fluid terminal add "use substitutions" button

This commit is contained in:
asdflj committed 2022-10-31 09:16:19 +08:00
1 parent b576e4b178
commit fd6eb37369
12 files changed
+198 -107

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.10-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-116-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-117-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')
compile('com.github.GTNewHorizons:ExtraCells2:2.5.25:dev') { transitive = false }
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2:dev")
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.PatternBeSubstitution;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
@@ -37,13 +38,14 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
private GuiImgButton encodeBtn;
private GuiImgButton clearBtn;
private GuiImgButton doubleBtn;
private GuiImgButton beSubstitutionsEnabledBtn;
private GuiImgButton beSubstitutionsDisabledBtn;
private GuiFCImgButton combineEnableBtn;
private GuiFCImgButton combineDisableBtn;
public GuiBaseFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( inventoryPlayer, te, new FCBasePartContainer( inventoryPlayer, te ) );
public GuiBaseFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te, new FCBasePartContainer(inventoryPlayer, te));
this.container = (FCBasePartContainer) this.inventorySlots;
setReservedSpace(81);
}
@@ -73,9 +75,12 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
}
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn)
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
}
}
@@ -103,24 +108,37 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
this.buttonList.add( this.clearBtn );
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
this.buttonList.add( this.encodeBtn );
this.buttonList.add(this.encodeBtn);
int combineLeft = 74;
int combineTop = 153;
if (ModAndClassUtil.isDoubleButton) {
this.doubleBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE );
this.doubleBtn.setHalfSize( true );
this.buttonList.add( this.doubleBtn );
this.doubleBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE);
this.doubleBtn.setHalfSize(true);
this.buttonList.add(this.doubleBtn);
combineLeft = 84;
}
if (ModAndClassUtil.isBeSubstitutionsButton) {
combineLeft = 74;
combineTop -= 11;
this.beSubstitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.beSubstitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsEnabledBtn);
this.combineEnableBtn = new GuiFCImgButton( this.guiLeft + combineLeft, this.guiTop + this.ySize - 153, "FORCE_COMBINE", "DO_COMBINE" );
this.combineEnableBtn.setHalfSize( true );
this.buttonList.add( this.combineEnableBtn );
this.beSubstitutionsDisabledBtn = new GuiImgButton(
this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
this.beSubstitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsDisabledBtn);
this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + combineLeft, this.guiTop + this.ySize - 153, "NOT_COMBINE", "DONT_COMBINE" );
this.combineDisableBtn.setHalfSize( true );
this.buttonList.add( this.combineDisableBtn );
}
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
this.buttonList.add(this.combineEnableBtn);
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "NOT_COMBINE", "DONT_COMBINE");
this.combineDisableBtn.setHalfSize(true);
this.buttonList.add(this.combineDisableBtn);
}
@Override
@@ -159,20 +177,26 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
this.combineEnableBtn.visible = true;
this.combineDisableBtn.visible = false;
}
else
{
else {
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = true;
}
}
else
{
} else {
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = false;
}
if (ModAndClassUtil.isBeSubstitutionsButton) {
if (this.container.beSubstitute) {
this.beSubstitutionsEnabledBtn.visible = true;
this.beSubstitutionsDisabledBtn.visible = false;
} else {
this.beSubstitutionsEnabledBtn.visible = false;
this.beSubstitutionsDisabledBtn.visible = true;
}
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
}
@Override
@@ -1,9 +1,6 @@
package com.glodblock.github.client.gui;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.PatternSlotConfig;
import appeng.api.config.Settings;
import appeng.api.config.*;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -36,14 +33,15 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
private GuiImgButton invertBtn;
private GuiImgButton clearBtn;
private GuiImgButton doubleBtn;
private GuiImgButton beSubstitutionsEnabledBtn;
private GuiImgButton beSubstitutionsDisabledBtn;
private GuiFCImgButton combineEnableBtn;
private GuiFCImgButton combineDisableBtn;
private final GuiScrollbar processingScrollBar = new GuiScrollbar();
public GuiBaseFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( inventoryPlayer, te, new FCBasePartContainerEx( inventoryPlayer, te ) );
public GuiBaseFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te, new FCBasePartContainerEx(inventoryPlayer, te));
this.container = (FCBasePartContainerEx) this.inventorySlots;
setReservedSpace(81);
@@ -80,9 +78,12 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
}
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn)
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "1"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "0"));
}
}
@@ -122,17 +123,27 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
if (ModAndClassUtil.isDoubleButton) {
this.doubleBtn = new GuiImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE );
this.doubleBtn.setHalfSize( true );
this.buttonList.add( this.doubleBtn );
this.buttonList.add(this.doubleBtn);
}
this.combineEnableBtn = new GuiFCImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 143, "FORCE_COMBINE", "DO_COMBINE" );
this.combineEnableBtn.setHalfSize( true );
this.buttonList.add( this.combineEnableBtn );
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 143, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
this.buttonList.add(this.combineEnableBtn);
this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 143, "NOT_COMBINE", "DONT_COMBINE" );
this.combineDisableBtn.setHalfSize( true );
this.buttonList.add( this.combineDisableBtn );
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 143, "NOT_COMBINE", "DONT_COMBINE");
this.combineDisableBtn.setHalfSize(true);
this.buttonList.add(this.combineDisableBtn);
if (ModAndClassUtil.isBeSubstitutionsButton) {
this.beSubstitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 133, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.beSubstitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsEnabledBtn);
this.beSubstitutionsDisabledBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 133, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
this.beSubstitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsDisabledBtn);
}
processingScrollBar.setTop(this.ySize - 164);
}
@@ -163,19 +174,25 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.fluidPrioritizedDisabledBtn.visible = false;
}
if ( this.container.combine )
{
if (this.container.combine) {
this.combineEnableBtn.visible = true;
this.combineDisableBtn.visible = false;
}
else
{
} else {
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = true;
}
if (ModAndClassUtil.isBeSubstitutionsButton) {
if (this.container.beSubstitute) {
this.beSubstitutionsEnabledBtn.visible = true;
this.beSubstitutionsDisabledBtn.visible = false;
} else {
this.beSubstitutionsEnabledBtn.visible = false;
this.beSubstitutionsDisabledBtn.visible = true;
}
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
this.processingScrollBar.draw(this);
}
@@ -119,6 +119,7 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
pattern.setInputs(collectInventory(craftingSlots));
pattern.setOutputs(collectInventory(outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
patternSlotOUT.putStack(pattern.writeToStack());
}
@@ -116,6 +116,7 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
pattern.setCombine(this.combine ? 1:0);
pattern.setInputs(collectInventory(craftingSlots));
pattern.setOutputs(collectInventory(outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
patternSlotOUT.putStack(pattern.writeToStack());
}
@@ -54,20 +54,22 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
protected final SlotPatternTerm craftSlot;
protected final SlotRestrictedInput patternSlotIN;
protected final SlotRestrictedInput patternSlotOUT;
@GuiSync( 97 )
@GuiSync(97)
public boolean craftingMode = true;
@GuiSync( 96 )
@GuiSync(96)
public boolean substitute = false;
@GuiSync( 95 )
@GuiSync(95)
public boolean combine = false;
@GuiSync(94)
public boolean beSubstitute = false;
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable) {
super(ip, monitorable, false);
this.patternTerminal = (PartFluidPatternTerminal) monitorable;
final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
final IInventory output = this.getPatternTerminal().getInventoryByName( "output" );
final IInventory patternInv = this.getPatternTerminal().getInventoryByName("pattern");
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
this.crafting = this.getPatternTerminal().getInventoryByName( "crafting" );
@@ -238,9 +240,9 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "crafting", this.isCraftingMode() );
encodedValue.setBoolean( "substitute", this.isSubstitute() );
output.setTagCompound( encodedValue );
encodedValue.setBoolean("substitute", this.isSubstitute());
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
output.setTagCompound(encodedValue);
}
private ItemStack[] getInputs()
@@ -460,6 +462,7 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
this.substitute = this.patternTerminal.isSubstitution();
this.combine = this.patternTerminal.shouldCombine();
this.beSubstitute = this.patternTerminal.canBeSubstitute();
}
}
@@ -543,23 +546,23 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
return this.craftingMode;
}
private void setCraftingMode( final boolean craftingMode )
{
private void setCraftingMode(final boolean craftingMode) {
this.craftingMode = craftingMode;
}
public PartFluidPatternTerminal getPatternTerminal()
{
public PartFluidPatternTerminal getPatternTerminal() {
return this.patternTerminal;
}
private boolean isSubstitute()
{
private boolean canBeSubstitute() {
return this.beSubstitute;
}
private boolean isSubstitute() {
return this.substitute;
}
public void setSubstitute( final boolean substitute )
{
public void setSubstitute(final boolean substitute) {
this.substitute = substitute;
}
@@ -63,25 +63,26 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
protected final ProcessingSlotFake[] outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
protected final SlotRestrictedInput patternSlotIN;
protected final SlotRestrictedInput patternSlotOUT;
@GuiSync( 96 + (17-9) + 11 )
@GuiSync(96 + (17 - 9) + 11)
public boolean combine = false;
@GuiSync( 96 + (17-9) + 12 )
@GuiSync(96 + (17 - 9) + 12)
public boolean substitute = false;
@GuiSync( 96 + (17-9) + 16 )
@GuiSync(96 + (17 - 9) + 16)
public boolean inverted;
@GuiSync( 96 + (17-9) + 17 )
@GuiSync(96 + (17 - 9) + 17)
public int activePage = 0;
@GuiSync( 96 + (17-9) + 13 )
@GuiSync(96 + (17 - 9) + 13)
public boolean prioritize = false;
@GuiSync(96 + (17 - 9) + 14)
public boolean beSubstitute = false;
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable) {
super(ip, monitorable, false);
this.patternTerminal = (PartFluidPatternTerminalEx) monitorable;
this.inverted = patternTerminal.isInverted();
final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
final IInventory output = this.getPatternTerminal().getInventoryByName( "output" );
final IInventory patternInv = this.getPatternTerminal().getInventoryByName("pattern");
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
IInventory crafting = this.getPatternTerminal().getInventoryByName("crafting");
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
@@ -210,9 +211,9 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "substitute", this.isSubstitute() );
encodedValue.setTag( "in", tagIn );
encodedValue.setBoolean("substitute", this.isSubstitute());
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
encodedValue.setTag("in", tagIn);
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "prioritize", this.isPrioritize() );
@@ -315,6 +316,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
{
this.substitute = this.patternTerminal.isSubstitution();
this.combine = this.patternTerminal.shouldCombine(); //Check out
this.beSubstitute = this.patternTerminal.canBeSubstitute();
this.prioritize = this.patternTerminal.isPrioritize();
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
inverted = patternTerminal.isInverted();
@@ -451,10 +453,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
{
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots))
{
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
{
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots)) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
}
@@ -463,6 +463,10 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
}
}
private boolean canBeSubstitute() {
return this.beSubstitute;
}
static boolean containsFluid(SlotFake[] slots) {
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long fluid = enabledSlots.stream().filter(s -> Util.isFluidPacket(s.getStack())).count();
@@ -41,6 +41,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
private boolean craftingMode = true;
private boolean substitute = false;
private boolean combine = false;
private boolean beSubstitute = false;
public PartFluidPatternTerminal(ItemStack is) {
super(is, true);
@@ -82,8 +83,9 @@ public class PartFluidPatternTerminal extends FCBasePart {
super.readFromNBT( data );
this.setCraftingRecipe( data.getBoolean( "craftingMode" ) );
this.setSubstitution( data.getBoolean( "substitute" ) );
this.setCombineMode( data.getBoolean("combine") );
this.pattern.readFromNBT( data, "pattern" );
this.setCombineMode(data.getBoolean("combine"));
this.setBeSubstitute(data.getBoolean("beSubstitute"));
this.pattern.readFromNBT(data, "pattern");
this.output.readFromNBT( data, "outputList" );
this.crafting.readFromNBT( data, "craftingGrid" );
}
@@ -94,8 +96,9 @@ public class PartFluidPatternTerminal extends FCBasePart {
super.writeToNBT( data );
data.setBoolean( "craftingMode", this.craftingMode );
data.setBoolean( "substitute", this.substitute );
data.setBoolean( "combine", this.combine );
this.pattern.writeToNBT( data, "pattern" );
data.setBoolean("combine", this.combine);
data.setBoolean("beSubstitute", this.beSubstitute);
this.pattern.writeToNBT(data, "pattern");
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
}
@@ -137,6 +140,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
if(newStack != null){
NBTTagCompound data = newStack.getTagCompound();
this.setCombineMode(data.getInteger("combine") == 1);
this.setBeSubstitute(data.getBoolean("beSubstitute"));
}
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
this.crafting.setInventorySlotContents(i, null);
@@ -209,23 +213,29 @@ public class PartFluidPatternTerminal extends FCBasePart {
return this.combine;
}
public void setSubstitution( boolean canSubstitute )
{
public void setSubstitution(boolean canSubstitute) {
this.substitute = canSubstitute;
}
public void setCombineMode(boolean shouldCombine)
{
public void setCombineMode(boolean shouldCombine) {
this.combine = shouldCombine;
}
public void setBeSubstitute(boolean canBeSubstitute) {
this.beSubstitute = canBeSubstitute;
}
public boolean canBeSubstitute() {
return this.beSubstitute;
}
public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutput) {
IInventory crafting = this.getInventoryByName("crafting");
IInventory output = this.getInventoryByName("output");
if (crafting instanceof AppEngInternalInventory && output instanceof AppEngInternalInventory) {
for (int x = 0; x < crafting.getSizeInventory() && x < newCrafting.length; x++) {
final IAEItemStack item = newCrafting[x];
crafting.setInventorySlotContents(x, item == null ? null: item.getItemStack());
crafting.setInventorySlotContents(x, item == null ? null : item.getItemStack());
}
for (int x = 0; x < output.getSizeInventory() && x < newOutput.length; x++) {
final IAEItemStack item = newOutput[x];
@@ -42,6 +42,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
private boolean combine = false;
private boolean prioritize = false;
private boolean inverted = false;
private boolean beSubstitute = false;
private int activePage = 0;
public PartFluidPatternTerminalEx(ItemStack is) {
@@ -87,9 +88,9 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
this.setCombineMode( data.getBoolean("combine") );
this.pattern.readFromNBT( data, "pattern" );
this.output.readFromNBT( data, "outputList" );
this.crafting.readFromNBT( data, "craftingGrid" );
this.setSubstitution( data.getBoolean( "substitute" ) );
this.crafting.readFromNBT(data, "craftingGrid");
this.setBeSubstitute(data.getBoolean("beSubstitute"));
this.setSubstitution(data.getBoolean("substitute"));
this.setPrioritization( data.getBoolean( "priorization") );
this.setInverted( data.getBoolean( "inverted" ) );
this.setActivePage( data.getInteger( "activePage" ) );
@@ -104,7 +105,8 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
data.setBoolean( "combine", this.combine );
this.pattern.writeToNBT( data, "pattern" );
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
this.crafting.writeToNBT(data, "craftingGrid");
data.setBoolean("beSubstitute", this.beSubstitute);
data.setBoolean("priorization", this.prioritize);
data.setBoolean( "substitute", this.substitute );
data.setBoolean( "inverted", this.inverted );
@@ -163,7 +165,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
if(newStack != null){
NBTTagCompound data = newStack.getTagCompound();
this.setCombineMode(data.getInteger("combine") == 1);
this.setPrioritization(data.getInteger("prioritize") == 1);
this.setBeSubstitute(data.getBoolean("beSubstitute"));
}
this.setInverted(inputsCount <= 8 && outputCount > 8);
this.setActivePage(0);
@@ -224,22 +226,27 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
this.combine = shouldCombine;
}
public boolean isSubstitution()
{
public boolean isSubstitution() {
return this.substitute;
}
public boolean isPrioritize()
{
public boolean isPrioritize() {
return this.prioritize;
}
public void setSubstitution( boolean canSubstitute )
{
public void setBeSubstitute(boolean canBeSubstitute) {
this.beSubstitute = canBeSubstitute;
}
public boolean canBeSubstitute() {
return this.beSubstitute;
}
public void setSubstitution(boolean canSubstitute) {
this.substitute = canSubstitute;
}
public void setPrioritization( boolean canPrioritize )
{
public void setPrioritization(boolean canPrioritize) {
this.prioritize = canPrioritize;
}
@@ -95,6 +95,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
case "PatternTerminal.Combine":
cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
break;
case "PatternTerminal.beSubstitute":
cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
break;
}
} else if( Name.startsWith( "PatternTerminalEx." ) && (c instanceof ContainerFluidPatternTerminalEx))
{
@@ -134,6 +137,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
case "PatternTerminalEx.Prioritize":
cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
break;
case "PatternTerminalEx.beSubstitute":
cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
break;
}
} else if(Name.equals( "Terminal.Cpu" ) && c instanceof ContainerFluidCraftConfirm) {
final ContainerFluidCraftConfirm qk = (ContainerFluidCraftConfirm) c;
@@ -22,12 +22,21 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
private IAEItemStack[] inputs = null, inputsCond = null, outputs = null, outputsCond = null;
private int priority = 0;
private int combine = 0;
private int beSubstitute = 0;
public FluidPatternDetails(ItemStack stack) {
this.patternStack = stack;
this.patternStackAe = Objects.requireNonNull(AEItemStack.create(stack)); // s2g
}
public boolean canBeSubstitute() {
return beSubstitute != 0;
}
public void setCanBeSubstitute(int beSubstitute) {
this.beSubstitute = beSubstitute;
}
@Override
public ItemStack getPattern() {
return patternStack;
@@ -150,6 +159,7 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
tag.setTag("in", writeStackArray(checkInitialized(inputs)));
tag.setTag("out", writeStackArray(checkInitialized(outputs)));
tag.setInteger("combine", this.getCombine());
tag.setBoolean("beSubstitute", this.canBeSubstitute());
patternStack.setTagCompound(tag);
patternStackAe = Objects.requireNonNull(AEItemStack.create(patternStack));
return patternStack;
@@ -33,6 +33,8 @@ public final class ModAndClassUtil {
public static boolean isShiftTooltip;
public static boolean isBigInterface;
public static boolean isBeSubstitutionsButton;
public static Class<?> essentiaGas;
@SuppressWarnings("all")
@@ -69,6 +71,12 @@ public final class ModAndClassUtil {
} catch (NoSuchFieldException e) {
isDoubleButton = false;
}
try {
Field d = ButtonToolTips.class.getDeclaredField("BeSubstitutionsDescEnabled");
isBeSubstitutionsButton = true;
} catch (NoSuchFieldException e) {
isBeSubstitutionsButton = false;
}
try {
Field d = Settings.class.getDeclaredField("SAVE_SEARCH");