Class CompassItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.CompassItem
All Implemented Interfaces:
ItemConvertible, Vanishable

public class CompassItem
extends Item
implements Vanishable
  • Field Details

    • field_24670

      private static final Logger field_24670
  • Constructor Details

  • Method Details

    • hasLodestone

      public static boolean hasLodestone​(ItemStack stack)
    • hasGlint

      public boolean hasGlint​(ItemStack stack)
      Checks if the glint effect should be applied when the item is rendered.

      By default, returns true if the item has enchantments.

      Overrides:
      hasGlint in class Item
    • getLodestoneDimension

      public static Optional<RegistryKey<World>> getLodestoneDimension​(CompoundTag tag)
    • inventoryTick

      public void inventoryTick​(ItemStack stack, World world, Entity entity, int slot, boolean selected)
      Overrides:
      inventoryTick in class Item
    • useOnBlock

      public ActionResult useOnBlock​(ItemUsageContext context)
      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 class Item
      Parameters:
      context - the usage context
      Returns:
      an action result that specifies if using the item on a block was successful.
    • method_27315

      private void method_27315​(RegistryKey<World> registryKey, BlockPos blockPos, CompoundTag compoundTag)
    • getTranslationKey

      public String getTranslationKey​(ItemStack stack)
      Gets the translation key of this item using the provided item stack for context.
      Overrides:
      getTranslationKey in class Item