mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-25 20:38:11 +01:00
Hook up node speed to KineticTileEntity speed
This commit is contained in:
parent
28a8358b22
commit
371cae7e5a
3 changed files with 15 additions and 12 deletions
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue