OSDN Git Service

TileEntityScienceCraftingTableのactiveTabをパケットに追加
authorlilly <lillyo_o@users.sourceforge.jp>
Sun, 9 Dec 2012 16:22:11 +0000 (01:22 +0900)
committerlilly <lillyo_o@users.sourceforge.jp>
Sun, 9 Dec 2012 16:22:11 +0000 (01:22 +0900)
Signed-off-by: lilly <lillyo_o@users.sourceforge.jp>
common/chemicraft/PacketHandler.java
common/chemicraft/TileEntityScienceCraftingTable.java

index bd26cda..93212f5 100644 (file)
@@ -29,18 +29,20 @@ public class PacketHandler implements IPacketHandler {
                if (packet.channel.equals("chemicraft")) {\r
                        ByteArrayDataInput var1 = ByteStreams.newDataInput(packet.data);\r
                        int x, y, z;\r
+                       String tab;\r
 \r
                        // パケットからデータ読み込み\r
                        x = var1.readInt();\r
                        y = var1.readInt();\r
                        z = var1.readInt();\r
+                       tab = var1.readUTF();\r
 \r
                        // TileEntityを取得し読み込んだデータを送る\r
                        World world = ChemiCraft.proxy.getClientWorld();\r
                        TileEntity tileEntity = world.getBlockTileEntity(x, y, z);\r
                        if (tileEntity instanceof TileEntityScienceCraftingTable) {\r
                                TileEntityScienceCraftingTable var2 = (TileEntityScienceCraftingTable) tileEntity;\r
-                               var2.handlePacket(null);\r
+                               var2.handlePacket(new Object[]{tab});\r
                        }\r
                }\r
        }\r
@@ -50,16 +52,19 @@ public class PacketHandler implements IPacketHandler {
                ByteArrayOutputStream var1 = new ByteArrayOutputStream(128);\r
                DataOutputStream var2 = new DataOutputStream(var1);\r
                int x, y, z;\r
+               String tab;\r
 \r
                // データの用意\r
                x = tileEntity.xCoord;\r
                y = tileEntity.yCoord;\r
                z = tileEntity.zCoord;\r
+               tab = tileEntity.getActiveTab();\r
 \r
                try {\r
                        var2.writeInt(x);\r
                        var2.writeInt(y);\r
                        var2.writeInt(z);\r
+                       var2.writeUTF(tab);\r
                } catch (IOException e) {\r
                        e.printStackTrace();\r
                }\r
index 0e26ea7..626198c 100644 (file)
@@ -117,7 +117,7 @@ public class TileEntityScienceCraftingTable extends TileEntity implements IInven
 
 
        public void handlePacket(Object[] data) {
-
+           this.activeTab = (String) data[0];
        }