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
  • Constructor Details

  • Method Details

    • getSpawnPosition

      @Nullable public static GlobalPos getSpawnPosition(Level pLevel)
    • 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, Level pLevel, Entity pEntity, int pItemSlot, boolean pIsSelected)
      Called each tick as long the item is in a player's inventory. Used by maps to check if it's in a player's hand and update its contents.
      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
    • getDescriptionId

      public String getDescriptionId(ItemStack pStack)
      Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.
      Overrides:
      getDescriptionId in class Item