Advertisement
Rob5Underscores

Untitled

Aug 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. List<Tag<?>> regionTags = SimpleRegionFileReader.readFile(file);
  2. List<Tag<?>> finalRegion = regionTags;
  3. for(Tag tags : regionTags){
  4. if(tags instanceof CompoundTag) {
  5. CompoundTag compoundTag = (CompoundTag)tags;
  6. CompoundMap compoundMap = compoundTag.getValue();
  7. if(compoundMap.containsKey("Level")) {
  8. CompoundTag level = (CompoundTag)compoundMap.get("Level");
  9. CompoundMap levelData = level.getValue();
  10. levelData.remove("xPos");
  11. levelData.remove("zPos");
  12. compoundMap.remove("Level");
  13. compoundMap.put(new CompoundTag("Level", levelData));
  14.  
  15. finalRegion.add(new CompoundTag(compoundTag.getName(), compoundMap));
  16. } else {
  17. finalRegion.add(tags);
  18. }
  19. } else {
  20. finalRegion.add(tags);
  21. }
  22. }
  23. OutputStream outputStream = new FileOutputStream(file);
  24. NBTOutputStream nbtOutputStream = new NBTOutputStream(outputStream);
  25. for(Tag tags : finalRegion) {
  26. nbtOutputStream.writeTag(tags);
  27. }
  28. nbtOutputStream.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement