use of com.builtbroken.mc.api.event.blast.BlastEventBlockEdit in project Engine by VoltzEngine-Project.
the class Blast method prePlace.
/**
* Called before block placement to check that
* the placement is not canceled by an event
*
* @param vec - edit data, null and has changed checked
* @return true if should continue
*/
protected boolean prePlace(final IWorldEdit vec) {
BlastEventBlockEdit event;
if (vec.getNewBlock() == Blocks.air) {
event = new BlastEventBlockRemoved.Pre(this, world, vec.getBlock(), vec.getBlockMetadata(), (int) vec.x(), (int) vec.y(), (int) vec.z());
} else {
event = new BlastEventBlockReplaced.Pre(this, world, vec.getBlock(), vec.getBlockMetadata(), vec.getNewBlock(), vec.getNewMeta(), (int) vec.x(), (int) vec.y(), (int) vec.z());
}
boolean result = MinecraftForge.EVENT_BUS.post(event);
if (vec instanceof BlockEdit && event instanceof BlastEventBlockReplaced.Pre) {
((BlockEdit) vec).set(((BlastEventBlockReplaced.Pre) event).newBlock, ((BlastEventBlockReplaced.Pre) event).newMeta);
}
return !result;
}
use of com.builtbroken.mc.api.event.blast.BlastEventBlockEdit in project Engine by VoltzEngine-Project.
the class BlastBasic method prePlace.
@Override
protected boolean prePlace(final IWorldEdit vec) {
BlastEventBlockEdit event = new BlastEventDestroyBlock.Pre(this, BlastEventDestroyBlock.DestructionType.FORCE, world, vec.getBlock(), vec.getBlockMetadata(), (int) vec.x(), (int) vec.y(), (int) vec.z());
boolean result = MinecraftForge.EVENT_BUS.post(event);
if (vec instanceof BlockEdit && event instanceof BlastEventBlockReplaced.Pre) {
((BlockEdit) vec).set(((BlastEventBlockReplaced.Pre) event).newBlock, ((BlastEventBlockReplaced.Pre) event).newMeta);
}
return !result;
}
Aggregations