mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
wireless interface terminal add edit button
This commit is contained in:
1 parent
d2c420d193
commit
417574fb3c
12 files changed
+203
-26
No files matched your search
@@ -48,6 +48,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.registerApp(2, "FORCE_PRIO", "DO_PRIO", "prio");
|
||||
this.registerApp(3, "NOT_PRIO", "DONT_PRIO", "not_prio");
|
||||
this.registerApp(4, "SUBMIT", "SUBMIT", "submit");
|
||||
this.registerApp(5, "EDIT", "YES", "edit");
|
||||
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||
this.registerApp(10, "FLUID_TEM", "YES", "fluid_terminal_w");
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -39,9 +40,11 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCBaseMEGui;
|
||||
import com.glodblock.github.client.gui.container.ContainerInterfaceWireless;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketRenamer;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
@@ -53,7 +56,7 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
|
||||
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
|
||||
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
|
||||
private final HashMap<ClientDCInternalInv, DimensionalCoord> blockPosHashMap = new HashMap<>();
|
||||
private final HashMap<ClientDCInternalInv, DimensionalCoordSide> blockPosHashMap = new HashMap<>();
|
||||
private final HashMap<GuiButton, ClientDCInternalInv> guiButtonHashMap = new HashMap<>();
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<Object> lines = new ArrayList<>();
|
||||
@@ -310,8 +313,14 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
guiTop + offset + 1,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.HIGHLIGHT_INTERFACE);
|
||||
GuiFCImgButton editButton = new GuiFCImgButton(guiLeft + 4, guiTop + offset + 1, "EDIT", "YES");
|
||||
guiButtonHashMap.put(guiButton, inv);
|
||||
buttonList.add(guiButton);
|
||||
guiButtonHashMap.put(editButton, inv);
|
||||
if (isShiftKeyDown()) {
|
||||
buttonList.add(editButton);
|
||||
} else {
|
||||
buttonList.add(guiButton);
|
||||
}
|
||||
}
|
||||
|
||||
offset += 18;
|
||||
@@ -336,28 +345,34 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (guiButtonHashMap.containsKey(btn)) {
|
||||
DimensionalCoord blockPos = blockPosHashMap.get(guiButtonHashMap.get(btn));
|
||||
WorldCoord blockPos2 = new WorldCoord(
|
||||
(int) mc.thePlayer.posX,
|
||||
(int) mc.thePlayer.posY,
|
||||
(int) mc.thePlayer.posZ);
|
||||
if (mc.theWorld.provider.dimensionId != blockPos.getDimension()) {
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceInOtherDim.getName(),
|
||||
blockPos.getDimension()));
|
||||
DimensionalCoordSide blockPos = blockPosHashMap.get(guiButtonHashMap.get(btn));
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketRenamer(blockPos.x, blockPos.y, blockPos.z, blockPos.getDimension(), blockPos.side));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlock(
|
||||
blockPos,
|
||||
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z));
|
||||
|
||||
WorldCoord blockPos2 = new WorldCoord(
|
||||
(int) mc.thePlayer.posX,
|
||||
(int) mc.thePlayer.posY,
|
||||
(int) mc.thePlayer.posZ);
|
||||
if (mc.theWorld.provider.dimensionId != blockPos.getDimension()) {
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceInOtherDim.getName(),
|
||||
blockPos.getDimension()));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlock(
|
||||
blockPos,
|
||||
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z));
|
||||
}
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
mc.thePlayer.closeScreen();
|
||||
} else if (btn == guiButtonHideFull) {
|
||||
AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal = !AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal;
|
||||
this.refreshList();
|
||||
@@ -473,6 +488,17 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class DimensionalCoordSide extends DimensionalCoord {
|
||||
|
||||
private ForgeDirection side = ForgeDirection.UNKNOWN;
|
||||
|
||||
public DimensionalCoordSide(final int _x, final int _y, final int _z, final int _dim, ForgeDirection side) {
|
||||
super(_x, _y, _z, _dim);
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(final NBTTagCompound in) {
|
||||
if (in.getBoolean("clear")) {
|
||||
this.byId.clear();
|
||||
@@ -491,7 +517,8 @@ public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropTo
|
||||
int Y = invData.getInteger("y");
|
||||
int Z = invData.getInteger("z");
|
||||
int dim = invData.getInteger("dim");
|
||||
blockPosHashMap.put(current, new DimensionalCoord(X, Y, Z, dim));
|
||||
ForgeDirection side = ForgeDirection.getOrientation(invData.getInteger("side"));
|
||||
blockPosHashMap.put(current, new DimensionalCoordSide(X, Y, Z, dim, side));
|
||||
|
||||
for (int x = 0; x < current.getInventory().getSizeInventory(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
|
||||
+9
-3
@@ -10,9 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
@@ -23,6 +21,7 @@ import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.parts.AEBasePart;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.p2p.PartP2PInterface;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -311,6 +310,7 @@ public class ContainerInterfaceWireless extends AEBaseContainer {
|
||||
tag.setInteger("y", inv.Y);
|
||||
tag.setInteger("z", inv.Z);
|
||||
tag.setInteger("dim", inv.dim);
|
||||
tag.setInteger("side", inv.side.ordinal());
|
||||
}
|
||||
|
||||
for (int x = 0; x < length; x++) {
|
||||
@@ -343,6 +343,7 @@ public class ContainerInterfaceWireless extends AEBaseContainer {
|
||||
private final int Y;
|
||||
private final int Z;
|
||||
private final int dim;
|
||||
private final ForgeDirection side;
|
||||
|
||||
public InvTracker(final DualityInterface dual, final IInventory patterns, final String unlocalizedName,
|
||||
int offset, int size) {
|
||||
@@ -355,6 +356,11 @@ public class ContainerInterfaceWireless extends AEBaseContainer {
|
||||
Y = dual.getLocation().y;
|
||||
Z = dual.getLocation().z;
|
||||
dim = dual.getLocation().getDimension();
|
||||
if (dual.getHost() instanceof AEBasePart) {
|
||||
side = ((AEBasePart) dual.getHost()).getSide();
|
||||
} else {
|
||||
side = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
case "appeng.core.sync.packets.PacketCompressedNBT":
|
||||
tform = PacketCompressedNBTTransformer.INSTANCE;
|
||||
break;
|
||||
case "appeng.client.gui.implementations.GuiRenamer":
|
||||
tform = GuiRenamerTransformer.INSTANCE;
|
||||
break;
|
||||
default:
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -31,15 +32,20 @@ import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
|
||||
import com.glodblock.github.client.gui.GuiInterfaceTerminalWireless;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.item.ItemWirelessInterfaceTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryCrafting;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.SetBackedMachineSet;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -199,4 +205,12 @@ public class CoreModHooks {
|
||||
((GuiInterfaceTerminalWireless) gs).postUpdate(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void reopenInterfaceTerminal() {
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack c = p.getCurrentEquippedItem();
|
||||
if (c.getItem() instanceof ItemWirelessInterfaceTerminal || c.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.WIRELESS_INTERFACE_TERMINAL, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class GuiRenamerTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final GuiRenamerTransformer INSTANCE = new GuiRenamerTransformer();
|
||||
|
||||
private GuiRenamerTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new GuiRenamerTransformer.TransformGuiRenamer(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformGuiRenamer extends ClassVisitor {
|
||||
|
||||
TransformGuiRenamer(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("keyTyped")) {
|
||||
return new GuiRenamerTransformer.TransformKeyTyped(
|
||||
api,
|
||||
super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformKeyTyped extends MethodVisitor {
|
||||
|
||||
TransformKeyTyped(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
if (owner.equals("net/minecraft/client/entity/EntityClientPlayerMP") && name.equals("closeScreen")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"reopenInterfaceTerminal",
|
||||
"()V",
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,8 @@ public class ChannelLoader implements Runnable {
|
||||
.registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER);
|
||||
FluidCraft.proxy.netHandler
|
||||
.registerMessage(new SPacketSetItemAmount.Handler(), SPacketSetItemAmount.class, id++, Side.CLIENT);
|
||||
FluidCraft.proxy.netHandler
|
||||
.registerMessage(new CPacketRenamer.Handler(), CPacketRenamer.class, id++, Side.SERVER);
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
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 CPacketRenamer implements IMessage {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int dim;
|
||||
private ForgeDirection side;
|
||||
|
||||
public CPacketRenamer() {}
|
||||
|
||||
public CPacketRenamer(int x, int y, int z, int dim, ForgeDirection side) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.dim = dim;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
this.dim = buf.readInt();
|
||||
this.side = ForgeDirection.getOrientation(buf.readInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(this.x);
|
||||
buf.writeInt(this.y);
|
||||
buf.writeInt(this.z);
|
||||
buf.writeInt(this.dim);
|
||||
buf.writeInt(side.ordinal());
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<CPacketRenamer, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(CPacketRenamer message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity tile = DimensionManager.getWorld(message.dim).getTileEntity(message.x, message.y, message.z);
|
||||
if (tile != null) {
|
||||
Platform.openGUI(player, tile, message.side, GuiBridge.GUI_RENAMER);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,7 @@ ae2fc.tooltip.prio.hint=Disabled
|
||||
ae2fc.tooltip.submit=Submit
|
||||
ae2fc.tooltip.enable=Enabled
|
||||
ae2fc.tooltip.disable=Disabled
|
||||
ae2fc.tooltip.edit=Edit
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal
|
||||
|
||||
@@ -110,6 +110,7 @@ ae2fc.tooltip.prio.hint=禁用
|
||||
ae2fc.tooltip.submit=提交
|
||||
ae2fc.tooltip.enable=启用
|
||||
ae2fc.tooltip.disable=禁用
|
||||
ae2fc.tooltip.edit=编辑
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=ME流体样板终端
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=ME增广流体样板终端
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 634 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
Reference in new issue
Block a user