コード例 #1
0
ファイル: PacketHelper.java プロジェクト: Corosauce/CoroUtil
  public static FMLProxyPacket createPacketForTEntDWClient(
      TileEntity tEnt, String name, Object val) {
    /*ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);*/

    CoroAI.dbg("createPacketForTEntDWClient incomplete");
    ByteBuf byteBuf = Unpooled.buffer();

    /*TileHandler tileHandler = ((ITilePacket)tEnt).getTileHandler();

    WatchableObject wo = new WatchableObject((Integer)tileHandler.tileDataWatcher.dataTypes.get(val.getClass()), tileHandler.mapNameToID.get(name), val);

    try {
    	ByteBufUtils.writeUTF8String(byteBuf, "CoroAI_TEntDW");
    	writeTEntToPacket(tEnt, byteBuf);
    	TileDataWatcher.writeWatchableObject(byteBuf, wo);

    	//this is the watchable object terminator indicator required for proper packet reading
    	dos.writeByte(127);
    } catch (IOException e) {
    	e.printStackTrace();
    }*/

    /*Packet250CustomPayload pkt = new Packet250CustomPayload();
    pkt.channel = "CoroAI_TEntDW";
    pkt.data = bos.toByteArray();
    pkt.length = bos.size();
    pkt.isChunkDataPacket = false;*/
    return new FMLProxyPacket(byteBuf, CoroAI.eventChannelName);
  }
コード例 #2
0
ファイル: PacketHelper.java プロジェクト: Corosauce/CoroUtil
  public static FMLProxyPacket createPacketForTEntDWServer(TileEntity tEnt) {
    /*ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);*/

    CoroAI.dbg("createPacketForTEntDWServer incomplete");
    ByteBuf byteBuf = Unpooled.buffer();

    /*TileDataWatcher tileDataWatcher = ((ITilePacket)tEnt).getTileHandler().tileDataWatcher;

    try {
    	ByteBufUtils.writeUTF8String(byteBuf, "CoroAI_TEntDW");
    	writeTEntToPacket(tEnt, dos);
    	TileDataWatcher.writeObjectsInListToStream(tileDataWatcher.unwatchAndReturnAllWatched(), dos);
    } catch (IOException e) {
    	e.printStackTrace();
    }*/

    /*Packet250CustomPayload pkt = new Packet250CustomPayload();
    pkt.channel = "CoroAI_TEntDW";
    pkt.data = bos.toByteArray();
    pkt.length = bos.size();
    pkt.isChunkDataPacket = false;*/
    return new FMLProxyPacket(byteBuf, CoroAI.eventChannelName);
  }