use of com.tntmodders.takumi.entity.EntityTakumiAbstractCreeper in project takumicraft by TNTModders.
the class BlockTakumiDarkBoard method onBlockAdded.
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
super.onBlockAdded(worldIn, pos, state);
if (worldIn.getTileEntity(pos) instanceof TileEntityDarkBoard) {
Random random = new Random();
random.setSeed(System.currentTimeMillis() + pos.getX() + pos.getZ());
if (((TileEntityDarkBoard) worldIn.getTileEntity(pos)).name == null || ((TileEntityDarkBoard) worldIn.getTileEntity(pos)).name.isEmpty()) {
Class clazz = ((Class) TakumiBlockCore.BOMB_MAP.keySet().toArray()[random.nextInt(TakumiBlockCore.BOMB_MAP.size())]);
try {
EntityTakumiAbstractCreeper creeper = (EntityTakumiAbstractCreeper) clazz.getConstructor(World.class).newInstance(worldIn);
((TileEntityDarkBoard) worldIn.getTileEntity(pos)).name = creeper.getRegisterName();
} catch (Exception e) {
e.printStackTrace();
}
}
TakumiCraftCore.LOGGER.info(((TileEntityDarkBoard) worldIn.getTileEntity(pos)).name);
}
}
use of com.tntmodders.takumi.entity.EntityTakumiAbstractCreeper in project takumicraft by TNTModders.
the class TakumiASMHooks method TakumiExplodeHook.
public static void TakumiExplodeHook(EntityCreeper creeper) {
try {
if (creeper instanceof EntityTakumiAbstractCreeper) {
int i = ((ITakumiEntity) creeper).getExplosionPower();
Field field = TakumiASMNameMap.getField(EntityCreeper.class, "explosionRadius");
field.setAccessible(true);
field.set(creeper, i);
((ITakumiEntity) creeper).takumiExplode();
}
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
Aggregations