Пример #1
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);
 }
Пример #2
0
  public void readFromNBT(NBTTagCompound tagCompound) {
    this.name = tagCompound.getString("name");
    setSpawnPoint(Coordinate.readFromNBT(tagCompound, "spawnPoint"));
    setProbeCounter(tagCompound.getInteger("probeCounter"));
    setupFromNBT(tagCompound);

    setupBiomeMapping();
  }
Пример #3
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();
  }
Пример #4
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);
  }
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   if (nbttagcompound.hasKey("playerGameType")) {
     itemInWorldManager.toggleGameType(nbttagcompound.getInteger("playerGameType"));
   }
 }
Пример #6
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);
 }
Пример #7
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];
    }
  }