This commit is contained in:
DBotThePony 2021-08-09 19:42:17 +07:00
parent e5f0e563a4
commit 839313bde4
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 7 additions and 7 deletions

View File

@ -40,7 +40,7 @@ public class BlockEntityAndroidStation extends BlockEntity implements MenuProvid
return new AndroidStationMenu(containerID, inventory, new AndroidStationMenu.AndroidStationContainer(ply), this);
}
private final MatteryMachineEnergyStorage energy = new MatteryMachineEnergyStorage(MatteryMachineEnergyStorage.MachineType.WORKER, new BigDecimal(1_000_000_000_000L));
private final MatteryMachineEnergyStorage energy = new MatteryMachineEnergyStorage(MatteryMachineEnergyStorage.MachineType.WORKER);
public BlockEntityAndroidStation(BlockPos p_155229_, BlockState p_155230_) {
super(OverdriveThatMatters.ANDROID_STATION_FACTORY, p_155229_, p_155230_);

View File

@ -9,7 +9,7 @@ public class BigDecimalDataContainer implements ContainerData {
public static final int NETWORK_PAYLOAD_SIZE = 8;
private BigDecimal value;
private int[] buffer = new int[NETWORK_PAYLOAD_SIZE + 1];
private final int[] buffer = new int[NETWORK_PAYLOAD_SIZE + 1];
public BigDecimal getDecimal() {
if (value != null) {
@ -32,9 +32,7 @@ public class BigDecimalDataContainer implements ContainerData {
byte[] build = new byte[_build[0] & 0xFF];
for (int i = 0; i < build.length; i++) {
build[i] = _build[i + 1];
}
System.arraycopy(_build, 1, build, 0, build.length);
value = new BigDecimal(new BigInteger(build), buffer[0]);
return value;
@ -55,8 +53,7 @@ public class BigDecimalDataContainer implements ContainerData {
byte[] build = new byte[NETWORK_PAYLOAD_SIZE * 4];
// insert, shift by one
for (int i = 0; i < Math.min(_build.length, NETWORK_PAYLOAD_SIZE * 4 - 1); i++)
build[i + 1] = _build[i];
System.arraycopy(_build, 0, build, 1, Math.min(_build.length, NETWORK_PAYLOAD_SIZE * 4 - 1));
// tell how many bytes are in there
build[0] = (byte) _build.length;

View File

@ -54,6 +54,9 @@ public class AndroidStationScreen extends AbstractContainerScreen<AndroidStation
level = 0d;
} else {
level = energy.divide(max_energy, MatteryCapability.ROUND_RULES).doubleValue();
if (level >= 0.98)
level = 1d;
}
if (level > 0.01)