FENSU and DFC fixes

This commit is contained in:
Boblet 2023-08-14 16:40:14 +02:00
parent 157456a0c8
commit 6b381821b8
4 changed files with 29 additions and 0 deletions

View File

@ -43,6 +43,7 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
public boolean isOn;
public FluidTank tank;
public long prev;
public static long maxJoules = Long.MAX_VALUE / 100_000;
public static final int range = 50;
@ -98,6 +99,8 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
for(int i = 1; i <= range; i++) {
if(out > maxJoules) out = maxJoules;
beam = i;
int x = xCoord + dir.offsetX * i;

View File

@ -146,4 +146,30 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery {
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public long transferPower(long power) {
long overshoot = 0;
// if power exceeds our transfer limit, truncate
if(power > maxTransfer) {
overshoot += power - maxTransfer;
power = maxTransfer;
}
// this check is in essence the same as the default implementation, but re-arranged to never overflow the int64 range
// if the remaining power exceeds the power cap, truncate again
long freespace = this.getMaxPower() - this.getPower();
if(freespace < power) {
overshoot += power - freespace;
power = freespace;
}
// what remains is sure to not exceed the transfer limit and the power cap (and therefore the int64 range)
this.setPower(this.getPower() + power);
return overshoot;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB