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 cys
-
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_BLOCKS_ATTACKS_MAX_USE_TIME, DEFAULT_MAX_COUNT, ENTRY_CODEC, ENTRY_PACKET_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) 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
appendTooltip, asItem, byRawId, canMine, finishUsing, fromBlock, getBonusAttackDamage, 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 aLcys;a:Ldno;
-
-
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>Lcys;<init>(Ldno;Ldag$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 aLdag;a(Ldef;)Lbvc;
-
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 aLcys;a(Lded;)Lbvc;
-
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 aLcys;a(Lebq;)Lawx;
-
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 bLcys;b(Lded;)Lded;
-
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 aLcys;a(Ldkj;Liw;Ldak;)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 aLcys;a(Liw;Ldkj;Lcsi;Ldak;Lebq;)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 cLcys;c(Lded;)Lebq;
-
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 aLcys;a(Liw;Ldkj;Ldak;Lebq;)Lebq;
-
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 bLcys;b(Lded;Lebq;)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 bLcys;b()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 aLcys;a(Lded;Lebq;)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 aLcys;a(Ldkj;Lcsi;Liw;Ldak;)Z
-
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 aLdag;a(Ldak;Lcsi;)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 cLcys;c()Ldno;
-
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 aLcys;a(Ljava/util/Map;Ldag;)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 dLdag;d()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 aLdag;a(Lcoo;)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 aLcys;a(Ldak;Ldyq;Lua;)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 kLcvp;k()Lcvs;
-