Class CompassItem

java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.CompassItem
All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension

public class CompassItem extends Item
  • Field Details

    • LODESTONE_COMPASS_NAME

      private static final Component LODESTONE_COMPASS_NAME
  • Constructor Details

  • Method Details

    • isFoil

      public boolean isFoil(ItemStack pStack)
      Returns true if this item has an enchantment glint. By default, this returns stack.isItemEnchanted(), but other items can override it (for instance, written books always return true). Note that if you override this method, you generally want to also call the super version (on Item) to get the glint for enchanted items. Of course, that is unnecessary if the overwritten version always returns true.
      Overrides:
      isFoil in class Item
    • inventoryTick

      public void inventoryTick(ItemStack pStack, ServerLevel pLevel, Entity pEntity, @Nullable EquipmentSlot pSlot)
      Overrides:
      inventoryTick in class Item
    • useOn

      public InteractionResult useOn(UseOnContext pContext)
      Called when this item is used when targeting a Block
      Overrides:
      useOn in class Item
    • getName

      public Component getName(ItemStack pStack)
      Overrides:
      getName in class Item