fixed particles updating twice per tick

This commit is contained in:
Ellpeck 2018-11-04 18:42:35 +01:00
parent c49b961131
commit 7f5c054f0a
8 changed files with 48 additions and 45 deletions

View file

@ -136,8 +136,8 @@ public class BlockAncientLeaves extends BlockLeaves implements
pos.getX() + rand.nextDouble(), pos.getY(), pos.getZ() + rand.nextDouble(),
0F, 0F, 0F, 0xc46df9,
rand.nextFloat() * 2F + 0.5F,
rand.nextInt(100) + 150,
rand.nextFloat() * 0.01F + 0.001F, true, true);
rand.nextInt(50) + 75,
rand.nextFloat() * 0.02F + 0.002F, true, true);
}
}

View file

@ -33,8 +33,8 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
pos.getX() + 0.35F + rand.nextFloat() * 0.3F,
pos.getY() + 0.2F,
pos.getZ() + 0.35F + rand.nextFloat() * 0.3F,
0F, rand.nextFloat() * 0.008F + 0.005F, 0F,
rand.nextBoolean() ? 0xf46e42 : 0xf49541, rand.nextFloat() + 0.5F, 100, 0F, true, true);
0F, rand.nextFloat() * 0.016F + 0.01F, 0F,
rand.nextBoolean() ? 0xf46e42 : 0xf49541, rand.nextFloat() + 0.5F, 50, 0F, true, true);
}
}

View file

@ -89,7 +89,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
this.pos.getX() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.pos.getY() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.world.rand.nextFloat() * 0.01F + 0.05F, color, 1F
this.world.rand.nextFloat() * 0.02F + 0.1F, color, 1F
));
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8));
}

View file

@ -46,7 +46,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
this.pos.getX() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.pos.getY() + 0.15F,
this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F,
this.world.rand.nextFloat() * 0.035F + 0.035F, 0x89cc37, this.world.rand.nextFloat() + 0.5F
this.world.rand.nextFloat() * 0.07F + 0.07F, 0x89cc37, this.world.rand.nextFloat() + 0.5F
));
}
}

View file

@ -85,7 +85,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
this.pos.getY() + rand.nextFloat() * 10F,
this.pos.getZ() + (float) rand.nextGaussian() * 10F,
this.pos.getX() + 0.5F, this.pos.getY() + 0.5F, this.pos.getZ() + 0.5F,
rand.nextFloat() * 0.05F + 0.05F, 0x89cc37, rand.nextFloat() * 1F + 1F
rand.nextFloat() * 0.1F + 0.1F, 0x89cc37, rand.nextFloat() * 1F + 1F
));
}
}
@ -148,22 +148,22 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
if (this.container.getStoredAura() > 0) {
NaturesAura.proxy.spawnMagicParticle(this.world,
this.pos.getX() - 4F + rand.nextFloat(), this.pos.getY() + 3F, this.pos.getZ() + rand.nextFloat(),
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(200) + 100, -0.025F, true, true);
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(100) + 50, -0.05F, true, true);
}
if (this.container.getStoredAura() >= fourths) {
NaturesAura.proxy.spawnMagicParticle(this.world,
this.pos.getX() + 4F + rand.nextFloat(), this.pos.getY() + 3F, this.pos.getZ() + rand.nextFloat(),
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(200) + 100, -0.025F, true, true);
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(100) + 50, -0.05F, true, true);
}
if (this.container.getStoredAura() >= fourths * 2) {
NaturesAura.proxy.spawnMagicParticle(this.world,
this.pos.getX() + rand.nextFloat(), this.pos.getY() + 3F, this.pos.getZ() - 4F + rand.nextFloat(),
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(200) + 100, -0.025F, true, true);
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(100) + 50, -0.05F, true, true);
}
if (this.container.getStoredAura() >= fourths * 3) {
NaturesAura.proxy.spawnMagicParticle(this.world,
this.pos.getX() + rand.nextFloat(), this.pos.getY() + 3F, this.pos.getZ() + 4F + rand.nextFloat(),
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(200) + 100, -0.025F, true, true);
0F, 0F, 0F, this.container.getAuraColor(), rand.nextFloat() * 3F + 1F, rand.nextInt(100) + 50, -0.05F, true, true);
}
}

View file

@ -61,7 +61,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
(float) pos.getY() + 0.85F,
(float) pos.getZ() + 0.2F + this.world.rand.nextFloat() * 0.6F,
this.ritualPos.getX() + 0.5F, this.ritualPos.getY() + this.world.rand.nextFloat() * 3F + 2F, this.ritualPos.getZ() + 0.5F,
this.world.rand.nextFloat() * 0.02F + 0.02F, 0x89cc37, this.world.rand.nextFloat() * 1F + 1F
this.world.rand.nextFloat() * 0.04F + 0.04F, 0x89cc37, this.world.rand.nextFloat() * 1F + 1F
));
}
});

View file

@ -28,6 +28,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
@ -75,12 +76,14 @@ public class ClientEvents {
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (!mc.isGamePaused()) {
ParticleHandler.updateParticles();
}
if (mc.world == null) {
ParticleHandler.clearParticles();
if (event.phase == Phase.END) {
Minecraft mc = Minecraft.getMinecraft();
if (!mc.isGamePaused()) {
ParticleHandler.updateParticles();
}
if (mc.world == null) {
ParticleHandler.clearParticles();
}
}
}

View file

@ -79,18 +79,18 @@ public class PacketParticles implements IMessage {
dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(),
dustPos.getY() + 0.1F,
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(),
(float) world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.005F + 0.01F,
(float) world.rand.nextGaussian() * 0.01F,
0xf4cb42, 2F, 100, 0F, false, true);
(float) world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.01F + 0.02F,
(float) world.rand.nextGaussian() * 0.02F,
0xf4cb42, 2F, 50, 0F, false, true);
});
break;
case 1: // Tree ritual: Consuming item
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
NaturesAura.proxy.spawnMagicParticle(world,
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
(float) world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, (float) world.rand.nextGaussian() * 0.02F,
0x89cc37, 1.5F, 50, 0F, false, true);
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
0x89cc37, 1.5F, 25, 0F, false, true);
}
break;
case 2: // Tree ritual: Tree disappearing
@ -98,15 +98,15 @@ public class PacketParticles implements IMessage {
NaturesAura.proxy.spawnMagicParticle(world,
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
0F, 0F, 0F,
0x33FF33, 1F, 100, 0F, false, true);
0x33FF33, 1F, 50, 0F, false, true);
}
break;
case 3: // Tree ritual: Spawn result item
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
NaturesAura.proxy.spawnMagicParticle(world,
message.posX, message.posY, message.posZ,
world.rand.nextGaussian() * 0.05F, world.rand.nextGaussian() * 0.05F, world.rand.nextGaussian() * 0.05F,
0x89cc37, 2F, 200, 0F, true, true);
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
0x89cc37, 2F, 100, 0F, true, true);
}
break;
case 4: // Nature altar: Conversion
@ -115,8 +115,8 @@ public class PacketParticles implements IMessage {
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.9F + 0.25F * world.rand.nextFloat(),
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.01F, world.rand.nextGaussian() * 0.01F,
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 40, 0F, false, true);
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
}
break;
case 5: // Potion generator
@ -127,8 +127,8 @@ public class PacketParticles implements IMessage {
message.posX + world.rand.nextFloat(),
message.posY + 1.1F,
message.posZ + world.rand.nextFloat(),
world.rand.nextGaussian() * 0.005F, world.rand.nextFloat() * 0.05F, world.rand.nextGaussian() * 0.005F,
color, 2F + world.rand.nextFloat(), 80, 0F, true, true);
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
if (disperse)
for (int x = -1; x <= 1; x += 2)
@ -137,10 +137,10 @@ public class PacketParticles implements IMessage {
message.posX + x * 3 + 0.5F,
message.posY + 2.5,
message.posZ + z * 3 + 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.02F,
world.rand.nextGaussian() * 0.01F,
0xd6340c, 1F + world.rand.nextFloat() * 2F, 150, 0F, true, true);
world.rand.nextGaussian() * 0.02F,
world.rand.nextFloat() * 0.04F,
world.rand.nextGaussian() * 0.02F,
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
}
}
break;
@ -150,8 +150,8 @@ public class PacketParticles implements IMessage {
message.posX + world.rand.nextFloat(),
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + world.rand.nextFloat(),
0F, world.rand.nextFloat() * 0.01F, 0F,
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 100, 0F, false, true);
0F, world.rand.nextFloat() * 0.02F, 0F,
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
break;
case 7: // Flower generator consumation
@ -161,10 +161,10 @@ public class PacketParticles implements IMessage {
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextGaussian() * 0.01F,
world.rand.nextGaussian() * 0.01F,
color, world.rand.nextFloat() * 2F + 1F, 50, 0F, false, true);
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
world.rand.nextGaussian() * 0.02F,
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
break;
case 8: // Flower generator aura creation
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
@ -172,10 +172,10 @@ public class PacketParticles implements IMessage {
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
message.posY + 1.01F,
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
world.rand.nextGaussian() * 0.005F,
world.rand.nextFloat() * 0.02F + 0.01F,
world.rand.nextGaussian() * 0.005F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 80, 0F, false, true);
world.rand.nextGaussian() * 0.01F,
world.rand.nextFloat() * 0.04F + 0.02F,
world.rand.nextGaussian() * 0.01F,
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
break;
}
}