Package org.jnbt

Examples of org.jnbt.IntTag


      // This is our map of data. It is an unmodifiable map, for some
      // reason, so we have to make a copy.
      final Map<String, Tag> newData = new LinkedHashMap<String, Tag>(originalData);
      // .get() a couple of values, just to make sure we're dealing with a
      // valid level file, here. Good for debugging, too.
      final IntTag spawnX = (IntTag) newData.get("SpawnX");
      final IntTag spawnY = (IntTag) newData.get("SpawnY");
      final IntTag spawnZ = (IntTag) newData.get("SpawnZ");

      final LongTag Seed = (LongTag) newData.get("RandomSeed");
      var.randomSeed = Seed.getValue();
      Out.out("Seed: " + var.randomSeed); // lets output the seed, cause why not?

      final Coordinates ret =
          new Coordinates(spawnX.getValue(), spawnY.getValue(), spawnZ.getValue());
      return ret;
    } catch (final ClassCastException ex) {
      throw new IOException("Invalid level format.");
    } catch (final NullPointerException ex) {
      throw new IOException("Invalid level format.");
View Full Code Here


          ((CompoundTag) originalTopLevelTag.getValue().get("Data")).getValue();
      // This is our map of data. It is an unmodifiable map, for some reason, so we have to make a copy.
      final Map<String, Tag> newData = new LinkedHashMap<String, Tag>(originalData);

      // .get() a couple of values, just to make sure we're dealing with a valid level file, here. Good for debugging, too.
      @SuppressWarnings("unused")
      final IntTag spawnX = (IntTag) newData.get("SpawnX"); // we never use these... Its only here for potential debugging.
      @SuppressWarnings("unused")
      final IntTag spawnY = (IntTag) newData.get("SpawnY"); // but whatever... so I (Morlok8k) suppressed these warnings.
      @SuppressWarnings("unused")
      final IntTag spawnZ = (IntTag) newData.get("SpawnZ"); // I don't want to remove existing code, either by myself (Morlok8k) or Corrodias

      newData.put("SpawnX", new IntTag("SpawnX", xyz.getX()));    // pulling the data out of the Coordinates,
      newData.put("SpawnY", new IntTag("SpawnY", xyz.getY()));    // and putting it into our IntTag's
      newData.put("SpawnZ", new IntTag("SpawnZ", xyz.getZ()));

      // Again, we can't modify the data map in the old Tag, so we have to make a new one.
      final CompoundTag newDataTag = new CompoundTag("Data", newData);
      final Map<String, Tag> newTopLevelMap = new HashMap<String, Tag>(1);
      newTopLevelMap.put("Data", newDataTag);
View Full Code Here

TOP

Related Classes of org.jnbt.IntTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.