mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
11 files changed
+117
-8
No files matched your search
@@ -11,7 +11,6 @@ import appeng.container.slot.AppEngSlot;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.FCBasePartContainerEx;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -24,11 +23,15 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
|
||||
private static final String SUBSITUTION_DISABLE = "0";
|
||||
private static final String SUBSITUTION_ENABLE = "1";
|
||||
private static final String PRIORITY_DISABLE = "0";
|
||||
private static final String PRIORITY_ENABLE = "1";
|
||||
|
||||
public FCBasePartContainerEx container;
|
||||
|
||||
private GuiImgButton substitutionsEnabledBtn;
|
||||
private GuiImgButton substitutionsDisabledBtn;
|
||||
private GuiFCImgButton fluidPrioritizedEnabledBtn;
|
||||
private GuiFCImgButton fluidPrioritizedDisabledBtn;
|
||||
private GuiImgButton encodeBtn;
|
||||
private GuiImgButton invertBtn;
|
||||
private GuiImgButton clearBtn;
|
||||
@@ -65,6 +68,10 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
}
|
||||
else if( this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Prioritize", container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE ) );
|
||||
}
|
||||
else if( this.invertBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Invert", container.inverted ? "0" : "1" ) );
|
||||
@@ -93,6 +100,14 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
this.substitutionsDisabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsDisabledBtn );
|
||||
|
||||
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "FORCE_PRIO", "DO_PRIO" );
|
||||
this.fluidPrioritizedEnabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.fluidPrioritizedEnabledBtn );
|
||||
|
||||
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "NOT_PRIO", "DONT_PRIO" );
|
||||
this.fluidPrioritizedDisabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.fluidPrioritizedDisabledBtn );
|
||||
|
||||
invertBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 153, Settings.ACTIONS, container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
|
||||
invertBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.invertBtn );
|
||||
@@ -137,6 +152,16 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
this.substitutionsEnabledBtn.visible = false;
|
||||
this.substitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
if( this.container.prioritize )
|
||||
{
|
||||
this.fluidPrioritizedEnabledBtn.visible = false;
|
||||
this.fluidPrioritizedDisabledBtn.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fluidPrioritizedEnabledBtn.visible = true;
|
||||
this.fluidPrioritizedDisabledBtn.visible = false;
|
||||
}
|
||||
|
||||
if ( this.container.combine )
|
||||
{
|
||||
@@ -184,11 +209,20 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
substitutionsEnabledBtn.visible = false;
|
||||
substitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
if (container.prioritize) {
|
||||
fluidPrioritizedEnabledBtn.visible = true;
|
||||
fluidPrioritizedDisabledBtn.visible = false;
|
||||
} else {
|
||||
fluidPrioritizedEnabledBtn.visible = false;
|
||||
fluidPrioritizedDisabledBtn.visible = true;
|
||||
}
|
||||
|
||||
final int offset = container.inverted? 18 * -3: 0;
|
||||
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
invertBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
|
||||
@@ -37,6 +37,8 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
appearances = new HashMap<>();
|
||||
this.registerApp( 0, "NOT_COMBINE", "DONT_COMBINE", "not_combine" );
|
||||
this.registerApp( 1, "FORCE_COMBINE", "DO_COMBINE", "combine" );
|
||||
this.registerApp( 2, "FORCE_PRIO", "DO_PRIO", "prio" );
|
||||
this.registerApp( 3, "NOT_PRIO", "DONT_PRIO", "not_prio" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public class GuiFCPriority extends AEBaseGui
|
||||
private GuiButton plus10;
|
||||
private GuiButton plus100;
|
||||
private GuiButton plus1000;
|
||||
private GuiButton plus10000;
|
||||
private GuiButton minus1;
|
||||
private GuiButton minus10;
|
||||
private GuiButton minus100;
|
||||
@@ -56,16 +57,20 @@ public class GuiFCPriority extends AEBaseGui
|
||||
final int b = AEConfig.instance.priorityByStacksAmounts( 1 );
|
||||
final int c = AEConfig.instance.priorityByStacksAmounts( 2 );
|
||||
final int d = AEConfig.instance.priorityByStacksAmounts( 3 );
|
||||
final int e = AEConfig.instance.priorityByStacksAmounts( 4 );
|
||||
|
||||
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
|
||||
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
|
||||
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
|
||||
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
|
||||
this.buttonList.add( this.plus10000 = new GuiButton( 0, this.guiLeft + 140, this.guiTop + 32, 42, 20, "+" + e ) );
|
||||
|
||||
|
||||
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
|
||||
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
|
||||
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
||||
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
||||
this.buttonList.add( this.plus10000 = new GuiButton( 0, this.guiLeft + 140, this.guiTop + 32, 42, 20, "+" + e ) );
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
|
||||
|
||||
@@ -68,6 +68,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
public boolean inverted;
|
||||
@GuiSync( 96 + (17-9) + 17 )
|
||||
public int activePage = 0;
|
||||
@GuiSync( 96 + (17-9) + 13 )
|
||||
public boolean prioritize = false;
|
||||
|
||||
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
@@ -207,6 +209,11 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "substitute", this.isSubstitute() );
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "piroritize", this.isPrioritize() );
|
||||
|
||||
|
||||
output.setTagCompound( encodedValue );
|
||||
}
|
||||
|
||||
@@ -305,7 +312,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
this.combine = this.patternTerminal.shouldCombine();
|
||||
this.combine = this.patternTerminal.shouldCombine(); //Check out
|
||||
this.prioritize = this.patternTerminal.isPrioritize();
|
||||
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
activePage = patternTerminal.getActivePage();
|
||||
@@ -386,6 +394,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
private boolean isPrioritize() { return this.prioritize; }
|
||||
|
||||
static boolean canDoubleStacks(SlotFake[] slots)
|
||||
{
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
|
||||
import akka.actor.Status;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public enum FluidPrioritization {
|
||||
ENABLED,
|
||||
DISABLED;
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
|
||||
private boolean substitute = false;
|
||||
private boolean combine = false;
|
||||
private boolean prioritize = false;
|
||||
private boolean inverted = false;
|
||||
private int activePage = 0;
|
||||
|
||||
@@ -80,7 +81,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
|
||||
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
this.setCombineMode( data.getBoolean("combine") );
|
||||
this.pattern.readFromNBT( data, "pattern" );
|
||||
@@ -88,6 +89,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
this.crafting.readFromNBT( data, "craftingGrid" );
|
||||
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
this.setPrioritization( data.getBoolean( "priorization") );
|
||||
this.setInverted( data.getBoolean( "inverted" ) );
|
||||
this.setActivePage( data.getInteger( "activePage" ) );
|
||||
}
|
||||
@@ -96,13 +98,13 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
|
||||
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "combine", this.combine );
|
||||
this.pattern.writeToNBT( data, "pattern" );
|
||||
this.output.writeToNBT( data, "outputList" );
|
||||
this.crafting.writeToNBT( data, "craftingGrid" );
|
||||
|
||||
data.setBoolean("priorization", this.prioritize);
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "inverted", this.inverted );
|
||||
data.setInteger( "activePage", this.activePage );
|
||||
@@ -221,10 +223,19 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
public boolean isPrioritize()
|
||||
{
|
||||
return this.prioritize;
|
||||
}
|
||||
|
||||
public void setSubstitution( boolean canSubstitute )
|
||||
{
|
||||
this.substitute = canSubstitute;
|
||||
}
|
||||
public void setPrioritization( boolean canPrioritize )
|
||||
{
|
||||
this.prioritize = canPrioritize;
|
||||
}
|
||||
|
||||
public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutput) {
|
||||
IInventory crafting = this.getInventoryByName("crafting");
|
||||
|
||||
+7
-1
@@ -4,8 +4,10 @@ import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiBaseFluidPatternTerminalEx;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
|
||||
import com.glodblock.github.client.gui.container.FluidPrioritization;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.nei.recipes.FluidRecipe;
|
||||
import com.glodblock.github.network.CPacketTransferRecipe;
|
||||
@@ -30,7 +32,11 @@ public class FluidPatternTerminalRecipeTransferHandler implements IOverlayHandle
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
|
||||
if (isCorrectGui(firstGui)) {
|
||||
List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex);
|
||||
boolean priority = false;
|
||||
if (firstGui instanceof GuiBaseFluidPatternTerminalEx) {
|
||||
priority = ((GuiBaseFluidPatternTerminalEx)firstGui).container.prioritize;
|
||||
}
|
||||
List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex, priority);
|
||||
List<OrderStack<?>> out = FluidRecipe.getPackageOutputs(recipe, recipeIndex, !notUseOther(recipe));
|
||||
boolean craft = shouldCraft(recipe);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketTransferRecipe(in, out, craft));
|
||||
|
||||
@@ -6,6 +6,11 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import gregtech.common.items.GT_FluidDisplayItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -24,14 +29,30 @@ public final class FluidRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index) {
|
||||
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index, boolean priority) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null || !IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return new ArrayList<>();
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageInputsLegacy(recipe, index);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(tRecipe.getIngredientStacks(index));
|
||||
return extractor.getInputIngredients(tmp, recipe, index);
|
||||
List<OrderStack<?>> out = extractor.getInputIngredients(tmp, recipe, index);
|
||||
if (priority) {
|
||||
List<OrderStack<?>> reordered = new ArrayList<>();
|
||||
byte numFluids = 0;
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof FluidStack) {
|
||||
reordered.add(new OrderStack(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof ItemStack) {
|
||||
reordered.add(new OrderStack(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
return reordered;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
|
||||
@@ -112,6 +112,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
case "PatternTerminalEx.ActivePage":
|
||||
cpt.getPatternTerminal().setActivePage(Integer.parseInt(Value));
|
||||
break;
|
||||
case "PatternTerminalEx.Prioritize":
|
||||
cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
|
||||
break;
|
||||
}
|
||||
} else if(Name.equals( "Terminal.Cpu" ) && c instanceof ContainerFluidCraftConfirm) {
|
||||
final ContainerFluidCraftConfirm qk = (ContainerFluidCraftConfirm) c;
|
||||
|
||||
@@ -40,6 +40,11 @@ ae2fc.tooltip.not_combine.hint=Disabled
|
||||
ae2fc.tooltip.combine=Merge the same items
|
||||
ae2fc.tooltip.combine.hint=Enabled
|
||||
|
||||
ae2fc.tooltip.not_prio=Allow fluids to be placed first
|
||||
ae2fc.tooltip.not_prio.hint=Enabled
|
||||
ae2fc.tooltip.prio=Allow fluids to be placed first
|
||||
ae2fc.tooltip.prio.hint=Disabled
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal
|
||||
ae2fc.gui.fluid_pattern_encoder=Fluid Pattern Encoder
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 1.1 KiB |
Reference in new issue
Block a user