mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-11-14 01:14:11 +00:00
Change Craft Ordering Quantity to Allow Longs (#672)
Co-authored-by: Maya <[email protected]>
This commit is contained in:
1 parent
35fb695071
commit
5a74924e2d
7 files changed
+29
-13
No files matched your search
@@ -129,23 +129,23 @@ public abstract class GuiAmount extends AEBaseGui {
|
||||
|| btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
int resultI = addOrderAmount(this.getQty(btn));
|
||||
this.amountTextField.setText(Integer.toString(resultI));
|
||||
long resultI = addOrderAmount(this.getQty(btn));
|
||||
this.amountTextField.setText(Long.toString(resultI));
|
||||
}
|
||||
}
|
||||
|
||||
protected int addOrderAmount(final int i) {
|
||||
int resultI = getAmount();
|
||||
protected long addOrderAmount(final int i) {
|
||||
long resultL = getAmountLong();
|
||||
|
||||
if (resultI == 1 && i > 1) {
|
||||
resultI = 0;
|
||||
if (resultL == 1 && i > 1) {
|
||||
resultL = 0;
|
||||
}
|
||||
|
||||
resultI += i;
|
||||
if (resultI < 1) {
|
||||
resultI = 1;
|
||||
resultL += i;
|
||||
if (resultL < 1) {
|
||||
resultL = 1;
|
||||
}
|
||||
return resultI;
|
||||
return resultL;
|
||||
}
|
||||
|
||||
protected int getAmount() {
|
||||
@@ -159,5 +159,16 @@ public abstract class GuiAmount extends AEBaseGui {
|
||||
}
|
||||
}
|
||||
|
||||
protected long getAmountLong() {
|
||||
String out = this.amountTextField.getText();
|
||||
double resultD = Calculator.conversion(out);
|
||||
|
||||
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||
return 0;
|
||||
} else {
|
||||
return (long) ArithHelper.round(resultD, 0);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String getBackground();
|
||||
}
|
||||
@@ -403,7 +403,9 @@ public class GuiCraftConfirm extends AEBaseGui implements ICraftingCPUTableHolde
|
||||
final String byteUsed = Platform.formatByteDouble(BytesUsed);
|
||||
final String bannerText;
|
||||
if (jobTree != null && !jobTree.getErrorMessage().isEmpty()) {
|
||||
bannerText = StatCollector.translateToLocal(jobTree.getErrorMessage());
|
||||
if (jobTree.getErrorMessage().equals("java.lang.ArithmeticException: long overflow")) {
|
||||
bannerText = GuiText.CraftingSizeLimitExceeded.getLocal();
|
||||
} else bannerText = StatCollector.translateToLocal(jobTree.getErrorMessage());
|
||||
} else if (BytesUsed > 0) {
|
||||
bannerText = byteUsed;
|
||||
} else {
|
||||
|
||||
@@ -128,7 +128,7 @@ public class GuiPatternMulti extends GuiAmount {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addOrderAmount(final int i) {
|
||||
protected long addOrderAmount(final int i) {
|
||||
return i + getAmount();
|
||||
}
|
||||
|
||||
|
||||
@@ -270,6 +270,7 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingC
|
||||
}
|
||||
|
||||
public boolean cpuMatches(final CraftingCPUStatus c) {
|
||||
if (this.getUsedBytes() <= 0) return false;
|
||||
if (c.isBusy() && this.cpuCraftingSameItem(c)) {
|
||||
return c.getStorage() >= this.getUsedBytes() + c.getUsedStorage();
|
||||
}
|
||||
|
||||
@@ -169,6 +169,7 @@ public enum GuiText {
|
||||
Simulation,
|
||||
Missing,
|
||||
CraftingStepLimitExceeded,
|
||||
CraftingSizeLimitExceeded,
|
||||
NoCraftingTreeReceived,
|
||||
RequestedItem,
|
||||
SimulationIncomplete,
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PacketCraftRequest extends AppEngPacket {
|
||||
this(craftAmt, shift, CraftingMode.STANDARD);
|
||||
}
|
||||
|
||||
public PacketCraftRequest(final int craftAmt, final boolean shift, final CraftingMode craftingMode) {
|
||||
public PacketCraftRequest(final long craftAmt, final boolean shift, final CraftingMode craftingMode) {
|
||||
this.amount = craftAmt;
|
||||
this.heldShift = shift;
|
||||
this.craftingMode = craftingMode;
|
||||
|
||||
@@ -279,6 +279,7 @@ gui.appliedenergistics2.Merge=Merge
|
||||
gui.appliedenergistics2.Missing=Missing
|
||||
gui.appliedenergistics2.NoCraftingTreeReceived=No crafting tree received
|
||||
gui.appliedenergistics2.CraftingStepLimitExceeded=Crafting step limit exceeded
|
||||
gui.appliedenergistics2.CraftingSizeLimitExceeded=Crafting size limit exceeded
|
||||
gui.appliedenergistics2.RequestedItem=Requested item
|
||||
gui.appliedenergistics2.SimulationIncomplete=Simulation incomplete
|
||||
gui.appliedenergistics2.Bytes=Storage
|
||||
|
||||
Reference in new issue
Block a user