use of pl.asie.charset.lib.block.BlockBase in project Charset by CharsetMC.
the class UtilProxyClient method spawnBlockDustClient.
@Override
public void spawnBlockDustClient(World world, BlockPos pos, Random rand, float posX, float posY, float posZ, int numberOfParticles, float particleSpeed, EnumFacing facing) {
TextureAtlasSprite sprite;
int tintIndex = -1;
IBlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockBase) {
tintIndex = ((BlockBase) state.getBlock()).getParticleTintIndex();
}
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
if (model instanceof IStateParticleBakedModel) {
state = state.getBlock().getExtendedState(state.getActualState(world, pos), world, pos);
sprite = ((IStateParticleBakedModel) model).getParticleTexture(state, facing);
} else {
sprite = model.getParticleTexture();
}
ParticleManager manager = Minecraft.getMinecraft().effectRenderer;
for (int i = 0; i < numberOfParticles; i++) {
double xSpeed = rand.nextGaussian() * particleSpeed;
double ySpeed = rand.nextGaussian() * particleSpeed;
double zSpeed = rand.nextGaussian() * particleSpeed;
try {
Particle particle = new ParticleBlockDustCharset(world, posX, posY, posZ, xSpeed, ySpeed, zSpeed, state, pos, sprite, tintIndex);
manager.addEffect(particle);
} catch (Throwable var16) {
ModCharset.logger.warn("Could not spawn block particle!");
return;
}
}
}
Aggregations