use of net.minecraft.client.particle.Particle in project Railcraft by Railcraft.
the class ClientEffectProxy method tuningEffect.
@Override
public void tuningEffect(TileEntity start, TileEntity dest) {
if (thinParticles(false))
return;
if (rand.nextInt(2) == 0) {
BlockPos pos = start.getPos();
double px = pos.getX() + getRandomParticleOffset();
double py = pos.getY() + getRandomParticleOffset();
double pz = pos.getZ() + getRandomParticleOffset();
TESRSignals.ColorProfile colorProfile = TESRSignals.ColorProfile.RAINBOW;
if (isGoggleAuraActive(GoggleAura.SIGNALLING))
colorProfile = TESRSignals.ColorProfile.ASPECT;
int color = colorProfile.getColor(start, start.getPos(), dest.getPos());
Particle particle = new ParticleTuningAura(start.getWorld(), new Vec3d(px, py, pz), EffectManager.getEffectSource(start), EffectManager.getEffectSource(dest), color);
spawnParticle(particle);
}
}
use of net.minecraft.client.particle.Particle in project Railcraft by Railcraft.
the class ClientEffectProxy method trailEffect.
@Override
public void trailEffect(BlockPos start, TileEntity dest, long colorSeed) {
if (thinParticles(false))
return;
if (Minecraft.getMinecraft().thePlayer.getDistanceSq(start) > TRACKING_DISTANCE)
return;
if (rand.nextInt(3) == 0) {
double px = start.getX() + 0.5 + rand.nextGaussian() * 0.1;
double py = start.getY() + 0.5 + rand.nextGaussian() * 0.1;
double pz = start.getZ() + 0.5 + rand.nextGaussian() * 0.1;
Particle particle = new ParticleHeatTrail(dest.getWorld(), new Vec3d(px, py, pz), colorSeed, EffectManager.getEffectSource(dest));
spawnParticle(particle);
}
}
use of net.minecraft.client.particle.Particle in project BetterWithAddons by DaedalusGame.
the class StormHandler method playerTick.
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent tickEvent) {
EntityPlayer entity = tickEvent.player;
if (entity == null)
return;
World world = entity.world;
if (world == null || !world.isRemote)
return;
if (InteractionBWA.OBVIOUS_STORMS) {
ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer;
Random random = world.rand;
BlockPos pos = entity.getPosition();
// blocks
int radius = 16;
for (int i = 0; i < InteractionBWA.DUST_PARTICLES; i++) {
BlockPos posGround = pos.add(random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius);
if (!shouldStorm(world, posGround))
continue;
// Constant access whaaaat???
posGround = world.getHeight(posGround).down();
IBlockState stateGround = world.getBlockState(posGround);
Particle particleGround = particleManager.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), posGround.getX() + random.nextDouble(), posGround.getY() + 1.2, posGround.getZ() + random.nextDouble(), -0.5 - random.nextDouble() * 0.6, 0.0, 0.0, Block.getStateId(stateGround));
}
for (int i = 0; i < InteractionBWA.AIR_PARTICLES; i++) {
BlockPos posAir = pos.add(random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius);
if (world.canSeeSky(posAir) && shouldStorm(world, posAir)) {
Particle particleAir = particleManager.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), posAir.getX() + random.nextDouble(), posAir.getY() + random.nextDouble(), posAir.getZ() + random.nextDouble(), -0.5 - random.nextDouble() * 0.6, 0.0, 0.0);
particleAir.setRBGColorF(1.0f, 1.0f, 1.0f);
}
}
}
if (InteractionBWA.OBVIOUS_SAND_STORMS) {
float epsilon = 0.001f;
if (Math.abs(currentDistance - desiredDistance) > epsilon)
// TODO: We can do better.
currentDistance += (desiredDistance - currentDistance) * 0.2;
if (Math.abs(currentDistanceScale - desiredDistanceScale) > epsilon)
// TODO: We can do better.
currentDistanceScale += (desiredDistanceScale - currentDistanceScale) * 0.2;
if (Math.abs(currentRed - desiredRed) > epsilon)
currentRed += (desiredRed - currentRed) * 0.2;
if (Math.abs(currentGreen - desiredGreen) > epsilon)
currentGreen += (desiredGreen - currentGreen) * 0.2;
if (Math.abs(currentBlue - desiredBlue) > epsilon)
currentBlue += (desiredBlue - currentBlue) * 0.2;
}
}
use of net.minecraft.client.particle.Particle in project MorePlanets by SteveKunG.
the class ClientProxyMP method spawnParticle.
@Override
public void spawnParticle(EnumParticleTypesMP type, double x, double y, double z, double motionX, double motionY, double motionZ, Object[] data) {
Particle entityfx = null;
Minecraft mc = Minecraft.getMinecraft();
if (mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.world != null) {
int i = mc.gameSettings.particleSetting;
double d6 = mc.getRenderViewEntity().posX - x;
double d7 = mc.getRenderViewEntity().posY - y;
double d8 = mc.getRenderViewEntity().posZ - z;
double d9 = 16.0D;
if (i == 1 && mc.world.rand.nextInt(3) == 0) {
i = 2;
}
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9) {
return;
} else if (i > 1) {
return;
}
if (type == EnumParticleTypesMP.CRYSTALLIZE_FLAME) {
entityfx = new ParticleCrystallizeFlame(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.CHEESE_OF_MILK_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 1.0F, 0.85F, 0.5F, 0.4F, false);
} else if (type == EnumParticleTypesMP.INFECTED_SPORE) {
entityfx = new ParticleInfectedSpore(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.ALIEN_MINER_SPARK) {
entityfx = new ParticleAlienMinerSpark(mc.world, x, y, z, (float) data[0]);
} else if (type == EnumParticleTypesMP.INFECTED_GUARDIAN_APPEARANCE) {
entityfx = new ParticleInfectedGuardianAppearance(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.DARK_PORTAL) {
entityfx = new ParticleDarkPortal(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.ALIEN_BERRY_LEAVES) {
entityfx = new ParticleAlienBerry(mc.world, x, y, z);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, (Item) data[0]);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING_META) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, (Item) data[0], (int) data[1]);
} else if (type == EnumParticleTypesMP.CUSTOM_BREAKING_MOTION) {
entityfx = new ParticleBreakingMC(mc.world, x, y, z, motionX, motionY, motionZ, (Item) data[0]);
} else if (type == EnumParticleTypesMP.INFECTED_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.95F, 0.4F, 0.3F, 0.6F, false);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.6F, 0.2F, 0.8F, 0.6F, false);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_LAVA_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.6F, 0.2F, 0.8F, 1.0F, true);
} else if (type == EnumParticleTypesMP.CRYSTALLIZE_LAVA) {
entityfx = new ParticleLavaMC(mc.world, x, y, z, "crystallize_lava");
} else if (type == EnumParticleTypesMP.MC_SMOKE_LARGE) {
mc.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0.0D, 0.0D, 0.0D);
} else if (type == EnumParticleTypesMP.NUCLEAR_WASTE_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.4F, 0.8F, 0.1F, 1.0F, true);
} else if (type == EnumParticleTypesMP.PURIFY_WATER_DRIP) {
entityfx = new ParticleLiquidDrip(mc.world, x, y, z, 0.45F, 0.8F, 1.0F, 0.6F, false);
} else if (type == EnumParticleTypesMP.KOENTUS_METEOR_SMOKE) {
entityfx = new ParticleKoentusMeteor(mc.world, x, y, z, motionX, motionY, motionZ);
} else if (type == EnumParticleTypesMP.CUSTOM_FALLING_DUST) {
entityfx = new ParticleFallingDustMP(mc.world, x, y, z, (int) data[0]);
}
if (entityfx != null) {
mc.effectRenderer.addEffect(entityfx);
}
}
}
use of net.minecraft.client.particle.Particle in project Charset by CharsetMC.
the class BlockBase method addHitEffects.
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(IBlockState state, World world, RayTraceResult target, ParticleManager manager) {
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
if (model instanceof IStateParticleBakedModel) {
BlockPos pos = target.getBlockPos();
EnumFacing side = target.sideHit;
state = getExtendedState(state.getActualState(world, pos), world, pos);
TextureAtlasSprite sprite = ((IStateParticleBakedModel) model).getParticleTexture(state, side);
if (sprite != null) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
AxisAlignedBB axisalignedbb = state.getBoundingBox(world, pos);
double d0 = (double) i + RANDOM.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minX;
double d1 = (double) j + RANDOM.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minY;
double d2 = (double) k + RANDOM.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minZ;
if (side == EnumFacing.DOWN) {
d1 = (double) j + axisalignedbb.minY - 0.10000000149011612D;
}
if (side == EnumFacing.UP) {
d1 = (double) j + axisalignedbb.maxY + 0.10000000149011612D;
}
if (side == EnumFacing.NORTH) {
d2 = (double) k + axisalignedbb.minZ - 0.10000000149011612D;
}
if (side == EnumFacing.SOUTH) {
d2 = (double) k + axisalignedbb.maxZ + 0.10000000149011612D;
}
if (side == EnumFacing.WEST) {
d0 = (double) i + axisalignedbb.minX - 0.10000000149011612D;
}
if (side == EnumFacing.EAST) {
d0 = (double) i + axisalignedbb.maxX + 0.10000000149011612D;
}
Particle particle = new ParticleDiggingCharset(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, state, pos, sprite, getParticleTintIndex()).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
manager.addEffect(particle);
return true;
}
}
return false;
}
Aggregations