Compare commits

...

1 Commits

Author SHA1 Message Date
PrototypeTrousers 66ab022c95 package patterns 2023-02-08 21:18:51 -03:00
19 changed files with 243 additions and 114 deletions
@@ -0,0 +1,5 @@
package appeng.api.config;
public enum Packaging {
ENABLED, DISABLED;
}
@@ -37,82 +37,86 @@ import java.util.List;
/**
* do not implement provided by {@link ICraftingPatternItem}
*
* <p>
* caching this INSTANCE will increase performance of validation and checks.
*/
public interface ICraftingPatternDetails
{
public interface ICraftingPatternDetails {
/**
* @return source item.
*/
ItemStack getPattern();
/**
* @return source item.
*/
ItemStack getPattern();
/**
* @param slotIndex specific slot index
* @param itemStack item in slot
* @param world crafting world
*
* @return if an item can be used in the specific slot for this pattern.
*/
boolean isValidItemForSlot( int slotIndex, ItemStack itemStack, World world );
/**
* @param slotIndex specific slot index
* @param itemStack item in slot
* @param world crafting world
* @return if an item can be used in the specific slot for this pattern.
*/
boolean isValidItemForSlot(int slotIndex, ItemStack itemStack, World world);
/**
* @return if this pattern is a crafting pattern ( work bench )
*/
boolean isCraftable();
/**
* @return if this pattern is a crafting pattern ( work bench )
*/
boolean isCraftable();
/**
* @return a list of the inputs, will include nulls.
*/
IAEItemStack[] getInputs();
/**
* @return a list of the inputs, will include nulls.
*/
IAEItemStack[] getInputs();
/**
* @return a list of the inputs, will be clean
*/
IAEItemStack[] getCondensedInputs();
/**
* @return a list of the inputs, will be clean
*/
IAEItemStack[] getCondensedInputs();
/**
* @return a list of the outputs, will be clean
*/
IAEItemStack[] getCondensedOutputs();
/**
* @return a list of the outputs, will be clean
*/
IAEItemStack[] getCondensedOutputs();
/**
* @return a list of the outputs, will include nulls.
*/
IAEItemStack[] getOutputs();
/**
* @return a list of the outputs, will include nulls.
*/
IAEItemStack[] getOutputs();
/**
* @return if this pattern is enabled to support substitutions.
*/
boolean canSubstitute();
/**
* @return if this pattern is enabled to support substitutions.
*/
boolean canSubstitute();
default List<IAEItemStack> getSubstituteInputs( int slot )
{
return Collections.emptyList();
}
default List<IAEItemStack> getSubstituteInputs(int slot) {
return Collections.emptyList();
}
/**
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
*
* @param craftingInv inventory
* @param world crafting world
*
* @return the crafted ( work bench ) item.
*/
ItemStack getOutput( InventoryCrafting craftingInv, World world );
/**
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
*
* @param craftingInv inventory
* @param world crafting world
* @return the crafted ( work bench ) item.
*/
ItemStack getOutput(InventoryCrafting craftingInv, World world);
/**
* Get the priority of this pattern
*
* @return the priority of this pattern
*/
int getPriority();
/**
* Get the priority of this pattern
*
* @return the priority of this pattern
*/
int getPriority();
/**
* Set the priority the of this pattern.
*
* @param priority priority of pattern
*/
void setPriority( int priority );
/**
* Set the priority the of this pattern.
*
* @param priority priority of pattern
*/
void setPriority(int priority);
/**
* @return if this pattern is a packaging pattern.
*/
default boolean isPackage() {
return false;
}
}
@@ -1,7 +1,7 @@
package appeng.client.gui.implementations;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.Packaging;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
@@ -36,6 +36,9 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String PACKAGING_DISABLE = "0";
private static final String PACKAGING_ENABLE = "1";
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
@@ -52,10 +55,14 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
private GuiImgButton divThreeBtn;
private GuiImgButton minusOneBtn;
private GuiImgButton maxCountBtn;
private GuiImgButton packagingEnabledBtn;
private GuiImgButton packagingDisabledBtn;
public Map<IGhostIngredientHandler.Target<?>, Object> mapTargetSlot = new HashMap<>();
private ContainerExpandedProcessingPatternTerm container;
public GuiExpandedProcessingPatternTerm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te, new ContainerExpandedProcessingPatternTerm(inventoryPlayer, te));
this.container = (ContainerExpandedProcessingPatternTerm) this.inventorySlots;
this.setReservedSpace(81);
}
@@ -112,6 +119,13 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
NetworkHandler.instance().sendToServer(new PacketValueConfig("PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
}
if (this.packagingEnabledBtn == btn || this.packagingDisabledBtn == btn) {
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig("PatternTerminal.Package", this.packagingEnabledBtn == btn ? PACKAGING_DISABLE : PACKAGING_ENABLE));
}
} catch (final IOException e) {
AELog.error(e);
}
@@ -121,29 +135,26 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
public void initGui() {
super.initGui();
this.tabCraftButton = new GuiTabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack(Blocks.CRAFTING_TABLE), GuiText.CraftingPattern.getLocal(), this.itemRender);
this.buttonList.add(this.tabCraftButton);
this.tabProcessButton = new GuiTabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack(Blocks.FURNACE), GuiText.ProcessingPattern.getLocal(), this.itemRender);
this.buttonList.add(this.tabProcessButton);
this.substitutionsEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
this.substitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsEnabledBtn);
this.packagingEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.ENABLED);
this.packagingEnabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingEnabledBtn);
this.substitutionsDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.packagingDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.DISABLED);
this.packagingDisabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingDisabledBtn);
this.clearBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
this.x3Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.MULTIPLY_BY_THREE);
this.x3Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 154, Settings.ACTIONS, ActionItems.MULTIPLY_BY_THREE);
this.x3Btn.setHalfSize(true);
this.buttonList.add(this.x3Btn);
this.x2Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO);
this.x2Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 144, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO);
this.x2Btn.setHalfSize(true);
this.buttonList.add(this.x2Btn);
@@ -151,11 +162,11 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
this.plusOneBtn.setHalfSize(true);
this.buttonList.add(this.plusOneBtn);
this.divThreeBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.DIVIDE_BY_THREE);
this.divThreeBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 154, Settings.ACTIONS, ActionItems.DIVIDE_BY_THREE);
this.divThreeBtn.setHalfSize(true);
this.buttonList.add(this.divThreeBtn);
this.divTwoBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.DIVIDE_BY_TWO);
this.divTwoBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 144, Settings.ACTIONS, ActionItems.DIVIDE_BY_TWO);
this.divTwoBtn.setHalfSize(true);
this.buttonList.add(this.divTwoBtn);
@@ -173,16 +184,21 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
this.substitutionsEnabledBtn.visible = false;
this.substitutionsDisabledBtn.visible = false;
this.x2Btn.visible = true;
this.x3Btn.visible = true;
this.divTwoBtn.visible = true;
this.divThreeBtn.visible = true;
this.plusOneBtn.visible = true;
this.minusOneBtn.visible = true;
if (this.container.packaging) {
this.packagingEnabledBtn.visible = true;
this.packagingDisabledBtn.visible = false;
} else {
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = true;
}
//this.maxCountBtn.visible = true;
super.drawFG(offsetX, offsetY, mouseX, mouseY);
@@ -21,6 +21,7 @@ package appeng.client.gui.implementations;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.Packaging;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
@@ -60,6 +61,9 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String PACKAGING_DISABLE = "0";
private static final String PACKAGING_ENABLE = "1";
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
@@ -78,6 +82,8 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
private GuiImgButton divThreeBtn;
private GuiImgButton minusOneBtn;
private GuiImgButton maxCountBtn;
private GuiImgButton packagingEnabledBtn;
private GuiImgButton packagingDisabledBtn;
public Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
public GuiPatternTerm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
@@ -149,6 +155,12 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
.sendToServer(
new PacketValueConfig("PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
}
if (this.packagingEnabledBtn == btn || this.packagingDisabledBtn == btn) {
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig("PatternTerminal.Package", this.packagingEnabledBtn == btn ? PACKAGING_DISABLE : PACKAGING_ENABLE));
}
} catch (final IOException e) {
AELog.error(e);
}
@@ -174,6 +186,14 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.packagingEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.ENABLED);
this.packagingEnabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingEnabledBtn);
this.packagingDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.DISABLED);
this.packagingDisabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingDisabledBtn);
this.clearBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
@@ -221,6 +241,8 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.divThreeBtn.visible = false;
this.plusOneBtn.visible = false;
this.minusOneBtn.visible = false;
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = false;
//this.maxCountBtn.visible = false;
if (this.container.substitute) {
@@ -231,6 +253,13 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.substitutionsDisabledBtn.visible = true;
}
} else {
if (this.container.packaging) {
this.packagingEnabledBtn.visible = true;
this.packagingDisabledBtn.visible = false;
} else {
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = true;
}
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
this.substitutionsEnabledBtn.visible = false;
@@ -125,6 +125,9 @@ public class GuiImgButton extends GuiButton implements ITooltip {
this.registerApp(4 + 3 * 16, Settings.ACTIONS, ItemSubstitution.ENABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescEnabled);
this.registerApp(7 + 3 * 16, Settings.ACTIONS, ItemSubstitution.DISABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescDisabled);
this.registerApp(8 + 3 * 16, Settings.ACTIONS, Packaging.ENABLED, ButtonToolTips.Packaging, ButtonToolTips.PackagingDescEnabled);
this.registerApp(9 + 3 * 16, Settings.ACTIONS, Packaging.DISABLED, ButtonToolTips.Packaging, ButtonToolTips.PackagingDescDisabled);
this.registerApp(16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems);
this.registerApp(18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable);
this.registerApp(19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, ButtonToolTips.View, ButtonToolTips.Craftable);
@@ -12,14 +12,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.container.slot.SlotRestrictedInput;
import appeng.container.slot.*;
import appeng.core.sync.packets.PacketPatternSlot;
import appeng.helpers.IContainerCraftingPacket;
import appeng.items.storage.ItemViewCell;
@@ -74,6 +67,8 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
public boolean craftingMode = true;
@GuiSync(96)
public boolean substitute = false;
@GuiSync(95)
public boolean packaging = false;
protected ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable, boolean bindInventory) {
super(ip, monitorable, bindInventory);
@@ -254,8 +249,12 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
encodedValue.setTag("in", tagIn);
encodedValue.setTag("out", tagOut);
encodedValue.setBoolean("crafting", this.isCraftingMode());
encodedValue.setBoolean("substitute", this.isSubstitute());
if (this.isCraftingMode()) {
encodedValue.setBoolean("crafting", this.isCraftingMode());
encodedValue.setBoolean("substitute", this.isSubstitute());
} else {
encodedValue.setBoolean("packaging", this.isPackaging());
}
output.setTagCompound(encodedValue);
@@ -532,6 +531,14 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
public void setSubstitute(final boolean substitute) {
if (getPart() != null) {
getPart().setSubstitution(substitute);
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
if (nbtTagCompound != null) {
nbtTagCompound.setBoolean("isSubstitute", substitute);
}
}
this.substitute = substitute;
if (getPart() != null) {
getPart().setSubstitution(substitute);
@@ -543,6 +550,22 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
}
public boolean isPackaging() {
return this.packaging;
}
public void setPackaging(boolean packaging) {
if (getPart() != null) {
getPart().setPackaging(packaging);
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
if (nbtTagCompound != null) {
nbtTagCompound.setBoolean("isPackaging", packaging);
}
}
this.packaging = packaging;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
@@ -552,6 +575,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
this.setCraftingMode(this.getPart().isCraftingRecipe());
this.updateOrderOfOutputSlots();
}
this.packaging = this.getPart().isPackaging();
this.substitute = this.getPart().isSubstitution();
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
@@ -570,20 +594,23 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
nbtTagCompound.setBoolean("isCraftingMode", false);
iGuiItemObject.getItemStack().setTagCompound(nbtTagCompound);
}
nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
if (nbtTagCompound != null) {
if (nbtTagCompound.hasKey("isSubstitute")) {
boolean substitute = nbtTagCompound.getBoolean("isSubstitute");
if (this.isSubstitute() != substitute) {
this.setSubstitute(substitute);
}
} else {
nbtTagCompound.setBoolean("isSubstitute", false);
if (nbtTagCompound.hasKey("isSubstitute")) {
boolean substitute = nbtTagCompound.getBoolean("isSubstitute");
if (this.isSubstitute() != substitute) {
this.setSubstitute(substitute);
}
} else {
nbtTagCompound = new NBTTagCompound();
nbtTagCompound.setBoolean("isSubstitute", false);
iGuiItemObject.getItemStack().setTagCompound(nbtTagCompound);
}
if (nbtTagCompound.hasKey("isPackaging")) {
boolean packaging = nbtTagCompound.getBoolean("isPackaging");
if (this.isPackaging() != packaging) {
this.setPackaging(packaging);
}
} else {
nbtTagCompound.setBoolean("isPackaging", false);
}
}
}
@@ -224,7 +224,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
this.output.writeToNBT(tag, "output");
this.pattern.writeToNBT(tag, "patterns");
this.upgrades.writeToNBT(tag, "upgrades");
tag.setBoolean("isPackaging", this.packaging);
this.wirelessTerminalGUIObject.saveChanges(tag);
}
}
@@ -236,6 +236,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
this.output.readFromNBT(data, "output");
this.pattern.readFromNBT(data, "patterns");
upgrades.readFromNBT(wirelessTerminalGUIObject.getItemStack().getTagCompound().getCompoundTag("upgrades"));
this.packaging = data.getBoolean("isPackaging");
}
}
@@ -116,6 +116,11 @@ public enum ButtonToolTips {
SubstitutionsOff,
SubstitutionsDescEnabled,
SubstitutionsDescDisabled,
Packaging,
PackagingOn,
PackagingOff,
PackagingDescEnabled,
PackagingDescDisabled,
CraftOnly,
CraftEither,
@@ -119,6 +119,7 @@ public enum GuiText {
And,
With,
Substitute,
Package,
Yes,
No,
@@ -255,14 +255,16 @@ public class PacketJEIRecipe extends AppEngPacket {
if (this.output != null && ((con instanceof ContainerPatternEncoder && !((ContainerPatternEncoder) con).isCraftingMode()))) {
IItemHandler outputSlots = cct.getInventoryByName("output");
for (int i = 0; i < outputSlots.getSlots(); ++i) {
ItemHandlerUtil.setStackInSlot(outputSlots, i, ItemStack.EMPTY);
}
for (int i = 0; i < this.output.size() && i < outputSlots.getSlots(); ++i) {
if (this.output.get(i) == null || this.output.get(i) == ItemStack.EMPTY) {
continue;
if (outputSlots != null) {
for (int i = 0; i < outputSlots.getSlots(); ++i) {
ItemHandlerUtil.setStackInSlot(outputSlots, i, ItemStack.EMPTY);
}
for (int i = 0; i < this.output.size() && i < outputSlots.getSlots(); ++i) {
if (this.output.get(i) == null || this.output.get(i) == ItemStack.EMPTY) {
continue;
}
ItemHandlerUtil.setStackInSlot(outputSlots, i, this.output.get(i));
}
ItemHandlerUtil.setStackInSlot(outputSlots, i, this.output.get(i));
}
}
}
@@ -23,7 +23,6 @@ import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.implementations.ContainerPatternEncoder;
import appeng.container.implementations.ContainerPatternTerm;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.util.item.AEItemStack;
@@ -157,7 +157,9 @@ public class PacketValueConfig extends AppEngPacket {
} else if (this.Name.equals("PatternTerminal.MaximizeCount")) {
cpt.maximizeCount();
} else if (this.Name.equals("PatternTerminal.Substitute")) {
cpt.getPart().setSubstitution(this.Value.equals("1"));
cpt.setSubstitute(this.Value.equals("1"));
} else if (this.Name.equals("PatternTerminal.Package")) {
cpt.setPackaging(this.Value.equals("1"));
}
}
} else if (this.Name.startsWith("StorageBus.")) {
@@ -68,6 +68,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
private final Set<TestLookup> failCache = new HashSet<>();
private final Set<TestLookup> passCache = new HashSet<>();
private final IAEItemStack pattern;
private final boolean isPackaging;
private int priority = 0;
public PatternHelper(final ItemStack is, final World w) {
@@ -80,6 +81,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
final NBTTagList inTag = encodedValue.getTagList("in", 10);
final NBTTagList outTag = encodedValue.getTagList("out", 10);
this.isCrafting = encodedValue.getBoolean("crafting");
this.isPackaging = encodedValue.getBoolean("packaging");
crafting = new InventoryCrafting(new ContainerNull(), isCrafting ? 3 : 4, isCrafting ? 3 : 4);
testFrame = new InventoryCrafting(new ContainerNull(), isCrafting ? 3 : 4, isCrafting ? 3 : 4);
@@ -207,6 +209,11 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
return this.patternItem;
}
@Override
public boolean isPackage() {
return this.isPackaging;
}
@Override
public synchronized boolean isValidItemForSlot(final int slotIndex, final ItemStack i, final World w) {
if (!this.isCrafting) {
@@ -136,6 +136,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final boolean isCrafting = details.isCraftable();
final boolean substitute = details.canSubstitute();
final boolean isPackage = details.isPackage();
final IAEItemStack[] in = details.getCondensedInputs();
final IAEItemStack[] out = details.getCondensedOutputs();
@@ -169,6 +170,11 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final String canSubstitute = substitute ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
lines.add(substitutionLabel + canSubstitute);
} else {
final String packageLabel = GuiText.Package.getLocal() + " ";
final String canPackage = isPackage ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
lines.add(packageLabel + canPackage);
}
}
@@ -546,6 +546,10 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
return;
}
if (this.finalOutput.getStackSize() == 0) {
this.completeJob();
}
this.waiting = false;
if (this.waiting || this.tasks.isEmpty()) // nothing to do here...
{
@@ -701,7 +705,11 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
for (final IAEItemStack out : details.getCondensedOutputs()) {
this.postChange(out, this.machineSrc);
this.waitingFor.add(out.copy());
if (!details.isPackage()) {
this.waitingFor.add(out.copy());
} else {
this.finalOutput.setStackSize(finalOutput.getStackSize() - out.getStackSize());
}
this.postCraftingStatusChange(out.copy());
}
@@ -23,6 +23,7 @@ public abstract class AbstractPartEncoder extends AbstractPartTerminal {
protected boolean craftingMode = true;
protected boolean substitute = false;
protected boolean packaging = false;
public AbstractPartEncoder(ItemStack is) {
super(is);
@@ -106,6 +107,14 @@ public abstract class AbstractPartEncoder extends AbstractPartTerminal {
return this.substitute;
}
public void setPackaging(boolean packaging) {
this.packaging = packaging;
}
public boolean isPackaging() {
return this.packaging;
}
public void setSubstitution(final boolean canSubstitute) {
this.substitute = canSubstitute;
}
@@ -33,7 +33,6 @@ import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import static appeng.helpers.PatternHelper.CRAFTING_GRID_DIMENSION;
import static appeng.helpers.PatternHelper.CRAFTING_OUTPUT_LIMIT;
public class PartPatternTerminal extends AbstractPartEncoder {
@@ -60,6 +59,7 @@ public class PartPatternTerminal extends AbstractPartEncoder {
super.readFromNBT(data);
this.setCraftingRecipe(data.getBoolean("craftingMode"));
this.setSubstitution(data.getBoolean("substitute"));
this.setPackaging(data.getBoolean("packaging"));
}
@Override
@@ -67,6 +67,7 @@ public class PartPatternTerminal extends AbstractPartEncoder {
super.writeToNBT(data);
data.setBoolean("craftingMode", this.craftingMode);
data.setBoolean("substitute", this.substitute);
data.setBoolean("packaging", this.packaging);
}
@Override
@@ -196,6 +196,7 @@ gui.appliedenergistics2.And=and
gui.appliedenergistics2.Creates=Creates
gui.appliedenergistics2.With=with
gui.appliedenergistics2.Substitute=Using Substitutions:
gui.appliedenergistics2.Package=Treating inputs as package:
gui.appliedenergistics2.Yes=Yes
gui.appliedenergistics2.No=No
gui.appliedenergistics2.InWorldCrafting=AE2 In World Crafting
@@ -260,6 +261,9 @@ gui.tooltips.appliedenergistics2.SubstitutionsDescEnabled=Allow substitutions of
gui.tooltips.appliedenergistics2.SubstitutionsDescDisabled=Prevent substitutions of input components.
gui.tooltips.appliedenergistics2.SubstitutionsOn=Substitutions Enabled
gui.tooltips.appliedenergistics2.SubstitutionsOff=Substitutions Disabled
gui.tooltips.appliedenergistics2.Packaging=Packaging Pattern
gui.tooltips.appliedenergistics2.PackagingDescEnabled=Treat the inputs as a package. Do not wait for the result of this pattern when crafting.
gui.tooltips.appliedenergistics2.PackagingDescDisabled=Wait for the result of this pattern. This is the DEFAULT behavior.
gui.tooltips.appliedenergistics2.Encode=Encode Pattern
gui.tooltips.appliedenergistics2.EncodeDescription=Write the entered pattern to the current encoded pattern, or to available blank pattern. Hold Shift to transfer directly to your inventory
gui.tooltips.appliedenergistics2.FuzzyMode=Fuzzy Comparison
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 34 KiB