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 cuw
-
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()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) 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
-
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 aLcuw;a:Ldjn;
-
-
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>Lcuw;<init>(Ldjn;Lcwm$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 aLcwm;a(Ldaj;)Lbsl;
-
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 aLcuw;a(Ldah;)Lbsl;
-
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 aLcuw;a(Ldwy;)Lavz;
-
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 bLcuw;b(Ldah;)Ldah;
-
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 aLcuw;a(Ldgj;Lji;Lcwq;)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 aLcuw;a(Lji;Ldgj;Lcoy;Lcwq;Ldwy;)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 cLcuw;c(Ldah;)Ldwy;
-
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 aLcuw;a(Lji;Ldgj;Lcwq;Ldwy;)Ldwy;
-
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 bLcuw;b(Ldah;Ldwy;)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 cLcuw;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 aLcuw;a(Ldah;Ldwy;)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 aLcuw;a(Ldgj;Lcoy;Lji;Lcwq;)Z
-
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 aLcwm;a(Lcwq;Lcwm$b;Ljava/util/List;Lcyi;)V
-
shouldShowOperatorBlockWarnings
public boolean shouldShowOperatorBlockWarnings(ItemStack stack, @Nullable @Nullable PlayerEntity player) - Overrides:
shouldShowOperatorBlockWarningsin classItem- Mappings:
Namespace Name Mixin selector named shouldShowOperatorBlockWarningsLnet/minecraft/item/Item;shouldShowOperatorBlockWarnings(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;)Zintermediary method_65353Lnet/minecraft/class_1792;method_65353(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;)Zofficial aLcwm;a(Lcwq;Lcoy;)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 dLcuw;d()Ldjn;
-
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 aLcuw;a(Ljava/util/Map;Lcwm;)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 eLcwm;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 aLcwm;a(Lcld;)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 aLcuw;a(Lcwq;Lduc;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 iLcrr;i()Lcru;
-