Considerable progress on Interface terminal.

This commit is contained in:
AlgorithmX2
2014-07-07 22:48:21 -05:00
parent a0427da1ae
commit 813c1bcb58
12 changed files with 427 additions and 66 deletions
+4 -1
View File
@@ -11,6 +11,7 @@ import appeng.core.sync.packets.PacketAssemblerAnimation;
import appeng.core.sync.packets.PacketClick;
import appeng.core.sync.packets.PacketCompassRequest;
import appeng.core.sync.packets.PacketCompassResponse;
import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketInventoryAction;
@@ -79,7 +80,9 @@ public class AppEngPacketHandlerBase
PACKET_CRAFTING_REQUEST(PacketCraftRequest.class),
PAKCET_ASSEMBLER_ANIMATION(PacketAssemblerAnimation.class);
PACKET_ASSEMBLER_ANIMATION(PacketAssemblerAnimation.class),
PACKET_COMPRESSED_NBT(PacketCompressedNBT.class);
final public Class pc;
final public Constructor con;
+5 -1
View File
@@ -45,6 +45,7 @@ import appeng.container.implementations.ContainerGrinder;
import appeng.container.implementations.ContainerIOPort;
import appeng.container.implementations.ContainerInscriber;
import appeng.container.implementations.ContainerInterface;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.container.implementations.ContainerLevelEmitter;
import appeng.container.implementations.ContainerMAC;
import appeng.container.implementations.ContainerMEMonitorable;
@@ -71,6 +72,7 @@ import appeng.parts.automation.PartFormationPlane;
import appeng.parts.automation.PartLevelEmitter;
import appeng.parts.misc.PartStorageBus;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartMonitor;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.server.AccessType;
import appeng.tile.crafting.TileCraftingTile;
@@ -157,7 +159,9 @@ public enum GuiBridge implements IGuiHandler
GUI_CRAFTING_AMOUNT(ContainerCraftAmount.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT),
GUI_CRAFTING_CONFIRM(ContainerCraftConfirm.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT);
GUI_CRAFTING_CONFIRM(ContainerCraftConfirm.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT),
GUI_INTERFACE_TERMINAL(ContainerInterfaceTerminal.class, PartMonitor.class, WORLD, SecurityPermissions.BUILD);
private Class Tile;
private Class Gui;
@@ -0,0 +1,95 @@
package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import appeng.client.gui.implementations.GuiInterfaceTerminal;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketCompressedNBT extends AppEngPacket
{
// output...
final private ByteBuf data;
final private GZIPOutputStream compressFrame;
int writtenBytes = 0;
boolean empty = true;
// input.
final NBTTagCompound in;
// automatic.
public PacketCompressedNBT(final ByteBuf stream) throws IOException {
data = null;
compressFrame = null;
GZIPInputStream gzReader = new GZIPInputStream( new InputStream() {
@Override
public int read() throws IOException
{
if ( stream.readableBytes() <= 0 )
return -1;
return (int) stream.readByte() & 0xff;
}
} );
in = CompressedStreamTools.read( new DataInputStream( gzReader ) );
}
@Override
@SideOnly(Side.CLIENT)
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiInterfaceTerminal )
((GuiInterfaceTerminal) gs).postUpdate( in );
}
// api
public PacketCompressedNBT(NBTTagCompound din) throws IOException {
data = Unpooled.buffer( 2048 );
data.writeInt( getPacketID() );
in = din;
compressFrame = new GZIPOutputStream( new OutputStream() {
@Override
public void write(int value) throws IOException
{
data.writeByte( value );
}
} );
CompressedStreamTools.write( din, new DataOutputStream( compressFrame ) );
compressFrame.close();
configureWrite( data );
}
}