public class BlockType extends ItemType
ItemType.Context| Modifier and Type | Field and Description |
|---|---|
protected static org.bukkit.block.BlockFace[] |
ADJACENT |
protected List<org.bukkit.inventory.ItemStack> |
drops |
protected SoundInfo |
placeSound
Gets the sound that will be played when a player places the block.
|
protected static org.bukkit.block.BlockFace[] |
SIDES |
| Constructor and Description |
|---|
BlockType() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterDestroy(GlowPlayer player,
GlowBlock block,
org.bukkit.block.BlockFace face,
GlowBlockState oldState)
Called after a player successfully destroys a block.
|
void |
afterPlace(GlowPlayer player,
GlowBlock block,
org.bukkit.inventory.ItemStack holding,
GlowBlockState oldState)
Called after a block has been placed by a player.
|
void |
blockDestroy(GlowPlayer player,
GlowBlock block,
org.bukkit.block.BlockFace face)
Called when a player attempts to destroy a block.
|
boolean |
blockInteract(GlowPlayer player,
GlowBlock block,
org.bukkit.block.BlockFace face,
org.bukkit.util.Vector clickedLoc)
Called when a player attempts to interact with (right-click) a block of this type already in
the world.
|
boolean |
canAbsorb(GlowBlock block,
org.bukkit.block.BlockFace face,
org.bukkit.inventory.ItemStack holding)
Called when a player attempts to place a block on an existing block of this type.
|
boolean |
canOverride(GlowBlock block,
org.bukkit.block.BlockFace face,
org.bukkit.inventory.ItemStack holding)
Called to check if this block can be overridden by a block place which would occur inside it.
|
boolean |
canPlaceAt(GlowPlayer player,
GlowBlock block,
org.bukkit.block.BlockFace against)
Check whether the block can be placed at the given location.
|
boolean |
canTickRandomly()
Called to check if this block can perform random tick updates.
|
BlockEntity |
createBlockEntity(GlowChunk chunk,
int cx,
int cy,
int cz)
Create a new block entity at the given location.
|
Collection<org.bukkit.inventory.ItemStack> |
getDrops(GlowBlock block,
org.bukkit.inventory.ItemStack tool)
Get the items that will be dropped by digging the block.
|
Collection<org.bukkit.inventory.ItemStack> |
getMinedDrops(GlowBlock block)
Get the items that would be dropped if the block was successfully mined.
|
protected static org.bukkit.block.BlockFace |
getOppositeBlockFace(org.bukkit.Location location,
boolean inverted)
Gets the BlockFace opposite of the direction the location is facing.
|
BlockType |
getPlaceAs()
The type of block to place when the item is used.
|
SoundInfo |
getPlaceSound()
Gets the sound that will be played when a player places the block.
|
int |
getPulseTickSpeed(GlowBlock block)
The rate at which the block should be pulsed.
|
boolean |
isPulseOnce(GlowBlock block)
Whether the block should only be pulsed once.
|
void |
leftClickBlock(GlowPlayer player,
GlowBlock block,
org.bukkit.inventory.ItemStack holding)
Called when a player left clicks a block.
|
void |
onBlockChanged(GlowBlock block,
org.bukkit.Material oldType,
byte oldData,
org.bukkit.Material newType,
byte data)
Called when this block has just changed to some other type.
|
void |
onEntityStep(GlowBlock block,
org.bukkit.entity.LivingEntity entity)
Called when an entity gets updated on top of the block.
|
void |
onNearBlockChanged(GlowBlock block,
org.bukkit.block.BlockFace face,
GlowBlock changedBlock,
org.bukkit.Material oldType,
byte oldData,
org.bukkit.Material newType,
byte newData)
Called when a neighboring block (within a 3x3x3 cube) has changed its type or data and
physics checks should occur.
|
void |
onRedstoneUpdate(GlowBlock block) |
void |
placeBlock(GlowPlayer player,
GlowBlockState state,
org.bukkit.block.BlockFace face,
org.bukkit.inventory.ItemStack holding,
org.bukkit.util.Vector clickedLoc)
Called when a block is placed to calculate what the block will become.
|
void |
receivePulse(GlowBlock block)
Called when the BlockType gets pulsed as requested.
|
void |
requestPulse(GlowBlockState state) |
void |
rightClickBlock(GlowPlayer player,
GlowBlock against,
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.
|
protected void |
setDrops(org.bukkit.inventory.ItemStack... drops) |
void |
setPlaceSound(org.bukkit.Sound sound)
Sets the sound that will be played when a player places the block.
|
void |
updateBlock(GlowBlock block)
Called when this block needs to be updated.
|
void |
updatePhysics(GlowBlock block)
Called when the BlockType should calculate the current physics.
|
void |
updatePhysicsAfterEvent(GlowBlock block) |
protected void |
warnMaterialData(Class<?> clazz,
org.bukkit.material.MaterialData data)
Display the warning for finding the wrong MaterialData subclass.
|
getContext, getId, getMaterial, getMaxStackSize, rightClickAir, setId, setMaterial, setMaxStackSize, setPlaceAs, setPlaceAs, toStringprotected static final org.bukkit.block.BlockFace[] SIDES
protected static final org.bukkit.block.BlockFace[] ADJACENT
protected List<org.bukkit.inventory.ItemStack> drops
protected SoundInfo placeSound
protected static org.bukkit.block.BlockFace getOppositeBlockFace(org.bukkit.Location location,
boolean inverted)
location - Location to get opposite ofinverted - If up/down should be usedprotected final void setDrops(org.bukkit.inventory.ItemStack... drops)
public Collection<org.bukkit.inventory.ItemStack> getDrops(GlowBlock block, org.bukkit.inventory.ItemStack tool)
block - The block being dug.tool - The tool used or null if fists or no tool was used.public void setPlaceSound(org.bukkit.Sound sound)
sound - The sound.public Collection<org.bukkit.inventory.ItemStack> getMinedDrops(GlowBlock block)
block - The block.public BlockEntity createBlockEntity(GlowChunk chunk, int cx, int cy, int cz)
chunk - The chunk to create the block entity at.cx - The x coordinate in the chunk.cy - The y coordinate in the chunk.cz - The z coordinate in the chunk.public boolean canPlaceAt(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace against)
player - The player who placed the block.block - The location the block is being placed at.against - The face the block is being placed against.public void placeBlock(GlowPlayer player, GlowBlockState state, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding, org.bukkit.util.Vector clickedLoc)
player - the player who placed the blockstate - the BlockState to editholding - the ItemStack that was being heldface - the face off which the block is being placedclickedLoc - where in the block the click occurredpublic void afterPlace(GlowPlayer player, GlowBlock block, org.bukkit.inventory.ItemStack holding, GlowBlockState oldState)
player - the player who placed the blockblock - the block that was placedholding - the the ItemStack that was being heldoldState - The old block state before the block was placed.public boolean blockInteract(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace face, org.bukkit.util.Vector clickedLoc)
player - the player interactingblock - the block interacted withface - the clicked faceclickedLoc - where in the block the click occurredpublic void blockDestroy(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace face)
player - The player interactingblock - The block the player destroyedface - The block facepublic void afterDestroy(GlowPlayer player, GlowBlock block, org.bukkit.block.BlockFace face, GlowBlockState oldState)
player - The player interactingblock - The block the player destroyedface - The block faceoldState - The block state of the block the player destroyed.public void receivePulse(GlowBlock block)
block - The block that was pulsedpublic boolean canAbsorb(GlowBlock block, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding)
block - The block the player right-clickedface - The face on which the click occurredholding - The ItemStack the player was holdingpublic boolean canOverride(GlowBlock block, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding)
block - The block being targeted by the placementface - The face on which the click occurredholding - The ItemStack the player was holdingpublic void onNearBlockChanged(GlowBlock block, org.bukkit.block.BlockFace face, GlowBlock changedBlock, org.bukkit.Material oldType, byte oldData, org.bukkit.Material newType, byte newData)
block - The block to perform physics checks forface - The BlockFace to the changed block, or null if unavailablechangedBlock - The neighboring block that has changedoldType - The old type of the changed blockoldData - The old data of the changed blocknewType - The new type of the changed blocknewData - The new data of the changed blockpublic void onBlockChanged(GlowBlock block, org.bukkit.Material oldType, byte oldData, org.bukkit.Material newType, byte data)
This is called whenever GlowBlock.setTypeIdAndData(int, byte, boolean), GlowBlock.setType(org.bukkit.Material)
or GlowBlock.setData(byte) is called with physics enabled, and might
be called from plugins or other means of changing the block.
block - The block that was changedoldType - The old MaterialoldData - The old datanewType - The new Materialdata - The new datapublic final void updatePhysics(GlowBlock block)
Called when the BlockType should calculate the current physics.
Subclasses should override updatePhysicsAfterEvent(GlowBlock)
if they need a custom handling of the physics calculation
block - The blockpublic void updatePhysicsAfterEvent(GlowBlock block)
public final void rightClickBlock(GlowPlayer player, GlowBlock against, org.bukkit.block.BlockFace face, org.bukkit.inventory.ItemStack holding, org.bukkit.util.Vector clickedLoc, org.bukkit.inventory.EquipmentSlot hand)
ItemTyperightClickBlock in class ItemTypeplayer - The playeragainst - 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 itempublic boolean canTickRandomly()
public void updateBlock(GlowBlock block)
block - The block that needs an updatepublic void leftClickBlock(GlowPlayer player, GlowBlock block, org.bukkit.inventory.ItemStack holding)
player - the player who clicked the blockblock - the block that was clickedholding - the ItemStack that was being heldprotected void warnMaterialData(Class<?> clazz, org.bukkit.material.MaterialData data)
clazz - The expected subclass of MaterialData.data - The actual MaterialData found.public void onRedstoneUpdate(GlowBlock block)
public void onEntityStep(GlowBlock block, org.bukkit.entity.LivingEntity entity)
block - the block that was stepped onentity - the entitypublic BlockType getPlaceAs()
ItemTypegetPlaceAs in class ItemTypepublic void requestPulse(GlowBlockState state)
public int getPulseTickSpeed(GlowBlock block)
block - the blockpublic boolean isPulseOnce(GlowBlock block)
block - the blockpublic SoundInfo getPlaceSound()
Copyright © 2021. All rights reserved.