diff --git a/client/src/main/java/client/renderer/particle/EntityFX.java b/client/src/main/java/client/renderer/particle/EntityFX.java index 67c53bd..8208122 100755 --- a/client/src/main/java/client/renderer/particle/EntityFX.java +++ b/client/src/main/java/client/renderer/particle/EntityFX.java @@ -5,7 +5,7 @@ import client.renderer.RenderBuffer; import client.renderer.texture.TextureAtlasSprite; import common.entity.Entity; import common.entity.EntityType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.ExtMath; import common.world.World; @@ -210,14 +210,14 @@ public class EntityFX extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { } diff --git a/client/src/main/java/client/renderer/particle/EntityFirework.java b/client/src/main/java/client/renderer/particle/EntityFirework.java index 58fde2e..e912a98 100755 --- a/client/src/main/java/client/renderer/particle/EntityFirework.java +++ b/client/src/main/java/client/renderer/particle/EntityFirework.java @@ -6,8 +6,8 @@ import client.world.WorldClient; import common.entity.Entity; import common.init.SoundEvent; import common.item.ItemDye; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BoundingBox; import common.util.ExtMath; import common.world.World; @@ -192,10 +192,10 @@ public class EntityFirework { private int fireworkAge; private final EffectRenderer theEffectRenderer; - private NBTTagTagList fireworkExplosions; + private TagObjectList fireworkExplosions; boolean twinkle; - public StarterFX(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, EffectRenderer p_i46464_14_, NBTTagCompound p_i46464_15_) + public StarterFX(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, EffectRenderer p_i46464_14_, TagObject p_i46464_15_) { super(p_i46464_1_, p_i46464_2_, p_i46464_4_, p_i46464_6_, 0.0D, 0.0D, 0.0D); this.motionX = p_i46464_8_; @@ -218,7 +218,7 @@ public class EntityFirework for (int i = 0; i < this.fireworkExplosions.size(); ++i) { - NBTTagCompound nbttagcompound = this.fireworkExplosions.get(i); + TagObject nbttagcompound = this.fireworkExplosions.get(i); if (nbttagcompound.getBool("Flicker")) { @@ -250,7 +250,7 @@ public class EntityFirework { for (int i = 0; i < this.fireworkExplosions.size(); ++i) { - NBTTagCompound nbttagcompound = this.fireworkExplosions.get(i); + TagObject nbttagcompound = this.fireworkExplosions.get(i); if (nbttagcompound.getByte("Type") == 1) { @@ -268,7 +268,7 @@ public class EntityFirework if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.size()) { int k = this.fireworkAge / 2; - NBTTagCompound nbttagcompound1 = this.fireworkExplosions.get(k); + TagObject nbttagcompound1 = this.fireworkExplosions.get(k); int l = nbttagcompound1.getByte("Type"); boolean flag4 = nbttagcompound1.getBool("Trail"); boolean flag2 = nbttagcompound1.getBool("Flicker"); diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index 1874f1e..3d61dfe 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -22,7 +22,7 @@ import common.init.SoundEvent; import common.item.ItemDye; import common.log.Log; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.sound.MovingSoundMinecart; import common.sound.PositionedSound; @@ -381,7 +381,7 @@ public class WorldClient extends AWorldClient // } } - public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, NBTTagCompound compund) + public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, TagObject compund) { this.gm.effectRenderer.addEffect(new EntityFirework.StarterFX(this.gm.world, x, y, z, motionX, motionY, motionZ, this.gm.effectRenderer, compund)); } diff --git a/common/src/main/java/common/attributes/Attributes.java b/common/src/main/java/common/attributes/Attributes.java index 5af05b5..afacffe 100755 --- a/common/src/main/java/common/attributes/Attributes.java +++ b/common/src/main/java/common/attributes/Attributes.java @@ -3,8 +3,8 @@ package common.attributes; import java.util.Collection; import common.log.Log; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; public class Attributes { @@ -40,9 +40,9 @@ public class Attributes /** * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances */ - public static NBTTagTagList writeBaseAttributeMapToNBT(AttributeMap map) + public static TagObjectList writeBaseAttributeMapToNBT(AttributeMap map) { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (AttributeInstance iattributeinstance : map.getAllAttributes()) { @@ -55,9 +55,9 @@ public class Attributes /** * Creates an NBTTagCompound from an AttributeInstance, including its AttributeModifiers */ - private static NBTTagCompound writeAttributeInstanceToNBT(AttributeInstance instance) + private static TagObject writeAttributeInstanceToNBT(AttributeInstance instance) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); Attribute iattribute = instance.getAttribute(); nbttagcompound.setString("Name", iattribute.getUnlocalizedName()); nbttagcompound.setDouble("Base", instance.getBaseValue()); @@ -65,7 +65,7 @@ public class Attributes if (collection != null && !collection.isEmpty()) { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (AttributeModifier attributemodifier : collection) { @@ -84,9 +84,9 @@ public class Attributes /** * Creates an NBTTagCompound from an AttributeModifier */ - private static NBTTagCompound writeAttributeModifierToNBT(AttributeModifier modifier) + private static TagObject writeAttributeModifierToNBT(AttributeModifier modifier) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setString("Name", modifier.getName()); nbttagcompound.setDouble("Amount", modifier.getAmount()); nbttagcompound.setBool("Multiply", modifier.isMultiplied()); @@ -94,11 +94,11 @@ public class Attributes return nbttagcompound; } - public static void setAttributeModifiers(AttributeMap map, NBTTagTagList list) + public static void setAttributeModifiers(AttributeMap map, TagObjectList list) { for (int i = 0; i < list.size(); ++i) { - NBTTagCompound nbttagcompound = list.get(i); + TagObject nbttagcompound = list.get(i); AttributeInstance iattributeinstance = map.getAttributeInstanceByName(nbttagcompound.getString("Name")); if (iattributeinstance != null) @@ -112,13 +112,13 @@ public class Attributes } } - private static void applyModifiersToAttributeInstance(AttributeInstance instance, NBTTagCompound compound) + private static void applyModifiersToAttributeInstance(AttributeInstance instance, TagObject compound) { instance.setBaseValue(compound.getDouble("Base")); if (compound.hasTagList("Modifiers")) { - NBTTagTagList nbttaglist = compound.getTagList("Modifiers"); + TagObjectList nbttaglist = compound.getTagList("Modifiers"); for (int i = 0; i < nbttaglist.size(); ++i) { @@ -142,7 +142,7 @@ public class Attributes /** * Creates an AttributeModifier from an NBTTagCompound */ - public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound compound) + public static AttributeModifier readAttributeModifierFromNBT(TagObject compound) { long id = compound.getLong("AttrId"); if(id == 0L) diff --git a/common/src/main/java/common/block/tile/BlockBanner.java b/common/src/main/java/common/block/tile/BlockBanner.java index aefc2f3..a7d466f 100755 --- a/common/src/main/java/common/block/tile/BlockBanner.java +++ b/common/src/main/java/common/block/tile/BlockBanner.java @@ -8,7 +8,7 @@ import common.init.Items; import common.item.Item; import common.item.ItemStack; import common.model.Transforms; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.properties.IProperty; import common.properties.PropertyDirection; import common.properties.PropertyInteger; @@ -125,7 +125,7 @@ public class BlockBanner extends BlockContainer if (tileentity instanceof TileEntityBanner) { ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); tileentity.writeToNBT(nbttagcompound); nbttagcompound.remove("x"); nbttagcompound.remove("y"); @@ -151,7 +151,7 @@ public class BlockBanner extends BlockContainer { TileEntityBanner tileentitybanner = (TileEntityBanner)te; ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor()); - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns()); itemstack.setTagInfo("BlockEntityTag", nbttagcompound); spawnAsEntity(worldIn, pos, itemstack); diff --git a/common/src/main/java/common/dimension/Dimension.java b/common/src/main/java/common/dimension/Dimension.java index bc650d7..cedcb4e 100755 --- a/common/src/main/java/common/dimension/Dimension.java +++ b/common/src/main/java/common/dimension/Dimension.java @@ -11,9 +11,9 @@ import common.init.BlockRegistry; import common.init.Blocks; import common.init.MetalType; import common.init.UniverseRegistry; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagStringList; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagStringList; +import common.nbt.TagObjectList; import common.util.ExtMath; import common.util.Vec3; import common.world.State; @@ -802,15 +802,15 @@ public abstract class Dimension extends Nameable implements Comparable= UniverseRegistry.MORE_DIM_ID) ? this.toNbt() : new NBTTagCompound(); + private final TagObject toNbt(boolean generator, boolean partialGen, boolean all) { + TagObject tag = (all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) ? this.toNbt() : new TagObject(); if(this == Space.INSTANCE) { if(generator || partialGen) tag.setLong("Seed", this.seed); @@ -1158,51 +1158,51 @@ public abstract class Dimension extends Nameable implements Comparable getEnchantments(ItemStack stack) { Map map = Maps.newLinkedHashMap(); - NBTTagTagList nbttaglist = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList(); + TagObjectList nbttaglist = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList(); if (nbttaglist != null) { @@ -92,7 +92,7 @@ public class EnchantmentHelper */ public static void setEnchantments(Map enchMap, ItemStack stack) { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); Iterator iterator = enchMap.keySet().iterator(); while (iterator.hasNext()) @@ -102,7 +102,7 @@ public class EnchantmentHelper if (enchantment != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setShort("id", (short)i); nbttagcompound.setShort("lvl", (short)enchMap.get(i).intValue()); nbttaglist.add(nbttagcompound); @@ -161,7 +161,7 @@ public class EnchantmentHelper { if (stack != null) { - NBTTagTagList nbttaglist = stack.getEnchantmentTagList(); + TagObjectList nbttaglist = stack.getEnchantmentTagList(); if (nbttaglist != null) { diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index 1705276..8c716bc 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -27,9 +27,9 @@ import common.init.UniverseRegistry; import common.item.Item; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagDoubleList; -import common.nbt.NBTTagFloatList; +import common.nbt.TagObject; +import common.nbt.TagDoubleList; +import common.nbt.TagFloatList; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -1424,7 +1424,7 @@ public abstract class Entity * Like writeToNBTOptional but does not check if the entity is ridden. Used for saving ridden entities with their * riders. */ - public boolean writeMountToNBT(NBTTagCompound tagCompund) + public boolean writeMountToNBT(TagObject tagCompund) { String s = EntityRegistry.getEntityString(this); @@ -1445,7 +1445,7 @@ public abstract class Entity * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their * rider. */ - public boolean writeToNBTOptional(NBTTagCompound tagCompund) + public boolean writeToNBTOptional(TagObject tagCompund) { String s = EntityRegistry.getEntityString(this); @@ -1488,7 +1488,7 @@ public abstract class Entity /** * Save the entity to NBT (calls an abstract helper method to write extra data) */ - public void writeToNBT(NBTTagCompound tagCompund) + public void writeToNBT(TagObject tagCompund) { // if(this.persistentId != 0L) { // tagCompund.setLong("PersistID", this.persistentId); @@ -1525,7 +1525,7 @@ public abstract class Entity if (this.vehicle != null && !(this.isPlayer())) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); if (this.vehicle.writeMountToNBT(nbttagcompound)) { @@ -1537,15 +1537,15 @@ public abstract class Entity /** * Reads the entity from NBT (calls an abstract helper method to read specialized data) */ - public void readFromNBT(NBTTagCompound tagCompund) + public void readFromNBT(TagObject tagCompund) { // if(tagCompund.hasLong("PersistID")) // this.setPersistentId(tagCompund.getLong("PersistID")); // this.setTag(tagCompund.getString("ObjectTag")); - NBTTagDoubleList nbttaglist = tagCompund.getDoubleList("Pos"); - NBTTagDoubleList nbttaglist1 = tagCompund.getDoubleList("Motion"); - NBTTagFloatList nbttaglist2 = tagCompund.getFloatList("Rotation"); + TagDoubleList nbttaglist = tagCompund.getDoubleList("Pos"); + TagDoubleList nbttaglist1 = tagCompund.getDoubleList("Motion"); + TagFloatList nbttaglist2 = tagCompund.getFloatList("Rotation"); this.motionX = nbttaglist1.get(0); this.motionY = nbttaglist1.get(1); this.motionZ = nbttaglist1.get(2); @@ -1614,12 +1614,12 @@ public abstract class Entity /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected abstract void readEntityFromNBT(NBTTagCompound tagCompund); + protected abstract void readEntityFromNBT(TagObject tagCompund); /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected abstract void writeEntityToNBT(NBTTagCompound tagCompound); + protected abstract void writeEntityToNBT(TagObject tagCompound); public void onChunkLoad() { @@ -1628,9 +1628,9 @@ public abstract class Entity /** * creates a NBT list from the array of doubles passed to this function */ - protected NBTTagDoubleList newDoubleNBTList(double... numbers) + protected TagDoubleList newDoubleNBTList(double... numbers) { - NBTTagDoubleList nbttaglist = new NBTTagDoubleList(); + TagDoubleList nbttaglist = new TagDoubleList(); for (double d0 : numbers) { @@ -1643,9 +1643,9 @@ public abstract class Entity /** * Returns a new NBTTagList filled with the specified floats */ - protected NBTTagFloatList newFloatNBTList(float... numbers) + protected TagFloatList newFloatNBTList(float... numbers) { - NBTTagFloatList nbttaglist = new NBTTagFloatList(); + TagFloatList nbttaglist = new TagFloatList(); for (float f : numbers) { @@ -2350,7 +2350,7 @@ public abstract class Entity */ public void copyDataFromOld(Entity entityIn) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); entityIn.writeToNBT(nbttagcompound); this.readFromNBT(nbttagcompound); // this.portalTimer = entityIn.portalTimer; @@ -2612,7 +2612,7 @@ public abstract class Entity return new BlockPos(this.posX, this.posY + 0.5D, this.posZ); } - public NBTTagCompound getNBTTagCompound() + public TagObject getNBTTagCompound() { return null; } @@ -2620,7 +2620,7 @@ public abstract class Entity /** * Called when client receives entity's NBTTagCompound from server. */ - public void clientUpdateEntityNBT(NBTTagCompound compound) + public void clientUpdateEntityNBT(TagObject compound) { } diff --git a/common/src/main/java/common/entity/EntityTrackerEntry.java b/common/src/main/java/common/entity/EntityTrackerEntry.java index fa99ad1..08c333e 100755 --- a/common/src/main/java/common/entity/EntityTrackerEntry.java +++ b/common/src/main/java/common/entity/EntityTrackerEntry.java @@ -12,7 +12,7 @@ import common.entity.projectile.EntityArrow; import common.entity.types.EntityLiving; import common.item.ItemStack; import common.log.Log; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.packet.SPacketEntityRelMove; import common.packet.SPacketEntityLook; @@ -296,7 +296,7 @@ public class EntityTrackerEntry { .sendPacket(new SPacketEntityMetadata(this.trackedEntity.getId(), this.trackedEntity.getDataWatcher(), true)); } - NBTTagCompound nbttagcompound = this.trackedEntity.getNBTTagCompound(); + TagObject nbttagcompound = this.trackedEntity.getNBTTagCompound(); if(nbttagcompound != null) { playerMP.connection.sendPacket(new SPacketUpdateEntityNBT(this.trackedEntity.getId(), nbttagcompound)); diff --git a/common/src/main/java/common/entity/animal/EntityBat.java b/common/src/main/java/common/entity/animal/EntityBat.java index a6c0d96..f5e86f2 100755 --- a/common/src/main/java/common/entity/animal/EntityBat.java +++ b/common/src/main/java/common/entity/animal/EntityBat.java @@ -8,7 +8,7 @@ import common.entity.npc.Alignment; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.SoundEvent; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.world.World; @@ -248,7 +248,7 @@ public class EntityBat extends EntityLiving /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.dataWatcher.updateObject(16, Byte.valueOf(tagCompund.getByte("BatFlags"))); @@ -257,7 +257,7 @@ public class EntityBat extends EntityLiving /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(16)); diff --git a/common/src/main/java/common/entity/animal/EntityChicken.java b/common/src/main/java/common/entity/animal/EntityChicken.java index 5e9bc8d..2954b0e 100755 --- a/common/src/main/java/common/entity/animal/EntityChicken.java +++ b/common/src/main/java/common/entity/animal/EntityChicken.java @@ -17,7 +17,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.ExtMath; import common.world.World; @@ -175,7 +175,7 @@ public class EntityChicken extends EntityAnimal /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.chickenJockey = tagCompund.getBool("IsChickenJockey"); @@ -193,7 +193,7 @@ public class EntityChicken extends EntityAnimal /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setBool("IsChickenJockey", this.chickenJockey); diff --git a/common/src/main/java/common/entity/animal/EntityDragonPart.java b/common/src/main/java/common/entity/animal/EntityDragonPart.java index c78dc53..cb481bb 100755 --- a/common/src/main/java/common/entity/animal/EntityDragonPart.java +++ b/common/src/main/java/common/entity/animal/EntityDragonPart.java @@ -4,7 +4,7 @@ import common.entity.DamageSource; import common.entity.Entity; import common.entity.EntityType; import common.entity.types.IEntityMultiPart; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class EntityDragonPart extends Entity { @@ -27,14 +27,14 @@ public class EntityDragonPart extends Entity /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { } diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index aac894f..345bd7f 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -31,8 +31,8 @@ import common.item.Item; import common.item.ItemMonsterPlacer; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.pathfinding.PathNavigateGround; import common.potion.Potion; import common.util.BlockPos; @@ -1387,7 +1387,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setBool("EatingHaystack", this.isEatingHaystack()); @@ -1402,7 +1402,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (this.isChested()) { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 2; i < this.horseChest.getSizeInventory(); ++i) { @@ -1410,7 +1410,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (itemstack != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); itemstack.writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); @@ -1422,19 +1422,19 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (this.horseChest.getStackInSlot(1) != null) { - tagCompound.setTag("ArmorItem", this.horseChest.getStackInSlot(1).writeToNBT(new NBTTagCompound())); + tagCompound.setTag("ArmorItem", this.horseChest.getStackInSlot(1).writeToNBT(new TagObject())); } if (this.horseChest.getStackInSlot(0) != null) { - tagCompound.setTag("SaddleItem", this.horseChest.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + tagCompound.setTag("SaddleItem", this.horseChest.getStackInSlot(0).writeToNBT(new TagObject())); } } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setEatingHaystack(tagCompund.getBool("EatingHaystack")); @@ -1466,12 +1466,12 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (this.isChested()) { - NBTTagTagList nbttaglist = tagCompund.getTagList("Items"); + TagObjectList nbttaglist = tagCompund.getTagList("Items"); this.initHorseChest(); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 2 && j < this.horseChest.getSizeInventory()) diff --git a/common/src/main/java/common/entity/animal/EntityOcelot.java b/common/src/main/java/common/entity/animal/EntityOcelot.java index 4cce764..4de9912 100755 --- a/common/src/main/java/common/entity/animal/EntityOcelot.java +++ b/common/src/main/java/common/entity/animal/EntityOcelot.java @@ -26,7 +26,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathNavigateGround; import common.world.World; @@ -123,7 +123,7 @@ public class EntityOcelot extends EntityTameable /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("CatType", this.getTameSkin()); @@ -132,7 +132,7 @@ public class EntityOcelot extends EntityTameable /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setTameSkin(tagCompund.getInt("CatType")); diff --git a/common/src/main/java/common/entity/animal/EntityPig.java b/common/src/main/java/common/entity/animal/EntityPig.java index 91e9307..4edd929 100755 --- a/common/src/main/java/common/entity/animal/EntityPig.java +++ b/common/src/main/java/common/entity/animal/EntityPig.java @@ -17,7 +17,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathNavigateGround; import common.world.World; @@ -69,7 +69,7 @@ public class EntityPig extends EntityAnimal /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setBool("Saddle", this.getSaddled()); @@ -78,7 +78,7 @@ public class EntityPig extends EntityAnimal /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setSaddled(tagCompund.getBool("Saddle")); diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index caef843..f95aac9 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -33,7 +33,7 @@ import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathEntity; import common.pathfinding.PathNavigateGround; import common.potion.Potion; @@ -198,13 +198,13 @@ public class EntityRabbit extends EntityAnimal { this.getEntityAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D); } - public void writeEntityToNBT(NBTTagCompound tagCompound) { + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("RabbitType", this.getRabbitType()); tagCompound.setInt("MoreCarrotTicks", this.foodCooldown); } - public void readEntityFromNBT(NBTTagCompound tagCompund) { + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setRabbitType(tagCompund.getInt("RabbitType")); this.foodCooldown = tagCompund.getInt("MoreCarrotTicks"); diff --git a/common/src/main/java/common/entity/animal/EntitySheep.java b/common/src/main/java/common/entity/animal/EntitySheep.java index 22dd349..a069802 100755 --- a/common/src/main/java/common/entity/animal/EntitySheep.java +++ b/common/src/main/java/common/entity/animal/EntitySheep.java @@ -29,7 +29,7 @@ import common.inventory.InventoryCrafting; import common.item.Item; import common.item.ItemShears; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.util.ExtMath; @@ -210,7 +210,7 @@ public class EntitySheep extends EntityAnimal /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setBool("Sheared", this.getSheared()); @@ -220,7 +220,7 @@ public class EntitySheep extends EntityAnimal /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setSheared(tagCompund.getBool("Sheared")); diff --git a/common/src/main/java/common/entity/animal/EntityWolf.java b/common/src/main/java/common/entity/animal/EntityWolf.java index 932f1da..c2e594e 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -31,7 +31,7 @@ import common.item.Item; import common.item.ItemFood; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathNavigateGround; import common.util.ExtMath; import common.world.World; @@ -139,7 +139,7 @@ public class EntityWolf extends EntityTameable /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setBool("Angry", this.isAngry()); @@ -149,7 +149,7 @@ public class EntityWolf extends EntityTameable /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setAngry(tagCompund.getBool("Angry")); diff --git a/common/src/main/java/common/entity/item/EntityBoat.java b/common/src/main/java/common/entity/item/EntityBoat.java index 7fb57b2..f1be550 100755 --- a/common/src/main/java/common/entity/item/EntityBoat.java +++ b/common/src/main/java/common/entity/item/EntityBoat.java @@ -15,7 +15,7 @@ import common.init.ItemRegistry; import common.init.Items; import common.item.Item; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -501,14 +501,14 @@ public class EntityBoat extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { } diff --git a/common/src/main/java/common/entity/item/EntityCart.java b/common/src/main/java/common/entity/item/EntityCart.java index 8f3580b..7192818 100755 --- a/common/src/main/java/common/entity/item/EntityCart.java +++ b/common/src/main/java/common/entity/item/EntityCart.java @@ -13,7 +13,7 @@ import common.init.Config; import common.init.Items; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.tileentity.IWorldNameable; import common.util.BlockPos; import common.util.BoundingBox; @@ -753,7 +753,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { if (tagCompund.getBool("CustomDisplayTile")) { @@ -798,7 +798,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { if (this.hasDisplayTile()) { diff --git a/common/src/main/java/common/entity/item/EntityCartContainer.java b/common/src/main/java/common/entity/item/EntityCartContainer.java index cefd14a..a223a33 100755 --- a/common/src/main/java/common/entity/item/EntityCartContainer.java +++ b/common/src/main/java/common/entity/item/EntityCartContainer.java @@ -7,8 +7,8 @@ import common.init.Config; import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.tileentity.ILockableContainer; import common.tileentity.LockCode; import common.util.BlockPos; @@ -187,16 +187,16 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.minecartContainerItems.length; ++i) { if (this.minecartContainerItems[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.minecartContainerItems[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); @@ -209,15 +209,15 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); - NBTTagTagList nbttaglist = tagCompund.getTagList("Items"); + TagObjectList nbttaglist = tagCompund.getTagList("Items"); this.minecartContainerItems = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.minecartContainerItems.length) diff --git a/common/src/main/java/common/entity/item/EntityCrystal.java b/common/src/main/java/common/entity/item/EntityCrystal.java index d7b4073..e41845f 100755 --- a/common/src/main/java/common/entity/item/EntityCrystal.java +++ b/common/src/main/java/common/entity/item/EntityCrystal.java @@ -3,7 +3,7 @@ package common.entity.item; import common.entity.DamageSource; import common.entity.Entity; import common.entity.EntityType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public class EntityCrystal extends Entity @@ -63,14 +63,14 @@ public class EntityCrystal extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { } diff --git a/common/src/main/java/common/entity/item/EntityExplosion.java b/common/src/main/java/common/entity/item/EntityExplosion.java index 48263e9..0001db4 100755 --- a/common/src/main/java/common/entity/item/EntityExplosion.java +++ b/common/src/main/java/common/entity/item/EntityExplosion.java @@ -2,7 +2,7 @@ package common.entity.item; import common.entity.Entity; import common.entity.EntityType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.Explosion; import common.world.World; @@ -62,13 +62,13 @@ public class EntityExplosion extends Entity Explosion.doExplosionAlgo3(this.worldObj, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, this.rand, min + 6.0d, min); } - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { tagCompound.setInt("Progress", this.progress); tagCompound.setInt("Radius", this.radius); } - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { this.progress = tagCompund.getInt("Progress"); this.radius = tagCompund.getInt("Radius"); diff --git a/common/src/main/java/common/entity/item/EntityFalling.java b/common/src/main/java/common/entity/item/EntityFalling.java index 866f929..12181ba 100755 --- a/common/src/main/java/common/entity/item/EntityFalling.java +++ b/common/src/main/java/common/entity/item/EntityFalling.java @@ -15,8 +15,8 @@ import common.init.BlockRegistry; import common.init.Blocks; import common.init.Config; import common.item.ItemStack; -import common.nbt.NBTBase; -import common.nbt.NBTTagCompound; +import common.nbt.Tag; +import common.nbt.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.ExtMath; @@ -33,7 +33,7 @@ public class EntityFalling extends Entity implements IObjectData private boolean hurtEntities; private int fallHurtMax = 40; private float fallHurtAmount = 2.0F; - public NBTTagCompound tileEntityData; + public TagObject tileEntityData; public EntityFalling(World worldIn) { @@ -148,12 +148,12 @@ public class EntityFalling extends Entity implements IObjectData if (tileentity != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); tileentity.writeToNBT(nbttagcompound); for (String s : this.tileEntityData.getKeySet()) { - NBTBase nbtbase = this.tileEntityData.get(s); + Tag nbtbase = this.tileEntityData.get(s); if (!s.equals("x") && !s.equals("y") && !s.equals("z")) { @@ -228,7 +228,7 @@ public class EntityFalling extends Entity implements IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air; String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(block); @@ -249,7 +249,7 @@ public class EntityFalling extends Entity implements IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { int i = tagCompund.getByte("Data") & 255; diff --git a/common/src/main/java/common/entity/item/EntityFireworks.java b/common/src/main/java/common/entity/item/EntityFireworks.java index cf0707a..8313f66 100755 --- a/common/src/main/java/common/entity/item/EntityFireworks.java +++ b/common/src/main/java/common/entity/item/EntityFireworks.java @@ -5,7 +5,7 @@ import common.entity.EntityType; import common.init.SoundEvent; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.ExtMath; import common.world.AWorldClient; import common.world.World; @@ -51,8 +51,8 @@ public class EntityFireworks extends Entity if (givenItem != null && givenItem.hasTagCompound()) { this.dataWatcher.updateObject(8, givenItem); - NBTTagCompound nbttagcompound = givenItem.getTagCompound(); - NBTTagCompound nbttagcompound1 = nbttagcompound.getTag("Fireworks"); + TagObject nbttagcompound = givenItem.getTagCompound(); + TagObject nbttagcompound1 = nbttagcompound.getTag("Fireworks"); if (nbttagcompound1 != null) { @@ -151,7 +151,7 @@ public class EntityFireworks extends Entity if (id == 17 && this.worldObj.client) { ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); - NBTTagCompound nbttagcompound = null; + TagObject nbttagcompound = null; if (itemstack != null && itemstack.hasTagCompound()) { @@ -167,7 +167,7 @@ public class EntityFireworks extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setInt("Life", this.fireworkAge); tagCompound.setInt("LifeTime", this.lifetime); @@ -175,7 +175,7 @@ public class EntityFireworks extends Entity if (itemstack != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); itemstack.writeToNBT(nbttagcompound); tagCompound.setTag("FireworksItem", nbttagcompound); } @@ -184,11 +184,11 @@ public class EntityFireworks extends Entity /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.fireworkAge = tagCompund.getInt("Life"); this.lifetime = tagCompund.getInt("LifeTime"); - NBTTagCompound nbttagcompound = tagCompund.getTag("FireworksItem"); + TagObject nbttagcompound = tagCompund.getTag("FireworksItem"); if (nbttagcompound != null) { diff --git a/common/src/main/java/common/entity/item/EntityHopperCart.java b/common/src/main/java/common/entity/item/EntityHopperCart.java index fe75575..7f88bad 100755 --- a/common/src/main/java/common/entity/item/EntityHopperCart.java +++ b/common/src/main/java/common/entity/item/EntityHopperCart.java @@ -11,7 +11,7 @@ import common.init.ItemRegistry; import common.inventory.Container; import common.inventory.ContainerHopper; import common.inventory.InventoryPlayer; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.tileentity.IHopper; import common.tileentity.TileEntityHopper; import common.util.BlockPos; @@ -201,7 +201,7 @@ public class EntityHopperCart extends EntityCartContainer implements IHopper /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("TransferCooldown", this.transferTicker); @@ -210,7 +210,7 @@ public class EntityHopperCart extends EntityCartContainer implements IHopper /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.transferTicker = tagCompund.getInt("TransferCooldown"); diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index 75f90dc..5c74418 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -14,7 +14,7 @@ import common.init.SoundEvent; import common.item.ItemStack; import common.log.Log; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.util.PortalType; @@ -342,7 +342,7 @@ public class EntityItem extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("Health", (short)((byte)this.health)); tagCompound.setShort("Age", (short)this.age); @@ -360,14 +360,14 @@ public class EntityItem extends Entity if (this.getEntityItem() != null) { - tagCompound.setTag("Item", this.getEntityItem().writeToNBT(new NBTTagCompound())); + tagCompound.setTag("Item", this.getEntityItem().writeToNBT(new TagObject())); } } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.health = tagCompund.getShort("Health") & 255; this.age = tagCompund.getShort("Age"); @@ -384,7 +384,7 @@ public class EntityItem extends Entity // this.thrower = tagCompund.getString("Thrower"); // } - NBTTagCompound nbttagcompound = tagCompund.getTag("Item"); + TagObject nbttagcompound = tagCompund.getTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); if (this.getEntityItem() == null) diff --git a/common/src/main/java/common/entity/item/EntityLeashKnot.java b/common/src/main/java/common/entity/item/EntityLeashKnot.java index 08b8882..49133ac 100755 --- a/common/src/main/java/common/entity/item/EntityLeashKnot.java +++ b/common/src/main/java/common/entity/item/EntityLeashKnot.java @@ -9,7 +9,7 @@ import common.entity.types.EntityLiving; import common.init.Items; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -375,7 +375,7 @@ public class EntityLeashKnot extends Entity * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their * rider. */ - public boolean writeToNBTOptional(NBTTagCompound tagCompund) + public boolean writeToNBTOptional(TagObject tagCompund) { return false; } @@ -383,14 +383,14 @@ public class EntityLeashKnot extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { } diff --git a/common/src/main/java/common/entity/item/EntityNuke.java b/common/src/main/java/common/entity/item/EntityNuke.java index e7af37c..e03bb67 100755 --- a/common/src/main/java/common/entity/item/EntityNuke.java +++ b/common/src/main/java/common/entity/item/EntityNuke.java @@ -3,7 +3,7 @@ package common.entity.item; import common.entity.Entity; import common.entity.EntityType; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public class EntityNuke extends Entity @@ -93,12 +93,12 @@ public class EntityNuke extends Entity // Explosion.doExplosionAlgo3(this.worldObj, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, this.rand, min + 6.0d, min); // } - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { tagCompound.setInt("Fuse", this.fuse); } - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { this.fuse = tagCompund.getInt("Fuse"); } diff --git a/common/src/main/java/common/entity/item/EntityTnt.java b/common/src/main/java/common/entity/item/EntityTnt.java index b68cb74..800f1b8 100755 --- a/common/src/main/java/common/entity/item/EntityTnt.java +++ b/common/src/main/java/common/entity/item/EntityTnt.java @@ -5,7 +5,7 @@ import common.entity.EntityType; import common.entity.types.EntityLiving; import common.entity.types.IObjectData; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public class EntityTnt extends Entity implements IObjectData @@ -109,7 +109,7 @@ public class EntityTnt extends Entity implements IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { tagCompound.setByte("Fuse", (byte)this.fuse); tagCompound.setByte("Power", (byte)this.explosionSize); @@ -118,7 +118,7 @@ public class EntityTnt extends Entity implements IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { this.fuse = tagCompund.getByte("Fuse"); this.explosionSize = ((int)tagCompund.getByte("Power")) & 7; diff --git a/common/src/main/java/common/entity/item/EntityTntCart.java b/common/src/main/java/common/entity/item/EntityTntCart.java index 345cf77..9c0445b 100755 --- a/common/src/main/java/common/entity/item/EntityTntCart.java +++ b/common/src/main/java/common/entity/item/EntityTntCart.java @@ -9,7 +9,7 @@ import common.init.Config; import common.init.SoundEvent; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.world.Explosion; import common.world.State; @@ -206,7 +206,7 @@ public class EntityTntCart extends EntityCart /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound tagCompund) + protected void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.minecartTNTFuse = tagCompund.getInt("TNTFuse"); @@ -215,7 +215,7 @@ public class EntityTntCart extends EntityCart /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound tagCompound) + protected void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("TNTFuse", this.minecartTNTFuse); diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index a097b69..25b2225 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -10,7 +10,7 @@ import common.entity.types.IObjectData; import common.init.Config; import common.init.SoundEvent; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.util.PortalType; @@ -293,7 +293,7 @@ public class EntityXp extends Entity implements IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("Health", (short)((byte)this.xpOrbHealth)); tagCompound.setShort("Age", (short)this.xpOrbAge); @@ -303,7 +303,7 @@ public class EntityXp extends Entity implements IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.xpOrbHealth = tagCompund.getShort("Health") & 255; this.xpOrbAge = tagCompund.getShort("Age"); diff --git a/common/src/main/java/common/entity/npc/EntityGargoyle.java b/common/src/main/java/common/entity/npc/EntityGargoyle.java index 294c450..b48b6ea 100755 --- a/common/src/main/java/common/entity/npc/EntityGargoyle.java +++ b/common/src/main/java/common/entity/npc/EntityGargoyle.java @@ -6,7 +6,7 @@ import common.entity.DamageSource; import common.init.Config; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.world.World; @@ -35,13 +35,13 @@ public class EntityGargoyle extends EntityFlyingNPC this.dataWatcher.addObject(23, 0); } - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("Invul", this.getInvulTime()); } - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setInvulTime(tagCompund.getInt("Invul")); diff --git a/common/src/main/java/common/entity/npc/EntityHaunter.java b/common/src/main/java/common/entity/npc/EntityHaunter.java index 17d7d53..f8fc069 100755 --- a/common/src/main/java/common/entity/npc/EntityHaunter.java +++ b/common/src/main/java/common/entity/npc/EntityHaunter.java @@ -9,7 +9,7 @@ import common.init.Config; import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.world.World; import common.world.AWorldServer; @@ -58,7 +58,7 @@ public class EntityHaunter extends EntityNPC { /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); @@ -74,7 +74,7 @@ public class EntityHaunter extends EntityNPC { /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setCharged(tagCompund.getBool("Charge")); diff --git a/common/src/main/java/common/entity/npc/EntityMobNPC.java b/common/src/main/java/common/entity/npc/EntityMobNPC.java index 4504a52..d876c50 100755 --- a/common/src/main/java/common/entity/npc/EntityMobNPC.java +++ b/common/src/main/java/common/entity/npc/EntityMobNPC.java @@ -6,7 +6,7 @@ import common.attributes.Attributes; import common.entity.DamageSource; import common.entity.Entity; import common.entity.types.EntityLiving; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public abstract class EntityMobNPC extends EntityNPC @@ -107,7 +107,7 @@ public abstract class EntityMobNPC extends EntityNPC /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setShort("Anger", (short)this.angerLevel); @@ -125,7 +125,7 @@ public abstract class EntityMobNPC extends EntityNPC /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.angerLevel = tagCompund.getShort("Anger"); diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index b765e54..21afa0f 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -67,8 +67,8 @@ import common.item.ItemStack; import common.item.ItemSword; import common.item.ItemTool; import common.model.ParticleType; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.network.IClientPlayer; import common.network.IPlayer; import common.packet.CPacketPlayerPosition; @@ -3380,7 +3380,7 @@ public abstract class EntityNPC extends EntityLiving /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { // super.readEntityFromNBT(tagCompund); super.readEntityFromNBT(tagCompund); @@ -3390,7 +3390,7 @@ public abstract class EntityNPC extends EntityLiving // } if(tagCompund.hasTagList("Equipment")) { - NBTTagTagList nbttaglist = tagCompund.getTagList("Equipment"); + TagObjectList nbttaglist = tagCompund.getTagList("Equipment"); for(int i = 0; i < this.equipment.length; ++i) { this.equipment[i] = ItemStack.loadItemStackFromNBT(nbttaglist.get(i)); @@ -3423,7 +3423,7 @@ public abstract class EntityNPC extends EntityLiving this.setNpcClass(type); this.setHeight(tagCompund.hasFloat("Height") ? tagCompund.getFloat("Height") : this.getBaseSize()); - NBTTagTagList nbttaglist = tagCompund.getTagList("Items"); + TagObjectList nbttaglist = tagCompund.getTagList("Items"); for (int i = 0; i < nbttaglist.size(); ++i) { @@ -3448,7 +3448,7 @@ public abstract class EntityNPC extends EntityLiving if(this.isPlayer()) { // this.entityUniqueID = getOfflineUUID(this.user); - NBTTagTagList nbttaglist0 = tagCompund.getTagList("Inventory"); + TagObjectList nbttaglist0 = tagCompund.getTagList("Inventory"); this.inventory.readFromNBT(nbttaglist0); this.inventory.currentItem = tagCompund.getInt("SelectedItemSlot"); // this.sleeping = tagCompund.getBoolean("Sleeping"); @@ -3497,7 +3497,7 @@ public abstract class EntityNPC extends EntityLiving if (tagCompund.hasTagList("WarpItems")) { - NBTTagTagList nbttaglist1 = tagCompund.getTagList("WarpItems"); + TagObjectList nbttaglist1 = tagCompund.getTagList("WarpItems"); this.warpChest.loadInventoryFromNBT(nbttaglist1); } @@ -3518,7 +3518,7 @@ public abstract class EntityNPC extends EntityLiving /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { if(this.isPlayer()) { for (int z = 0; z < this.inventory.mainInventory.length; z++) @@ -3534,10 +3534,10 @@ public abstract class EntityNPC extends EntityLiving super.writeEntityToNBT(tagCompound); // tagCompound.setBoolean("CanPickUpLoot", this.canPickUpLoot()); - NBTTagTagList nbttaglist0 = new NBTTagTagList(); + TagObjectList nbttaglist0 = new TagObjectList(); for(int i = 0; i < this.equipment.length; ++i) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); if(this.equipment[i] != null) { this.equipment[i].writeToNBT(nbttagcompound); @@ -3559,7 +3559,7 @@ public abstract class EntityNPC extends EntityLiving if(type != null) tagCompound.setString("ClassType", this.species.classnames.inverse().get(type)); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.extraInventory.getSizeInventory(); ++i) { @@ -3567,7 +3567,7 @@ public abstract class EntityNPC extends EntityLiving if (itemstack != null) { - nbttaglist.add(itemstack.writeToNBT(new NBTTagCompound())); + nbttaglist.add(itemstack.writeToNBT(new TagObject())); } } @@ -3587,7 +3587,7 @@ public abstract class EntityNPC extends EntityLiving this.getAttributeMap().applyAttributeModifiers(itemstack.getAttributeModifiers(2), z, itemstack.stackSize); } } - tagCompound.setTagList("Inventory", this.inventory.writeToNBT(new NBTTagTagList())); + tagCompound.setTagList("Inventory", this.inventory.writeToNBT(new TagObjectList())); tagCompound.setInt("SelectedItemSlot", this.inventory.currentItem); // tagCompound.setBoolean("Sleeping", this.sleeping); // tagCompound.setShort("SleepTimer", (short)this.sleepTimer); @@ -3629,7 +3629,7 @@ public abstract class EntityNPC extends EntityLiving if (itemstack != null && itemstack.getItem() != null) { - tagCompound.setTag("SelectedItem", itemstack.writeToNBT(new NBTTagCompound())); + tagCompound.setTag("SelectedItem", itemstack.writeToNBT(new TagObject())); } // tagCompound.setString("Model", this.getModel().name); diff --git a/common/src/main/java/common/entity/npc/EntitySlime.java b/common/src/main/java/common/entity/npc/EntitySlime.java index 5adfed1..708e3df 100755 --- a/common/src/main/java/common/entity/npc/EntitySlime.java +++ b/common/src/main/java/common/entity/npc/EntitySlime.java @@ -10,7 +10,7 @@ import common.entity.types.EntityLiving; import common.init.Config; import common.init.SoundEvent; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.util.BlockPos; @@ -134,7 +134,7 @@ public class EntitySlime extends EntityNPC /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); // tagCompound.setInteger("Size", this.getSlimeSize() - 1); @@ -144,7 +144,7 @@ public class EntitySlime extends EntityNPC /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); // int i = tagCompund.getInteger("Size"); diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index f2fade8..f505c33 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -18,7 +18,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -471,7 +471,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("xTile", (short)this.xTile); tagCompound.setShort("yTile", (short)this.yTile); @@ -491,7 +491,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.xTile = tagCompund.getShort("xTile"); this.yTile = tagCompund.getShort("yTile"); diff --git a/common/src/main/java/common/entity/projectile/EntityBullet.java b/common/src/main/java/common/entity/projectile/EntityBullet.java index 2fa707f..3ae858c 100755 --- a/common/src/main/java/common/entity/projectile/EntityBullet.java +++ b/common/src/main/java/common/entity/projectile/EntityBullet.java @@ -11,7 +11,7 @@ import common.entity.types.IObjectData; import common.entity.types.IProjectile; import common.init.Config; import common.init.SoundEvent; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -347,13 +347,13 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData // this.doBlockCollisions(); } - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setInt("damage", this.damage); tagCompound.setInt("age", this.age); } - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.damage = tagCompund.getInt("damage"); this.age = tagCompund.getInt("age"); diff --git a/common/src/main/java/common/entity/projectile/EntityDie.java b/common/src/main/java/common/entity/projectile/EntityDie.java index d02fcb1..5b910a6 100755 --- a/common/src/main/java/common/entity/projectile/EntityDie.java +++ b/common/src/main/java/common/entity/projectile/EntityDie.java @@ -9,7 +9,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.ItemDie; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.HitPosition; import common.world.World; @@ -64,7 +64,7 @@ public class EntityDie extends EntityThrowable implements IObjectData return this.dataWatcher.getWatchableObjectInt(16); } - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("Sides", this.sides); @@ -72,7 +72,7 @@ public class EntityDie extends EntityThrowable implements IObjectData tagCompound.setBool("NoPickup", this.noPickup); } - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.sides = tagCompund.getInt("Sides"); diff --git a/common/src/main/java/common/entity/projectile/EntityDynamite.java b/common/src/main/java/common/entity/projectile/EntityDynamite.java index 1146bdb..f3b7314 100755 --- a/common/src/main/java/common/entity/projectile/EntityDynamite.java +++ b/common/src/main/java/common/entity/projectile/EntityDynamite.java @@ -9,7 +9,7 @@ import common.init.Config; import common.init.ItemRegistry; import common.init.Items; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.HitPosition; import common.world.World; @@ -59,13 +59,13 @@ public class EntityDynamite extends EntityThrowable implements IObjectData } } - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setByte("Power", (byte)this.explosionSize); } - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.explosionSize = ((int)tagCompund.getByte("Power")) & 7; diff --git a/common/src/main/java/common/entity/projectile/EntityFireball.java b/common/src/main/java/common/entity/projectile/EntityFireball.java index 056e3b0..3af3edc 100755 --- a/common/src/main/java/common/entity/projectile/EntityFireball.java +++ b/common/src/main/java/common/entity/projectile/EntityFireball.java @@ -3,7 +3,7 @@ package common.entity.projectile; import common.entity.DamageSource; import common.entity.types.EntityLiving; import common.init.Config; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.HitPosition; import common.world.World; @@ -56,7 +56,7 @@ public class EntityFireball extends EntityProjectile /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("ExplosionPower", this.explosionPower); @@ -65,7 +65,7 @@ public class EntityFireball extends EntityProjectile /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.explosionPower = tagCompund.getInt("ExplosionPower"); diff --git a/common/src/main/java/common/entity/projectile/EntityHook.java b/common/src/main/java/common/entity/projectile/EntityHook.java index 5e1f9d1..bf6410b 100755 --- a/common/src/main/java/common/entity/projectile/EntityHook.java +++ b/common/src/main/java/common/entity/projectile/EntityHook.java @@ -18,7 +18,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -121,7 +121,7 @@ public class EntityHook extends Entity implements IObjectData { } - public boolean writeToNBTOptional(NBTTagCompound tagCompund) + public boolean writeToNBTOptional(TagObject tagCompund) { return false; } @@ -517,7 +517,7 @@ public class EntityHook extends Entity implements IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("xTile", (short)this.xTile); tagCompound.setShort("yTile", (short)this.yTile); @@ -533,7 +533,7 @@ public class EntityHook extends Entity implements IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.xTile = tagCompund.getShort("xTile"); this.yTile = tagCompund.getShort("yTile"); diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index e8aad19..bde9b6e 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -7,7 +7,7 @@ import common.entity.types.EntityThrowable; import common.entity.types.IObjectData; import common.init.Items; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.potion.Potion; import common.potion.PotionEffect; import common.util.BlockPos; @@ -158,7 +158,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); @@ -180,13 +180,13 @@ public class EntityPotion extends EntityThrowable implements IObjectData /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); if (this.potionDamage != null) { - tagCompound.setTag("Potion", this.potionDamage.writeToNBT(new NBTTagCompound())); + tagCompound.setTag("Potion", this.potionDamage.writeToNBT(new TagObject())); } } diff --git a/common/src/main/java/common/entity/projectile/EntityProjectile.java b/common/src/main/java/common/entity/projectile/EntityProjectile.java index 6e73775..d4db08b 100755 --- a/common/src/main/java/common/entity/projectile/EntityProjectile.java +++ b/common/src/main/java/common/entity/projectile/EntityProjectile.java @@ -9,8 +9,8 @@ import common.entity.EntityType; import common.entity.types.EntityLiving; import common.init.BlockRegistry; import common.model.ParticleType; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagDoubleList; +import common.nbt.TagObject; +import common.nbt.TagDoubleList; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -254,7 +254,7 @@ public abstract class EntityProjectile extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("xTile", (short)this.xTile); tagCompound.setShort("yTile", (short)this.yTile); @@ -269,7 +269,7 @@ public abstract class EntityProjectile extends Entity /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.xTile = tagCompund.getShort("xTile"); this.yTile = tagCompund.getShort("yTile"); @@ -288,7 +288,7 @@ public abstract class EntityProjectile extends Entity if (tagCompund.hasDoubleList("direction")) { - NBTTagDoubleList nbttaglist = tagCompund.getDoubleList("direction"); + TagDoubleList nbttaglist = tagCompund.getDoubleList("direction"); this.motionX = nbttaglist.get(0); this.motionY = nbttaglist.get(1); this.motionZ = nbttaglist.get(2); diff --git a/common/src/main/java/common/entity/types/EntityAnimal.java b/common/src/main/java/common/entity/types/EntityAnimal.java index 67889f7..c10eb29 100755 --- a/common/src/main/java/common/entity/types/EntityAnimal.java +++ b/common/src/main/java/common/entity/types/EntityAnimal.java @@ -12,7 +12,7 @@ import common.init.Blocks; import common.init.Items; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.world.World; @@ -100,7 +100,7 @@ public abstract class EntityAnimal extends EntityLiving /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInt("InLove", this.inLove); @@ -109,7 +109,7 @@ public abstract class EntityAnimal extends EntityLiving /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); this.setInLove(tagCompund.getInt("InLove"), true); diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 5c54f45..409ff4b 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -47,8 +47,8 @@ import common.item.ItemArmor; import common.item.ItemMonsterPlacer; import common.item.ItemStack; import common.model.ParticleType; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.network.IPlayer; import common.packet.SPacketEntityAttach; import common.packet.SPacketAnimation; @@ -87,7 +87,7 @@ public abstract class EntityLiving extends Entity private EntitySenses senses; private boolean leashed; private Entity leashedTo; - private NBTTagCompound leashTag; + private TagObject leashTag; public float prevCamPitch; public float camPitch; @@ -539,7 +539,7 @@ public abstract class EntityLiving extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setInt("Health", this.getHealth()); // tagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth()))); @@ -569,7 +569,7 @@ public abstract class EntityLiving extends Entity if (!this.effects.isEmpty()) { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (PotionEffect potioneffect : this.effects.values()) { @@ -582,7 +582,7 @@ public abstract class EntityLiving extends Entity tagCompound.setBool("Leashed", this.leashed); if(this.leashedTo != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + TagObject nbttagcompound1 = new TagObject(); // if(this.leashedTo.isPlayer()) { // nbttagcompound1.setString("PlayerName", ((EntityNPC)this.leashedTo).getUser()); @@ -609,7 +609,7 @@ public abstract class EntityLiving extends Entity /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.setAbsorptionAmount(tagCompund.getInt("Absorption")); @@ -620,11 +620,11 @@ public abstract class EntityLiving extends Entity if (tagCompund.hasTagList("ActiveEffects")) { - NBTTagTagList nbttaglist = tagCompund.getTagList("ActiveEffects"); + TagObjectList nbttaglist = tagCompund.getTagList("ActiveEffects"); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); PotionEffect potioneffect = PotionEffect.fromNbt(nbttagcompound); if (potioneffect != null && !potioneffect.getPotion().isInstant()) diff --git a/common/src/main/java/common/entity/types/EntityTameable.java b/common/src/main/java/common/entity/types/EntityTameable.java index f67ca74..c35e5c0 100755 --- a/common/src/main/java/common/entity/types/EntityTameable.java +++ b/common/src/main/java/common/entity/types/EntityTameable.java @@ -2,7 +2,7 @@ package common.entity.types; import common.ai.EntityAISit; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public abstract class EntityTameable extends EntityAnimal implements IEntityOwnable @@ -25,7 +25,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { super.writeEntityToNBT(tagCompound); @@ -45,7 +45,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { super.readEntityFromNBT(tagCompund); // String s = ""; diff --git a/common/src/main/java/common/entity/types/EntityThrowable.java b/common/src/main/java/common/entity/types/EntityThrowable.java index 1faa87d..1c3b509 100755 --- a/common/src/main/java/common/entity/types/EntityThrowable.java +++ b/common/src/main/java/common/entity/types/EntityThrowable.java @@ -9,7 +9,7 @@ import common.entity.EntityType; import common.init.BlockRegistry; import common.init.Blocks; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -303,7 +303,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound tagCompound) + public void writeEntityToNBT(TagObject tagCompound) { tagCompound.setShort("xTile", (short)this.xTile); tagCompound.setShort("yTile", (short)this.yTile); @@ -326,7 +326,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void readEntityFromNBT(TagObject tagCompund) { this.xTile = tagCompund.getShort("xTile"); this.yTile = tagCompund.getShort("yTile"); diff --git a/common/src/main/java/common/entity/types/EntityWeatherEffect.java b/common/src/main/java/common/entity/types/EntityWeatherEffect.java index 3604e81..a99b297 100755 --- a/common/src/main/java/common/entity/types/EntityWeatherEffect.java +++ b/common/src/main/java/common/entity/types/EntityWeatherEffect.java @@ -2,7 +2,7 @@ package common.entity.types; import common.entity.Entity; import common.entity.EntityType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public abstract class EntityWeatherEffect extends Entity { @@ -25,10 +25,10 @@ public abstract class EntityWeatherEffect extends Entity { protected final void entityInit() { } - protected final void readEntityFromNBT(NBTTagCompound tagCompund) { + protected final void readEntityFromNBT(TagObject tagCompund) { } - protected final void writeEntityToNBT(NBTTagCompound tagCompound) { + protected final void writeEntityToNBT(TagObject tagCompound) { } public final EntityType getType() { diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index deb5830..5820441 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -25,8 +25,8 @@ import common.item.Item; import common.item.ItemArmor; import common.item.ItemDye; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.tileentity.TileEntityBanner; import common.world.World; @@ -616,8 +616,8 @@ public abstract class CraftingRegistry } } - NBTTagCompound nbttagcompound1 = itemstack.getSubCompound("BlockEntityTag", true); - NBTTagTagList nbttaglist = null; + TagObject nbttagcompound1 = itemstack.getSubCompound("BlockEntityTag", true); + TagObjectList nbttaglist = null; if (nbttagcompound1.hasTagList("Patterns")) { @@ -625,11 +625,11 @@ public abstract class CraftingRegistry } else { - nbttaglist = new NBTTagTagList(); + nbttaglist = new TagObjectList(); nbttagcompound1.setTagList("Patterns", nbttaglist); } - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setString("Pattern", tileentitybanner$enumbannerpattern.getPatternID()); nbttagcompound.setInt("Color", k); nbttaglist.add(nbttagcompound); @@ -969,9 +969,9 @@ public abstract class CraftingRegistry if (l > 0) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObject nbttagcompound1 = new TagObject(); + TagObject nbttagcompound3 = new TagObject(); + TagObjectList nbttaglist = new TagObjectList(); for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2) { @@ -994,8 +994,8 @@ public abstract class CraftingRegistry else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) { this.field_92102_a = new ItemStack(Items.firework_charge); - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); + TagObject nbttagcompound2 = new TagObject(); byte b0 = 0; List list = Lists.newArrayList(); @@ -1080,7 +1080,7 @@ public abstract class CraftingRegistry if (this.field_92102_a != null && this.field_92102_a.hasTagCompound()) { - NBTTagCompound nbttagcompound4 = this.field_92102_a.getTagCompound().getTag("Explosion"); + TagObject nbttagcompound4 = this.field_92102_a.getTagCompound().getTag("Explosion"); if (nbttagcompound4 == null) { @@ -1552,7 +1552,7 @@ public abstract class CraftingRegistry if (itemstack1 != null && itemstack1.hasTagCompound()) { - itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy()); + itemstack.setTagCompound((TagObject)itemstack1.getTagCompound().copy()); } } } diff --git a/common/src/main/java/common/init/EntityRegistry.java b/common/src/main/java/common/init/EntityRegistry.java index d4c2695..20ff42d 100755 --- a/common/src/main/java/common/init/EntityRegistry.java +++ b/common/src/main/java/common/init/EntityRegistry.java @@ -49,7 +49,7 @@ import common.entity.projectile.EntitySnowball; import common.entity.types.EntityLiving; import common.entity.types.IObjectData; import common.log.Log; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.world.World; public abstract class EntityRegistry { @@ -117,7 +117,7 @@ public abstract class EntityRegistry { return entity; } - public static Entity createEntityFromNBT(NBTTagCompound nbt, World worldIn) { + public static Entity createEntityFromNBT(TagObject nbt, World worldIn) { Entity entity = null; // if("Minecart".equals(nbt.getString("id"))) { diff --git a/common/src/main/java/common/init/UniverseRegistry.java b/common/src/main/java/common/init/UniverseRegistry.java index ddb8587..3f4e5de 100755 --- a/common/src/main/java/common/init/UniverseRegistry.java +++ b/common/src/main/java/common/init/UniverseRegistry.java @@ -27,10 +27,10 @@ import common.dimension.Star; import common.dimension.Dimension.GeneratorType; import common.dimension.Dimension.ReplacerType; import common.log.Log; -import common.nbt.NBTException; -import common.nbt.NBTParser; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagException; +import common.nbt.TagInterpreter; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.rng.Random; import common.util.PortalType; import common.world.State; @@ -92,8 +92,8 @@ public abstract class UniverseRegistry { } } - public static void loadNbt(NBTTagCompound tag) { - NBTTagTagList list = tag.getTagList("Dimensions"); + public static void loadNbt(TagObject tag) { + TagObjectList list = tag.getTagList("Dimensions"); for(int z = 0; z < list.size(); z++) { Dimension dim = Dimension.getByNbt(list.get(z)); if(!REGISTRY.containsKey(dim.getDimensionId()) && !ALIASES.containsKey(dim.getDimensionName())) @@ -102,7 +102,7 @@ public abstract class UniverseRegistry { list = tag.getTagList("Names"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound data = list.get(z); + TagObject data = list.get(z); String id = data.getString("ID"); // if(BASE_ALIASES.containsKey(id)) { Dimension dim = ALIASES.get(id); @@ -113,7 +113,7 @@ public abstract class UniverseRegistry { list = tag.getTagList("Sectors"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound data = list.get(z); + TagObject data = list.get(z); String id = data.getString("ID"); Sector sector = SECTORS.get(id); if(sector == null) @@ -123,7 +123,7 @@ public abstract class UniverseRegistry { list = tag.getTagList("Galaxies"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound data = list.get(z); + TagObject data = list.get(z); String id = data.getString("ID"); Galaxy galaxy = GALAXIES.get(id); if(galaxy == null) @@ -133,7 +133,7 @@ public abstract class UniverseRegistry { list = tag.getTagList("Domains"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound data = list.get(z); + TagObject data = list.get(z); String id = data.getString("ID"); Domain domain = DOMAINS.get(id); if(domain == null) @@ -143,16 +143,16 @@ public abstract class UniverseRegistry { list = tag.getTagList("Barycenters"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound link = list.get(z); + TagObject link = list.get(z); if(!assign(link.getString("Celestial"), link.getString("Center"))) Log.TICK.warn("Konnte '" + link.getString("Celestial") + "' nicht zu '" + link.getString("Center") + "' zuweisen"); } } - public static NBTTagCompound saveNbt() { - NBTTagCompound tag = new NBTTagCompound(); + public static TagObject saveNbt() { + TagObject tag = new TagObject(); - NBTTagTagList list = new NBTTagTagList(); + TagObjectList list = new TagObjectList(); for(Dimension dim : DIMENSIONS) { if(!BASE_REGISTRY.containsKey(dim.getDimensionId()) && dim != Space.INSTANCE) list.add(dim.toNbt()); @@ -160,10 +160,10 @@ public abstract class UniverseRegistry { if(!list.isEmpty()) tag.setTagList("Dimensions", list); - list = new NBTTagTagList(); + list = new TagObjectList(); for(Dimension dim : DIMENSIONS) { if(/* BASE_REGISTRY.containsKey(dim.getDimensionId()) */ dim != Space.INSTANCE) { - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); dim.writeNbt(data); if(!data.isEmpty()) { data.setString("ID", dim.getDimensionName()); @@ -174,9 +174,9 @@ public abstract class UniverseRegistry { if(!list.isEmpty()) tag.setTagList("Names", list); - list = new NBTTagTagList(); + list = new TagObjectList(); for(Sector sector : SECTORS.values()) { - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); sector.writeNbt(data); if(!data.isEmpty()) { data.setString("ID", sector.id); @@ -186,9 +186,9 @@ public abstract class UniverseRegistry { if(!list.isEmpty()) tag.setTagList("Sectors", list); - list = new NBTTagTagList(); + list = new TagObjectList(); for(Galaxy galaxy : GALAXIES.values()) { - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); galaxy.writeNbt(data); if(!data.isEmpty()) { data.setString("ID", galaxy.id); @@ -198,9 +198,9 @@ public abstract class UniverseRegistry { if(!list.isEmpty()) tag.setTagList("Galaxies", list); - list = new NBTTagTagList(); + list = new TagObjectList(); for(Domain domain : DOMAINS.values()) { - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); domain.writeNbt(data); if(!data.isEmpty()) { data.setString("ID", domain.id); @@ -210,11 +210,11 @@ public abstract class UniverseRegistry { if(!list.isEmpty()) tag.setTagList("Domains", list); - list = new NBTTagTagList(); + list = new TagObjectList(); for(Entry entry : MOON_MAP.entrySet()) { if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId())) continue; - NBTTagCompound link = new NBTTagCompound(); + TagObject link = new TagObject(); link.setString("Celestial", entry.getKey().getDimensionName()); link.setString("Center", entry.getValue().getDimensionName()); list.add(link); @@ -222,7 +222,7 @@ public abstract class UniverseRegistry { for(Entry entry : PLANET_MAP.entrySet()) { if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId())) continue; - NBTTagCompound link = new NBTTagCompound(); + TagObject link = new TagObject(); link.setString("Celestial", entry.getKey().getDimensionName()); link.setString("Center", entry.getValue().getDimensionName()); list.add(link); @@ -230,7 +230,7 @@ public abstract class UniverseRegistry { for(Entry entry : STAR_MAP.entrySet()) { if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId())) continue; - NBTTagCompound link = new NBTTagCompound(); + TagObject link = new TagObject(); link.setString("Celestial", entry.getKey().getDimensionName()); link.setString("Center", entry.getValue().id); list.add(link); @@ -238,7 +238,7 @@ public abstract class UniverseRegistry { for(Entry entry : SECTOR_MAP.entrySet()) { if(BASE_MAP.containsKey(entry.getKey().id)) continue; - NBTTagCompound link = new NBTTagCompound(); + TagObject link = new TagObject(); link.setString("Celestial", entry.getKey().id); link.setString("Center", entry.getValue().id); list.add(link); @@ -246,7 +246,7 @@ public abstract class UniverseRegistry { for(Entry entry : AREA_MAP.entrySet()) { if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId())) continue; - NBTTagCompound link = new NBTTagCompound(); + TagObject link = new TagObject(); link.setString("Celestial", entry.getKey().getDimensionName()); link.setString("Center", entry.getValue().id); list.add(link); @@ -701,14 +701,14 @@ public abstract class UniverseRegistry { private static Dimension addPreset(String name, String base, String data) { Dimension dim = BASE_ALIASES.get(base).copy(UniverseRegistry.MORE_DIM_ID, "preset"); - NBTTagCompound ptag; + TagObject ptag; try { - ptag = NBTParser.parseTag("{" + data + "}"); + ptag = TagInterpreter.parseTag("{" + data + "}"); } - catch(NBTException e) { + catch(TagException e) { throw new RuntimeException(e); } - NBTTagCompound dtag = dim.toNbt(true); + TagObject dtag = dim.toNbt(true); if(ptag.getBool("ClearGenerator")) { ptag.remove("ClearGenerator"); dtag.remove("FloorBlock"); diff --git a/common/src/main/java/common/inventory/InventoryHelper.java b/common/src/main/java/common/inventory/InventoryHelper.java index 43d6151..487dba2 100755 --- a/common/src/main/java/common/inventory/InventoryHelper.java +++ b/common/src/main/java/common/inventory/InventoryHelper.java @@ -3,7 +3,7 @@ package common.inventory; import common.entity.Entity; import common.entity.item.EntityItem; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.util.BlockPos; import common.world.World; @@ -55,7 +55,7 @@ public class InventoryHelper if (stack.hasTagCompound()) { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy()); + entityitem.getEntityItem().setTagCompound((TagObject)stack.getTagCompound().copy()); } float f3 = 0.05F; diff --git a/common/src/main/java/common/inventory/InventoryPlayer.java b/common/src/main/java/common/inventory/InventoryPlayer.java index ed01d0b..464638e 100755 --- a/common/src/main/java/common/inventory/InventoryPlayer.java +++ b/common/src/main/java/common/inventory/InventoryPlayer.java @@ -5,8 +5,8 @@ import common.entity.npc.EntityNPC; import common.item.Item; import common.item.ItemArmor; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; public class InventoryPlayer implements IInventory { @@ -216,7 +216,7 @@ public class InventoryPlayer implements IInventory if (itemStackIn.hasTagCompound()) { - this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); + this.mainInventory[j].setTagCompound((TagObject)itemStackIn.getTagCompound().copy()); } } @@ -450,13 +450,13 @@ public class InventoryPlayer implements IInventory * * @param nbtTagListIn List to append tags to */ - public NBTTagTagList writeToNBT(NBTTagTagList nbtTagListIn) + public TagObjectList writeToNBT(TagObjectList nbtTagListIn) { for (int i = 0; i < this.mainInventory.length; ++i) { if (this.mainInventory[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.mainInventory[i].writeToNBT(nbttagcompound); nbtTagListIn.add(nbttagcompound); @@ -467,7 +467,7 @@ public class InventoryPlayer implements IInventory { if (this.armorInventory[j] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + TagObject nbttagcompound1 = new TagObject(); nbttagcompound1.setByte("Slot", (byte)(j + 100)); this.armorInventory[j].writeToNBT(nbttagcompound1); nbtTagListIn.add(nbttagcompound1); @@ -482,14 +482,14 @@ public class InventoryPlayer implements IInventory * * @param nbtTagListIn tagList to read from */ - public void readFromNBT(NBTTagTagList nbtTagListIn) + public void readFromNBT(TagObjectList nbtTagListIn) { this.mainInventory = new ItemStack[36]; this.armorInventory = new ItemStack[4]; for (int i = 0; i < nbtTagListIn.size(); ++i) { - NBTTagCompound nbttagcompound = nbtTagListIn.get(i); + TagObject nbttagcompound = nbtTagListIn.get(i); int j = nbttagcompound.getByte("Slot") & 255; ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound); diff --git a/common/src/main/java/common/inventory/InventoryWarpChest.java b/common/src/main/java/common/inventory/InventoryWarpChest.java index b91161d..8ee6a11 100755 --- a/common/src/main/java/common/inventory/InventoryWarpChest.java +++ b/common/src/main/java/common/inventory/InventoryWarpChest.java @@ -3,8 +3,8 @@ package common.inventory; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; public class InventoryWarpChest extends InventoryBasic @@ -21,7 +21,7 @@ public class InventoryWarpChest extends InventoryBasic this.associatedChest = chestTileEntity; } - public void loadInventoryFromNBT(NBTTagTagList p_70486_1_) + public void loadInventoryFromNBT(TagObjectList p_70486_1_) { for (int i = 0; i < this.getSizeInventory(); ++i) { @@ -30,7 +30,7 @@ public class InventoryWarpChest extends InventoryBasic for (int k = 0; k < p_70486_1_.size(); ++k) { - NBTTagCompound nbttagcompound = p_70486_1_.get(k); + TagObject nbttagcompound = p_70486_1_.get(k); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.getSizeInventory()) @@ -40,9 +40,9 @@ public class InventoryWarpChest extends InventoryBasic } } - public NBTTagTagList saveInventoryToNBT() + public TagObjectList saveInventoryToNBT() { - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.getSizeInventory(); ++i) { @@ -50,7 +50,7 @@ public class InventoryWarpChest extends InventoryBasic if (itemstack != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); itemstack.writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 71c9535..3a4b4e7 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -16,7 +16,7 @@ import common.model.ItemMeshDefinition; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -105,7 +105,7 @@ public class Item /** * Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data */ - public boolean updateItemStackNBT(NBTTagCompound nbt) + public boolean updateItemStackNBT(TagObject nbt) { return false; } @@ -420,7 +420,7 @@ public class Item // private static final Set VALID_TAGS = Sets.newHashSet("Name", "ench", "RepairCost"); - protected final boolean validateNbt(NBTTagCompound tag) { + protected final boolean validateNbt(TagObject tag) { return true; } diff --git a/common/src/main/java/common/item/ItemArmor.java b/common/src/main/java/common/item/ItemArmor.java index b2cb3d2..16f32a7 100755 --- a/common/src/main/java/common/item/ItemArmor.java +++ b/common/src/main/java/common/item/ItemArmor.java @@ -20,7 +20,7 @@ import common.init.ToolMaterial; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.BoundingBox; import common.world.World; @@ -158,7 +158,7 @@ public class ItemArmor extends Item } else { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + TagObject nbttagcompound = stack.getTagCompound(); if (nbttagcompound != null && nbttagcompound.hasInt("color")) { @@ -181,7 +181,7 @@ public class ItemArmor extends Item { if (this.material.canBeDyed()) { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + TagObject nbttagcompound = stack.getTagCompound(); if (nbttagcompound != null) { @@ -208,11 +208,11 @@ public class ItemArmor extends Item } else { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + TagObject nbttagcompound = stack.getTagCompound(); if (nbttagcompound == null) { - nbttagcompound = new NBTTagCompound(); + nbttagcompound = new TagObject(); stack.setTagCompound(nbttagcompound); } diff --git a/common/src/main/java/common/item/ItemBanner.java b/common/src/main/java/common/item/ItemBanner.java index e56db80..3ac42d4 100755 --- a/common/src/main/java/common/item/ItemBanner.java +++ b/common/src/main/java/common/item/ItemBanner.java @@ -10,8 +10,8 @@ import common.init.Blocks; import common.model.ItemMeshDefinition; import common.model.Model; import common.model.ModelProvider; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.tileentity.TileEntity; import common.tileentity.TileEntityBanner; import common.util.BlockPos; @@ -96,15 +96,15 @@ public class ItemBanner extends ItemBlock */ public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { - NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); if (nbttagcompound != null && nbttagcompound.hasTagList("Patterns")) { - NBTTagTagList nbttaglist = nbttagcompound.getTagList("Patterns"); + TagObjectList nbttaglist = nbttagcompound.getTagList("Patterns"); for (int i = 0; i < nbttaglist.size() && i < 6; ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.get(i); + TagObject nbttagcompound1 = nbttaglist.get(i); DyeColor enumdyecolor = DyeColor.byDyeDamage(nbttagcompound1.getInt("Color")); TileEntityBanner.EnumBannerPattern pattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern")); @@ -137,9 +137,9 @@ public class ItemBanner extends ItemBlock { for (DyeColor enumdyecolor : DyeColor.values()) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null); - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + TagObject nbttagcompound1 = new TagObject(); nbttagcompound1.setTag("BlockEntityTag", nbttagcompound); ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage()); itemstack.setTagCompound(nbttagcompound1); @@ -157,7 +157,7 @@ public class ItemBanner extends ItemBlock private DyeColor getBaseColor(ItemStack stack) { - NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); DyeColor enumdyecolor = null; if (nbttagcompound != null && nbttagcompound.hasInt("Base")) diff --git a/common/src/main/java/common/item/ItemBlock.java b/common/src/main/java/common/item/ItemBlock.java index 2a0e781..12896e8 100755 --- a/common/src/main/java/common/item/ItemBlock.java +++ b/common/src/main/java/common/item/ItemBlock.java @@ -11,7 +11,7 @@ import common.init.Blocks; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; @@ -118,10 +118,10 @@ public class ItemBlock extends Item return false; } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + TagObject nbttagcompound = new TagObject(); + TagObject nbttagcompound1 = (TagObject)nbttagcompound.copy(); tileentity.writeToNBT(nbttagcompound); - NBTTagCompound nbttagcompound2 = (NBTTagCompound)p_179224_3_.getTagCompound().get("BlockEntityTag"); + TagObject nbttagcompound2 = (TagObject)p_179224_3_.getTagCompound().get("BlockEntityTag"); nbttagcompound.merge(nbttagcompound2); nbttagcompound.setInt("x", stack.getX()); nbttagcompound.setInt("y", stack.getY()); diff --git a/common/src/main/java/common/item/ItemEnchantedBook.java b/common/src/main/java/common/item/ItemEnchantedBook.java index 9324711..205d2e6 100755 --- a/common/src/main/java/common/item/ItemEnchantedBook.java +++ b/common/src/main/java/common/item/ItemEnchantedBook.java @@ -9,8 +9,8 @@ import common.enchantment.RngEnchantment; import common.entity.npc.EntityNPC; import common.init.Items; import common.model.ItemMeshDefinition; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.rng.Random; public class ItemEnchantedBook extends Item @@ -48,10 +48,10 @@ public class ItemEnchantedBook extends Item // return this.getEnchantments(stack).tagCount() > 0 ? ChatFormat.YELLOW : super.getColor(stack); // } - public NBTTagTagList getEnchantments(ItemStack stack) + public TagObjectList getEnchantments(ItemStack stack) { - NBTTagCompound nbttagcompound = stack.getTagCompound(); - return nbttagcompound != null && nbttagcompound.hasTagList("StoredEnchantments") ? nbttagcompound.getTagList("StoredEnchantments") : new NBTTagTagList(); + TagObject nbttagcompound = stack.getTagCompound(); + return nbttagcompound != null && nbttagcompound.hasTagList("StoredEnchantments") ? nbttagcompound.getTagList("StoredEnchantments") : new TagObjectList(); } /** @@ -60,7 +60,7 @@ public class ItemEnchantedBook extends Item public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { super.addInformation(stack, playerIn, tooltip); - NBTTagTagList nbttaglist = this.getEnchantments(stack); + TagObjectList nbttaglist = this.getEnchantments(stack); if (nbttaglist != null) { @@ -82,12 +82,12 @@ public class ItemEnchantedBook extends Item */ public void addEnchantment(ItemStack stack, RngEnchantment enchantment) { - NBTTagTagList nbttaglist = this.getEnchantments(stack); + TagObjectList nbttaglist = this.getEnchantments(stack); boolean flag = true; for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); if (nbttagcompound.getShort("id") == enchantment.enchantmentobj.effectId) { @@ -103,7 +103,7 @@ public class ItemEnchantedBook extends Item if (flag) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + TagObject nbttagcompound1 = new TagObject(); nbttagcompound1.setShort("id", (short)enchantment.enchantmentobj.effectId); nbttagcompound1.setShort("lvl", (short)enchantment.enchantmentLevel); nbttaglist.add(nbttagcompound1); @@ -111,7 +111,7 @@ public class ItemEnchantedBook extends Item if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new TagObject()); } stack.getTagCompound().setTagList("StoredEnchantments", nbttaglist); diff --git a/common/src/main/java/common/item/ItemFirework.java b/common/src/main/java/common/item/ItemFirework.java index 528a194..60779b4 100755 --- a/common/src/main/java/common/item/ItemFirework.java +++ b/common/src/main/java/common/item/ItemFirework.java @@ -5,8 +5,8 @@ import java.util.List; import common.collect.Lists; import common.entity.item.EntityFireworks; import common.entity.npc.EntityNPC; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; import common.util.Facing; import common.world.World; @@ -43,7 +43,7 @@ public class ItemFirework extends Item { if (stack.hasTagCompound()) { - NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Fireworks"); + TagObject nbttagcompound = stack.getTagCompound().getTag("Fireworks"); if (nbttagcompound != null) { @@ -52,13 +52,13 @@ public class ItemFirework extends Item tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight")); } - NBTTagTagList nbttaglist = nbttagcompound.getTagList("Explosions"); + TagObjectList nbttaglist = nbttagcompound.getTagList("Explosions"); if (nbttaglist != null && nbttaglist.size() > 0) { for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.get(i); + TagObject nbttagcompound1 = nbttaglist.get(i); List list = Lists.newArrayList(); ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list); diff --git a/common/src/main/java/common/item/ItemFireworkCharge.java b/common/src/main/java/common/item/ItemFireworkCharge.java index 04a24a3..b392429 100755 --- a/common/src/main/java/common/item/ItemFireworkCharge.java +++ b/common/src/main/java/common/item/ItemFireworkCharge.java @@ -6,7 +6,7 @@ import common.color.DyeColor; import common.entity.npc.EntityNPC; import common.model.Model; import common.model.ModelProvider; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class ItemFireworkCharge extends Item { @@ -22,7 +22,7 @@ public class ItemFireworkCharge extends Item { if (stack.hasTagCompound()) { - NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Explosion"); + TagObject nbttagcompound = stack.getTagCompound().getTag("Explosion"); if (nbttagcompound != null) { @@ -65,7 +65,7 @@ public class ItemFireworkCharge extends Item { if (stack.hasTagCompound()) { - NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Explosion"); + TagObject nbttagcompound = stack.getTagCompound().getTag("Explosion"); if (nbttagcompound != null) { @@ -74,7 +74,7 @@ public class ItemFireworkCharge extends Item } } - public static void addExplosionInfo(NBTTagCompound nbt, List tooltip) + public static void addExplosionInfo(TagObject nbt, List tooltip) { byte b0 = nbt.getByte("Type"); diff --git a/common/src/main/java/common/item/ItemStack.java b/common/src/main/java/common/item/ItemStack.java index b660c36..52a0572 100755 --- a/common/src/main/java/common/item/ItemStack.java +++ b/common/src/main/java/common/item/ItemStack.java @@ -19,9 +19,9 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.BlockRegistry; import common.init.ItemRegistry; -import common.nbt.NBTBase; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.Tag; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -46,7 +46,7 @@ public final class ItemStack /** * A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items */ - private NBTTagCompound stackTagCompound; + private TagObject stackTagCompound; private int itemDamage; /** Item frame this stack is on, or null if not on an item frame. */ @@ -114,7 +114,7 @@ public final class ItemStack return (amount / 1000000000) + "B+"; } - public static ItemStack loadItemStackFromNBT(NBTTagCompound nbt) + public static ItemStack loadItemStackFromNBT(TagObject nbt) { ItemStack itemstack = new ItemStack(); itemstack.readFromNBT(nbt); @@ -138,7 +138,7 @@ public final class ItemStack if (this.stackTagCompound != null) { - itemstack.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + itemstack.stackTagCompound = (TagObject)this.stackTagCompound.copy(); } this.stackSize -= amount; @@ -194,7 +194,7 @@ public final class ItemStack /** * Write the stack fields to a NBT object. Return the new NBT object. */ - public NBTTagCompound writeToNBT(NBTTagCompound nbt) + public TagObject writeToNBT(TagObject nbt) { String resourcelocation = ItemRegistry.REGISTRY.getNameForObject(this.item); nbt.setString("id", resourcelocation == null ? "air" : resourcelocation.toString()); @@ -212,7 +212,7 @@ public final class ItemStack /** * Read the stack fields from a NBT object. */ - public void readFromNBT(NBTTagCompound nbt) + public void readFromNBT(TagObject nbt) { if (nbt.hasString("id")) { @@ -450,7 +450,7 @@ public final class ItemStack if (this.stackTagCompound != null) { - itemstack.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + itemstack.stackTagCompound = (TagObject)this.stackTagCompound.copy(); } return itemstack; @@ -571,7 +571,7 @@ public final class ItemStack /** * Returns the NBTTagCompound of the ItemStack. */ - public NBTTagCompound getTagCompound() + public TagObject getTagCompound() { return this.stackTagCompound; } @@ -579,7 +579,7 @@ public final class ItemStack /** * Get an NBTTagCompound from this stack's NBT data. */ - public NBTTagCompound getSubCompound(String key, boolean create) + public TagObject getSubCompound(String key, boolean create) { if (this.stackTagCompound != null && this.stackTagCompound.hasTag(key)) { @@ -587,7 +587,7 @@ public final class ItemStack } else if (create) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); this.setTagInfo(key, nbttagcompound); return nbttagcompound; } @@ -597,7 +597,7 @@ public final class ItemStack } } - public NBTTagTagList getEnchantmentTagList() + public TagObjectList getEnchantmentTagList() { return this.stackTagCompound == null ? null : this.stackTagCompound.getTagList("ench"); } @@ -605,7 +605,7 @@ public final class ItemStack /** * Assigns a NBTTagCompound to the ItemStack, does not validate that only non-stackable items can have it. */ - public void setTagCompound(NBTTagCompound nbt) + public void setTagCompound(TagObject nbt) { this.stackTagCompound = nbt; } @@ -642,7 +642,7 @@ public final class ItemStack { if (this.stackTagCompound == null) { - this.stackTagCompound = new NBTTagCompound(); + this.stackTagCompound = new TagObject(); } // if (!this.stackTagCompound.hasTag("display")) @@ -842,7 +842,7 @@ public final class ItemStack { // if ((i1 & 1) == 0) // { - NBTTagTagList nbttaglist = this.getEnchantmentTagList(); + TagObjectList nbttaglist = this.getEnchantmentTagList(); if (nbttaglist != null) { @@ -1033,16 +1033,16 @@ public final class ItemStack { if (this.stackTagCompound == null) { - this.setTagCompound(new NBTTagCompound()); + this.setTagCompound(new TagObject()); } if (!this.stackTagCompound.hasTagList("ench")) { - this.stackTagCompound.setTagList("ench", new NBTTagTagList()); + this.stackTagCompound.setTagList("ench", new TagObjectList()); } - NBTTagTagList nbttaglist = this.stackTagCompound.getTagList("ench"); - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObjectList nbttaglist = this.stackTagCompound.getTagList("ench"); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setShort("id", (short)ench.effectId); nbttagcompound.setShort("lvl", (short)(/* (byte) */ level)); nbttaglist.add(nbttagcompound); @@ -1058,10 +1058,10 @@ public final class ItemStack if(!this.stackTagCompound.hasTagList("ench")) { return false; } - NBTTagTagList oldEnch = this.stackTagCompound.getTagList("ench"); - NBTTagTagList newEnch = new NBTTagTagList(); + TagObjectList oldEnch = this.stackTagCompound.getTagList("ench"); + TagObjectList newEnch = new TagObjectList(); boolean changed = false; - NBTTagCompound tag; + TagObject tag; for(int z = 0; z < oldEnch.size(); z++) { tag = oldEnch.get(z); if(tag.getShort("id") != ench.effectId) { @@ -1111,11 +1111,11 @@ public final class ItemStack return this.stackTagCompound != null && this.stackTagCompound.hasTagList("ench"); } - public void setTagInfo(String key, NBTBase value) + public void setTagInfo(String key, Tag value) { if (this.stackTagCompound == null) { - this.setTagCompound(new NBTTagCompound()); + this.setTagCompound(new TagObject()); } this.stackTagCompound.set(key, value); @@ -1179,7 +1179,7 @@ public final class ItemStack if (!this.hasTagCompound()) { - this.stackTagCompound = new NBTTagCompound(); + this.stackTagCompound = new TagObject(); } this.stackTagCompound.setInt("RepairCost", cost); diff --git a/common/src/main/java/common/nbt/NBTBase.java b/common/src/main/java/common/nbt/NBTBase.java deleted file mode 100755 index 7802273..0000000 --- a/common/src/main/java/common/nbt/NBTBase.java +++ /dev/null @@ -1,60 +0,0 @@ -package common.nbt; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - -public abstract class NBTBase { - protected static NBTBase createNewByType(byte id) { - switch(id) { - case 0: - return new NBTTagEnd(); - case 1: - return new NBTTagByte(); - case 2: - return new NBTTagShort(); - case 3: - return new NBTTagInt(); - case 4: - return new NBTTagLong(); - case 5: - return new NBTTagFloat(); - case 6: - return new NBTTagDouble(); - case 7: - return new NBTTagByteArray(); - case 8: - return new NBTTagString(); - case 9: - return new NBTTagStringList(); - case 10: - return new NBTTagCompound(); - case 11: - return new NBTTagIntArray(); - case 12: - return new NBTTagTagList(); - case 13: - return new NBTTagFloatList(); - case 14: - return new NBTTagDoubleList(); - case 15: - return new NBTTagIntArrayList(); - default: - return null; - } - } - - abstract void write(DataOutput output) throws IOException; - abstract void read(DataInput input, int depth, SizeTracker tracker) throws IOException; - public abstract String toString(); - protected abstract byte getId(); - public abstract NBTBase copy(); - - public boolean equals(Object other) { - return other instanceof NBTBase && this.getId() == ((NBTBase)other).getId(); - } - - public int hashCode() { - return this.getId(); - } -} diff --git a/common/src/main/java/common/nbt/NBTException.java b/common/src/main/java/common/nbt/NBTException.java deleted file mode 100755 index 4accf8a..0000000 --- a/common/src/main/java/common/nbt/NBTException.java +++ /dev/null @@ -1,7 +0,0 @@ -package common.nbt; - -public class NBTException extends Exception { - public NBTException(String message) { - super(message); - } -} diff --git a/common/src/main/java/common/nbt/NBTTagDoubleList.java b/common/src/main/java/common/nbt/NBTTagDoubleList.java deleted file mode 100644 index 5b0185a..0000000 --- a/common/src/main/java/common/nbt/NBTTagDoubleList.java +++ /dev/null @@ -1,27 +0,0 @@ -package common.nbt; - -public class NBTTagDoubleList extends NBTTagList { - protected byte getId() { - return 14; - } - - protected byte getType() { - return 6; - } - - protected NBTTagList createInstance() { - return new NBTTagDoubleList(); - } - - protected NBTTagDouble getDefault() { - return new NBTTagDouble(0.0); - } - - public double get(int index) { - return this.getElem(index).getDouble(); - } - - public void add(double value) { - this.addElem(new NBTTagDouble(value)); - } -} diff --git a/common/src/main/java/common/nbt/NBTTagFloatList.java b/common/src/main/java/common/nbt/NBTTagFloatList.java deleted file mode 100644 index 4459ce4..0000000 --- a/common/src/main/java/common/nbt/NBTTagFloatList.java +++ /dev/null @@ -1,27 +0,0 @@ -package common.nbt; - -public class NBTTagFloatList extends NBTTagList { - protected byte getId() { - return 13; - } - - protected byte getType() { - return 5; - } - - protected NBTTagList createInstance() { - return new NBTTagFloatList(); - } - - protected NBTTagFloat getDefault() { - return new NBTTagFloat(0.0f); - } - - public float get(int index) { - return this.getElem(index).getFloat(); - } - - public void add(float value) { - this.addElem(new NBTTagFloat(value)); - } -} diff --git a/common/src/main/java/common/nbt/NBTTagIntArrayList.java b/common/src/main/java/common/nbt/NBTTagIntArrayList.java deleted file mode 100644 index ad8eff0..0000000 --- a/common/src/main/java/common/nbt/NBTTagIntArrayList.java +++ /dev/null @@ -1,27 +0,0 @@ -package common.nbt; - -public class NBTTagIntArrayList extends NBTTagList { - protected byte getId() { - return 15; - } - - protected byte getType() { - return 11; - } - - protected NBTTagList createInstance() { - return new NBTTagIntArrayList(); - } - - protected NBTTagIntArray getDefault() { - return new NBTTagIntArray(new int[0]); - } - - public int[] get(int index) { - return this.getElem(index).getIntArray(); - } - - public void add(int[] value) { - this.addElem(new NBTTagIntArray(value)); - } -} diff --git a/common/src/main/java/common/nbt/NBTTagStringList.java b/common/src/main/java/common/nbt/NBTTagStringList.java deleted file mode 100644 index 411ecf6..0000000 --- a/common/src/main/java/common/nbt/NBTTagStringList.java +++ /dev/null @@ -1,27 +0,0 @@ -package common.nbt; - -public class NBTTagStringList extends NBTTagList { - protected byte getId() { - return 9; - } - - protected byte getType() { - return 8; - } - - protected NBTTagList createInstance() { - return new NBTTagStringList(); - } - - protected NBTTagString getDefault() { - return new NBTTagString(""); - } - - public String get(int index) { - return this.getElem(index).getString(); - } - - public void add(String value) { - this.addElem(new NBTTagString(value)); - } -} diff --git a/common/src/main/java/common/nbt/NBTTagTagList.java b/common/src/main/java/common/nbt/NBTTagTagList.java deleted file mode 100644 index 908e4ad..0000000 --- a/common/src/main/java/common/nbt/NBTTagTagList.java +++ /dev/null @@ -1,27 +0,0 @@ -package common.nbt; - -public class NBTTagTagList extends NBTTagList { - protected byte getId() { - return 12; - } - - protected byte getType() { - return 10; - } - - protected NBTTagList createInstance() { - return new NBTTagTagList(); - } - - protected NBTTagCompound getDefault() { - return new NBTTagCompound(); - } - - public NBTTagCompound get(int index) { - return this.getElem(index); - } - - public void add(NBTTagCompound value) { - this.addElem(value); - } -} diff --git a/common/src/main/java/common/nbt/Tag.java b/common/src/main/java/common/nbt/Tag.java new file mode 100755 index 0000000..0be932b --- /dev/null +++ b/common/src/main/java/common/nbt/Tag.java @@ -0,0 +1,60 @@ +package common.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public abstract class Tag { + protected static Tag createNewByType(byte id) { + switch(id) { + case 0: + return new TagNull(); + case 1: + return new TagByte(); + case 2: + return new TagShort(); + case 3: + return new TagInt(); + case 4: + return new TagLong(); + case 5: + return new TagFloat(); + case 6: + return new TagDouble(); + case 7: + return new TagByteArray(); + case 8: + return new TagString(); + case 9: + return new TagStringList(); + case 10: + return new TagObject(); + case 11: + return new TagIntArray(); + case 12: + return new TagObjectList(); + case 13: + return new TagFloatList(); + case 14: + return new TagDoubleList(); + case 15: + return new TagIntArrayList(); + default: + return null; + } + } + + abstract void write(DataOutput output) throws IOException; + abstract void read(DataInput input, int depth, SizeTracker tracker) throws IOException; + public abstract String toString(); + protected abstract byte getId(); + public abstract Tag copy(); + + public boolean equals(Object other) { + return other instanceof Tag && this.getId() == ((Tag)other).getId(); + } + + public int hashCode() { + return this.getId(); + } +} diff --git a/common/src/main/java/common/nbt/NBTTagByte.java b/common/src/main/java/common/nbt/TagByte.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagByte.java rename to common/src/main/java/common/nbt/TagByte.java index 893b942..13b9349 100755 --- a/common/src/main/java/common/nbt/NBTTagByte.java +++ b/common/src/main/java/common/nbt/TagByte.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagByte extends NBTBase +class TagByte extends Tag { private byte data; - NBTTagByte() + TagByte() { } - public NBTTagByte(byte data) + public TagByte(byte data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagByte extends NBTBase return "" + this.data + "b"; } - public NBTBase copy() + public Tag copy() { - return new NBTTagByte(this.data); + return new TagByte(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagByte nbttagbyte = (NBTTagByte)other; + TagByte nbttagbyte = (TagByte)other; return this.data == nbttagbyte.data; } else diff --git a/common/src/main/java/common/nbt/NBTTagByteArray.java b/common/src/main/java/common/nbt/TagByteArray.java similarity index 78% rename from common/src/main/java/common/nbt/NBTTagByteArray.java rename to common/src/main/java/common/nbt/TagByteArray.java index 9d8cca9..9adaf82 100755 --- a/common/src/main/java/common/nbt/NBTTagByteArray.java +++ b/common/src/main/java/common/nbt/TagByteArray.java @@ -5,13 +5,13 @@ import java.io.DataOutput; import java.io.IOException; import java.util.Arrays; -class NBTTagByteArray extends NBTBase { +class TagByteArray extends Tag { private byte[] data; - NBTTagByteArray() { + TagByteArray() { } - public NBTTagByteArray(byte[] data) { + public TagByteArray(byte[] data) { this.data = data; } @@ -36,14 +36,14 @@ class NBTTagByteArray extends NBTBase { return "[" + this.data.length + " bytes]"; } - public NBTBase copy() { + public Tag copy() { byte[] data = new byte[this.data.length]; System.arraycopy(this.data, 0, data, 0, this.data.length); - return new NBTTagByteArray(data); + return new TagByteArray(data); } public boolean equals(Object other) { - return super.equals(other) && Arrays.equals(this.data, ((NBTTagByteArray)other).data); + return super.equals(other) && Arrays.equals(this.data, ((TagByteArray)other).data); } public int hashCode() { diff --git a/common/src/main/java/common/nbt/NBTTagDouble.java b/common/src/main/java/common/nbt/TagDouble.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagDouble.java rename to common/src/main/java/common/nbt/TagDouble.java index e760b93..7330b2c 100755 --- a/common/src/main/java/common/nbt/NBTTagDouble.java +++ b/common/src/main/java/common/nbt/TagDouble.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagDouble extends NBTBase +class TagDouble extends Tag { private double data; - NBTTagDouble() + TagDouble() { } - public NBTTagDouble(double data) + public TagDouble(double data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagDouble extends NBTBase return "" + this.data + "d"; } - public NBTBase copy() + public Tag copy() { - return new NBTTagDouble(this.data); + return new TagDouble(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagDouble nbttagdouble = (NBTTagDouble)other; + TagDouble nbttagdouble = (TagDouble)other; return this.data == nbttagdouble.data; } else diff --git a/common/src/main/java/common/nbt/TagDoubleList.java b/common/src/main/java/common/nbt/TagDoubleList.java new file mode 100644 index 0000000..620aabf --- /dev/null +++ b/common/src/main/java/common/nbt/TagDoubleList.java @@ -0,0 +1,27 @@ +package common.nbt; + +public class TagDoubleList extends TagList { + protected byte getId() { + return 14; + } + + protected byte getType() { + return 6; + } + + protected TagList createInstance() { + return new TagDoubleList(); + } + + protected TagDouble getDefault() { + return new TagDouble(0.0); + } + + public double get(int index) { + return this.getElem(index).getDouble(); + } + + public void add(double value) { + this.addElem(new TagDouble(value)); + } +} diff --git a/common/src/main/java/common/nbt/TagException.java b/common/src/main/java/common/nbt/TagException.java new file mode 100755 index 0000000..697dd6a --- /dev/null +++ b/common/src/main/java/common/nbt/TagException.java @@ -0,0 +1,7 @@ +package common.nbt; + +public class TagException extends Exception { + public TagException(String message) { + super(message); + } +} diff --git a/common/src/main/java/common/nbt/NBTTagFloat.java b/common/src/main/java/common/nbt/TagFloat.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagFloat.java rename to common/src/main/java/common/nbt/TagFloat.java index 30df2df..4f0d209 100755 --- a/common/src/main/java/common/nbt/NBTTagFloat.java +++ b/common/src/main/java/common/nbt/TagFloat.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagFloat extends NBTBase +class TagFloat extends Tag { private float data; - NBTTagFloat() + TagFloat() { } - public NBTTagFloat(float data) + public TagFloat(float data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagFloat extends NBTBase return "" + this.data + "f"; } - public NBTBase copy() + public Tag copy() { - return new NBTTagFloat(this.data); + return new TagFloat(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagFloat nbttagfloat = (NBTTagFloat)other; + TagFloat nbttagfloat = (TagFloat)other; return this.data == nbttagfloat.data; } else diff --git a/common/src/main/java/common/nbt/TagFloatList.java b/common/src/main/java/common/nbt/TagFloatList.java new file mode 100644 index 0000000..7393920 --- /dev/null +++ b/common/src/main/java/common/nbt/TagFloatList.java @@ -0,0 +1,27 @@ +package common.nbt; + +public class TagFloatList extends TagList { + protected byte getId() { + return 13; + } + + protected byte getType() { + return 5; + } + + protected TagList createInstance() { + return new TagFloatList(); + } + + protected TagFloat getDefault() { + return new TagFloat(0.0f); + } + + public float get(int index) { + return this.getElem(index).getFloat(); + } + + public void add(float value) { + this.addElem(new TagFloat(value)); + } +} diff --git a/common/src/main/java/common/nbt/NBTTagInt.java b/common/src/main/java/common/nbt/TagInt.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagInt.java rename to common/src/main/java/common/nbt/TagInt.java index b15bbe2..77c3cd5 100755 --- a/common/src/main/java/common/nbt/NBTTagInt.java +++ b/common/src/main/java/common/nbt/TagInt.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagInt extends NBTBase +class TagInt extends Tag { private int data; - NBTTagInt() + TagInt() { } - public NBTTagInt(int data) + public TagInt(int data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagInt extends NBTBase return "" + this.data; } - public NBTBase copy() + public Tag copy() { - return new NBTTagInt(this.data); + return new TagInt(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagInt nbttagint = (NBTTagInt)other; + TagInt nbttagint = (TagInt)other; return this.data == nbttagint.data; } else diff --git a/common/src/main/java/common/nbt/NBTTagIntArray.java b/common/src/main/java/common/nbt/TagIntArray.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagIntArray.java rename to common/src/main/java/common/nbt/TagIntArray.java index cd9fb0b..3617857 100755 --- a/common/src/main/java/common/nbt/NBTTagIntArray.java +++ b/common/src/main/java/common/nbt/TagIntArray.java @@ -5,13 +5,13 @@ import java.io.DataOutput; import java.io.IOException; import java.util.Arrays; -class NBTTagIntArray extends NBTBase { +class TagIntArray extends Tag { private int[] data; - NBTTagIntArray() { + TagIntArray() { } - public NBTTagIntArray(int[] data) { + public TagIntArray(int[] data) { this.data = data; } @@ -44,14 +44,14 @@ class NBTTagIntArray extends NBTBase { return sb.append("]").toString(); } - public NBTBase copy() { + public Tag copy() { int[] data = new int[this.data.length]; System.arraycopy(this.data, 0, data, 0, this.data.length); - return new NBTTagIntArray(data); + return new TagIntArray(data); } public boolean equals(Object other) { - return super.equals(other) && Arrays.equals(this.data, ((NBTTagIntArray)other).data); + return super.equals(other) && Arrays.equals(this.data, ((TagIntArray)other).data); } public int hashCode() { diff --git a/common/src/main/java/common/nbt/TagIntArrayList.java b/common/src/main/java/common/nbt/TagIntArrayList.java new file mode 100644 index 0000000..e0a9ff3 --- /dev/null +++ b/common/src/main/java/common/nbt/TagIntArrayList.java @@ -0,0 +1,27 @@ +package common.nbt; + +public class TagIntArrayList extends TagList { + protected byte getId() { + return 15; + } + + protected byte getType() { + return 11; + } + + protected TagList createInstance() { + return new TagIntArrayList(); + } + + protected TagIntArray getDefault() { + return new TagIntArray(new int[0]); + } + + public int[] get(int index) { + return this.getElem(index).getIntArray(); + } + + public void add(int[] value) { + this.addElem(new TagIntArray(value)); + } +} diff --git a/common/src/main/java/common/nbt/NBTParser.java b/common/src/main/java/common/nbt/TagInterpreter.java similarity index 76% rename from common/src/main/java/common/nbt/NBTParser.java rename to common/src/main/java/common/nbt/TagInterpreter.java index 2b16630..f99f5cb 100755 --- a/common/src/main/java/common/nbt/NBTParser.java +++ b/common/src/main/java/common/nbt/TagInterpreter.java @@ -5,29 +5,29 @@ import java.util.regex.Pattern; import common.collect.Lists; -public class NBTParser +public class TagInterpreter { private static final Pattern PATTERN = Pattern.compile("\\[[-+\\d|,\\s]+\\]"); - public static NBTTagCompound parseTag(String jsonString) throws NBTException + public static TagObject parseTag(String jsonString) throws TagException { jsonString = jsonString.trim(); if (!jsonString.startsWith("{")) { - throw new NBTException("Invalid tag encountered, expected \'{\' as first char."); + throw new TagException("Invalid tag encountered, expected \'{\' as first char."); } else if (func_150310_b(jsonString) != 1) { - throw new NBTException("Encountered multiple top tags, only one expected"); + throw new TagException("Encountered multiple top tags, only one expected"); } else { - return (NBTTagCompound)func_150316_a("tag", jsonString).parse(); + return (TagObject)func_150316_a("tag", jsonString).parse(); } } - static int func_150310_b(String p_150310_0_) throws NBTException + static int func_150310_b(String p_150310_0_) throws TagException { int i = 0; boolean flag = false; @@ -43,7 +43,7 @@ public class NBTParser { if (!flag) { - throw new NBTException("Illegal use of \\\": " + p_150310_0_); + throw new TagException("Illegal use of \\\": " + p_150310_0_); } } else @@ -57,12 +57,12 @@ public class NBTParser { if (c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) { - throw new NBTException("Unbalanced curly brackets {}: " + p_150310_0_); + throw new TagException("Unbalanced curly brackets {}: " + p_150310_0_); } if (c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) { - throw new NBTException("Unbalanced square brackets []: " + p_150310_0_); + throw new TagException("Unbalanced square brackets []: " + p_150310_0_); } } else @@ -79,11 +79,11 @@ public class NBTParser if (flag) { - throw new NBTException("Unbalanced quotation: " + p_150310_0_); + throw new TagException("Unbalanced quotation: " + p_150310_0_); } else if (!stack.isEmpty()) { - throw new NBTException("Unbalanced brackets: " + p_150310_0_); + throw new TagException("Unbalanced brackets: " + p_150310_0_); } else { @@ -101,17 +101,17 @@ public class NBTParser // return func_150316_a(s1, s2); // } - static NBTParser.Any func_150316_a(String p_150316_0_, String p_150316_1_) throws NBTException + static TagInterpreter.Any func_150316_a(String p_150316_0_, String p_150316_1_) throws TagException { p_150316_1_ = p_150316_1_.trim(); if (p_150316_1_.startsWith("{")) { p_150316_1_ = p_150316_1_.substring(1, p_150316_1_.length() - 1); - NBTParser.Compound jsontonbt$compound; + TagInterpreter.Compound jsontonbt$compound; String s1; - for (jsontonbt$compound = new NBTParser.Compound(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s1.length() + 1)) + for (jsontonbt$compound = new TagInterpreter.Compound(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s1.length() + 1)) { s1 = func_150314_a(p_150316_1_, true); @@ -130,7 +130,7 @@ public class NBTParser if (c1 != 44 && c1 != 123 && c1 != 125 && c1 != 91 && c1 != 93) { - throw new NBTException("Unexpected token \'" + c1 + "\' at: " + p_150316_1_.substring(s1.length())); + throw new TagException("Unexpected token \'" + c1 + "\' at: " + p_150316_1_.substring(s1.length())); } } @@ -139,10 +139,10 @@ public class NBTParser else if (p_150316_1_.startsWith("[") && !PATTERN.matcher(p_150316_1_).matches()) { p_150316_1_ = p_150316_1_.substring(1, p_150316_1_.length() - 1); - NBTParser.List jsontonbt$list; + TagInterpreter.List jsontonbt$list; String s; - for (jsontonbt$list = new NBTParser.List(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s.length() + 1)) + for (jsontonbt$list = new TagInterpreter.List(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s.length() + 1)) { s = func_150314_a(p_150316_1_, false); @@ -161,7 +161,7 @@ public class NBTParser if (c0 != 44 && c0 != 123 && c0 != 125 && c0 != 91 && c0 != 93) { - throw new NBTException("Unexpected token \'" + c0 + "\' at: " + p_150316_1_.substring(s.length())); + throw new TagException("Unexpected token \'" + c0 + "\' at: " + p_150316_1_.substring(s.length())); } } @@ -169,18 +169,18 @@ public class NBTParser } else { - return new NBTParser.Primitive(p_150316_0_, p_150316_1_); + return new TagInterpreter.Primitive(p_150316_0_, p_150316_1_); } } - private static NBTParser.Any func_179270_a(String p_179270_0_, boolean p_179270_1_) throws NBTException + private static TagInterpreter.Any func_179270_a(String p_179270_0_, boolean p_179270_1_) throws TagException { String s = func_150313_b(p_179270_0_, p_179270_1_); String s1 = func_150311_c(p_179270_0_, p_179270_1_); return func_150316_a(s, s1); } - private static String func_150314_a(String p_150314_0_, boolean p_150314_1_) throws NBTException + private static String func_150314_a(String p_150314_0_, boolean p_150314_1_) throws TagException { int i = func_150312_a(p_150314_0_, ':'); int j = func_150312_a(p_150314_0_, ','); @@ -189,12 +189,12 @@ public class NBTParser { if (i == -1) { - throw new NBTException("Unable to locate name/value separator for string: " + p_150314_0_); + throw new TagException("Unable to locate name/value separator for string: " + p_150314_0_); } if (j != -1 && j < i) { - throw new NBTException("Name error at: " + p_150314_0_); + throw new TagException("Name error at: " + p_150314_0_); } } else if (i == -1 || i > j) @@ -205,7 +205,7 @@ public class NBTParser return func_179269_a(p_150314_0_, i); } - private static String func_179269_a(String p_179269_0_, int p_179269_1_) throws NBTException + private static String func_179269_a(String p_179269_0_, int p_179269_1_) throws TagException { Stack stack = new Stack(); int i = p_179269_1_ + 1; @@ -223,7 +223,7 @@ public class NBTParser { if (!flag) { - throw new NBTException("Illegal use of \\\": " + p_179269_0_); + throw new TagException("Illegal use of \\\": " + p_179269_0_); } } else @@ -247,12 +247,12 @@ public class NBTParser { if (c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) { - throw new NBTException("Unbalanced curly brackets {}: " + p_179269_0_); + throw new TagException("Unbalanced curly brackets {}: " + p_179269_0_); } if (c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) { - throw new NBTException("Unbalanced square brackets []: " + p_179269_0_); + throw new TagException("Unbalanced square brackets []: " + p_179269_0_); } if (c0 == 44 && stack.isEmpty()) @@ -280,7 +280,7 @@ public class NBTParser return p_179269_0_.substring(0, i); } - private static String func_150313_b(String p_150313_0_, boolean p_150313_1_) throws NBTException + private static String func_150313_b(String p_150313_0_, boolean p_150313_1_) throws TagException { if (p_150313_1_) { @@ -302,7 +302,7 @@ public class NBTParser } else { - throw new NBTException("Unable to locate name/value separator for string: " + p_150313_0_); + throw new TagException("Unable to locate name/value separator for string: " + p_150313_0_); } } else @@ -311,7 +311,7 @@ public class NBTParser } } - private static String func_150311_c(String p_150311_0_, boolean p_150311_1_) throws NBTException + private static String func_150311_c(String p_150311_0_, boolean p_150311_1_) throws TagException { if (p_150311_1_) { @@ -333,7 +333,7 @@ public class NBTParser } else { - throw new NBTException("Unable to locate name/value separator for string: " + p_150311_0_); + throw new TagException("Unable to locate name/value separator for string: " + p_150311_0_); } } else @@ -383,23 +383,23 @@ public class NBTParser { protected String json; - public abstract NBTBase parse() throws NBTException; + public abstract Tag parse() throws TagException; } - static class Compound extends NBTParser.Any + static class Compound extends TagInterpreter.Any { - protected java.util.List field_150491_b = Lists.newArrayList(); + protected java.util.List field_150491_b = Lists.newArrayList(); public Compound(String p_i45137_1_) { this.json = p_i45137_1_; } - public NBTBase parse() throws NBTException + public Tag parse() throws TagException { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); - for (NBTParser.Any jsontonbt$any : this.field_150491_b) + for (TagInterpreter.Any jsontonbt$any : this.field_150491_b) { nbttagcompound.set(jsontonbt$any.json, jsontonbt$any.parse()); } @@ -408,36 +408,36 @@ public class NBTParser } } - static class List extends NBTParser.Any + static class List extends TagInterpreter.Any { - protected java.util.List field_150492_b = Lists.newArrayList(); + protected java.util.List field_150492_b = Lists.newArrayList(); public List(String json) { this.json = json; } - public NBTBase parse() throws NBTException + public Tag parse() throws TagException { - NBTTagList nbttaglist = null; + TagList nbttaglist = null; - for (NBTParser.Any jsontonbt$any : this.field_150492_b) + for (TagInterpreter.Any jsontonbt$any : this.field_150492_b) { - NBTBase tag = jsontonbt$any.parse(); + Tag tag = jsontonbt$any.parse(); if(nbttaglist == null) { switch(tag.getId()) { case 8: - nbttaglist = new NBTTagStringList(); + nbttaglist = new TagStringList(); case 10: - nbttaglist = new NBTTagTagList(); + nbttaglist = new TagObjectList(); case 5: - nbttaglist = new NBTTagFloatList(); + nbttaglist = new TagFloatList(); case 6: - nbttaglist = new NBTTagDoubleList(); + nbttaglist = new TagDoubleList(); case 11: - nbttaglist = new NBTTagIntArrayList(); + nbttaglist = new TagIntArrayList(); default: - throw new NBTException("Type cannot be put in a list: " + jsontonbt$any.json); + throw new TagException("Type cannot be put in a list: " + jsontonbt$any.json); } } nbttaglist.addElem(tag); @@ -447,7 +447,7 @@ public class NBTParser } } - static class Primitive extends NBTParser.Any + static class Primitive extends TagInterpreter.Any { private static final Pattern DOUBLE = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[d|D]"); private static final Pattern FLOAT = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[f|F]"); @@ -465,54 +465,54 @@ public class NBTParser this.jsonValue = p_i45139_2_; } - public NBTBase parse() throws NBTException + public Tag parse() throws TagException { try { if (DOUBLE.matcher(this.jsonValue).matches()) { - return new NBTTagDouble(Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + return new TagDouble(Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1))); } if (FLOAT.matcher(this.jsonValue).matches()) { - return new NBTTagFloat(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + return new TagFloat(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1))); } if (BYTE.matcher(this.jsonValue).matches()) { - return new NBTTagByte(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + return new TagByte(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1))); } if (LONG.matcher(this.jsonValue).matches()) { - return new NBTTagLong(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + return new TagLong(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1))); } if (SHORT.matcher(this.jsonValue).matches()) { - return new NBTTagShort(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + return new TagShort(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1))); } if (INTEGER.matcher(this.jsonValue).matches()) { - return new NBTTagInt(Integer.parseInt(this.jsonValue)); + return new TagInt(Integer.parseInt(this.jsonValue)); } if (DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) { - return new NBTTagDouble(Double.parseDouble(this.jsonValue)); + return new TagDouble(Double.parseDouble(this.jsonValue)); } if (this.jsonValue.equalsIgnoreCase("true") || this.jsonValue.equalsIgnoreCase("false")) { - return new NBTTagByte((byte)(Boolean.parseBoolean(this.jsonValue) ? 1 : 0)); + return new TagByte((byte)(Boolean.parseBoolean(this.jsonValue) ? 1 : 0)); } } catch (NumberFormatException var6) { this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\""); - return new NBTTagString(this.jsonValue); + return new TagString(this.jsonValue); } if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) @@ -529,11 +529,11 @@ public class NBTParser aint[j] = Integer.parseInt(astring[j].trim()); } - return new NBTTagIntArray(aint); + return new TagIntArray(aint); } catch (NumberFormatException var5) { - return new NBTTagString(this.jsonValue); + return new TagString(this.jsonValue); } } else @@ -559,7 +559,7 @@ public class NBTParser } } - return new NBTTagString(stringbuilder.toString()); + return new TagString(stringbuilder.toString()); } } } diff --git a/common/src/main/java/common/nbt/NBTTagList.java b/common/src/main/java/common/nbt/TagList.java similarity index 86% rename from common/src/main/java/common/nbt/NBTTagList.java rename to common/src/main/java/common/nbt/TagList.java index 3426a06..4520362 100755 --- a/common/src/main/java/common/nbt/NBTTagList.java +++ b/common/src/main/java/common/nbt/TagList.java @@ -9,7 +9,7 @@ import java.util.List; import common.collect.Lists; import common.log.Log; -abstract class NBTTagList extends NBTBase { +abstract class TagList extends Tag { private List list = Lists.newArrayList(); void write(DataOutput output) throws IOException { @@ -27,7 +27,7 @@ abstract class NBTTagList extends NBTBase { tracker.read(4 * len); this.list = new ArrayList(len); for(int z = 0; z < len; z++) { - K tag = (K)NBTBase.createNewByType(this.getType()); + K tag = (K)Tag.createNewByType(this.getType()); tag.read(input, depth + 1, tracker); this.list.add(tag); } @@ -35,7 +35,7 @@ abstract class NBTTagList extends NBTBase { protected abstract byte getId(); protected abstract byte getType(); - protected abstract NBTTagList createInstance(); + protected abstract TagList createInstance(); protected abstract K getDefault(); public String toString() { @@ -76,8 +76,8 @@ abstract class NBTTagList extends NBTBase { return this.list.size(); } - public NBTBase copy() { - NBTTagList list = this.createInstance(); + public Tag copy() { + TagList list = this.createInstance(); for(K tag : this.list) { list.list.add((K)tag.copy()); } @@ -85,7 +85,7 @@ abstract class NBTTagList extends NBTBase { } public boolean equals(Object other) { - return super.equals(other) && this.list.equals(((NBTTagList)other).list); + return super.equals(other) && this.list.equals(((TagList)other).list); } public int hashCode() { diff --git a/common/src/main/java/common/nbt/NBTLoader.java b/common/src/main/java/common/nbt/TagLoader.java similarity index 67% rename from common/src/main/java/common/nbt/NBTLoader.java rename to common/src/main/java/common/nbt/TagLoader.java index 230b932..28304d1 100755 --- a/common/src/main/java/common/nbt/NBTLoader.java +++ b/common/src/main/java/common/nbt/TagLoader.java @@ -13,10 +13,10 @@ import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -public class NBTLoader { - public static NBTTagCompound readGZip(File file) throws IOException { +public class TagLoader { + public static TagObject readGZip(File file) throws IOException { DataInputStream in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)))); - NBTTagCompound tag; + TagObject tag; try { tag = read(in, SizeTracker.INFINITE); } @@ -26,7 +26,7 @@ public class NBTLoader { return tag; } - public static void writeGZip(NBTTagCompound tag, File file) throws IOException { + public static void writeGZip(TagObject tag, File file) throws IOException { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file)))); try { write(tag, out); @@ -36,13 +36,13 @@ public class NBTLoader { } } - public static NBTTagCompound read(DataInput in, SizeTracker tracker) throws IOException { - NBTTagCompound tag = new NBTTagCompound(); + public static TagObject read(DataInput in, SizeTracker tracker) throws IOException { + TagObject tag = new TagObject(); tag.read(in, 0, tracker); return tag; } - public static void write(NBTTagCompound tag, DataOutput out) throws IOException { + public static void write(TagObject tag, DataOutput out) throws IOException { tag.write(out); } } diff --git a/common/src/main/java/common/nbt/NBTTagLong.java b/common/src/main/java/common/nbt/TagLong.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagLong.java rename to common/src/main/java/common/nbt/TagLong.java index 469e7b4..9c275ec 100755 --- a/common/src/main/java/common/nbt/NBTTagLong.java +++ b/common/src/main/java/common/nbt/TagLong.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagLong extends NBTBase +class TagLong extends Tag { private long data; - NBTTagLong() + TagLong() { } - public NBTTagLong(long data) + public TagLong(long data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagLong extends NBTBase return "" + this.data + "L"; } - public NBTBase copy() + public Tag copy() { - return new NBTTagLong(this.data); + return new TagLong(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagLong nbttaglong = (NBTTagLong)other; + TagLong nbttaglong = (TagLong)other; return this.data == nbttaglong.data; } else diff --git a/common/src/main/java/common/nbt/NBTTagEnd.java b/common/src/main/java/common/nbt/TagNull.java similarity index 81% rename from common/src/main/java/common/nbt/NBTTagEnd.java rename to common/src/main/java/common/nbt/TagNull.java index 0b6ed6a..716b10a 100755 --- a/common/src/main/java/common/nbt/NBTTagEnd.java +++ b/common/src/main/java/common/nbt/TagNull.java @@ -4,7 +4,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagEnd extends NBTBase { +class TagNull extends Tag { void read(DataInput input, int depth, SizeTracker tracker) throws IOException { tracker.read(8); } @@ -20,7 +20,7 @@ class NBTTagEnd extends NBTBase { return "END"; } - public NBTBase copy() { - return new NBTTagEnd(); + public Tag copy() { + return new TagNull(); } } diff --git a/common/src/main/java/common/nbt/NBTTagCompound.java b/common/src/main/java/common/nbt/TagObject.java similarity index 60% rename from common/src/main/java/common/nbt/NBTTagCompound.java rename to common/src/main/java/common/nbt/TagObject.java index 9135f64..c40f421 100755 --- a/common/src/main/java/common/nbt/NBTTagCompound.java +++ b/common/src/main/java/common/nbt/TagObject.java @@ -10,12 +10,12 @@ import common.collect.Maps; import java.util.Set; -public class NBTTagCompound extends NBTBase { - private Map tags = Maps.newHashMap(); +public class TagObject extends Tag { + private Map tags = Maps.newHashMap(); void write(DataOutput output) throws IOException { for(String key : this.tags.keySet()) { - NBTBase tag = this.tags.get(key); + Tag tag = this.tags.get(key); output.writeByte(tag.getId()); if(tag.getId() != 0) { output.writeUTF(key); @@ -34,7 +34,7 @@ public class NBTTagCompound extends NBTBase { while((id = input.readByte()) != 0) { String key = input.readUTF(); tracker.read(28 + 2 * key.length()); - NBTBase tag = NBTBase.createNewByType(id); + Tag tag = Tag.createNewByType(id); tag.read(input, depth + 1, tracker); if(this.tags.put(key, tag) != null) tracker.read(36); @@ -49,80 +49,80 @@ public class NBTTagCompound extends NBTBase { return (byte)10; } - public void set(String key, NBTBase value) { + public void set(String key, Tag value) { this.tags.put(key, value); } - public void setTag(String key, NBTTagCompound value) { + public void setTag(String key, TagObject value) { this.tags.put(key, value); } - public void setFloatList(String key, NBTTagFloatList value) { + public void setFloatList(String key, TagFloatList value) { this.tags.put(key, value); } - public void setDoubleList(String key, NBTTagDoubleList value) { + public void setDoubleList(String key, TagDoubleList value) { this.tags.put(key, value); } - public void setStringList(String key, NBTTagStringList value) { + public void setStringList(String key, TagStringList value) { this.tags.put(key, value); } - public void setIntArrayList(String key, NBTTagIntArrayList value) { + public void setIntArrayList(String key, TagIntArrayList value) { this.tags.put(key, value); } - public void setTagList(String key, NBTTagTagList value) { + public void setTagList(String key, TagObjectList value) { this.tags.put(key, value); } public void setByte(String key, byte value) { - this.tags.put(key, new NBTTagByte(value)); + this.tags.put(key, new TagByte(value)); } public void setShort(String key, short value) { - this.tags.put(key, new NBTTagShort(value)); + this.tags.put(key, new TagShort(value)); } public void setInt(String key, int value) { - this.tags.put(key, new NBTTagInt(value)); + this.tags.put(key, new TagInt(value)); } public void setLong(String key, long value) { - this.tags.put(key, new NBTTagLong(value)); + this.tags.put(key, new TagLong(value)); } public void setFloat(String key, float value) { - this.tags.put(key, new NBTTagFloat(value)); + this.tags.put(key, new TagFloat(value)); } public void setDouble(String key, double value) { - this.tags.put(key, new NBTTagDouble(value)); + this.tags.put(key, new TagDouble(value)); } public void setString(String key, String value) { - this.tags.put(key, new NBTTagString(value)); + this.tags.put(key, new TagString(value)); } public void setByteArray(String key, byte[] value) { - this.tags.put(key, new NBTTagByteArray(value)); + this.tags.put(key, new TagByteArray(value)); } public void setIntArray(String key, int[] value) { - this.tags.put(key, new NBTTagIntArray(value)); + this.tags.put(key, new TagIntArray(value)); } public void setBool(String key, boolean value) { this.setByte(key, (byte)(value ? 1 : 0)); } - public NBTBase get(String key) { + public Tag get(String key) { return this.tags.get(key); } public byte getTagId(String key) { - NBTBase tag = this.tags.get(key); + Tag tag = this.tags.get(key); return tag != null ? tag.getId() : 0; } @@ -196,63 +196,63 @@ public class NBTTagCompound extends NBTBase { } public byte getByte(String key) { - return !this.hasKey(key, 1) ? 0 : ((NBTTagByte)this.tags.get(key)).getByte(); + return !this.hasKey(key, 1) ? 0 : ((TagByte)this.tags.get(key)).getByte(); } public short getShort(String key) { - return !this.hasKey(key, 2) ? 0 : ((NBTTagShort)this.tags.get(key)).getShort(); + return !this.hasKey(key, 2) ? 0 : ((TagShort)this.tags.get(key)).getShort(); } public int getInt(String key) { - return !this.hasKey(key, 3) ? 0 : ((NBTTagInt)this.tags.get(key)).getInt(); + return !this.hasKey(key, 3) ? 0 : ((TagInt)this.tags.get(key)).getInt(); } public long getLong(String key) { - return !this.hasKey(key, 4) ? 0L : ((NBTTagLong)this.tags.get(key)).getLong(); + return !this.hasKey(key, 4) ? 0L : ((TagLong)this.tags.get(key)).getLong(); } public float getFloat(String key) { - return !this.hasKey(key, 5) ? 0.0F : ((NBTTagFloat)this.tags.get(key)).getFloat(); + return !this.hasKey(key, 5) ? 0.0F : ((TagFloat)this.tags.get(key)).getFloat(); } public double getDouble(String key) { - return !this.hasKey(key, 6) ? 0.0D : ((NBTTagDouble)this.tags.get(key)).getDouble(); + return !this.hasKey(key, 6) ? 0.0D : ((TagDouble)this.tags.get(key)).getDouble(); } public String getString(String key) { - return !this.hasKey(key, 8) ? "" : ((NBTTagString)this.tags.get(key)).getString(); + return !this.hasKey(key, 8) ? "" : ((TagString)this.tags.get(key)).getString(); } public byte[] getByteArray(String key) { - return !this.hasKey(key, 7) ? new byte[0] : ((NBTTagByteArray)this.tags.get(key)).getByteArray(); + return !this.hasKey(key, 7) ? new byte[0] : ((TagByteArray)this.tags.get(key)).getByteArray(); } public int[] getIntArray(String key) { - return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray)this.tags.get(key)).getIntArray(); + return !this.hasKey(key, 11) ? new int[0] : ((TagIntArray)this.tags.get(key)).getIntArray(); } - public NBTTagCompound getTag(String key) { - return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound)this.tags.get(key); + public TagObject getTag(String key) { + return !this.hasKey(key, 10) ? new TagObject() : (TagObject)this.tags.get(key); } - public NBTTagFloatList getFloatList(String key) { - return !this.hasKey(key, 13) ? new NBTTagFloatList() : (NBTTagFloatList)this.tags.get(key); + public TagFloatList getFloatList(String key) { + return !this.hasKey(key, 13) ? new TagFloatList() : (TagFloatList)this.tags.get(key); } - public NBTTagDoubleList getDoubleList(String key) { - return !this.hasKey(key, 14) ? new NBTTagDoubleList() : (NBTTagDoubleList)this.tags.get(key); + public TagDoubleList getDoubleList(String key) { + return !this.hasKey(key, 14) ? new TagDoubleList() : (TagDoubleList)this.tags.get(key); } - public NBTTagStringList getStringList(String key) { - return !this.hasKey(key, 9) ? new NBTTagStringList() : (NBTTagStringList)this.tags.get(key); + public TagStringList getStringList(String key) { + return !this.hasKey(key, 9) ? new TagStringList() : (TagStringList)this.tags.get(key); } - public NBTTagIntArrayList getIntArrayList(String key) { - return !this.hasKey(key, 15) ? new NBTTagIntArrayList() : (NBTTagIntArrayList)this.tags.get(key); + public TagIntArrayList getIntArrayList(String key) { + return !this.hasKey(key, 15) ? new TagIntArrayList() : (TagIntArrayList)this.tags.get(key); } - public NBTTagTagList getTagList(String key) { - return !this.hasKey(key, 12) ? new NBTTagTagList() : (NBTTagTagList)this.tags.get(key); + public TagObjectList getTagList(String key) { + return !this.hasKey(key, 12) ? new TagObjectList() : (TagObjectList)this.tags.get(key); } public boolean getBool(String key) { @@ -265,7 +265,7 @@ public class NBTTagCompound extends NBTBase { public String toString() { StringBuilder sb = new StringBuilder("{"); - for(Entry entry : this.tags.entrySet()) { + for(Entry entry : this.tags.entrySet()) { if(sb.length() != 1) sb.append(','); sb.append(entry.getKey()).append(':').append(entry.getValue()); @@ -277,8 +277,8 @@ public class NBTTagCompound extends NBTBase { return this.tags.isEmpty(); } - public NBTBase copy() { - NBTTagCompound tag = new NBTTagCompound(); + public Tag copy() { + TagObject tag = new TagObject(); for(String s : this.tags.keySet()) { tag.set(s, this.tags.get(s).copy()); } @@ -286,7 +286,7 @@ public class NBTTagCompound extends NBTBase { } public boolean equals(Object other) { - return super.equals(other) && this.tags.entrySet().equals(((NBTTagCompound)other).tags.entrySet()); + return super.equals(other) && this.tags.entrySet().equals(((TagObject)other).tags.entrySet()); } public int hashCode() { @@ -298,13 +298,13 @@ public class NBTTagCompound extends NBTBase { * merged using the same methods, other types of tags are overwritten from the * given compound. */ - public void merge(NBTTagCompound other) { + public void merge(TagObject other) { for(String key : other.tags.keySet()) { - NBTBase tag = other.tags.get(key); + Tag tag = other.tags.get(key); if(tag.getId() == 10) { if(this.hasKey(key, 10)) { - NBTTagCompound comp = this.getTag(key); - comp.merge((NBTTagCompound)tag); + TagObject comp = this.getTag(key); + comp.merge((TagObject)tag); } else { this.set(key, tag.copy()); diff --git a/common/src/main/java/common/nbt/TagObjectList.java b/common/src/main/java/common/nbt/TagObjectList.java new file mode 100644 index 0000000..b7fd4a3 --- /dev/null +++ b/common/src/main/java/common/nbt/TagObjectList.java @@ -0,0 +1,27 @@ +package common.nbt; + +public class TagObjectList extends TagList { + protected byte getId() { + return 12; + } + + protected byte getType() { + return 10; + } + + protected TagList createInstance() { + return new TagObjectList(); + } + + protected TagObject getDefault() { + return new TagObject(); + } + + public TagObject get(int index) { + return this.getElem(index); + } + + public void add(TagObject value) { + this.addElem(value); + } +} diff --git a/common/src/main/java/common/nbt/NBTTagShort.java b/common/src/main/java/common/nbt/TagShort.java similarity index 81% rename from common/src/main/java/common/nbt/NBTTagShort.java rename to common/src/main/java/common/nbt/TagShort.java index 89370e7..db84b71 100755 --- a/common/src/main/java/common/nbt/NBTTagShort.java +++ b/common/src/main/java/common/nbt/TagShort.java @@ -4,15 +4,15 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagShort extends NBTBase +class TagShort extends Tag { private short data; - public NBTTagShort() + public TagShort() { } - public NBTTagShort(short data) + public TagShort(short data) { this.data = data; } @@ -38,16 +38,16 @@ class NBTTagShort extends NBTBase return "" + this.data + "s"; } - public NBTBase copy() + public Tag copy() { - return new NBTTagShort(this.data); + return new TagShort(this.data); } public boolean equals(Object other) { if (super.equals(other)) { - NBTTagShort nbttagshort = (NBTTagShort)other; + TagShort nbttagshort = (TagShort)other; return this.data == nbttagshort.data; } else diff --git a/common/src/main/java/common/nbt/NBTTagString.java b/common/src/main/java/common/nbt/TagString.java similarity index 82% rename from common/src/main/java/common/nbt/NBTTagString.java rename to common/src/main/java/common/nbt/TagString.java index bda3e44..4d9b035 100755 --- a/common/src/main/java/common/nbt/NBTTagString.java +++ b/common/src/main/java/common/nbt/TagString.java @@ -4,14 +4,14 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -class NBTTagString extends NBTBase { +class TagString extends Tag { private String data; - public NBTTagString() { + public TagString() { this.data = ""; } - public NBTTagString(String data) { + public TagString(String data) { if(data == null) throw new IllegalArgumentException("null is not allowed"); this.data = data; @@ -35,14 +35,14 @@ class NBTTagString extends NBTBase { return "\"" + this.data.replace("\"", "\\\"") + "\""; } - public NBTBase copy() { - return new NBTTagString(this.data); + public Tag copy() { + return new TagString(this.data); } public boolean equals(Object other) { if(!super.equals(other)) return false; - NBTTagString tag = (NBTTagString)other; + TagString tag = (TagString)other; return this.data == null && tag.data == null || this.data != null && this.data.equals(tag.data); } diff --git a/common/src/main/java/common/nbt/TagStringList.java b/common/src/main/java/common/nbt/TagStringList.java new file mode 100644 index 0000000..6435b63 --- /dev/null +++ b/common/src/main/java/common/nbt/TagStringList.java @@ -0,0 +1,27 @@ +package common.nbt; + +public class TagStringList extends TagList { + protected byte getId() { + return 9; + } + + protected byte getType() { + return 8; + } + + protected TagList createInstance() { + return new TagStringList(); + } + + protected TagString getDefault() { + return new TagString(""); + } + + public String get(int index) { + return this.getElem(index).getString(); + } + + public void add(String value) { + this.addElem(new TagString(value)); + } +} diff --git a/common/src/main/java/common/network/PacketBuffer.java b/common/src/main/java/common/network/PacketBuffer.java index 1c7196f..0e5a14a 100755 --- a/common/src/main/java/common/network/PacketBuffer.java +++ b/common/src/main/java/common/network/PacketBuffer.java @@ -5,9 +5,9 @@ import java.nio.charset.Charset; import common.init.ItemRegistry; import common.item.ItemStack; -import common.nbt.NBTLoader; +import common.nbt.TagLoader; import common.nbt.SizeTracker; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.net.buffer.ByteBuf; import common.net.buffer.ByteBufInputStream; import common.net.buffer.ByteBufOutputStream; @@ -92,26 +92,26 @@ public class PacketBuffer { return v; } - public void writeTag(NBTTagCompound tag) { + public void writeTag(TagObject tag) { if(tag == null) { this.writeByte(0); return; } try { - NBTLoader.write(tag, new ByteBufOutputStream(this.buf)); + TagLoader.write(tag, new ByteBufOutputStream(this.buf)); } catch(IOException e) { throw new EncoderException(e); } } - public NBTTagCompound readTag() throws IOException { + public TagObject readTag() throws IOException { int i = this.buf.readerIndex(); byte b = this.readByte(); if(b == 0) return null; this.buf.readerIndex(i); - return NBTLoader.read(new ByteBufInputStream(this.buf), new SizeTracker(2097152)); + return TagLoader.read(new ByteBufInputStream(this.buf), new SizeTracker(2097152)); } public void writeItemStack(ItemStack stack) { diff --git a/common/src/main/java/common/packet/SPacketJoinGame.java b/common/src/main/java/common/packet/SPacketJoinGame.java index ffef6cc..647258a 100755 --- a/common/src/main/java/common/packet/SPacketJoinGame.java +++ b/common/src/main/java/common/packet/SPacketJoinGame.java @@ -3,14 +3,14 @@ package common.packet; import java.io.IOException; import common.dimension.Dimension; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; public class SPacketJoinGame implements Packet { private int entityId; - private NBTTagCompound dimension; + private TagObject dimension; private int type; private boolean editor; diff --git a/common/src/main/java/common/packet/SPacketRespawn.java b/common/src/main/java/common/packet/SPacketRespawn.java index 215269f..f599779 100755 --- a/common/src/main/java/common/packet/SPacketRespawn.java +++ b/common/src/main/java/common/packet/SPacketRespawn.java @@ -3,14 +3,14 @@ package common.packet; import java.io.IOException; import common.dimension.Dimension; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; public class SPacketRespawn implements Packet { - private NBTTagCompound dimension; + private TagObject dimension; private int type; private boolean editor; diff --git a/common/src/main/java/common/packet/SPacketUpdateEntityNBT.java b/common/src/main/java/common/packet/SPacketUpdateEntityNBT.java index d68a4d8..51133fe 100755 --- a/common/src/main/java/common/packet/SPacketUpdateEntityNBT.java +++ b/common/src/main/java/common/packet/SPacketUpdateEntityNBT.java @@ -3,7 +3,7 @@ package common.packet; import java.io.IOException; import common.entity.Entity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; @@ -12,13 +12,13 @@ import common.world.World; public class SPacketUpdateEntityNBT implements Packet { private int entityId; - private NBTTagCompound tagCompound; + private TagObject tagCompound; public SPacketUpdateEntityNBT() { } - public SPacketUpdateEntityNBT(int entityIdIn, NBTTagCompound tagCompoundIn) + public SPacketUpdateEntityNBT(int entityIdIn, TagObject tagCompoundIn) { this.entityId = entityIdIn; this.tagCompound = tagCompoundIn; @@ -50,7 +50,7 @@ public class SPacketUpdateEntityNBT implements Packet handler.handleEntityNBT(this); } - public NBTTagCompound getTagCompound() + public TagObject getTagCompound() { return this.tagCompound; } diff --git a/common/src/main/java/common/packet/SPacketUpdateTileEntity.java b/common/src/main/java/common/packet/SPacketUpdateTileEntity.java index 99cd78d..137e6a2 100755 --- a/common/src/main/java/common/packet/SPacketUpdateTileEntity.java +++ b/common/src/main/java/common/packet/SPacketUpdateTileEntity.java @@ -3,7 +3,7 @@ package common.packet; import java.io.IOException; import common.init.TileRegistry; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; @@ -14,7 +14,7 @@ public class SPacketUpdateTileEntity implements Packet { private BlockPos blockPos; private int type; - private NBTTagCompound nbt; + private TagObject nbt; public SPacketUpdateTileEntity() { @@ -24,7 +24,7 @@ public class SPacketUpdateTileEntity implements Packet { this.blockPos = tile.getPos(); this.type = TileRegistry.CLASS_TO_ID.get(tile.getClass()); - tile.writeToNBT(this.nbt = new NBTTagCompound()); + tile.writeToNBT(this.nbt = new TagObject()); } /** @@ -65,7 +65,7 @@ public class SPacketUpdateTileEntity implements Packet return this.type == TileRegistry.CLASS_TO_ID.get(tile.getClass()); } - public NBTTagCompound getNbtCompound() + public TagObject getNbtCompound() { return this.nbt; } diff --git a/common/src/main/java/common/potion/PotionEffect.java b/common/src/main/java/common/potion/PotionEffect.java index 91d83bf..31a1cc5 100755 --- a/common/src/main/java/common/potion/PotionEffect.java +++ b/common/src/main/java/common/potion/PotionEffect.java @@ -2,7 +2,7 @@ package common.potion; import common.entity.types.EntityLiving; import common.log.Log; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class PotionEffect { private final Potion potion; @@ -135,8 +135,8 @@ public class PotionEffect { && this.thrown == other.thrown && this.remaining == other.remaining && this.ambient == other.ambient; } - public NBTTagCompound toNbt() { - NBTTagCompound nbt = new NBTTagCompound(); + public TagObject toNbt() { + TagObject nbt = new TagObject(); nbt.setString("Type", this.potion.getName()); nbt.setByte("Amplifier", (byte)this.amplifier); nbt.setInt("Duration", this.duration); @@ -146,7 +146,7 @@ public class PotionEffect { return nbt; } - public static PotionEffect fromNbt(NBTTagCompound nbt) { + public static PotionEffect fromNbt(TagObject nbt) { Potion potion = Potion.getByName(nbt.getString("Type")); return potion == null ? null : new PotionEffect(potion, nbt.getInt("Duration"), (int)(nbt.getByte("Amplifier") & 255), nbt.getBool("Ambient"), nbt.getBool("Particles")) .setRemaining(nbt.getInt("Remaining")); diff --git a/common/src/main/java/common/tileentity/LockCode.java b/common/src/main/java/common/tileentity/LockCode.java index 63d34b7..bbb70d4 100755 --- a/common/src/main/java/common/tileentity/LockCode.java +++ b/common/src/main/java/common/tileentity/LockCode.java @@ -1,6 +1,6 @@ package common.tileentity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class LockCode { @@ -22,12 +22,12 @@ public class LockCode return this.lock; } - public void toNBT(NBTTagCompound nbt) + public void toNBT(TagObject nbt) { nbt.setString("Lock", this.lock); } - public static LockCode fromNBT(NBTTagCompound nbt) + public static LockCode fromNBT(TagObject nbt) { if (nbt.hasString("Lock")) { diff --git a/common/src/main/java/common/tileentity/MachineResource.java b/common/src/main/java/common/tileentity/MachineResource.java index a21c1a6..d7e11ac 100755 --- a/common/src/main/java/common/tileentity/MachineResource.java +++ b/common/src/main/java/common/tileentity/MachineResource.java @@ -1,6 +1,6 @@ package common.tileentity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class MachineResource { public static enum Type { @@ -23,7 +23,7 @@ public class MachineResource { this.overcharge = over; } - public void readFromNbt(NBTTagCompound tag) { + public void readFromNbt(TagObject tag) { this.amount = tag.getInt("Amount"); this.capacity = tag.getInt("Capacity"); this.undercharge = tag.getInt("Under"); @@ -31,7 +31,7 @@ public class MachineResource { this.entropy = tag.getInt("Entropy"); } - public void writeToNbt(NBTTagCompound tag) { + public void writeToNbt(TagObject tag) { tag.setInt("Amount", this.amount); tag.setInt("Capacity", this.capacity); tag.setInt("Under", this.undercharge); diff --git a/common/src/main/java/common/tileentity/TileEntity.java b/common/src/main/java/common/tileentity/TileEntity.java index 2f96938..18e3edf 100755 --- a/common/src/main/java/common/tileentity/TileEntity.java +++ b/common/src/main/java/common/tileentity/TileEntity.java @@ -4,7 +4,7 @@ import common.block.Block; import common.init.Blocks; import common.init.TileRegistry; import common.log.Log; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.util.BlockPos; import common.world.AWorldServer; @@ -53,12 +53,12 @@ public abstract class TileEntity return this.worldObj != null; } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { this.pos = new BlockPos(compound.getInt("x"), compound.getInt("y"), compound.getInt("z")); } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { String s = (String)TileRegistry.CLASS_TO_NAME.get(this.getClass()); @@ -78,7 +78,7 @@ public abstract class TileEntity /** * Creates a new entity and loads its data from the specified NBT. */ - public static TileEntity createAndLoadEntity(NBTTagCompound nbt) + public static TileEntity createAndLoadEntity(TagObject nbt) { TileEntity tileentity = null; diff --git a/common/src/main/java/common/tileentity/TileEntityBanner.java b/common/src/main/java/common/tileentity/TileEntityBanner.java index 33879f5..d4b5a58 100755 --- a/common/src/main/java/common/tileentity/TileEntityBanner.java +++ b/common/src/main/java/common/tileentity/TileEntityBanner.java @@ -8,8 +8,8 @@ import common.color.DyeColor; import common.init.Blocks; import common.init.Items; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.network.Packet; import common.packet.SPacketUpdateTileEntity; @@ -18,7 +18,7 @@ public class TileEntityBanner extends TileEntity private int baseColor; /** A list of all the banner patterns. */ - private NBTTagTagList patterns; + private TagObjectList patterns; private boolean field_175119_g; private List patternList; private List colorList; @@ -34,11 +34,11 @@ public class TileEntityBanner extends TileEntity if (stack.hasTagCompound() && stack.getTagCompound().hasTag("BlockEntityTag")) { - NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("BlockEntityTag"); + TagObject nbttagcompound = stack.getTagCompound().getTag("BlockEntityTag"); if (nbttagcompound.hasTagList("Patterns")) { - this.patterns = (NBTTagTagList)nbttagcompound.getTagList("Patterns").copy(); + this.patterns = (TagObjectList)nbttagcompound.getTagList("Patterns").copy(); } if (nbttagcompound.hasInt("Base")) @@ -61,13 +61,13 @@ public class TileEntityBanner extends TileEntity this.field_175119_g = true; } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); setBaseColorAndPatterns(compound, this.baseColor, this.patterns); } - public static void setBaseColorAndPatterns(NBTTagCompound compound, int baseColorIn, NBTTagTagList patternsIn) + public static void setBaseColorAndPatterns(TagObject compound, int baseColorIn, TagObjectList patternsIn) { compound.setInt("Base", baseColorIn); @@ -77,7 +77,7 @@ public class TileEntityBanner extends TileEntity } } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.baseColor = compound.getInt("Base"); @@ -104,7 +104,7 @@ public class TileEntityBanner extends TileEntity public static int getBaseColor(ItemStack stack) { - NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); return nbttagcompound != null && nbttagcompound.hasInt("Base") ? nbttagcompound.getInt("Base") : stack.getMetadata(); } @@ -113,7 +113,7 @@ public class TileEntityBanner extends TileEntity */ public static int getPatterns(ItemStack stack) { - NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); return nbttagcompound != null && nbttagcompound.hasTagList("Patterns") ? nbttagcompound.getTagList("Patterns").size() : 0; } @@ -123,7 +123,7 @@ public class TileEntityBanner extends TileEntity return this.patternList; } - public NBTTagTagList getPatterns() + public TagObjectList getPatterns() { return this.patterns; } @@ -164,7 +164,7 @@ public class TileEntityBanner extends TileEntity { for (int i = 0; i < this.patterns.size(); ++i) { - NBTTagCompound nbttagcompound = this.patterns.get(i); + TagObject nbttagcompound = this.patterns.get(i); TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern")); if (tileentitybanner$enumbannerpattern != null) @@ -189,11 +189,11 @@ public class TileEntityBanner extends TileEntity */ public static void removeBannerData(ItemStack stack) { - NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); if (nbttagcompound != null && nbttagcompound.hasTagList("Patterns")) { - NBTTagTagList nbttaglist = nbttagcompound.getTagList("Patterns"); + TagObjectList nbttaglist = nbttagcompound.getTagList("Patterns"); if (nbttaglist.size() > 0) { @@ -205,7 +205,7 @@ public class TileEntityBanner extends TileEntity if (stack.getTagCompound().isEmpty()) { - stack.setTagCompound((NBTTagCompound)null); + stack.setTagCompound((TagObject)null); } } } diff --git a/common/src/main/java/common/tileentity/TileEntityBeacon.java b/common/src/main/java/common/tileentity/TileEntityBeacon.java index 99f86fd..22888c6 100755 --- a/common/src/main/java/common/tileentity/TileEntityBeacon.java +++ b/common/src/main/java/common/tileentity/TileEntityBeacon.java @@ -6,7 +6,7 @@ import common.block.Block; import common.color.DyeColor; import common.entity.types.EntityLiving; import common.init.Blocks; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.packet.SPacketUpdateTileEntity; import common.potion.Potion; @@ -301,7 +301,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable // } } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.primaryEffect = compound.hasString("Primary") ? this.getEffect(compound.getString("Primary")) : null; @@ -315,7 +315,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable // } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); if(this.primaryEffect != null) diff --git a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java index b1079e1..159aee5 100755 --- a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java +++ b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java @@ -13,8 +13,8 @@ import common.inventory.InventoryPlayer; import common.item.Item; import common.item.ItemPotion; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.potion.PotionEffect; import common.potion.PotionHelper; import common.util.Facing; @@ -227,15 +227,15 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta); } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.brewingItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot"); if (j >= 0 && j < this.brewingItemStacks.length) @@ -252,17 +252,17 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setShort("BrewTime", (short)this.brewTime); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.brewingItemStacks.length; ++i) { if (this.brewingItemStacks[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.brewingItemStacks[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/tileentity/TileEntityChest.java b/common/src/main/java/common/tileentity/TileEntityChest.java index 9d08a94..8ab9cc5 100755 --- a/common/src/main/java/common/tileentity/TileEntityChest.java +++ b/common/src/main/java/common/tileentity/TileEntityChest.java @@ -10,8 +10,8 @@ import common.inventory.IInventory; import common.inventory.InventoryLargeChest; import common.inventory.InventoryPlayer; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -161,10 +161,10 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II this.customName = name; } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.chestContents = new ItemStack[this.getSizeInventory()]; if (compound.hasString("CustomName")) @@ -174,7 +174,7 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.chestContents.length) @@ -184,16 +184,16 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.chestContents.length; ++i) { if (this.chestContents[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.chestContents[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/tileentity/TileEntityComparator.java b/common/src/main/java/common/tileentity/TileEntityComparator.java index 3f80903..630c49d 100755 --- a/common/src/main/java/common/tileentity/TileEntityComparator.java +++ b/common/src/main/java/common/tileentity/TileEntityComparator.java @@ -1,18 +1,18 @@ package common.tileentity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class TileEntityComparator extends TileEntity { private int outputSignal; - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setInt("OutputSignal", this.outputSignal); } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.outputSignal = compound.getInt("OutputSignal"); diff --git a/common/src/main/java/common/tileentity/TileEntityDispenser.java b/common/src/main/java/common/tileentity/TileEntityDispenser.java index db09af3..633c52a 100755 --- a/common/src/main/java/common/tileentity/TileEntityDispenser.java +++ b/common/src/main/java/common/tileentity/TileEntityDispenser.java @@ -6,8 +6,8 @@ import common.inventory.ContainerDispenser; import common.inventory.IInventory; import common.inventory.InventoryPlayer; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.rng.Random; public class TileEntityDispenser extends TileEntityLockable implements IInventory @@ -152,15 +152,15 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor return this.customName != null; } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.stacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.stacks.length) @@ -175,16 +175,16 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.stacks.length; ++i) { if (this.stacks[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.stacks[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/tileentity/TileEntityEnchantmentTable.java b/common/src/main/java/common/tileentity/TileEntityEnchantmentTable.java index 8025481..848284e 100755 --- a/common/src/main/java/common/tileentity/TileEntityEnchantmentTable.java +++ b/common/src/main/java/common/tileentity/TileEntityEnchantmentTable.java @@ -4,7 +4,7 @@ import common.entity.npc.EntityNPC; import common.inventory.Container; import common.inventory.ContainerEnchantment; import common.inventory.InventoryPlayer; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.util.ExtMath; @@ -23,7 +23,7 @@ public class TileEntityEnchantmentTable extends TileEntity implements ITickable, private static Random rand = new Random(); private String customName; - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); @@ -33,7 +33,7 @@ public class TileEntityEnchantmentTable extends TileEntity implements ITickable, } } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); diff --git a/common/src/main/java/common/tileentity/TileEntityFurnace.java b/common/src/main/java/common/tileentity/TileEntityFurnace.java index 6d190e2..504a803 100755 --- a/common/src/main/java/common/tileentity/TileEntityFurnace.java +++ b/common/src/main/java/common/tileentity/TileEntityFurnace.java @@ -23,8 +23,8 @@ import common.item.ItemHoe; import common.item.ItemStack; import common.item.ItemSword; import common.item.ItemTool; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.ExtMath; import common.util.Facing; @@ -156,15 +156,15 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable, this.furnaceCustomName = p_145951_1_; } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot"); if (j >= 0 && j < this.furnaceItemStacks.length) @@ -184,19 +184,19 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable, } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setShort("BurnTime", (short)this.furnaceBurnTime); compound.setShort("CookTime", (short)this.cookTime); compound.setShort("CookTimeTotal", (short)this.totalCookTime); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { if (this.furnaceItemStacks[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.furnaceItemStacks[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/tileentity/TileEntityHopper.java b/common/src/main/java/common/tileentity/TileEntityHopper.java index d168cd0..4cb283c 100755 --- a/common/src/main/java/common/tileentity/TileEntityHopper.java +++ b/common/src/main/java/common/tileentity/TileEntityHopper.java @@ -16,8 +16,8 @@ import common.inventory.IInventory; import common.inventory.ISidedInventory; import common.inventory.InventoryPlayer; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; import common.util.BoundingBox; import common.util.ExtMath; @@ -30,10 +30,10 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi private String customName; private int transferCooldown = -1; - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.inventory = new ItemStack[this.getSizeInventory()]; if (compound.hasString("CustomName")) @@ -45,7 +45,7 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot"); if (j >= 0 && j < this.inventory.length) @@ -55,16 +55,16 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi } } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (int i = 0; i < this.inventory.length; ++i) { if (this.inventory[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.inventory[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); diff --git a/common/src/main/java/common/tileentity/TileEntityLockable.java b/common/src/main/java/common/tileentity/TileEntityLockable.java index 64bb470..9ac3d65 100755 --- a/common/src/main/java/common/tileentity/TileEntityLockable.java +++ b/common/src/main/java/common/tileentity/TileEntityLockable.java @@ -1,18 +1,18 @@ package common.tileentity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public abstract class TileEntityLockable extends TileEntity implements IInteractionObject, ILockableContainer { private LockCode code = LockCode.EMPTY_CODE; - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.code = LockCode.fromNBT(compound); } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); diff --git a/common/src/main/java/common/tileentity/TileEntityMachine.java b/common/src/main/java/common/tileentity/TileEntityMachine.java index 588e27a..5f19596 100755 --- a/common/src/main/java/common/tileentity/TileEntityMachine.java +++ b/common/src/main/java/common/tileentity/TileEntityMachine.java @@ -6,8 +6,8 @@ import common.inventory.Container; import common.inventory.ContainerMachine; import common.inventory.InventoryPlayer; import common.item.ItemStack; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.network.Packet; import common.packet.SPacketUpdateTileEntity; import common.rng.Random; @@ -79,13 +79,13 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH this.status = status; } - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); - NBTTagTagList nbttaglist = compound.getTagList("Items"); + TagObjectList nbttaglist = compound.getTagList("Items"); this.clear(); for(int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); int j = nbttagcompound.getByte("Slot"); if(j >= 0 && j < this.inventory.length) { @@ -106,13 +106,13 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH this.status = Status.values()[(int)compound.getByte("Status") % Status.values().length]; } - public void writeToNBT(NBTTagCompound compound) { + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for(int i = 0; i < this.inventory.length; ++i) { if(this.inventory[i] != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setByte("Slot", (byte)i); this.inventory[i].writeToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); @@ -120,9 +120,9 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH } compound.setTagList("Items", nbttaglist); - nbttaglist = new NBTTagTagList(); + nbttaglist = new TagObjectList(); for(int z = 0; z < this.resources.length; z++) { - NBTTagCompound res = new NBTTagCompound(); + TagObject res = new TagObject(); this.resources[z].writeToNbt(res); nbttaglist.add(res); } diff --git a/common/src/main/java/common/tileentity/TileEntityMobSpawner.java b/common/src/main/java/common/tileentity/TileEntityMobSpawner.java index 49a3263..af603fb 100755 --- a/common/src/main/java/common/tileentity/TileEntityMobSpawner.java +++ b/common/src/main/java/common/tileentity/TileEntityMobSpawner.java @@ -6,7 +6,7 @@ import common.init.Blocks; import common.init.Config; import common.init.EntityRegistry; import common.model.ParticleType; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.packet.SPacketUpdateTileEntity; import common.util.BlockPos; @@ -162,7 +162,7 @@ public class TileEntityMobSpawner extends TileEntity implements ITickable this.worldObj.addBlockEvent(TileEntityMobSpawner.this.pos, Blocks.mob_spawner, 1, 0); } - public void readFromNBT(NBTTagCompound nbt) + public void readFromNBT(TagObject nbt) { super.readFromNBT(nbt); this.mobID = nbt.getString("EntityId"); @@ -192,7 +192,7 @@ public class TileEntityMobSpawner extends TileEntity implements ITickable } } - public void writeToNBT(NBTTagCompound nbt) + public void writeToNBT(TagObject nbt) { super.writeToNBT(nbt); String s = this.mobID; diff --git a/common/src/main/java/common/tileentity/TileEntityNote.java b/common/src/main/java/common/tileentity/TileEntityNote.java index 092fe9e..61b2fed 100755 --- a/common/src/main/java/common/tileentity/TileEntityNote.java +++ b/common/src/main/java/common/tileentity/TileEntityNote.java @@ -1,7 +1,7 @@ package common.tileentity; import common.init.Blocks; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.world.World; @@ -14,13 +14,13 @@ public class TileEntityNote extends TileEntity /** stores the latest redstone state */ public boolean previousRedstoneState; - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setByte("note", this.note); } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.note = compound.getByte("note"); diff --git a/common/src/main/java/common/tileentity/TileEntityPiston.java b/common/src/main/java/common/tileentity/TileEntityPiston.java index 7f26755..85c2909 100755 --- a/common/src/main/java/common/tileentity/TileEntityPiston.java +++ b/common/src/main/java/common/tileentity/TileEntityPiston.java @@ -6,7 +6,7 @@ import common.collect.Lists; import common.entity.Entity; import common.init.BlockRegistry; import common.init.Blocks; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.BoundingBox; import common.util.Facing; import common.world.State; @@ -198,7 +198,7 @@ public class TileEntityPiston extends TileEntity implements ITickable } } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.pistonState = BlockRegistry.getBlockById(compound.getInt("blockId")).getStateFromMeta(compound.getInt("blockData")); @@ -207,7 +207,7 @@ public class TileEntityPiston extends TileEntity implements ITickable this.extending = compound.getBool("extending"); } - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setInt("blockId", BlockRegistry.getIdFromBlock(this.pistonState.getBlock())); diff --git a/common/src/main/java/common/tileentity/TileEntitySign.java b/common/src/main/java/common/tileentity/TileEntitySign.java index 4d74f43..ed4b8d3 100755 --- a/common/src/main/java/common/tileentity/TileEntitySign.java +++ b/common/src/main/java/common/tileentity/TileEntitySign.java @@ -1,7 +1,7 @@ package common.tileentity; import common.entity.npc.EntityNPC; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.packet.SPacketUpdateSign; @@ -19,7 +19,7 @@ public class TileEntitySign extends TileEntity { private EntityNPC player; // private boolean oldFormat; - public void writeToNBT(NBTTagCompound compound) { + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); for(int i = 0; i < 4; ++i) { @@ -30,7 +30,7 @@ public class TileEntitySign extends TileEntity { // compound.setString("Command", this.command); } - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(TagObject compound) { // this.isEditable = false; super.readFromNBT(compound); diff --git a/common/src/main/java/common/tileentity/TileEntitySkull.java b/common/src/main/java/common/tileentity/TileEntitySkull.java index 76cd968..9d4f759 100755 --- a/common/src/main/java/common/tileentity/TileEntitySkull.java +++ b/common/src/main/java/common/tileentity/TileEntitySkull.java @@ -1,6 +1,6 @@ package common.tileentity; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.Packet; import common.packet.SPacketUpdateTileEntity; @@ -9,7 +9,7 @@ public class TileEntitySkull extends TileEntity private int skullRotation; // private String user = null; - public void writeToNBT(NBTTagCompound compound) + public void writeToNBT(TagObject compound) { super.writeToNBT(compound); compound.setByte("Rot", (byte)(this.skullRotation & 255)); @@ -17,7 +17,7 @@ public class TileEntitySkull extends TileEntity // compound.setString("Owner", this.user); } - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(TagObject compound) { super.readFromNBT(compound); this.skullRotation = compound.getByte("Rot"); diff --git a/common/src/main/java/common/village/MerchantRecipe.java b/common/src/main/java/common/village/MerchantRecipe.java index 03e4c85..93156ca 100755 --- a/common/src/main/java/common/village/MerchantRecipe.java +++ b/common/src/main/java/common/village/MerchantRecipe.java @@ -2,14 +2,14 @@ package common.village; import common.item.Item; import common.item.ItemStack; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public class MerchantRecipe { private final ItemStack buying; private final ItemStack buySecond; private final ItemStack selling; - public MerchantRecipe(NBTTagCompound tag) { + public MerchantRecipe(TagObject tag) { this.buying = ItemStack.loadItemStackFromNBT(tag.getTag("buy")); this.selling = ItemStack.loadItemStackFromNBT(tag.getTag("sell")); this.buySecond = tag.hasTag("buyB") ? ItemStack.loadItemStackFromNBT(tag.getTag("buyB")) : null; @@ -45,12 +45,12 @@ public class MerchantRecipe { return this.selling; } - public NBTTagCompound toNbt() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setTag("buy", this.buying.writeToNBT(new NBTTagCompound())); - tag.setTag("sell", this.selling.writeToNBT(new NBTTagCompound())); + public TagObject toNbt() { + TagObject tag = new TagObject(); + tag.setTag("buy", this.buying.writeToNBT(new TagObject())); + tag.setTag("sell", this.selling.writeToNBT(new TagObject())); if(this.buySecond != null) - tag.setTag("buyB", this.buySecond.writeToNBT(new NBTTagCompound())); + tag.setTag("buyB", this.buySecond.writeToNBT(new TagObject())); return tag; } } diff --git a/common/src/main/java/common/village/MerchantRecipeList.java b/common/src/main/java/common/village/MerchantRecipeList.java index fa2da93..7851013 100755 --- a/common/src/main/java/common/village/MerchantRecipeList.java +++ b/common/src/main/java/common/village/MerchantRecipeList.java @@ -3,9 +3,9 @@ package common.village; import java.util.ArrayList; import common.item.ItemStack; -import common.nbt.NBTBase; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.Tag; +import common.nbt.TagObject; +import common.nbt.TagObjectList; public class MerchantRecipeList extends ArrayList { public MerchantRecipe canUse(ItemStack stack1, ItemStack stack2, int index) { @@ -36,16 +36,16 @@ public class MerchantRecipeList extends ArrayList { && (!stack2.hasTagCompound() || stack1.hasTagCompound() && compareTags(stack2.getTagCompound(), stack1.getTagCompound())); } - private static boolean compareTags(NBTBase tag1, NBTBase tag2) { + private static boolean compareTags(Tag tag1, Tag tag2) { if(tag1 == tag2 || tag1 == null) return true; else if(tag2 == null || !tag1.getClass().equals(tag2.getClass())) return false; - else if(tag1 instanceof NBTTagCompound) { - NBTTagCompound comp1 = (NBTTagCompound)tag1; - NBTTagCompound comp2 = (NBTTagCompound)tag2; + else if(tag1 instanceof TagObject) { + TagObject comp1 = (TagObject)tag1; + TagObject comp2 = (TagObject)tag2; for(String key : comp1.getKeySet()) { - NBTBase tag = comp1.get(key); + Tag tag = comp1.get(key); if(!compareTags(tag, comp2.get(key))) return false; } @@ -54,15 +54,15 @@ public class MerchantRecipeList extends ArrayList { return tag1.equals(tag2); } - public void fromNbt(NBTTagTagList list) { + public void fromNbt(TagObjectList list) { this.clear(); for(int z = 0; z < list.size(); z++) { this.add(new MerchantRecipe(list.get(z))); } } - public NBTTagTagList toNbt() { - NBTTagTagList list = new NBTTagTagList(); + public TagObjectList toNbt() { + TagObjectList list = new TagObjectList(); for(int z = 0; z < this.size(); z++) { list.add(this.get(z).toNbt()); } diff --git a/common/src/main/java/common/village/Village.java b/common/src/main/java/common/village/Village.java index f2adff2..bd0351b 100755 --- a/common/src/main/java/common/village/Village.java +++ b/common/src/main/java/common/village/Village.java @@ -7,8 +7,8 @@ import common.block.Block; import common.block.Material; import common.block.artificial.BlockDoor; import common.collect.Lists; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; import common.world.AWorldServer; @@ -209,7 +209,7 @@ public class Village } } - public void readVillageDataFromNBT(NBTTagCompound compound) + public void readVillageDataFromNBT(TagObject compound) { // this.numVillagers = compound.getInteger("PopSize"); this.radius = compound.getInt("Radius"); @@ -218,17 +218,17 @@ public class Village // this.noBreedTicks = compound.getInteger("MTick"); this.center = new BlockPos(compound.getInt("CX"), compound.getInt("CY"), compound.getInt("CZ")); this.doorRange = new BlockPos(compound.getInt("ACX"), compound.getInt("ACY"), compound.getInt("ACZ")); - NBTTagTagList nbttaglist = compound.getTagList("Doors"); + TagObjectList nbttaglist = compound.getTagList("Doors"); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); VillageDoorInfo villagedoorinfo = new VillageDoorInfo(new BlockPos(nbttagcompound.getInt("X"), nbttagcompound.getInt("Y"), nbttagcompound.getInt("Z")), nbttagcompound.getInt("IDX"), nbttagcompound.getInt("IDZ"), nbttagcompound.getInt("TS")); this.doors.add(villagedoorinfo); } } - public void writeVillageDataToNBT(NBTTagCompound compound) + public void writeVillageDataToNBT(TagObject compound) { // compound.setInteger("PopSize", this.numVillagers); compound.setInt("Radius", this.radius); @@ -241,11 +241,11 @@ public class Village compound.setInt("ACX", this.doorRange.getX()); compound.setInt("ACY", this.doorRange.getY()); compound.setInt("ACZ", this.doorRange.getZ()); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (VillageDoorInfo villagedoorinfo : this.doors) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setInt("X", villagedoorinfo.getDoorBlockPos().getX()); nbttagcompound.setInt("Y", villagedoorinfo.getDoorBlockPos().getY()); nbttagcompound.setInt("Z", villagedoorinfo.getDoorBlockPos().getZ()); diff --git a/common/src/main/java/common/world/AWorldClient.java b/common/src/main/java/common/world/AWorldClient.java index c7189f0..51a57ae 100644 --- a/common/src/main/java/common/world/AWorldClient.java +++ b/common/src/main/java/common/world/AWorldClient.java @@ -2,7 +2,7 @@ package common.world; import common.dimension.Dimension; import common.init.SoundEvent; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; public abstract class AWorldClient extends World { protected AWorldClient(Dimension dim, boolean debug) { @@ -10,6 +10,6 @@ public abstract class AWorldClient extends World { } public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume); - public abstract void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, NBTTagCompound compund); + public abstract void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, TagObject compund); public abstract void setLastLightning(int last, int color); } diff --git a/server/src/main/java/server/Server.java b/server/src/main/java/server/Server.java index 0b1db9a..59c29b0 100755 --- a/server/src/main/java/server/Server.java +++ b/server/src/main/java/server/Server.java @@ -43,10 +43,10 @@ import common.init.Registry; import common.init.UniverseRegistry; import common.init.Config.ValueType; import common.log.Log; -import common.nbt.NBTLoader; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagDoubleList; -import common.nbt.NBTTagFloatList; +import common.nbt.TagLoader; +import common.nbt.TagObject; +import common.nbt.TagDoubleList; +import common.nbt.TagFloatList; import common.net.bootstrap.ServerBootstrap; import common.net.channel.Channel; import common.net.channel.ChannelException; @@ -173,11 +173,11 @@ public final class Server implements IThreadListener { } public static void saveServerConfig(long time) { - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); data.setLong("Time", time); data.setLong("LastAccess", System.currentTimeMillis()); data.setString("Version", Util.VERSION); - NBTTagCompound cfg = new NBTTagCompound(); + TagObject cfg = new TagObject(); for(String cvar : Config.VARS.keySet()) { Config.Value value = Config.VARS.get(cvar); if(!value.noDef || !value.def.equals(value.getValue())) @@ -188,7 +188,7 @@ public final class Server implements IThreadListener { File nfile = new File("server.nbt.tmp"); File lfile = new File("server.nbt"); try { - NBTLoader.writeGZip(data, nfile); + TagLoader.writeGZip(data, nfile); if(lfile.exists()) lfile.delete(); nfile.renameTo(lfile); @@ -206,8 +206,8 @@ public final class Server implements IThreadListener { file = new File("server.nbt.tmp"); if(file.exists()) { try { - NBTTagCompound tag = NBTLoader.readGZip(file); - NBTTagCompound cfg = tag.getTag("Config"); + TagObject tag = TagLoader.readGZip(file); + TagObject cfg = tag.getTag("Config"); for(String key : cfg.getKeySet()) { Config.set(key, cfg.getString(key), false); } @@ -291,15 +291,15 @@ public final class Server implements IThreadListener { } } - public NBTTagCompound loadPlayerData(String user) { + public TagObject loadPlayerData(String user) { if(this.debug || !IPlayer.isValidUser(user)) return null; - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(new File("players"), user + ".nbt"); if(dat.exists() && dat.isFile()) { - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } } catch(Exception e) { @@ -308,13 +308,13 @@ public final class Server implements IThreadListener { return tag; } - public void writePlayerData(String user, NBTTagCompound tag) { + public void writePlayerData(String user, TagObject tag) { if(this.debug || !IPlayer.isValidUser(user)) return; try { File tmp = new File(new File("players"), user + ".nbt.tmp"); File dat = new File(new File("players"), user + ".nbt"); - NBTLoader.writeGZip(tag, tmp); + TagLoader.writeGZip(tag, tmp); if(dat.exists()) { dat.delete(); } @@ -326,11 +326,11 @@ public final class Server implements IThreadListener { } public Position getOfflinePosition(String user) { - NBTTagCompound tag = this.loadPlayerData(user); + TagObject tag = this.loadPlayerData(user); if(tag == null) return null; - NBTTagDoubleList pos = tag.getDoubleList("Pos"); - NBTTagFloatList rot = tag.getFloatList("Rotation"); + TagDoubleList pos = tag.getDoubleList("Pos"); + TagFloatList rot = tag.getFloatList("Rotation"); double posX = pos.get(0); double posY = pos.get(1); double posZ = pos.get(2); @@ -837,7 +837,7 @@ public final class Server implements IThreadListener { } public String addPlayer(NetConnection connection, String loginUser, String loginPass) { - NBTTagCompound tag = this.readPlayer(loginUser); + TagObject tag = this.readPlayer(loginUser); Player conn = new Player(this, connection, loginUser); if(tag != null) conn.readFromNBT(tag); @@ -934,15 +934,15 @@ public final class Server implements IThreadListener { newWorld.loadChunk((int)player.posX >> 4, (int)player.posZ >> 4); } - private NBTTagCompound readPlayer(String user) { + private TagObject readPlayer(String user) { if(this.debug) return null; - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(new File("players"), user + ".nbt"); if(dat.exists() && dat.isFile()) { - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } } catch(Exception e) { @@ -955,10 +955,10 @@ public final class Server implements IThreadListener { if(this.debug) return; try { - NBTTagCompound tag = new NBTTagCompound(); + TagObject tag = new TagObject(); EntityNPC entity = conn.getPresentEntity(); if(entity != null) { - NBTTagCompound etag = new NBTTagCompound(); + TagObject etag = new TagObject(); entity.writeToNBT(etag); etag.setInt("Dimension", entity.worldObj.dimension.getDimensionId()); etag.setString("id", EntityRegistry.getEntityString(entity)); @@ -969,7 +969,7 @@ public final class Server implements IThreadListener { conn.writeToNBT(tag); File tmp = new File(new File("players"), conn.getUser() + ".nbt.tmp"); File dat = new File(new File("players"), conn.getUser() + ".nbt"); - NBTLoader.writeGZip(tag, tmp); + TagLoader.writeGZip(tag, tmp); if(dat.exists()) { dat.delete(); } @@ -1045,10 +1045,10 @@ public final class Server implements IThreadListener { old.worldObj.dimension.getFormattedName(false)); } - public NBTTagCompound swapPlayer(Player conn, NBTTagCompound tag, Class clazz) { + public TagObject swapPlayer(Player conn, TagObject tag, Class clazz) { EntityNPC old = conn.getEntity(); old.unmount(); - NBTTagCompound oldTag = new NBTTagCompound(); + TagObject oldTag = new TagObject(); old.writeToNBT(oldTag); oldTag.setInt("Dimension", old.worldObj.dimension.getDimensionId()); oldTag.setString("id", EntityRegistry.getEntityString(old)); diff --git a/server/src/main/java/server/clipboard/ClipboardBlock.java b/server/src/main/java/server/clipboard/ClipboardBlock.java index abb7c34..c536b90 100755 --- a/server/src/main/java/server/clipboard/ClipboardBlock.java +++ b/server/src/main/java/server/clipboard/ClipboardBlock.java @@ -1,12 +1,12 @@ package server.clipboard; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.tileentity.TileEntity; import common.world.State; public class ClipboardBlock { private State state; - private NBTTagCompound nbt; + private TagObject nbt; public ClipboardBlock(State state) { this.state = state; @@ -14,7 +14,7 @@ public class ClipboardBlock { public ClipboardBlock(State data, TileEntity tile) { this(data); - NBTTagCompound tag = new NBTTagCompound(); + TagObject tag = new TagObject(); tile.writeToNBT(tag); this.nbt = tag; } @@ -27,7 +27,7 @@ public class ClipboardBlock { this.state = state; } - public NBTTagCompound getNbtData() { + public TagObject getNbtData() { return this.nbt; } } diff --git a/server/src/main/java/server/command/TagParser.java b/server/src/main/java/server/command/TagParser.java index ab1fad2..2672b2b 100644 --- a/server/src/main/java/server/command/TagParser.java +++ b/server/src/main/java/server/command/TagParser.java @@ -1,26 +1,26 @@ package server.command; -import common.nbt.NBTException; -import common.nbt.NBTParser; -import common.nbt.NBTTagCompound; +import common.nbt.TagException; +import common.nbt.TagInterpreter; +import common.nbt.TagObject; public class TagParser extends DefaultingParser { - public TagParser(String name, NBTTagCompound def, Object ... completions) { + public TagParser(String name, TagObject def, Object ... completions) { super(name, def, completions); } - public NBTTagCompound parse(CommandEnvironment env, String input) { - NBTTagCompound value; + public TagObject parse(CommandEnvironment env, String input) { + TagObject value; try { - value = NBTParser.parseTag(input); + value = TagInterpreter.parseTag(input); } - catch(NBTException e) { + catch(TagException e) { throw new RunException(e, "Ungültiger NBT-Tag '%s'", input); } return value; } public Class getTypeClass(boolean required) { - return NBTTagCompound.class; + return TagObject.class; } } diff --git a/server/src/main/java/server/command/commands/CommandBlock.java b/server/src/main/java/server/command/commands/CommandBlock.java index 7910264..5d2107a 100644 --- a/server/src/main/java/server/command/commands/CommandBlock.java +++ b/server/src/main/java/server/command/commands/CommandBlock.java @@ -2,7 +2,7 @@ package server.command.commands; import java.util.Collection; import common.init.BlockRegistry; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.world.State; @@ -28,7 +28,7 @@ public class CommandBlock extends Command { this.addTag("tag", 't'); } - public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, NBTTagCompound tag) { + public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) { State state = BlockRegistry.getFromIdName(block, null); if(state == null) throw new RunException("Block '%s' existiert nicht", block); @@ -36,7 +36,7 @@ public class CommandBlock extends Command { if(tag != null) { TileEntity tile = world.getTileEntity(position); if(tile != null) { - NBTTagCompound te = new NBTTagCompound(); + TagObject te = new TagObject(); tile.writeToNBT(te); tag.setString("id", te.getString("id")); tag.setInt("x", position.getX()); diff --git a/server/src/main/java/server/command/commands/CommandRegister.java b/server/src/main/java/server/command/commands/CommandRegister.java index c8a48e4..4d545e2 100644 --- a/server/src/main/java/server/command/commands/CommandRegister.java +++ b/server/src/main/java/server/command/commands/CommandRegister.java @@ -2,7 +2,7 @@ package server.command.commands; import common.color.TextColor; import common.init.Config; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.network.IPlayer; import server.command.Command; import server.command.CommandEnvironment; @@ -25,7 +25,7 @@ public class CommandRegister extends Command { Player player = env.getServer().getPlayer(username); if(player != null) throw new RunException("Ein Spieler mit diesem Nutzernamen ist bereits online"); - NBTTagCompound tag = env.getServer().loadPlayerData(username); + TagObject tag = env.getServer().loadPlayerData(username); if(tag != null) throw new RunException("Ein Spieler mit diesem Nutzernamen ist bereits registriert"); if(exec.isPlayer()) { @@ -53,7 +53,7 @@ public class CommandRegister extends Command { exec.logConsole(TextColor.RED + "Passwörter stimmen nicht überein"); return; } - NBTTagCompound user = new NBTTagCompound(); + TagObject user = new TagObject(); user.setString("password", this.passwordField.get()); env.getServer().writePlayerData(username, user); exec.logConsole(TextColor.GREEN + "Spieler %s registriert", username); @@ -63,7 +63,7 @@ public class CommandRegister extends Command { else if(exec.isConsole()) { if(password == null) throw new RunException("Bei Verwendung in der Konsole muss ein Passwort angegeben werden"); - NBTTagCompound user = new NBTTagCompound(); + TagObject user = new TagObject(); user.setString("password", password); env.getServer().writePlayerData(username, user); exec.logConsole(TextColor.GREEN + "Spieler %s registriert", username); diff --git a/server/src/main/java/server/command/commands/CommandSpawn.java b/server/src/main/java/server/command/commands/CommandSpawn.java index 366499f..a49ded1 100644 --- a/server/src/main/java/server/command/commands/CommandSpawn.java +++ b/server/src/main/java/server/command/commands/CommandSpawn.java @@ -8,7 +8,7 @@ import common.collect.Sets; import common.entity.Entity; import common.entity.types.EntityLiving; import common.init.EntityRegistry; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.util.Util; import common.util.Vec3; import server.command.Command; @@ -38,7 +38,7 @@ public class CommandSpawn extends Command { this.addTag("postTag", 'p'); } - public Object exec(CommandEnvironment env, Executor exec, String type, Vec3 pos, WorldServer world, NBTTagCompound tag, boolean noinit, int count, NBTTagCompound postTag) { + public Object exec(CommandEnvironment env, Executor exec, String type, Vec3 pos, WorldServer world, TagObject tag, boolean noinit, int count, TagObject postTag) { if(type.equalsIgnoreCase("Lightning")) { for(int z = 0; z < count; z++) { int color = 0xffffff; @@ -66,7 +66,7 @@ public class CommandSpawn extends Command { throw new RunException("Objekt konnte nicht erzeugt werden"); entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f); if(tag != null) { - NBTTagCompound ent = new NBTTagCompound(); + TagObject ent = new TagObject(); entity.writeToNBT(ent); ent.merge(tag); entity.readFromNBT(ent); @@ -75,7 +75,7 @@ public class CommandSpawn extends Command { ((EntityLiving)entity).onInitialSpawn(null); world.spawnEntityInWorld(entity); if(postTag != null) { - NBTTagCompound ent = new NBTTagCompound(); + TagObject ent = new TagObject(); entity.writeToNBT(ent); ent.merge(postTag); entity.readFromNBT(ent); diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index c95e192..8886ae9 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -46,9 +46,9 @@ import common.item.ItemArmor; import common.item.ItemControl; import common.item.ItemStack; import common.log.Log; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagDoubleList; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagDoubleList; +import common.nbt.TagObjectList; import common.net.util.concurrent.Future; import common.net.util.concurrent.GenericFutureListener; import common.network.IPlayer; @@ -153,7 +153,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer private final Server server; private final String user; private final IntHashMap transactions = new IntHashMap(); - private final List characters = Lists.newArrayList(); + private final List characters = Lists.newArrayList(); private EntityNPC entity; private int tickTime; @@ -617,12 +617,12 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer } - public void readFromNBT(NBTTagCompound tag) { + public void readFromNBT(TagObject tag) { this.admin = tag.getBool("admin"); if(tag.hasString("password")) this.password = tag.getString("password"); this.selected = tag.getInt("selected"); - NBTTagTagList list = tag.getTagList("characters"); + TagObjectList list = tag.getTagList("characters"); for(int z = 0; z < list.size(); z++) { this.characters.add(list.get(z)); } @@ -642,15 +642,15 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer // } } - public void writeToNBT(NBTTagCompound tag) { + public void writeToNBT(TagObject tag) { if(this.admin) tag.setBool("admin", this.admin); if(this.password != null) tag.setString("password", this.password); if(!this.characters.isEmpty()) { tag.setInt("selected", this.selected); - NBTTagTagList list = new NBTTagTagList(); - for(NBTTagCompound etag : this.characters) { + TagObjectList list = new TagObjectList(); + for(TagObject etag : this.characters) { list.add(etag); } tag.setTagList("characters", list); @@ -1611,11 +1611,11 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer this.addHotbar(TextColor.YELLOW + (info.isEmpty() ? "Keine Drehung" : info)); } - public NBTTagCompound readCharacter() { + public TagObject readCharacter() { return this.characters.isEmpty() || this.selected < 0 ? null : this.characters.get(this.selected); } - public void writeCharacter(NBTTagCompound tag) { + public void writeCharacter(TagObject tag) { if(!this.characters.isEmpty() && this.selected >= 0) this.characters.set(this.selected, tag); } @@ -1647,13 +1647,13 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer this.server.removePlayer(this); } - public PlayerCharacter getCharacterInfo(NBTTagCompound tag) { + public PlayerCharacter getCharacterInfo(TagObject tag) { String name = tag.getString("CustomName"); String info = tag.getString("Description"); if(info != null && info.isEmpty()) info = null; Alignment align = Alignment.getByName(tag.getString("Align")); - NBTTagDoubleList position = tag.getDoubleList("Pos"); + TagDoubleList position = tag.getDoubleList("Pos"); Dimension dimension = UniverseRegistry.getDimension(tag.getInt("Dimension")); String dim = dimension == null ? "???" : dimension.getFormattedName(false); BlockPos pos = new BlockPos(position.get(0), position.get(1), position.get(2)); @@ -1664,7 +1664,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer public void onConnect() { List chars = Lists.newArrayList(); - for(NBTTagCompound tag : this.characters) { + for(TagObject tag : this.characters) { chars.add(this.getCharacterInfo(tag)); } this.sendPacket(new SPacketCharacterList(this.selected, chars)); @@ -2535,7 +2535,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer this.charEditor = true; // if(this.local) // this.server.resetProgress(); - NBTTagCompound tag = this.server.swapPlayer(this, null, EntityHuman.class); + TagObject tag = this.server.swapPlayer(this, null, EntityHuman.class); if(!this.characters.isEmpty() && this.selected >= 0) this.characters.set(this.selected, tag); int last = this.selected; @@ -2547,7 +2547,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer case CLOSE_EDITOR: { this.charEditor = false; this.selected = this.characters.size(); - this.characters.add(new NBTTagCompound()); + this.characters.add(new TagObject()); WorldServer world = this.server.getWorld(packetIn.getAuxData()); world = world == null ? this.server.getSpace() : world; WorldPos origin = new WorldPos(world.rand.range(-Config.originRadius, Config.originRadius), 64, world.rand.range(-Config.originRadius, Config.originRadius), @@ -2565,7 +2565,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer int index = packetIn.getAuxData(); if(index == this.selected || index >= this.characters.size() || index < 0) return; - NBTTagCompound etag = this.server.swapPlayer(this, this.characters.get(index), null); + TagObject etag = this.server.swapPlayer(this, this.characters.get(index), null); if(!this.characters.isEmpty() && this.selected >= 0) this.characters.set(this.selected, etag); int last = this.selected; @@ -2995,7 +2995,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer // itemstack.setTagCompound(null); // } // else { - NBTTagCompound nbttagcompound = itemstack.getTagCompound().getTag("BlockEntityTag"); + TagObject nbttagcompound = itemstack.getTagCompound().getTag("BlockEntityTag"); if (nbttagcompound.hasInt("x") && nbttagcompound.hasInt("y") && nbttagcompound.hasInt("z")) { @@ -3004,7 +3004,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer if (tileentity != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + TagObject nbttagcompound1 = new TagObject(); tileentity.writeToNBT(nbttagcompound1); nbttagcompound1.remove("x"); nbttagcompound1.remove("y"); diff --git a/server/src/main/java/server/village/VillageCollection.java b/server/src/main/java/server/village/VillageCollection.java index fa0818d..262465d 100755 --- a/server/src/main/java/server/village/VillageCollection.java +++ b/server/src/main/java/server/village/VillageCollection.java @@ -7,8 +7,8 @@ import common.block.Block; import common.block.Material; import common.block.artificial.BlockDoor; import common.collect.Lists; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.util.BlockPos; import common.util.Facing; import common.village.Village; @@ -23,14 +23,14 @@ public class VillageCollection private int tickCounter; private boolean dirty; - public VillageCollection(NBTTagCompound nbt) { + public VillageCollection(TagObject nbt) { if(nbt != null) { this.tickCounter = nbt.getInt("Tick"); - NBTTagTagList nbttaglist = nbt.getTagList("Villages"); + TagObjectList nbttaglist = nbt.getTagList("Villages"); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.get(i); + TagObject nbttagcompound = nbttaglist.get(i); Village village = new Village(); village.readVillageDataFromNBT(nbttagcompound); this.villageList.add(village); @@ -248,15 +248,15 @@ public class VillageCollection return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false; } - public NBTTagCompound writeToNBT() + public TagObject writeToNBT() { - NBTTagCompound nbt = new NBTTagCompound(); + TagObject nbt = new TagObject(); nbt.setInt("Tick", this.tickCounter); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (Village village : this.villageList) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); village.writeVillageDataToNBT(nbttagcompound); nbttaglist.add(nbttagcompound); } diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 76d7b9b..e1a0ab2 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -67,11 +67,11 @@ import common.init.EntityRegistry; import common.init.TileRegistry; import common.init.UniverseRegistry; import common.log.Log; -import common.nbt.NBTLoader; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagDoubleList; -import common.nbt.NBTTagFloatList; -import common.nbt.NBTTagTagList; +import common.nbt.TagLoader; +import common.nbt.TagObject; +import common.nbt.TagDoubleList; +import common.nbt.TagFloatList; +import common.nbt.TagObjectList; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityBanner; @@ -938,8 +938,8 @@ public abstract class Converter { return (OldNbtTag)read(in, (byte)10); } - private static NBTTagCompound convertTile(OldNbtTag ent, String id) { - NBTTagCompound nent = new NBTTagCompound(); + private static TagObject convertTile(OldNbtTag ent, String id) { + TagObject nent = new TagObject(); if("Sign".equals(id)) { String[] signText = new String[4]; for(int i = 0; i < 4; ++i) { @@ -997,24 +997,24 @@ public abstract class Converter { return idx >= 0 ? name.substring(idx + 1) : name; // save compat } - private static NBTTagFloatList getList(float[] values) { - NBTTagFloatList nlist = new NBTTagFloatList(); + private static TagFloatList getList(float[] values) { + TagFloatList nlist = new TagFloatList(); for(int z = 0; z < values.length; z++) { nlist.add(values[z]); } return nlist; } - private static NBTTagDoubleList getList(double[] values) { - NBTTagDoubleList nlist = new NBTTagDoubleList(); + private static TagDoubleList getList(double[] values) { + TagDoubleList nlist = new TagDoubleList(); for(int z = 0; z < values.length; z++) { nlist.add(values[z]); } return nlist; } - private static NBTTagCompound convertChunkData(OldNbtTag tag, boolean legacy) { - NBTTagCompound ntag = new NBTTagCompound(); + private static TagObject convertChunkData(OldNbtTag tag, boolean legacy) { + TagObject ntag = new TagObject(); tag = tag.getTag("Level"); if(legacy) { byte[] oldheight = tag.getByteArray("HeightMap"); @@ -1027,7 +1027,7 @@ public abstract class Converter { byte[] olddata = tag.getByteArray("Data"); byte[] oldsky = tag.getByteArray("SkyLight"); byte[] oldlight = tag.getByteArray("BlockLight"); - NBTTagTagList sections = new NBTTagTagList(); + TagObjectList sections = new TagObjectList(); for(int n = 0; n < 8; ++n) { boolean empty = true; for(int x = 0; x < 16 && empty; ++x) { @@ -1059,7 +1059,7 @@ public abstract class Converter { } } } - NBTTagCompound section = new NBTTagCompound(); + TagObject section = new TagObject(); section.setByte("Y", (byte)(n & 255)); section.setByteArray("Blocks", blocks); section.setByteArray("Data", data.getData()); @@ -1081,9 +1081,9 @@ public abstract class Converter { ntag.setBool("LightPopulated", tag.getByte("LightPopulated") != 0); OldNbtTag[] ents = tag.getTagList("Entities"); - NBTTagTagList entities = new NBTTagTagList(); + TagObjectList entities = new TagObjectList(); for(OldNbtTag ent : ents) { - NBTTagCompound nent = new NBTTagCompound(); + TagObject nent = new TagObject(); String mapped = ENTITY_MAP.get(trimColon(ent.getString("id"))); if(mapped != null) { double[] pos = ent.getDoubleList("Pos"); @@ -1104,9 +1104,9 @@ public abstract class Converter { ntag.setTagList("Entities", entities); ents = tag.getTagList("TileEntities"); - entities = new NBTTagTagList(); + entities = new TagObjectList(); for(OldNbtTag ent : ents) { - NBTTagCompound nent = new NBTTagCompound(); + TagObject nent = new TagObject(); String mapped = TILE_MAP.get(trimColon(ent.getString("id"))); if(mapped != null) { nent = convertTile(ent, mapped); @@ -1120,9 +1120,9 @@ public abstract class Converter { ntag.setTagList("TileEntities", entities); OldNbtTag[] sects = tag.getTagList("Sections"); - entities = new NBTTagTagList(); + entities = new TagObjectList(); for(OldNbtTag sect : sects) { - NBTTagCompound nsect = new NBTTagCompound(); + TagObject nsect = new TagObject(); byte[] blocks = sect.getByteArray("Blocks"); NibbleArray data = new NibbleArray(sect.getByteArray("Data")); byte[] add = sect.getByteArray("Add"); @@ -1212,7 +1212,7 @@ public abstract class Converter { } OldNbtTag tag = readTag(in); in.close(); - NBTTagCompound ntag = convertChunkData(tag, legacy); + TagObject ntag = convertChunkData(tag, legacy); // DataOutputStream out = newreg.getOutputStream(nx, nz); // CompressedStreamTools.write(tag, out); // out.close(); @@ -1326,12 +1326,12 @@ public abstract class Converter { Server.saveServerConfig(World.START_TIME); Weather weather = nbt.getByte("thundering") != 0 ? Weather.THUNDER : (nbt.getByte("raining") != 0 ? Weather.RAIN : Weather.CLEAR); if(weather != Weather.CLEAR) { - NBTTagCompound dataTag = new NBTTagCompound(); + 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"); try { - NBTLoader.writeGZip(dataTag, dataFile); + TagLoader.writeGZip(dataTag, dataFile); } catch(Exception e) { Log.IO.error(e, "Konnte Weltdaten nicht speichern"); diff --git a/server/src/main/java/server/world/Region.java b/server/src/main/java/server/world/Region.java index 5f8a7b5..5af05a1 100755 --- a/server/src/main/java/server/world/Region.java +++ b/server/src/main/java/server/world/Region.java @@ -25,10 +25,10 @@ import common.entity.Entity; import common.init.BlockRegistry; import common.init.EntityRegistry; import common.log.Log; -import common.nbt.NBTLoader; +import common.nbt.TagLoader; import common.nbt.SizeTracker; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.NextTickListEntry; @@ -273,10 +273,10 @@ public class Region { return (long)this.timestamps[x + z * 8] * 10000L; } - public void writeTag(int x, int z, NBTTagCompound tag) throws IOException { + public void writeTag(int x, int z, TagObject tag) throws IOException { ChunkBuffer buf = new ChunkBuffer(); DataOutputStream out = new DataOutputStream(new DeflaterOutputStream(buf)); - NBTLoader.write(tag, out); + TagLoader.write(tag, out); out.close(); this.write(x, z, buf.getData(), buf.size()); } @@ -343,24 +343,24 @@ public class Region { clearCache(true); } - public static /* synchronized */ NBTTagCompound readChunk(File dir, int x, int z) throws IOException { + public static /* synchronized */ TagObject readChunk(File dir, int x, int z) throws IOException { // return getRegionFile(dir, x >> 3, z >> 3).readTag(x & 7, z & 7); 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)))), SizeTracker.INFINITE); + return TagLoader.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 { + public static /* synchronized */ void writeChunk(File dir, int x, int z, TagObject tag) throws IOException { ChunkBuffer buf = new ChunkBuffer(); DataOutputStream out = new DataOutputStream(new DeflaterOutputStream(buf)); - NBTLoader.write(tag, out); + TagLoader.write(tag, out); out.close(); getRegionFile(dir, x >> 3, z >> 3).write(x & 7, z & 7, buf.getData(), buf.size()); // getRegionFile(dir, x >> 3, z >> 3).writeTag(x & 7, z & 7, tag); } - public static ChunkServer readNbt(WorldServer world, int x, int z, NBTTagCompound tag) { + public static ChunkServer readNbt(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; @@ -375,12 +375,12 @@ public class Region { chunk.setTerrainPopulated(tag.getBool("TerrainPopulated")); chunk.setLightPopulated(tag.getBool("LightPopulated")); chunk.setInhabited(tag.getLong("InhabitedTime")); - NBTTagTagList sects = tag.getTagList("Sections"); + TagObjectList sects = tag.getTagList("Sections"); BlockArray[] sections = new BlockArray[sects.size()]; boolean light = !world.dimension.hasNoLight(); for(int n = 0; n < sects.size(); ++n) { - NBTTagCompound sect = sects.get(n); + TagObject sect = sects.get(n); int y = sect.getInt("Y"); BlockArray storage = new BlockArray(y << 4, light, null); byte[] blocks = sect.getByteArray("Blocks"); @@ -413,11 +413,11 @@ public class Region { chunk.setBiomes(tag.getByteArray("Biomes")); } - NBTTagTagList entities = tag.getTagList("Entities"); + TagObjectList entities = tag.getTagList("Entities"); if(entities != null) { for(int n = 0; n < entities.size(); ++n) { - NBTTagCompound ent = entities.get(n); + TagObject ent = entities.get(n); Entity entity = EntityRegistry.createEntityFromNBT(ent, world); chunk.setHasEntities(true); @@ -425,7 +425,7 @@ public class Region { chunk.addEntity(entity); Entity rider = entity; - for(NBTTagCompound ride = ent; ride.hasTag("Riding"); ride = ride.getTag("Riding")) { + for(TagObject ride = ent; ride.hasTag("Riding"); ride = ride.getTag("Riding")) { Entity pass = EntityRegistry.createEntityFromNBT(ride.getTag("Riding"), world); if(pass != null) { @@ -439,11 +439,11 @@ public class Region { } } - NBTTagTagList tiles = tag.getTagList("TileEntities"); + TagObjectList tiles = tag.getTagList("TileEntities"); if(tiles != null) { for(int n = 0; n < tiles.size(); ++n) { - NBTTagCompound tile = tiles.get(n); + TagObject tile = tiles.get(n); TileEntity tileentity = TileEntity.createAndLoadEntity(tile); if(tileentity != null) { @@ -453,12 +453,12 @@ public class Region { } if(tag.hasTagList("TileTicks")) { - NBTTagTagList ticks = tag.getTagList("TileTicks"); + TagObjectList ticks = tag.getTagList("TileTicks"); if(ticks != null) { int invalid = 0; for(int n = 0; n < ticks.size(); ++n) { - NBTTagCompound tick = ticks.get(n); + TagObject tick = ticks.get(n); Block block; if(tick.hasString("i")) { @@ -486,8 +486,8 @@ public class Region { return chunk; } - public static NBTTagCompound writeNbt(WorldServer world, ChunkServer chunk) { - NBTTagCompound tag = new NBTTagCompound(); + public static TagObject writeNbt(WorldServer world, ChunkServer chunk) { + TagObject tag = new TagObject(); // tag.setShort("V", (short)Config.PROTOCOL); tag.setLong("LastUpdate", world.getTime()); tag.setIntArray("HeightMap", chunk.getHeights()); @@ -495,12 +495,12 @@ public class Region { tag.setBool("LightPopulated", chunk.isLightPopulated()); tag.setLong("InhabitedTime", chunk.getInhabited()); Set sections = chunk.getStorage(); - NBTTagTagList sects = new NBTTagTagList(); + TagObjectList sects = new TagObjectList(); boolean light = !world.dimension.hasNoLight(); for(BlockArray storage : sections) { if(storage != null) { - NBTTagCompound sect = new NBTTagCompound(); + TagObject sect = new TagObject(); sect.setInt("Y", storage.getY() >> 4); byte[] blocks = new byte[storage.getData().length]; NibbleArray data = new NibbleArray(); @@ -547,11 +547,11 @@ public class Region { tag.setTagList("Sections", sects); tag.setByteArray("Biomes", chunk.getBiomes()); chunk.setHasEntities(false); - NBTTagTagList entities = new NBTTagTagList(); + TagObjectList entities = new TagObjectList(); for(int n = 0; n < chunk.getEntities().length; ++n) { for(Entity entity : chunk.getEntities()[n]) { - NBTTagCompound ent = new NBTTagCompound(); + TagObject ent = new TagObject(); if(entity.writeToNBTOptional(ent)) { chunk.setHasEntities(true); @@ -561,10 +561,10 @@ public class Region { } tag.setTagList("Entities", entities); - NBTTagTagList tiles = new NBTTagTagList(); + TagObjectList tiles = new TagObjectList(); for(TileEntity tileentity : chunk.getTiles().values()) { - NBTTagCompound tile = new NBTTagCompound(); + TagObject tile = new TagObject(); tileentity.writeToNBT(tile); tiles.add(tile); } @@ -574,10 +574,10 @@ public class Region { if(tics != null) { long time = world.getTime(); - NBTTagTagList ticks = new NBTTagTagList(); + TagObjectList ticks = new TagObjectList(); for(NextTickListEntry tic : tics) { - NBTTagCompound tick = new NBTTagCompound(); + TagObject tick = new TagObject(); String res = BlockRegistry.REGISTRY.getNameForObject(tic.getBlock()); tick.setString("i", res == null ? "" : res.toString()); tick.setInt("x", tic.position.getX()); diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index 36a7bbe..9cfeae2 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -40,9 +40,9 @@ import common.init.UniverseRegistry; import common.item.ItemDoor; import common.log.Log; import common.model.ParticleType; -import common.nbt.NBTLoader; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagLoader; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.network.IPlayer; import common.network.Packet; import common.packet.SPacketEntityStatus; @@ -129,7 +129,7 @@ public final class WorldServer extends AWorldServer { private final Set dropped = Collections.newSetFromMap(new ConcurrentHashMap()); private final LongHashMap chunks = new LongHashMap(); private final List loaded = Lists.newArrayList(); - private final Map toRemove = new ConcurrentHashMap(); + private final Map toRemove = new ConcurrentHashMap(); private final Set pending = Collections.newSetFromMap(new ConcurrentHashMap()); private final LongHashMap loaders = new LongHashMap(); private final Set loaderList = Sets.newHashSet(); @@ -297,11 +297,11 @@ public final class WorldServer extends AWorldServer { this.chunkDir.mkdirs(); this.seed = this.rand.longv(); this.dimension.setSeed(this.seed); - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(this.chunkDir, "data.nbt"); if(dat.exists() && dat.isFile()) - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } catch(Exception e) { Log.IO.error(e, "Konnte Weltdaten nicht laden"); @@ -439,19 +439,19 @@ public final class WorldServer extends AWorldServer { this.calculateInitialWeather(); this.updatePhysics(); if(!debug) { - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(this.chunkDir, "loaders.nbt"); if(dat.exists() && dat.isFile()) - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } catch(Exception e) { Log.IO.error(e, "Konnte Ladeliste nicht laden"); } if(tag != null && tag.hasTagList("Loaders")) { - NBTTagTagList list = tag.getTagList("Loaders"); + TagObjectList list = tag.getTagList("Loaders"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound pos = list.get(z); + TagObject pos = list.get(z); this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z"))); } this.loadersModified = false; @@ -479,7 +479,7 @@ public final class WorldServer extends AWorldServer { try { File dat = new File(this.chunkDir, "villages.nbt"); if(dat.exists() && dat.isFile()) - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } catch(Exception e) { Log.IO.error(e, "Konnte Dorfliste nicht laden"); @@ -928,11 +928,11 @@ public final class WorldServer extends AWorldServer { } public static boolean needsLoading(Dimension dim) { - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "loaders.nbt"); if(dat.exists() && dat.isFile()) - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } catch(Exception e) { return false; @@ -941,20 +941,20 @@ public final class WorldServer extends AWorldServer { } public static void loadWarps(Dimension dim, Map warps) { - NBTTagCompound tag = null; + TagObject tag = null; try { File dat = new File(new File(new File("chunk"), dim.getDimensionName()), "warps.nbt"); if(dat.exists() && dat.isFile()) - tag = NBTLoader.readGZip(dat); + tag = TagLoader.readGZip(dat); } catch(Exception e) { Log.IO.error(e, "Konnte Warpliste nicht laden"); return; } if(tag != null && tag.hasTagList("Warps")) { - NBTTagTagList list = tag.getTagList("Warps"); + TagObjectList list = tag.getTagList("Warps"); for(int z = 0; z < list.size(); z++) { - NBTTagCompound pos = list.get(z); + TagObject pos = list.get(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())); } @@ -962,14 +962,14 @@ public final class WorldServer extends AWorldServer { } public static void saveWarps(Map warps) { - Map map = Maps.newHashMap(); + Map map = Maps.newHashMap(); for(Entry pos : warps.entrySet()) { Dimension dim = UniverseRegistry.getDimension(pos.getValue().dim); if(dim != null) { - NBTTagTagList list = map.get(pos.getValue().dim); + TagObjectList list = map.get(pos.getValue().dim); if(list == null) - map.put(pos.getValue().dim, list = new NBTTagTagList()); - NBTTagCompound warp = new NBTTagCompound(); + map.put(pos.getValue().dim, list = new TagObjectList()); + TagObject warp = new TagObject(); warp.setString("Name", pos.getKey()); warp.setDouble("X", pos.getValue().x); warp.setDouble("Y", pos.getValue().y); @@ -980,16 +980,16 @@ public final class WorldServer extends AWorldServer { } } for(Dimension dim : UniverseRegistry.getDimensions()) { - NBTTagTagList list = map.get(dim.getDimensionId()); + TagObjectList 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(); + TagObject tag = new TagObject(); tag.setTagList("Warps", list); try { - NBTLoader.writeGZip(tag, file); + TagLoader.writeGZip(tag, file); } catch(Exception e) { Log.IO.error(e, "Konnte Warpliste nicht speichern"); @@ -1030,10 +1030,10 @@ public final class WorldServer extends AWorldServer { // } if(this.loadersModified) { this.loadersModified = false; - NBTTagCompound loaders = new NBTTagCompound(); - NBTTagTagList list = new NBTTagTagList(); + TagObject loaders = new TagObject(); + TagObjectList list = new TagObjectList(); for(BlockPos pos : this.loaderList) { - NBTTagCompound loader = new NBTTagCompound(); + TagObject loader = new TagObject(); loader.setInt("X", pos.getX()); loader.setInt("Y", pos.getY()); loader.setInt("Z", pos.getZ()); @@ -1046,7 +1046,7 @@ public final class WorldServer extends AWorldServer { } else { try { - NBTLoader.writeGZip(loaders, file); + TagLoader.writeGZip(loaders, file); } catch(Exception e) { Log.IO.error(e, "Konnte Ladeliste nicht speichern"); @@ -1058,7 +1058,7 @@ public final class WorldServer extends AWorldServer { // } // if(this.dataModified) { // this.dataModified = false; - NBTTagCompound data = new NBTTagCompound(); + TagObject data = new TagObject(); // data.setLong("Seed", this.seed); data.setTag("Generator", this.dimension.toNbt(true)); data.setLong("Time", this.time); @@ -1067,7 +1067,7 @@ public final class WorldServer extends AWorldServer { // ... File file = new File(this.chunkDir, "data.nbt"); try { - NBTLoader.writeGZip(data, file); + TagLoader.writeGZip(data, file); } catch(Exception e) { Log.IO.error(e, "Konnte Weltdaten nicht speichern"); @@ -1081,10 +1081,10 @@ public final class WorldServer extends AWorldServer { } } if(this.villageStorage != null && this.villageStorage.isDirty()) { - NBTTagCompound tag = this.villageStorage.writeToNBT(); + TagObject tag = this.villageStorage.writeToNBT(); File dat = new File(this.chunkDir, "villages.nbt"); try { - NBTLoader.writeGZip(tag, dat); + TagLoader.writeGZip(tag, dat); } catch(Exception e) { Log.IO.error(e, "Konnte Dorfliste nicht speichern"); @@ -1403,7 +1403,7 @@ public final class WorldServer extends AWorldServer { private ChunkServer loadChunkFromFile(int x, int z) { try { ChunkPos coord = new ChunkPos(x, z); - NBTTagCompound tag = this.toRemove.get(coord); + TagObject tag = this.toRemove.get(coord); if(tag == null) { tag = Region.readChunk(this.chunkDir, x, z); // DataInputStream in = ; @@ -1446,7 +1446,7 @@ public final class WorldServer extends AWorldServer { try { // NBTTagCompound ltag = new NBTTagCompound(); // tag.setTag("Level", ltag); - NBTTagCompound tag = Region.writeNbt(this, chunk); + TagObject tag = Region.writeNbt(this, chunk); ChunkPos coord = new ChunkPos(chunk.xPos, chunk.zPos); if(!this.pending.contains(coord)) { this.toRemove.put(coord, tag); @@ -1474,7 +1474,7 @@ public final class WorldServer extends AWorldServer { boolean flag; try { this.pending.add(coord); - NBTTagCompound tag = this.toRemove.remove(coord); + TagObject tag = this.toRemove.remove(coord); if(tag != null) { try { @@ -2230,7 +2230,7 @@ public final class WorldServer extends AWorldServer { if(successful) { if(block.getNbtData() != null) { this.removeTileEntity(pos); - NBTTagCompound tag = block.getNbtData(); + TagObject tag = block.getNbtData(); tag.setString("id", tag.getString("id")); tag.setInt("x", pos.getX()); tag.setInt("y", pos.getY()); @@ -2486,7 +2486,7 @@ public final class WorldServer extends AWorldServer { File file = this.getSaveFile(id); if(file.exists()) { // try { - data = new WorldSavedData(id, NBTLoader.readGZip(file)); + data = new WorldSavedData(id, TagLoader.readGZip(file)); // } // catch(Exception re) { // throw new RuntimeException("Konnte " + clazz.toString() + " nicht instanzieren", re); @@ -2523,7 +2523,7 @@ public final class WorldServer extends AWorldServer { // NBTTagCompound dtag = new NBTTagCompound(); // dtag.setTag("data", tag); // FileOutputStream out = new FileOutputStream(file); - NBTLoader.writeGZip(data.tag, file); + TagLoader.writeGZip(data.tag, file); // out.close(); } catch(Exception e) { @@ -2787,11 +2787,11 @@ public final class WorldServer extends AWorldServer { public static class WorldSavedData { public final String id; - public final NBTTagCompound tag; + public final TagObject tag; public boolean dirty; - public WorldSavedData(String id, NBTTagCompound tag) { + public WorldSavedData(String id, TagObject tag) { this.id = id; this.tag = tag; } diff --git a/server/src/main/java/server/worldgen/structure/MapGenStructure.java b/server/src/main/java/server/worldgen/structure/MapGenStructure.java index 570f066..b800737 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenStructure.java +++ b/server/src/main/java/server/worldgen/structure/MapGenStructure.java @@ -4,8 +4,8 @@ import java.util.Iterator; import java.util.Map; import common.collect.Maps; -import common.nbt.NBTBase; -import common.nbt.NBTTagCompound; +import common.nbt.Tag; +import common.nbt.TagObject; import common.rng.Random; import common.util.BlockPos; import common.util.ChunkPos; @@ -198,20 +198,20 @@ public abstract class MapGenStructure extends MapGenBase if (this.structureData == null) { - this.structureData = new WorldSavedData(this.getStructureName(), new NBTTagCompound()); + this.structureData = new WorldSavedData(this.getStructureName(), new TagObject()); worldIn.setItemData(this.getStructureName(), this.structureData); } else { - NBTTagCompound tag = this.structureData.tag; + TagObject tag = this.structureData.tag; for (String s : tag.getKeySet()) { - NBTBase nbtbase = tag.get(s); + Tag nbtbase = tag.get(s); - if (nbtbase instanceof NBTTagCompound) + if (nbtbase instanceof TagObject) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase; + TagObject nbttagcompound1 = (TagObject)nbtbase; if (nbttagcompound1.hasInt("ChunkX") && nbttagcompound1.hasInt("ChunkZ")) { diff --git a/server/src/main/java/server/worldgen/structure/MapGenStructureIO.java b/server/src/main/java/server/worldgen/structure/MapGenStructureIO.java index 16a2ab6..f572039 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenStructureIO.java +++ b/server/src/main/java/server/worldgen/structure/MapGenStructureIO.java @@ -4,7 +4,7 @@ import java.util.Map; import common.collect.Maps; import common.log.Log; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import server.world.WorldServer; public class MapGenStructureIO @@ -36,7 +36,7 @@ public class MapGenStructureIO return (String)componentClassToNameMap.get(component.getClass()); } - public static StructureStart getStructureStart(NBTTagCompound tagCompound, WorldServer worldIn) + public static StructureStart getStructureStart(TagObject tagCompound, WorldServer worldIn) { StructureStart structurestart = null; @@ -67,7 +67,7 @@ public class MapGenStructureIO return structurestart; } - public static StructureComponent getStructureComponent(NBTTagCompound tagCompound, WorldServer worldIn) + public static StructureComponent getStructureComponent(TagObject tagCompound, WorldServer worldIn) { StructureComponent structurecomponent = null; diff --git a/server/src/main/java/server/worldgen/structure/MapGenVillage.java b/server/src/main/java/server/worldgen/structure/MapGenVillage.java index e9ad387..64ee560 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenVillage.java +++ b/server/src/main/java/server/worldgen/structure/MapGenVillage.java @@ -5,7 +5,7 @@ import java.util.Set; import common.biome.Biome; import common.collect.Sets; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import server.world.WorldServer; @@ -140,13 +140,13 @@ public class MapGenVillage extends MapGenStructure return this.hasMoreThanTwoComponents; } - public void writeToNBT(NBTTagCompound tagCompound) + public void writeToNBT(TagObject tagCompound) { super.writeToNBT(tagCompound); tagCompound.setBool("Valid", this.hasMoreThanTwoComponents); } - public void readFromNBT(NBTTagCompound tagCompound) + public void readFromNBT(TagObject tagCompound) { super.readFromNBT(tagCompound); this.hasMoreThanTwoComponents = tagCompound.getBool("Valid"); diff --git a/server/src/main/java/server/worldgen/structure/StructureBridge.java b/server/src/main/java/server/worldgen/structure/StructureBridge.java index 61faef4..f53e66b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureBridge.java +++ b/server/src/main/java/server/worldgen/structure/StructureBridge.java @@ -4,7 +4,7 @@ import java.util.List; import common.collect.Lists; import common.init.Blocks; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityMobSpawner; @@ -115,13 +115,13 @@ public class StructureBridge this.field_111021_b = p_i45615_2_.zrange(3) == 0; } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.field_111021_b = tagCompound.getBool("Chest"); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Chest", this.field_111021_b); @@ -186,13 +186,13 @@ public class StructureBridge this.field_111020_b = p_i45613_2_.zrange(3) == 0; } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.field_111020_b = tagCompound.getBool("Chest"); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Chest", this.field_111020_b); @@ -636,13 +636,13 @@ 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(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.fillSeed = tagCompound.getInt("Seed"); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("Seed", this.fillSeed); @@ -951,11 +951,11 @@ public class StructureBridge super(p_i2054_1_); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { } @@ -1243,12 +1243,12 @@ public class StructureBridge } } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); } @@ -1325,13 +1325,13 @@ public class StructureBridge this.boundingBox = p_i45611_3_; } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasSpawner = tagCompound.getBool("Mob"); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Mob", this.hasSpawner); diff --git a/server/src/main/java/server/worldgen/structure/StructureComponent.java b/server/src/main/java/server/worldgen/structure/StructureComponent.java index f6199c9..c3d7856 100755 --- a/server/src/main/java/server/worldgen/structure/StructureComponent.java +++ b/server/src/main/java/server/worldgen/structure/StructureComponent.java @@ -8,7 +8,7 @@ import common.block.artificial.BlockDoor; import common.init.Blocks; import common.item.ItemDoor; import common.item.RngLoot; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; @@ -44,9 +44,9 @@ public abstract class StructureComponent * game.worldgen.structure.StructureComponent#componentType componentType}) to new NBTTagCompound and * returns it. */ - public NBTTagCompound createStructureBaseNBT() + public TagObject createStructureBaseNBT() { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + 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()); @@ -58,14 +58,14 @@ public abstract class StructureComponent /** * (abstract) Helper method to write subclass data to NBT */ - protected abstract void writeStructureToNBT(NBTTagCompound tagCompound); + protected abstract void writeStructureToNBT(TagObject tagCompound); /** * 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, NBTTagCompound tagCompound) + public void readStructureBaseNBT(WorldServer worldIn, TagObject tagCompound) { if (tagCompound.hasIntArray("BB")) { @@ -81,7 +81,7 @@ public abstract class StructureComponent /** * (abstract) Helper method to read subclass data from NBT */ - protected abstract void readStructureFromNBT(NBTTagCompound tagCompound); + protected abstract void readStructureFromNBT(TagObject tagCompound); /** * Initiates construction of the Structure Component picked, at the current Location of StructGen diff --git a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java index 13899f0..eca0d3a 100755 --- a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java +++ b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java @@ -7,8 +7,8 @@ import common.entity.item.EntityChestCart; import common.init.Blocks; import common.init.Items; import common.item.RngLoot; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagIntArrayList; +import common.nbt.TagObject; +import common.nbt.TagIntArrayList; import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; @@ -100,7 +100,7 @@ public class StructureMineshaft { } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(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(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { this.hasRails = tagCompound.getBool("hr"); this.hasSpiders = tagCompound.getBool("sc"); @@ -425,13 +425,13 @@ public class StructureMineshaft { } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { tagCompound.setBool("tf", this.isMultipleFloors); tagCompound.setInt("D", this.corridorDirection.getHorizontalIndex()); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { this.isMultipleFloors = tagCompound.getBool("tf"); this.corridorDirection = Facing.getHorizontal(tagCompound.getInt("D")); @@ -710,9 +710,9 @@ public class StructureMineshaft } } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { - NBTTagIntArrayList nbttaglist = new NBTTagIntArrayList(); + TagIntArrayList nbttaglist = new TagIntArrayList(); for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom) { @@ -722,9 +722,9 @@ public class StructureMineshaft tagCompound.setIntArrayList("Entrances", nbttaglist); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { - NBTTagIntArrayList nbttaglist = tagCompound.getIntArrayList("Entrances"); + TagIntArrayList nbttaglist = tagCompound.getIntArrayList("Entrances"); for (int i = 0; i < nbttaglist.size(); ++i) { @@ -746,11 +746,11 @@ public class StructureMineshaft this.boundingBox = structurebb; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { } diff --git a/server/src/main/java/server/worldgen/structure/StructureScattered.java b/server/src/main/java/server/worldgen/structure/StructureScattered.java index 1d4b062..28dc0d1 100755 --- a/server/src/main/java/server/worldgen/structure/StructureScattered.java +++ b/server/src/main/java/server/worldgen/structure/StructureScattered.java @@ -13,7 +13,7 @@ import common.init.Blocks; import common.init.Config; import common.init.Items; import common.item.RngLoot; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -41,7 +41,7 @@ public class StructureScattered super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("hasPlacedChest0", this.hasPlacedChest[0]); @@ -50,7 +50,7 @@ public class StructureScattered tagCompound.setBool("hasPlacedChest3", this.hasPlacedChest[3]); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasPlacedChest[0] = tagCompound.getBool("hasPlacedChest0"); @@ -293,7 +293,7 @@ public class StructureScattered } } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(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(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { this.scatteredFeatureSizeX = tagCompound.getInt("Width"); this.scatteredFeatureSizeY = tagCompound.getInt("Height"); @@ -366,7 +366,7 @@ public class StructureScattered super(p_i2064_1_, p_i2064_2_, 64, p_i2064_3_, 12, 10, 15); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("placedMainChest", this.placedMainChest); @@ -375,7 +375,7 @@ public class StructureScattered tagCompound.setBool("placedTrap2", this.placedTrap2); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.placedMainChest = tagCompound.getBool("placedMainChest"); @@ -613,13 +613,13 @@ public class StructureScattered super(p_i2066_1_, p_i2066_2_, 64, p_i2066_3_, 7, 7, 9); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Mage", this.hasMage); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasMage = tagCompound.getBool("Mage"); diff --git a/server/src/main/java/server/worldgen/structure/StructureStart.java b/server/src/main/java/server/worldgen/structure/StructureStart.java index 63d7a77..f2c235b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStart.java +++ b/server/src/main/java/server/worldgen/structure/StructureStart.java @@ -3,8 +3,8 @@ package server.worldgen.structure; import java.util.Iterator; import java.util.LinkedList; -import common.nbt.NBTTagCompound; -import common.nbt.NBTTagTagList; +import common.nbt.TagObject; +import common.nbt.TagObjectList; import common.rng.Random; import common.util.ChunkPos; import server.world.WorldServer; @@ -67,14 +67,14 @@ public abstract class StructureStart } } - public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) + public TagObject writeStructureComponentsToNBT(int chunkX, int chunkZ) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); + TagObject nbttagcompound = new TagObject(); nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); nbttagcompound.setInt("ChunkX", chunkX); nbttagcompound.setInt("ChunkZ", chunkZ); nbttagcompound.setIntArray("BB", this.boundingBox.toIntArray()); - NBTTagTagList nbttaglist = new NBTTagTagList(); + TagObjectList nbttaglist = new TagObjectList(); for (StructureComponent structurecomponent : this.components) { @@ -86,11 +86,11 @@ public abstract class StructureStart return nbttagcompound; } - public void writeToNBT(NBTTagCompound tagCompound) + public void writeToNBT(TagObject tagCompound) { } - public void readStructureComponentsFromNBT(WorldServer worldIn, NBTTagCompound tagCompound) + public void readStructureComponentsFromNBT(WorldServer worldIn, TagObject tagCompound) { this.chunkPosX = tagCompound.getInt("ChunkX"); this.chunkPosZ = tagCompound.getInt("ChunkZ"); @@ -100,7 +100,7 @@ public abstract class StructureStart this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB")); } - NBTTagTagList nbttaglist = tagCompound.getTagList("Children"); + TagObjectList nbttaglist = tagCompound.getTagList("Children"); for (int i = 0; i < nbttaglist.size(); ++i) { @@ -110,7 +110,7 @@ public abstract class StructureStart this.readFromNBT(tagCompound); } - public void readFromNBT(NBTTagCompound tagCompound) + public void readFromNBT(TagObject tagCompound) { } diff --git a/server/src/main/java/server/worldgen/structure/StructureStronghold.java b/server/src/main/java/server/worldgen/structure/StructureStronghold.java index 9650b55..69a91d8 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -10,7 +10,7 @@ import common.collect.Maps; import common.init.Blocks; import common.init.Items; import common.item.RngLoot; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityMobSpawner; @@ -252,13 +252,13 @@ public class StructureStronghold this.boundingBox = p_i45582_3_; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Chest", this.hasMadeChest); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasMadeChest = tagCompound.getBool("Chest"); @@ -324,13 +324,13 @@ 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(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("Steps", this.field_74993_a); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.field_74993_a = tagCompound.getInt("Steps"); @@ -425,7 +425,7 @@ public class StructureStronghold this.field_74999_h = p_i45580_2_.zrange(3) > 0; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("leftLow", this.field_74996_b); @@ -434,7 +434,7 @@ public class StructureStronghold tagCompound.setBool("rightHigh", this.field_74999_h); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.field_74996_b = tagCompound.getBool("leftLow"); @@ -608,13 +608,13 @@ public class StructureStronghold this.isLargeRoom = p_i45578_3_.getYSize() > 6; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Tall", this.isLargeRoom); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.isLargeRoom = tagCompound.getBool("Tall"); @@ -792,13 +792,13 @@ public class StructureStronghold this.boundingBox = p_i45577_3_; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Mob", this.hasSpawner); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasSpawner = tagCompound.getBool("Mob"); @@ -1030,13 +1030,13 @@ public class StructureStronghold this.roomType = p_i45575_2_.zrange(5); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("Type", this.roomType); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.roomType = tagCompound.getInt("Type"); @@ -1199,13 +1199,13 @@ public class StructureStronghold this.boundingBox = p_i45574_3_; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Source", this.field_75024_a); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.field_75024_a = tagCompound.getBool("Source"); @@ -1393,14 +1393,14 @@ public class StructureStronghold this.expandsZ = p_i45573_2_.zrange(2) == 0; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Left", this.expandsX); tagCompound.setBool("Right", this.expandsZ); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.expandsX = tagCompound.getBool("Left"); @@ -1472,12 +1472,12 @@ public class StructureStronghold super(p_i2087_1_); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { tagCompound.setString("EntryDoor", this.field_143013_d.getName()); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { this.field_143013_d = StructureStronghold.Stronghold.Door.getByName(tagCompound.getString("EntryDoor")); } diff --git a/server/src/main/java/server/worldgen/structure/StructureVillage.java b/server/src/main/java/server/worldgen/structure/StructureVillage.java index 1c23066..f20257a 100755 --- a/server/src/main/java/server/worldgen/structure/StructureVillage.java +++ b/server/src/main/java/server/worldgen/structure/StructureVillage.java @@ -16,7 +16,7 @@ import common.entity.npc.EntityHuman; import common.init.BlockRegistry; import common.init.Blocks; import common.init.Config; -import common.nbt.NBTTagCompound; +import common.nbt.TagObject; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -403,7 +403,7 @@ public class StructureVillage this.cropTypeD = this.func_151559_a(rand); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA)); @@ -412,7 +412,7 @@ public class StructureVillage tagCompound.setInt("CD", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeD)); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA")); @@ -512,14 +512,14 @@ public class StructureVillage this.cropTypeB = this.func_151560_a(rand); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA)); tagCompound.setInt("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB)); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInt("CA")); @@ -855,13 +855,13 @@ 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(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Chest", this.hasMadeChest); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.hasMadeChest = tagCompound.getBool("Chest"); @@ -1123,13 +1123,13 @@ public class StructureVillage this.isRoofAccessible = rand.chance(); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("Terrace", this.isRoofAccessible); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.isRoofAccessible = tagCompound.getBool("Terrace"); @@ -1252,13 +1252,13 @@ public class StructureVillage this.length = Math.max(p_i45562_4_.getXSize(), p_i45562_4_.getZSize()); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("Length", this.length); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.length = tagCompound.getInt("Length"); @@ -1507,14 +1507,14 @@ public class StructureVillage } } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { tagCompound.setInt("HPos", this.field_143015_k); tagCompound.setInt("VCount", this.villagersSpawned); tagCompound.setBool("Desert", this.isDesertVillage); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { this.field_143015_k = tagCompound.getInt("HPos"); this.villagersSpawned = tagCompound.getInt("VCount"); @@ -1789,14 +1789,14 @@ public class StructureVillage this.tablePosition = rand.zrange(3); } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInt("T", this.tablePosition); tagCompound.setBool("C", this.isTallHouse); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.tablePosition = tagCompound.getInt("T"); @@ -1901,13 +1901,13 @@ public class StructureVillage this.boundingBox = p_i45565_4_; } - protected void writeStructureToNBT(NBTTagCompound tagCompound) + protected void writeStructureToNBT(TagObject tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setBool("VSpawn", this.villagerSpawned); } - protected void readStructureFromNBT(NBTTagCompound tagCompound) + protected void readStructureFromNBT(TagObject tagCompound) { super.readStructureFromNBT(tagCompound); this.villagerSpawned = tagCompound.getBool("VSpawn");