use of net.minecraft.client.particle.ParticleManager 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;
}
}
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntitySmokeFX.
public static void addEntitySmokeFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleSmoke(world, x, y, z));
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntityHoneyDustFX.
public static void addEntityHoneyDustFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleHoneydust(world, x, y, z, 0, 0, 0));
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntityExplodeFX.
public static void addEntityExplodeFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle Particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), x, y, z, 0, 0, 0);
effectRenderer.addEffect(Particle);
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntityPotionFX.
public static void addEntityPotionFX(World world, double x, double y, double z, int color) {
if (!shouldSpawnParticle(world)) {
return;
}
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), x, y, z, 0, 0, 0);
if (particle != null) {
particle.setRBGColorF(red, green, blue);
effectRenderer.addEffect(particle);
}
}
Aggregations