Package org.jnbt

Examples of org.jnbt.NBTInputStream.readTag()


   * @author Corrodias
   */
  protected static Coordinates getSpawn(final File level) throws IOException {
    try {
      final NBTInputStream input = new NBTInputStream(new FileInputStream(level));
      final CompoundTag originalTopLevelTag = (CompoundTag) input.readTag();
      input.close();

      final Map<String, Tag> originalData =
          ((CompoundTag) originalTopLevelTag.getValue().get("Data")).getValue();
      // This is our map of data. It is an unmodifiable map, for some
View Full Code Here


   */
  protected static void setSpawn(final File level, final Coordinates xyz) throws IOException {

    try {
      final NBTInputStream input = new NBTInputStream(new FileInputStream(level));
      final CompoundTag originalTopLevelTag = (CompoundTag) input.readTag();
      input.close();

      //@formatter:off

            //Note: The Following Information is Old (from 2010), compared to the Data inside a current "level.dat".
View Full Code Here

      String outPath = file.getParent() + "/players/" + name +".dat";
      out = new File(outPath);
      backupFile(out);
      try {
        NBTInputStream inStream = new NBTInputStream(new FileInputStream(out));
        CompoundTag root = (CompoundTag)inStream.readTag();
        inStream.close();
       
        HashMap<String, Tag> rootMap = new HashMap<String, Tag>(root.getValue());
        ArrayList<Tag> posTag = new ArrayList<Tag>(((ListTag)rootMap.get("Pos")).getValue());
        posTag.set(0, new DoubleTag("x", x));
View Full Code Here

    } else {
      out = file;
      backupFile(out);
      try {
        NBTInputStream inStream = new NBTInputStream(new FileInputStream(out));
        CompoundTag root = (CompoundTag)(((CompoundTag)inStream.readTag()).getValue().get("Data"));
        inStream.close();
       
        HashMap<String, Tag> rootMap = new HashMap<String, Tag>(root.getValue());
        HashMap<String, Tag> playerMap = new HashMap<String, Tag>(((CompoundTag)rootMap.get("Player")).getValue());
        ArrayList<Tag> posTag = new ArrayList<Tag>(((ListTag)playerMap.get("Pos")).getValue());
View Full Code Here

    file = f;
    players = new ArrayList<MapObjectPlayer>();
    back = new ArrayList<String>();
    try {
      NBTInputStream inStream = new NBTInputStream(new FileInputStream(f));
      CompoundTag root = (CompoundTag) ((CompoundTag)inStream.readTag()).getValue().get("Data");
      inStream.close();
      seed = (Long)(root.getValue().get("RandomSeed").getValue());
      if (root.getValue().get("generatorName") != null) {
        genType = Type.fromMixedCase((String)(root.getValue().get("generatorName").getValue()));
       
View Full Code Here

      } else {
        File[] listing = playersFolder.listFiles();
        for (int i = 0; i < (listing != null ? listing.length : 0); i++) {
          if (listing[i].isFile()) {
            NBTInputStream playerInputStream = new NBTInputStream(new FileInputStream(listing[i]));
            addPlayer(listing[i].getName().split("\\.")[0], (CompoundTag) ((CompoundTag)playerInputStream.readTag()));
            playerInputStream.close();
          }
        }
       
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.