Fix custom machine crashing clients/invalidating packets due to buffer underflow.
This commit is contained in:
BallOfEnergy 2025-01-08 08:20:49 -06:00
parent 5746a90cb7
commit 3882b9b82c

View File

@ -231,6 +231,8 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen
public void serialize(ByteBuf buf) { public void serialize(ByteBuf buf) {
super.serialize(buf); super.serialize(buf);
BufferUtil.writeString(buf, this.machineType);
buf.writeLong(power); buf.writeLong(power);
buf.writeInt(progress); buf.writeInt(progress);
buf.writeInt(flux); buf.writeInt(flux);
@ -596,13 +598,13 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen
return 0; return 0;
} }
@Override @Override
public long getReceiverSpeed() { public long getReceiverSpeed() {
if(this.config != null && !this.config.generatorMode) return this.getMaxPower(); if(this.config != null && !this.config.generatorMode) return this.getMaxPower();
return 0; return 0;
} }
@Override @Override
public long getProviderSpeed() { public long getProviderSpeed() {
if(this.config != null && this.config.generatorMode) return this.getMaxPower(); if(this.config != null && this.config.generatorMode) return this.getMaxPower();