Class ItemType

java.lang.Object
net.glowstone.block.itemtype.ItemType
Direct Known Subclasses:
BlockType, ItemArmorStand, ItemBanner, ItemBoat, ItemBucket, ItemDye, ItemEndCrystal, ItemEnderPearl, ItemFilledBucket, ItemFirework, ItemFishingRod, ItemItemFrame, ItemKnowledgeBook, ItemMinecart, ItemPainting, ItemPlaceAs, ItemProjectile, ItemSeeds, ItemSign, ItemSpawn, ItemTimedUsage, ItemTool, ItemWrittenBook

public class ItemType extends Object
Base class for specific types of items.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Context of the Items interaction.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the context this item can be used in.
    final org.bukkit.Material
    Deprecated.
    ItemTypes can be assigned to multiple materials.
    final com.google.common.collect.ImmutableList<org.bukkit.Material>
    Get the Materials assigned to this ItemType.
    int
    The maximum stack size of the item.
    The type of block to place when the item is used.
    void
    rightClickAir(GlowPlayer player, org.bukkit.inventory.ItemStack holding)
    Called when a player right-clicks in midair while holding this item.
    void
    rightClickBlock(GlowPlayer player, GlowBlock target, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding, org.bukkit.util.Vector clickedLoc, org.bukkit.inventory.EquipmentSlot hand)
    Called when a player right-clicks on a block while holding this item.
    final void
    setMaterial(org.bukkit.Material material)
    Assign a Material to this ItemType (for internal use only).
    protected void
    setMaxStackSize(int maxStackSize)
    The maximum stack size of the item.
    protected final void
    Set this item to act like the given block type when being placed.
    protected final void
    setPlaceAs(org.bukkit.Material placeAs)
    Set this item to act like the given block type when being placed.
    final String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ItemType

      public ItemType()
  • Method Details

    • getMaterial

      @Deprecated public final org.bukkit.Material getMaterial()
      Deprecated.
      ItemTypes can be assigned to multiple materials. Use getMaterials.
      Get the Material assigned to this ItemType.
      Returns:
      The corresponding Material.
    • setMaterial

      public final void setMaterial(org.bukkit.Material material)
      Assign a Material to this ItemType (for internal use only).
      Parameters:
      material - The internal material for this item.
    • getMaterials

      public final com.google.common.collect.ImmutableList<org.bukkit.Material> getMaterials()
      Get the Materials assigned to this ItemType.
      Returns:
      The Materials.
    • setPlaceAs

      protected final void setPlaceAs(org.bukkit.Material placeAs)
      Set this item to act like the given block type when being placed.
      Parameters:
      placeAs - The material to place as.
    • setPlaceAs

      protected final void setPlaceAs(BlockType placeAs)
      Set this item to act like the given block type when being placed.
      Parameters:
      placeAs - The block to place as.
    • rightClickAir

      public void rightClickAir(GlowPlayer player, org.bukkit.inventory.ItemStack holding)
      Called when a player right-clicks in midair while holding this item. Also called by default if rightClickBlock is not overridden.
      Parameters:
      player - The player
      holding - The ItemStack the player was holding
    • getContext

      public ItemType.Context getContext()
      Get the context this item can be used in.
      Returns:
      context of the item, default is {ItemType.Context.BLOCK}
    • rightClickBlock

      public void rightClickBlock(GlowPlayer player, GlowBlock target, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding, org.bukkit.util.Vector clickedLoc, org.bukkit.inventory.EquipmentSlot hand)
      Called when a player right-clicks on a block while holding this item.
      Parameters:
      player - The player
      target - The block the player right-clicked
      face - The face on which the click occurred
      holding - The ItemStack the player was holding
      clickedLoc - The coordinates at which the click occurred
      hand - The hand slot of this item
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getPlaceAs

      public BlockType getPlaceAs()
      The type of block to place when the item is used.
      Returns:
      the type of block to place
    • getMaxStackSize

      public int getMaxStackSize()
      The maximum stack size of the item.
      Returns:
      The maximum stack size.
    • setMaxStackSize

      protected void setMaxStackSize(int maxStackSize)
      The maximum stack size of the item.