diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 9a10d5eba..252b6fd04 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -241,16 +241,17 @@ public class KineticTileEntity extends SmartTileEntity @Override protected void read(CompoundTag compound, boolean clientPacket) { - boolean overStressedBefore = overStressed; - clearKineticInformation(); + //boolean overStressedBefore = overStressed; + //clearKineticInformation(); // DO NOT READ kinetic information when placed after movement - if (wasMoved) { - super.read(compound, clientPacket); - return; - } + //if (wasMoved) { + // super.read(compound, clientPacket); + // return; + //} - speed = compound.getFloat("Speed"); + if (clientPacket) + speed = compound.getFloat("Speed"); // if (compound.contains("Source")) // source = NbtUtils.readBlockPos(compound.getCompound("Source")); @@ -268,8 +269,8 @@ public class KineticTileEntity extends SmartTileEntity super.read(compound, clientPacket); - if (clientPacket && overStressedBefore != overStressed && speed != 0) - effects.triggerOverStressedEffect(); +// if (clientPacket && overStressedBefore != overStressed && speed != 0) +// effects.triggerOverStressedEffect(); if (clientPacket) DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this)); @@ -294,7 +295,10 @@ public class KineticTileEntity extends SmartTileEntity } public void setSpeed(float speed) { + float prevSpeed = this.speed; this.speed = speed; + onSpeedChanged(prevSpeed); + sendData(); } public boolean hasSource() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNetwork.java b/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNetwork.java index f0419405d..3b8a4e6ff 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNetwork.java +++ b/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNetwork.java @@ -71,7 +71,7 @@ public class KineticNetwork { return SolveResult.CONTRADICTION; } - // find the generator that would maximize the root speed + // search over all generators to maximize the root speed float newSpeed = 0; float sign = 0; for (KineticNode generator : generators) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNode.java b/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNode.java index b2d2c038f..fb6e1a035 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNode.java +++ b/src/main/java/com/simibubi/create/content/contraptions/solver/KineticNode.java @@ -170,8 +170,7 @@ public class KineticNode { public void flushChangedSpeed() { if (speedCur != speedNext) { speedCur = speedNext; - // TODO: update entity's speed - System.out.printf("Set speed of %s to %f\n", this, speedNext); + entity.setSpeed(speedCur); } }