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/BlockItemintermediary net/minecraft/class_1747official cso
-
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, ITEM_BAR_STEPS, MAX_MAX_COUNTFields 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) Gets the translation key of this item.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) 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, 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, 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 aLcso;a:Ldfy;
-
-
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>Lcso;<init>(Ldfy;Lcul$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 aLcul;a(Lcyf;)Lbqr;
-
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 aLcso;a(Lcyd;)Lbqr;
-
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 aLcso;a(Ldtc;)Lavo;
-
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 bLcso;b(Lcyd;)Lcyd;
-
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 aLcso;a(Ldcw;Ljd;Lcuq;)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 aLcso;a(Ljd;Ldcw;Lcmx;Lcuq;Ldtc;)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 cLcso;c(Lcyd;)Ldtc;
-
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 aLcso;a(Ljd;Ldcw;Lcuq;Ldtc;)Ldtc;
-
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 bLcso;b(Lcyd;Ldtc;)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 cLcso;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 aLcso;a(Lcyd;Ldtc;)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 aLcso;a(Ldcw;Lcmx;Ljd;Lcuq;)Z
-
getTranslationKey
Gets the translation key of this item.- Overrides:
getTranslationKeyin classItem- Mappings:
Namespace Name Mixin selector named getTranslationKeyLnet/minecraft/item/Item;getTranslationKey()Ljava/lang/String;intermediary method_7876Lnet/minecraft/class_1792;method_7876()Ljava/lang/String;official aLcul;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 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 aLcul;a(Lcuq;Lcul$b;Ljava/util/List;Lcwm;)V
-
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 dLcso;d()Ldfy;
-
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 aLcso;a(Ljava/util/Map;Lcul;)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 ar_Lcul;ar_()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 aLcul;a(Lcjh;)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 aLcso;a(Lcuq;Ldqj;Lub;)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 iLcpi;i()Lcpl;
-