Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev

This commit is contained in:
Daniel Amberson 2020-08-04 12:00:55 -05:00
commit 6bed40d01b
5 changed files with 57 additions and 14 deletions

View file

@ -14,6 +14,7 @@ import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -80,6 +81,7 @@ public class CubeParticle extends Particle {
};
protected float scale;
protected boolean hot;
public CubeParticle(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
super(world, x, y, z);
@ -92,12 +94,39 @@ public class CubeParticle extends Particle {
public void setScale(float scale) {
this.scale = scale;
this.setSize(scale, scale);
this.setSize(scale * 0.5f, scale * 0.5f);
}
public void averageAge(int age) {
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
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.setScale(data.scale);
particle.averageAge(data.avgAge);
particle.setHot(data.hot);
return particle;
}
}

View file

@ -28,12 +28,14 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
float scale = reader.readFloat();
reader.expect(' ');
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
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 scale;
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.g = g;
this.b = b;
this.scale = scale;
this.avgAge = avgAge;
this.hot = hot;
}
public static CubeParticleData dummy() {
return new CubeParticleData(0, 0, 0, 0, 0);
return new CubeParticleData(0, 0, 0, 0, 0, false);
}
@Override
@ -78,10 +82,11 @@ public class CubeParticleData implements IParticleData, ICustomParticle<CubePart
buffer.writeFloat(b);
buffer.writeFloat(scale);
buffer.writeInt(avgAge);
buffer.writeBoolean(hot);
}
@Override
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);
}
}

View file

@ -7,6 +7,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.contraptions.components.deployer.DeployerFakePlayer;
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.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.ColorHelper;
@ -63,7 +64,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
tickRotation();
}
spawnParticles(getHeatLevel());
spawnParticles(getHeatLevel(), 1);
if (remainingBurnTime <= 0) {
return;
@ -194,6 +195,10 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
}
updateHeatLevel();
HeatLevel level = getHeatLevel();
for (int i = 0; i < 20; i++) {
spawnParticles(level, 1 + (.25 * (i / 4)));
}
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)
return;
@ -228,22 +233,22 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
return;
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) {
if (r.nextDouble() > 0.5)
return;
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) {
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) {
for (int i = 0; i < 2; i++) {
if (r.nextDouble() > 0.6)
return;
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(
particleData,
(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,
0.0D,
speed,

View file

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 764 B