mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-17 10:55:06 +00:00
Merge branch 'master' into gui-reaper
This commit is contained in:
8 files changed
+294
-22
No files matched your search
+1
-1
@@ -48,7 +48,7 @@ dependencies {
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.0:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.12:dev') {
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.20:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
@@ -2,22 +2,35 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
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.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||
import com.glodblock.github.network.CPacketValueConfig;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -28,6 +41,11 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
private MEGuiTextField amountTextField;
|
||||
|
||||
protected GuiType originalGui;
|
||||
protected Util.DimensionalCoordSide originalBlockPos;
|
||||
protected ItemStack originalGuiIcon;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
|
||||
private GuiButton plus1;
|
||||
private GuiButton plus10;
|
||||
private GuiButton plus100;
|
||||
@@ -43,6 +61,43 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
|
||||
super(new ContainerFluidLevelEmitter(inventoryPlayer, te));
|
||||
|
||||
if (inventoryPlayer.player.openContainer instanceof AEBaseContainer container) {
|
||||
var target = container.getTarget();
|
||||
if (target instanceof PartLevelTerminal terminal) {
|
||||
originalGuiIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
DimensionalCoord blockPos = new DimensionalCoord(terminal.getTile());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
terminal.getSide(),
|
||||
"");
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
originalGuiIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
inventoryPlayer.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
|
||||
originalGuiIcon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
inventoryPlayer.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,6 +110,17 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
this.amountTextField.setFocused(true);
|
||||
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.amountTextField);
|
||||
this.validateText();
|
||||
|
||||
if (this.originalGuiIcon != null) {
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.originalGuiIcon,
|
||||
this.originalGuiIcon.getDisplayName(),
|
||||
itemRender);
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
this.buttonList.add(originalGuiBtn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,9 +209,18 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if (btn == this.setButton && this.setButton.enabled) {
|
||||
if (btn == this.originalGuiBtn) {
|
||||
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
|
||||
CPacketLevelTerminalCommands.Action.BACK,
|
||||
originalBlockPos.x,
|
||||
originalBlockPos.y,
|
||||
originalBlockPos.z,
|
||||
originalBlockPos.getDimension(),
|
||||
originalBlockPos.getSide());
|
||||
message.setOriginalGui(originalGui.ordinal());
|
||||
FluidCraft.proxy.netHandler.sendToServer(message);
|
||||
} else if (btn == this.setButton && this.setButton.enabled) {
|
||||
final long amount = this.getAmountLong();
|
||||
this.amountTextField.setText(Long.toString(amount));
|
||||
|
||||
@@ -161,6 +236,8 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
if (isPlus || isMinus) {
|
||||
long result = addOrderAmount(this.getQty(btn));
|
||||
this.amountTextField.setText(Long.toString(result));
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
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.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.implementations.GuiLevelEmitter;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public class GuiLevelEmitterProxy extends GuiLevelEmitter {
|
||||
|
||||
protected GuiType originalGui;
|
||||
protected Util.DimensionalCoordSide originalBlockPos;
|
||||
protected ItemStack originalGuiIcon;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
|
||||
public GuiLevelEmitterProxy(final InventoryPlayer inventoryPlayer, final PartLevelEmitter te) {
|
||||
super(inventoryPlayer, te);
|
||||
|
||||
if (inventoryPlayer.player.openContainer instanceof AEBaseContainer container) {
|
||||
var target = container.getTarget();
|
||||
if (target instanceof PartLevelTerminal terminal) {
|
||||
originalGuiIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
DimensionalCoord blockPos = new DimensionalCoord(terminal.getTile());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
terminal.getSide(),
|
||||
"");
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
originalGuiIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
inventoryPlayer.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
|
||||
originalGuiIcon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
inventoryPlayer.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
if (this.originalGuiIcon != null) {
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.originalGuiIcon,
|
||||
this.originalGuiIcon.getDisplayName(),
|
||||
itemRender);
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
this.buttonList.add(originalGuiBtn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
if (btn == this.originalGuiBtn) {
|
||||
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
|
||||
CPacketLevelTerminalCommands.Action.BACK,
|
||||
originalBlockPos.x,
|
||||
originalBlockPos.y,
|
||||
originalBlockPos.z,
|
||||
originalBlockPos.getDimension(),
|
||||
originalBlockPos.getSide());
|
||||
message.setOriginalGui(originalGui.ordinal());
|
||||
FluidCraft.proxy.netHandler.sendToServer(message);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
|
||||
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
|
||||
@@ -1224,7 +1224,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
dim,
|
||||
ForgeDirection.getOrientation(side),
|
||||
"");
|
||||
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) {
|
||||
if (isCtrlKeyDown() && isShiftKeyDown()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
|
||||
@@ -59,6 +59,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.SettingsFrom;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -101,10 +102,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
|
||||
int idx = this.getRequestIndexByLink(link);
|
||||
if (idx == -1) {
|
||||
AELog.warn("Invalid crafting link: " + link);
|
||||
return items;
|
||||
}
|
||||
|
||||
try {
|
||||
if (getProxy().isActive()) {
|
||||
final IEnergyGrid energy = getProxy().getEnergy();
|
||||
@@ -116,7 +114,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
.injectItems(ItemFluidDrop.getAeFluidStack(items), mode, source);
|
||||
if (notInjectedItems != null) {
|
||||
items.setStackSize(notInjectedItems.getStackSize());
|
||||
this.updateState(idx, LevelState.Export);
|
||||
if (idx != -1) {
|
||||
this.updateState(idx, LevelState.Export);
|
||||
}
|
||||
|
||||
return items;
|
||||
} else {
|
||||
@@ -163,7 +163,8 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
final IGrid grid = getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> inv = getProxy().getStorage().getItemInventory().getStorageList();
|
||||
final IItemList<IAEItemStack> invItems = getProxy().getStorage().getItemInventory().getStorageList();
|
||||
final IItemList<IAEFluidStack> invFluid = getProxy().getStorage().getFluidInventory().getStorageList();
|
||||
|
||||
// Check there are available crafting CPUs before doing any work.
|
||||
// This hopefully stops level maintainers busy-looping calculating
|
||||
@@ -205,9 +206,16 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
|
||||
IAEItemStack aeItem = inv.findPrecise(craftItem);
|
||||
IAEItemStack aeItem = invItems.findPrecise(craftItem);
|
||||
|
||||
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
long stackSize;
|
||||
|
||||
if (craftItem.getItem() instanceof ItemFluidDrop) {
|
||||
IAEFluidStack ifs = invFluid.findPrecise(ItemFluidDrop.getAeFluidStack(craftItem));
|
||||
stackSize = ifs == null ? 0 : ifs.getStackSize();
|
||||
} else {
|
||||
stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.ThE) {
|
||||
if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) {
|
||||
@@ -430,7 +438,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (this.requests[i] != null) {
|
||||
tagList.appendTag(this.requests[i].writeToNBT());
|
||||
tagList.appendTag(this.requests[i].writeToNBT(true));
|
||||
} else {
|
||||
tagList.appendTag(new NBTTagCompound());
|
||||
}
|
||||
@@ -544,6 +552,42 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
data.writeBoolean(isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(SettingsFrom from, NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
NBTTagList tagList = compound.getTagList(NBT_REQUESTS, Constants.NBT.TAG_COMPOUND);
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
if (tag == null || !tag.hasKey(NBT_STACK)) {
|
||||
this.requests[i] = null;
|
||||
} else {
|
||||
try {
|
||||
this.requests[i] = new RequestInfo(tag, this);
|
||||
this.requests[i].state = LevelState.None;
|
||||
} catch (Exception ignored) {
|
||||
this.requests[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound compound = super.downloadSettings(from);
|
||||
compound = compound == null ? new NBTTagCompound() : compound;
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (this.requests[i] != null) {
|
||||
tagList.appendTag(this.requests[i].writeToNBT(false));
|
||||
} else {
|
||||
tagList.appendTag(new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
compound.setTag(NBT_REQUESTS, tagList);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkPowerStatusChange p) {
|
||||
updatePowerState();
|
||||
@@ -643,7 +687,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT() {
|
||||
public NBTTagCompound writeToNBT(boolean includeLink) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
NBTTagCompound stackTag = new NBTTagCompound();
|
||||
itemStack.writeToNBT(stackTag);
|
||||
@@ -652,7 +696,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
tag.setLong(NBT_BATCH, batchSize);
|
||||
tag.setBoolean(NBT_ENABLE, enable);
|
||||
tag.setInteger(NBT_STATE, state.ordinal());
|
||||
if (this.link != null) {
|
||||
if (this.link != null && includeLink) {
|
||||
NBTTagCompound linkTag = new NBTTagCompound();
|
||||
this.link.writeToNBT(linkTag);
|
||||
tag.setTag(NBT_LINK, linkTag);
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.glodblock.github.client.gui.GuiFluidPatternEncoder;
|
||||
import com.glodblock.github.client.gui.GuiFluidStorageBus;
|
||||
import com.glodblock.github.client.gui.GuiIngredientBuffer;
|
||||
import com.glodblock.github.client.gui.GuiLargeIngredientBuffer;
|
||||
import com.glodblock.github.client.gui.GuiLevelEmitterProxy;
|
||||
import com.glodblock.github.client.gui.GuiLevelMaintainer;
|
||||
import com.glodblock.github.client.gui.GuiLevelTerminal;
|
||||
import com.glodblock.github.client.gui.GuiLevelWireless;
|
||||
@@ -55,6 +56,14 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerPatternItemRenamer;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public enum GuiType {
|
||||
|
||||
@@ -71,6 +80,19 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
LEVEL_EMITTER_PROXY(new PartGuiFactory<>(PartLevelEmitter.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartLevelEmitter inv) {
|
||||
return new ContainerLevelEmitter(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, PartLevelEmitter inv) {
|
||||
return new GuiLevelEmitterProxy(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_LEVEL_EMITTER(new PartGuiFactory<>(PartFluidLevelEmitter.class) {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,10 +5,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -110,12 +114,33 @@ public class CPacketLevelTerminalCommands implements IMessage {
|
||||
case EDIT -> {
|
||||
TileEntity tile = DimensionManager.getWorld(message.dim)
|
||||
.getTileEntity(message.x, message.y, message.z);
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
player.worldObj,
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.LEVEL_MAINTAINER);
|
||||
|
||||
if (tile instanceof IPartHost host) {
|
||||
IPart part = host.getPart(message.side);
|
||||
if (part instanceof PartLevelEmitter) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
tile.getWorldObj(),
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.LEVEL_EMITTER_PROXY);
|
||||
} else if (part instanceof PartFluidLevelEmitter) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
tile.getWorldObj(),
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.FLUID_LEVEL_EMITTER);
|
||||
}
|
||||
} else {
|
||||
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
tile.getWorldObj(),
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.LEVEL_MAINTAINER);
|
||||
}
|
||||
}
|
||||
case BACK -> {
|
||||
GuiType originalGui = GuiType.getByOrdinal(message.originalGui);
|
||||
|
||||
Reference in new issue
Block a user