예제 #1
0
  public void importOldChunkTileEntities() {
    File file = wc.downloadSaveHandler.getSaveDirectory();
    if (wc.worldProvider instanceof WorldProviderHell) {
      file = new File(file, "DIM-1");
      file.mkdirs();
    }

    java.io.DataInputStream datainputstream =
        RegionFileCache.getChunkInputStream(file, xPosition, zPosition);
    NBTTagCompound nbttagcompound;
    if (datainputstream != null) {
      try {
        nbttagcompound = CompressedStreamTools.func_1141_a(datainputstream);
      } catch (IOException e) {
        return;
      }
    } else return;

    if (!nbttagcompound.hasKey("Level")) return;

    NBTTagList nbttaglist1 = nbttagcompound.getCompoundTag("Level").getTagList("TileEntities");
    if (nbttaglist1 != null) {
      for (int l = 0; l < nbttaglist1.tagCount(); l++) {
        NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l);
        TileEntity te = TileEntity.createAndLoadEntity(nbttagcompound2);
        if (te != null) {
          ChunkPosition cp = new ChunkPosition(te.xCoord & 0xf, te.yCoord, te.zCoord & 0xf);
          newChunkTileEntityMap.put(cp, te);
        }
      }
    }
  }
예제 #2
0
 /** (abstract) Protected helper method to write subclass entity data to NBT. */
 public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
   par1NBTTagCompound.setByte("Dir", (byte) direction);
   par1NBTTagCompound.setString("Motive", art.title);
   par1NBTTagCompound.setInteger("TileX", xPosition);
   par1NBTTagCompound.setInteger("TileY", yPosition);
   par1NBTTagCompound.setInteger("TileZ", zPosition);
 }
예제 #3
0
  public void readFromNBT(NBTTagCompound tagCompound) {
    this.name = tagCompound.getString("name");
    setSpawnPoint(Coordinate.readFromNBT(tagCompound, "spawnPoint"));
    setProbeCounter(tagCompound.getInteger("probeCounter"));
    setupFromNBT(tagCompound);

    setupBiomeMapping();
  }
예제 #4
0
 public void func_70014_b(NBTTagCompound p_70014_1_) {
   p_70014_1_.func_74777_a("xTile", (short) field_70231_e);
   p_70014_1_.func_74777_a("yTile", (short) field_70228_f);
   p_70014_1_.func_74777_a("zTile", (short) field_70229_g);
   p_70014_1_.func_74774_a("inTile", (byte) field_70237_h);
   p_70014_1_.func_74774_a("inGround", (byte) (field_70238_i ? 1 : 0));
   p_70014_1_.func_74782_a(
       "direction", func_70087_a(new double[] {field_70159_w, field_70181_x, field_70179_y}));
 }
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   setProfession(nbttagcompound.getInt("Profession"));
   riches = nbttagcompound.getInt("Riches");
   if (nbttagcompound.hasKeyOfType("Offers", 10)) {
     NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Offers");
     bu = new MerchantRecipeList(nbttagcompound1);
   }
 }
예제 #6
0
  public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
    super.writeEntityToNBT(nbttagcompound);

    if (getBotOwner() == null) {
      nbttagcompound.setString("Owner", "");
    } else {
      nbttagcompound.setString("Owner", getBotOwner());
    }
  }
예제 #7
0
 public static int[] getIntArraySafe(NBTTagCompound tagCompound, String name) {
   if (!tagCompound.hasKey(name)) {
     return new int[0];
   }
   NBTBase tag = tagCompound.getTag(name);
   if (tag instanceof NBTTagIntArray) {
     return tagCompound.getIntArray(name);
   } else {
     return new int[0];
   }
 }
예제 #8
0
 private static void writeBlocksToNBT(
     NBTTagCompound tagCompound, BlockMeta[] blocks, String name) {
   List<Integer> ids = new ArrayList<Integer>(blocks.length);
   List<Integer> meta = new ArrayList<Integer>(blocks.length);
   for (BlockMeta t : blocks) {
     ids.add(Block.blockRegistry.getIDForObject(t.getBlock()));
     meta.add((int) t.getMeta());
   }
   tagCompound.setIntArray(name, ArrayUtils.toPrimitive(ids.toArray(new Integer[ids.size()])));
   tagCompound.setIntArray(
       name + "_meta", ArrayUtils.toPrimitive(meta.toArray(new Integer[meta.size()])));
 }
  /** Writes a tile entity to NBT. */
  public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setString("EntityId", mobID);
    par1NBTTagCompound.setShort("Delay", (short) delay);
    par1NBTTagCompound.setShort("MinSpawnDelay", (short) field_70388_f);
    par1NBTTagCompound.setShort("MaxSpawnDelay", (short) field_70389_g);
    par1NBTTagCompound.setShort("SpawnCount", (short) field_70395_h);

    if (field_70391_e != null) {
      par1NBTTagCompound.setCompoundTag("SpawnData", field_70391_e);
    }
  }
예제 #10
0
  public void readFromNBT(NBTTagCompound tagCompound) {
    if (tagCompound != null) {
      NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
      for (int i = 0; i < tagList.tagCount(); ++i) {
        NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null) {
          this.inventory[j] = itemstack;
        }
      }
    }
  }
  public void func_70383_a(Entity par1Entity) {
    if (field_70391_e != null) {
      NBTTagCompound nbttagcompound = new NBTTagCompound();
      par1Entity.addEntityID(nbttagcompound);
      NBTBase nbtbase;

      for (Iterator iterator = field_70391_e.getTags().iterator();
          iterator.hasNext();
          nbttagcompound.setTag(nbtbase.getName(), nbtbase.copy())) {
        nbtbase = (NBTBase) iterator.next();
      }

      par1Entity.readFromNBT(nbttagcompound);
    }
  }
예제 #12
0
  /* Save/Load */
  public void saveToNBT(NBTTagCompound tagCompound) {
    NBTTagList tagList = new NBTTagList();
    NBTTagCompound invSlot;

    for (int i = 0; i < this.inventory.length; ++i) {
      if (this.inventory[i] != null) {
        invSlot = new NBTTagCompound();
        invSlot.setByte("Slot", (byte) i);
        this.inventory[i].writeToNBT(invSlot);
        tagList.appendTag(invSlot);
      }
    }

    tagCompound.setTag("Inventory", tagList);
  }
예제 #13
0
 private static void writeFluidsToNBT(NBTTagCompound tagCompound, Block[] fluids, String name) {
   List<Integer> c;
   c = new ArrayList<Integer>(fluids.length);
   for (Block t : fluids) {
     c.add(Block.blockRegistry.getIDForObject(t));
   }
   tagCompound.setIntArray(name, ArrayUtils.toPrimitive(c.toArray(new Integer[c.size()])));
 }
예제 #14
0
  public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
    super.readEntityFromNBT(nbttagcompound);

    String s = nbttagcompound.getString("Owner");
    if (s.length() > 0) {
      setBotOwner(s);
    }
  }
예제 #15
0
  public DimensionInformation(DimensionDescriptor descriptor, NBTTagCompound tagCompound) {
    this.name = tagCompound.getString("name");
    this.descriptor = descriptor;

    setSpawnPoint(Coordinate.readFromNBT(tagCompound, "spawnPoint"));
    setProbeCounter(tagCompound.getInteger("probeCounter"));

    int version = tagCompound.getInteger("version");
    if (version == 1) {
      // This version of the dimension information has the random information persisted.
      setupFromNBT(tagCompound);
    } else {
      // This is an older version. Here we have to calculate the random information again.
      setupFromDescriptor(1);
    }

    setupBiomeMapping();
  }
예제 #16
0
 public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
   super.writeEntityToNBT(nbttagcompound);
   nbttagcompound.setTag("Inventory", inventory.writeToNBT(new NBTTagList()));
   nbttagcompound.setInteger("Dimension", dimension);
   nbttagcompound.setBoolean("Sleeping", sleeping);
   nbttagcompound.setShort("SleepTimer", (short) sleepTimer);
   nbttagcompound.setFloat("XpP", currentXP);
   nbttagcompound.setInteger("XpLevel", playerLevel);
   nbttagcompound.setInteger("XpTotal", totalXP);
   if (playerSpawnCoordinate != null) {
     nbttagcompound.setInteger("SpawnX", playerSpawnCoordinate.posX);
     nbttagcompound.setInteger("SpawnY", playerSpawnCoordinate.posY);
     nbttagcompound.setInteger("SpawnZ", playerSpawnCoordinate.posZ);
   }
   foodStats.writeStatsToNBT(nbttagcompound);
   capabilities.writeCapabilitiesToNBT(nbttagcompound);
 }
예제 #17
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    direction = par1NBTTagCompound.getByte("Dir");
    xPosition = par1NBTTagCompound.getInteger("TileX");
    yPosition = par1NBTTagCompound.getInteger("TileY");
    zPosition = par1NBTTagCompound.getInteger("TileZ");
    String s = par1NBTTagCompound.getString("Motive");
    EnumArt aenumart[] = EnumArt.values();
    int i = aenumart.length;

    for (int j = 0; j < i; j++) {
      EnumArt enumart = aenumart[j];

      if (enumart.title.equals(s)) {
        art = enumart;
      }
    }

    if (art == null) {
      art = EnumArt.Kebab;
    }

    func_179_a(direction);
  }
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    mobID = par1NBTTagCompound.getString("EntityId");
    delay = par1NBTTagCompound.getShort("Delay");

    if (par1NBTTagCompound.hasKey("SpawnData")) {
      field_70391_e = par1NBTTagCompound.getCompoundTag("SpawnData");
    } else {
      field_70391_e = null;
    }

    if (par1NBTTagCompound.hasKey("MinSpawnDelay")) {
      field_70388_f = par1NBTTagCompound.getShort("MinSpawnDelay");
      field_70389_g = par1NBTTagCompound.getShort("MaxSpawnDelay");
      field_70395_h = par1NBTTagCompound.getShort("SpawnCount");
    }
  }
예제 #19
0
 public void func_70037_a(NBTTagCompound p_70037_1_) {
   field_70231_e = p_70037_1_.func_74765_d("xTile");
   field_70228_f = p_70037_1_.func_74765_d("yTile");
   field_70229_g = p_70037_1_.func_74765_d("zTile");
   field_70237_h = p_70037_1_.func_74771_c("inTile") & 0xff;
   field_70238_i = p_70037_1_.func_74771_c("inGround") == 1;
   if (p_70037_1_.func_74764_b("direction")) {
     NBTTagList nbttaglist = p_70037_1_.func_74761_m("direction");
     field_70159_w = ((NBTTagDouble) nbttaglist.func_74743_b(0)).field_74755_a;
     field_70181_x = ((NBTTagDouble) nbttaglist.func_74743_b(1)).field_74755_a;
     field_70179_y = ((NBTTagDouble) nbttaglist.func_74743_b(2)).field_74755_a;
   } else {
     func_70106_y();
   }
 }
  /** copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData */
  private void convertChunks(
      File par1File,
      File par2File,
      WorldChunkManager par3WorldChunkManager,
      int par4,
      int par5,
      IProgressUpdate par6IProgressUpdate) {
    try {
      String s = par2File.getName();
      RegionFile regionfile = new RegionFile(par2File);
      RegionFile regionfile1 =
          new RegionFile(
              new File(
                  par1File,
                  (new StringBuilder())
                      .append(s.substring(0, s.length() - ".mcr".length()))
                      .append(".mca")
                      .toString()));

      for (int i = 0; i < 32; i++) {
        for (int j = 0; j < 32; j++) {
          if (!regionfile.isChunkSaved(i, j) || regionfile1.isChunkSaved(i, j)) {
            continue;
          }

          DataInputStream datainputstream = regionfile.getChunkDataInputStream(i, j);

          if (datainputstream == null) {
            System.out.println("Failed to fetch input stream");
          } else {
            NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream);
            datainputstream.close();
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Level");
            AnvilConverterData anvilconverterdata = ChunkLoader.load(nbttagcompound1);
            NBTTagCompound nbttagcompound2 = new NBTTagCompound();
            NBTTagCompound nbttagcompound3 = new NBTTagCompound();
            nbttagcompound2.setTag("Level", nbttagcompound3);
            ChunkLoader.convertToAnvilFormat(
                anvilconverterdata, nbttagcompound3, par3WorldChunkManager);
            DataOutputStream dataoutputstream = regionfile1.getChunkDataOutputStream(i, j);
            CompressedStreamTools.write(nbttagcompound2, dataoutputstream);
            dataoutputstream.close();
          }
        }

        int k = (int) Math.round((100D * (double) (par4 * 1024)) / (double) (par5 * 1024));
        int l =
            (int)
                Math.round((100D * (double) ((i + 1) * 32 + par4 * 1024)) / (double) (par5 * 1024));

        if (l > k) {
          par6IProgressUpdate.setLoadingProgress(l);
        }
      }

      regionfile.close();
      regionfile1.close();
    } catch (IOException ioexception) {
      ioexception.printStackTrace();
    }
  }
예제 #21
0
 private BlockMeta getBlockMeta(NBTTagCompound tagCompound, String name) {
   Block block = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger(name));
   int meta = tagCompound.getInteger(name + "_meta");
   return new BlockMeta(block, meta);
 }
예제 #22
0
  private void setupFromNBT(NBTTagCompound tagCompound) {
    terrainType = TerrainType.values()[tagCompound.getInteger("terrain")];
    featureTypes = toEnumSet(getIntArraySafe(tagCompound, "features"), FeatureType.values());
    structureTypes = toEnumSet(getIntArraySafe(tagCompound, "structures"), StructureType.values());
    effectTypes = toEnumSet(getIntArraySafe(tagCompound, "effects"), EffectType.values());

    biomes.clear();
    for (int a : getIntArraySafe(tagCompound, "biomes")) {
      BiomeGenBase biome = BiomeGenBase.getBiome(a);
      if (biome != null) {
        biomes.add(biome);
      } else {
        // Protect against deleted biomes (i.e. a mod with biomes gets removed and this dimension
        // still uses it).
        // We will pick a replacement biome here.
        biomes.add(BiomeGenBase.plains);
      }
    }
    if (tagCompound.hasKey("controller")) {
      controllerType = ControllerType.values()[tagCompound.getInteger("controller")];
    } else {
      // Support for old type.
      if (biomes.isEmpty()) {
        controllerType = ControllerType.CONTROLLER_DEFAULT;
      } else {
        controllerType = ControllerType.CONTROLLER_SINGLE;
      }
    }

    digitString = tagCompound.getString("digits");

    forcedDimensionSeed = tagCompound.getLong("forcedSeed");
    baseSeed = tagCompound.getLong("baseSeed");
    worldVersion = tagCompound.getInteger("worldVersion");

    baseBlockForTerrain = getBlockMeta(tagCompound, "baseBlock");
    tendrilBlock = getBlockMeta(tagCompound, "tendrilBlock");
    canyonBlock = getBlockMeta(tagCompound, "canyonBlock");
    fluidForTerrain =
        (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("fluidBlock"));

    hugeLiquidSphereFluids = readFluidsFromNBT(tagCompound, "hugeLiquidSphereFluids");
    hugeLiquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeLiquidSphereBlocks");

    // Support for the old format with only one liquid block.
    Block oldLiquidSphereFluid =
        (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("liquidSphereFluid"));
    liquidSphereFluids = readFluidsFromNBT(tagCompound, "liquidSphereFluids");
    if (liquidSphereFluids.length == 0) {
      liquidSphereFluids = new Block[] {oldLiquidSphereFluid};
    }

    // Support for the old format with only one sphere block.
    BlockMeta oldLiquidSphereBlock = getBlockMeta(tagCompound, "liquidSphereBlock");
    liquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "liquidSphereBlocks");
    if (liquidSphereBlocks.length == 0) {
      liquidSphereBlocks = new BlockMeta[] {oldLiquidSphereBlock};
    }

    pyramidBlocks = readBlockArrayFromNBT(tagCompound, "pyramidBlocks");
    if (pyramidBlocks.length == 0) {
      pyramidBlocks = new BlockMeta[] {BlockMeta.STONE};
    }

    // Support for the old format with only one sphere block.
    BlockMeta oldSphereBlock = getBlockMeta(tagCompound, "sphereBlock");
    sphereBlocks = readBlockArrayFromNBT(tagCompound, "sphereBlocks");
    if (sphereBlocks.length == 0) {
      sphereBlocks = new BlockMeta[] {oldSphereBlock};
    }

    hugeSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeSphereBlocks");

    extraOregen = readBlockArrayFromNBT(tagCompound, "extraOregen");
    fluidsForLakes = readFluidsFromNBT(tagCompound, "lakeFluids");

    peaceful = tagCompound.getBoolean("peaceful");
    noanimals = tagCompound.getBoolean("noanimals");
    shelter = tagCompound.getBoolean("shelter");
    respawnHere = tagCompound.getBoolean("respawnHere");
    if (tagCompound.hasKey("celestialAngle")) {
      celestialAngle = tagCompound.getFloat("celestialAngle");
    } else {
      celestialAngle = null;
    }
    if (tagCompound.hasKey("timeSpeed")) {
      timeSpeed = tagCompound.getFloat("timeSpeed");
    } else {
      timeSpeed = null;
    }
    probeCounter = tagCompound.getInteger("probes");
    actualRfCost = tagCompound.getInteger("actualCost");

    skyDescriptor = new SkyDescriptor.Builder().fromNBT(tagCompound).build();
    calculateCelestialBodyDescriptors();

    patreon1 = tagCompound.getLong("patreon1");

    weatherDescriptor = new WeatherDescriptor.Builder().fromNBT(tagCompound).build();

    extraMobs.clear();
    NBTTagList list = tagCompound.getTagList("mobs", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < list.tagCount(); i++) {
      NBTTagCompound tc = list.getCompoundTagAt(i);
      String className = tc.getString("class");
      int chance = tc.getInteger("chance");
      int minGroup = tc.getInteger("minGroup");
      int maxGroup = tc.getInteger("maxGroup");
      int maxLoaded = tc.getInteger("maxLoaded");
      Class<? extends EntityLiving> c = null;
      try {
        c = (Class<? extends EntityLiving>) Class.forName(className);
      } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
      MobDescriptor mob = new MobDescriptor(null, c, chance, minGroup, maxGroup, maxLoaded);
      extraMobs.add(mob);
    }

    String ds = tagCompound.getString("dimensionTypes");
    dimensionTypes = StringUtils.split(ds, ",");
    if (dimensionTypes == null) {
      dimensionTypes = new String[0];
    }
  }
예제 #23
0
 private void setBlockMeta(NBTTagCompound tagCompound, BlockMeta blockMeta, String name) {
   tagCompound.setInteger(name, Block.blockRegistry.getIDForObject(blockMeta.getBlock()));
   tagCompound.setInteger(name + "_meta", blockMeta.getMeta());
 }
예제 #24
0
  public void writeToNBT(NBTTagCompound tagCompound) {
    tagCompound.setString("name", getName());
    Coordinate spawnPoint = getSpawnPoint();
    if (spawnPoint != null) {
      Coordinate.writeToNBT(tagCompound, "spawnPoint", spawnPoint);
    }
    tagCompound.setInteger("probeCounter", getProbeCounter());
    tagCompound.setInteger(
        "version",
        1); // Version number so that we can detect incompatible changes in persisted dimension
    // information objects.

    tagCompound.setInteger(
        "terrain",
        terrainType == null ? TerrainType.TERRAIN_VOID.ordinal() : terrainType.ordinal());
    tagCompound.setIntArray("features", toIntArray(featureTypes));
    tagCompound.setIntArray("structures", toIntArray(structureTypes));
    tagCompound.setIntArray("effects", toIntArray(effectTypes));

    List<Integer> c = new ArrayList<Integer>(biomes.size());
    for (BiomeGenBase t : biomes) {
      if (t != null) {
        c.add(t.biomeID);
      } else {
        c.add(BiomeGenBase.plains.biomeID);
      }
    }
    tagCompound.setIntArray("biomes", ArrayUtils.toPrimitive(c.toArray(new Integer[c.size()])));
    tagCompound.setInteger(
        "controller",
        controllerType == null
            ? ControllerType.CONTROLLER_DEFAULT.ordinal()
            : controllerType.ordinal());
    tagCompound.setString("digits", digitString);

    tagCompound.setLong("forcedSeed", forcedDimensionSeed);
    tagCompound.setLong("baseSeed", baseSeed);
    tagCompound.setInteger("worldVersion", worldVersion);

    setBlockMeta(tagCompound, baseBlockForTerrain, "baseBlock");
    setBlockMeta(tagCompound, tendrilBlock, "tendrilBlock");

    writeBlocksToNBT(tagCompound, pyramidBlocks, "pyramidBlocks");

    writeBlocksToNBT(tagCompound, sphereBlocks, "sphereBlocks");
    if (sphereBlocks.length > 0) {
      // Write out a single sphere block for compatibility with older RFTools.
      setBlockMeta(tagCompound, sphereBlocks[0], "sphereBlock");
    }

    writeBlocksToNBT(tagCompound, hugeSphereBlocks, "hugeSphereBlocks");
    writeBlocksToNBT(tagCompound, hugeLiquidSphereBlocks, "hugeLiquidSphereBlocks");
    writeFluidsToNBT(tagCompound, hugeLiquidSphereFluids, "hugeLiquidSphereFluids");

    writeBlocksToNBT(tagCompound, liquidSphereBlocks, "liquidSphereBlocks");
    if (liquidSphereBlocks.length > 0) {
      // Write out a single sphere block for compatibility with older RFTools.
      setBlockMeta(tagCompound, liquidSphereBlocks[0], "liquidSphereBlock");
    }

    writeFluidsToNBT(tagCompound, liquidSphereFluids, "liquidSphereFluids");
    if (liquidSphereFluids.length > 0) {
      tagCompound.setInteger(
          "liquidSphereFluid", Block.blockRegistry.getIDForObject(liquidSphereFluids[0]));
    }

    setBlockMeta(tagCompound, canyonBlock, "canyonBlock");
    tagCompound.setInteger("fluidBlock", Block.blockRegistry.getIDForObject(fluidForTerrain));

    writeBlocksToNBT(tagCompound, extraOregen, "extraOregen");
    writeFluidsToNBT(tagCompound, fluidsForLakes, "lakeFluids");

    tagCompound.setBoolean("peaceful", peaceful);
    tagCompound.setBoolean("noanimals", noanimals);
    tagCompound.setBoolean("shelter", shelter);
    tagCompound.setBoolean("respawnHere", respawnHere);
    if (celestialAngle != null) {
      tagCompound.setFloat("celestialAngle", celestialAngle);
    }
    if (timeSpeed != null) {
      tagCompound.setFloat("timeSpeed", timeSpeed);
    }
    tagCompound.setInteger("probes", probeCounter);
    tagCompound.setInteger("actualCost", actualRfCost);

    skyDescriptor.writeToNBT(tagCompound);
    weatherDescriptor.writeToNBT(tagCompound);

    tagCompound.setLong("patreon1", patreon1);

    NBTTagList list = new NBTTagList();
    for (MobDescriptor mob : extraMobs) {
      NBTTagCompound tc = new NBTTagCompound();

      if (mob != null) {
        if (mob.getEntityClass() != null) {
          tc.setString("class", mob.getEntityClass().getName());
          tc.setInteger("chance", mob.getSpawnChance());
          tc.setInteger("minGroup", mob.getMinGroup());
          tc.setInteger("maxGroup", mob.getMaxGroup());
          tc.setInteger("maxLoaded", mob.getMaxLoaded());
          list.appendTag(tc);
        }
      }
    }

    tagCompound.setTag("mobs", list);
    tagCompound.setString("dimensionTypes", StringUtils.join(dimensionTypes, ","));
  }
예제 #25
0
 public void a(String s, NBTTagCompound nbttagcompound) {
   a.put(s, nbttagcompound.m(s));
 }
 public void b(NBTTagCompound nbttagcompound) {
   super.b(nbttagcompound);
   nbttagcompound.setInt("Profession", getProfession());
   nbttagcompound.setInt("Riches", riches);
   if (bu != null) nbttagcompound.set("Offers", bu.a());
 }
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   if (nbttagcompound.hasKey("playerGameType")) {
     itemInWorldManager.toggleGameType(nbttagcompound.getInteger("playerGameType"));
   }
 }
 public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
   super.writeEntityToNBT(nbttagcompound);
   nbttagcompound.setInteger("playerGameType", itemInWorldManager.getGameType());
 }
예제 #29
0
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory");
   inventory.readFromNBT(nbttaglist);
   dimension = nbttagcompound.getInteger("Dimension");
   sleeping = nbttagcompound.getBoolean("Sleeping");
   sleepTimer = nbttagcompound.getShort("SleepTimer");
   currentXP = nbttagcompound.getFloat("XpP");
   playerLevel = nbttagcompound.getInteger("XpLevel");
   totalXP = nbttagcompound.getInteger("XpTotal");
   if (sleeping) {
     bedChunkCoordinates =
         new ChunkCoordinates(
             MathHelper.floor_double(posX),
             MathHelper.floor_double(posY),
             MathHelper.floor_double(posZ));
     wakeUpPlayer(true, true, false);
   }
   if (nbttagcompound.hasKey("SpawnX")
       && nbttagcompound.hasKey("SpawnY")
       && nbttagcompound.hasKey("SpawnZ")) {
     playerSpawnCoordinate =
         new ChunkCoordinates(
             nbttagcompound.getInteger("SpawnX"),
             nbttagcompound.getInteger("SpawnY"),
             nbttagcompound.getInteger("SpawnZ"));
   }
   foodStats.readStatsFromNBT(nbttagcompound);
   capabilities.readCapabilitiesFromNBT(nbttagcompound);
 }