use of net.minecraft.client.particle.ParticleManager in project Binnie by ForestryMC.
the class AnalyserFX method onDisplayTick.
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(World world, BlockPos pos, Random rand) {
if (this.getUtil().getProcess().isInProgress()) {
final ParticleManager effectRenderer = BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer;
effectRenderer.addEffect(new AnalyserParticle(world, pos, rand));
}
}
use of net.minecraft.client.particle.ParticleManager 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.ParticleManager in project DynamicSurroundings by OreCruncher.
the class DiagnosticHandler method process.
@Override
public void process(@Nonnull final EntityPlayer player) {
// Gather diagnostics if needed
if (Minecraft.getMinecraft().gameSettings.showDebugInfo) {
this.diagnostics = new ArrayList<>();
if (DSurround.isDeveloperMode())
this.diagnostics.add(TextFormatting.RED + "DEVELOPER MODE ENABLED");
if (ModOptions.logging.enableDebugLogging) {
final DiagnosticEvent.Gather gather = new DiagnosticEvent.Gather(player.getEntityWorld(), player);
MinecraftForge.EVENT_BUS.post(gather);
this.diagnostics.addAll(gather.output);
}
} else {
this.diagnostics = null;
}
if (ModOptions.logging.showDebugDialog)
DiagnosticPanel.refresh();
if (DSurround.isDeveloperMode()) {
final ParticleManager pm = Minecraft.getMinecraft().effectRenderer;
if (!(pm instanceof TraceParticleManager)) {
DSurround.log().info("Wrapping particle manager [%s]", pm.getClass().getName());
Minecraft.getMinecraft().effectRenderer = new TraceParticleManager(pm);
}
}
}
use of net.minecraft.client.particle.ParticleManager in project EnderIO by SleepyTrousers.
the class BlockVat method randomDisplayTick.
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
// Spit some "steam" out the spout
TileVat te = getTileEntity(world, pos);
if (te != null && te.isActive()) {
float pX = pos.getX() + 0.5f;
float pY = pos.getY() + 0.7f;
float pZ = pos.getZ() + 0.5f;
EnumFacing dir = te.getFacing();
pX += 0.6f * dir.getFrontOffsetX();
pZ += 0.6f * dir.getFrontOffsetZ();
double velX = ((rand.nextDouble() * 0.075) + 0.025) * dir.getFrontOffsetX();
double velZ = ((rand.nextDouble() * 0.075) + 0.025) * dir.getFrontOffsetZ();
int num = rand.nextInt(4) + 2;
for (int k = 0; k < num; k++) {
ParticleManager er = Minecraft.getMinecraft().effectRenderer;
Particle fx = er.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), pX, pY, pZ, 1, 1, 1, 0);
if (fx != null) {
fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
ClientUtil.setParticleVelocity(fx, velX, -0.06, velZ);
}
}
}
}
use of net.minecraft.client.particle.ParticleManager in project ForestryMC by ForestryMC.
the class ParticleRender method addBeeHiveFX.
public static void addBeeHiveFX(IBeeHousing housing, IBeeGenome genome, List<BlockPos> flowerPositions) {
World world = housing.getWorldObj();
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Vec3d particleStart = housing.getBeeFXCoordinates();
// Avoid rendering bee particles that are too far away, they're very small.
// At 32+ distance, have no bee particles. Make more particles up close.
BlockPos playerPosition = Minecraft.getMinecraft().player.getPosition();
double playerDistanceSq = playerPosition.distanceSqToCenter(particleStart.x, particleStart.y, particleStart.z);
if (world.rand.nextInt(1024) < playerDistanceSq) {
return;
}
int color = genome.getPrimary().getSpriteColour(0);
int randomInt = world.rand.nextInt(100);
if (housing instanceof IHiveTile) {
if (((IHiveTile) housing).isAngry() || randomInt >= 85) {
List<EntityLivingBase> entitiesInRange = AlleleEffect.getEntitiesInRange(genome, housing, EntityLivingBase.class);
if (!entitiesInRange.isEmpty()) {
EntityLivingBase entity = entitiesInRange.get(world.rand.nextInt(entitiesInRange.size()));
Particle particle = new ParticleBeeTargetEntity(world, particleStart, entity, color);
effectRenderer.addEffect(particle);
return;
}
}
}
if (randomInt < 75 && !flowerPositions.isEmpty()) {
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
Particle particle = new ParticleBeeRoundTrip(world, particleStart, destination, color);
effectRenderer.addEffect(particle);
} else {
Vec3i area = AlleleEffect.getModifiedArea(genome, housing);
Vec3i offset = housing.getCoordinates().add(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
BlockPos destination = VectUtil.getRandomPositionInArea(world.rand, area).add(offset);
Particle particle = new ParticleBeeExplore(world, particleStart, destination, color);
effectRenderer.addEffect(particle);
}
}
Aggregations