change nbt format

This commit is contained in:
Sen 2025-05-27 21:25:11 +02:00
parent ad4949af16
commit 17aad1f023
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
124 changed files with 2063 additions and 2986 deletions

View file

@ -45,7 +45,8 @@ import common.init.Config.ValueType;
import common.log.Log;
import common.nbt.NBTLoader;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagDoubleList;
import common.nbt.NBTTagFloatList;
import common.net.bootstrap.ServerBootstrap;
import common.net.channel.Channel;
import common.net.channel.ChannelException;
@ -206,15 +207,15 @@ public final class Server implements IThreadListener {
if(file.exists()) {
try {
NBTTagCompound tag = NBTLoader.readGZip(file);
NBTTagCompound cfg = tag.getCompoundTag("Config");
NBTTagCompound cfg = tag.getTag("Config");
for(String key : cfg.getKeySet()) {
Config.set(key, cfg.getString(key), false);
}
UniverseRegistry.loadNbt(tag.getCompoundTag("Universe"));
UniverseRegistry.loadNbt(tag.getTag("Universe"));
long lastPlayed = tag.getLong("LastAccess");
String version = tag.hasKey("Version", 8) ? tag.getString("Version") : null;
String version = tag.hasString("Version") ? tag.getString("Version") : null;
version = version != null && version.isEmpty() ? "<unbekannt>" : version;
long time = tag.hasKey("Time", 4) ? tag.getLong("Time") : World.START_TIME;
long time = tag.hasLong("Time") ? tag.getLong("Time") : World.START_TIME;
Log.IO.info("Version: %s", version);
Log.IO.info("Weltzeit: %d Ticks / %d Sekunden", time, time / 20L);
Log.IO.info("Zuletzt geladen: %s", new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date(lastPlayed)));
@ -328,14 +329,14 @@ public final class Server implements IThreadListener {
NBTTagCompound tag = this.loadPlayerData(user);
if(tag == null)
return null;
NBTTagList pos = tag.getTagList("Pos", 6);
NBTTagList rot = tag.getTagList("Rotation", 5);
double posX = pos.getDoubleAt(0);
double posY = pos.getDoubleAt(1);
double posZ = pos.getDoubleAt(2);
float rotYaw = rot.getFloatAt(0);
float rotPitch = rot.getFloatAt(1);
int dimension = tag.getInteger("Dimension");
NBTTagDoubleList pos = tag.getDoubleList("Pos");
NBTTagFloatList rot = tag.getFloatList("Rotation");
double posX = pos.getDouble(0);
double posY = pos.getDouble(1);
double posZ = pos.getDouble(2);
float rotYaw = rot.getFloat(0);
float rotPitch = rot.getFloat(1);
int dimension = tag.getInt("Dimension");
return new Position(posX, posY, posZ, rotYaw, rotPitch, dimension);
}
@ -871,7 +872,7 @@ public final class Server implements IThreadListener {
this.usermap.put(loginUser, conn);
tag = conn.readCharacter();
WorldServer world = tag == null ? this.space : this.getWorld(tag.getInteger("Dimension"));
WorldServer world = tag == null ? this.space : this.getWorld(tag.getInt("Dimension"));
world = world == null ? this.space : world;
EntityNPC player = conn.createPlayer(world, tag == null ? EntityRegistry.getEntityString(EntityHuman.class) : tag.getString("id"));
if(tag != null)
@ -959,7 +960,7 @@ public final class Server implements IThreadListener {
if(entity != null) {
NBTTagCompound etag = new NBTTagCompound();
entity.writeToNBT(etag);
etag.setInteger("Dimension", entity.worldObj.dimension.getDimensionId());
etag.setInt("Dimension", entity.worldObj.dimension.getDimensionId());
etag.setString("id", EntityRegistry.getEntityString(entity));
conn.writeCharacter(etag);
}
@ -1049,7 +1050,7 @@ public final class Server implements IThreadListener {
old.unmount();
NBTTagCompound oldTag = new NBTTagCompound();
old.writeToNBT(oldTag);
oldTag.setInteger("Dimension", old.worldObj.dimension.getDimensionId());
oldTag.setInt("Dimension", old.worldObj.dimension.getDimensionId());
oldTag.setString("id", EntityRegistry.getEntityString(old));
WorldServer oldWorld = (WorldServer)old.getServerWorld();
@ -1059,7 +1060,7 @@ public final class Server implements IThreadListener {
oldWorld.removePlayerEntityDangerously(old);
// old.dead = false;
WorldServer world = tag == null ? this.space : this.getWorld(tag.getInteger("Dimension"));
WorldServer world = tag == null ? this.space : this.getWorld(tag.getInt("Dimension"));
world = world == null ? this.space : world;
EntityNPC nplayer = conn.createPlayer(world, tag == null ? EntityRegistry.getEntityString(clazz) : tag.getString("id"));
// conn.sendPacket(new SPacketRespawn(world.dimension, EntityRegistry.getEntityID(nplayer)));

View file

@ -39,9 +39,9 @@ public class CommandBlock extends Command {
NBTTagCompound te = new NBTTagCompound();
tile.writeToNBT(te);
tag.setString("id", te.getString("id"));
tag.setInteger("x", position.getX());
tag.setInteger("y", position.getY());
tag.setInteger("z", position.getZ());
tag.setInt("x", position.getX());
tag.setInt("y", position.getY());
tag.setInt("z", position.getZ());
te.merge(tag);
TileEntity newTile = TileEntity.createAndLoadEntity(te);
if(newTile != null) {

View file

@ -42,9 +42,9 @@ public class CommandSpawn extends Command {
if(type.equalsIgnoreCase("Lightning")) {
for(int z = 0; z < count; z++) {
int color = 0xffffff;
if(tag != null && tag.hasKey("color", 3))
color = tag.getInteger("color");
else if(tag != null && tag.hasKey("color", 8)) {
if(tag != null && tag.hasInt("color"))
color = tag.getInt("color");
else if(tag != null && tag.hasString("color")) {
try {
color = Integer.parseUnsignedInt(tag.getString("color"), 16);
}
@ -52,8 +52,8 @@ public class CommandSpawn extends Command {
}
}
world.strikeLightning(pos.xCoord, pos.yCoord, pos.zCoord, color,
tag != null && tag.hasKey("damage", 3) ? tag.getInteger("damage") : 0, tag != null && tag.hasKey("fire", 1) && tag.getBoolean("fire"),
exec.isPlayer() && tag != null && tag.hasKey("summoned", 1) && tag.getBoolean("summoned") ? ((Player)exec).getPresentEntity() : null);
tag != null && tag.hasInt("damage") ? tag.getInt("damage") : 0, tag != null && tag.hasBool("fire") && tag.getBool("fire"),
exec.isPlayer() && tag != null && tag.hasBool("summoned") && tag.getBool("summoned") ? ((Player)exec).getPresentEntity() : null);
}
exec.logConsole("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), (int)pos.xCoord, (int)pos.yCoord, (int)pos.zCoord, world.dimension.getFormattedName(false));
return null;

View file

@ -47,7 +47,8 @@ import common.item.ItemControl;
import common.item.ItemStack;
import common.log.Log;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagDoubleList;
import common.nbt.NBTTagTagList;
import common.net.util.concurrent.Future;
import common.net.util.concurrent.GenericFutureListener;
import common.network.IPlayer;
@ -617,18 +618,18 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
public void readFromNBT(NBTTagCompound tag) {
this.admin = tag.getBoolean("admin");
if(tag.hasKey("password", 8))
this.admin = tag.getBool("admin");
if(tag.hasString("password"))
this.password = tag.getString("password");
this.selected = tag.getInteger("selected");
NBTTagList list = tag.getTagList("characters", 10);
for(int z = 0; z < list.tagCount(); z++) {
this.characters.add(list.getCompoundTagAt(z));
this.selected = tag.getInt("selected");
NBTTagTagList list = tag.getTagList("characters");
for(int z = 0; z < list.size(); z++) {
this.characters.add(list.getTag(z));
}
this.selected = Math.min(this.selected, this.characters.size() - 1);
this.charEditor = this.selected < 0;
// this.stats.clear();
// if(tag.hasKey("Stats", 10)) {
// if(tag.hasTag("Stats")) {
// NBTTagCompound stats = tag.getCompoundTag("Stats");
// for(String key : stats.getKeySet()) {
// StatBase stat = StatRegistry.getStat(key);
@ -643,16 +644,16 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
public void writeToNBT(NBTTagCompound tag) {
if(this.admin)
tag.setBoolean("admin", this.admin);
tag.setBool("admin", this.admin);
if(this.password != null)
tag.setString("password", this.password);
if(!this.characters.isEmpty()) {
tag.setInteger("selected", this.selected);
NBTTagList list = new NBTTagList();
tag.setInt("selected", this.selected);
NBTTagTagList list = new NBTTagTagList();
for(NBTTagCompound etag : this.characters) {
list.appendTag(etag);
list.add(etag);
}
tag.setTag("characters", list);
tag.setTagList("characters", list);
}
// NBTTagCompound stats = new NBTTagCompound();
// for(Entry<StatBase, Integer> entry : this.stats.entrySet()) {
@ -1652,12 +1653,12 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
if(info != null && info.isEmpty())
info = null;
Alignment align = Alignment.getByName(tag.getString("Align"));
NBTTagList position = tag.getTagList("Pos", 6);
Dimension dimension = UniverseRegistry.getDimension(tag.getInteger("Dimension"));
NBTTagDoubleList position = tag.getDoubleList("Pos");
Dimension dimension = UniverseRegistry.getDimension(tag.getInt("Dimension"));
String dim = dimension == null ? "???" : dimension.getFormattedName(false);
BlockPos pos = new BlockPos(position.getDoubleAt(0), position.getDoubleAt(1), position.getDoubleAt(2));
BlockPos pos = new BlockPos(position.getDouble(0), position.getDouble(1), position.getDouble(2));
String type = EntityRegistry.getEntityName(tag.getString("id"));
int level = tag.getInteger("XpLevel");
int level = tag.getInt("XpLevel");
return new PlayerCharacter(name, info, align, dim, pos, type, level);
}
@ -2987,27 +2988,27 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
// changed = true;
// }
if (itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag"))
if (itemstack.hasTagCompound() && itemstack.getTagCompound().hasTag("BlockEntityTag"))
{
// if(!itemstack.getTagCompound().hasKey("BlockEntityTag", 10)) {
// if(!itemstack.getTagCompound().hasTag("BlockEntityTag")) {
// changed = true;
// itemstack.setTagCompound(null);
// }
// else {
NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");
NBTTagCompound nbttagcompound = itemstack.getTagCompound().getTag("BlockEntityTag");
if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
if (nbttagcompound.hasInt("x") && nbttagcompound.hasInt("y") && nbttagcompound.hasInt("z"))
{
BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
BlockPos blockpos = new BlockPos(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
TileEntity tileentity = this.entity.worldObj.getTileEntity(blockpos);
if (tileentity != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
tileentity.writeToNBT(nbttagcompound1);
nbttagcompound1.removeTag("x");
nbttagcompound1.removeTag("y");
nbttagcompound1.removeTag("z");
nbttagcompound1.remove("x");
nbttagcompound1.remove("y");
nbttagcompound1.remove("z");
itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
}
}

View file

@ -8,7 +8,7 @@ import common.block.Material;
import common.block.artificial.BlockDoor;
import common.collect.Lists;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagTagList;
import common.util.BlockPos;
import common.util.Facing;
import common.village.Village;
@ -25,12 +25,12 @@ public class VillageCollection
public VillageCollection(NBTTagCompound nbt) {
if(nbt != null) {
this.tickCounter = nbt.getInteger("Tick");
NBTTagList nbttaglist = nbt.getTagList("Villages", 10);
this.tickCounter = nbt.getInt("Tick");
NBTTagTagList nbttaglist = nbt.getTagList("Villages");
for (int i = 0; i < nbttaglist.tagCount(); ++i)
for (int i = 0; i < nbttaglist.size(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
Village village = new Village();
village.readVillageDataFromNBT(nbttagcompound);
this.villageList.add(village);
@ -251,17 +251,17 @@ public class VillageCollection
public NBTTagCompound writeToNBT()
{
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("Tick", this.tickCounter);
NBTTagList nbttaglist = new NBTTagList();
nbt.setInt("Tick", this.tickCounter);
NBTTagTagList nbttaglist = new NBTTagTagList();
for (Village village : this.villageList)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
village.writeVillageDataToNBT(nbttagcompound);
nbttaglist.appendTag(nbttagcompound);
nbttaglist.add(nbttagcompound);
}
nbt.setTag("Villages", nbttaglist);
nbt.setTagList("Villages", nbttaglist);
this.dirty = false;
return nbt;
}

View file

@ -69,9 +69,9 @@ import common.init.UniverseRegistry;
import common.log.Log;
import common.nbt.NBTLoader;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagDouble;
import common.nbt.NBTTagFloat;
import common.nbt.NBTTagList;
import common.nbt.NBTTagDoubleList;
import common.nbt.NBTTagFloatList;
import common.nbt.NBTTagTagList;
import common.rng.Random;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityBanner;
@ -976,7 +976,7 @@ public abstract class Converter {
}
}
else if("Comparator".equals(id)) {
nent.setInteger("OutputSignal", ent.getInt("OutputSignal"));
nent.setInt("OutputSignal", ent.getInt("OutputSignal"));
}
else if("Music".equals(id)) {
nent.setByte("note", ent.getByte("note"));
@ -997,18 +997,18 @@ public abstract class Converter {
return idx >= 0 ? name.substring(idx + 1) : name; // save compat
}
private static NBTTagList getList(float[] values) {
NBTTagList nlist = new NBTTagList();
private static NBTTagFloatList getList(float[] values) {
NBTTagFloatList nlist = new NBTTagFloatList();
for(int z = 0; z < values.length; z++) {
nlist.appendTag(new NBTTagFloat(values[z]));
nlist.add(values[z]);
}
return nlist;
}
private static NBTTagList getList(double[] values) {
NBTTagList nlist = new NBTTagList();
private static NBTTagDoubleList getList(double[] values) {
NBTTagDoubleList nlist = new NBTTagDoubleList();
for(int z = 0; z < values.length; z++) {
nlist.appendTag(new NBTTagDouble(values[z]));
nlist.add(values[z]);
}
return nlist;
}
@ -1027,7 +1027,7 @@ public abstract class Converter {
byte[] olddata = tag.getByteArray("Data");
byte[] oldsky = tag.getByteArray("SkyLight");
byte[] oldlight = tag.getByteArray("BlockLight");
NBTTagList sections = new NBTTagList();
NBTTagTagList sections = new NBTTagTagList();
for(int n = 0; n < 8; ++n) {
boolean empty = true;
for(int x = 0; x < 16 && empty; ++x) {
@ -1065,10 +1065,10 @@ public abstract class Converter {
section.setByteArray("Data", data.getData());
section.setByteArray("SkyLight", sky.getData());
section.setByteArray("BlockLight", light.getData());
sections.appendTag(section);
sections.add(section);
}
}
ntag.setTag("Sections", sections);
ntag.setTagList("Sections", sections);
byte[] biomes = new byte[256];
Arrays.fill(biomes, (byte)(Biome.DEF_BIOME.id & 255));
ntag.setByteArray("Biomes", biomes);
@ -1077,11 +1077,11 @@ public abstract class Converter {
ntag.setIntArray("HeightMap", tag.getIntArray("HeightMap"));
}
ntag.setBoolean("TerrainPopulated", true);
ntag.setBoolean("LightPopulated", tag.getByte("LightPopulated") != 0);
ntag.setBool("TerrainPopulated", true);
ntag.setBool("LightPopulated", tag.getByte("LightPopulated") != 0);
OldNbtTag[] ents = tag.getTagList("Entities");
NBTTagList entities = new NBTTagList();
NBTTagTagList entities = new NBTTagTagList();
for(OldNbtTag ent : ents) {
NBTTagCompound nent = new NBTTagCompound();
String mapped = ENTITY_MAP.get(trimColon(ent.getString("id")));
@ -1092,35 +1092,35 @@ public abstract class Converter {
if(pos.length != 3 || motion.length != 3 || rotation.length != 2)
continue;
boolean ground = ent.getByte("OnGround") != 0;
nent.setTag("Pos", getList(pos));
nent.setTag("Motion", getList(motion));
nent.setTag("Rotation", getList(rotation));
nent.setBoolean("OnGround", ground);
nent.setInteger("Dimension", 1);
nent.setDoubleList("Pos", getList(pos));
nent.setDoubleList("Motion", getList(motion));
nent.setFloatList("Rotation", getList(rotation));
nent.setBool("OnGround", ground);
nent.setInt("Dimension", 1);
nent.setString("id", mapped);
entities.appendTag(nent);
entities.add(nent);
}
}
ntag.setTag("Entities", entities);
ntag.setTagList("Entities", entities);
ents = tag.getTagList("TileEntities");
entities = new NBTTagList();
entities = new NBTTagTagList();
for(OldNbtTag ent : ents) {
NBTTagCompound nent = new NBTTagCompound();
String mapped = TILE_MAP.get(trimColon(ent.getString("id")));
if(mapped != null) {
nent = convertTile(ent, mapped);
nent.setString("id", mapped);
nent.setInteger("x", ent.getInt("x"));
nent.setInteger("y", ent.getInt("y"));
nent.setInteger("z", ent.getInt("z"));
entities.appendTag(nent);
nent.setInt("x", ent.getInt("x"));
nent.setInt("y", ent.getInt("y"));
nent.setInt("z", ent.getInt("z"));
entities.add(nent);
}
}
ntag.setTag("TileEntities", entities);
ntag.setTagList("TileEntities", entities);
OldNbtTag[] sects = tag.getTagList("Sections");
entities = new NBTTagList();
entities = new NBTTagTagList();
for(OldNbtTag sect : sects) {
NBTTagCompound nsect = new NBTTagCompound();
byte[] blocks = sect.getByteArray("Blocks");
@ -1161,9 +1161,9 @@ public abstract class Converter {
nsect.setByteArray("Data", data.getData());
if(adddata != null)
nsect.setByteArray("Add", adddata.getData());
entities.appendTag(nsect);
entities.add(nsect);
}
ntag.setTag("Sections", entities);
ntag.setTagList("Sections", entities);
return ntag;
}

View file

@ -26,8 +26,9 @@ import common.init.BlockRegistry;
import common.init.EntityRegistry;
import common.log.Log;
import common.nbt.NBTLoader;
import common.nbt.SizeTracker;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagTagList;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.NextTickListEntry;
@ -347,7 +348,7 @@ public class Region {
byte[] data = getRegionFile(dir, x >> 3, z >> 3).read(x & 7, z & 7);
if(data == null)
return null;
return NBTLoader.read(new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(data)))));
return NBTLoader.read(new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(data)))), SizeTracker.INFINITE);
}
public static /* synchronized */ void writeChunk(File dir, int x, int z, NBTTagCompound tag) throws IOException {
@ -360,31 +361,31 @@ public class Region {
}
public static ChunkServer readNbt(WorldServer world, int x, int z, NBTTagCompound tag) {
// if(!tag.hasKey("Level", 10)) {
// if(!tag.hasTag("Level")) {
// Log.error("Chunk-Datei bei " + x + "," + z + " hat keine Level-Daten, überspringe");
// return null;
// }
// tag = tag.getCompoundTag("Level");
if(!tag.hasKey("Sections", 9)) {
if(!tag.hasTagList("Sections")) {
Log.IO.warn("Chunk-Datei bei " + x + "," + z + " hat keine Block-Daten, überspringe");
return null;
}
ChunkServer chunk = new ChunkServer(world, x, z);
chunk.setHeights(tag.getIntArray("HeightMap"));
chunk.setTerrainPopulated(tag.getBoolean("TerrainPopulated"));
chunk.setLightPopulated(tag.getBoolean("LightPopulated"));
chunk.setTerrainPopulated(tag.getBool("TerrainPopulated"));
chunk.setLightPopulated(tag.getBool("LightPopulated"));
chunk.setInhabited(tag.getLong("InhabitedTime"));
NBTTagList sects = tag.getTagList("Sections", 10);
BlockArray[] sections = new BlockArray[sects.tagCount()];
NBTTagTagList sects = tag.getTagList("Sections");
BlockArray[] sections = new BlockArray[sects.size()];
boolean light = !world.dimension.hasNoLight();
for(int n = 0; n < sects.tagCount(); ++n) {
NBTTagCompound sect = sects.getCompoundTagAt(n);
int y = sect.getInteger("Y");
for(int n = 0; n < sects.size(); ++n) {
NBTTagCompound sect = sects.getTag(n);
int y = sect.getInt("Y");
BlockArray storage = new BlockArray(y << 4, light, null);
byte[] blocks = sect.getByteArray("Blocks");
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
NibbleArray adddata = sect.hasKey("Add", 7) ? new NibbleArray(sect.getByteArray("Add")) : null;
NibbleArray adddata = sect.hasByteArray("Add") ? new NibbleArray(sect.getByteArray("Add")) : null;
char[] seg = new char[blocks.length];
for(int c = 0; c < seg.length; ++c) {
@ -408,15 +409,15 @@ public class Region {
chunk.setStorage(sections);
if(tag.hasKey("Biomes", 7)) {
if(tag.hasByteArray("Biomes")) {
chunk.setBiomes(tag.getByteArray("Biomes"));
}
NBTTagList entities = tag.getTagList("Entities", 10);
NBTTagTagList entities = tag.getTagList("Entities");
if(entities != null) {
for(int n = 0; n < entities.tagCount(); ++n) {
NBTTagCompound ent = entities.getCompoundTagAt(n);
for(int n = 0; n < entities.size(); ++n) {
NBTTagCompound ent = entities.getTag(n);
Entity entity = EntityRegistry.createEntityFromNBT(ent, world);
chunk.setHasEntities(true);
@ -424,8 +425,8 @@ public class Region {
chunk.addEntity(entity);
Entity rider = entity;
for(NBTTagCompound ride = ent; ride.hasKey("Riding", 10); ride = ride.getCompoundTag("Riding")) {
Entity pass = EntityRegistry.createEntityFromNBT(ride.getCompoundTag("Riding"), world);
for(NBTTagCompound ride = ent; ride.hasTag("Riding"); ride = ride.getTag("Riding")) {
Entity pass = EntityRegistry.createEntityFromNBT(ride.getTag("Riding"), world);
if(pass != null) {
chunk.addEntity(pass);
@ -438,11 +439,11 @@ public class Region {
}
}
NBTTagList tiles = tag.getTagList("TileEntities", 10);
NBTTagTagList tiles = tag.getTagList("TileEntities");
if(tiles != null) {
for(int n = 0; n < tiles.tagCount(); ++n) {
NBTTagCompound tile = tiles.getCompoundTagAt(n);
for(int n = 0; n < tiles.size(); ++n) {
NBTTagCompound tile = tiles.getTag(n);
TileEntity tileentity = TileEntity.createAndLoadEntity(tile);
if(tileentity != null) {
@ -451,29 +452,29 @@ public class Region {
}
}
if(tag.hasKey("TileTicks", 9)) {
NBTTagList ticks = tag.getTagList("TileTicks", 10);
if(tag.hasTagList("TileTicks")) {
NBTTagTagList ticks = tag.getTagList("TileTicks");
if(ticks != null) {
int invalid = 0;
for(int n = 0; n < ticks.tagCount(); ++n) {
NBTTagCompound tick = ticks.getCompoundTagAt(n);
for(int n = 0; n < ticks.size(); ++n) {
NBTTagCompound tick = ticks.getTag(n);
Block block;
if(tick.hasKey("i", 8)) {
if(tick.hasString("i")) {
block = BlockRegistry.getByIdFallback(tick.getString("i"));
}
else {
block = BlockRegistry.getBlockById(tick.getInteger("i"));
block = BlockRegistry.getBlockById(tick.getInt("i"));
}
if(block != null) { // FIX
world.scheduleBlockUpdate(new BlockPos(tick.getInteger("x"), tick.getInteger("y"), tick.getInteger("z")), block,
tick.getInteger("t"), tick.getInteger("p"));
world.scheduleBlockUpdate(new BlockPos(tick.getInt("x"), tick.getInt("y"), tick.getInt("z")), block,
tick.getInt("t"), tick.getInt("p"));
}
else if(invalid++ < 10) {
Log.IO.warn("Unbekannter Block-Tick in Chunk " + x + "," + z + ": " +
(tick.hasKey("i", 8) ? ("'" + tick.getString("i") + "'") : ("#" + tick.getInteger("i"))));
(tick.hasString("i") ? ("'" + tick.getString("i") + "'") : ("#" + tick.getInt("i"))));
}
}
if(invalid > 10) {
@ -490,17 +491,17 @@ public class Region {
// tag.setShort("V", (short)Config.PROTOCOL);
tag.setLong("LastUpdate", world.getTime());
tag.setIntArray("HeightMap", chunk.getHeights());
tag.setBoolean("TerrainPopulated", chunk.isTerrainPopulated());
tag.setBoolean("LightPopulated", chunk.isLightPopulated());
tag.setBool("TerrainPopulated", chunk.isTerrainPopulated());
tag.setBool("LightPopulated", chunk.isLightPopulated());
tag.setLong("InhabitedTime", chunk.getInhabited());
Set<BlockArray> sections = chunk.getStorage();
NBTTagList sects = new NBTTagList();
NBTTagTagList sects = new NBTTagTagList();
boolean light = !world.dimension.hasNoLight();
for(BlockArray storage : sections) {
if(storage != null) {
NBTTagCompound sect = new NBTTagCompound();
sect.setInteger("Y", storage.getY() >> 4);
sect.setInt("Y", storage.getY() >> 4);
byte[] blocks = new byte[storage.getData().length];
NibbleArray data = new NibbleArray();
NibbleArray adddata = null;
@ -539,14 +540,14 @@ public class Region {
sect.setByteArray("SkyLight", new byte[storage.getBlocklight().getData().length]);
}
sects.appendTag(sect);
sects.add(sect);
}
}
tag.setTag("Sections", sects);
tag.setTagList("Sections", sects);
tag.setByteArray("Biomes", chunk.getBiomes());
chunk.setHasEntities(false);
NBTTagList entities = new NBTTagList();
NBTTagTagList entities = new NBTTagTagList();
for(int n = 0; n < chunk.getEntities().length; ++n) {
for(Entity entity : chunk.getEntities()[n]) {
@ -554,40 +555,40 @@ public class Region {
if(entity.writeToNBTOptional(ent)) {
chunk.setHasEntities(true);
entities.appendTag(ent);
entities.add(ent);
}
}
}
tag.setTag("Entities", entities);
NBTTagList tiles = new NBTTagList();
tag.setTagList("Entities", entities);
NBTTagTagList tiles = new NBTTagTagList();
for(TileEntity tileentity : chunk.getTiles().values()) {
NBTTagCompound tile = new NBTTagCompound();
tileentity.writeToNBT(tile);
tiles.appendTag(tile);
tiles.add(tile);
}
tag.setTag("TileEntities", tiles);
tag.setTagList("TileEntities", tiles);
List<NextTickListEntry> tics = world.getPendingBlockUpdates(chunk);
if(tics != null) {
long time = world.getTime();
NBTTagList ticks = new NBTTagList();
NBTTagTagList ticks = new NBTTagTagList();
for(NextTickListEntry tic : tics) {
NBTTagCompound tick = new NBTTagCompound();
String res = BlockRegistry.REGISTRY.getNameForObject(tic.getBlock());
tick.setString("i", res == null ? "" : res.toString());
tick.setInteger("x", tic.position.getX());
tick.setInteger("y", tic.position.getY());
tick.setInteger("z", tic.position.getZ());
tick.setInteger("t", (int)(tic.scheduledTime - time));
tick.setInteger("p", tic.priority);
ticks.appendTag(tick);
tick.setInt("x", tic.position.getX());
tick.setInt("y", tic.position.getY());
tick.setInt("z", tic.position.getZ());
tick.setInt("t", (int)(tic.scheduledTime - time));
tick.setInt("p", tic.priority);
ticks.add(tick);
}
tag.setTag("TileTicks", ticks);
tag.setTagList("TileTicks", ticks);
}
return tag;

View file

@ -42,8 +42,7 @@ import common.log.Log;
import common.model.ParticleType;
import common.nbt.NBTLoader;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagInt;
import common.nbt.NBTTagList;
import common.nbt.NBTTagTagList;
import common.network.IPlayer;
import common.network.Packet;
import common.packet.SPacketEntityStatus;
@ -308,10 +307,10 @@ public final class WorldServer extends AWorldServer {
Log.IO.error(e, "Konnte Weltdaten nicht laden");
}
if(tag != null) {
this.exterminated = tag.getBoolean("Exterminated");
this.exterminated = tag.getBool("Exterminated");
this.time = tag.getLong("Time");
if(tag.hasKey("Generator", 10)) {
this.dimension.fromNbt(tag.getCompoundTag("Generator"));
if(tag.hasTag("Generator")) {
this.dimension.fromNbt(tag.getTag("Generator"));
if(this.dimension.getType().weather && !this.exterminated)
this.weather = this.dimension.getWeather();
this.seed = this.dimension.getSeed();
@ -449,11 +448,11 @@ public final class WorldServer extends AWorldServer {
catch(Exception e) {
Log.IO.error(e, "Konnte Ladeliste nicht laden");
}
if(tag != null && tag.hasKey("Loaders", 9)) {
NBTTagList list = tag.getTagList("Loaders", 10);
for(int z = 0; z < list.tagCount(); z++) {
NBTTagCompound pos = list.getCompoundTagAt(z);
this.addLoader(new BlockPos(pos.getInteger("X"), pos.getInteger("Y"), pos.getInteger("Z")));
if(tag != null && tag.hasTagList("Loaders")) {
NBTTagTagList list = tag.getTagList("Loaders");
for(int z = 0; z < list.size(); z++) {
NBTTagCompound pos = list.getTag(z);
this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
}
this.loadersModified = false;
}
@ -466,7 +465,7 @@ public final class WorldServer extends AWorldServer {
// catch(Exception e) {
// Log.warn("Konnte Warpliste nicht laden", e);
// }
// if(tag != null && tag.hasKey("Warps", 9)) {
// 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);
@ -938,7 +937,7 @@ public final class WorldServer extends AWorldServer {
catch(Exception e) {
return false;
}
return tag != null && tag.hasKey("Loaders", 9) && !tag.getTagList("Loaders", 10).hasNoTags();
return tag != null && tag.hasTagList("Loaders") && !tag.getTagList("Loaders").isEmpty();
}
public static void loadWarps(Dimension dim, Map<String, Position> warps) {
@ -952,10 +951,10 @@ public final class WorldServer extends AWorldServer {
Log.IO.error(e, "Konnte Warpliste nicht laden");
return;
}
if(tag != null && tag.hasKey("Warps", 9)) {
NBTTagList list = tag.getTagList("Warps", 10);
for(int z = 0; z < list.tagCount(); z++) {
NBTTagCompound pos = list.getCompoundTagAt(z);
if(tag != null && tag.hasTagList("Warps")) {
NBTTagTagList list = tag.getTagList("Warps");
for(int z = 0; z < list.size(); z++) {
NBTTagCompound pos = list.getTag(z);
warps.put(pos.getString("Name"), new Position(pos.getDouble("X"), pos.getDouble("Y"), pos.getDouble("Z"),
pos.getFloat("Yaw"), pos.getFloat("Pitch"), dim.getDimensionId()));
}
@ -963,13 +962,13 @@ public final class WorldServer extends AWorldServer {
}
public static void saveWarps(Map<String, Position> warps) {
Map<Integer, NBTTagList> map = Maps.newHashMap();
Map<Integer, NBTTagTagList> map = Maps.newHashMap();
for(Entry<String, Position> pos : warps.entrySet()) {
Dimension dim = UniverseRegistry.getDimension(pos.getValue().dim);
if(dim != null) {
NBTTagList list = map.get(pos.getValue().dim);
NBTTagTagList list = map.get(pos.getValue().dim);
if(list == null)
map.put(pos.getValue().dim, list = new NBTTagList());
map.put(pos.getValue().dim, list = new NBTTagTagList());
NBTTagCompound warp = new NBTTagCompound();
warp.setString("Name", pos.getKey());
warp.setDouble("X", pos.getValue().x);
@ -977,18 +976,18 @@ public final class WorldServer extends AWorldServer {
warp.setDouble("Z", pos.getValue().z);
warp.setFloat("Yaw", pos.getValue().yaw);
warp.setFloat("Pitch", pos.getValue().pitch);
list.appendTag(warp);
list.add(warp);
}
}
for(Dimension dim : UniverseRegistry.getDimensions()) {
NBTTagList list = map.get(dim.getDimensionId());
NBTTagTagList list = map.get(dim.getDimensionId());
File file = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.nbt");
if(list == null) {
file.delete();
}
else {
NBTTagCompound tag = new NBTTagCompound();
tag.setTag("Warps", list);
tag.setTagList("Warps", list);
try {
NBTLoader.writeGZip(tag, file);
}
@ -1032,17 +1031,17 @@ public final class WorldServer extends AWorldServer {
if(this.loadersModified) {
this.loadersModified = false;
NBTTagCompound loaders = new NBTTagCompound();
NBTTagList list = new NBTTagList();
NBTTagTagList list = new NBTTagTagList();
for(BlockPos pos : this.loaderList) {
NBTTagCompound loader = new NBTTagCompound();
loader.setInteger("X", pos.getX());
loader.setInteger("Y", pos.getY());
loader.setInteger("Z", pos.getZ());
list.appendTag(loader);
loader.setInt("X", pos.getX());
loader.setInt("Y", pos.getY());
loader.setInt("Z", pos.getZ());
list.add(loader);
}
loaders.setTag("Loaders", list);
loaders.setTagList("Loaders", list);
File file = new File(this.chunkDir, "loaders.nbt");
if(list.hasNoTags()) {
if(list.isEmpty()) {
file.delete();
}
else {
@ -1063,7 +1062,7 @@ public final class WorldServer extends AWorldServer {
// data.setLong("Seed", this.seed);
data.setTag("Generator", this.dimension.toNbt(true));
data.setLong("Time", this.time);
data.setBoolean("Exterminated", this.exterminated);
data.setBool("Exterminated", this.exterminated);
data.setString("Weather", this.weather.getName());
// ...
File file = new File(this.chunkDir, "data.nbt");
@ -2233,9 +2232,9 @@ public final class WorldServer extends AWorldServer {
this.removeTileEntity(pos);
NBTTagCompound tag = block.getNbtData();
tag.setString("id", tag.getString("id"));
tag.setTag("x", new NBTTagInt(pos.getX()));
tag.setTag("y", new NBTTagInt(pos.getY()));
tag.setTag("z", new NBTTagInt(pos.getZ()));
tag.setInt("x", pos.getX());
tag.setInt("y", pos.getY());
tag.setInt("z", pos.getZ());
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag);
if(tileEntity != null) {
this.setTileEntity(pos, tileEntity);

View file

@ -207,16 +207,16 @@ public abstract class MapGenStructure extends MapGenBase
for (String s : tag.getKeySet())
{
NBTBase nbtbase = tag.getTag(s);
NBTBase nbtbase = tag.get(s);
if (nbtbase.getId() == 10)
{
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;
if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
if (nbttagcompound1.hasInt("ChunkX") && nbttagcompound1.hasInt("ChunkZ"))
{
int i = nbttagcompound1.getInteger("ChunkX");
int j = nbttagcompound1.getInteger("ChunkZ");
int i = nbttagcompound1.getInt("ChunkX");
int j = nbttagcompound1.getInt("ChunkZ");
StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);
if (structurestart != null)

View file

@ -143,13 +143,13 @@ public class MapGenVillage extends MapGenStructure
public void writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
tagCompound.setBoolean("Valid", this.hasMoreThanTwoComponents);
tagCompound.setBool("Valid", this.hasMoreThanTwoComponents);
}
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
this.hasMoreThanTwoComponents = tagCompound.getBoolean("Valid");
this.hasMoreThanTwoComponents = tagCompound.getBool("Valid");
}
}
}

View file

@ -1,6 +1,5 @@
package server.worldgen.structure;
import common.nbt.NBTTagIntArray;
import common.util.BlockPos;
import common.util.Facing;
import common.util.Vec3i;
@ -209,8 +208,8 @@ public class StructureBoundingBox
// return Objects.toStringHelper(this).add("x0", this.minX).add("y0", this.minY).add("z0", this.minZ).add("x1", this.maxX).add("y1", this.maxY).add("z1", this.maxZ).toString();
// }
public NBTTagIntArray toNBTTagIntArray()
public int[] toIntArray()
{
return new NBTTagIntArray(new int[] {this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ});
return new int[] {this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ};
}
}

View file

@ -118,13 +118,13 @@ public class StructureBridge
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.field_111021_b = tagCompound.getBoolean("Chest");
this.field_111021_b = tagCompound.getBool("Chest");
}
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Chest", this.field_111021_b);
tagCompound.setBool("Chest", this.field_111021_b);
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -189,13 +189,13 @@ public class StructureBridge
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.field_111020_b = tagCompound.getBoolean("Chest");
this.field_111020_b = tagCompound.getBool("Chest");
}
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Chest", this.field_111020_b);
tagCompound.setBool("Chest", this.field_111020_b);
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -639,13 +639,13 @@ public class StructureBridge
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.fillSeed = tagCompound.getInteger("Seed");
this.fillSeed = tagCompound.getInt("Seed");
}
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("Seed", this.fillSeed);
tagCompound.setInt("Seed", this.fillSeed);
}
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@ -1328,13 +1328,13 @@ public class StructureBridge
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasSpawner = tagCompound.getBoolean("Mob");
this.hasSpawner = tagCompound.getBool("Mob");
}
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Mob", this.hasSpawner);
tagCompound.setBool("Mob", this.hasSpawner);
}
public static StructureBridge.Throne func_175874_a(List<StructureComponent> p_175874_0_, Random p_175874_1_, int p_175874_2_, int p_175874_3_, int p_175874_4_, int p_175874_5_, Facing p_175874_6_)

View file

@ -48,9 +48,9 @@ public abstract class StructureComponent
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this));
nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray());
nbttagcompound.setInteger("O", this.coordBaseMode == null ? -1 : this.coordBaseMode.getHorizontalIndex());
nbttagcompound.setInteger("GD", this.componentType);
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;
}
@ -67,14 +67,14 @@ public abstract class StructureComponent
*/
public void readStructureBaseNBT(WorldServer worldIn, NBTTagCompound tagCompound)
{
if (tagCompound.hasKey("BB"))
if (tagCompound.hasIntArray("BB"))
{
this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
}
int i = tagCompound.getInteger("O");
int i = tagCompound.getInt("O");
this.coordBaseMode = i == -1 ? null : Facing.getHorizontal(i);
this.componentType = tagCompound.getInteger("GD");
this.componentType = tagCompound.getInt("GD");
this.readStructureFromNBT(tagCompound);
}

View file

@ -8,7 +8,7 @@ import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagIntArrayList;
import common.rng.Random;
import common.rng.WeightedList;
import common.tileentity.TileEntity;
@ -102,18 +102,18 @@ public class StructureMineshaft
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
tagCompound.setBoolean("hr", this.hasRails);
tagCompound.setBoolean("sc", this.hasSpiders);
tagCompound.setBoolean("hps", this.spawnerPlaced);
tagCompound.setInteger("Num", this.sectionCount);
tagCompound.setBool("hr", this.hasRails);
tagCompound.setBool("sc", this.hasSpiders);
tagCompound.setBool("hps", this.spawnerPlaced);
tagCompound.setInt("Num", this.sectionCount);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
this.hasRails = tagCompound.getBoolean("hr");
this.hasSpiders = tagCompound.getBoolean("sc");
this.spawnerPlaced = tagCompound.getBoolean("hps");
this.sectionCount = tagCompound.getInteger("Num");
this.hasRails = tagCompound.getBool("hr");
this.hasSpiders = tagCompound.getBool("sc");
this.spawnerPlaced = tagCompound.getBool("hps");
this.sectionCount = tagCompound.getInt("Num");
}
public Corridor(int type, Random rand, StructureBoundingBox structurebb, Facing facing)
@ -427,14 +427,14 @@ public class StructureMineshaft
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
tagCompound.setBoolean("tf", this.isMultipleFloors);
tagCompound.setInteger("D", this.corridorDirection.getHorizontalIndex());
tagCompound.setBool("tf", this.isMultipleFloors);
tagCompound.setInt("D", this.corridorDirection.getHorizontalIndex());
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
this.isMultipleFloors = tagCompound.getBoolean("tf");
this.corridorDirection = Facing.getHorizontal(tagCompound.getInteger("D"));
this.isMultipleFloors = tagCompound.getBool("tf");
this.corridorDirection = Facing.getHorizontal(tagCompound.getInt("D"));
}
public Cross(int type, Random rand, StructureBoundingBox structurebb, Facing facing)
@ -712,23 +712,23 @@ public class StructureMineshaft
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
NBTTagList nbttaglist = new NBTTagList();
NBTTagIntArrayList nbttaglist = new NBTTagIntArrayList();
for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom)
{
nbttaglist.appendTag(structureboundingbox.toNBTTagIntArray());
nbttaglist.add(structureboundingbox.toIntArray());
}
tagCompound.setTag("Entrances", nbttaglist);
tagCompound.setIntArrayList("Entrances", nbttaglist);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
NBTTagList nbttaglist = tagCompound.getTagList("Entrances", 11);
NBTTagIntArrayList nbttaglist = tagCompound.getIntArrayList("Entrances");
for (int i = 0; i < nbttaglist.tagCount(); ++i)
for (int i = 0; i < nbttaglist.size(); ++i)
{
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(nbttaglist.getIntArrayAt(i)));
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(nbttaglist.getIntArray(i)));
}
}
}

View file

@ -44,19 +44,19 @@ public class StructureScattered
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("hasPlacedChest0", this.hasPlacedChest[0]);
tagCompound.setBoolean("hasPlacedChest1", this.hasPlacedChest[1]);
tagCompound.setBoolean("hasPlacedChest2", this.hasPlacedChest[2]);
tagCompound.setBoolean("hasPlacedChest3", this.hasPlacedChest[3]);
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(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasPlacedChest[0] = tagCompound.getBoolean("hasPlacedChest0");
this.hasPlacedChest[1] = tagCompound.getBoolean("hasPlacedChest1");
this.hasPlacedChest[2] = tagCompound.getBoolean("hasPlacedChest2");
this.hasPlacedChest[3] = tagCompound.getBoolean("hasPlacedChest3");
this.hasPlacedChest[0] = tagCompound.getBool("hasPlacedChest0");
this.hasPlacedChest[1] = tagCompound.getBool("hasPlacedChest1");
this.hasPlacedChest[2] = tagCompound.getBool("hasPlacedChest2");
this.hasPlacedChest[3] = tagCompound.getBool("hasPlacedChest3");
}
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@ -295,18 +295,18 @@ public class StructureScattered
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
tagCompound.setInteger("Width", this.scatteredFeatureSizeX);
tagCompound.setInteger("Height", this.scatteredFeatureSizeY);
tagCompound.setInteger("Depth", this.scatteredFeatureSizeZ);
tagCompound.setInteger("HPos", this.field_74936_d);
tagCompound.setInt("Width", this.scatteredFeatureSizeX);
tagCompound.setInt("Height", this.scatteredFeatureSizeY);
tagCompound.setInt("Depth", this.scatteredFeatureSizeZ);
tagCompound.setInt("HPos", this.field_74936_d);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
this.scatteredFeatureSizeX = tagCompound.getInteger("Width");
this.scatteredFeatureSizeY = tagCompound.getInteger("Height");
this.scatteredFeatureSizeZ = tagCompound.getInteger("Depth");
this.field_74936_d = tagCompound.getInteger("HPos");
this.scatteredFeatureSizeX = tagCompound.getInt("Width");
this.scatteredFeatureSizeY = tagCompound.getInt("Height");
this.scatteredFeatureSizeZ = tagCompound.getInt("Depth");
this.field_74936_d = tagCompound.getInt("HPos");
}
protected boolean func_74935_a(WorldServer worldIn, StructureBoundingBox p_74935_2_, int p_74935_3_)
@ -369,19 +369,19 @@ public class StructureScattered
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("placedMainChest", this.placedMainChest);
tagCompound.setBoolean("placedHiddenChest", this.placedHiddenChest);
tagCompound.setBoolean("placedTrap1", this.placedTrap1);
tagCompound.setBoolean("placedTrap2", this.placedTrap2);
tagCompound.setBool("placedMainChest", this.placedMainChest);
tagCompound.setBool("placedHiddenChest", this.placedHiddenChest);
tagCompound.setBool("placedTrap1", this.placedTrap1);
tagCompound.setBool("placedTrap2", this.placedTrap2);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.placedMainChest = tagCompound.getBoolean("placedMainChest");
this.placedHiddenChest = tagCompound.getBoolean("placedHiddenChest");
this.placedTrap1 = tagCompound.getBoolean("placedTrap1");
this.placedTrap2 = tagCompound.getBoolean("placedTrap2");
this.placedMainChest = tagCompound.getBool("placedMainChest");
this.placedHiddenChest = tagCompound.getBool("placedHiddenChest");
this.placedTrap1 = tagCompound.getBool("placedTrap1");
this.placedTrap2 = tagCompound.getBool("placedTrap2");
}
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@ -616,13 +616,13 @@ public class StructureScattered
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Mage", this.hasMage);
tagCompound.setBool("Mage", this.hasMage);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasMage = tagCompound.getBoolean("Mage");
this.hasMage = tagCompound.getBool("Mage");
}
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)

View file

@ -4,7 +4,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.nbt.NBTTagTagList;
import common.rng.Random;
import common.util.ChunkPos;
import server.world.WorldServer;
@ -71,17 +71,17 @@ public abstract class StructureStart
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this));
nbttagcompound.setInteger("ChunkX", chunkX);
nbttagcompound.setInteger("ChunkZ", chunkZ);
nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray());
NBTTagList nbttaglist = new NBTTagList();
nbttagcompound.setInt("ChunkX", chunkX);
nbttagcompound.setInt("ChunkZ", chunkZ);
nbttagcompound.setIntArray("BB", this.boundingBox.toIntArray());
NBTTagTagList nbttaglist = new NBTTagTagList();
for (StructureComponent structurecomponent : this.components)
{
nbttaglist.appendTag(structurecomponent.createStructureBaseNBT());
nbttaglist.add(structurecomponent.createStructureBaseNBT());
}
nbttagcompound.setTag("Children", nbttaglist);
nbttagcompound.setTagList("Children", nbttaglist);
this.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@ -92,19 +92,19 @@ public abstract class StructureStart
public void readStructureComponentsFromNBT(WorldServer worldIn, NBTTagCompound tagCompound)
{
this.chunkPosX = tagCompound.getInteger("ChunkX");
this.chunkPosZ = tagCompound.getInteger("ChunkZ");
this.chunkPosX = tagCompound.getInt("ChunkX");
this.chunkPosZ = tagCompound.getInt("ChunkZ");
if (tagCompound.hasKey("BB"))
if (tagCompound.hasIntArray("BB"))
{
this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB"));
}
NBTTagList nbttaglist = tagCompound.getTagList("Children", 10);
NBTTagTagList nbttaglist = tagCompound.getTagList("Children");
for (int i = 0; i < nbttaglist.tagCount(); ++i)
for (int i = 0; i < nbttaglist.size(); ++i)
{
this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn));
this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getTag(i), worldIn));
}
this.readFromNBT(tagCompound);

View file

@ -255,13 +255,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Chest", this.hasMadeChest);
tagCompound.setBool("Chest", this.hasMadeChest);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasMadeChest = tagCompound.getBoolean("Chest");
this.hasMadeChest = tagCompound.getBool("Chest");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -327,13 +327,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("Steps", this.field_74993_a);
tagCompound.setInt("Steps", this.field_74993_a);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.field_74993_a = tagCompound.getInteger("Steps");
this.field_74993_a = tagCompound.getInt("Steps");
}
public static StructureBoundingBox func_175869_a(List<StructureComponent> p_175869_0_, Random p_175869_1_, int p_175869_2_, int p_175869_3_, int p_175869_4_, Facing p_175869_5_)
@ -428,19 +428,19 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("leftLow", this.field_74996_b);
tagCompound.setBoolean("leftHigh", this.field_74997_c);
tagCompound.setBoolean("rightLow", this.field_74995_d);
tagCompound.setBoolean("rightHigh", this.field_74999_h);
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(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.field_74996_b = tagCompound.getBoolean("leftLow");
this.field_74997_c = tagCompound.getBoolean("leftHigh");
this.field_74995_d = tagCompound.getBoolean("rightLow");
this.field_74999_h = tagCompound.getBoolean("rightHigh");
this.field_74996_b = tagCompound.getBool("leftLow");
this.field_74997_c = tagCompound.getBool("leftHigh");
this.field_74995_d = tagCompound.getBool("rightLow");
this.field_74999_h = tagCompound.getBool("rightHigh");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -611,13 +611,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Tall", this.isLargeRoom);
tagCompound.setBool("Tall", this.isLargeRoom);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.isLargeRoom = tagCompound.getBoolean("Tall");
this.isLargeRoom = tagCompound.getBool("Tall");
}
public static StructureStronghold.Library func_175864_a(List<StructureComponent> p_175864_0_, Random p_175864_1_, int p_175864_2_, int p_175864_3_, int p_175864_4_, Facing p_175864_5_, int p_175864_6_)
@ -795,13 +795,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Mob", this.hasSpawner);
tagCompound.setBool("Mob", this.hasSpawner);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasSpawner = tagCompound.getBoolean("Mob");
this.hasSpawner = tagCompound.getBool("Mob");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -1033,13 +1033,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("Type", this.roomType);
tagCompound.setInt("Type", this.roomType);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.roomType = tagCompound.getInteger("Type");
this.roomType = tagCompound.getInt("Type");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -1202,13 +1202,13 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Source", this.field_75024_a);
tagCompound.setBool("Source", this.field_75024_a);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.field_75024_a = tagCompound.getBoolean("Source");
this.field_75024_a = tagCompound.getBool("Source");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -1396,15 +1396,15 @@ public class StructureStronghold
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Left", this.expandsX);
tagCompound.setBoolean("Right", this.expandsZ);
tagCompound.setBool("Left", this.expandsX);
tagCompound.setBool("Right", this.expandsZ);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.expandsX = tagCompound.getBoolean("Left");
this.expandsZ = tagCompound.getBoolean("Right");
this.expandsX = tagCompound.getBool("Left");
this.expandsZ = tagCompound.getBool("Right");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)

View file

@ -406,19 +406,19 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
tagCompound.setInteger("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
tagCompound.setInteger("CC", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeC));
tagCompound.setInteger("CD", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeD));
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(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInteger("CA"));
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInteger("CB"));
this.cropTypeC = BlockRegistry.getBlockById(tagCompound.getInteger("CC"));
this.cropTypeD = BlockRegistry.getBlockById(tagCompound.getInteger("CD"));
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA"));
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInt("CB"));
this.cropTypeC = BlockRegistry.getBlockById(tagCompound.getInt("CC"));
this.cropTypeD = BlockRegistry.getBlockById(tagCompound.getInt("CD"));
}
private Block func_151559_a(Random rand)
@ -515,15 +515,15 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
tagCompound.setInteger("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
tagCompound.setInt("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
tagCompound.setInt("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInteger("CA"));
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInteger("CB"));
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA"));
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInt("CB"));
}
private Block func_151560_a(Random rand)
@ -858,13 +858,13 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Chest", this.hasMadeChest);
tagCompound.setBool("Chest", this.hasMadeChest);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.hasMadeChest = tagCompound.getBoolean("Chest");
this.hasMadeChest = tagCompound.getBool("Chest");
}
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@ -1126,13 +1126,13 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("Terrace", this.isRoofAccessible);
tagCompound.setBool("Terrace", this.isRoofAccessible);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.isRoofAccessible = tagCompound.getBoolean("Terrace");
this.isRoofAccessible = tagCompound.getBool("Terrace");
}
public static StructureVillage.House4Garden func_175858_a(StructureVillage.Start start, List<StructureComponent> p_175858_1_, Random rand, int p_175858_3_, int p_175858_4_, int p_175858_5_, Facing facing, int p_175858_7_)
@ -1255,13 +1255,13 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("Length", this.length);
tagCompound.setInt("Length", this.length);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.length = tagCompound.getInteger("Length");
this.length = tagCompound.getInt("Length");
}
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
@ -1509,16 +1509,16 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
tagCompound.setInteger("HPos", this.field_143015_k);
tagCompound.setInteger("VCount", this.villagersSpawned);
tagCompound.setBoolean("Desert", this.isDesertVillage);
tagCompound.setInt("HPos", this.field_143015_k);
tagCompound.setInt("VCount", this.villagersSpawned);
tagCompound.setBool("Desert", this.isDesertVillage);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
this.field_143015_k = tagCompound.getInteger("HPos");
this.villagersSpawned = tagCompound.getInteger("VCount");
this.isDesertVillage = tagCompound.getBoolean("Desert");
this.field_143015_k = tagCompound.getInt("HPos");
this.villagersSpawned = tagCompound.getInt("VCount");
this.isDesertVillage = tagCompound.getBool("Desert");
}
protected StructureComponent getNextComponentNN(StructureVillage.Start start, List<StructureComponent> p_74891_2_, Random rand, int p_74891_4_, int p_74891_5_)
@ -1792,15 +1792,15 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setInteger("T", this.tablePosition);
tagCompound.setBoolean("C", this.isTallHouse);
tagCompound.setInt("T", this.tablePosition);
tagCompound.setBool("C", this.isTallHouse);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.tablePosition = tagCompound.getInteger("T");
this.isTallHouse = tagCompound.getBoolean("C");
this.tablePosition = tagCompound.getInt("T");
this.isTallHouse = tagCompound.getBool("C");
}
public static StructureVillage.WoodHut func_175853_a(StructureVillage.Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, Facing facing, int p_175853_7_)
@ -1904,13 +1904,13 @@ public class StructureVillage
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setBoolean("VSpawn", this.villagerSpawned);
tagCompound.setBool("VSpawn", this.villagerSpawned);
}
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.villagerSpawned = tagCompound.getBoolean("VSpawn");
this.villagerSpawned = tagCompound.getBool("VSpawn");
}
public static StructureVillage.Cage func_175853_a(StructureVillage.Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, Facing facing, int p_175853_7_)