compressed data tree cleanup, streamlining
This commit is contained in:
parent
f76d3c8b89
commit
b52053f5ea
50 changed files with 560 additions and 598 deletions
|
@ -80,7 +80,6 @@ import common.packet.SPacketSkin;
|
|||
import common.packet.SPacketTimeUpdate;
|
||||
import common.packet.SPacketWorld;
|
||||
import common.potion.PotionEffect;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.EncryptUtil;
|
||||
|
@ -186,7 +185,7 @@ public final class Server implements IThreadListener {
|
|||
File nfile = new File("server.cdt.tmp");
|
||||
File lfile = new File("server.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(data, nfile);
|
||||
TagObject.writeGZip(data, nfile);
|
||||
if(lfile.exists())
|
||||
lfile.delete();
|
||||
nfile.renameTo(lfile);
|
||||
|
@ -204,9 +203,9 @@ public final class Server implements IThreadListener {
|
|||
file = new File("server.cdt.tmp");
|
||||
if(file.exists()) {
|
||||
try {
|
||||
TagObject tag = TagLoader.readGZip(file);
|
||||
TagObject tag = TagObject.readGZip(file);
|
||||
TagObject cfg = tag.getObject("Config");
|
||||
for(String key : cfg.getKeySet()) {
|
||||
for(String key : cfg.keySet()) {
|
||||
Config.set(key, cfg.getString(key), false);
|
||||
}
|
||||
UniverseRegistry.fromTags(tag.getObject("Universe"));
|
||||
|
@ -297,7 +296,7 @@ public final class Server implements IThreadListener {
|
|||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -312,7 +311,7 @@ public final class Server implements IThreadListener {
|
|||
try {
|
||||
File tmp = new File(new File("players"), user + ".cdt.tmp");
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
TagLoader.writeGZip(tag, tmp);
|
||||
TagObject.writeGZip(tag, tmp);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
}
|
||||
|
@ -938,7 +937,7 @@ public final class Server implements IThreadListener {
|
|||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -963,7 +962,7 @@ public final class Server implements IThreadListener {
|
|||
conn.writeTags(tag);
|
||||
File tmp = new File(new File("players"), conn.getUser() + ".cdt.tmp");
|
||||
File dat = new File(new File("players"), conn.getUser() + ".cdt");
|
||||
TagLoader.writeGZip(tag, tmp);
|
||||
TagObject.writeGZip(tag, tmp);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package server.command;
|
||||
|
||||
import common.tags.TagException;
|
||||
import common.tags.TagInterpreter;
|
||||
import common.tags.TagObject;
|
||||
|
||||
public class TagParser extends DefaultingParser {
|
||||
|
@ -12,9 +10,9 @@ public class TagParser extends DefaultingParser {
|
|||
public TagObject parse(CommandEnvironment env, String input) {
|
||||
TagObject value;
|
||||
try {
|
||||
value = TagInterpreter.parseTag(input);
|
||||
value = TagObject.parse(input);
|
||||
}
|
||||
catch(TagException e) {
|
||||
catch(IllegalArgumentException e) {
|
||||
throw new RunException(e, "Ungültiger Tag '%s'", input);
|
||||
}
|
||||
return value;
|
||||
|
|
|
@ -102,7 +102,6 @@ import common.packet.SPacketMessage.Type;
|
|||
import common.potion.Potion;
|
||||
import common.potion.PotionEffect;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.tileentity.ILockableContainer;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -621,7 +620,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
if(tag.hasString("password"))
|
||||
this.password = tag.getString("password");
|
||||
this.selected = tag.getInt("selected");
|
||||
TagObjectList list = tag.getObjectList("characters");
|
||||
List<TagObject> list = tag.getList("characters");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
this.characters.add(list.get(z));
|
||||
}
|
||||
|
@ -636,11 +635,11 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
tag.setString("password", this.password);
|
||||
if(!this.characters.isEmpty()) {
|
||||
tag.setInt("selected", this.selected);
|
||||
TagObjectList list = new TagObjectList();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(TagObject etag : this.characters) {
|
||||
list.add(etag);
|
||||
}
|
||||
tag.setObjectList("characters", list);
|
||||
tag.setList("characters", list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.block.Material;
|
|||
import common.block.artificial.BlockDoor;
|
||||
import common.collect.Lists;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.village.Village;
|
||||
|
@ -26,7 +25,7 @@ public class VillageCollection
|
|||
public VillageCollection(TagObject tag) {
|
||||
if(tag != null) {
|
||||
this.tickCounter = tag.getInt("Tick");
|
||||
TagObjectList list = tag.getObjectList("Villages");
|
||||
List<TagObject> list = tag.getList("Villages");
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
|
@ -252,7 +251,7 @@ public class VillageCollection
|
|||
{
|
||||
TagObject tag = new TagObject();
|
||||
tag.setInt("Tick", this.tickCounter);
|
||||
TagObjectList list = new TagObjectList();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
|
||||
for (Village village : this.villageList)
|
||||
{
|
||||
|
@ -261,7 +260,7 @@ public class VillageCollection
|
|||
list.add(obj);
|
||||
}
|
||||
|
||||
tag.setObjectList("Villages", list);
|
||||
tag.setList("Villages", list);
|
||||
this.dirty = false;
|
||||
return tag;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,7 @@ import common.init.TileRegistry;
|
|||
import common.init.UniverseRegistry;
|
||||
import common.log.Log;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityBeacon;
|
||||
|
@ -1009,7 +1007,7 @@ public abstract class Converter {
|
|||
byte[] olddata = tag.getByteArray("Data");
|
||||
byte[] oldsky = tag.getByteArray("SkyLight");
|
||||
byte[] oldlight = tag.getByteArray("BlockLight");
|
||||
TagObjectList sections = new TagObjectList();
|
||||
List<TagObject> sections = Lists.newArrayList();
|
||||
for(int n = 0; n < 8; ++n) {
|
||||
boolean empty = true;
|
||||
for(int x = 0; x < 16 && empty; ++x) {
|
||||
|
@ -1050,7 +1048,7 @@ public abstract class Converter {
|
|||
sections.add(section);
|
||||
}
|
||||
}
|
||||
ntag.setObjectList("Sections", sections);
|
||||
ntag.setList("Sections", sections);
|
||||
byte[] biomes = new byte[256];
|
||||
Arrays.fill(biomes, (byte)(Biome.DEF_BIOME.id & 255));
|
||||
ntag.setByteArray("Biomes", biomes);
|
||||
|
@ -1063,7 +1061,7 @@ public abstract class Converter {
|
|||
ntag.setBool("LightPopulated", tag.getByte("LightPopulated") != 0);
|
||||
|
||||
NbtTag[] ents = tag.getTagList("Entities");
|
||||
TagObjectList entities = new TagObjectList();
|
||||
List<TagObject> entities = Lists.newArrayList();
|
||||
for(NbtTag ent : ents) {
|
||||
TagObject nent = new TagObject();
|
||||
String mapped = ENTITY_MAP.get(trimColon(ent.getString("id")));
|
||||
|
@ -1088,10 +1086,10 @@ public abstract class Converter {
|
|||
entities.add(nent);
|
||||
}
|
||||
}
|
||||
ntag.setObjectList("Entities", entities);
|
||||
ntag.setList("Entities", entities);
|
||||
|
||||
ents = tag.getTagList("TileEntities");
|
||||
entities = new TagObjectList();
|
||||
entities = Lists.newArrayList();
|
||||
for(NbtTag ent : ents) {
|
||||
TagObject nent = new TagObject();
|
||||
String mapped = TILE_MAP.get(trimColon(ent.getString("id")));
|
||||
|
@ -1104,10 +1102,10 @@ public abstract class Converter {
|
|||
entities.add(nent);
|
||||
}
|
||||
}
|
||||
ntag.setObjectList("TileEntities", entities);
|
||||
ntag.setList("TileEntities", entities);
|
||||
|
||||
NbtTag[] sects = tag.getTagList("Sections");
|
||||
entities = new TagObjectList();
|
||||
entities = Lists.newArrayList();
|
||||
for(NbtTag sect : sects) {
|
||||
TagObject nsect = new TagObject();
|
||||
nsect.setInt("Y", sect.getByte("Y"));
|
||||
|
@ -1151,7 +1149,7 @@ public abstract class Converter {
|
|||
nsect.setByteArray("Add", adddata.getData());
|
||||
entities.add(nsect);
|
||||
}
|
||||
ntag.setObjectList("Sections", entities);
|
||||
ntag.setList("Sections", entities);
|
||||
return ntag;
|
||||
}
|
||||
|
||||
|
@ -1318,7 +1316,7 @@ public abstract class Converter {
|
|||
Log.IO.info("Speichere neue data.cdt ...");
|
||||
File dataFile = new File(new File(new File("chunk"), "terra"), "data.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(dataTag, dataFile);
|
||||
TagObject.writeGZip(dataTag, dataFile);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht speichern");
|
||||
|
|
|
@ -25,10 +25,7 @@ import common.entity.Entity;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.EntityRegistry;
|
||||
import common.log.Log;
|
||||
import common.tags.SizeTracker;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.NextTickListEntry;
|
||||
|
@ -276,7 +273,7 @@ public class Region {
|
|||
public void writeTag(int x, int z, TagObject tag) throws IOException {
|
||||
ChunkBuffer buf = new ChunkBuffer();
|
||||
DataOutputStream out = new DataOutputStream(new DeflaterOutputStream(buf));
|
||||
TagLoader.write(tag, out);
|
||||
TagObject.write(tag, out);
|
||||
out.close();
|
||||
this.write(x, z, buf.getData(), buf.size());
|
||||
}
|
||||
|
@ -348,13 +345,13 @@ public class Region {
|
|||
byte[] data = getRegionFile(dir, x >> 3, z >> 3).read(x & 7, z & 7);
|
||||
if(data == null)
|
||||
return null;
|
||||
return TagLoader.read(new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(data)))), SizeTracker.INFINITE);
|
||||
return TagObject.read(new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(data)))));
|
||||
}
|
||||
|
||||
public static /* synchronized */ void writeChunk(File dir, int x, int z, TagObject tag) throws IOException {
|
||||
ChunkBuffer buf = new ChunkBuffer();
|
||||
DataOutputStream out = new DataOutputStream(new DeflaterOutputStream(buf));
|
||||
TagLoader.write(tag, out);
|
||||
TagObject.write(tag, out);
|
||||
out.close();
|
||||
getRegionFile(dir, x >> 3, z >> 3).write(x & 7, z & 7, buf.getData(), buf.size());
|
||||
// getRegionFile(dir, x >> 3, z >> 3).writeTag(x & 7, z & 7, tag);
|
||||
|
@ -366,7 +363,7 @@ public class Region {
|
|||
// return null;
|
||||
// }
|
||||
// tag = tag.getCompoundTag("Level");
|
||||
if(!tag.hasObjectList("Sections")) {
|
||||
if(!tag.hasList("Sections")) {
|
||||
Log.IO.warn("Chunk-Datei bei " + x + "," + z + " hat keine Block-Daten, überspringe");
|
||||
return null;
|
||||
}
|
||||
|
@ -375,7 +372,7 @@ public class Region {
|
|||
chunk.setTerrainPopulated(tag.getBool("TerrainPopulated"));
|
||||
chunk.setLightPopulated(tag.getBool("LightPopulated"));
|
||||
chunk.setInhabited(tag.getLong("InhabitedTime"));
|
||||
TagObjectList sects = tag.getObjectList("Sections");
|
||||
List<TagObject> sects = tag.getList("Sections");
|
||||
BlockArray[] sections = new BlockArray[sects.size()];
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
|
||||
|
@ -413,7 +410,7 @@ public class Region {
|
|||
chunk.setBiomes(tag.getByteArray("Biomes"));
|
||||
}
|
||||
|
||||
TagObjectList entities = tag.getObjectList("Entities");
|
||||
List<TagObject> entities = tag.getList("Entities");
|
||||
|
||||
if(entities != null) {
|
||||
for(int n = 0; n < entities.size(); ++n) {
|
||||
|
@ -439,7 +436,7 @@ public class Region {
|
|||
}
|
||||
}
|
||||
|
||||
TagObjectList tiles = tag.getObjectList("TileEntities");
|
||||
List<TagObject> tiles = tag.getList("TileEntities");
|
||||
|
||||
if(tiles != null) {
|
||||
for(int n = 0; n < tiles.size(); ++n) {
|
||||
|
@ -452,8 +449,8 @@ public class Region {
|
|||
}
|
||||
}
|
||||
|
||||
if(tag.hasObjectList("TileTicks")) {
|
||||
TagObjectList ticks = tag.getObjectList("TileTicks");
|
||||
if(tag.hasList("TileTicks")) {
|
||||
List<TagObject> ticks = tag.getList("TileTicks");
|
||||
|
||||
if(ticks != null) {
|
||||
int invalid = 0;
|
||||
|
@ -495,7 +492,7 @@ public class Region {
|
|||
tag.setBool("LightPopulated", chunk.isLightPopulated());
|
||||
tag.setLong("InhabitedTime", chunk.getInhabited());
|
||||
Set<BlockArray> sections = chunk.getStorage();
|
||||
TagObjectList sects = new TagObjectList();
|
||||
List<TagObject> sects = Lists.newArrayList();
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
|
||||
for(BlockArray storage : sections) {
|
||||
|
@ -544,10 +541,10 @@ public class Region {
|
|||
}
|
||||
}
|
||||
|
||||
tag.setObjectList("Sections", sects);
|
||||
tag.setList("Sections", sects);
|
||||
tag.setByteArray("Biomes", chunk.getBiomes());
|
||||
chunk.setHasEntities(false);
|
||||
TagObjectList entities = new TagObjectList();
|
||||
List<TagObject> entities = Lists.newArrayList();
|
||||
|
||||
for(int n = 0; n < chunk.getEntities().length; ++n) {
|
||||
for(Entity entity : chunk.getEntities()[n]) {
|
||||
|
@ -560,8 +557,8 @@ public class Region {
|
|||
}
|
||||
}
|
||||
|
||||
tag.setObjectList("Entities", entities);
|
||||
TagObjectList tiles = new TagObjectList();
|
||||
tag.setList("Entities", entities);
|
||||
List<TagObject> tiles = Lists.newArrayList();
|
||||
|
||||
for(TileEntity tileentity : chunk.getTiles().values()) {
|
||||
TagObject tile = new TagObject();
|
||||
|
@ -569,12 +566,12 @@ public class Region {
|
|||
tiles.add(tile);
|
||||
}
|
||||
|
||||
tag.setObjectList("TileEntities", tiles);
|
||||
tag.setList("TileEntities", tiles);
|
||||
List<NextTickListEntry> tics = world.getPendingBlockUpdates(chunk);
|
||||
|
||||
if(tics != null) {
|
||||
long time = world.getTime();
|
||||
TagObjectList ticks = new TagObjectList();
|
||||
List<TagObject> ticks = Lists.newArrayList();
|
||||
|
||||
for(NextTickListEntry tic : tics) {
|
||||
TagObject tick = new TagObject();
|
||||
|
@ -588,7 +585,7 @@ public class Region {
|
|||
ticks.add(tick);
|
||||
}
|
||||
|
||||
tag.setObjectList("TileTicks", ticks);
|
||||
tag.setList("TileTicks", ticks);
|
||||
}
|
||||
|
||||
return tag;
|
||||
|
|
|
@ -56,9 +56,7 @@ import common.packet.SPacketBlockChange;
|
|||
import common.packet.SPacketMultiBlockChange;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -301,7 +299,7 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File dat = new File(this.chunkDir, "data.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht laden");
|
||||
|
@ -443,13 +441,13 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File dat = new File(this.chunkDir, "loaders.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht laden");
|
||||
}
|
||||
if(tag != null && tag.hasObjectList("Loaders")) {
|
||||
TagObjectList list = tag.getObjectList("Loaders");
|
||||
if(tag != null && tag.hasList("Loaders")) {
|
||||
List<TagObject> list = tag.getList("Loaders");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
TagObject pos = list.get(z);
|
||||
this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
|
||||
|
@ -461,7 +459,7 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht laden");
|
||||
|
@ -914,12 +912,12 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "loaders.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
return tag != null && tag.hasObjectList("Loaders") && !tag.getObjectList("Loaders").isEmpty();
|
||||
return tag != null && tag.hasList("Loaders") && !tag.getList("Loaders").isEmpty();
|
||||
}
|
||||
|
||||
public static void loadWarps(Dimension dim, Map<String, Position> warps) {
|
||||
|
@ -927,14 +925,14 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Warpliste nicht laden");
|
||||
return;
|
||||
}
|
||||
if(tag != null && tag.hasObjectList("Warps")) {
|
||||
TagObjectList list = tag.getObjectList("Warps");
|
||||
if(tag != null && tag.hasList("Warps")) {
|
||||
List<TagObject> list = tag.getList("Warps");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
TagObject pos = list.get(z);
|
||||
warps.put(pos.getString("Name"), new Position(pos.getDouble("X"), pos.getDouble("Y"), pos.getDouble("Z"),
|
||||
|
@ -944,13 +942,13 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public static void saveWarps(Map<String, Position> warps) {
|
||||
Map<Integer, TagObjectList> map = Maps.newHashMap();
|
||||
Map<Integer, List<TagObject>> map = Maps.newHashMap();
|
||||
for(Entry<String, Position> pos : warps.entrySet()) {
|
||||
Dimension dim = UniverseRegistry.getDimension(pos.getValue().dim);
|
||||
if(dim != null) {
|
||||
TagObjectList list = map.get(pos.getValue().dim);
|
||||
List<TagObject> list = map.get(pos.getValue().dim);
|
||||
if(list == null)
|
||||
map.put(pos.getValue().dim, list = new TagObjectList());
|
||||
map.put(pos.getValue().dim, list = Lists.newArrayList());
|
||||
TagObject warp = new TagObject();
|
||||
warp.setString("Name", pos.getKey());
|
||||
warp.setDouble("X", pos.getValue().x);
|
||||
|
@ -962,16 +960,16 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
}
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
TagObjectList list = map.get(dim.getDimensionId());
|
||||
List<TagObject> list = map.get(dim.getDimensionId());
|
||||
File file = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.cdt");
|
||||
if(list == null) {
|
||||
file.delete();
|
||||
}
|
||||
else {
|
||||
TagObject tag = new TagObject();
|
||||
tag.setObjectList("Warps", list);
|
||||
tag.setList("Warps", list);
|
||||
try {
|
||||
TagLoader.writeGZip(tag, file);
|
||||
TagObject.writeGZip(tag, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Warpliste nicht speichern");
|
||||
|
@ -1013,7 +1011,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(this.loadersModified) {
|
||||
this.loadersModified = false;
|
||||
TagObject loaders = new TagObject();
|
||||
TagObjectList list = new TagObjectList();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(BlockPos pos : this.loaderList) {
|
||||
TagObject loader = new TagObject();
|
||||
loader.setInt("X", pos.getX());
|
||||
|
@ -1021,14 +1019,14 @@ public final class WorldServer extends AWorldServer {
|
|||
loader.setInt("Z", pos.getZ());
|
||||
list.add(loader);
|
||||
}
|
||||
loaders.setObjectList("Loaders", list);
|
||||
loaders.setList("Loaders", list);
|
||||
File file = new File(this.chunkDir, "loaders.cdt");
|
||||
if(list.isEmpty()) {
|
||||
file.delete();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
TagLoader.writeGZip(loaders, file);
|
||||
TagObject.writeGZip(loaders, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht speichern");
|
||||
|
@ -1049,7 +1047,7 @@ public final class WorldServer extends AWorldServer {
|
|||
// ...
|
||||
File file = new File(this.chunkDir, "data.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(data, file);
|
||||
TagObject.writeGZip(data, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht speichern");
|
||||
|
@ -1066,7 +1064,7 @@ public final class WorldServer extends AWorldServer {
|
|||
TagObject tag = this.villageStorage.toTags();
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(tag, dat);
|
||||
TagObject.writeGZip(tag, dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht speichern");
|
||||
|
@ -2459,7 +2457,7 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File file = this.getSaveFile(id);
|
||||
if(file.exists()) {
|
||||
data = new WorldSavedData(id, TagLoader.readGZip(file));
|
||||
data = new WorldSavedData(id, TagObject.readGZip(file));
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -2483,7 +2481,7 @@ public final class WorldServer extends AWorldServer {
|
|||
private void saveData(WorldSavedData data) {
|
||||
try {
|
||||
File file = this.getSaveFile(data.id);
|
||||
TagLoader.writeGZip(data.tag, file);
|
||||
TagObject.writeGZip(data.tag, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||
|
||||
import common.collect.Maps;
|
||||
import common.rng.Random;
|
||||
import common.tags.Tag;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ChunkPos;
|
||||
|
@ -205,13 +204,11 @@ public abstract class MapGenStructure extends MapGenBase
|
|||
{
|
||||
TagObject tag = this.structureData.tag;
|
||||
|
||||
for (String s : tag.getKeySet())
|
||||
for (String s : tag.keySet())
|
||||
{
|
||||
Tag sub = tag.get(s);
|
||||
|
||||
if (sub instanceof TagObject)
|
||||
if (tag.hasObject(s))
|
||||
{
|
||||
TagObject start = (TagObject)sub;
|
||||
TagObject start = tag.getObject(s);
|
||||
|
||||
if (start.hasInt("ChunkX") && start.hasInt("ChunkZ"))
|
||||
{
|
||||
|
|
|
@ -3,9 +3,10 @@ package server.worldgen.structure;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import java.util.List;
|
||||
import common.util.ChunkPos;
|
||||
import server.world.WorldServer;
|
||||
|
||||
|
@ -74,14 +75,14 @@ public abstract class StructureStart
|
|||
tag.setInt("ChunkX", chunkX);
|
||||
tag.setInt("ChunkZ", chunkZ);
|
||||
tag.setIntArray("BB", this.boundingBox.toIntArray());
|
||||
TagObjectList list = new TagObjectList();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
|
||||
for (StructureComponent comp : this.components)
|
||||
{
|
||||
list.add(comp.writeBase());
|
||||
}
|
||||
|
||||
tag.setObjectList("Children", list);
|
||||
tag.setList("Children", list);
|
||||
this.writeTags(tag);
|
||||
return tag;
|
||||
}
|
||||
|
@ -100,7 +101,7 @@ public abstract class StructureStart
|
|||
this.boundingBox = new StructureBoundingBox(tag.getIntArray("BB"));
|
||||
}
|
||||
|
||||
TagObjectList list = tag.getObjectList("Children");
|
||||
List<TagObject> list = tag.getList("Children");
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue