a
This commit is contained in:
parent
e5f0e563a4
commit
839313bde4
@ -40,7 +40,7 @@ public class BlockEntityAndroidStation extends BlockEntity implements MenuProvid
|
|||||||
return new AndroidStationMenu(containerID, inventory, new AndroidStationMenu.AndroidStationContainer(ply), this);
|
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_) {
|
public BlockEntityAndroidStation(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(OverdriveThatMatters.ANDROID_STATION_FACTORY, p_155229_, p_155230_);
|
super(OverdriveThatMatters.ANDROID_STATION_FACTORY, p_155229_, p_155230_);
|
||||||
|
@ -9,7 +9,7 @@ public class BigDecimalDataContainer implements ContainerData {
|
|||||||
public static final int NETWORK_PAYLOAD_SIZE = 8;
|
public static final int NETWORK_PAYLOAD_SIZE = 8;
|
||||||
|
|
||||||
private BigDecimal value;
|
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() {
|
public BigDecimal getDecimal() {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -32,9 +32,7 @@ public class BigDecimalDataContainer implements ContainerData {
|
|||||||
|
|
||||||
byte[] build = new byte[_build[0] & 0xFF];
|
byte[] build = new byte[_build[0] & 0xFF];
|
||||||
|
|
||||||
for (int i = 0; i < build.length; i++) {
|
System.arraycopy(_build, 1, build, 0, build.length);
|
||||||
build[i] = _build[i + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
value = new BigDecimal(new BigInteger(build), buffer[0]);
|
value = new BigDecimal(new BigInteger(build), buffer[0]);
|
||||||
return value;
|
return value;
|
||||||
@ -55,8 +53,7 @@ public class BigDecimalDataContainer implements ContainerData {
|
|||||||
byte[] build = new byte[NETWORK_PAYLOAD_SIZE * 4];
|
byte[] build = new byte[NETWORK_PAYLOAD_SIZE * 4];
|
||||||
|
|
||||||
// insert, shift by one
|
// insert, shift by one
|
||||||
for (int i = 0; i < Math.min(_build.length, NETWORK_PAYLOAD_SIZE * 4 - 1); i++)
|
System.arraycopy(_build, 0, build, 1, Math.min(_build.length, NETWORK_PAYLOAD_SIZE * 4 - 1));
|
||||||
build[i + 1] = _build[i];
|
|
||||||
|
|
||||||
// tell how many bytes are in there
|
// tell how many bytes are in there
|
||||||
build[0] = (byte) _build.length;
|
build[0] = (byte) _build.length;
|
||||||
|
@ -54,6 +54,9 @@ public class AndroidStationScreen extends AbstractContainerScreen<AndroidStation
|
|||||||
level = 0d;
|
level = 0d;
|
||||||
} else {
|
} else {
|
||||||
level = energy.divide(max_energy, MatteryCapability.ROUND_RULES).doubleValue();
|
level = energy.divide(max_energy, MatteryCapability.ROUND_RULES).doubleValue();
|
||||||
|
|
||||||
|
if (level >= 0.98)
|
||||||
|
level = 1d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level > 0.01)
|
if (level > 0.01)
|
||||||
|
Loading…
Reference in New Issue
Block a user