mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
make level maintainer able to use lite crafting mode (#463)
Co-authored-by: Martin Robertz <[email protected]> Co-authored-by: AnsonYeung <[email protected]>
This commit is contained in:
8 files changed
+107
-8
No files matched your search
@@ -16,6 +16,8 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
Batch,
|
||||
Enable,
|
||||
Disable,
|
||||
ToggleLiteMode,
|
||||
ClearLiteMode,
|
||||
}
|
||||
|
||||
private Action action;
|
||||
@@ -25,6 +27,12 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
@SuppressWarnings("unused")
|
||||
public CPacketLevelMaintainer() {}
|
||||
|
||||
public CPacketLevelMaintainer(Action action) {
|
||||
this.action = action;
|
||||
this.slotIndex = -1;
|
||||
this.size = 0;
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(Action action, int slotIndex) {
|
||||
this.action = action;
|
||||
this.slotIndex = slotIndex;
|
||||
@@ -62,6 +70,8 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
case Batch -> clm.getTile().updateBatchSize(message.slotIndex, message.size);
|
||||
case Enable -> clm.getTile().updateStatus(message.slotIndex, false);
|
||||
case Disable -> clm.getTile().updateStatus(message.slotIndex, true);
|
||||
case ToggleLiteMode -> clm.getTile().toggleLiteMode();
|
||||
case ClearLiteMode -> clm.getTile().clearLiteMode();
|
||||
}
|
||||
clm.updateGui();
|
||||
}
|
||||
|
||||
@@ -18,13 +18,15 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
|
||||
private Info[] infoList;
|
||||
private boolean onlyState;
|
||||
private boolean isLiteMode;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public SPacketLevelMaintainerGuiUpdate() {}
|
||||
|
||||
public SPacketLevelMaintainerGuiUpdate(RequestInfo[] requests, boolean onlyState) {
|
||||
public SPacketLevelMaintainerGuiUpdate(RequestInfo[] requests, boolean onlyState, boolean isLiteMode) {
|
||||
this.infoList = new Info[REQ_COUNT];
|
||||
this.onlyState = onlyState;
|
||||
this.isLiteMode = isLiteMode;
|
||||
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (requests[i] == null) {
|
||||
@@ -43,6 +45,7 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.infoList = new Info[REQ_COUNT];
|
||||
this.onlyState = buf.readBoolean();
|
||||
this.isLiteMode = buf.readBoolean();
|
||||
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (buf.readBoolean()) {
|
||||
@@ -64,6 +67,7 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeBoolean(this.onlyState);
|
||||
buf.writeBoolean(this.isLiteMode);
|
||||
for (Info info : this.infoList) {
|
||||
buf.writeBoolean(info != null);
|
||||
if (info == null) continue;
|
||||
@@ -114,6 +118,8 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
gui.updateComponent(i, info.quantity, info.batchSize, info.enable, info.state);
|
||||
}
|
||||
}
|
||||
|
||||
gui.updateComponent(message.isLiteMode);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user