Compare commits

..
Author SHA1 Message Date
Martin Robertz 507d6ca2a0 update 2025-01-20 19:07:55 +01:00
lordIcocain 8315db5ee9 second commit 2025-01-20 19:41:08 +02:00
lordIcocain 913088788f first commit 2025-01-20 19:37:37 +02:00
40 changed files with 1631 additions and 1025 deletions

No files matched your search

+14 -12
View File
@@ -34,30 +34,32 @@
* 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.7.40-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-597-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.7.23-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-526-GTNH-pre:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.8.4:dev')
api("com.github.GTNewHorizons:GTNHLib:0.6.21:dev")
api('com.github.GTNewHorizons:waila:1.8.2:dev')
api("com.github.GTNewHorizons:GTNHLib:0.6.3:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.0:dev") {
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.7-GTNH:dev')
compileOnly("com.github.GTNewHorizons:GTNHLib:0.6.3: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.10.7:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.8:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.266:dev') {
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.85: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.11.13-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.7-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.46:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.4-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.5-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.17:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.6.3:dev")
}
+1 -1
View File
@@ -14,7 +14,7 @@ modId = ae2fc
modGroup = com.glodblock.github
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+3 -2
View File
@@ -86,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -205,7 +206,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
}
@@ -3,7 +3,6 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
@@ -17,14 +16,10 @@ import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.helpers.InventoryAction;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
@@ -82,20 +77,4 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
super.actionPerformed(btn);
}
}
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
IAEItemStack hoveredAEStack = getHoveredAEStack();
if (hoveredAEStack != null && btn == 2) {
((AEBaseContainer) inventorySlots).setTargetStack(hoveredAEStack);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketInventoryAction(
InventoryAction.AUTO_CRAFT,
Ae2ReflectClient.getInventorySlots(this).size(),
0,
hoveredAEStack));
return;
}
super.mouseClicked(xCoord, yCoord, btn);
}
}
@@ -3,9 +3,6 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
@@ -17,17 +14,15 @@ import appeng.api.config.Settings;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
public class GuiFluidLevelEmitter extends GuiUpgradeable {
private MEGuiTextField amountTextField;
private GuiNumberBox level;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
@@ -36,9 +31,6 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
private GuiButton setButton;
private boolean isMul = false;
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
@@ -49,12 +41,13 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
public void initGui() {
super.initGui();
this.amountTextField = new MEGuiTextField(90, 12);
this.amountTextField.x = this.guiLeft + 39;
this.amountTextField.y = this.guiTop + 44;
this.amountTextField.setFocused(true);
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.amountTextField);
this.validateText();
this.level = new GuiNumberBox(this.fontRendererObj, 24, 43, 79, this.fontRendererObj.FONT_HEIGHT, Long.class);
this.level.setEnableBackgroundDrawing(false);
this.level.setMaxStringLength(16);
this.level.setTextColor(GuiColors.LevelEmitterValue.getColor());
this.level.setVisible(true);
this.level.setFocused(true);
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.level);
}
@Override
@@ -75,19 +68,10 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c));
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d));
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 63, 22, 20, "-" + a));
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 63, 28, 20, "-" + b));
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 63, 32, 20, "-" + c));
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 63, 38, 20, "-" + d));
this.buttonList.add(
this.setButton = new GuiButton(
0,
this.guiLeft + 134,
this.guiTop + 40,
28,
20,
GuiText.Set.getLocal()));
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a));
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b));
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c));
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d));
this.buttonList.add(this.redstoneMode);
}
@@ -105,18 +89,19 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
this.ySize - 96 + 3,
GuiColors.UpgradableInventory.getColor());
this.redstoneMode.set(this.cvb.getRedStoneMode());
this.level.drawTextBox();
if (isShiftKeyDown() && !isMul) {
for (GuiButton btn : this.buttonList) {
for (Object btn : this.buttonList) {
if (btn instanceof GuiButton) {
btn.displayString += "000";
((GuiButton) btn).displayString += "000";
}
}
isMul = true;
} else if (!isShiftKeyDown() && isMul) {
for (GuiButton btn : this.buttonList) {
for (Object btn : this.buttonList) {
if (btn instanceof GuiButton) {
btn.displayString = btn.displayString.substring(0, btn.displayString.lastIndexOf("000"));
((GuiButton) btn).displayString = ((GuiButton) btn).displayString
.substring(0, ((GuiButton) btn).displayString.lastIndexOf("000"));
}
}
isMul = false;
@@ -126,11 +111,6 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawBG(offsetX, offsetY, mouseX, mouseY);
this.amountTextField.drawTextBox();
// Without these two lines, the liquid slot will not draw properly.
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.bindTexture(this.getBackground());
}
@Override
@@ -144,76 +124,75 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
if (btn == this.setButton && this.setButton.enabled) {
final long amount = this.getAmountLong();
this.amountTextField.setText(Long.toString(amount));
if (isPlus || isMinus) {
this.addQty(this.getQty(btn));
}
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(amount, 0));
} else {
final boolean isPlus = btn == this.plus1 || btn == this.plus10
|| btn == this.plus100
|| btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
private void addQty(final long i) {
try {
String Out = this.level.getText();
if (isPlus || isMinus) {
long result = addOrderAmount(this.getQty(btn));
this.amountTextField.setText(Long.toString(result));
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
long result = Long.parseLong(Out);
result += i;
if (result < 0) {
result = 0;
}
this.level.setText(Out = Long.toString(result));
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
} catch (final NumberFormatException e) {
this.level.setText("0");
}
}
private long addOrderAmount(final int i) {
long resultL = getAmountLong();
if (resultL == 1 && i > 1) {
resultL = 0;
}
resultL += i;
if (resultL < 1) {
resultL = 1;
}
return resultL;
}
private long getAmountLong() {
String out = this.amountTextField.getText();
double resultD = Calculator.conversion(out);
if (resultD <= 0 || Double.isNaN(resultD)) {
return 0;
} else {
return (long) ArithHelper.round(resultD, 0);
}
}
private void validateText() {
String text = this.amountTextField.getText();
double resultD = Calculator.conversion(text);
this.setButton.enabled = !Double.isNaN(resultD);
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
this.amountTextField.mouseClicked(xCoord, yCoord, btn);
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.actionPerformed(this.setButton);
} else {
boolean typedTextbox = this.amountTextField.textboxKeyTyped(character, key);
if (typedTextbox) {
this.validateText();
} else {
super.keyTyped(character, key);
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
&& this.level.textboxKeyTyped(character, key)) {
try {
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(Long.parseLong(Out), 0));
} catch (final NumberFormatException e) {
AELog.debug(e);
}
} else {
super.keyTyped(character, key);
}
}
}
File diff suppressed because it is too large. Load diff
@@ -2,10 +2,10 @@ package com.glodblock.github.client.gui;
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@@ -15,10 +15,8 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@@ -42,6 +40,7 @@ import com.glodblock.github.network.CPacketLevelTerminalCommands;
import com.glodblock.github.util.FCGuiColors;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import com.gtnewhorizon.gtnhlib.util.parsing.MathExpressionParser;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.DimensionalCoord;
@@ -54,12 +53,11 @@ import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNEIDragClick;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cofh.core.render.CoFHFontRenderer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
@@ -69,7 +67,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private final ContainerLevelMaintainer cont;
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
private Widget focusedWidget;
private FCGuiTextField input;
private int lastWorkingTick;
private int refreshTick;
private final CoFHFontRenderer render;
@@ -79,6 +77,10 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
protected Util.DimensionalCoordSide originalBlockPos;
protected GuiTabButton originalGuiBtn;
protected static final boolean isGTNHLibLoaded = Loader.isModLoaded("gtnhlib");
protected static final Pattern numberPattern = isGTNHLibLoaded ? MathExpressionParser.EXPRESSION_PATTERN
: Pattern.compile("^[0-9]+");
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(new ContainerLevelMaintainer(ipl, tile));
this.cont = (ContainerLevelMaintainer) inventorySlots;
@@ -150,8 +152,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
component[idx].getQty().textField.setText(String.valueOf(quantity));
component[idx].getBatch().textField.setText(String.valueOf(batch));
component[idx].getQty().validate();
component[idx].getBatch().validate();
component[idx].setEnable(isEnable);
component[idx].setState(state);
}
@@ -207,7 +207,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
int tick = this.refreshTick;
int interval = 20;
if (tick > lastWorkingTick + interval && this.focusedWidget == null) {
if (tick > lastWorkingTick + interval && this.input == null) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
lastWorkingTick = this.refreshTick;
}
@@ -233,11 +233,11 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
super.func_146977_a(new SlotSingleItem(slot));
if (stack == null) return true;
IAEItemStack fake = stack.copy();
Widget qty = this.component[slot.getSlotIndex()].getQty();
qty.validate();
fake.setStackSize(qty.getAmount() != null ? qty.getAmount() : 0);
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
} else {
fake.setStackSize(0);
}
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.setAeStack(fake);
aeRenderItem.renderItemOverlayIntoGUI(
@@ -255,41 +255,42 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
if (btn == 0) {
if (focusedWidget != null) {
focusedWidget.textField.setFocused(false);
if (input != null) {
input.setFocused(false);
}
for (Component com : this.component) {
Widget textField = com.isMouseIn(xCoord, yCoord);
FCGuiTextField textField = com.isMouseIn(xCoord, yCoord);
if (textField != null) {
textField.textField.setFocused(true);
this.focusedWidget = textField;
textField.setFocused(true);
this.input = textField;
super.mouseClicked(xCoord, yCoord, btn);
return;
}
}
this.focusedWidget = null;
this.input = null;
}
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void keyTyped(final char character, final int key) {
if (this.focusedWidget == null) {
if (this.input == null) {
super.keyTyped(character, key);
return;
}
if (!this.checkHotbarKeys(key)) {
if (!((character == ' ') && this.focusedWidget.textField.getText().isEmpty())) {
this.focusedWidget.textField.textboxKeyTyped(character, key);
if (!((character == ' ') && this.input.getText().isEmpty())) {
this.input.textboxKeyTyped(character, key);
}
super.keyTyped(character, key);
this.focusedWidget.validate();
if (!numberPattern.matcher(this.input.getText()).matches()) {
this.input.setTextColor(0xFF0000);
} else {
this.input.setTextColor(0xFFFFFF);
}
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.component[this.focusedWidget.componentIndex].submit();
this.focusedWidget.textField.setFocused(false);
this.focusedWidget = null;
this.input.setFocused(false);
this.input = null;
}
}
}
@@ -408,38 +409,39 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
public int getIndex() {
return this.qty.componentIndex;
return this.qty.idx;
}
public void setEnable(boolean enable) {
this.isEnable = enable;
}
private void send(Widget widget) {
if (cont.inventorySlots.get(widget.componentIndex).getHasStack() && widget.getAmount() != null) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer(widget.action, widget.componentIndex, widget.getAmount()));
private boolean send(Widget widget) {
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
if (isGTNHLibLoaded) {
long value = (long) MathExpressionParser.parse(widget.textField.getText());
widget.textField.setText(String.valueOf(value));
}
if (!widget.textField.getText().isEmpty()
&& numberPattern.matcher(widget.textField.getText()).matches()) {
String str = widget.textField.getText().replaceAll("^(0+)", "");
widget.textField.setText(str.isEmpty() ? "0" : str);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
widget.textField.setTextColor(0xFFFFFF);
return true;
} else {
widget.textField.setTextColor(0xFF0000);
return false;
}
}
}
public void submit() {
this.sendToServer(this.submit);
return false;
}
protected boolean sendToServer(GuiButton btn) {
boolean didSomething = false;
if (this.submit == btn) {
final Widget qty = this.getQty();
final Widget batch = this.getBatch();
qty.validate();
batch.validate();
if (qty.getAmount() != null) {
this.send(qty);
}
if (batch.getAmount() != null) {
this.send(batch);
}
if (this.send(this.getQty())) this.send(this.getBatch());
didSomething = true;
} else if (this.enable == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
@@ -451,9 +453,9 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
return didSomething;
}
public Widget isMouseIn(final int xCoord, final int yCoord) {
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty();
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch();
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
return null;
}
@@ -538,41 +540,28 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private class Widget {
public final int componentIndex;
public final int idx;
public final Action action;
public final FCGuiTextField textField;
private final FCGuiTextField textField;
private final String tooltip;
private Long amount;
public Widget(FCGuiTextField textField, String tooltip, int componentIndex, Action action) {
public Widget(FCGuiTextField textField, String tooltip, int idx, Action action) {
this.textField = textField;
this.textField.setEnableBackgroundDrawing(false);
this.textField.setText("0");
this.textField.setMaxStringLength(16); // this length is enough to be useful
this.componentIndex = componentIndex;
this.idx = idx;
this.action = action;
this.tooltip = tooltip;
}
public void draw() {
String current = amount != null
? StatCollector.translateToLocal(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NumberFormat.getNumberInstance().format(amount)
+ "\n"
: "";
if (isShiftKeyDown()) {
this.setTooltip(
render.wrapFormattedStringToWidth(
StatCollector.translateToLocal(this.tooltip) + "\n"
+ current
+ "\n"
+ StatCollector.translateToLocal(this.tooltip + ".hint"),
xSize / 2));
this.setTooltip(render.wrapFormattedStringToWidth(NameConst.i18n(this.tooltip), xSize / 2));
} else {
this.setTooltip(
render.wrapFormattedStringToWidth(
NameConst.i18n(this.tooltip, "\n", false) + "\n"
+ current
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
(int) Math.floor(xSize * 0.8)));
}
@@ -582,21 +571,5 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void setTooltip(String message) {
this.textField.setMessage(message);
}
public void validate() {
final double result = Calculator.conversion(this.textField.getText());
if (Double.isNaN(result)) {
this.amount = null;
this.textField.setTextColor(0xFF0000);
} else {
this.amount = (long) ArithHelper.round(result, 0);
this.textField.setTextColor(0xFFFFFF);
}
}
@Nullable
public Long getAmount() {
return this.amount;
}
}
}
@@ -28,7 +28,6 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -96,7 +95,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
public static final int VIEW_WIDTH = 174;
public static final int VIEW_LEFT = 8;
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_terminal.png");
private static final RenderItem renderItem = new RenderItem();
protected int offsetY;
private static final int offsetX = 21;
protected static String searchFieldOutputsText = "";
@@ -504,7 +502,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
Tessellator.instance.startDrawingQuads();
int relY = 0;
final int slotLeftMargin = (VIEW_WIDTH - entry.rowSize * 18);
float lastZLevel = renderItem.zLevel;
float lastZLevel = aeRenderItem.zLevel;
entry.dispY = viewY;
/* PASS 1: BG */
@@ -592,9 +590,10 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemStack.stackSize = 0;
renderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
renderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
renderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
aeRenderItem.setAeStack(null);
aeRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
aeRenderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
int color = switch (state) {
case Idle -> FCGuiColors.StateIdle.getColor();
@@ -642,7 +641,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
}
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
renderItem.zLevel = lastZLevel;
aeRenderItem.zLevel = lastZLevel;
return relY + 1;
}
@@ -1,55 +0,0 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.network.SPacketPatternItemRenamer;
import appeng.api.storage.ITerminalHost;
public class GuiPatternItemRenamer extends appeng.client.gui.implementations.GuiPatternItemRenamer {
private GuiType originalGui;
public GuiPatternItemRenamer(InventoryPlayer ip, ITerminalHost p) {
super(ip, p);
}
@Override
protected void setOriginGUI(Object target) {
if (target instanceof PartFluidPatternTerminal) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (target instanceof PartFluidPatternTerminalEx) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (target instanceof PartFluidTerminal) {
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (target instanceof WirelessPatternTerminalInventory) {
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof WirelessLevelTerminalInventory) {
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
@Override
protected void keyTyped(final char character, final int key) {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
FluidCraft.proxy.netHandler
.sendToServer(new SPacketPatternItemRenamer(originalGui, getText(), getValueIndex()));
} else super.keyTyped(character, key);
}
}
@@ -50,10 +50,8 @@ public class GuiPatternMulti extends GuiAmount {
Settings.ACTIONS,
ActionItems.MULTIPLY));
this.amountTextField.x = this.guiLeft + 48;
this.amountTextField.w = 73;
this.amountTextField.xPosition = this.guiLeft + 50;
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
this.amountTextField.setCursorPositionEnd();
this.amountTextField.setSelectionPos(0);
}
@@ -117,7 +115,7 @@ public class GuiPatternMulti extends GuiAmount {
}
@Override
protected long addOrderAmount(final int i) {
protected int addOrderAmount(final int i) {
return i + getAmount();
}
@@ -13,6 +13,7 @@ import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
import com.glodblock.github.client.gui.GuiFluidPatternWireless;
import com.glodblock.github.client.gui.GuiFluidPortableCell;
import com.glodblock.github.client.gui.GuiInterfaceWireless;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
@@ -101,14 +102,16 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.FluidTerminal);
}
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
if (!(this instanceof GuiInterfaceWireless)) {
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
}
if (!(this instanceof GuiLevelWireless)) {
this.buttonList.add(
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
@@ -416,9 +416,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
if (slot.getHasStack()) {
InventoryAction action = InventoryAction.SET_PATTERN_VALUE;
if (isCtrlKeyDown()) {
action = InventoryAction.RENAME_PATTERN_ITEM;
}
IAEItemStack stack = AEItemStack.create(slot.getStack());
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
@@ -1,5 +1,6 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
@@ -13,7 +14,6 @@ import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.implementations.IUpgradeableHost;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
@@ -25,7 +25,7 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
private final PartFluidLevelEmitter lvlEmitter;
@SideOnly(Side.CLIENT)
private MEGuiTextField textField;
private GuiTextField textField;
@GuiSync(2)
public long EmitterValue = -1;
@@ -50,12 +50,15 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
@Override
protected void setupConfig() {
final IInventory inv = this.getUpgradeable().getInventoryByName("config");
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, 17, 42, 0, 0, 0));
final int y = 40;
final int x = 80 + 44;
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
}
@SideOnly(Side.CLIENT)
public void setTextField(final MEGuiTextField level) {
public void setTextField(final GuiTextField level) {
this.textField = level;
this.textField.setText(String.valueOf(this.EmitterValue));
}
public void setLevel(final long l, final EntityPlayer player) {
@@ -96,10 +99,6 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
if (field.equals("EmitterValue")) {
if (this.textField != null) {
this.textField.setText(String.valueOf(this.EmitterValue));
if (String.valueOf(oldValue).equals("-1")) {
this.textField.setCursorPositionEnd();
}
}
}
}
@@ -332,15 +332,10 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
if (emptiedTanks > 0) {
final ItemStack testDrainStack = targetStack.copy();
testDrainStack.stackSize = 1;
fcItem.drain(testDrainStack, fluidPerContainer, true);
if (testDrainStack.stackSize == 0) {
emptiedTanksStack = null;
} else {
emptiedTanksStack = testDrainStack.copy();
emptiedTanksStack.stackSize = emptiedTanks;
}
emptiedTanksStack = targetStack.copy();
emptiedTanksStack.stackSize = 1;
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
emptiedTanksStack.stackSize = emptiedTanks;
} else {
emptiedTanksStack = null;
}
@@ -395,7 +390,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
} else if (partialTanksStack != null) {
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
} else {
player.inventory.setInventorySlotContents(slotIndex, null);
player.inventory.setItemStack(null);
shouldSendStack = false;
}
}
if (shouldSendStack) {
@@ -271,7 +271,6 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
pattern.setInputs(collectInventory(this.craftingSlots));
pattern.setOutputs(collectInventory(this.outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
pattern.setCombine(this.combine ? 1 : 0);
patternSlotOUT.putStack(stampAuthor(pattern.writeToStack()));
}
@@ -17,8 +17,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.FluidCellInventory;
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.NameConst;
@@ -99,7 +99,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final FluidCellInventoryHandler handler) {
final FluidCellInventory cellInventory = (FluidCellInventory) handler.getCellInv();
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
lines.add(
@@ -120,7 +120,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
+ GuiText.Of.getLocal()
+ " "
+ EnumChatFormatting.DARK_GREEN
+ cellInventory.getMaxFluidTypes()
+ cellInventory.getTotalFluidTypes()
+ " "
+ EnumChatFormatting.GRAY
+ GuiText.Types.getLocal());
@@ -161,17 +161,6 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
lines.add(GuiText.Sticky.getLocal());
}
}
List<Object> restricted = handler.getRestricted();
if (restricted != null && ((long) restricted.get(0) != 0 || (byte) restricted.get(1) != 0)) {
lines.add(GuiText.Restricted.getLocal());
if (GuiScreen.isShiftKeyDown()) {
NumberFormat nf = NumberFormat.getNumberInstance();
if ((long) restricted.get(0) != 0)
lines.add(GuiText.MaxFluid.getLocal() + " " + nf.format((long) restricted.get(0)) + " mB");
if ((byte) restricted.get(1) != 0)
lines.add(GuiText.MaxTypes.getLocal() + " " + restricted.get(1));
}
}
}
}
}
@@ -237,9 +226,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
+ ","
+ Platform.openNbtData(is).getByte("cellRestrictionTypes")
+ ","
+ Platform.openNbtData(is).getLong("cellRestrictionAmount")
+ ","
+ "fluid";
+ Platform.openNbtData(is).getLong("cellRestrictionAmount");
}
@Override
@@ -112,9 +112,6 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
@Override
public boolean canHandle(final ItemStack is) {
if (is == null) {
return false;
}
return is.getItem() instanceof ItemBaseWirelessTerminal;
}
@@ -111,7 +111,7 @@ public class ItemFluidVoidStorageCell extends AEBaseItem
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 5);
return new CellUpgrades(is, 0);
}
@Override
@@ -56,12 +56,14 @@ public class CreativeFluidCellInventory extends FluidCellInventory {
IInventory inv = this.cellType.getConfigInventory(this.cellItem);
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack is = inv.getStackInSlot(i);
FluidStack fs = Util.getFluidFromItem(is);
if (fs == null) continue;
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
iaeFluidStack.setStackSize((long) (Math.pow(2, 52) - 1));
this.cellFluids.add(iaeFluidStack);
if (Util.FluidUtil.isFluidContainer(is)) {
FluidStack fs = Util.getFluidFromItem(is);
if (fs == null) continue;
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
iaeFluidStack.setStackSize(Integer.MAX_VALUE * 1_000_000L);
this.cellFluids.add(iaeFluidStack);
}
}
}
}
@@ -1,7 +1,6 @@
package com.glodblock.github.common.storage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nonnull;
@@ -182,10 +181,6 @@ public class FluidCellInventory implements IFluidCellInventory {
return this.cellType.getTotalTypes(this.cellItem);
}
public long getMaxFluidTypes() {
return this.cellType.getTotalTypes(this.cellItem);
}
@Override
public long getStoredFluidCount() {
return this.storedFluidCount;
@@ -397,10 +392,8 @@ public class FluidCellInventory implements IFluidCellInventory {
if (cardDistribution) {
remainingFluidCount = this.getRemainingFluidCountDist(null);
} else {
remainingFluidCount = Math.min(
getRemainingFluidCount(),
getFreeBytes() * singleByteAmount + getUnusedFluidCount()
- (long) getBytesPerType() * singleByteAmount);
remainingFluidCount = this.getRemainingFluidCount()
- ((long) this.getBytesPerType() * singleByteAmount);
}
if (remainingFluidCount > 0) {
@@ -496,8 +489,4 @@ public class FluidCellInventory implements IFluidCellInventory {
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
}
public List<Object> getRestriction() {
return Arrays.asList(restrictionLong, restrictionTypes);
}
}
@@ -1,7 +1,5 @@
package com.glodblock.github.common.storage;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -39,9 +37,7 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
final ItemStack is = config.getStackInSlot(x);
final FluidStack fluid = Util.getFluidFromItem(is);
if (fluid != null) {
AEFluidStack stack = AEFluidStack.create(fluid);
stack.setStackSize(1);
priorityList.add(stack);
priorityList.add(AEFluidStack.create(fluid));
}
}
if (!priorityList.isEmpty()) {
@@ -152,13 +148,4 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
public TYPE getCellType() {
return TYPE.FLUID;
}
public List<Object> getRestricted() {
IFluidCellInventory cellInventory = this.getCellInv();
if (cellInventory instanceof FluidCellInventory ci) {
return ci.getRestriction();
}
return null;
}
}
@@ -145,10 +145,9 @@ public class TileFluidAutoFiller extends AENetworkInvTile
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
IStorageGrid storage = getStorageGrid();
if (storage == null) return;
if (this.fluids.isEmpty()) {
this.fluids = storage.getFluidInventory().getStorageList();
}
for (IAEFluidStack fluidStack : this.fluids) {
IItemList<IAEFluidStack> fluidStorage = this.fluids.isEmpty() ? storage.getFluidInventory().getStorageList()
: this.fluids;
for (IAEFluidStack fluidStack : fluidStorage) {
Fluid fluid = fluidStack.getFluid();
if (fluid == null) continue;
int maxCapacity = Util.FluidUtil.getCapacity(this.getContainerItem(), fluid);
@@ -213,10 +212,12 @@ public class TileFluidAutoFiller extends AENetworkInvTile
BaseActionSource source) {
if (this.getProxy().isActive() && this.getStorageGrid() != null) {
boolean hasChanged = false;
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory().getStorageList();
for (IAEFluidStack tmp : change) {
if (this.fluids.findPrecise(tmp) == null) {
if (stored.findPrecise(tmp) == null || this.fluids.findPrecise(tmp) == null) {
hasChanged = true;
this.fluids.add(tmp);
this.fluids = stored;
break;
}
}
if (hasChanged) postEvent();
@@ -1,13 +1,11 @@
package com.glodblock.github.common.tile;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -220,11 +218,4 @@ public class TileFluidInterface extends TileInterface implements IDualHost {
getInternalFluid().setFluidInSlot(id, fluid);
}
}
@Override
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {
this.fluidDuality.addDrops(drops);
this.fluidDuality.convertDrops(drops, this.getInterfaceDuality().getWaitingToSend());
super.getDrops(w, x, y, z, drops);
}
}
@@ -374,7 +374,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
private boolean isItemConduit(TileEntity te) {
if (isConduit(te)) {
if (ModAndClassUtil.EIO && conduitClazz.isInstance(te)) {
try {
return eioTypeCheck.invoke(te, IItemConduit.class) != null;
} catch (InvocationTargetException | IllegalAccessException e) {
@@ -385,7 +385,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
private boolean isConduit(TileEntity te) {
return ModAndClassUtil.EIO && conduitClazz.isInstance(te);
return ModAndClassUtil.EIO && te instanceof IItemDuct;
}
private ItemStack fillEIOConduit(ItemStack item, TileEntity te, ForgeDirection direction) {
@@ -1,18 +1,14 @@
package com.glodblock.github.inventory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
@@ -29,13 +25,10 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AELog;
import appeng.util.item.AEFluidStack;
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
private static boolean WrongFluidRemovedWarnIssued = false;
private final IFluidHandler handler;
private final ForgeDirection side;
private IItemList<IAEFluidStack> cache = AEApi.instance().storage().createFluidList();
@@ -64,10 +57,6 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
if (!this.handler.canFill(this.side, input.getFluid())) {
return input;
}
int filled = this.handler.fill(this.side, input.getFluidStack(), type == Actionable.MODULATE);
if (type == Actionable.MODULATE) {
@@ -84,41 +73,8 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IAEFluidStack extractItems(IAEFluidStack request, Actionable type, BaseActionSource src) {
if (!this.handler.canDrain(this.side, request.getFluid())) {
return null;
}
FluidStack removed = this.handler.drain(this.side, request.getFluidStack(), type == Actionable.MODULATE);
if (removed != null && removed.amount != 0) {
// perform a one time log if the removed fluid isn't what's reported since this will create a dupe exploit
if (!WrongFluidRemovedWarnIssued && !removed.isFluidEqual(request.getFluidStack())) {
WrongFluidRemovedWarnIssued = true;
String issuesUrl = "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/new";
String msg = String.format(
"[AE2FC] MEMonitorIFluidHandler.extractItems got the wrong fluids while extracting from %s. expected %s got %s. Please report this message if seen: ",
this.handler.getClass().getSimpleName(),
request.getFluidStack().getUnlocalizedName(),
removed.getUnlocalizedName());
// elevate log to error if chat msg is removed to make it easier to find.
AELog.warn(msg + issuesUrl);
ChatComponentText chatTxt = new ChatComponentText(msg);
chatTxt.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED).setBold(true));
ChatComponentText chatUrl = new ChatComponentText(issuesUrl);
chatUrl.setChatStyle(
new ChatStyle().setUnderlined(true)
.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, issuesUrl))
.setChatHoverEvent(
new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new ChatComponentText("Click to open link"))));
ChatComponentText chat = new ChatComponentText("");
chat.appendSibling(chatTxt);
chat.appendSibling(chatUrl);
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chat);
}
IAEFluidStack o = request.copy();
o.setStackSize(removed.amount);
if (type == Actionable.MODULATE) {
@@ -142,6 +98,8 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
// *Decompiled Stuff*//
public TickRateModulation onTick() {
boolean changed = false;
List<IAEFluidStack> changes = new ArrayList<>();
FluidTankInfo[] tankProperties = this.handler.getTankInfo(this.side);
IItemList<IAEFluidStack> currentlyOnStorage = AEApi.instance().storage().createFluidList();
@@ -153,32 +111,37 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
}
// make diff between cache and new contents
IItemList<IAEFluidStack> changes = AEApi.instance().storage().createFluidList();
// using non-enhanced for to prevent concurrency errors
for (Iterator<IAEFluidStack> iter = this.cache.iterator(); iter.hasNext();) {
IAEFluidStack copy = iter.next().copy();
copy.setStackSize(-copy.getStackSize());
changes.add(copy);
Iterator<?> var9 = this.cache.iterator();
IAEFluidStack is;
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
is.setStackSize(-is.getStackSize());
}
for (IAEFluidStack is : currentlyOnStorage) {
changes.add(is);
var9 = currentlyOnStorage.iterator();
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
this.cache.add(is);
}
// update cache as soon as possible
this.cache = currentlyOnStorage;
// remove unchanged values
for (Iterator<IAEFluidStack> iter = changes.iterator(); iter.hasNext();) {
if (iter.next().getStackSize() == 0L) {
iter.remove();
var9 = this.cache.iterator();
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
if (is.getStackSize() != 0L) {
changes.add(is);
}
}
this.cache = currentlyOnStorage;
if (!changes.isEmpty()) {
this.postDifference(changes);
return TickRateModulation.URGENT;
changed = true;
}
return TickRateModulation.SLOWER;
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
}
private void postDifference(Iterable<IAEFluidStack> a) {
@@ -34,7 +34,6 @@ import com.glodblock.github.client.gui.GuiLevelMaintainer;
import com.glodblock.github.client.gui.GuiLevelTerminal;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.GuiOCPatternEditor;
import com.glodblock.github.client.gui.GuiPatternItemRenamer;
import com.glodblock.github.client.gui.GuiPatternMulti;
import com.glodblock.github.client.gui.GuiPatternValueAmount;
import com.glodblock.github.client.gui.GuiRenamer;
@@ -85,7 +84,6 @@ import com.google.common.collect.ImmutableList;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.container.implementations.ContainerPatternItemRenamer;
import appeng.container.implementations.ContainerPriority;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
@@ -529,19 +527,6 @@ public enum GuiType {
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiPatternMulti(player.inventory, inv);
}
}),
GUI_PATTERN_ITEM_RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
return new ContainerPatternItemRenamer(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiPatternItemRenamer(player.inventory, inv);
}
});
public static final List<GuiType> VALUES = ImmutableList.copyOf(values());
@@ -23,7 +23,6 @@ import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
import com.glodblock.github.network.SPacketMEFluidInvUpdate;
import com.glodblock.github.network.SPacketMEItemInvUpdate;
import com.glodblock.github.network.SPacketPatternItemRenamer;
import com.glodblock.github.network.SPacketSetItemAmount;
import com.glodblock.github.network.SPacketStringUpdate;
import com.glodblock.github.network.SPacketSwitchBack;
@@ -82,11 +81,6 @@ public class ChannelLoader implements Runnable {
Side.SERVER);
netHandler
.registerMessage(new CPacketPatternMultiSet.Handler(), CPacketPatternMultiSet.class, id++, Side.SERVER);
netHandler.registerMessage(
new SPacketPatternItemRenamer.Handler(),
SPacketPatternItemRenamer.class,
id++,
Side.SERVER);
}
public static void sendPacketToAllPlayers(Packet packet, World world) {
@@ -30,34 +30,21 @@ public class KeybindLoader implements Runnable {
FMLCommonHandler.instance().bus().register(this);
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (openTerminal.isPressed()) {
handleOpenTerminalKey();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
if (openTerminal.isPressed()) {
handleOpenTerminalKey();
}
}
private void handleOpenTerminalKey() {
if (Minecraft.getMinecraft().currentScreen != null) return;
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player.openContainer == null) {
EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;
if (p.openContainer == null) {
return;
}
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
ItemWirelessUltraTerminal.switchTerminal(
player,
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
if (openTerminal.isPressed()) {
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(p);
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
ItemWirelessUltraTerminal.switchTerminal(
p,
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
}
}
}
}
@@ -1,7 +1,6 @@
package com.glodblock.github.loader;
import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
import static com.glodblock.github.loader.ItemAndBlockHolder.ARTIFICIAL_UNIVERSE_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024KM;
@@ -508,18 +507,6 @@ public class RecipeLoader implements Runnable {
QUANTUM_CELL,
'M',
AE2_MATTER_CONDENSER));
GameRegistry.addRecipe(
new ShapedOreRecipe(
ARTIFICIAL_UNIVERSE_CELL,
"SCS",
"CNC",
"SCS",
'S',
AE2_SINGULARITY,
'C',
SINGULARITY_CELL,
'N',
NETHER_STAR));
GameRegistry.addRecipe(
new ShapedOreRecipe(
FLUID_VOID_CELL,
@@ -1,278 +0,0 @@
package com.glodblock.github.nei;
import static net.minecraft.util.EnumChatFormatting.GRAY;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
import com.glodblock.github.util.ModAndClassUtil;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import appeng.api.AEApi;
import appeng.api.config.TerminalFontSize;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEStack;
import appeng.client.render.StackSizeRenderer;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
import appeng.util.item.FluidList;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.IUsageHandler;
public class NEICellViewHandler implements IUsageHandler {
private static class ViewItemStack {
public PositionedStack stack;
public long amount;
public IIcon icon;
public int color;
public ViewItemStack(PositionedStack stack, long amount, IIcon icon, int color) {
this.stack = stack;
this.amount = amount;
this.icon = icon;
this.color = color;
}
}
private static final ResourceLocation SLOT_TEXTURE_LOCATION = new ResourceLocation("nei", "textures/slot.png");
private static final int OFFSET_X = 2;
private static final int INFO_OFFSET_Y = 4;
private static final int ITEMS_OFFSET_Y = INFO_OFFSET_Y + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2 + 6;
private static final int ROW_ITEM_NUM = 9;
private final List<ViewItemStack> stacks = new ArrayList<>();
private FluidCellInventoryHandler cellHandler;
@Override
public IUsageHandler getUsageHandler(String inputId, Object... ingredients) {
if (ingredients.length > 0 && ingredients[0] instanceof ItemStack ingredient && AEApi.instance().registries().cell()
.getCellInventory(ingredient, null, StorageChannel.FLUIDS) instanceof final FluidCellInventoryHandler handler && handler.getTotalBytes() > 0) {
this.cellHandler = handler;
FluidList list = new FluidList();
handler.getAvailableItems(list, appeng.util.IterationCounter.fetchNewId());
List<IAEFluidStack> sortedStacks = new ArrayList<>();
list.iterator().forEachRemaining(sortedStacks::add);
sortedStacks.sort(Comparator.comparing(IAEStack::getStackSize, Comparator.reverseOrder()));
stacks.clear();
int count = 0;
for (IAEFluidStack aeFluid : sortedStacks) {
FluidStack fluid = aeFluid.getFluidStack();
long amount = fluid.amount;
ItemStack fluidItemStack = ItemFluidDrop.newStack(fluid);
if (fluidItemStack != null) {
fluidItemStack.stackSize = 1;
PositionedStack positionedStack = new PositionedStack(
fluidItemStack,
OFFSET_X + count % ROW_ITEM_NUM * 18 + 1,
ITEMS_OFFSET_Y + count / ROW_ITEM_NUM * 18 + 1);
stacks.add(new ViewItemStack(positionedStack, amount, fluid.getFluid().getIcon(), fluid.getFluid().getColor()));
count++;
}
}
return this;
}
return null;
}
@Override
public String getRecipeName() {
return GuiText.CellView.getLocal();
}
@Override
public int numRecipes() {
return 1;
}
@Override
public void drawBackground(int recipe) {}
@Override
public void drawForeground(int recipe) {
final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
final String usedBytes = Platform.formatByteDouble(cellHandler.getUsedBytes());
final String totalBytes = Platform.formatByteDouble(cellHandler.getTotalBytes());
fontRenderer.drawString(
usedBytes + " " + GuiText.Of.getLocal() + ' ' + totalBytes + ' ' + GuiText.BytesUsed.getLocal(),
OFFSET_X,
INFO_OFFSET_Y,
0);
fontRenderer.drawString(
NumberFormat.getInstance().format(cellHandler.getUsedTypes()) + " "
+ GuiText.Of.getLocal()
+ ' '
+ NumberFormat.getInstance().format(cellHandler.getTotalTypes())
+ ' '
+ GuiText.Types.getLocal(),
OFFSET_X,
INFO_OFFSET_Y + fontRenderer.FONT_HEIGHT + 2,
0);
final Tessellator tessellator = Tessellator.instance;
GL11.glColor3f(1F, 1F, 1F);
// Draw slots
Minecraft.getMinecraft().getTextureManager().bindTexture(SLOT_TEXTURE_LOCATION);
tessellator.startDrawingQuads();
for (int i = 0; i < this.cellHandler.getTotalTypes(); i++) {
final int line = i % ROW_ITEM_NUM;
final int row = i / ROW_ITEM_NUM;
tessellator.addVertexWithUV(OFFSET_X + 18 * (line + 1), ITEMS_OFFSET_Y + 18 * row, 0, 1, 0);
tessellator.addVertexWithUV(OFFSET_X + 18 * line, ITEMS_OFFSET_Y + 18 * row, 0, 0, 0);
tessellator.addVertexWithUV(OFFSET_X + 18 * line, ITEMS_OFFSET_Y + 18 * (row + 1), 0, 0, 1);
tessellator.addVertexWithUV(OFFSET_X + 18 * (line + 1), ITEMS_OFFSET_Y + 18 * (row + 1), 0, 1, 1);
}
tessellator.draw();
// Draw fluids
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
tessellator.startDrawingQuads();
for (int i = 0; i < this.stacks.size(); i++) {
final IIcon icon = this.stacks.get(i).icon;
final int color = this.stacks.get(i).color;
final int line = i % ROW_ITEM_NUM;
final int row = i / ROW_ITEM_NUM;
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite sprite) {
sprite.markNeedsAnimationUpdate();
}
tessellator.setColorRGBA(color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF, 0xFF);
tessellator.addVertexWithUV(
OFFSET_X + 18 * (line + 1) - 1,
ITEMS_OFFSET_Y + 18 * row + 1,
0,
icon.getMaxU(),
icon.getMinV());
tessellator.addVertexWithUV(
OFFSET_X + 18 * line + 1,
ITEMS_OFFSET_Y + 18 * row + 1,
0,
icon.getMinU(),
icon.getMinV());
tessellator.addVertexWithUV(
OFFSET_X + 18 * line + 1,
ITEMS_OFFSET_Y + 18 * (row + 1) - 1,
0,
icon.getMinU(),
icon.getMaxV());
tessellator.addVertexWithUV(
OFFSET_X + 18 * (line + 1) - 1,
ITEMS_OFFSET_Y + 18 * (row + 1) - 1,
0,
icon.getMaxU(),
icon.getMaxV());
}
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
// Draw amount
for (ViewItemStack viewStack : this.stacks) {
StackSizeRenderer.drawStackSize(
viewStack.stack.relx,
viewStack.stack.rely,
viewStack.amount,
fontRenderer,
TerminalFontSize.SMALL);
}
}
@Override
public List<PositionedStack> getIngredientStacks(int recipe) {
return new ArrayList<>();
}
@Override
public List<PositionedStack> getOtherStacks(int recipe) {
return this.stacks.stream().map(stack -> stack.stack).collect(Collectors.toList());
}
@Override
public PositionedStack getResultStack(int recipe) {
return null;
}
@Override
public void onUpdate() {}
@Override
public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
return false;
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe) {
return null;
}
@Override
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe) {
return null;
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipe) {
return currenttip;
}
@Override
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) {
if (stack == null) return currenttip;
this.stacks.stream().filter(viewStack -> viewStack.stack.item.equals(stack)).findFirst().ifPresent(
viewItemStack -> currenttip.set(
1,
GRAY + GuiText.Stored.getLocal()
+ ": "
+ NumberFormat.getNumberInstance().format(viewItemStack.amount)));
return currenttip;
}
@Override
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
return false;
}
@Override
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipe) {
return false;
}
}
@@ -20,7 +20,6 @@ public class NEI_FC_Config implements IConfigureNEI {
API.registerNEIGuiHandler(new AE2FC_NEIGuiHandler());
API.addSearchProvider(new NEIItemFilter());
API.registerStackStringifyHandler(new FCStackStringifyHandler());
API.registerUsageHandler(new NEICellViewHandler());
if (ModAndClassUtil.AVARITIA) {
API.registerGuiOverlay(GuiFluidPatternWireless.class, "extreme", null);
@@ -24,7 +24,6 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerPatternItemRenamer;
import appeng.helpers.InventoryAction;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
@@ -188,36 +187,7 @@ public class CPacketInventoryAction implements IMessage {
cpm.detectAndSendChanges();
}
}
} else if (message.action == InventoryAction.RENAME_PATTERN_ITEM) {
final ContainerOpenContext context = baseContainer.getOpenContext();
if (context != null) {
final TileEntity te = context.getTile();
if (te != null) {
InventoryHandler.openGui(
sender,
te.getWorldObj(),
new BlockPos(te),
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
GuiType.GUI_PATTERN_ITEM_RENAMER);
} else if (target instanceof IWirelessTerminal wt) {
InventoryHandler.openGui(
sender,
sender.worldObj,
new BlockPos(
wt.getInventorySlot(),
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0),
ForgeDirection.UNKNOWN,
GuiType.GUI_PATTERN_ITEM_RENAMER);
}
if (sender.openContainer instanceof ContainerPatternItemRenamer cpir) {
if (baseContainer.getTargetStack() != null) {
cpir.getPatternValue().putStack(baseContainer.getTargetStack().getItemStack());
}
cpir.detectAndSendChanges();
}
}
}else {
} else {
baseContainer.doAction(sender, message.action, message.slot, message.id);
}
}
@@ -54,6 +54,12 @@ public class CPacketLevelMaintainer implements IMessage {
this.size = size;
}
public CPacketLevelMaintainer(Action action, int slotIndex, String size) {
this.action = action;
this.slotIndex = slotIndex;
this.size = size.isEmpty() ? 0 : Long.parseLong(size);
}
@Override
public void fromBytes(ByteBuf buf) {
this.action = Action.values()[buf.readInt()];
@@ -1,107 +0,0 @@
package com.glodblock.github.network;
import java.util.Objects;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.Util;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerPatternItemRenamer;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
public class SPacketPatternItemRenamer implements IMessage {
private GuiType guiType;
private String name = "";
private int valueIndex;
public SPacketPatternItemRenamer() {}
public SPacketPatternItemRenamer(GuiType guiType, String text, int valIndex) {
this.guiType = guiType;
name = text;
valueIndex = valIndex;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeByte(guiType != null ? guiType.ordinal() : 0);
buf.writeInt(valueIndex);
buf.writeInt(name.length());
for (int i = 0; i < name.length(); i++) {
buf.writeChar(name.charAt(i));
}
}
@Override
public void fromBytes(ByteBuf buf) {
guiType = GuiType.getByOrdinal(buf.readByte());
valueIndex = buf.readInt();
int leName = buf.readInt();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < leName; i++) {
sb.append(buf.readChar());
}
name = sb.toString();
}
public static class Handler implements IMessageHandler<SPacketPatternItemRenamer, IMessage> {
@Nullable
@Override
public IMessage onMessage(SPacketPatternItemRenamer message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
if (player.openContainer instanceof ContainerPatternItemRenamer cpv) {
ContainerOpenContext context = cpv.getOpenContext();
if (context == null) {
return null;
}
TileEntity te = context.getTile();
if (te != null) {
InventoryHandler.openGui(
player,
player.worldObj,
new BlockPos(te),
Objects.requireNonNull(context.getSide()),
message.guiType);
} else if (cpv.getTarget() instanceof IWirelessTerminal iwt) {
InventoryHandler.openGui(
player,
player.worldObj,
new BlockPos(
iwt.getInventorySlot(),
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0),
Objects.requireNonNull(context.getSide()),
message.guiType);
}
if (player.openContainer instanceof FCContainerEncodeTerminal) {
Slot slot = player.openContainer.getSlot(message.valueIndex);
if (slot != null && slot.getHasStack()) {
ItemStack nextStack = slot.getStack().copy();
nextStack.setRepairCost(2);
nextStack.setStackDisplayName(message.name);
slot.putStack(nextStack);
}
}
}
return null;
}
}
}
@@ -67,7 +67,6 @@ public class CommonProxy {
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_VOID_CELL), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16K), 1);
@@ -76,8 +75,6 @@ public class CommonProxy {
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.QUANTUM_CELL), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.SINGULARITY_CELL), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1);
@@ -87,7 +84,6 @@ public class CommonProxy {
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024K), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096K), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384K), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.QUANTUM_CELL), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1);
@@ -97,7 +93,6 @@ public class CommonProxy {
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.ARTIFICIAL_UNIVERSE_CELL), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1);
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1);
@@ -1,10 +1,8 @@
package com.glodblock.github.util;
import java.util.List;
import java.util.Objects;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@@ -460,24 +458,4 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
super(tileInterface.tanks);
}
}
public void addDrops(final List<ItemStack> drops) {
for (int i = 0; i < NUMBER_OF_TANKS; i++) {
ItemStack is = ItemFluidPacket.newStack(this.tanks.getFluidStackInSlot(i));
if (is != null) {
drops.add(is);
}
}
}
public void convertDrops(final List<ItemStack> drops, final List<ItemStack> waitingToSend) {
if (waitingToSend != null) {
for (final ItemStack is : waitingToSend) {
if (is != null && is.getItem() instanceof ItemFluidDrop) {
drops.add(ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(is)));
is.stackSize = 0;
}
}
}
}
}
@@ -187,9 +187,6 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
return false;
}
NBTTagCompound tag = Objects.requireNonNull(patternStack.getTagCompound());
setCanBeSubstitute(tag.getBoolean("beSubstitute") ? 1 : 0);
setCombine(tag.getInteger("combine"));
// may be possible to enter a partially-correct state if setInputs succeeds but setOutputs failed
// but outside code should treat it as completely incorrect and not attempt to make calls
return setInputs(readStackArray(tag.getTagList("in", Constants.NBT.TAG_COMPOUND)))