work on wireless pattern terminal

This commit is contained in:
PrototypeTrousers
2022-10-19 20:53:05 -03:00
parent cb1011295c
commit f407a26a8f
4 changed files with 60 additions and 56 deletions
@@ -53,7 +53,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
protected SlotPatternTerm craftSlot;
protected SlotRestrictedInput patternSlotIN;
protected SlotRestrictedInput patternSlotOUT;
private IRecipe currentRecipe;
protected IRecipe currentRecipe;
protected SlotFakeCraftingMatrix[] craftingSlots;
protected OptionalSlotFake[] outputSlots;
@@ -128,7 +128,20 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
@Override
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
if (inv == this.crafting) {
this.fixCraftingRecipes();
}
}
private void fixCraftingRecipes() {
if (this.isCraftingMode()) {
for (int x = 0; x < this.crafting.getSlots(); x++) {
final ItemStack is = this.crafting.getStackInSlot(x);
if (!is.isEmpty()) {
is.setCount(1);
}
}
}
}
@Override
@@ -215,7 +228,6 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
if (maybePattern.isPresent()) {
output = maybePattern.get();
this.patternSlotOUT.putStack(output);
}
}
@@ -239,6 +251,8 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
encodedValue.setBoolean("substitute", this.isSubstitute());
output.setTagCompound(encodedValue);
patternSlotOUT.putStack(output);
}
public void multiply(int multiple) {
@@ -489,8 +503,9 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
return this.craftingMode;
}
void setCraftingMode(final boolean craftingMode) {
public void setCraftingMode(final boolean craftingMode) {
this.craftingMode = craftingMode;
this.fixCraftingRecipes();
}
@@ -518,7 +533,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
if (nbtTagCompound.hasKey("isCraftingMode")) {
boolean crafting = nbtTagCompound.getBoolean("isCraftingMode");
if (this.isCraftingMode() != crafting) {
this.setCraftingMode(crafting);
this.setCraftingMode(isCraftingMode());
this.updateOrderOfOutputSlots();
}
} else {
@@ -538,7 +553,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
if (nbtTagCompound.hasKey("isSubstitute")) {
boolean crafting = nbtTagCompound.getBoolean("isSubstitute");
if (this.isCraftingMode() != crafting) {
this.setCraftingMode(crafting);
this.setCraftingMode(!crafting);
this.updateOrderOfOutputSlots();
}
} else {