cleanup, rename, nbt->cdt "compressed data tree"
This commit is contained in:
parent
753b4b8b5d
commit
6c55d59f1f
181 changed files with 1254 additions and 1664 deletions
|
@ -184,9 +184,9 @@ public final class Server implements IThreadListener {
|
|||
cfg.setString(cvar, value.getValue());
|
||||
}
|
||||
data.setObject("Config", cfg);
|
||||
data.setObject("Universe", UniverseRegistry.saveNbt());
|
||||
File nfile = new File("server.nbt.tmp");
|
||||
File lfile = new File("server.nbt");
|
||||
data.setObject("Universe", UniverseRegistry.toTags());
|
||||
File nfile = new File("server.cdt.tmp");
|
||||
File lfile = new File("server.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(data, nfile);
|
||||
if(lfile.exists())
|
||||
|
@ -201,9 +201,9 @@ public final class Server implements IThreadListener {
|
|||
public static long loadServerConfig() {
|
||||
Config.clear();
|
||||
UniverseRegistry.clear();
|
||||
File file = new File("server.nbt");
|
||||
File file = new File("server.cdt");
|
||||
if(!file.exists())
|
||||
file = new File("server.nbt.tmp");
|
||||
file = new File("server.cdt.tmp");
|
||||
if(file.exists()) {
|
||||
try {
|
||||
TagObject tag = TagLoader.readGZip(file);
|
||||
|
@ -211,7 +211,7 @@ public final class Server implements IThreadListener {
|
|||
for(String key : cfg.getKeySet()) {
|
||||
Config.set(key, cfg.getString(key), false);
|
||||
}
|
||||
UniverseRegistry.loadNbt(tag.getObject("Universe"));
|
||||
UniverseRegistry.fromTags(tag.getObject("Universe"));
|
||||
long lastPlayed = tag.getLong("LastAccess");
|
||||
String version = tag.hasString("Version") ? tag.getString("Version") : null;
|
||||
version = version != null && version.isEmpty() ? "<unbekannt>" : version;
|
||||
|
@ -274,7 +274,7 @@ public final class Server implements IThreadListener {
|
|||
list = new String[0];
|
||||
}
|
||||
for(int i = 0; i < list.length; ++i) {
|
||||
if(list[i].endsWith(".nbt")) {
|
||||
if(list[i].endsWith(".cdt")) {
|
||||
list[i] = list[i].substring(0, list[i].length() - 4);
|
||||
// Player player = this.getPlayer(list[i]);
|
||||
// if(player != null)
|
||||
|
@ -296,7 +296,7 @@ public final class Server implements IThreadListener {
|
|||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".nbt");
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = TagLoader.readGZip(dat);
|
||||
|
@ -312,8 +312,8 @@ public final class Server implements IThreadListener {
|
|||
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");
|
||||
File tmp = new File(new File("players"), user + ".cdt.tmp");
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
TagLoader.writeGZip(tag, tmp);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
|
@ -840,7 +840,7 @@ public final class Server implements IThreadListener {
|
|||
TagObject tag = this.readPlayer(loginUser);
|
||||
Player conn = new Player(this, connection, loginUser);
|
||||
if(tag != null)
|
||||
conn.readFromNBT(tag);
|
||||
conn.readTags(tag);
|
||||
if(Config.playerLimit > 0 && this.players.size() >= Config.playerLimit && !conn.isAdmin())
|
||||
return String.format("Der Server ist voll (%d/%d)!", this.players.size(), Config.playerLimit);
|
||||
if(conn.getPassword() == null) {
|
||||
|
@ -876,7 +876,7 @@ public final class Server implements IThreadListener {
|
|||
world = world == null ? this.space : world;
|
||||
EntityNPC player = conn.createPlayer(world, tag == null ? EntityRegistry.getEntityString(EntityHuman.class) : tag.getString("id"));
|
||||
if(tag != null)
|
||||
player.readFromNBT(tag);
|
||||
player.readTags(tag);
|
||||
else
|
||||
player.onInitialSpawn(null);
|
||||
// player.setWorld(world);
|
||||
|
@ -939,7 +939,7 @@ public final class Server implements IThreadListener {
|
|||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".nbt");
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
||||
if(dat.exists() && dat.isFile()) {
|
||||
tag = TagLoader.readGZip(dat);
|
||||
|
@ -959,16 +959,14 @@ public final class Server implements IThreadListener {
|
|||
EntityNPC entity = conn.getPresentEntity();
|
||||
if(entity != null) {
|
||||
TagObject etag = new TagObject();
|
||||
entity.writeToNBT(etag);
|
||||
entity.writeTags(etag);
|
||||
etag.setInt("Dimension", entity.worldObj.dimension.getDimensionId());
|
||||
etag.setString("id", EntityRegistry.getEntityString(entity));
|
||||
conn.writeCharacter(etag);
|
||||
}
|
||||
// else
|
||||
// etag = new NBTTagCompound();
|
||||
conn.writeToNBT(tag);
|
||||
File tmp = new File(new File("players"), conn.getUser() + ".nbt.tmp");
|
||||
File dat = new File(new File("players"), conn.getUser() + ".nbt");
|
||||
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);
|
||||
if(dat.exists()) {
|
||||
dat.delete();
|
||||
|
@ -1049,7 +1047,7 @@ public final class Server implements IThreadListener {
|
|||
EntityNPC old = conn.getEntity();
|
||||
old.unmount();
|
||||
TagObject oldTag = new TagObject();
|
||||
old.writeToNBT(oldTag);
|
||||
old.writeTags(oldTag);
|
||||
oldTag.setInt("Dimension", old.worldObj.dimension.getDimensionId());
|
||||
oldTag.setString("id", EntityRegistry.getEntityString(old));
|
||||
|
||||
|
@ -1065,7 +1063,7 @@ public final class Server implements IThreadListener {
|
|||
EntityNPC nplayer = conn.createPlayer(world, tag == null ? EntityRegistry.getEntityString(clazz) : tag.getString("id"));
|
||||
// conn.sendPacket(new SPacketRespawn(world.dimension, EntityRegistry.getEntityID(nplayer)));
|
||||
if(tag != null)
|
||||
nplayer.readFromNBT(tag);
|
||||
nplayer.readTags(tag);
|
||||
else
|
||||
nplayer.onInitialSpawn(null);
|
||||
// nplayer.clonePlayer(old);
|
||||
|
|
|
@ -6,7 +6,7 @@ import common.world.State;
|
|||
|
||||
public class ClipboardBlock {
|
||||
private State state;
|
||||
private TagObject nbt;
|
||||
private TagObject data;
|
||||
|
||||
public ClipboardBlock(State state) {
|
||||
this.state = state;
|
||||
|
@ -16,7 +16,7 @@ public class ClipboardBlock {
|
|||
this(data);
|
||||
TagObject tag = new TagObject();
|
||||
tile.writeTags(tag);
|
||||
this.nbt = tag;
|
||||
this.data = tag;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
|
@ -27,7 +27,7 @@ public class ClipboardBlock {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
public TagObject getNbtData() {
|
||||
return this.nbt;
|
||||
public TagObject getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,169 +243,4 @@ public class ArgumentSplitter {
|
|||
Object value = arg.getValues().get(par);
|
||||
return value == null ? null : (T)value;
|
||||
}
|
||||
|
||||
// public <T> T getUnchecked(String name) {
|
||||
// return this.getDefault(name, null);
|
||||
// }
|
||||
//
|
||||
// public boolean getBool(String name, boolean def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public boolean getBool(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public <T extends Enum<?>> T getEnum(String name, T def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public <T extends Enum<?>> T getEnum(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public int getInt(String name, int def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public int getInt(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public long getLong(String name, long def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public long getLong(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public double getDouble(String name, double def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public double getDouble(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public String getString(String name, String def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public String getString(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public String[] getStrings(String name, String[] def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public String[] getStrings(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public Entity getEntity(String name, Entity def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public Entity getEntity(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public EntityLiving getLiving(String name, EntityLiving def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public EntityLiving getLiving(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public EntityNPC getNpc(String name, EntityNPC def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public EntityNPC getNpc(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public Block getBlock(String name, Block def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public Block getBlock(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public State getState(String name, State def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public State getState(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public Item getItem(String name, Item def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public Item getItem(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public ItemStack getStack(String name, ItemStack def) {
|
||||
// return this.getDefault(name, def);
|
||||
// }
|
||||
//
|
||||
// public ItemStack getStack(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public BlockPos getColumnPos(String name, BlockPos def) {
|
||||
// return this.hasArg(name) ? this.getColumnPos(name) : def;
|
||||
// }
|
||||
//
|
||||
// public BlockPos getColumnPos(String name) {
|
||||
// return new BlockPos(this.getUnchecked(name, "x"), 0, this.getUnchecked(name, "z"));
|
||||
// }
|
||||
//
|
||||
// public BlockPos getBlockPos(String name, BlockPos def) {
|
||||
// return this.hasArg(name) ? this.getBlockPos(name) : def;
|
||||
// }
|
||||
//
|
||||
// public BlockPos getBlockPos(String name) {
|
||||
// return new BlockPos(this.getUnchecked(name, "x"), this.getUnchecked(name, "y"), this.getUnchecked(name, "z"));
|
||||
// }
|
||||
//
|
||||
// public WorldPos getWorldPos(String name, WorldPos def) {
|
||||
// return this.hasArg(name) ? this.getWorldPos(name) : def;
|
||||
// }
|
||||
//
|
||||
// public WorldPos getWorldPos(String name) {
|
||||
// return new WorldPos(this.getUnchecked(name, "x"), this.getUnchecked(name, "y"), this.getUnchecked(name, "z"),
|
||||
// this.getUnchecked(name, "dim"));
|
||||
// }
|
||||
//
|
||||
// public Vec3 getVector2D(String name, Vec3 def) {
|
||||
// return this.hasArg(name) ? this.getVector2D(name) : def;
|
||||
// }
|
||||
//
|
||||
// public Vec3 getVector2D(String name) {
|
||||
// return new Vec3(this.getUnchecked(name, "x"), 0.0, this.getUnchecked(name, "z"));
|
||||
// }
|
||||
//
|
||||
// public Vec3 getVector(String name, Vec3 def) {
|
||||
// return this.hasArg(name) ? this.getVector(name) : def;
|
||||
// }
|
||||
//
|
||||
// public Vec3 getVector(String name) {
|
||||
// return new Vec3(this.getUnchecked(name, "x"), this.getUnchecked(name, "y"), this.getUnchecked(name, "z"));
|
||||
// }
|
||||
//
|
||||
// public WorldServer getWorld(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
//
|
||||
// public NBTTagCompound getTag(String name) {
|
||||
// return this.getUnchecked(name);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class TagParser extends DefaultingParser {
|
|||
value = TagInterpreter.parseTag(input);
|
||||
}
|
||||
catch(TagException e) {
|
||||
throw new RunException(e, "Ungültiger NBT-Tag '%s'", input);
|
||||
throw new RunException(e, "Ungültiger Tag '%s'", input);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -67,18 +67,18 @@ public class CommandSpawn extends Command {
|
|||
entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f);
|
||||
if(tag != null) {
|
||||
TagObject ent = new TagObject();
|
||||
entity.writeToNBT(ent);
|
||||
entity.writeTags(ent);
|
||||
ent.merge(tag);
|
||||
entity.readFromNBT(ent);
|
||||
entity.readTags(ent);
|
||||
}
|
||||
if(!noinit && (entity instanceof EntityLiving))
|
||||
((EntityLiving)entity).onInitialSpawn(null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
if(postTag != null) {
|
||||
TagObject ent = new TagObject();
|
||||
entity.writeToNBT(ent);
|
||||
entity.writeTags(ent);
|
||||
ent.merge(postTag);
|
||||
entity.readFromNBT(ent);
|
||||
entity.readTags(ent);
|
||||
}
|
||||
spawned.add("#" + entity.getId());
|
||||
}
|
||||
|
|
|
@ -608,16 +608,16 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
}
|
||||
|
||||
public void sendThrowMessage(ItemStack stack) {
|
||||
if(stack.stackSize == 1)
|
||||
if(stack.size == 1)
|
||||
this.addFeed(TextColor.DRED + "* %s weg geworfen",
|
||||
stack.getColoredName(TextColor.DRED));
|
||||
else
|
||||
this.addFeed(TextColor.DRED + "* %d %s weg geworfen", stack.stackSize,
|
||||
this.addFeed(TextColor.DRED + "* %d %s weg geworfen", stack.size,
|
||||
stack.getColoredName(TextColor.DRED));
|
||||
}
|
||||
|
||||
|
||||
public void readFromNBT(TagObject tag) {
|
||||
public void readTags(TagObject tag) {
|
||||
this.admin = tag.getBool("admin");
|
||||
if(tag.hasString("password"))
|
||||
this.password = tag.getString("password");
|
||||
|
@ -628,21 +628,9 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
}
|
||||
this.selected = Math.min(this.selected, this.characters.size() - 1);
|
||||
this.charEditor = this.selected < 0;
|
||||
// this.stats.clear();
|
||||
// if(tag.hasTag("Stats")) {
|
||||
// NBTTagCompound stats = tag.getCompoundTag("Stats");
|
||||
// for(String key : stats.getKeySet()) {
|
||||
// StatBase stat = StatRegistry.getStat(key);
|
||||
// if(stat == null) {
|
||||
// Log.warn("Ungültige Statistik: Statistik '" + key + "' ist unbekannt");
|
||||
// continue;
|
||||
// }
|
||||
// this.stats.put(stat, stats.getInteger(key));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public void writeToNBT(TagObject tag) {
|
||||
public void writeTags(TagObject tag) {
|
||||
if(this.admin)
|
||||
tag.setBool("admin", this.admin);
|
||||
if(this.password != null)
|
||||
|
@ -655,11 +643,6 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
}
|
||||
tag.setObjectList("characters", list);
|
||||
}
|
||||
// NBTTagCompound stats = new NBTTagCompound();
|
||||
// for(Entry<StatBase, Integer> entry : this.stats.entrySet()) {
|
||||
// stats.setInteger(entry.getKey().statId, entry.getValue());
|
||||
// }
|
||||
// tag.setTag("Stats", stats);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1272,7 +1255,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
itemstack1.onBlockDestroyed(this.entity.worldObj, iblockstate.getBlock(), pos, this.entity);
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
if (itemstack1.size == 0)
|
||||
{
|
||||
this.entity.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
@ -1293,11 +1276,11 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
// if(this.onPlayerInteract(false, null)) {
|
||||
// return true;
|
||||
// }
|
||||
int i = stack.stackSize;
|
||||
int i = stack.size;
|
||||
int j = stack.getMetadata();
|
||||
ItemStack itemstack = stack.useItemRightClick(this.entity.worldObj, this.entity);
|
||||
|
||||
if (itemstack != stack || itemstack != null && (itemstack.stackSize != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getMetadata() != j))
|
||||
if (itemstack != stack || itemstack != null && (itemstack.size != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getMetadata() != j))
|
||||
{
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = itemstack;
|
||||
|
||||
|
@ -1311,7 +1294,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
// }
|
||||
// }
|
||||
|
||||
if (itemstack.stackSize == 0)
|
||||
if (itemstack.size == 0)
|
||||
{
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
}
|
||||
|
@ -2463,7 +2446,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
itemstack = this.entity.inventory.getCurrentItem();
|
||||
|
||||
if (itemstack != null && itemstack.stackSize == 0)
|
||||
if (itemstack != null && itemstack.size == 0)
|
||||
{
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
itemstack = null;
|
||||
|
@ -2814,8 +2797,8 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
case REPAIR:
|
||||
if(this.isAdmin() && this.entity.getCurrentEquippedItem() != null) {
|
||||
ItemStack itemstack = this.entity.getCurrentEquippedItem();
|
||||
int diff = itemstack.getMaxStackSize() - itemstack.stackSize;
|
||||
itemstack.stackSize = itemstack.getMaxStackSize();
|
||||
int diff = itemstack.getMaxStackSize() - itemstack.size;
|
||||
itemstack.size = itemstack.getMaxStackSize();
|
||||
itemstack.setRepairCost(0);
|
||||
if(itemstack.getItem().getMaxDamage() > 0)
|
||||
itemstack.setItemDamage(0);
|
||||
|
@ -2966,9 +2949,9 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
}
|
||||
}
|
||||
|
||||
public void processCheat(CPacketCheat packetIn)
|
||||
public void processCheat(CPacketCheat packet)
|
||||
{
|
||||
NetHandler.checkThread(packetIn, this, this.server);
|
||||
NetHandler.checkThread(packet, this, this.server);
|
||||
if(this.charEditor)
|
||||
return;
|
||||
|
||||
|
@ -2979,7 +2962,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
// {
|
||||
// boolean drop = packetIn.getSlotId() < 0;
|
||||
// boolean changed = false;
|
||||
ItemStack itemstack = packetIn.getStack();
|
||||
ItemStack itemstack = packet.getStack();
|
||||
// if(itemstack != null && itemstack.getItem() == Items.barrier && !this.playerEntity.canUse(Permissions.BARRIER)) {
|
||||
// changed = true;
|
||||
// itemstack = null;
|
||||
|
@ -2995,21 +2978,21 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
// itemstack.setTagCompound(null);
|
||||
// }
|
||||
// else {
|
||||
TagObject nbttagcompound = itemstack.getTagCompound().getObject("BlockEntityTag");
|
||||
TagObject tag = itemstack.getTagCompound().getObject("BlockEntityTag");
|
||||
|
||||
if (nbttagcompound.hasInt("x") && nbttagcompound.hasInt("y") && nbttagcompound.hasInt("z"))
|
||||
if (tag.hasInt("x") && tag.hasInt("y") && tag.hasInt("z"))
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
|
||||
TileEntity tileentity = this.entity.worldObj.getTileEntity(blockpos);
|
||||
BlockPos pos = new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z"));
|
||||
TileEntity te = this.entity.worldObj.getTileEntity(pos);
|
||||
|
||||
if (tileentity != null)
|
||||
if (te != null)
|
||||
{
|
||||
TagObject nbttagcompound1 = new TagObject();
|
||||
tileentity.writeTags(nbttagcompound1);
|
||||
nbttagcompound1.remove("x");
|
||||
nbttagcompound1.remove("y");
|
||||
nbttagcompound1.remove("z");
|
||||
itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
|
||||
TagObject tile = new TagObject();
|
||||
te.writeTags(tile);
|
||||
tile.remove("x");
|
||||
tile.remove("y");
|
||||
tile.remove("z");
|
||||
itemstack.setTagInfo("BlockEntityTag", tile);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
@ -3017,30 +3000,30 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
// boolean validSlot = packetIn.getSlotId() >= 1 && packetIn.getSlotId() < 36 + InventoryPlayer.getHotbarSize();
|
||||
boolean validItem = itemstack.getItem() != null;
|
||||
boolean validData = itemstack.getMetadata() >= 0 && itemstack.stackSize <= itemstack.getMaxStackSize() && itemstack.stackSize > 0; // TODO: max
|
||||
boolean validData = itemstack.getMetadata() >= 0 && itemstack.size <= itemstack.getMaxStackSize() && itemstack.size > 0; // TODO: max
|
||||
|
||||
if (validItem && validData)
|
||||
{
|
||||
int amount = itemstack.stackSize;
|
||||
if(packetIn.getSlot() == -1) {
|
||||
int amount = itemstack.size;
|
||||
if(packet.getSlot() == -1) {
|
||||
this.entity.inventory.addItemStackToInventory(itemstack);
|
||||
amount -= itemstack.stackSize;
|
||||
amount -= itemstack.size;
|
||||
}
|
||||
else if(packetIn.getSlot() >= 0 && packetIn.getSlot() < this.entity.inventory.getSizeInventory() && (packetIn.getSlot() < this.entity.inventory.mainInventory.length || (itemstack.getItem() instanceof ItemArmor && ((ItemArmor)itemstack.getItem()).armorType == packetIn.getSlot() - this.entity.inventory.mainInventory.length))) {
|
||||
ItemStack old = this.entity.inventory.getStackInSlot(packetIn.getSlot());
|
||||
else if(packet.getSlot() >= 0 && packet.getSlot() < this.entity.inventory.getSizeInventory() && (packet.getSlot() < this.entity.inventory.mainInventory.length || (itemstack.getItem() instanceof ItemArmor && ((ItemArmor)itemstack.getItem()).armorType == packet.getSlot() - this.entity.inventory.mainInventory.length))) {
|
||||
ItemStack old = this.entity.inventory.getStackInSlot(packet.getSlot());
|
||||
if(old != null) {
|
||||
if(ItemStack.areItemsEqual(itemstack, old) && ItemStack.areItemStackTagsEqual(itemstack, old)) {
|
||||
itemstack.stackSize = Math.min(itemstack.getMaxStackSize(), old.stackSize + itemstack.stackSize);
|
||||
amount = itemstack.stackSize - old.stackSize;
|
||||
itemstack.size = Math.min(itemstack.getMaxStackSize(), old.size + itemstack.size);
|
||||
amount = itemstack.size - old.size;
|
||||
}
|
||||
else if(old.stackSize == 1)
|
||||
else if(old.size == 1)
|
||||
this.addFeed(TextColor.DRED + "* %s zerstört",
|
||||
old.getColoredName(TextColor.DRED));
|
||||
else
|
||||
this.addFeed(TextColor.DRED + "* %d %s zerstört", old.stackSize,
|
||||
this.addFeed(TextColor.DRED + "* %d %s zerstört", old.size,
|
||||
old.getColoredName(TextColor.DRED));
|
||||
}
|
||||
this.entity.inventory.setInventorySlotContents(packetIn.getSlot(), itemstack);
|
||||
this.entity.inventory.setInventorySlotContents(packet.getSlot(), itemstack);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
|
|
|
@ -23,16 +23,16 @@ public class VillageCollection
|
|||
private int tickCounter;
|
||||
private boolean dirty;
|
||||
|
||||
public VillageCollection(TagObject nbt) {
|
||||
if(nbt != null) {
|
||||
this.tickCounter = nbt.getInt("Tick");
|
||||
TagObjectList nbttaglist = nbt.getObjectList("Villages");
|
||||
public VillageCollection(TagObject tag) {
|
||||
if(tag != null) {
|
||||
this.tickCounter = tag.getInt("Tick");
|
||||
TagObjectList list = tag.getObjectList("Villages");
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
TagObject nbttagcompound = nbttaglist.get(i);
|
||||
TagObject obj = list.get(i);
|
||||
Village village = new Village();
|
||||
village.readVillageDataFromNBT(nbttagcompound);
|
||||
village.readTags(obj);
|
||||
this.villageList.add(village);
|
||||
}
|
||||
}
|
||||
|
@ -248,22 +248,22 @@ public class VillageCollection
|
|||
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;
|
||||
}
|
||||
|
||||
public TagObject writeToNBT()
|
||||
public TagObject toTags()
|
||||
{
|
||||
TagObject nbt = new TagObject();
|
||||
nbt.setInt("Tick", this.tickCounter);
|
||||
TagObjectList nbttaglist = new TagObjectList();
|
||||
TagObject tag = new TagObject();
|
||||
tag.setInt("Tick", this.tickCounter);
|
||||
TagObjectList list = new TagObjectList();
|
||||
|
||||
for (Village village : this.villageList)
|
||||
{
|
||||
TagObject nbttagcompound = new TagObject();
|
||||
village.writeVillageDataToNBT(nbttagcompound);
|
||||
nbttaglist.add(nbttagcompound);
|
||||
TagObject obj = new TagObject();
|
||||
village.writeTags(obj);
|
||||
list.add(obj);
|
||||
}
|
||||
|
||||
nbt.setObjectList("Villages", nbttaglist);
|
||||
tag.setObjectList("Villages", list);
|
||||
this.dirty = false;
|
||||
return nbt;
|
||||
return tag;
|
||||
}
|
||||
|
||||
public boolean isDirty()
|
||||
|
|
|
@ -96,7 +96,7 @@ import common.world.World;
|
|||
import server.Server;
|
||||
|
||||
public abstract class Converter {
|
||||
private static class OldNbtTag {
|
||||
private static class NbtTag {
|
||||
private final Map<String, Object> map = Maps.newHashMap();
|
||||
|
||||
private boolean has(String key, Class<?> type) {
|
||||
|
@ -132,8 +132,8 @@ public abstract class Converter {
|
|||
return !this.has(key, int[].class) ? new int[0] : (int[])this.map.get(key);
|
||||
}
|
||||
|
||||
public OldNbtTag getTag(String key) {
|
||||
return !this.has(key, OldNbtTag.class) ? new OldNbtTag() : (OldNbtTag)this.map.get(key);
|
||||
public NbtTag getTag(String key) {
|
||||
return !this.has(key, NbtTag.class) ? new NbtTag() : (NbtTag)this.map.get(key);
|
||||
}
|
||||
|
||||
public float[] getFloatList(String key) {
|
||||
|
@ -154,11 +154,11 @@ public abstract class Converter {
|
|||
return values;
|
||||
}
|
||||
|
||||
public OldNbtTag[] getTagList(String key) {
|
||||
List<?> list = this.getList(key, OldNbtTag.class);
|
||||
OldNbtTag[] values = new OldNbtTag[list.size()];
|
||||
public NbtTag[] getTagList(String key) {
|
||||
List<?> list = this.getList(key, NbtTag.class);
|
||||
NbtTag[] values = new NbtTag[list.size()];
|
||||
for(int z = 0; z < values.length; z++) {
|
||||
values[z] = (OldNbtTag)list.get(z);
|
||||
values[z] = (NbtTag)list.get(z);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ public abstract class Converter {
|
|||
return list;
|
||||
}
|
||||
case 10: {
|
||||
OldNbtTag tag = new OldNbtTag();
|
||||
NbtTag tag = new NbtTag();
|
||||
byte type;
|
||||
while((type = input.readByte()) != 0) {
|
||||
String key = input.readUTF();
|
||||
|
@ -931,14 +931,14 @@ public abstract class Converter {
|
|||
}
|
||||
}
|
||||
|
||||
private static OldNbtTag readTag(DataInputStream in) throws IOException {
|
||||
private static NbtTag readTag(DataInputStream in) throws IOException {
|
||||
if(in.readByte() != 10)
|
||||
throw new IOException("Tag hat den falschen Typ");
|
||||
in.readUTF();
|
||||
return (OldNbtTag)read(in, (byte)10);
|
||||
return (NbtTag)read(in, (byte)10);
|
||||
}
|
||||
|
||||
private static TagObject convertTile(OldNbtTag ent, String id) {
|
||||
private static TagObject convertTile(NbtTag ent, String id) {
|
||||
TagObject nent = new TagObject();
|
||||
if("Sign".equals(id)) {
|
||||
String[] signText = new String[4];
|
||||
|
@ -1013,7 +1013,7 @@ public abstract class Converter {
|
|||
return nlist;
|
||||
}
|
||||
|
||||
private static TagObject convertChunkData(OldNbtTag tag, boolean legacy) {
|
||||
private static TagObject convertChunkData(NbtTag tag, boolean legacy) {
|
||||
TagObject ntag = new TagObject();
|
||||
tag = tag.getTag("Level");
|
||||
if(legacy) {
|
||||
|
@ -1080,9 +1080,9 @@ public abstract class Converter {
|
|||
ntag.setBool("TerrainPopulated", true);
|
||||
ntag.setBool("LightPopulated", tag.getByte("LightPopulated") != 0);
|
||||
|
||||
OldNbtTag[] ents = tag.getTagList("Entities");
|
||||
NbtTag[] ents = tag.getTagList("Entities");
|
||||
TagObjectList entities = new TagObjectList();
|
||||
for(OldNbtTag ent : ents) {
|
||||
for(NbtTag ent : ents) {
|
||||
TagObject nent = new TagObject();
|
||||
String mapped = ENTITY_MAP.get(trimColon(ent.getString("id")));
|
||||
if(mapped != null) {
|
||||
|
@ -1105,7 +1105,7 @@ public abstract class Converter {
|
|||
|
||||
ents = tag.getTagList("TileEntities");
|
||||
entities = new TagObjectList();
|
||||
for(OldNbtTag ent : ents) {
|
||||
for(NbtTag ent : ents) {
|
||||
TagObject nent = new TagObject();
|
||||
String mapped = TILE_MAP.get(trimColon(ent.getString("id")));
|
||||
if(mapped != null) {
|
||||
|
@ -1119,9 +1119,9 @@ public abstract class Converter {
|
|||
}
|
||||
ntag.setObjectList("TileEntities", entities);
|
||||
|
||||
OldNbtTag[] sects = tag.getTagList("Sections");
|
||||
NbtTag[] sects = tag.getTagList("Sections");
|
||||
entities = new TagObjectList();
|
||||
for(OldNbtTag sect : sects) {
|
||||
for(NbtTag sect : sects) {
|
||||
TagObject nsect = new TagObject();
|
||||
byte[] blocks = sect.getByteArray("Blocks");
|
||||
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
||||
|
@ -1210,7 +1210,7 @@ public abstract class Converter {
|
|||
Log.IO.warn("Konnte " + file.getPath() + "@" + x + "," + z + " nicht lesen");
|
||||
continue;
|
||||
}
|
||||
OldNbtTag tag = readTag(in);
|
||||
NbtTag tag = readTag(in);
|
||||
in.close();
|
||||
TagObject ntag = convertChunkData(tag, legacy);
|
||||
// DataOutputStream out = newreg.getOutputStream(nx, nz);
|
||||
|
@ -1240,7 +1240,7 @@ public abstract class Converter {
|
|||
|
||||
public static boolean convert() {
|
||||
long cur = System.currentTimeMillis();
|
||||
if(new File("server.nbt").exists())
|
||||
if(new File("server.cdt").exists())
|
||||
return false;
|
||||
File ldat = new File("level.dat");
|
||||
if(!ldat.exists())
|
||||
|
@ -1248,11 +1248,11 @@ public abstract class Converter {
|
|||
if(!ldat.exists())
|
||||
return false;
|
||||
Log.IO.info("Welt wird konvertiert");
|
||||
OldNbtTag nbt;
|
||||
NbtTag tag;
|
||||
DataInputStream in = null;
|
||||
try {
|
||||
in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(ldat))));
|
||||
nbt = readTag(in);
|
||||
tag = readTag(in);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Fehler beim Lesen von level.dat");
|
||||
|
@ -1266,10 +1266,9 @@ public abstract class Converter {
|
|||
catch(IOException e) {
|
||||
}
|
||||
}
|
||||
nbt = nbt.getTag("Data");
|
||||
int version = nbt.getInt("version");
|
||||
int data = nbt.getInt("DataVersion");
|
||||
// nbt.setBoolean("incompatible", data >= 1400);
|
||||
tag = tag.getTag("Data");
|
||||
int version = tag.getInt("version");
|
||||
int data = tag.getInt("DataVersion");
|
||||
SaveVersion ver = data >= 1400 ? SaveVersion.RELEASE_1_13 : (data >= 100 ? SaveVersion.RELEASE_1_9 : (version == 19132 || version == 19133 ? SaveVersion.BETA_1_3 : (version == 0 ? SaveVersion.ALPHA_1_0 : null)));
|
||||
if(ver == null) {
|
||||
Log.IO.error("Version %d ist unbekannt", version);
|
||||
|
@ -1317,19 +1316,19 @@ public abstract class Converter {
|
|||
Log.IO.info("Konvertiere Daten von level.dat");
|
||||
Config.clear();
|
||||
UniverseRegistry.clear();
|
||||
OldNbtTag rules = nbt.getTag("GameRules");
|
||||
NbtTag rules = tag.getTag("GameRules");
|
||||
for(Entry<String, String> rule : OLD_GAMERULES.entrySet()) {
|
||||
if(!rules.getString(rule.getKey()).isEmpty())
|
||||
Config.set(rule.getValue(), rules.getString(rule.getKey()), false);
|
||||
}
|
||||
Log.IO.info("Speichere neue server.nbt ...");
|
||||
Log.IO.info("Speichere neue server.cdt ...");
|
||||
Server.saveServerConfig(World.START_TIME);
|
||||
Weather weather = nbt.getByte("thundering") != 0 ? Weather.THUNDER : (nbt.getByte("raining") != 0 ? Weather.RAIN : Weather.CLEAR);
|
||||
Weather weather = tag.getByte("thundering") != 0 ? Weather.THUNDER : (tag.getByte("raining") != 0 ? Weather.RAIN : Weather.CLEAR);
|
||||
if(weather != Weather.CLEAR) {
|
||||
TagObject dataTag = new TagObject();
|
||||
dataTag.setString("Weather", weather.getName());
|
||||
Log.IO.info("Speichere neue data.nbt ...");
|
||||
File dataFile = new File(new File(new File("chunk"), "terra"), "data.nbt");
|
||||
Log.IO.info("Speichere neue data.cdt ...");
|
||||
File dataFile = new File(new File(new File("chunk"), "terra"), "data.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(dataTag, dataFile);
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ public class Region {
|
|||
// getRegionFile(dir, x >> 3, z >> 3).writeTag(x & 7, z & 7, tag);
|
||||
}
|
||||
|
||||
public static ChunkServer readNbt(WorldServer world, int x, int z, TagObject tag) {
|
||||
public static ChunkServer readChunk(WorldServer world, int x, int z, TagObject tag) {
|
||||
// if(!tag.hasTag("Level")) {
|
||||
// Log.error("Chunk-Datei bei " + x + "," + z + " hat keine Level-Daten, überspringe");
|
||||
// return null;
|
||||
|
@ -418,7 +418,7 @@ public class Region {
|
|||
if(entities != null) {
|
||||
for(int n = 0; n < entities.size(); ++n) {
|
||||
TagObject ent = entities.get(n);
|
||||
Entity entity = EntityRegistry.createEntityFromNBT(ent, world);
|
||||
Entity entity = EntityRegistry.createFromTags(ent, world);
|
||||
chunk.setHasEntities(true);
|
||||
|
||||
if(entity != null) {
|
||||
|
@ -426,7 +426,7 @@ public class Region {
|
|||
Entity rider = entity;
|
||||
|
||||
for(TagObject ride = ent; ride.hasObject("Riding"); ride = ride.getObject("Riding")) {
|
||||
Entity pass = EntityRegistry.createEntityFromNBT(ride.getObject("Riding"), world);
|
||||
Entity pass = EntityRegistry.createFromTags(ride.getObject("Riding"), world);
|
||||
|
||||
if(pass != null) {
|
||||
chunk.addEntity(pass);
|
||||
|
@ -486,7 +486,7 @@ public class Region {
|
|||
return chunk;
|
||||
}
|
||||
|
||||
public static TagObject writeNbt(WorldServer world, ChunkServer chunk) {
|
||||
public static TagObject writeChunk(WorldServer world, ChunkServer chunk) {
|
||||
TagObject tag = new TagObject();
|
||||
// tag.setShort("V", (short)Config.PROTOCOL);
|
||||
tag.setLong("LastUpdate", world.getTime());
|
||||
|
@ -553,7 +553,7 @@ public class Region {
|
|||
for(Entity entity : chunk.getEntities()[n]) {
|
||||
TagObject ent = new TagObject();
|
||||
|
||||
if(entity.writeToNBTOptional(ent)) {
|
||||
if(entity.writeOptional(ent)) {
|
||||
chunk.setHasEntities(true);
|
||||
entities.add(ent);
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ public final class WorldServer extends AWorldServer {
|
|||
this.dimension.setSeed(this.seed);
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "data.nbt");
|
||||
File dat = new File(this.chunkDir, "data.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ public final class WorldServer extends AWorldServer {
|
|||
this.exterminated = tag.getBool("Exterminated");
|
||||
this.time = tag.getLong("Time");
|
||||
if(tag.hasObject("Generator")) {
|
||||
this.dimension.fromNbt(tag.getObject("Generator"));
|
||||
this.dimension.fromTags(tag.getObject("Generator"));
|
||||
if(this.dimension.getType().weather && !this.exterminated)
|
||||
this.weather = this.dimension.getWeather();
|
||||
this.seed = this.dimension.getSeed();
|
||||
|
@ -441,7 +441,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(!debug) {
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "loaders.nbt");
|
||||
File dat = new File(this.chunkDir, "loaders.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
|
@ -456,28 +456,10 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
this.loadersModified = false;
|
||||
}
|
||||
// tag = null;
|
||||
// try {
|
||||
// File dat = new File(this.chunkDir, "warps.nbt");
|
||||
// if(dat.exists() && dat.isFile())
|
||||
// tag = NBTLoader.readGZip(dat);
|
||||
// }
|
||||
// catch(Exception e) {
|
||||
// Log.warn("Konnte Warpliste nicht laden", e);
|
||||
// }
|
||||
// if(tag != null && tag.hasList("Warps")) {
|
||||
// NBTTagList list = tag.getTagList("Warps", 10);
|
||||
// for(int z = 0; z < list.tagCount(); z++) {
|
||||
// NBTTagCompound pos = list.getCompoundTagAt(z);
|
||||
// server.getWarps().put(pos.getString("Name"), new Position(pos.getDouble("X"), pos.getDouble("Y"), pos.getDouble("Z"),
|
||||
// pos.getFloat("Yaw"), pos.getFloat("Pitch"), this.dimension.getDimensionId()));
|
||||
// }
|
||||
// this.warpsModified = false;
|
||||
// }
|
||||
if(this.villageGen != null) {
|
||||
tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "villages.nbt");
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
|
@ -930,7 +912,7 @@ public final class WorldServer extends AWorldServer {
|
|||
public static boolean needsLoading(Dimension dim) {
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "loaders.nbt");
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "loaders.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
|
@ -943,7 +925,7 @@ public final class WorldServer extends AWorldServer {
|
|||
public static void loadWarps(Dimension dim, Map<String, Position> warps) {
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.nbt");
|
||||
File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagLoader.readGZip(dat);
|
||||
}
|
||||
|
@ -981,7 +963,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
TagObjectList list = map.get(dim.getDimensionId());
|
||||
File file = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.nbt");
|
||||
File file = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.cdt");
|
||||
if(list == null) {
|
||||
file.delete();
|
||||
}
|
||||
|
@ -1040,7 +1022,7 @@ public final class WorldServer extends AWorldServer {
|
|||
list.add(loader);
|
||||
}
|
||||
loaders.setObjectList("Loaders", list);
|
||||
File file = new File(this.chunkDir, "loaders.nbt");
|
||||
File file = new File(this.chunkDir, "loaders.cdt");
|
||||
if(list.isEmpty()) {
|
||||
file.delete();
|
||||
}
|
||||
|
@ -1060,12 +1042,12 @@ public final class WorldServer extends AWorldServer {
|
|||
// this.dataModified = false;
|
||||
TagObject data = new TagObject();
|
||||
// data.setLong("Seed", this.seed);
|
||||
data.setObject("Generator", this.dimension.toNbt(true));
|
||||
data.setObject("Generator", this.dimension.toTags(true));
|
||||
data.setLong("Time", this.time);
|
||||
data.setBool("Exterminated", this.exterminated);
|
||||
data.setString("Weather", this.weather.getName());
|
||||
// ...
|
||||
File file = new File(this.chunkDir, "data.nbt");
|
||||
File file = new File(this.chunkDir, "data.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(data, file);
|
||||
}
|
||||
|
@ -1081,8 +1063,8 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
}
|
||||
if(this.villageStorage != null && this.villageStorage.isDirty()) {
|
||||
TagObject tag = this.villageStorage.writeToNBT();
|
||||
File dat = new File(this.chunkDir, "villages.nbt");
|
||||
TagObject tag = this.villageStorage.toTags();
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
try {
|
||||
TagLoader.writeGZip(tag, dat);
|
||||
}
|
||||
|
@ -1412,7 +1394,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
// tag = CompressedStreamTools.read(in);
|
||||
}
|
||||
ChunkServer chunk = Region.readNbt(this, x, z, tag);
|
||||
ChunkServer chunk = Region.readChunk(this, x, z, tag);
|
||||
if(chunk != null) {
|
||||
chunk.setSaved(this.time);
|
||||
if(this.mineshaftGen != null) {
|
||||
|
@ -1440,13 +1422,9 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
private void saveChunkData(ChunkServer chunk) {
|
||||
// try {
|
||||
chunk.setSaved(this.time);
|
||||
// this.lock.check();
|
||||
try {
|
||||
// NBTTagCompound ltag = new NBTTagCompound();
|
||||
// tag.setTag("Level", ltag);
|
||||
TagObject tag = Region.writeNbt(this, chunk);
|
||||
TagObject tag = Region.writeChunk(this, chunk);
|
||||
ChunkPos coord = new ChunkPos(chunk.xPos, chunk.zPos);
|
||||
if(!this.pending.contains(coord)) {
|
||||
this.toRemove.put(coord, tag);
|
||||
|
@ -1456,10 +1434,6 @@ public final class WorldServer extends AWorldServer {
|
|||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Chunk nicht speichern");
|
||||
}
|
||||
// }
|
||||
// catch(SaveException e) {
|
||||
// Log.error("Konnte Chunk nicht speichern; bereits von einer anderen Instanz genutzt?", e);
|
||||
// }
|
||||
}
|
||||
|
||||
public boolean writeNextIO() {
|
||||
|
@ -2228,9 +2202,9 @@ public final class WorldServer extends AWorldServer {
|
|||
State successState = chunk.setState(pos, newState);
|
||||
boolean successful = successState != null;
|
||||
if(successful) {
|
||||
if(block.getNbtData() != null) {
|
||||
if(block.getData() != null) {
|
||||
this.removeTileEntity(pos);
|
||||
TagObject tag = block.getNbtData();
|
||||
TagObject tag = block.getData();
|
||||
tag.setString("id", tag.getString("id"));
|
||||
tag.setInt("x", pos.getX());
|
||||
tag.setInt("y", pos.getY());
|
||||
|
@ -2475,7 +2449,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
private File getSaveFile(String id) {
|
||||
return new File(this.chunkDir, id.toLowerCase() + ".nbt");
|
||||
return new File(this.chunkDir, id.toLowerCase() + ".cdt");
|
||||
}
|
||||
|
||||
private WorldSavedData loadData(String id) {
|
||||
|
@ -2485,16 +2459,7 @@ public final class WorldServer extends AWorldServer {
|
|||
try {
|
||||
File file = this.getSaveFile(id);
|
||||
if(file.exists()) {
|
||||
// try {
|
||||
data = new WorldSavedData(id, TagLoader.readGZip(file));
|
||||
// }
|
||||
// catch(Exception re) {
|
||||
// throw new RuntimeException("Konnte " + clazz.toString() + " nicht instanzieren", re);
|
||||
// }
|
||||
// FileInputStream in = new FileInputStream(file);
|
||||
// NBTTagCompound tag = ;
|
||||
// in.close();
|
||||
// data.readFromNBT(tag.getCompoundTag("data"));
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
@ -2518,13 +2483,7 @@ public final class WorldServer extends AWorldServer {
|
|||
private void saveData(WorldSavedData data) {
|
||||
try {
|
||||
File file = this.getSaveFile(data.id);
|
||||
// NBTTagCompound tag = new NBTTagCompound();
|
||||
// data.writeToNBT(tag);
|
||||
// NBTTagCompound dtag = new NBTTagCompound();
|
||||
// dtag.setTag("data", tag);
|
||||
// FileOutputStream out = new FileOutputStream(file);
|
||||
TagLoader.writeGZip(data.tag, file);
|
||||
// out.close();
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -190,16 +190,16 @@ public abstract class MapGenStructure extends MapGenBase
|
|||
// return null;
|
||||
// }
|
||||
|
||||
private void initializeStructureData(WorldServer worldIn)
|
||||
private void initializeStructureData(WorldServer world)
|
||||
{
|
||||
if (this.structureData == null)
|
||||
{
|
||||
this.structureData = worldIn.loadItemData(this.getStructureName());
|
||||
this.structureData = world.loadItemData(this.getStructureName());
|
||||
|
||||
if (this.structureData == null)
|
||||
{
|
||||
this.structureData = new WorldSavedData(this.getStructureName(), new TagObject());
|
||||
worldIn.setItemData(this.getStructureName(), this.structureData);
|
||||
world.setItemData(this.getStructureName(), this.structureData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -207,21 +207,21 @@ public abstract class MapGenStructure extends MapGenBase
|
|||
|
||||
for (String s : tag.getKeySet())
|
||||
{
|
||||
Tag nbtbase = tag.get(s);
|
||||
Tag sub = tag.get(s);
|
||||
|
||||
if (nbtbase instanceof TagObject)
|
||||
if (sub instanceof TagObject)
|
||||
{
|
||||
TagObject nbttagcompound1 = (TagObject)nbtbase;
|
||||
TagObject start = (TagObject)sub;
|
||||
|
||||
if (nbttagcompound1.hasInt("ChunkX") && nbttagcompound1.hasInt("ChunkZ"))
|
||||
if (start.hasInt("ChunkX") && start.hasInt("ChunkZ"))
|
||||
{
|
||||
int i = nbttagcompound1.getInt("ChunkX");
|
||||
int j = nbttagcompound1.getInt("ChunkZ");
|
||||
StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);
|
||||
int i = start.getInt("ChunkX");
|
||||
int j = start.getInt("ChunkZ");
|
||||
StructureStart structure = MapGenStructureIO.getStructureStart(start, world);
|
||||
|
||||
if (structurestart != null)
|
||||
if (structure != null)
|
||||
{
|
||||
this.structureMap.put(Long.valueOf(LongHashMap.packInt(i, j)), structurestart);
|
||||
this.structureMap.put(Long.valueOf(LongHashMap.packInt(i, j)), structure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public abstract class MapGenStructure extends MapGenBase
|
|||
|
||||
private void setStructureStart(int chunkX, int chunkZ, StructureStart start)
|
||||
{
|
||||
this.structureData.tag.setObject("[" + chunkX + "," + chunkZ + "]", start.writeStructureComponentsToNBT(chunkX, chunkZ));
|
||||
this.structureData.tag.setObject("[" + chunkX + "," + chunkZ + "]", start.writeComponents(chunkX, chunkZ));
|
||||
this.structureData.dirty = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MapGenStructureIO
|
|||
|
||||
if (structurestart != null)
|
||||
{
|
||||
structurestart.readStructureComponentsFromNBT(worldIn, tagCompound);
|
||||
structurestart.readComponents(worldIn, tagCompound);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ public class MapGenStructureIO
|
|||
|
||||
if (structurecomponent != null)
|
||||
{
|
||||
structurecomponent.readStructureBaseNBT(worldIn, tagCompound);
|
||||
structurecomponent.readBase(worldIn, tagCompound);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -140,15 +140,15 @@ public class MapGenVillage extends MapGenStructure
|
|||
return this.hasMoreThanTwoComponents;
|
||||
}
|
||||
|
||||
public void writeToNBT(TagObject tagCompound)
|
||||
public void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Valid", this.hasMoreThanTwoComponents);
|
||||
}
|
||||
|
||||
public void readFromNBT(TagObject tagCompound)
|
||||
public void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasMoreThanTwoComponents = tagCompound.getBool("Valid");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,15 +115,15 @@ public class StructureBridge
|
|||
this.field_111021_b = p_i45615_2_.zrange(3) == 0;
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.field_111021_b = tagCompound.getBool("Chest");
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Chest", this.field_111021_b);
|
||||
}
|
||||
|
||||
|
@ -186,15 +186,15 @@ public class StructureBridge
|
|||
this.field_111020_b = p_i45613_2_.zrange(3) == 0;
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.field_111020_b = tagCompound.getBool("Chest");
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Chest", this.field_111020_b);
|
||||
}
|
||||
|
||||
|
@ -636,15 +636,15 @@ public class StructureBridge
|
|||
return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175884_0_, structureboundingbox) == null ? new StructureBridge.End(p_175884_6_, p_175884_1_, structureboundingbox, p_175884_5_) : null;
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.fillSeed = tagCompound.getInt("Seed");
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("Seed", this.fillSeed);
|
||||
}
|
||||
|
||||
|
@ -951,11 +951,11 @@ public class StructureBridge
|
|||
super(p_i2054_1_);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1243,14 +1243,14 @@ public class StructureBridge
|
|||
}
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1325,15 +1325,15 @@ public class StructureBridge
|
|||
this.boundingBox = p_i45611_3_;
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasSpawner = tagCompound.getBool("Mob");
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Mob", this.hasSpawner);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,47 +41,47 @@ public abstract class StructureComponent
|
|||
/**
|
||||
* Writes structure base data (id, boundingbox, {@link
|
||||
* game.worldgen.structure.StructureComponent#coordBaseMode coordBase} and {@link
|
||||
* game.worldgen.structure.StructureComponent#componentType componentType}) to new NBTTagCompound and
|
||||
* game.worldgen.structure.StructureComponent#componentType componentType}) to new tag and
|
||||
* returns it.
|
||||
*/
|
||||
public TagObject createStructureBaseNBT()
|
||||
public TagObject writeBase()
|
||||
{
|
||||
TagObject nbttagcompound = new TagObject();
|
||||
nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this));
|
||||
nbttagcompound.setIntArray("BB", this.boundingBox.toIntArray());
|
||||
nbttagcompound.setInt("O", this.coordBaseMode == null ? -1 : this.coordBaseMode.getHorizontalIndex());
|
||||
nbttagcompound.setInt("GD", this.componentType);
|
||||
this.writeStructureToNBT(nbttagcompound);
|
||||
return nbttagcompound;
|
||||
TagObject tag = new TagObject();
|
||||
tag.setString("id", MapGenStructureIO.getStructureComponentName(this));
|
||||
tag.setIntArray("BB", this.boundingBox.toIntArray());
|
||||
tag.setInt("O", this.coordBaseMode == null ? -1 : this.coordBaseMode.getHorizontalIndex());
|
||||
tag.setInt("GD", this.componentType);
|
||||
this.writeTags(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Helper method to write subclass data to NBT
|
||||
* (abstract) Helper method to write subclass data to tag
|
||||
*/
|
||||
protected abstract void writeStructureToNBT(TagObject tagCompound);
|
||||
protected abstract void writeTags(TagObject tag);
|
||||
|
||||
/**
|
||||
* Reads and sets structure base data (boundingbox, {@link
|
||||
* game.worldgen.structure.StructureComponent#coordBaseMode coordBase} and {@link
|
||||
* game.worldgen.structure.StructureComponent#componentType componentType})
|
||||
*/
|
||||
public void readStructureBaseNBT(WorldServer worldIn, TagObject tagCompound)
|
||||
public void readBase(WorldServer world, TagObject tag)
|
||||
{
|
||||
if (tagCompound.hasIntArray("BB"))
|
||||
if (tag.hasIntArray("BB"))
|
||||
{
|
||||
this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
|
||||
this.boundingBox = new StructureBoundingBox(tag.getIntArray("BB"));
|
||||
}
|
||||
|
||||
int i = tagCompound.getInt("O");
|
||||
int i = tag.getInt("O");
|
||||
this.coordBaseMode = i == -1 ? null : Facing.getHorizontal(i);
|
||||
this.componentType = tagCompound.getInt("GD");
|
||||
this.readStructureFromNBT(tagCompound);
|
||||
this.componentType = tag.getInt("GD");
|
||||
this.readTags(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Helper method to read subclass data from NBT
|
||||
* (abstract) Helper method to read subclass data from tag
|
||||
*/
|
||||
protected abstract void readStructureFromNBT(TagObject tagCompound);
|
||||
protected abstract void readTags(TagObject tag);
|
||||
|
||||
/**
|
||||
* Initiates construction of the Structure Component picked, at the current Location of StructGen
|
||||
|
|
|
@ -100,7 +100,7 @@ public class StructureMineshaft
|
|||
{
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
tagCompound.setBool("hr", this.hasRails);
|
||||
tagCompound.setBool("sc", this.hasSpiders);
|
||||
|
@ -108,7 +108,7 @@ public class StructureMineshaft
|
|||
tagCompound.setInt("Num", this.sectionCount);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
this.hasRails = tagCompound.getBool("hr");
|
||||
this.hasSpiders = tagCompound.getBool("sc");
|
||||
|
@ -425,13 +425,13 @@ public class StructureMineshaft
|
|||
{
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
tagCompound.setBool("tf", this.isMultipleFloors);
|
||||
tagCompound.setInt("D", this.corridorDirection.getHorizontalIndex());
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
this.isMultipleFloors = tagCompound.getBool("tf");
|
||||
this.corridorDirection = Facing.getHorizontal(tagCompound.getInt("D"));
|
||||
|
@ -710,25 +710,25 @@ public class StructureMineshaft
|
|||
}
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tag)
|
||||
{
|
||||
TagIntArrayList nbttaglist = new TagIntArrayList();
|
||||
TagIntArrayList list = new TagIntArrayList();
|
||||
|
||||
for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom)
|
||||
for (StructureBoundingBox bb : this.roomsLinkedToTheRoom)
|
||||
{
|
||||
nbttaglist.add(structureboundingbox.toIntArray());
|
||||
list.add(bb.toIntArray());
|
||||
}
|
||||
|
||||
tagCompound.setIntArrayList("Entrances", nbttaglist);
|
||||
tag.setIntArrayList("Entrances", list);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tag)
|
||||
{
|
||||
TagIntArrayList nbttaglist = tagCompound.getIntArrayList("Entrances");
|
||||
TagIntArrayList list = tag.getIntArrayList("Entrances");
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(nbttaglist.get(i)));
|
||||
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(list.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -746,11 +746,11 @@ public class StructureMineshaft
|
|||
this.boundingBox = structurebb;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -41,18 +41,18 @@ public class StructureScattered
|
|||
super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("hasPlacedChest0", this.hasPlacedChest[0]);
|
||||
tagCompound.setBool("hasPlacedChest1", this.hasPlacedChest[1]);
|
||||
tagCompound.setBool("hasPlacedChest2", this.hasPlacedChest[2]);
|
||||
tagCompound.setBool("hasPlacedChest3", this.hasPlacedChest[3]);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasPlacedChest[0] = tagCompound.getBool("hasPlacedChest0");
|
||||
this.hasPlacedChest[1] = tagCompound.getBool("hasPlacedChest1");
|
||||
this.hasPlacedChest[2] = tagCompound.getBool("hasPlacedChest2");
|
||||
|
@ -293,7 +293,7 @@ public class StructureScattered
|
|||
}
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
tagCompound.setInt("Width", this.scatteredFeatureSizeX);
|
||||
tagCompound.setInt("Height", this.scatteredFeatureSizeY);
|
||||
|
@ -301,7 +301,7 @@ public class StructureScattered
|
|||
tagCompound.setInt("HPos", this.field_74936_d);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
this.scatteredFeatureSizeX = tagCompound.getInt("Width");
|
||||
this.scatteredFeatureSizeY = tagCompound.getInt("Height");
|
||||
|
@ -366,18 +366,18 @@ public class StructureScattered
|
|||
super(p_i2064_1_, p_i2064_2_, 64, p_i2064_3_, 12, 10, 15);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("placedMainChest", this.placedMainChest);
|
||||
tagCompound.setBool("placedHiddenChest", this.placedHiddenChest);
|
||||
tagCompound.setBool("placedTrap1", this.placedTrap1);
|
||||
tagCompound.setBool("placedTrap2", this.placedTrap2);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.placedMainChest = tagCompound.getBool("placedMainChest");
|
||||
this.placedHiddenChest = tagCompound.getBool("placedHiddenChest");
|
||||
this.placedTrap1 = tagCompound.getBool("placedTrap1");
|
||||
|
@ -613,15 +613,15 @@ public class StructureScattered
|
|||
super(p_i2066_1_, p_i2066_2_, 64, p_i2066_3_, 7, 7, 9);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Mage", this.hasMage);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasMage = tagCompound.getBool("Mage");
|
||||
}
|
||||
|
||||
|
|
|
@ -67,50 +67,50 @@ public abstract class StructureStart
|
|||
}
|
||||
}
|
||||
|
||||
public TagObject writeStructureComponentsToNBT(int chunkX, int chunkZ)
|
||||
public TagObject writeComponents(int chunkX, int chunkZ)
|
||||
{
|
||||
TagObject nbttagcompound = new TagObject();
|
||||
nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this));
|
||||
nbttagcompound.setInt("ChunkX", chunkX);
|
||||
nbttagcompound.setInt("ChunkZ", chunkZ);
|
||||
nbttagcompound.setIntArray("BB", this.boundingBox.toIntArray());
|
||||
TagObjectList nbttaglist = new TagObjectList();
|
||||
TagObject tag = new TagObject();
|
||||
tag.setString("id", MapGenStructureIO.getStructureStartName(this));
|
||||
tag.setInt("ChunkX", chunkX);
|
||||
tag.setInt("ChunkZ", chunkZ);
|
||||
tag.setIntArray("BB", this.boundingBox.toIntArray());
|
||||
TagObjectList list = new TagObjectList();
|
||||
|
||||
for (StructureComponent structurecomponent : this.components)
|
||||
for (StructureComponent comp : this.components)
|
||||
{
|
||||
nbttaglist.add(structurecomponent.createStructureBaseNBT());
|
||||
list.add(comp.writeBase());
|
||||
}
|
||||
|
||||
nbttagcompound.setObjectList("Children", nbttaglist);
|
||||
this.writeToNBT(nbttagcompound);
|
||||
return nbttagcompound;
|
||||
tag.setObjectList("Children", list);
|
||||
this.writeTags(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void writeToNBT(TagObject tagCompound)
|
||||
public void writeTags(TagObject tag)
|
||||
{
|
||||
}
|
||||
|
||||
public void readStructureComponentsFromNBT(WorldServer worldIn, TagObject tagCompound)
|
||||
public void readComponents(WorldServer world, TagObject tag)
|
||||
{
|
||||
this.chunkPosX = tagCompound.getInt("ChunkX");
|
||||
this.chunkPosZ = tagCompound.getInt("ChunkZ");
|
||||
this.chunkPosX = tag.getInt("ChunkX");
|
||||
this.chunkPosZ = tag.getInt("ChunkZ");
|
||||
|
||||
if (tagCompound.hasIntArray("BB"))
|
||||
if (tag.hasIntArray("BB"))
|
||||
{
|
||||
this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
|
||||
this.boundingBox = new StructureBoundingBox(tag.getIntArray("BB"));
|
||||
}
|
||||
|
||||
TagObjectList nbttaglist = tagCompound.getObjectList("Children");
|
||||
TagObjectList list = tag.getObjectList("Children");
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.get(i), worldIn));
|
||||
this.components.add(MapGenStructureIO.getStructureComponent(list.get(i), world));
|
||||
}
|
||||
|
||||
this.readFromNBT(tagCompound);
|
||||
this.readTags(tag);
|
||||
}
|
||||
|
||||
public void readFromNBT(TagObject tagCompound)
|
||||
public void readTags(TagObject tag)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -252,15 +252,15 @@ public class StructureStronghold
|
|||
this.boundingBox = p_i45582_3_;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Chest", this.hasMadeChest);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasMadeChest = tagCompound.getBool("Chest");
|
||||
}
|
||||
|
||||
|
@ -324,15 +324,15 @@ public class StructureStronghold
|
|||
this.field_74993_a = p_i45581_4_ != Facing.NORTH && p_i45581_4_ != Facing.SOUTH ? p_i45581_3_.getXSize() : p_i45581_3_.getZSize();
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("Steps", this.field_74993_a);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.field_74993_a = tagCompound.getInt("Steps");
|
||||
}
|
||||
|
||||
|
@ -425,18 +425,18 @@ public class StructureStronghold
|
|||
this.field_74999_h = p_i45580_2_.zrange(3) > 0;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("leftLow", this.field_74996_b);
|
||||
tagCompound.setBool("leftHigh", this.field_74997_c);
|
||||
tagCompound.setBool("rightLow", this.field_74995_d);
|
||||
tagCompound.setBool("rightHigh", this.field_74999_h);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.field_74996_b = tagCompound.getBool("leftLow");
|
||||
this.field_74997_c = tagCompound.getBool("leftHigh");
|
||||
this.field_74995_d = tagCompound.getBool("rightLow");
|
||||
|
@ -608,15 +608,15 @@ public class StructureStronghold
|
|||
this.isLargeRoom = p_i45578_3_.getYSize() > 6;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Tall", this.isLargeRoom);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.isLargeRoom = tagCompound.getBool("Tall");
|
||||
}
|
||||
|
||||
|
@ -792,15 +792,15 @@ public class StructureStronghold
|
|||
this.boundingBox = p_i45577_3_;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Mob", this.hasSpawner);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasSpawner = tagCompound.getBool("Mob");
|
||||
}
|
||||
|
||||
|
@ -1030,15 +1030,15 @@ public class StructureStronghold
|
|||
this.roomType = p_i45575_2_.zrange(5);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("Type", this.roomType);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.roomType = tagCompound.getInt("Type");
|
||||
}
|
||||
|
||||
|
@ -1199,15 +1199,15 @@ public class StructureStronghold
|
|||
this.boundingBox = p_i45574_3_;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Source", this.field_75024_a);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.field_75024_a = tagCompound.getBool("Source");
|
||||
}
|
||||
|
||||
|
@ -1393,16 +1393,16 @@ public class StructureStronghold
|
|||
this.expandsZ = p_i45573_2_.zrange(2) == 0;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Left", this.expandsX);
|
||||
tagCompound.setBool("Right", this.expandsZ);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.expandsX = tagCompound.getBool("Left");
|
||||
this.expandsZ = tagCompound.getBool("Right");
|
||||
}
|
||||
|
@ -1472,12 +1472,12 @@ public class StructureStronghold
|
|||
super(p_i2087_1_);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
tagCompound.setString("EntryDoor", this.field_143013_d.getName());
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
this.field_143013_d = StructureStronghold.Stronghold.Door.getByName(tagCompound.getString("EntryDoor"));
|
||||
}
|
||||
|
|
|
@ -403,18 +403,18 @@ public class StructureVillage
|
|||
this.cropTypeD = this.func_151559_a(rand);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
|
||||
tagCompound.setInt("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
|
||||
tagCompound.setInt("CC", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeC));
|
||||
tagCompound.setInt("CD", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeD));
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA"));
|
||||
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInt("CB"));
|
||||
this.cropTypeC = BlockRegistry.getBlockById(tagCompound.getInt("CC"));
|
||||
|
@ -512,16 +512,16 @@ public class StructureVillage
|
|||
this.cropTypeB = this.func_151560_a(rand);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
|
||||
tagCompound.setInt("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA"));
|
||||
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInt("CB"));
|
||||
}
|
||||
|
@ -855,15 +855,15 @@ public class StructureVillage
|
|||
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new StructureVillage.House2(start, p_175855_7_, rand, structureboundingbox, facing) : null;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Chest", this.hasMadeChest);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.hasMadeChest = tagCompound.getBool("Chest");
|
||||
}
|
||||
|
||||
|
@ -1123,15 +1123,15 @@ public class StructureVillage
|
|||
this.isRoofAccessible = rand.chance();
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("Terrace", this.isRoofAccessible);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.isRoofAccessible = tagCompound.getBool("Terrace");
|
||||
}
|
||||
|
||||
|
@ -1252,15 +1252,15 @@ public class StructureVillage
|
|||
this.length = Math.max(p_i45562_4_.getXSize(), p_i45562_4_.getZSize());
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("Length", this.length);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.length = tagCompound.getInt("Length");
|
||||
}
|
||||
|
||||
|
@ -1507,14 +1507,14 @@ public class StructureVillage
|
|||
}
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
tagCompound.setInt("HPos", this.field_143015_k);
|
||||
tagCompound.setInt("VCount", this.villagersSpawned);
|
||||
tagCompound.setBool("Desert", this.isDesertVillage);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
this.field_143015_k = tagCompound.getInt("HPos");
|
||||
this.villagersSpawned = tagCompound.getInt("VCount");
|
||||
|
@ -1789,16 +1789,16 @@ public class StructureVillage
|
|||
this.tablePosition = rand.zrange(3);
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setInt("T", this.tablePosition);
|
||||
tagCompound.setBool("C", this.isTallHouse);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.tablePosition = tagCompound.getInt("T");
|
||||
this.isTallHouse = tagCompound.getBool("C");
|
||||
}
|
||||
|
@ -1901,15 +1901,15 @@ public class StructureVillage
|
|||
this.boundingBox = p_i45565_4_;
|
||||
}
|
||||
|
||||
protected void writeStructureToNBT(TagObject tagCompound)
|
||||
protected void writeTags(TagObject tagCompound)
|
||||
{
|
||||
super.writeStructureToNBT(tagCompound);
|
||||
super.writeTags(tagCompound);
|
||||
tagCompound.setBool("VSpawn", this.villagerSpawned);
|
||||
}
|
||||
|
||||
protected void readStructureFromNBT(TagObject tagCompound)
|
||||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readStructureFromNBT(tagCompound);
|
||||
super.readTags(tagCompound);
|
||||
this.villagerSpawned = tagCompound.getBool("VSpawn");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue