From d9d92c771a6cf7279aa85b8599dc4991e7f73ad9 Mon Sep 17 00:00:00 2001 From: miozune Date: Wed, 14 Dec 2022 06:47:45 +0900 Subject: [PATCH] Enable "Use as substitution" by default (#204) --- .../container/implementations/ContainerPatternTermEx.java | 2 +- src/main/java/appeng/helpers/PatternHelper.java | 6 +++++- src/main/java/appeng/items/misc/ItemEncodedPattern.java | 7 ++++++- .../java/appeng/parts/reporting/PartPatternTerminal.java | 8 ++++++-- .../appeng/parts/reporting/PartPatternTerminalEx.java | 8 ++++++-- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTermEx.java b/src/main/java/appeng/container/implementations/ContainerPatternTermEx.java index 901b04cdeed..876d81ec570 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTermEx.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTermEx.java @@ -69,7 +69,7 @@ public void setHidden(boolean hide) { public boolean substitute = false; @GuiSync(96 + (17 - 9) + 13) - public boolean beSubstitute = false; + public boolean beSubstitute = true; @GuiSync(96 + (17 - 9) + 16) public boolean inverted; diff --git a/src/main/java/appeng/helpers/PatternHelper.java b/src/main/java/appeng/helpers/PatternHelper.java index 531960fa6c4..904eb97b96f 100644 --- a/src/main/java/appeng/helpers/PatternHelper.java +++ b/src/main/java/appeng/helpers/PatternHelper.java @@ -66,7 +66,11 @@ public PatternHelper(final ItemStack is, final World w) { this.isCrafting = encodedValue.getBoolean("crafting"); this.canSubstitute = encodedValue.getBoolean("substitute"); - this.canBeSubstitute = encodedValue.getBoolean("beSubstitute"); + if (encodedValue.hasKey("beSubstitute")) { + this.canBeSubstitute = encodedValue.getBoolean("beSubstitute"); + } else { + this.canBeSubstitute = true; + } this.patternItem = is; this.pattern = AEItemStack.create(is); diff --git a/src/main/java/appeng/items/misc/ItemEncodedPattern.java b/src/main/java/appeng/items/misc/ItemEncodedPattern.java index 99eeb5a3df4..86a12a316df 100644 --- a/src/main/java/appeng/items/misc/ItemEncodedPattern.java +++ b/src/main/java/appeng/items/misc/ItemEncodedPattern.java @@ -121,7 +121,12 @@ public void addCheckedInformation( final ICraftingPatternDetails details = this.getPatternForItem(stack, player.worldObj); final boolean isCrafting = encodedValue.getBoolean("crafting"); final boolean substitute = encodedValue.getBoolean("substitute"); - final boolean beSubstitute = encodedValue.getBoolean("beSubstitute"); + final boolean beSubstitute; + if (encodedValue.hasKey("beSubstitute")) { + beSubstitute = encodedValue.getBoolean("beSubstitute"); + } else { + beSubstitute = true; + } IAEItemStack[] inItems; IAEItemStack[] outItems; diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java index 4214dce617f..11b743a07fe 100644 --- a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java @@ -47,7 +47,7 @@ public class PartPatternTerminal extends AbstractPartTerminal { private boolean craftingMode = true; private boolean substitute = false; - private boolean beSubstitute = false; + private boolean beSubstitute = true; @Reflected public PartPatternTerminal(final ItemStack is) { @@ -68,7 +68,11 @@ public void readFromNBT(final NBTTagCompound data) { super.readFromNBT(data); this.setCraftingRecipe(data.getBoolean("craftingMode")); this.setSubstitution(data.getBoolean("substitute")); - this.setCanBeSubstitution(data.getBoolean("beSubstitute")); + if (data.hasKey("beSubstitute")) { + this.setCanBeSubstitution(data.getBoolean("beSubstitute")); + } else { + this.setCanBeSubstitution(true); + } this.pattern.readFromNBT(data, "pattern"); this.output.readFromNBT(data, "outputList"); this.crafting.readFromNBT(data, "craftingGrid"); diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminalEx.java b/src/main/java/appeng/parts/reporting/PartPatternTerminalEx.java index cbef9d1a9a9..07ee492d95e 100644 --- a/src/main/java/appeng/parts/reporting/PartPatternTerminalEx.java +++ b/src/main/java/appeng/parts/reporting/PartPatternTerminalEx.java @@ -26,7 +26,7 @@ public class PartPatternTerminalEx extends AbstractPartTerminal { private final AppEngInternalInventory pattern = new AppEngInternalInventory(this, 2); private boolean substitute = false; - private boolean beSubstitute = false; + private boolean beSubstitute = true; private boolean inverted = false; private int activePage = 0; @@ -53,7 +53,11 @@ public void readFromNBT(final NBTTagCompound data) { this.crafting.readFromNBT(data, "craftingGrid"); this.setSubstitution(data.getBoolean("substitute")); - this.setCanBeSubstitution(data.getBoolean("beSubstitute")); + if (data.hasKey("beSubstitute")) { + this.setCanBeSubstitution(data.getBoolean("beSubstitute")); + } else { + this.setCanBeSubstitution(true); + } this.setInverted(data.getBoolean("inverted")); this.setActivePage(data.getInteger("activePage")); }