Class MaterialData

java.lang.Object
org.bukkit.material.MaterialData
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Banner, Bed, Cake, Cauldron, Coal, CocoaPlant, Command, Crops, Diode, DirectionalContainer, Door, Dye, FlowerPot, Gate, Leaves, LongGrass, Mushroom, NetherWarts, PistonBaseMaterial, PistonExtensionMaterial, PressurePlate, Pumpkin, Rails, RedstoneWire, Sandstone, Sign, SimpleAttachableMaterialData, Skull, SpawnEgg, Stairs, TexturedMaterial, Tree, Tripwire, Vine, WoodenStep, Wool

public class MaterialData
extends java.lang.Object
implements java.lang.Cloneable
Handles specific metadata for certain items or blocks
  • Constructor Summary

    Constructors 
    Constructor Description
    MaterialData​(int type)
    Deprecated.
    Magic value
    MaterialData​(int type, byte data)
    Deprecated.
    Magic value
    MaterialData​(Material type)  
    MaterialData​(Material type, byte data)
    Deprecated.
    Magic value
  • Method Summary

    Modifier and Type Method Description
    MaterialData clone()  
    boolean equals​(java.lang.Object obj)  
    byte getData()
    Deprecated.
    Magic value
    Material getItemType()
    Gets the Material that this MaterialData represents
    int getItemTypeId()
    Deprecated.
    Magic value
    int hashCode()  
    void setData​(byte data)
    Deprecated.
    Magic value
    ItemStack toItemStack()
    Creates a new ItemStack based on this MaterialData
    ItemStack toItemStack​(int amount)
    Creates a new ItemStack based on this MaterialData
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MaterialData

      @Deprecated public MaterialData​(int type)
      Deprecated.
      Magic value
      Parameters:
      type - the raw type id
    • MaterialData

      public MaterialData​(Material type)
    • MaterialData

      @Deprecated public MaterialData​(int type, byte data)
      Deprecated.
      Magic value
      Parameters:
      type - the raw type id
      data - the raw data value
    • MaterialData

      @Deprecated public MaterialData​(Material type, byte data)
      Deprecated.
      Magic value
      Parameters:
      type - the type
      data - the raw data value
  • Method Details

    • getData

      @Deprecated public byte getData()
      Deprecated.
      Magic value
      Gets the raw data in this material
      Returns:
      Raw data
    • setData

      @Deprecated public void setData​(byte data)
      Deprecated.
      Magic value
      Sets the raw data of this material
      Parameters:
      data - New raw data
    • getItemType

      public Material getItemType()
      Gets the Material that this MaterialData represents
      Returns:
      Material represented by this MaterialData
    • getItemTypeId

      @Deprecated public int getItemTypeId()
      Deprecated.
      Magic value
      Gets the Material Id that this MaterialData represents
      Returns:
      Material Id represented by this MaterialData
    • toItemStack

      public ItemStack toItemStack()
      Creates a new ItemStack based on this MaterialData
      Returns:
      New ItemStack containing a copy of this MaterialData
    • toItemStack

      public ItemStack toItemStack​(int amount)
      Creates a new ItemStack based on this MaterialData
      Parameters:
      amount - The stack size of the new stack
      Returns:
      New ItemStack containing a copy of this MaterialData
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • clone

      public MaterialData clone()
      Overrides:
      clone in class java.lang.Object