@Override
  public void writeSpawnData(ByteArrayDataOutput data) {
    NBTTagCompound tags = returnStack.getTagCompound().getCompoundTag("InfiTool");
    data.writeShort(returnStack.itemID);
    data.writeFloat(rotationYaw);
    data.writeInt(tags.getInteger("RenderHandle"));
    data.writeInt(tags.getInteger("RenderHead"));
    data.writeInt(tags.getInteger("RenderAccessory"));

    int effects = 0;
    if (tags.hasKey("Effect1")) effects++;
    if (tags.hasKey("Effect2")) effects++;
    if (tags.hasKey("Effect3")) effects++;
    if (tags.hasKey("Effect4")) effects++;
    if (tags.hasKey("Effect5")) effects++;
    if (tags.hasKey("Effect6")) effects++;
    data.writeInt(effects);

    switch (effects) {
      case 6:
        data.writeInt(tags.getInteger("Effect6"));
      case 5:
        data.writeInt(tags.getInteger("Effect5"));
      case 4:
        data.writeInt(tags.getInteger("Effect4"));
      case 3:
        data.writeInt(tags.getInteger("Effect3"));
      case 2:
        data.writeInt(tags.getInteger("Effect2"));
      case 1:
        data.writeInt(tags.getInteger("Effect1"));
    }
  }
 @Override
 protected void writeData(ByteArrayDataOutput out) throws IOException {
   out.writeInt(x);
   out.writeShort(y);
   out.writeInt(z);
   out.writeInt(charge);
 }
예제 #3
0
 @Override
 public void write(ByteArrayDataOutput out) {
   out.writeUTF(playerName);
   out.writeInt(x);
   out.writeInt(y);
   out.writeInt(z);
   out.writeInt(size);
   out.writeInt(types);
   out.writeBoolean(remove);
   out.writeChar(upgrade);
   out.writeChar(downgrade);
 }
예제 #4
0
 @Override
 public byte[] generatePacket(Object... data) {
   @SuppressWarnings("unchecked")
   Map<String, String> modVersions = (Map<String, String>) data[0];
   @SuppressWarnings("unchecked")
   List<String> missingMods = (List<String>) data[1];
   ByteArrayDataOutput dat = ByteStreams.newDataOutput();
   dat.writeInt(modVersions.size());
   for (Entry<String, String> version : modVersions.entrySet()) {
     dat.writeUTF(version.getKey());
     dat.writeUTF(version.getValue());
   }
   dat.writeInt(missingMods.size());
   for (String missing : missingMods) {
     dat.writeUTF(missing);
   }
   return dat.toByteArray();
 }
예제 #5
0
 @Override
 public byte[] generatePacket(Object... data) {
   ByteArrayDataOutput dat = ByteStreams.newDataOutput();
   Set<ModContainer> activeMods = FMLNetworkHandler.instance().getNetworkModList();
   dat.writeInt(activeMods.size());
   for (ModContainer mc : activeMods) {
     dat.writeUTF(mc.getModId());
   }
   dat.writeByte(FMLNetworkHandler.getCompatibilityLevel());
   return dat.toByteArray();
 }
예제 #6
0
  /** create the custom250packet from the current data in this packet. */
  protected void constructPacket() {
    ByteArrayDataOutput data = ByteStreams.newDataOutput();

    /**
     * write the packet type number to the stream, decoded in packetHandler to create a new packet
     */
    data.writeInt(this.getPacketType());

    /** write default packet data NBTCompound to the stream */
    NBTWriter.writeTagToStream(packetData, data);

    /** write custom data to the output stream */
    this.writeDataToStream(data);
    this.packet250 = new Packet250CustomPayload();
    packet250.isChunkDataPacket = this.chunkPacket;
    packet250.channel = this.getChannel();
    packet250.data = data.toByteArray();
    packet250.length = packet250.data.length;
  }
 @Override
 void writeData(ByteArrayDataOutput out) {
   out.writeInt(entityId);
   out.writeUTF(newName);
 }
예제 #8
0
 @Override
 public void writeSpawnData(ByteArrayDataOutput data) {
   data.writeInt(this.BirthTick);
   data.writeInt(this.EnumToInt(DinoInside));
   // data.writeChars(this.ParentOwner);
 }
예제 #9
0
 @Override
 public void writeToStream(ByteArrayDataOutput stream) {
   this.key.writeToStream(stream);
   stream.writeInt(this.value);
   this.data.writeToStream(stream);
 }
 @Override
 public void write(ByteArrayDataOutput out) {
   out.writeInt(windowId);
   out.writeInt(marketId);
 }
예제 #11
0
 @Override
 public void write(Object o, ByteArrayDataOutput dat) {
   dat.writeInt((Integer) o);
 }
예제 #12
0
 @Override
 protected void write(ByteArrayDataOutput output) {
   output.writeInt(cost);
 }
 @Override
 public void writeSpawnData(ByteArrayDataOutput data) {
   data.writeInt(angler.entityId);
 }