use of mekanism.common.tile.interfaces.ITileRadioactive in project Mekanism by mekanism.
the class BlockMekanism method animateTick.
@Override
public void animateTick(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random random) {
super.animateTick(state, world, pos, random);
TileEntity tile = WorldUtils.getTileEntity(world, pos);
if (tile instanceof ITileRadioactive) {
int count = ((ITileRadioactive) tile).getRadiationParticleCount();
if (count > 0) {
// Update count to be randomized but store it instead of calculating our max number each time we loop
count = random.nextInt(count);
for (int i = 0; i < count; i++) {
double randX = pos.getX() - 0.1 + random.nextDouble() * 1.2;
double randY = pos.getY() - 0.1 + random.nextDouble() * 1.2;
double randZ = pos.getZ() - 0.1 + random.nextDouble() * 1.2;
world.addParticle(MekanismParticleTypes.RADIATION.getParticleType(), randX, randY, randZ, 0, 0, 0);
}
}
}
}
Aggregations