Skip to content

Commit

Permalink
Enable "Use as substitution" by default (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune authored Dec 13, 2022
1 parent 5fb8039 commit d9d92c7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/appeng/helpers/PatternHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/appeng/items/misc/ItemEncodedPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/appeng/parts/reporting/PartPatternTerminal.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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"));
}
Expand Down

0 comments on commit d9d92c7

Please sign in to comment.