public class DebugStickItem extends Item
Item.Settings
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group, RANDOM
Constructor and Description |
---|
DebugStickItem(Item.Settings settings) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMine(BlockState state,
World world,
BlockPos pos,
PlayerEntity miner)
Checks if a player can break a block while holding the item.
|
private static <T extends Comparable<T>> |
cycle(BlockState state,
Property<T> property,
boolean inverse) |
private static <T> T |
cycle(Iterable<T> elements,
T current,
boolean inverse) |
private static <T extends Comparable<T>> |
getValueString(BlockState state,
Property<T> property) |
boolean |
hasGlint(ItemStack stack)
Checks if the glint effect should be applied when the item is rendered.
|
private static void |
sendMessage(PlayerEntity player,
Text message) |
private void |
use(PlayerEntity player,
BlockState state,
WorldAccess world,
BlockPos pos,
boolean update,
ItemStack stack) |
ActionResult |
useOnBlock(ItemUsageContext context)
Called when an item is used on a block.
|
appendStacks, appendTooltip, asItem, byRawId, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getTranslationKey, getUseAction, hasRecipeRemainder, inventoryTick, isDamageable, isEffectiveOn, isEnchantable, isFireproof, isFood, isIn, isIn, isNetworkSynced, isUsedOnRelease, onCraft, onStoppedUsing, postHit, postMine, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, use, useOnEntity
public DebugStickItem(Item.Settings settings)
public boolean hasGlint(ItemStack stack)
By default, returns true if the item has enchantments.
public boolean canMine(BlockState state, World world, BlockPos pos, PlayerEntity miner)
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 contextprivate void use(PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos, boolean update, ItemStack stack)
private static <T extends Comparable<T>> BlockState cycle(BlockState state, Property<T> property, boolean inverse)
private static void sendMessage(PlayerEntity player, Text message)
private static <T extends Comparable<T>> String getValueString(BlockState state, Property<T> property)