public class CustomBlock
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.lang.String> |
description
The List
|
private java.util.List<org.bukkit.inventory.ItemStack> |
drops
These items will be the default one dropped when the block is destroyed
|
private float |
hardness
This is the hardness value, it will be used when this block should explode if the hardness is greater than yield then the block isn't destroyed
A negative value is a non-explodable block
|
private int |
id
This is the id of the block, it will render to
|
private java.lang.String |
identifier
This will be the metadata string to identify your block.
|
private java.util.ArrayList<org.bukkit.Location> |
locs
All the locs where this block has been placed
|
private int |
maxStackSize
This the maximum amount of item stackable
|
private java.lang.String |
name
This is the name of this custom block
|
private org.bukkit.inventory.Recipe |
recipe
This is the default recipe for this custom block
By default it's null until you call setRecipe(Recipe rec);
|
| Constructor and Description |
|---|
CustomBlock()
You should set its identifier and name because currently it's a random
|
CustomBlock(java.lang.String id)
This will be the metadata string to identify your block.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLocation(org.bukkit.Location loc) |
void |
burn(org.bukkit.event.block.BlockBurnEvent event)
Fired when this block has burnt
|
void |
burning(org.bukkit.event.block.BlockIgniteEvent event)
Fired when this block is burning
|
void |
collide(org.bukkit.event.vehicle.VehicleBlockCollisionEvent event)
Fired when a vehicle collide with this block
|
void |
damage(org.bukkit.event.block.BlockDamageEvent event)
Fired when this block is damaged by a player
|
void |
destroy(org.bukkit.event.block.BlockBreakEvent event)
Fired when this block is destroyed
|
boolean |
equals(org.bukkit.block.Block block)
Check if a block match to this custom block
|
void |
exploded(org.bukkit.event.entity.EntityExplodeEvent event,
org.bukkit.block.Block block)
Fired when this block was destroyed by an explosion
|
int |
getBlockID()
This is the id of the block, it will render to
|
java.util.List<java.lang.String> |
getDescription()
Get the List
|
java.util.List<org.bukkit.inventory.ItemStack> |
getDrops() |
float |
getHardness() |
java.lang.String |
getIdentifier()
This is the metadata string that identify this block
|
java.util.ArrayList<org.bukkit.Location> |
getLocs() |
int |
getMaxStackSize()
This the maximum amount of item stackable
|
java.lang.String |
getName() |
org.bukkit.inventory.Recipe |
getRecipe()
Be aware if not set by user @return null
|
void |
handleDestroy(org.bukkit.event.block.BlockBreakEvent event) |
void |
handleExplode(org.bukkit.event.entity.EntityExplodeEvent event,
org.bukkit.block.Block block) |
void |
handlePlace(org.bukkit.event.player.PlayerInteractEvent event,
BlockAPI plugin)
Thrown when a player right click with a book that match the format of this block
|
void |
hanging_placed(org.bukkit.event.hanging.HangingPlaceEvent event)
Fired when an hanging is placed on this block
|
void |
leftClick(org.bukkit.event.player.PlayerInteractEvent event)
Fired when a player left click on this block
|
void |
physics(org.bukkit.event.block.BlockPhysicsEvent event)
Fired when some physics concern this custom block
e.g: like when a sand block falls
|
void |
place(org.bukkit.event.block.BlockPlaceEvent event)
Fired when this block is placed
|
void |
power(org.bukkit.event.block.BlockRedstoneEvent event)
Fired when this block is powered by redstone
|
void |
projectile_hit(org.bukkit.event.entity.ProjectileHitEvent event,
org.bukkit.block.Block block)
Fired when a projectile hit this block
|
void |
removeLocation(org.bukkit.Location location) |
void |
rightClick(org.bukkit.event.player.PlayerInteractEvent event)
Fired when a player right click on this block
|
void |
setBlockID(int id)
This is the id of the block, it will render to
currently only render as block so from 1 to 255
|
void |
setDescription(java.util.List<java.lang.String> description)
Set the List
|
void |
setDrops(org.bukkit.inventory.ItemStack... drops) |
void |
setDrops(java.util.List<org.bukkit.inventory.ItemStack> drops) |
void |
setHardness(float hardness) |
void |
setMaxStackSize(int maxStackSize)
This the maximum amount of item stackable
|
void |
setName(java.lang.String name) |
void |
setRecipe(org.bukkit.inventory.Recipe recipe)
Set the default recipe to this one, nothing is done with is, it's only for futur uses or other developers uses
To get help to create a recipe see
BlockAPI |
void |
walk(org.bukkit.event.player.PlayerMoveEvent event)
Fired when a player walk on this block
|
private java.lang.String identifier
private java.lang.String name
private int id
private int maxStackSize
private java.util.ArrayList<org.bukkit.Location> locs
private org.bukkit.inventory.Recipe recipe
private java.util.List<org.bukkit.inventory.ItemStack> drops
private float hardness
private java.util.List<java.lang.String> description
public CustomBlock()
public CustomBlock(java.lang.String id)
public java.lang.String getIdentifier()
public java.lang.String getName()
public void setName(java.lang.String name)
public final void handlePlace(org.bukkit.event.player.PlayerInteractEvent event,
BlockAPI plugin)
public void place(org.bukkit.event.block.BlockPlaceEvent event)
public final void handleDestroy(org.bukkit.event.block.BlockBreakEvent event)
public void destroy(org.bukkit.event.block.BlockBreakEvent event)
public void power(org.bukkit.event.block.BlockRedstoneEvent event)
public void burn(org.bukkit.event.block.BlockBurnEvent event)
public void burning(org.bukkit.event.block.BlockIgniteEvent event)
public void damage(org.bukkit.event.block.BlockDamageEvent event)
public void walk(org.bukkit.event.player.PlayerMoveEvent event)
public void leftClick(org.bukkit.event.player.PlayerInteractEvent event)
public void rightClick(org.bukkit.event.player.PlayerInteractEvent event)
public void collide(org.bukkit.event.vehicle.VehicleBlockCollisionEvent event)
public final void handleExplode(org.bukkit.event.entity.EntityExplodeEvent event,
org.bukkit.block.Block block)
public void exploded(org.bukkit.event.entity.EntityExplodeEvent event,
org.bukkit.block.Block block)
block - is the block that matches to this custom blockpublic void hanging_placed(org.bukkit.event.hanging.HangingPlaceEvent event)
public void projectile_hit(org.bukkit.event.entity.ProjectileHitEvent event,
org.bukkit.block.Block block)
public void physics(org.bukkit.event.block.BlockPhysicsEvent event)
public int getBlockID()
public int getMaxStackSize()
public void setMaxStackSize(int maxStackSize)
public org.bukkit.inventory.Recipe getRecipe()
public void setRecipe(org.bukkit.inventory.Recipe recipe)
BlockAPIpublic java.util.List<org.bukkit.inventory.ItemStack> getDrops()
public void setDrops(java.util.List<org.bukkit.inventory.ItemStack> drops)
public void setDrops(org.bukkit.inventory.ItemStack... drops)
public float getHardness()
public void setHardness(float hardness)
public java.util.List<java.lang.String> getDescription()
public void setDescription(java.util.List<java.lang.String> description)
public void setBlockID(int id)
public boolean equals(org.bukkit.block.Block block)
public void addLocation(org.bukkit.Location loc)
public void removeLocation(org.bukkit.Location location)
public java.util.ArrayList<org.bukkit.Location> getLocs()