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

@@ -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;
}