small fix
This commit is contained in:
@@ -65,7 +65,7 @@ public class KineticOutputHatchBlockEntity extends GeneratingKineticBlockEntity
|
||||
private float generatedSpeed = 0.0f;
|
||||
private float lastGeneratedSpeed = 0.0f;
|
||||
private boolean metaUnloaded = false;
|
||||
private float turbineOcV = 0.0f;
|
||||
private long turbineOcV = 0L;
|
||||
private int lastCoils = 0;
|
||||
|
||||
public KineticOutputHatchBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) {
|
||||
@@ -96,6 +96,11 @@ public class KineticOutputHatchBlockEntity extends GeneratingKineticBlockEntity
|
||||
|
||||
int rotorSpeed = turbine.getRotorSpeed();
|
||||
int maxRotorSpeed = turbine.getMaxRotorHolderSpeed();
|
||||
if (maxRotorSpeed <= 0) {
|
||||
this.generatedSpeed = 0;
|
||||
finalizeKinetics();
|
||||
return;
|
||||
}
|
||||
|
||||
float nextSpeed = ((float) rotorSpeed / (float) maxRotorSpeed) * TARGET_RPM;
|
||||
this.generatedSpeed = (float) Math.ceil(nextSpeed);
|
||||
@@ -195,8 +200,9 @@ public class KineticOutputHatchBlockEntity extends GeneratingKineticBlockEntity
|
||||
if (turbine == null) {
|
||||
return 0;
|
||||
}
|
||||
if (this.turbineOcV != turbine.getOverclockVoltage()) {
|
||||
this.turbineOcV = turbine.getOverclockVoltage();
|
||||
long overclockVoltage = turbine.getOverclockVoltage();
|
||||
if (this.turbineOcV != overclockVoltage) {
|
||||
this.turbineOcV = overclockVoltage;
|
||||
setChanged();
|
||||
sendData();
|
||||
}
|
||||
@@ -236,7 +242,7 @@ public class KineticOutputHatchBlockEntity extends GeneratingKineticBlockEntity
|
||||
}
|
||||
super.read(tag, clientPacket);
|
||||
this.generatedSpeed = tag.getFloat("GeneratedSpeed");
|
||||
this.turbineOcV = tag.getFloat("TurbineOcV");
|
||||
this.turbineOcV = tag.getLong("TurbineOcV");
|
||||
this.lastCoils = tag.getInt("LastCoils");
|
||||
}
|
||||
|
||||
@@ -244,7 +250,7 @@ public class KineticOutputHatchBlockEntity extends GeneratingKineticBlockEntity
|
||||
protected void write(CompoundTag tag, boolean clientPacket) {
|
||||
super.write(tag, clientPacket);
|
||||
tag.putFloat("GeneratedSpeed", this.generatedSpeed);
|
||||
tag.putFloat("TurbineOcV", this.turbineOcV);
|
||||
tag.putLong("TurbineOcV", this.turbineOcV);
|
||||
tag.putInt("LastCoils", this.lastCoils);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user