mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Improve blaze burner particles
- Now curl around blocks that are placed above - Spawns a burst of particles when fuel is added
This commit is contained in:
parent
79e78fc2d2
commit
515eb0026d
4 changed files with 57 additions and 14 deletions
|
@ -14,6 +14,7 @@ import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -80,6 +81,7 @@ public class CubeParticle extends Particle {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected float scale;
|
protected float scale;
|
||||||
|
protected boolean hot;
|
||||||
|
|
||||||
public CubeParticle(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
public CubeParticle(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||||
super(world, x, y, z);
|
super(world, x, y, z);
|
||||||
|
@ -92,12 +94,39 @@ public class CubeParticle extends Particle {
|
||||||
|
|
||||||
public void setScale(float scale) {
|
public void setScale(float scale) {
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
this.setSize(scale, scale);
|
this.setSize(scale * 0.5f, scale * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void averageAge(int age) {
|
public void averageAge(int age) {
|
||||||
this.maxAge = (int) (age + (rand.nextDouble() * 2D - 1D) * 8);
|
this.maxAge = (int) (age + (rand.nextDouble() * 2D - 1D) * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHot(boolean hot) {
|
||||||
|
this.hot = hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean billowing = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
if (this.hot && this.age > 0) {
|
||||||
|
if (this.prevPosY == this.posY) {
|
||||||
|
billowing = true;
|
||||||
|
field_228343_B_ = false; // Prevent motion being ignored due to vertical collision
|
||||||
|
if (this.motionX == 0 && this.motionZ == 0) {
|
||||||
|
Vec3d diff = new Vec3d(new BlockPos(posX, posY, posZ)).add(0.5, 0.5, 0.5).subtract(posX, posY, posZ);
|
||||||
|
this.motionX = -diff.x * 0.1;
|
||||||
|
this.motionZ = -diff.z * 0.1;
|
||||||
|
}
|
||||||
|
this.motionX *= 1.1;
|
||||||
|
this.motionY *= 0.9;
|
||||||
|
this.motionZ *= 1.1;
|
||||||
|
} else if (billowing) {
|
||||||
|
this.motionY *= 1.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.tick();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildGeometry(IVertexBuilder builder, ActiveRenderInfo renderInfo, float p_225606_3_) {
|
public void buildGeometry(IVertexBuilder builder, ActiveRenderInfo renderInfo, float p_225606_3_) {
|
||||||
|
@ -146,6 +175,7 @@ public class CubeParticle extends Particle {
|
||||||
particle.setColor(data.r, data.g, data.b);
|
particle.setColor(data.r, data.g, data.b);
|
||||||
particle.setScale(data.scale);
|
particle.setScale(data.scale);
|
||||||
particle.averageAge(data.avgAge);
|
particle.averageAge(data.avgAge);
|
||||||
|
particle.setHot(data.hot);
|
||||||
return particle;
|
return particle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,14 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
|
||||||
float scale = reader.readFloat();
|
float scale = reader.readFloat();
|
||||||
reader.expect(' ');
|
reader.expect(' ');
|
||||||
int avgAge = reader.readInt();
|
int avgAge = reader.readInt();
|
||||||
return new CubeParticleData(r, g, b, scale, avgAge);
|
reader.expect(' ');
|
||||||
|
boolean hot = reader.readBoolean();
|
||||||
|
return new CubeParticleData(r, g, b, scale, avgAge, hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CubeParticleData read(ParticleType<CubeParticleData> type, PacketBuffer buffer) {
|
public CubeParticleData read(ParticleType<CubeParticleData> type, PacketBuffer buffer) {
|
||||||
return new CubeParticleData(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readInt());
|
return new CubeParticleData(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readInt(), buffer.readBoolean());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,17 +44,19 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
|
||||||
final float b;
|
final float b;
|
||||||
final float scale;
|
final float scale;
|
||||||
final int avgAge;
|
final int avgAge;
|
||||||
|
final boolean hot;
|
||||||
|
|
||||||
public CubeParticleData(float r, float g, float b, float scale, int avgAge) {
|
public CubeParticleData(float r, float g, float b, float scale, int avgAge, boolean hot) {
|
||||||
this.r = r;
|
this.r = r;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
this.b = b;
|
this.b = b;
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
this.avgAge = avgAge;
|
this.avgAge = avgAge;
|
||||||
|
this.hot = hot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CubeParticleData dummy() {
|
public static CubeParticleData dummy() {
|
||||||
return new CubeParticleData(0, 0, 0, 0, 0);
|
return new CubeParticleData(0, 0, 0, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,10 +82,11 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
|
||||||
buffer.writeFloat(b);
|
buffer.writeFloat(b);
|
||||||
buffer.writeFloat(scale);
|
buffer.writeFloat(scale);
|
||||||
buffer.writeInt(avgAge);
|
buffer.writeInt(avgAge);
|
||||||
|
buffer.writeBoolean(hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameters() {
|
public String getParameters() {
|
||||||
return String.format(Locale.ROOT, "%s %f %f %f %f %d", AllParticleTypes.CUBE.parameter(), r, g, b, scale, avgAge);
|
return String.format(Locale.ROOT, "%s %f %f %f %f %d %s", AllParticleTypes.CUBE.parameter(), r, g, b, scale, avgAge, hot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerFakePlayer;
|
import com.simibubi.create.content.contraptions.components.deployer.DeployerFakePlayer;
|
||||||
import com.simibubi.create.content.contraptions.particle.CubeParticleData;
|
import com.simibubi.create.content.contraptions.particle.CubeParticleData;
|
||||||
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
@ -63,7 +64,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
||||||
tickRotation();
|
tickRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnParticles(getHeatLevel());
|
spawnParticles(getHeatLevel(), 1);
|
||||||
|
|
||||||
if (remainingBurnTime <= 0) {
|
if (remainingBurnTime <= 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -194,6 +195,10 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateHeatLevel();
|
updateHeatLevel();
|
||||||
|
HeatLevel level = getHeatLevel();
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
spawnParticles(level, 1 + (.25 * (i / 4)));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +220,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnParticles(BlazeBurnerBlock.HeatLevel heatLevel) {
|
private void spawnParticles(BlazeBurnerBlock.HeatLevel heatLevel, double burstMult) {
|
||||||
if (world == null)
|
if (world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -228,22 +233,22 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vec3d color = randomColor(heatLevel);
|
Vec3d color = randomColor(heatLevel);
|
||||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.03F, 15), 0.015, 0.1);
|
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.03F, 15, false), 0.015 * burstMult, 0.1 * burstMult);
|
||||||
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.FADING) {
|
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.FADING) {
|
||||||
if (r.nextDouble() > 0.5)
|
if (r.nextDouble() > 0.5)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vec3d color = randomColor(heatLevel);
|
Vec3d color = randomColor(heatLevel);
|
||||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.035F, 18), 0.03, 0.15);
|
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.035F, 18, false), 0.03 * burstMult, 0.15 * burstMult);
|
||||||
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.KINDLED) {
|
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.KINDLED) {
|
||||||
Vec3d color = randomColor(heatLevel);
|
Vec3d color = randomColor(heatLevel);
|
||||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.04F, 21), 0.05, 0.2);
|
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.04F, 35, true), 0.05 * burstMult, 0.2 * burstMult);
|
||||||
}else if (heatLevel == BlazeBurnerBlock.HeatLevel.SEETHING) {
|
}else if (heatLevel == BlazeBurnerBlock.HeatLevel.SEETHING) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (r.nextDouble() > 0.6)
|
if (r.nextDouble() > 0.6)
|
||||||
return;
|
return;
|
||||||
Vec3d color = randomColor(heatLevel);
|
Vec3d color = randomColor(heatLevel);
|
||||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.045F, 24), 0.06, 0.22);
|
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.045F, 35, true), 0.06 * burstMult, 0.22 * burstMult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,7 +259,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
||||||
world.addOptionalParticle(
|
world.addOptionalParticle(
|
||||||
particleData,
|
particleData,
|
||||||
(double) pos.getX() + 0.5D + (random.nextDouble() * 2.0 - 1D) * spread,
|
(double) pos.getX() + 0.5D + (random.nextDouble() * 2.0 - 1D) * spread,
|
||||||
(double) pos.getY() + 0.6D + random.nextDouble() / 10.0,
|
(double) pos.getY() + 0.6D + (random.nextDouble() / 4.0),
|
||||||
(double) pos.getZ() + 0.5D + (random.nextDouble() * 2.0 - 1D) * spread,
|
(double) pos.getZ() + 0.5D + (random.nextDouble() * 2.0 - 1D) * spread,
|
||||||
0.0D,
|
0.0D,
|
||||||
speed,
|
speed,
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
public net.minecraft.network.play.ServerPlayNetHandler field_147365_f # floatingTickCount
|
public net.minecraft.network.play.ServerPlayNetHandler field_147365_f # floatingTickCount
|
||||||
|
|
||||||
|
# CubeParticle
|
||||||
|
protected net.minecraft.client.particle.Particle field_228343_B_ # collidedY
|
Loading…
Reference in a new issue