change nbt format: change class names
This commit is contained in:
parent
4433d3b3df
commit
47a69ce8bc
143 changed files with 1207 additions and 1207 deletions
|
@ -43,10 +43,10 @@ import common.init.Registry;
|
|||
import common.init.UniverseRegistry;
|
||||
import common.init.Config.ValueType;
|
||||
import common.log.Log;
|
||||
import common.nbt.NBTLoader;
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.nbt.NBTTagDoubleList;
|
||||
import common.nbt.NBTTagFloatList;
|
||||
import common.nbt.TagLoader;
|
||||
import common.nbt.TagObject;
|
||||
import common.nbt.TagDoubleList;
|
||||
import common.nbt.TagFloatList;
|
||||
import common.net.bootstrap.ServerBootstrap;
|
||||
import common.net.channel.Channel;
|
||||
import common.net.channel.ChannelException;
|
||||
|
@ -173,11 +173,11 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public static void saveServerConfig(long time) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
TagObject data = new TagObject();
|
||||
data.setLong("Time", time);
|
||||
data.setLong("LastAccess", System.currentTimeMillis());
|
||||
data.setString("Version", Util.VERSION);
|
||||
NBTTagCompound cfg = new NBTTagCompound();
|
||||
TagObject cfg = new TagObject();
|
||||
for(String cvar : Config.VARS.keySet()) {
|
||||
Config.Value value = Config.VARS.get(cvar);
|
||||
if(!value.noDef || !value.def.equals(value.getValue()))
|
||||
|
@ -188,7 +188,7 @@ public final class Server implements IThreadListener {
|
|||
File nfile = new File("server.nbt.tmp");
|
||||
File lfile = new File("server.nbt");
|
||||
try {
|
||||
NBTLoader.writeGZip(data, nfile);
|
||||
TagLoader.writeGZip(data, nfile);
|
||||
if(lfile.exists())
|
||||
lfile.delete();
|
||||
nfile.renameTo(lfile);
|
||||
|
@ -206,8 +206,8 @@ public final class Server implements IThreadListener {
|
|||
file = new File("server.nbt.tmp");
|
||||
if(file.exists()) {
|
||||
try {
|
||||
NBTTagCompound tag = NBTLoader.readGZip(file);
|
||||
NBTTagCompound cfg = tag.getTag("Config");
|
||||
TagObject tag = TagLoader.readGZip(file);
|
||||
TagObject cfg = tag.getTag("Config");
|
||||
for(String key : cfg.getKeySet()) {
|
||||
Config.set(key, cfg.getString(key), false);
|
||||
}
|
||||
|
@ -291,15 +291,15 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound loadPlayerData(String user) {
|
||||
public TagObject loadPlayerData(String user) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
return null;
|
||||
NBTTagCompound tag = null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".nbt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = NBTLoader.readGZip(dat);
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -308,13 +308,13 @@ public final class Server implements IThreadListener {
|
|||
return tag;
|
||||
}
|
||||
|
||||
public void writePlayerData(String user, NBTTagCompound tag) {
|
||||
public void writePlayerData(String user, TagObject tag) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
return;
|
||||
try {
|
||||
File tmp = new File(new File("players"), user + ".nbt.tmp");
|
||||
File dat = new File(new File("players"), user + ".nbt");
|
||||
NBTLoader.writeGZip(tag, tmp);
|
||||
TagLoader.writeGZip(tag, tmp);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
}
|
||||
|
@ -326,11 +326,11 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public Position getOfflinePosition(String user) {
|
||||
NBTTagCompound tag = this.loadPlayerData(user);
|
||||
TagObject tag = this.loadPlayerData(user);
|
||||
if(tag == null)
|
||||
return null;
|
||||
NBTTagDoubleList pos = tag.getDoubleList("Pos");
|
||||
NBTTagFloatList rot = tag.getFloatList("Rotation");
|
||||
TagDoubleList pos = tag.getDoubleList("Pos");
|
||||
TagFloatList rot = tag.getFloatList("Rotation");
|
||||
double posX = pos.get(0);
|
||||
double posY = pos.get(1);
|
||||
double posZ = pos.get(2);
|
||||
|
@ -837,7 +837,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public String addPlayer(NetConnection connection, String loginUser, String loginPass) {
|
||||
NBTTagCompound tag = this.readPlayer(loginUser);
|
||||
TagObject tag = this.readPlayer(loginUser);
|
||||
Player conn = new Player(this, connection, loginUser);
|
||||
if(tag != null)
|
||||
conn.readFromNBT(tag);
|
||||
|
@ -934,15 +934,15 @@ public final class Server implements IThreadListener {
|
|||
newWorld.loadChunk((int)player.posX >> 4, (int)player.posZ >> 4);
|
||||
}
|
||||
|
||||
private NBTTagCompound readPlayer(String user) {
|
||||
private TagObject readPlayer(String user) {
|
||||
if(this.debug)
|
||||
return null;
|
||||
NBTTagCompound tag = null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".nbt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = NBTLoader.readGZip(dat);
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -955,10 +955,10 @@ public final class Server implements IThreadListener {
|
|||
if(this.debug)
|
||||
return;
|
||||
try {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
TagObject tag = new TagObject();
|
||||
EntityNPC entity = conn.getPresentEntity();
|
||||
if(entity != null) {
|
||||
NBTTagCompound etag = new NBTTagCompound();
|
||||
TagObject etag = new TagObject();
|
||||
entity.writeToNBT(etag);
|
||||
etag.setInt("Dimension", entity.worldObj.dimension.getDimensionId());
|
||||
etag.setString("id", EntityRegistry.getEntityString(entity));
|
||||
|
@ -969,7 +969,7 @@ public final class Server implements IThreadListener {
|
|||
conn.writeToNBT(tag);
|
||||
File tmp = new File(new File("players"), conn.getUser() + ".nbt.tmp");
|
||||
File dat = new File(new File("players"), conn.getUser() + ".nbt");
|
||||
NBTLoader.writeGZip(tag, tmp);
|
||||
TagLoader.writeGZip(tag, tmp);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
}
|
||||
|
@ -1045,10 +1045,10 @@ public final class Server implements IThreadListener {
|
|||
old.worldObj.dimension.getFormattedName(false));
|
||||
}
|
||||
|
||||
public NBTTagCompound swapPlayer(Player conn, NBTTagCompound tag, Class<? extends EntityNPC> clazz) {
|
||||
public TagObject swapPlayer(Player conn, TagObject tag, Class<? extends EntityNPC> clazz) {
|
||||
EntityNPC old = conn.getEntity();
|
||||
old.unmount();
|
||||
NBTTagCompound oldTag = new NBTTagCompound();
|
||||
TagObject oldTag = new TagObject();
|
||||
old.writeToNBT(oldTag);
|
||||
oldTag.setInt("Dimension", old.worldObj.dimension.getDimensionId());
|
||||
oldTag.setString("id", EntityRegistry.getEntityString(old));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue