/** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound tagCompund) {
    super.readEntityFromNBT(tagCompund);

    if (tagCompund.hasKey("playerGameType", 99)) {
      if (MinecraftServer.getServer().getForceGamemode()) {
        this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType());
      } else {
        this.theItemInWorldManager.setGameType(
            WorldSettings.GameType.getByID(tagCompund.getInteger("playerGameType")));
      }
    }
  }
Example #2
0
  /** Reads the raw packet data from the data stream. */
  public void readPacketData(PacketBuffer p_148837_1_) throws IOException {
    this.field_149206_a = p_148837_1_.readInt();
    short var2 = p_148837_1_.readUnsignedByte();
    this.field_149204_b = (var2 & 8) == 8;
    int var3 = var2 & -9;
    this.field_149205_c = WorldSettings.GameType.getByID(var3);
    this.field_149202_d = p_148837_1_.readByte();
    this.field_149203_e = EnumDifficulty.getDifficultyEnum(p_148837_1_.readUnsignedByte());
    this.field_149200_f = p_148837_1_.readUnsignedByte();
    this.field_149201_g = WorldType.parseWorldType(p_148837_1_.readStringFromBuffer(16));

    if (this.field_149201_g == null) {
      this.field_149201_g = WorldType.DEFAULT;
    }
  }