public class BlockItem extends Item
Item.Settings
Modifier and Type | Field and Description |
---|---|
private Block |
block
Deprecated.
|
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group, RANDOM
Constructor and Description |
---|
BlockItem(Block block,
Item.Settings settings) |
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
@Deprecated private final Block block
public BlockItem(Block block, Item.Settings settings)
public ActionResult useOnBlock(ItemUsageContext context)
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()
.
useOnBlock
in class Item
context
- the usage contextpublic ActionResult place(ItemPlacementContext context)
protected SoundEvent getPlaceSound(BlockState state)
@Nullable public ItemPlacementContext getPlacementContext(ItemPlacementContext context)
protected boolean postPlacement(BlockPos pos, World world, @Nullable PlayerEntity player, ItemStack stack, BlockState state)
@Nullable protected BlockState getPlacementState(ItemPlacementContext context)
private BlockState placeFromTag(BlockPos pos, World world, ItemStack stack, BlockState state)
private static <T extends Comparable<T>> BlockState with(BlockState state, Property<T> property, String name)
protected boolean canPlace(ItemPlacementContext context, BlockState state)
protected boolean checkStatePlacement()
protected boolean place(ItemPlacementContext context, BlockState state)
public static boolean writeTagToBlockEntity(World world, @Nullable PlayerEntity player, BlockPos pos, ItemStack stack)
public String getTranslationKey()
getTranslationKey
in class Item
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks)
appendStacks
in class Item
@Environment(value=CLIENT) public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context)
appendTooltip
in class Item
public Block getBlock()