use of com.bergerkiller.generated.net.minecraft.server.BlockPositionHandle in project BKCommonLib by bergerhealer.
the class NMSTileEntity method getBlock.
public static Block getBlock(Object tileEntity) {
TileEntityHandle handle = TileEntityHandle.createHandle(tileEntity);
BlockPositionHandle pos = handle.getPosition();
return handle.getWorld().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
}
use of com.bergerkiller.generated.net.minecraft.server.BlockPositionHandle in project BKCommonLib by bergerhealer.
the class ChunkProviderServerHook method getMobsFor.
@HookMethod("public List<BiomeBase.BiomeMeta> getBiomeSpawnInfo:???(EnumCreatureType enumcreaturetype, BlockPosition blockposition)")
public List<?> getMobsFor(Object enumcreaturetype, Object blockposition) {
List<?> mobs = base.getMobsFor(enumcreaturetype, blockposition);
if (CommonPlugin.hasInstance()) {
// There is no use wasting CPU time when no one handles the event!
if (LogicUtil.nullOrEmpty(mobs) || !CommonUtil.hasHandlers(CreaturePreSpawnEvent.getHandlerList())) {
return mobs;
}
// Wrap the parameters and send the event along
BlockPositionHandle pos = BlockPositionHandle.createHandle(blockposition);
org.bukkit.World world = getWorld();
List<BiomeMetaHandle> mobsHandles = new ConvertingList<BiomeMetaHandle>(mobs, BiomeMetaHandle.T.getHandleConverter());
mobsHandles = CommonPlugin.getInstance().getEventFactory().handleCreaturePreSpawn(world, pos.getX(), pos.getY(), pos.getZ(), mobsHandles);
return new ConvertingList<Object>(mobsHandles, BiomeMetaHandle.T.getHandleConverter().reverse());
} else {
return mobs;
}
}
Aggregations