Package net.minecraft.item
Class BlockItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.BlockItem
- All Implemented Interfaces:
ItemConvertible
- Direct Known Subclasses:
AliasedBlockItem
,BedItem
,CommandBlockItem
,LilyPadItem
,ScaffoldingItem
,TallBlockItem
,WallStandingBlockItem
public class BlockItem extends Item
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings
-
Field Summary
Fields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group, RANDOM
-
Constructor Summary
Constructors Constructor Description BlockItem(Block block, Item.Settings settings)
-
Method Summary
Methods inherited from class net.minecraft.item.Item
asItem, byRawId, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEffectiveOn, isEnchantable, isFireproof, isFood, isIn, isIn, isNetworkSynced, isUsedOnRelease, onCraft, onStoppedUsing, postHit, postMine, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, use, useOnEntity
-
Field Details
-
block
Deprecated.
-
-
Constructor Details
-
BlockItem
-
-
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.
-
place
-
getPlaceSound
-
getPlacementContext
-
postPlacement
protected boolean postPlacement(BlockPos pos, World world, @Nullable PlayerEntity player, ItemStack stack, BlockState state) -
getPlacementState
-
placeFromTag
-
with
private static <T extends Comparable<T>> BlockState with(BlockState state, Property<T> property, String name) -
canPlace
-
checkStatePlacement
protected boolean checkStatePlacement() -
place
-
writeTagToBlockEntity
public static boolean writeTagToBlockEntity(World world, @Nullable PlayerEntity player, BlockPos pos, ItemStack stack) -
getTranslationKey
Gets the translation key of this item.- Overrides:
getTranslationKey
in classItem
-
appendStacks
- Overrides:
appendStacks
in classItem
-
appendTooltip
@Environment(CLIENT) public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context)- Overrides:
appendTooltip
in classItem
-
getBlock
-
appendBlocks
-