Package net.minecraft.item
Class BlockItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.BlockItem
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Direct Known Subclasses:
BedItem,OperatorOnlyBlockItem,PlaceableOnWaterItem,PowderSnowBucketItem,ScaffoldingItem,TallBlockItem,VerticallyAttachableBlockItem
Represents an item corresponding to a block. Using this item places a
block in the world.
- Mappings:
Namespace Name named net/minecraft/item/BlockItemintermediary net/minecraft/class_1747official cut
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext -
Field Summary
FieldsFields inherited from class net.minecraft.item.Item
BASE_ATTACK_DAMAGE_MODIFIER_ID, BASE_ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, ENTRY_CODEC, ITEM_BAR_STEPS, MAX_MAX_COUNT, translationKeyFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendBlocks(Map<Block, Item> map, Item item) voidappendTooltip(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item.booleanprotected booleancanPlace(ItemPlacementContext context, BlockState state) protected booleanprivate static voidcopyComponentsToBlockEntity(World world, BlockPos pos, ItemStack stack) getBlock()private static @Nullable BlockEntityType<?> getBlockEntityId(RegistryWrapper.WrapperLookup registries, NbtComponent nbt) getPlacementContext(ItemPlacementContext context) protected @Nullable BlockStategetPlacementState(ItemPlacementContext context) protected SoundEventgetPlaceSound(BlockState state) voidonItemEntityDestroyed(ItemEntity entity) Called on the server when anItemEntityholding this item gets destroyed.place(ItemPlacementContext context) protected booleanplace(ItemPlacementContext context, BlockState state) private BlockStateplaceFromNbt(BlockPos pos, World world, ItemStack stack, BlockState state) protected booleanpostPlacement(BlockPos pos, World world, @Nullable PlayerEntity player, ItemStack stack, BlockState state) static voidsetBlockEntityData(ItemStack stack, BlockEntityType<?> type, NbtCompound nbt) static booleanshouldShowOperatorBlockWarnings(ItemStack stack, @Nullable PlayerEntity player) useOnBlock(ItemUsageContext context) Called when an item is used on a block.static booleanwriteNbtToBlockEntity(World world, @Nullable PlayerEntity player, BlockPos pos, ItemStack stack) Methods inherited from class net.minecraft.item.Item
asItem, byRawId, canMine, finishUsing, fromBlock, getBonusAttackDamage, getBreakSound, getComponents, getDamageSource, getDefaultStack, getItemBarColor, getItemBarStep, getMaxCount, getMaxUseTime, getMiningSpeed, getName, getName, getRawId, getRecipeRemainder, getRegistryEntry, getTooltipData, getTranslationKey, getUseAction, hasGlint, inventoryTick, isCorrectForDrops, isItemBarVisible, isUsedOnRelease, onClicked, onCraft, onCraftByPlayer, onStackClicked, onStoppedUsing, postDamageEntity, postHit, postMine, postProcessComponents, raycast, toString, usageTick, use, useOnEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
OPERATOR_BLOCK_WARNINGS
- Mappings:
Namespace Name Mixin selector named OPERATOR_BLOCK_WARNINGSLnet/minecraft/item/BlockItem;OPERATOR_BLOCK_WARNINGS:Ljava/util/List;intermediary field_55205Lnet/minecraft/class_1747;field_55205:Ljava/util/List;official aLcut;a:Ljava/util/List;
-
block
Deprecated.- Mappings:
Namespace Name Mixin selector named blockLnet/minecraft/item/BlockItem;block:Lnet/minecraft/block/Block;intermediary field_7901Lnet/minecraft/class_1747;field_7901:Lnet/minecraft/class_2248;official bLcut;b:Ldjk;
-
-
Constructor Details
-
BlockItem
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/item/BlockItem;<init>(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item$Settings;)Vintermediary <init>Lnet/minecraft/class_1747;<init>(Lnet/minecraft/class_2248;Lnet/minecraft/class_1792$class_1793;)Vofficial <init>Lcut;<init>(Ldjk;Lcwj$a;)V
-
-
Method Details
-
useOnBlock
Called when an item is used on a block.This method is called on both the logical client and logical server, so take caution when using this method. The logical side can be checked using
context.getWorld().isClient().- Overrides:
useOnBlockin classItem- Parameters:
context- the usage context- Returns:
- an action result that specifies if using the item on a block was successful.
- Mappings:
Namespace Name Mixin selector named useOnBlockLnet/minecraft/item/Item;useOnBlock(Lnet/minecraft/item/ItemUsageContext;)Lnet/minecraft/util/ActionResult;intermediary method_7884Lnet/minecraft/class_1792;method_7884(Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269;official aLcwj;a(Ldag;)Lbsi;
-
place
- Mappings:
Namespace Name Mixin selector named placeLnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;intermediary method_7712Lnet/minecraft/class_1747;method_7712(Lnet/minecraft/class_1750;)Lnet/minecraft/class_1269;official aLcut;a(Ldae;)Lbsi;
-
getPlaceSound
- Mappings:
Namespace Name Mixin selector named getPlaceSoundLnet/minecraft/item/BlockItem;getPlaceSound(Lnet/minecraft/block/BlockState;)Lnet/minecraft/sound/SoundEvent;intermediary method_19260Lnet/minecraft/class_1747;method_19260(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3414;official aLcut;a(Ldwv;)Lavy;
-
getPlacementContext
- Mappings:
Namespace Name Mixin selector named getPlacementContextLnet/minecraft/item/BlockItem;getPlacementContext(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/item/ItemPlacementContext;intermediary method_16356Lnet/minecraft/class_1747;method_16356(Lnet/minecraft/class_1750;)Lnet/minecraft/class_1750;official bLcut;b(Ldae;)Ldae;
-
copyComponentsToBlockEntity
- Mappings:
Namespace Name Mixin selector named copyComponentsToBlockEntityLnet/minecraft/item/BlockItem;copyComponentsToBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)Vintermediary method_57339Lnet/minecraft/class_1747;method_57339(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;)Vofficial aLcut;a(Ldgg;Lji;Lcwn;)V
-
postPlacement
protected boolean postPlacement(BlockPos pos, World world, @Nullable @Nullable PlayerEntity player, ItemStack stack, BlockState state) - Mappings:
Namespace Name Mixin selector named postPlacementLnet/minecraft/item/BlockItem;postPlacement(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/BlockState;)Zintermediary method_7710Lnet/minecraft/class_1747;method_7710(Lnet/minecraft/class_2338;Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;Lnet/minecraft/class_2680;)Zofficial aLcut;a(Lji;Ldgg;Lcov;Lcwn;Ldwv;)Z
-
getPlacementState
- Mappings:
Namespace Name Mixin selector named getPlacementStateLnet/minecraft/item/BlockItem;getPlacementState(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;intermediary method_7707Lnet/minecraft/class_1747;method_7707(Lnet/minecraft/class_1750;)Lnet/minecraft/class_2680;official cLcut;c(Ldae;)Ldwv;
-
placeFromNbt
- Mappings:
Namespace Name Mixin selector named placeFromNbtLnet/minecraft/item/BlockItem;placeFromNbt(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/BlockState;intermediary method_18084Lnet/minecraft/class_1747;method_18084(Lnet/minecraft/class_2338;Lnet/minecraft/class_1937;Lnet/minecraft/class_1799;Lnet/minecraft/class_2680;)Lnet/minecraft/class_2680;official aLcut;a(Lji;Ldgg;Lcwn;Ldwv;)Ldwv;
-
canPlace
- Mappings:
Namespace Name Mixin selector named canPlaceLnet/minecraft/item/BlockItem;canPlace(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Zintermediary method_7709Lnet/minecraft/class_1747;method_7709(Lnet/minecraft/class_1750;Lnet/minecraft/class_2680;)Zofficial bLcut;b(Ldae;Ldwv;)Z
-
checkStatePlacement
protected boolean checkStatePlacement()- Mappings:
Namespace Name Mixin selector named checkStatePlacementLnet/minecraft/item/BlockItem;checkStatePlacement()Zintermediary method_20360Lnet/minecraft/class_1747;method_20360()Zofficial cLcut;c()Z
-
place
- Mappings:
Namespace Name Mixin selector named placeLnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Zintermediary method_7708Lnet/minecraft/class_1747;method_7708(Lnet/minecraft/class_1750;Lnet/minecraft/class_2680;)Zofficial aLcut;a(Ldae;Ldwv;)Z
-
writeNbtToBlockEntity
public static boolean writeNbtToBlockEntity(World world, @Nullable @Nullable PlayerEntity player, BlockPos pos, ItemStack stack) - Mappings:
Namespace Name Mixin selector named writeNbtToBlockEntityLnet/minecraft/item/BlockItem;writeNbtToBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)Zintermediary method_7714Lnet/minecraft/class_1747;method_7714(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;)Zofficial aLcut;a(Ldgg;Lcov;Lji;Lcwn;)Z
-
getBlockEntityId
@Nullable private static @Nullable BlockEntityType<?> getBlockEntityId(RegistryWrapper.WrapperLookup registries, NbtComponent nbt) - Mappings:
Namespace Name Mixin selector named getBlockEntityIdLnet/minecraft/item/BlockItem;getBlockEntityId(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;Lnet/minecraft/component/type/NbtComponent;)Lnet/minecraft/block/entity/BlockEntityType;intermediary method_65128Lnet/minecraft/class_1747;method_65128(Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_9279;)Lnet/minecraft/class_2591;official aLcut;a(Ljt$a;Lcyw;)Ldtz;
-
appendTooltip
public void appendTooltip(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item. Subclasses can override this and add custom tooltips totooltiplist.- Overrides:
appendTooltipin classItem- Parameters:
tooltip- the list of tooltips to show- Mappings:
Namespace Name Mixin selector named appendTooltipLnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/Item$TooltipContext;Ljava/util/List;Lnet/minecraft/item/tooltip/TooltipType;)Vintermediary method_7851Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1792$class_9635;Ljava/util/List;Lnet/minecraft/class_1836;)Vofficial aLcwj;a(Lcwn;Lcwj$b;Ljava/util/List;Lcyf;)V
-
shouldShowOperatorBlockWarnings
public static boolean shouldShowOperatorBlockWarnings(ItemStack stack, @Nullable @Nullable PlayerEntity player) - Mappings:
Namespace Name Mixin selector named shouldShowOperatorBlockWarningsLnet/minecraft/item/BlockItem;shouldShowOperatorBlockWarnings(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;)Zintermediary method_65353Lnet/minecraft/class_1747;method_65353(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;)Zofficial aLcut;a(Lcwn;Lcov;)Z
-
getBlock
- Mappings:
Namespace Name Mixin selector named getBlockLnet/minecraft/item/BlockItem;getBlock()Lnet/minecraft/block/Block;intermediary method_7711Lnet/minecraft/class_1747;method_7711()Lnet/minecraft/class_2248;official dLcut;d()Ldjk;
-
appendBlocks
- Mappings:
Namespace Name Mixin selector named appendBlocksLnet/minecraft/item/BlockItem;appendBlocks(Ljava/util/Map;Lnet/minecraft/item/Item;)Vintermediary method_7713Lnet/minecraft/class_1747;method_7713(Ljava/util/Map;Lnet/minecraft/class_1792;)Vofficial aLcut;a(Ljava/util/Map;Lcwj;)V
-
canBeNested
public boolean canBeNested()- Overrides:
canBeNestedin classItem- Returns:
- true if the item can be placed inside of shulker boxes or bundles.
- Mappings:
Namespace Name Mixin selector named canBeNestedLnet/minecraft/item/Item;canBeNested()Zintermediary method_31568Lnet/minecraft/class_1792;method_31568()Zofficial eLcwj;e()Z
-
onItemEntityDestroyed
Called on the server when anItemEntityholding this item gets destroyed. This can happen due to fire, lava, cactus, explosion, etc. Items that can hold other items should override this to drop its contents.- Overrides:
onItemEntityDestroyedin classItem- See Also:
- Mappings:
Namespace Name Mixin selector named onItemEntityDestroyedLnet/minecraft/item/Item;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)Vintermediary method_33261Lnet/minecraft/class_1792;method_33261(Lnet/minecraft/class_1542;)Vofficial aLcwj;a(Lcla;)V
-
setBlockEntityData
- Mappings:
Namespace Name Mixin selector named setBlockEntityDataLnet/minecraft/item/BlockItem;setBlockEntityData(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/entity/BlockEntityType;Lnet/minecraft/nbt/NbtCompound;)Vintermediary method_57338Lnet/minecraft/class_1747;method_57338(Lnet/minecraft/class_1799;Lnet/minecraft/class_2591;Lnet/minecraft/class_2487;)Vofficial aLcut;a(Lcwn;Ldtz;Ltq;)V
-
getRequiredFeatures
- Specified by:
getRequiredFeaturesin interfaceToggleableFeature- Overrides:
getRequiredFeaturesin classItem- Mappings:
Namespace Name Mixin selector named getRequiredFeaturesLnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;intermediary method_45322Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;official iLcro;i()Lcrr;
-