use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addPortalFx.
public static void addPortalFx(World world, BlockPos pos, Random rand) {
if (!shouldSpawnParticle(world)) {
return;
}
int j = rand.nextInt(2) * 2 - 1;
int k = rand.nextInt(2) * 2 - 1;
double xPos = (double) pos.getX() + 0.5D + 0.25D * (double) j;
double yPos = (double) ((float) pos.getY() + rand.nextFloat());
double zPos = (double) pos.getZ() + 0.5D + 0.25D * (double) k;
double xSpeed = (double) (rand.nextFloat() * (float) j);
double ySpeed = ((double) rand.nextFloat() - 0.5D) * 0.125D;
double zSpeed = (double) (rand.nextFloat() * (float) k);
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.getParticleID(), xPos, yPos, zPos, xSpeed, ySpeed, zSpeed);
if (particle != null) {
effectRenderer.addEffect(particle);
}
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntityIgnitionFX.
public static void addEntityIgnitionFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleIgnition(world, x, y, z));
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntitySnowFX.
public static void addEntitySnowFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleSnow(world, x + world.rand.nextGaussian(), y, z + world.rand.nextGaussian()));
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addEntityBiodustFX.
public static void addEntityBiodustFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.VILLAGER_HAPPY.ordinal(), x, y, z, 0, 0, 0);
if (particle != null) {
effectRenderer.addEffect(particle);
}
}
use of net.minecraft.client.particle.ParticleManager in project EnderIO by SleepyTrousers.
the class BlockCombustionGenerator method randomDisplayTick.
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
// If active, randomly throw some smoke around
if (isActive(world, pos)) {
TileEntity te = world.getTileEntity(pos);
EnumFacing facing = EnumFacing.SOUTH;
if (te instanceof AbstractMachineEntity) {
AbstractMachineEntity me = (AbstractMachineEntity) te;
facing = me.facing;
}
for (int j = 0; j < (isEnhanced ? 3 : 1); j++) {
boolean toTop = rand.nextBoolean();
// top:front<->back or side:bottom<->top
float offsetA = rand.nextFloat();
// right<->left
float offsetB = .5f + rand.nextFloat() * .2f - rand.nextFloat() * .2f;
float startX = pos.getX(), startY = pos.getY(), startZ = pos.getZ();
if (toTop) {
startY += 0.95f;
switch(facing) {
case NORTH:
case SOUTH:
startX += offsetB;
startZ += offsetA;
break;
case EAST:
case WEST:
default:
startX += offsetA;
startZ += offsetB;
break;
}
} else {
boolean swap = rand.nextBoolean();
startY += offsetA;
switch(facing) {
case NORTH:
case SOUTH:
startX += offsetB;
startZ += swap ? 0.05f : 0.95f;
break;
case EAST:
case WEST:
default:
startX += swap ? 0.05f : 0.95f;
startZ += offsetB;
break;
}
}
for (int i = 0; i < (isEnhanced ? 5 : 2); i++) {
ParticleManager er = Minecraft.getMinecraft().effectRenderer;
Particle fx = er.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), startX, startY, startZ, 0.0D, 0.0D, 0.0D);
if (fx != null && rand.nextFloat() > .75f) {
fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
}
startX += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
startY += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
startZ += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
}
}
}
}
Aggregations