mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
Merge branch 'master' into asm
This commit is contained in:
18 files changed
+199
-248
No files matched your search
+16
-10
@@ -34,27 +34,33 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.6.44-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-474-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.6.51-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-502-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.8.1:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.5.19:dev")
|
||||
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.5.22:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev")
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.22:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.20:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.62:dev') {
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.19:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.22:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.10:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.27-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.1-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.27-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.77:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.2:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.5.22:dev")
|
||||
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -19,7 +20,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -43,7 +43,6 @@ import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.gui.IInterfaceTerminalPostUpdate;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -71,6 +70,7 @@ import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
// TODO why is this copy pasting all the UI code from AE2 instead of reusing it ???
|
||||
public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillTextField, IInterfaceTerminalPostUpdate {
|
||||
|
||||
public static final int HEADER_HEIGHT = 52;
|
||||
@@ -220,9 +220,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
|
||||
offsetY = guiButtonAssemblersOnly.yPosition + 18;
|
||||
|
||||
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
|
||||
setSearchString();
|
||||
}
|
||||
setSearchString();
|
||||
|
||||
this.setScrollBar();
|
||||
this.repositionSlots();
|
||||
@@ -323,7 +321,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
initGui();
|
||||
super.scheduleGuiResize();
|
||||
} else if (btn == searchStringSave) {
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
}
|
||||
@@ -344,9 +342,16 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
|
||||
public void setSearchString() {
|
||||
searchFieldInputs.setText(searchFieldInputsText);
|
||||
searchFieldOutputs.setText(searchFieldOutputsText);
|
||||
searchFieldNames.setText(searchFieldNamesText);
|
||||
boolean setString = AEConfig.instance.preserveSearchBar || isSubGui();
|
||||
if (searchFieldInputs.getText().isEmpty() && setString) {
|
||||
searchFieldInputs.setText(searchFieldInputsText);
|
||||
}
|
||||
if (searchFieldOutputs.getText().isEmpty() && setString) {
|
||||
searchFieldOutputs.setText(searchFieldOutputsText);
|
||||
}
|
||||
if (searchFieldNames.getText().isEmpty() && setString) {
|
||||
searchFieldNames.setText(searchFieldNamesText);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -840,7 +845,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
addCmd.name,
|
||||
addCmd.rows,
|
||||
addCmd.rowSize,
|
||||
addCmd.online).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
|
||||
addCmd.online,
|
||||
addCmd.p2pOutput).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
|
||||
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
|
||||
masterList.addEntry(entry);
|
||||
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRemove) {
|
||||
@@ -1142,6 +1148,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
String output = GuiInterfaceWireless.this.searchFieldOutputs.getText().toLowerCase();
|
||||
|
||||
for (InterfaceWirelessEntry entry : entries) {
|
||||
if (!entry.online || entry.p2pOutput) continue;
|
||||
|
||||
var moleAss = AEApi.instance().definitions().blocks().molecularAssembler().maybeStack(1);
|
||||
entry.dispY = -9999;
|
||||
if (onlyMolecularAssemblers
|
||||
@@ -1232,13 +1240,14 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
int guiHeight;
|
||||
int dispY = -9999;
|
||||
boolean online;
|
||||
boolean p2pOutput;
|
||||
private Boolean[] brokenRecipes;
|
||||
int numItems = 0;
|
||||
/** Should recipe be filtered out/grayed out? */
|
||||
boolean[] filteredRecipes;
|
||||
private int hoveredSlotIdx = -1;
|
||||
|
||||
InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online) {
|
||||
InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online, boolean p2pOutput) {
|
||||
this.id = id;
|
||||
if (StatCollector.canTranslate(name)) {
|
||||
this.dispName = StatCollector.translateToLocal(name);
|
||||
@@ -1254,6 +1263,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
this.rows = rows;
|
||||
this.rowSize = rowSize;
|
||||
this.online = online;
|
||||
this.p2pOutput = p2pOutput;
|
||||
this.optionsButton = new GuiFCImgButton(2, 0, "HIGHLIGHT", "YES");
|
||||
this.optionsButton.setHalfSize(true);
|
||||
this.renameButton = new GuiFCImgButton(2, 0, "EDIT", "YES");
|
||||
@@ -1372,25 +1382,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
blockPos.getDimension(),
|
||||
ForgeDirection.getOrientation(side)));
|
||||
} else {
|
||||
/* View in world */
|
||||
WorldCoord blockPos2 = new WorldCoord(
|
||||
(int) mc.thePlayer.posX,
|
||||
(int) mc.thePlayer.posY,
|
||||
(int) mc.thePlayer.posZ);
|
||||
if (mc.theWorld.provider.dimensionId != dim) {
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlock(
|
||||
blockPos,
|
||||
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z));
|
||||
}
|
||||
BlockPosHighlighter.highlightBlocks(
|
||||
mc.thePlayer,
|
||||
Collections.singletonList(blockPos),
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
PlayerMessages.InterfaceInOtherDim.getName());
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -354,18 +353,21 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Rectangle getSlotArea(SlotFake slot) {
|
||||
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
if (draggedStack != null) {
|
||||
draggedStack.stackSize = 0;
|
||||
if (draggedStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
draggedStack.stackSize = 0;
|
||||
Slot slotAtPosition = this.getSlotAtPosition(mouseX, mouseY);
|
||||
if (slotAtPosition == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.cont.getRequestSlots().length; i++) {
|
||||
SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i];
|
||||
if (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) {
|
||||
if (slotAtPosition.equals(slot)) {
|
||||
ItemStack itemStack = createLevelValues(draggedStack.copy());
|
||||
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
|
||||
slot.putStack(itemStack);
|
||||
|
||||
@@ -12,6 +12,7 @@ import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRena
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -34,7 +35,6 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -65,7 +65,6 @@ import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.gui.IGuiTooltipHandler;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -349,8 +348,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
if (btn == terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
|
||||
reinitialize();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
|
||||
iBtn.set(next);
|
||||
@@ -359,11 +357,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
private void reinitialize() {
|
||||
buttonList.clear();
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
@@ -1327,8 +1320,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (!section.visible || mouseButton < 0 || mouseButton > 2) {
|
||||
return false;
|
||||
}
|
||||
@@ -1343,7 +1334,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
dim,
|
||||
ForgeDirection.getOrientation(side),
|
||||
"");
|
||||
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(player)) {
|
||||
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
@@ -1361,23 +1352,12 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
} else {
|
||||
/* View in world */
|
||||
WorldCoord blockPos2 = new WorldCoord((int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
if (mc.theWorld.provider.dimensionId != dim) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlock(
|
||||
blockPos,
|
||||
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z));
|
||||
}
|
||||
player.closeScreen();
|
||||
BlockPosHighlighter.highlightBlocks(
|
||||
mc.thePlayer,
|
||||
Collections.singletonList(blockPos),
|
||||
PlayerMessages.LevelEmitterHighlighted.getName(),
|
||||
PlayerMessages.LevelEmitterInAnotherDim.getName());
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1393,25 +1373,17 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
// send packet to server, request an update
|
||||
InventoryAction action = switch (mouseButton) {
|
||||
case 0 -> {
|
||||
// pickup / set-down.
|
||||
yield null;
|
||||
}
|
||||
case 1 -> {
|
||||
yield null;
|
||||
}
|
||||
case 0 -> null; // pickup / set-down.
|
||||
case 1 -> null;
|
||||
case 2 -> {
|
||||
// creative dupe:
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
if (mc.thePlayer.capabilities.isCreativeMode) {
|
||||
yield InventoryAction.CREATIVE_DUPLICATE;
|
||||
} else {
|
||||
yield InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
// drop item:
|
||||
yield null;
|
||||
}
|
||||
default -> null;// drop item:
|
||||
};
|
||||
|
||||
if (action != null) {
|
||||
|
||||
@@ -137,6 +137,28 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
this.buttonList.addAll(termBtns);
|
||||
}
|
||||
|
||||
private boolean scheduleGuiResize;
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
if (scheduleGuiResize) {
|
||||
// in the GuiScreen class, the implementation of super.mouseClicked
|
||||
// ends up looping on the button list and execute the action for any
|
||||
// button below the mouse.
|
||||
// Therefore, if we initGui() the terminal in the actionPerformed method below
|
||||
// it will run the actionPerformed a second time for the new button
|
||||
// that will end up being below the mouse (if any) after the initGui()
|
||||
buttonList.clear();
|
||||
initGui();
|
||||
scheduleGuiResize = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected final void scheduleGuiResize() {
|
||||
scheduleGuiResize = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
@@ -116,10 +117,11 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
"PatternTerminal.Combine",
|
||||
this.combineDisableBtn == btn ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
final int eventButton = Mouse.getEventButton();
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Double",
|
||||
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0") + (eventButton == 1 ? "1" : "0")));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||
|
||||
@@ -70,6 +70,7 @@ import appeng.util.item.AEItemStack;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
|
||||
// TODO why is this copy pasting all the UI code from AE2 instead of reusing it ???
|
||||
public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||
|
||||
@@ -102,7 +103,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
protected GuiImgButton searchStringSave;
|
||||
protected GuiImgButton typeFilter;
|
||||
protected boolean hasShiftKeyDown = false;
|
||||
private boolean reInitializationRequested = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||
@@ -161,17 +161,14 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
}
|
||||
iBtn.set(next);
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
this.reInitalize();
|
||||
memoryText = this.searchField.getText();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
protected void reInitalize() {
|
||||
reInitializationRequested = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
@@ -668,11 +665,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
if (reInitializationRequested) {
|
||||
reInitializationRequested = false;
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
this.repo.setPowered(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
+2
-2
@@ -153,9 +153,9 @@ public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleStacks(boolean isShift) {
|
||||
public void doubleStacks(boolean isShift, boolean divide) {
|
||||
if (!isCraftingMode()) {
|
||||
super.doubleStacks(isShift);
|
||||
super.doubleStacks(isShift, divide);
|
||||
}
|
||||
}
|
||||
}
|
||||
+70
-45
@@ -537,57 +537,82 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean canDouble(SlotFake[] slots, int mult) {
|
||||
for (Slot s : slots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
long result = (long) ItemFluidPacket.getFluidAmount(st) * mult;
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
long result = (long) s.getStack().stackSize * mult;
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void doubleStacksInternal(SlotFake[] slots, int mult) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
|
||||
} else {
|
||||
st.stackSize *= mult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift) {
|
||||
public void doubleStacks(boolean isShift, boolean divide) {
|
||||
if (!isCraftingMode()) {
|
||||
if (isShift) {
|
||||
if (canDouble(this.craftingSlots, 8) && canDouble(this.outputSlots, 8)) {
|
||||
doubleStacksInternal(this.craftingSlots, 8);
|
||||
doubleStacksInternal(this.outputSlots, 8);
|
||||
}
|
||||
} else {
|
||||
if (canDouble(this.craftingSlots, 2) && canDouble(this.outputSlots, 2)) {
|
||||
doubleStacksInternal(this.craftingSlots, 2);
|
||||
doubleStacksInternal(this.outputSlots, 2);
|
||||
}
|
||||
final int mult = (isShift ? 8 : 2) * (divide ? -1 : 1);
|
||||
if (canMultiplyOrDivide(this.craftingSlots, mult) && canMultiplyOrDivide(this.outputSlots, mult)) {
|
||||
multiplyOrDivideStacksInternal(this.craftingSlots, mult);
|
||||
multiplyOrDivideStacksInternal(this.outputSlots, mult);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
static boolean canMultiplyOrDivide(SlotFake[] slots, int mult) {
|
||||
if (mult > 0) {
|
||||
for (Slot s : slots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
final long count;
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
count = ItemFluidPacket.getFluidAmount(st);
|
||||
} else {
|
||||
count = s.getStack().stackSize;
|
||||
}
|
||||
long result = count * mult;
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (mult < 0) {
|
||||
mult = Math.abs(mult);
|
||||
for (Slot s : slots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
final int count;
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
count = ItemFluidPacket.getFluidAmount(st);
|
||||
} else {
|
||||
count = s.getStack().stackSize;
|
||||
}
|
||||
if (count % mult != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void multiplyOrDivideStacksInternal(SlotFake[] slots, int mult) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
if (mult > 0) {
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
|
||||
} else {
|
||||
st.stackSize *= mult;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mult < 0) {
|
||||
mult = Math.abs(mult);
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) / mult);
|
||||
} else {
|
||||
st.stackSize /= mult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
||||
if (this.patternTerminal != null) {
|
||||
|
||||
@@ -46,6 +46,7 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
@@ -97,6 +98,27 @@ public class PartFluidStorageBus extends PartUpgradeable
|
||||
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
|
||||
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
|
||||
this.source = new MachineSource(this);
|
||||
if (is.getTagCompound() != null) {
|
||||
NBTTagCompound tag = is.getTagCompound();
|
||||
if (tag.hasKey("priority")) {
|
||||
priority = tag.getInteger("priority");
|
||||
// if we don't do this, the tag will stick forever to the storage bus, as it's never cleaned up,
|
||||
// even when the item is broken with a pickaxe
|
||||
this.is.setTagCompound(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(final PartItemStack type) {
|
||||
if (type == PartItemStack.Wrench) {
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("priority", priority);
|
||||
final ItemStack copy = this.is.copy();
|
||||
copy.setTagCompound(tag);
|
||||
return copy;
|
||||
}
|
||||
return super.getItemStack(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -31,11 +30,9 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
|
||||
@@ -43,7 +40,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
private final BaseActionSource ownActionSource = new MachineSource(this);
|
||||
private final FluidDiscretizingInventory fluidDropInv = new FluidDiscretizingInventory();
|
||||
private final FluidCraftingInventory fluidCraftInv = new FluidCraftingInventory();
|
||||
private boolean prevActiveState = false;
|
||||
|
||||
public TileFluidDiscretizer() {
|
||||
@@ -60,12 +56,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public List<IMEInventoryHandler> getCellArray(StorageChannel channel) {
|
||||
if (getProxy().isActive()) {
|
||||
if (channel == StorageChannel.ITEMS) {
|
||||
return Collections.singletonList(fluidDropInv.invHandler);
|
||||
} else if (channel == StorageChannel.FLUIDS) {
|
||||
return Collections.singletonList(fluidCraftInv.invHandler);
|
||||
}
|
||||
if (channel == StorageChannel.ITEMS && getProxy().isActive()) {
|
||||
return Collections.singletonList(fluidDropInv.invHandler);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -263,85 +255,4 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
|
||||
private class FluidCraftingInventoryHandler extends MEInventoryHandler<IAEFluidStack> {
|
||||
|
||||
public FluidCraftingInventoryHandler(IMEInventory<IAEFluidStack> i, StorageChannel channel) {
|
||||
super(i, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(IAEFluidStack input) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEFluidStack input) {
|
||||
ICraftingGrid craftingGrid;
|
||||
try {
|
||||
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
|
||||
} catch (GridAccessException e) {
|
||||
return false;
|
||||
}
|
||||
if (craftingGrid instanceof CraftingGridCache craftingGridCache) {
|
||||
return craftingGridCache.canAccept(ItemFluidDrop.newAeStack(input));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoCraftingInventory() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private class FluidCraftingInventory implements IMEInventory<IAEFluidStack> {
|
||||
|
||||
private final MEInventoryHandler<IAEFluidStack> invHandler = new FluidCraftingInventoryHandler(
|
||||
this,
|
||||
getChannel());
|
||||
|
||||
FluidCraftingInventory() {
|
||||
invHandler.setPriority(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
|
||||
ICraftingGrid craftingGrid;
|
||||
try {
|
||||
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
if (craftingGrid instanceof CraftingGridCache) {
|
||||
IAEStack remaining = ((CraftingGridCache) craftingGrid)
|
||||
.injectItems(ItemFluidDrop.newAeStack(input), type, ownActionSource);
|
||||
if (remaining instanceof IAEItemStack) {
|
||||
return ItemFluidDrop.getAeFluidStack((IAEItemStack) remaining);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,23 +77,22 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
case "PatternTerminal.Clear" -> cpt.clear();
|
||||
case "PatternTerminal.Substitute" -> cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
|
||||
case "PatternTerminal.Invert" -> cpt.getPatternTerminal().setInverted(Value.equals("1"));
|
||||
case "PatternTerminal.Double" -> cpt.doubleStacks(Value.equals("1"));
|
||||
case "PatternTerminal.Double" -> cpt.doubleStacks(Value.charAt(0) == '1', Value.charAt(1) == '1');
|
||||
case "PatternTerminal.Combine" -> cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
|
||||
case "PatternTerminal.beSubstitute" -> cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
|
||||
case "PatternTerminal.ActivePage" -> cpt.getPatternTerminal()
|
||||
.setActivePage(Integer.parseInt(Value));
|
||||
case "PatternTerminal.ActivePage" ->
|
||||
cpt.getPatternTerminal().setActivePage(Integer.parseInt(Value));
|
||||
case "PatternTerminal.Prioritize" -> {
|
||||
switch (Value) {
|
||||
case "0", "1" -> cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
|
||||
case "2" -> cpt.getPatternTerminal().sortCraftingItems();
|
||||
}
|
||||
}
|
||||
case "PatternTerminal.AutoFillerPattern" -> cpt.getPatternTerminal()
|
||||
.setAutoFillPattern(Value.equals("1"));
|
||||
case "PatternTerminal.AutoFillerPattern" ->
|
||||
cpt.getPatternTerminal().setAutoFillPattern(Value.equals("1"));
|
||||
}
|
||||
cpt.getPatternTerminal().saveSettings();
|
||||
} else if (Name.startsWith("StorageBus.") && c instanceof ContainerFluidStorageBus) {
|
||||
final ContainerFluidStorageBus ccw = (ContainerFluidStorageBus) c;
|
||||
} else if (Name.startsWith("StorageBus.") && c instanceof ContainerFluidStorageBus ccw) {
|
||||
if (Name.equals("StorageBus.Action")) {
|
||||
if (Value.equals("Partition")) {
|
||||
ccw.partition();
|
||||
|
||||
@@ -7,3 +7,5 @@ public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop
|
||||
public net.minecraft.client.gui.inventory.GuiContainer field_147006_u #theSlot
|
||||
|
||||
public net.minecraft.client.renderer.texture.TextureMap field_110574_e # mapRegisteredSprites
|
||||
|
||||
protected net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet.minecraft.inventory.Slot; # getSlotAtPosition
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 1015 B |
Binary file not shown.
|
After Width: | Height: | Size: 636 B |
Reference in new issue
Block a user