Package net.glowstone.block.itemtype
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
Base class for specific types of items.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet 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
setPlaceAs
(BlockType placeAs) 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
toString()
-
Constructor Details
-
ItemType
public ItemType()
-
-
Method Details
-
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
Set this item to act like the given block type when being placed.- Parameters:
placeAs
- The block to place as.
-
rightClickAir
Called when a player right-clicks in midair while holding this item. Also called by default if rightClickBlock is not overridden.- Parameters:
player
- The playerholding
- The ItemStack the player was holding
-
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 playertarget
- The block the player right-clickedface
- The face on which the click occurredholding
- The ItemStack the player was holdingclickedLoc
- The coordinates at which the click occurredhand
- The hand slot of this item
-
toString
-
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.
-