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:
AliasedBlockItem
,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/BlockItem
intermediary net/minecraft/class_1747
official csm
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext
-
Field Summary
Fields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, ITEM_BAR_STEPS, MAX_MAX_COUNT
Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendBlocks
(Map<Block, Item> map, Item item) void
appendTooltip
(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item.boolean
protected boolean
canPlace
(ItemPlacementContext context, BlockState state) protected boolean
private static void
copyComponentsToBlockEntity
(World world, BlockPos pos, ItemStack stack) getBlock()
getPlacementContext
(ItemPlacementContext context) protected @Nullable BlockState
getPlacementState
(ItemPlacementContext context) protected SoundEvent
getPlaceSound
(BlockState state) Gets the translation key of this item.void
onItemEntityDestroyed
(ItemEntity entity) Called on the server when anItemEntity
holding this item gets destroyed.place
(ItemPlacementContext context) protected boolean
place
(ItemPlacementContext context, BlockState state) private BlockState
placeFromNbt
(BlockPos pos, World world, ItemStack stack, BlockState state) protected boolean
postPlacement
(BlockPos pos, World world, @Nullable PlayerEntity player, ItemStack stack, BlockState state) static void
setBlockEntityData
(ItemStack stack, BlockEntityType<?> type, NbtCompound nbt) useOnBlock
(ItemUsageContext context) Called when an item is used on a block.static boolean
writeNbtToBlockEntity
(World world, @Nullable PlayerEntity player, BlockPos pos, ItemStack stack) Methods inherited from class net.minecraft.item.Item
asItem, byRawId, canMine, canRepair, finishUsing, fromBlock, getAttributeModifiers, getBonusAttackDamage, getBreakSound, getComponents, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getItemBarColor, getItemBarStep, getMaxCount, getMaxUseTime, getMiningSpeed, getName, getName, getOrCreateTranslationKey, getRawId, getRecipeRemainder, getRegistryEntry, getTooltipData, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isCorrectForDrops, isEnchantable, isItemBarVisible, isNetworkSynced, isUsedOnRelease, onClicked, onCraft, onCraftByPlayer, onStackClicked, onStoppedUsing, postDamageEntity, postHit, postMine, postProcessComponents, raycast, toString, usageTick, use, useOnEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
block
Deprecated.- Mappings:
Namespace Name Mixin selector named block
Lnet/minecraft/item/BlockItem;block:Lnet/minecraft/block/Block;
intermediary field_7901
Lnet/minecraft/class_1747;field_7901:Lnet/minecraft/class_2248;
official a
Lcsm;a:Ldfw;
-
-
Constructor Details
-
BlockItem
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/item/BlockItem;<init>(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item$Settings;)V
intermediary <init>
Lnet/minecraft/class_1747;<init>(Lnet/minecraft/class_2248;Lnet/minecraft/class_1792$class_1793;)V
official <init>
Lcsm;<init>(Ldfw;Lcuj$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:
useOnBlock
in 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 useOnBlock
Lnet/minecraft/item/Item;useOnBlock(Lnet/minecraft/item/ItemUsageContext;)Lnet/minecraft/util/ActionResult;
intermediary method_7884
Lnet/minecraft/class_1792;method_7884(Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269;
official a
Lcuj;a(Lcyd;)Lbqq;
-
place
- Mappings:
Namespace Name Mixin selector named place
Lnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;
intermediary method_7712
Lnet/minecraft/class_1747;method_7712(Lnet/minecraft/class_1750;)Lnet/minecraft/class_1269;
official a
Lcsm;a(Lcyb;)Lbqq;
-
getPlaceSound
- Mappings:
Namespace Name Mixin selector named getPlaceSound
Lnet/minecraft/item/BlockItem;getPlaceSound(Lnet/minecraft/block/BlockState;)Lnet/minecraft/sound/SoundEvent;
intermediary method_19260
Lnet/minecraft/class_1747;method_19260(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3414;
official a
Lcsm;a(Ldta;)Lavn;
-
getPlacementContext
- Mappings:
Namespace Name Mixin selector named getPlacementContext
Lnet/minecraft/item/BlockItem;getPlacementContext(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/item/ItemPlacementContext;
intermediary method_16356
Lnet/minecraft/class_1747;method_16356(Lnet/minecraft/class_1750;)Lnet/minecraft/class_1750;
official b
Lcsm;b(Lcyb;)Lcyb;
-
copyComponentsToBlockEntity
- Mappings:
Namespace Name Mixin selector named copyComponentsToBlockEntity
Lnet/minecraft/item/BlockItem;copyComponentsToBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)V
intermediary method_57339
Lnet/minecraft/class_1747;method_57339(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;)V
official a
Lcsm;a(Ldcu;Ljd;Lcuo;)V
-
postPlacement
protected boolean postPlacement(BlockPos pos, World world, @Nullable @Nullable PlayerEntity player, ItemStack stack, BlockState state) - Mappings:
Namespace Name Mixin selector named postPlacement
Lnet/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;)Z
intermediary method_7710
Lnet/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;)Z
official a
Lcsm;a(Ljd;Ldcu;Lcmv;Lcuo;Ldta;)Z
-
getPlacementState
- Mappings:
Namespace Name Mixin selector named getPlacementState
Lnet/minecraft/item/BlockItem;getPlacementState(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;
intermediary method_7707
Lnet/minecraft/class_1747;method_7707(Lnet/minecraft/class_1750;)Lnet/minecraft/class_2680;
official c
Lcsm;c(Lcyb;)Ldta;
-
placeFromNbt
- Mappings:
Namespace Name Mixin selector named placeFromNbt
Lnet/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_18084
Lnet/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 a
Lcsm;a(Ljd;Ldcu;Lcuo;Ldta;)Ldta;
-
canPlace
- Mappings:
Namespace Name Mixin selector named canPlace
Lnet/minecraft/item/BlockItem;canPlace(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Z
intermediary method_7709
Lnet/minecraft/class_1747;method_7709(Lnet/minecraft/class_1750;Lnet/minecraft/class_2680;)Z
official b
Lcsm;b(Lcyb;Ldta;)Z
-
checkStatePlacement
protected boolean checkStatePlacement()- Mappings:
Namespace Name Mixin selector named checkStatePlacement
Lnet/minecraft/item/BlockItem;checkStatePlacement()Z
intermediary method_20360
Lnet/minecraft/class_1747;method_20360()Z
official c
Lcsm;c()Z
-
place
- Mappings:
Namespace Name Mixin selector named place
Lnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Z
intermediary method_7708
Lnet/minecraft/class_1747;method_7708(Lnet/minecraft/class_1750;Lnet/minecraft/class_2680;)Z
official a
Lcsm;a(Lcyb;Ldta;)Z
-
writeNbtToBlockEntity
public static boolean writeNbtToBlockEntity(World world, @Nullable @Nullable PlayerEntity player, BlockPos pos, ItemStack stack) - Mappings:
Namespace Name Mixin selector named writeNbtToBlockEntity
Lnet/minecraft/item/BlockItem;writeNbtToBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)Z
intermediary method_7714
Lnet/minecraft/class_1747;method_7714(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;)Z
official a
Lcsm;a(Ldcu;Lcmv;Ljd;Lcuo;)Z
-
getTranslationKey
Gets the translation key of this item.- Overrides:
getTranslationKey
in classItem
- Mappings:
Namespace Name Mixin selector named getTranslationKey
Lnet/minecraft/item/Item;getTranslationKey()Ljava/lang/String;
intermediary method_7876
Lnet/minecraft/class_1792;method_7876()Ljava/lang/String;
official a
Lcuj;a()Ljava/lang/String;
-
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 totooltip
list.- Overrides:
appendTooltip
in classItem
- Parameters:
tooltip
- the list of tooltips to show- Mappings:
Namespace Name Mixin selector named appendTooltip
Lnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/Item$TooltipContext;Ljava/util/List;Lnet/minecraft/client/item/TooltipType;)V
intermediary method_7851
Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1792$class_9635;Ljava/util/List;Lnet/minecraft/class_1836;)V
official a
Lcuj;a(Lcuo;Lcuj$b;Ljava/util/List;Lcwk;)V
-
getBlock
- Mappings:
Namespace Name Mixin selector named getBlock
Lnet/minecraft/item/BlockItem;getBlock()Lnet/minecraft/block/Block;
intermediary method_7711
Lnet/minecraft/class_1747;method_7711()Lnet/minecraft/class_2248;
official d
Lcsm;d()Ldfw;
-
appendBlocks
- Mappings:
Namespace Name Mixin selector named appendBlocks
Lnet/minecraft/item/BlockItem;appendBlocks(Ljava/util/Map;Lnet/minecraft/item/Item;)V
intermediary method_7713
Lnet/minecraft/class_1747;method_7713(Ljava/util/Map;Lnet/minecraft/class_1792;)V
official a
Lcsm;a(Ljava/util/Map;Lcuj;)V
-
canBeNested
public boolean canBeNested()- Overrides:
canBeNested
in classItem
- Returns:
- true if the item can be placed inside of shulker boxes or bundles.
- Mappings:
Namespace Name Mixin selector named canBeNested
Lnet/minecraft/item/Item;canBeNested()Z
intermediary method_31568
Lnet/minecraft/class_1792;method_31568()Z
official an_
Lcuj;an_()Z
-
onItemEntityDestroyed
Called on the server when anItemEntity
holding 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:
onItemEntityDestroyed
in classItem
- See Also:
- Mappings:
Namespace Name Mixin selector named onItemEntityDestroyed
Lnet/minecraft/item/Item;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)V
intermediary method_33261
Lnet/minecraft/class_1792;method_33261(Lnet/minecraft/class_1542;)V
official a
Lcuj;a(Lcjf;)V
-
setBlockEntityData
- Mappings:
Namespace Name Mixin selector named setBlockEntityData
Lnet/minecraft/item/BlockItem;setBlockEntityData(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/entity/BlockEntityType;Lnet/minecraft/nbt/NbtCompound;)V
intermediary method_57338
Lnet/minecraft/class_1747;method_57338(Lnet/minecraft/class_1799;Lnet/minecraft/class_2591;Lnet/minecraft/class_2487;)V
official a
Lcsm;a(Lcuo;Ldqh;Lua;)V
-
getRequiredFeatures
- Specified by:
getRequiredFeatures
in interfaceToggleableFeature
- Overrides:
getRequiredFeatures
in classItem
- Mappings:
Namespace Name Mixin selector named getRequiredFeatures
Lnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;
intermediary method_45322
Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;
official i
Lcpg;i()Lcpj;
-