public abstract class DBlock
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
applyPhysics(org.bukkit.Location location)
Update the physics of the the nearby blocks surrounding the location, including the block.
|
void |
attackBlock(DBlockData data,
org.bukkit.Location location,
org.bukkit.entity.HumanEntity entity)
Called when a player starts mining a block.
|
boolean |
canEntitySpawnOn(DBlockData data,
org.bukkit.Location location,
org.bukkit.NamespacedKey type)
Set whether the entity type can spawn on the given block.
|
boolean |
causesSuffocation(DBlockData data,
org.bukkit.Location location)
Does this block cause suffocation damage if the player's head is inside of it.
|
boolean |
destroyedByFluid(DBlockData data,
org.bukkit.NamespacedKey fluid)
Whether or not the block can be destroyed by the fluid.
|
void |
doPhysics(DBlockData data,
org.bukkit.Location location,
org.bukkit.Location otherBlock)
Called when physics are applied to this object.
|
void |
dropNaturally(DBlockData data,
org.bukkit.Location location,
org.bukkit.inventory.ItemStack item)
Called when the block gets broken.
|
org.bukkit.block.data.BlockData |
getClientBlock(DBlockData data)
Set the client view of this block to the BlockData provided.
|
int |
getComparatorLevel(DBlockData data,
org.bukkit.Location location)
Get the level of redstone that will be given to a comparator.
|
org.bukkit.block.data.BlockData |
getData() |
DBlockData |
getDefaultBlockData() |
float |
getExplosionResistance()
Get the explosion resistance of this block.
|
DInfo |
getInfo() |
org.bukkit.NamespacedKey |
getKey() |
java.awt.Color |
getMapColor(DBlockData data,
org.bukkit.Location location)
Get the color that should show up on the map.
|
PistonReaction |
getPistonReaction(DBlockData data) |
int |
getPowerSourceLevel(DBlockData data,
org.bukkit.Location location,
org.bukkit.block.BlockFace face)
Get the level of redstone that is emitted in the direction provided.
|
abstract DState<?>[] |
getStates()
Return a list of all DStates that this block supports.
|
static DTileEntity |
getTileEntity(org.bukkit.Location location)
Get the
DTileEntity at the given location, if it exists. |
void |
handleRain(org.bukkit.Location location)
Called every once in a while when it's raining.
|
InteractionResult |
interact(DBlockData data,
org.bukkit.Location location,
org.bukkit.entity.HumanEntity entity,
boolean mainhand,
CollisionResultBlock ray)
Called when a HumanEntity right clicks this block, with either hand.
|
boolean |
isComplexRedstone(DBlockData data)
Whether or not this block will give comparator output.
|
boolean |
isOccluding(DBlockData data,
org.bukkit.Location location)
Set whether the block is occluding, such as preventing chests from being accessible.
|
boolean |
isPowerSource(DBlockData data)
Whether or not this block will give off redstone power.
|
void |
onContact(DBlockData data,
org.bukkit.Location location,
org.bukkit.entity.Entity entity)
Called when an entity touches, or is inside the block.
|
void |
onDataUpdate(DBlockData data,
org.bukkit.Location location)
Called after this block gets placed in the world, either through code or command.
|
void |
onProjectileHit(DBlockData data,
org.bukkit.entity.Entity projectile,
CollisionResultBlock ray)
Called when a projectile, hits the block.
|
void |
onRegister()
Manage all block related stuff here, such as setting the states and their various values.
|
void |
postBreak(DBlockData data,
org.bukkit.Location location)
Called after the block gets broken by the player, or removed somehow.
|
void |
stepOn(org.bukkit.Location location,
org.bukkit.entity.Entity entity)
Called when an entity is standing directly on top of the block.
|
void |
tick(DBlockData data,
org.bukkit.Location location,
java.util.Random random)
Tick event.
|
void |
tickLater(org.bukkit.Location location,
int delay)
Call the
tick(DBlockData, Location, Random) method after a given delay |
static void |
update(DBlockData block,
org.bukkit.Location location)
Set the provided
DBlockData to the location, and apply physics. |
static void |
update(DBlockData block,
org.bukkit.Location location,
boolean doPhysics)
Set the provided
DBlockData to the location, and apply physics if specified. |
void |
updateState(DBlockData data,
org.bukkit.Location blockloc,
org.bukkit.Location neighbor,
org.bukkit.block.BlockFace direction)
Called when a neighboring block has been changed.
|
public DBlock(DInfo info)
public final org.bukkit.NamespacedKey getKey()
public final DInfo getInfo()
public final org.bukkit.block.data.BlockData getData()
public final DBlockData getDefaultBlockData()
public final void tickLater(org.bukkit.Location location,
int delay)
tick(DBlockData, Location, Random) method after a given delaylocation - The location of the block to tick.delay - The delay in ticks.public final void applyPhysics(org.bukkit.Location location)
location - The location to update around.public void onRegister()
public org.bukkit.block.data.BlockData getClientBlock(DBlockData data)
data - This value should not be modified in any way except for determining the states. Doing so will throw an IllegalArgumentException.public void onContact(DBlockData data, org.bukkit.Location location, org.bukkit.entity.Entity entity)
data - location - entity - public void dropNaturally(DBlockData data, org.bukkit.Location location, org.bukkit.inventory.ItemStack item)
data - location - item - public boolean canEntitySpawnOn(DBlockData data, org.bukkit.Location location, org.bukkit.NamespacedKey type)
data - location - type - NamespacedKey of the entity. Follows NMS naming conventions. May not match with Bukkit EntityType enums.public boolean isOccluding(DBlockData data, org.bukkit.Location location)
data - location - public void attackBlock(DBlockData data, org.bukkit.Location location, org.bukkit.entity.HumanEntity entity)
data - location - entity - public void stepOn(org.bukkit.Location location,
org.bukkit.entity.Entity entity)
location - entity - public void onProjectileHit(DBlockData data, org.bukkit.entity.Entity projectile, CollisionResultBlock ray)
data - projectile - Does not support all projectiles.ray - public void onDataUpdate(DBlockData data, org.bukkit.Location location)
data - location - public void postBreak(DBlockData data, org.bukkit.Location location)
data - location - public void tick(DBlockData data, org.bukkit.Location location, java.util.Random random)
tickLater(Location, int).data - location - random - public void updateState(DBlockData data, org.bukkit.Location blockloc, org.bukkit.Location neighbor, org.bukkit.block.BlockFace direction)
data - blockloc - neighbor - direction - The direction of the neighboring block.public void doPhysics(DBlockData data, org.bukkit.Location location, org.bukkit.Location otherBlock)
data - location - otherBlock - May not always be directly adjacent to the block.public void handleRain(org.bukkit.Location location)
location - Not sure what this location represents.public boolean isComplexRedstone(DBlockData data)
data - public int getComparatorLevel(DBlockData data, org.bukkit.Location location)
isComplexRedstone(DBlockData) must
return true for this to be called. Apply a physics update if the comparator level output changes.data - location - public boolean isPowerSource(DBlockData data)
data - public int getPowerSourceLevel(DBlockData data, org.bukkit.Location location, org.bukkit.block.BlockFace face)
isPowerSource(DBlockData) must
return true for this to be called. Apply a physics update if the redstone level changes.data - location - face - public InteractionResult interact(DBlockData data, org.bukkit.Location location, org.bukkit.entity.HumanEntity entity, boolean mainhand, CollisionResultBlock ray)
data - location - entity - mainhand - ray - public boolean destroyedByFluid(DBlockData data, org.bukkit.NamespacedKey fluid)
data - fluid - Namespaced key id of the fluid.public boolean causesSuffocation(DBlockData data, org.bukkit.Location location)
data - location - public float getExplosionResistance()
public java.awt.Color getMapColor(DBlockData data, org.bukkit.Location location)
data - location - public PistonReaction getPistonReaction(DBlockData data)
public abstract DState<?>[] getStates()
public static void update(DBlockData block, org.bukkit.Location location)
DBlockData to the location, and apply physics.block - location - public static void update(DBlockData block, org.bukkit.Location location, boolean doPhysics)
DBlockData to the location, and apply physics if specified.block - location - doPhysics - Whether or not to apply physics.public static DTileEntity getTileEntity(org.bukkit.Location location)
DTileEntity at the given location, if it exists.location -