change nbt format: change class names
This commit is contained in:
parent
4433d3b3df
commit
47a69ce8bc
143 changed files with 1207 additions and 1207 deletions
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Dimension
|
|||
return other == null ? -1 : this.name.compareTo(other.name);
|
||||
}
|
||||
|
||||
public static Dimension getByNbt(NBTTagCompound tag) {
|
||||
public static Dimension getByNbt(TagObject tag) {
|
||||
return getByNbt(tag, true, false, false, false);
|
||||
}
|
||||
|
||||
public static Dimension getByNbt(NBTTagCompound tag, boolean generator) {
|
||||
public static Dimension getByNbt(TagObject tag, boolean generator) {
|
||||
return getByNbt(tag, false, generator, !generator, false);
|
||||
}
|
||||
|
||||
private static Dimension getByNbt(NBTTagCompound tag, boolean mapOnly, boolean generator, boolean partialGen, boolean all) {
|
||||
private static Dimension getByNbt(TagObject tag, boolean mapOnly, boolean generator, boolean partialGen, boolean all) {
|
||||
Dimension dim;
|
||||
DimType type = DimType.getByName(tag.getString("Type"));
|
||||
int id = tag.getInt("ID");
|
||||
|
@ -847,17 +847,17 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
|
||||
public final Dimension copy(int id, String name) {
|
||||
NBTTagCompound tag = this.toNbt(true, false, true);
|
||||
TagObject tag = this.toNbt(true, false, true);
|
||||
tag.setInt("ID", id);
|
||||
tag.setString("Name", name);
|
||||
return getByNbt(tag, false, true, false, true);
|
||||
}
|
||||
|
||||
public final void fromNbt(NBTTagCompound tag) {
|
||||
public final void fromNbt(TagObject tag) {
|
||||
this.fromNbt(tag, true, false, false);
|
||||
}
|
||||
|
||||
private final void fromNbt(NBTTagCompound tag, boolean generator, boolean partialGen, boolean all) {
|
||||
private final void fromNbt(TagObject tag, boolean generator, boolean partialGen, boolean all) {
|
||||
if(this == Space.INSTANCE) {
|
||||
if(generator || partialGen)
|
||||
this.seed = tag.getLong("Seed");
|
||||
|
@ -921,7 +921,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.alt2 = BlockRegistry.getFromIdName(tag.getString("AltBlock2"), Blocks.sand.getState());
|
||||
this.caveFiller = BlockRegistry.getFromIdName(tag.getString("CaveFillBlock"), Blocks.lava.getState());
|
||||
if(tag.hasStringList("Layers")) {
|
||||
NBTTagStringList list = tag.getStringList("Layers");
|
||||
TagStringList list = tag.getStringList("Layers");
|
||||
this.layers = new State[list.size()];
|
||||
for(int z = 0; z < this.layers.length; z++) {
|
||||
this.layers[z] = BlockRegistry.getFromIdName(list.get(z), Blocks.stone.getState());
|
||||
|
@ -931,7 +931,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.layers = null;
|
||||
}
|
||||
if(tag.hasStringList("AddBiomes")) {
|
||||
NBTTagStringList list = tag.getStringList("AddBiomes");
|
||||
TagStringList list = tag.getStringList("AddBiomes");
|
||||
if(list.isEmpty()) {
|
||||
this.addBiomes = null;
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.addBiomes = null;
|
||||
}
|
||||
if(tag.hasStringList("FrostBiomes")) {
|
||||
NBTTagStringList list = tag.getStringList("FrostBiomes");
|
||||
TagStringList list = tag.getStringList("FrostBiomes");
|
||||
if(list.isEmpty()) {
|
||||
this.frostBiomes = null;
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.frostBiomes = null;
|
||||
}
|
||||
if(tag.hasStringList("ColdBiomes")) {
|
||||
NBTTagStringList list = tag.getStringList("ColdBiomes");
|
||||
TagStringList list = tag.getStringList("ColdBiomes");
|
||||
if(list.isEmpty()) {
|
||||
this.coldBiomes = null;
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.coldBiomes = null;
|
||||
}
|
||||
if(tag.hasStringList("MediumBiomes")) {
|
||||
NBTTagStringList list = tag.getStringList("MediumBiomes");
|
||||
TagStringList list = tag.getStringList("MediumBiomes");
|
||||
if(list.isEmpty()) {
|
||||
this.mediumBiomes = null;
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.mediumBiomes = null;
|
||||
}
|
||||
if(tag.hasStringList("HotBiomes")) {
|
||||
NBTTagStringList list = tag.getStringList("HotBiomes");
|
||||
TagStringList list = tag.getStringList("HotBiomes");
|
||||
if(list.isEmpty()) {
|
||||
this.hotBiomes = null;
|
||||
}
|
||||
|
@ -1007,9 +1007,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
this.ores.clear();
|
||||
if(tag.hasTagList("Ores")) {
|
||||
NBTTagTagList list = tag.getTagList("Ores");
|
||||
TagObjectList list = tag.getTagList("Ores");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
NBTTagCompound gen = list.get(z);
|
||||
TagObject gen = list.get(z);
|
||||
this.ores.add(new Ore(BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.getInt("Count"), gen.getInt("Add"), gen.getInt("Size"),
|
||||
gen.getInt("MinC"), gen.getInt("MaxS"), gen.getBool("Distrib")));
|
||||
|
@ -1017,9 +1017,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
this.lakes.clear();
|
||||
if(tag.hasTagList("Lakes")) {
|
||||
NBTTagTagList list = tag.getTagList("Lakes");
|
||||
TagObjectList list = tag.getTagList("Lakes");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
NBTTagCompound gen = list.get(z);
|
||||
TagObject gen = list.get(z);
|
||||
this.lakes.add(new Lake(
|
||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.hasString("Filler") ? BlockRegistry.getFromIdName(gen.getString("Filler"), null) : null,
|
||||
|
@ -1029,9 +1029,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
this.liquids.clear();
|
||||
if(tag.hasTagList("Liquids")) {
|
||||
NBTTagTagList list = tag.getTagList("Liquids");
|
||||
TagObjectList list = tag.getTagList("Liquids");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
NBTTagCompound gen = list.get(z);
|
||||
TagObject gen = list.get(z);
|
||||
this.liquids.add(new Liquid(
|
||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Lower")));
|
||||
|
@ -1068,7 +1068,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.setStarColor(tag.getInt("StarColor"));
|
||||
}
|
||||
else if(tag.hasTag("StarColorFnc")) {
|
||||
NBTTagCompound fnc = tag.getTag("StarColorFnc");
|
||||
TagObject fnc = tag.getTag("StarColorFnc");
|
||||
this.setStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
||||
fnc.getInt("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.setDeepStarColor(tag.getInt("DStarColor"));
|
||||
}
|
||||
else if(tag.hasTag("DStarColorFnc")) {
|
||||
NBTTagCompound fnc = tag.getTag("DStarColorFnc");
|
||||
TagObject fnc = tag.getTag("DStarColorFnc");
|
||||
this.setDeepStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
||||
fnc.getInt("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
||||
}
|
||||
|
@ -1089,12 +1089,12 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
}
|
||||
|
||||
public final NBTTagCompound toNbt(boolean generator) {
|
||||
public final TagObject toNbt(boolean generator) {
|
||||
return this.toNbt(generator, !generator, false);
|
||||
}
|
||||
|
||||
private final NBTTagCompound toNbt(boolean generator, boolean partialGen, boolean all) {
|
||||
NBTTagCompound tag = (all || !generator || this.id >= 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<Dimension
|
|||
tag.setString("AltBlock2", BlockRegistry.toIdName(this.alt2));
|
||||
tag.setString("CaveFillBlock", BlockRegistry.toIdName(this.caveFiller));
|
||||
if(this.layers != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(State gen : this.layers) {
|
||||
list.add(BlockRegistry.toIdName(gen));
|
||||
}
|
||||
tag.setStringList("Layers", list);
|
||||
}
|
||||
if(this.addBiomes != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(Biome biome : this.addBiomes) {
|
||||
list.add(biome.name.toLowerCase());
|
||||
}
|
||||
tag.setStringList("AddBiomes", list);
|
||||
}
|
||||
if(this.frostBiomes != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(Biome biome : this.frostBiomes) {
|
||||
list.add(biome.name.toLowerCase());
|
||||
}
|
||||
tag.setStringList("FrostBiomes", list);
|
||||
}
|
||||
if(this.coldBiomes != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(Biome biome : this.coldBiomes) {
|
||||
list.add(biome.name.toLowerCase());
|
||||
}
|
||||
tag.setStringList("ColdBiomes", list);
|
||||
}
|
||||
if(this.mediumBiomes != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(Biome biome : this.mediumBiomes) {
|
||||
list.add(biome.name.toLowerCase());
|
||||
}
|
||||
tag.setStringList("MediumBiomes", list);
|
||||
}
|
||||
if(this.hotBiomes != null) {
|
||||
NBTTagStringList list = new NBTTagStringList();
|
||||
TagStringList list = new TagStringList();
|
||||
for(Biome biome : this.hotBiomes) {
|
||||
list.add(biome.name.toLowerCase());
|
||||
}
|
||||
tag.setStringList("HotBiomes", list);
|
||||
}
|
||||
if(!this.ores.isEmpty()) {
|
||||
NBTTagTagList list = new NBTTagTagList();
|
||||
TagObjectList list = new TagObjectList();
|
||||
for(Ore gen : this.ores) {
|
||||
NBTTagCompound ore = new NBTTagCompound();
|
||||
TagObject ore = new TagObject();
|
||||
ore.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
ore.setBool("Distrib", gen.dist);
|
||||
ore.setInt("Size", gen.size);
|
||||
|
@ -1215,9 +1215,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setTagList("Ores", list);
|
||||
}
|
||||
if(!this.lakes.isEmpty()) {
|
||||
NBTTagTagList list = new NBTTagTagList();
|
||||
TagObjectList list = new TagObjectList();
|
||||
for(Lake gen : this.lakes) {
|
||||
NBTTagCompound lake = new NBTTagCompound();
|
||||
TagObject lake = new TagObject();
|
||||
lake.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
if(gen.filler != null)
|
||||
lake.setString("Filler", BlockRegistry.toIdName(gen.filler));
|
||||
|
@ -1232,9 +1232,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setTagList("Lakes", list);
|
||||
}
|
||||
if(!this.liquids.isEmpty()) {
|
||||
NBTTagTagList list = new NBTTagTagList();
|
||||
TagObjectList list = new TagObjectList();
|
||||
for(Liquid gen : this.liquids) {
|
||||
NBTTagCompound liquid = new NBTTagCompound();
|
||||
TagObject liquid = new TagObject();
|
||||
liquid.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
liquid.setBool("Lower", gen.lower);
|
||||
liquid.setInt("Chance", gen.chance);
|
||||
|
@ -1277,7 +1277,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setInt("StarColor", ((SingleColorGen)this.starColorFunc).color);
|
||||
}
|
||||
else if(this.starColorFunc instanceof SinusColorGen) {
|
||||
NBTTagCompound fnc = new NBTTagCompound();
|
||||
TagObject fnc = new TagObject();
|
||||
fnc.setFloat("Period", ((SinusColorGen)this.starColorFunc).period);
|
||||
fnc.setFloat("Det", ((SinusColorGen)this.starColorFunc).det);
|
||||
fnc.setFloat("Dist", ((SinusColorGen)this.starColorFunc).dist);
|
||||
|
@ -1290,7 +1290,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setInt("DStarColor", ((SingleColorGen)this.deepstarColorFunc).color);
|
||||
}
|
||||
else if(this.deepstarColorFunc instanceof SinusColorGen) {
|
||||
NBTTagCompound fnc = new NBTTagCompound();
|
||||
TagObject fnc = new TagObject();
|
||||
fnc.setFloat("Period", ((SinusColorGen)this.deepstarColorFunc).period);
|
||||
fnc.setFloat("Det", ((SinusColorGen)this.deepstarColorFunc).det);
|
||||
fnc.setFloat("Dist", ((SinusColorGen)this.deepstarColorFunc).dist);
|
||||
|
@ -1303,8 +1303,8 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
return tag;
|
||||
}
|
||||
|
||||
public final NBTTagCompound toNbt() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
public final TagObject toNbt() {
|
||||
TagObject tag = new TagObject();
|
||||
tag.setInt("ID", this.id);
|
||||
tag.setString("Name", this.name);
|
||||
tag.setString("Type", this.getType().getName());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.dimension;
|
||||
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.nbt.TagObject;
|
||||
|
||||
public abstract class Nameable {
|
||||
protected String customName = null;
|
||||
|
@ -13,11 +13,11 @@ public abstract class Nameable {
|
|||
this.customName = name;
|
||||
}
|
||||
|
||||
public void readNbt(NBTTagCompound tag) {
|
||||
public void readNbt(TagObject tag) {
|
||||
this.customName = tag.hasString("CustomName") ? tag.getString("CustomName") : null;
|
||||
}
|
||||
|
||||
public void writeNbt(NBTTagCompound tag) {
|
||||
public void writeNbt(TagObject tag) {
|
||||
if(this.customName != null)
|
||||
tag.setString("CustomName", this.customName);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.nbt.NBTTagTagList;
|
||||
import common.nbt.TagObject;
|
||||
import common.nbt.TagObjectList;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class EnchantmentHelper
|
|||
}
|
||||
else
|
||||
{
|
||||
NBTTagTagList nbttaglist = stack.getEnchantmentTagList();
|
||||
TagObjectList nbttaglist = stack.getEnchantmentTagList();
|
||||
|
||||
if (nbttaglist == null)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ public class EnchantmentHelper
|
|||
public static Map<Integer, Integer> getEnchantments(ItemStack stack)
|
||||
{
|
||||
Map<Integer, Integer> map = Maps.<Integer, Integer>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<Integer, Integer> 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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<Integer> list = Lists.<Integer>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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"))) {
|
||||
|
|
|
@ -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<Moon, Planet> 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<Planet, Star> 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<Star, Sector> 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<Sector, Galaxy> 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<Area, Domain> 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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String> VALID_TAGS = Sets.newHashSet("Name", "ench", "RepairCost");
|
||||
|
||||
protected final boolean validateNbt(NBTTagCompound tag) {
|
||||
protected final boolean validateNbt(TagObject tag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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"))
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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<String> 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);
|
||||
|
|
|
@ -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<String> list = Lists.<String>newArrayList();
|
||||
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
|
||||
|
||||
|
|
|
@ -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<String> tooltip)
|
||||
public static void addExplosionInfo(TagObject nbt, List<String> tooltip)
|
||||
{
|
||||
byte b0 = nbt.getByte("Type");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTException extends Exception {
|
||||
public NBTException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTTagDoubleList extends NBTTagList<NBTTagDouble> {
|
||||
protected byte getId() {
|
||||
return 14;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
protected NBTTagList<NBTTagDouble> 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));
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTTagFloatList extends NBTTagList<NBTTagFloat> {
|
||||
protected byte getId() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
protected NBTTagList<NBTTagFloat> 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));
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTTagIntArrayList extends NBTTagList<NBTTagIntArray> {
|
||||
protected byte getId() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
protected NBTTagList<NBTTagIntArray> 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));
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTTagStringList extends NBTTagList<NBTTagString> {
|
||||
protected byte getId() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected NBTTagList<NBTTagString> 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));
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.nbt;
|
||||
|
||||
public class NBTTagTagList extends NBTTagList<NBTTagCompound> {
|
||||
protected byte getId() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
protected NBTTagList<NBTTagCompound> 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);
|
||||
}
|
||||
}
|
60
common/src/main/java/common/nbt/Tag.java
Executable file
60
common/src/main/java/common/nbt/Tag.java
Executable file
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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() {
|
|
@ -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
|
27
common/src/main/java/common/nbt/TagDoubleList.java
Normal file
27
common/src/main/java/common/nbt/TagDoubleList.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagDoubleList extends TagList<TagDouble> {
|
||||
protected byte getId() {
|
||||
return 14;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
protected TagList<TagDouble> 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));
|
||||
}
|
||||
}
|
7
common/src/main/java/common/nbt/TagException.java
Executable file
7
common/src/main/java/common/nbt/TagException.java
Executable file
|
@ -0,0 +1,7 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagException extends Exception {
|
||||
public TagException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -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
|
27
common/src/main/java/common/nbt/TagFloatList.java
Normal file
27
common/src/main/java/common/nbt/TagFloatList.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagFloatList extends TagList<TagFloat> {
|
||||
protected byte getId() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
protected TagList<TagFloat> 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));
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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() {
|
27
common/src/main/java/common/nbt/TagIntArrayList.java
Normal file
27
common/src/main/java/common/nbt/TagIntArrayList.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagIntArrayList extends TagList<TagIntArray> {
|
||||
protected byte getId() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
protected TagList<TagIntArray> 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));
|
||||
}
|
||||
}
|
|
@ -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<Character> 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<NBTParser.Any> field_150491_b = Lists.<NBTParser.Any>newArrayList();
|
||||
protected java.util.List<TagInterpreter.Any> field_150491_b = Lists.<TagInterpreter.Any>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<NBTParser.Any> field_150492_b = Lists.<NBTParser.Any>newArrayList();
|
||||
protected java.util.List<TagInterpreter.Any> field_150492_b = Lists.<TagInterpreter.Any>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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
import common.collect.Lists;
|
||||
import common.log.Log;
|
||||
|
||||
abstract class NBTTagList<K extends NBTBase> extends NBTBase {
|
||||
abstract class TagList<K extends Tag> extends Tag {
|
||||
private List<K> list = Lists.newArrayList();
|
||||
|
||||
void write(DataOutput output) throws IOException {
|
||||
|
@ -27,7 +27,7 @@ abstract class NBTTagList<K extends NBTBase> extends NBTBase {
|
|||
tracker.read(4 * len);
|
||||
this.list = new ArrayList<K>(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<K extends NBTBase> extends NBTBase {
|
|||
|
||||
protected abstract byte getId();
|
||||
protected abstract byte getType();
|
||||
protected abstract NBTTagList<K> createInstance();
|
||||
protected abstract TagList<K> createInstance();
|
||||
protected abstract K getDefault();
|
||||
|
||||
public String toString() {
|
||||
|
@ -76,8 +76,8 @@ abstract class NBTTagList<K extends NBTBase> extends NBTBase {
|
|||
return this.list.size();
|
||||
}
|
||||
|
||||
public NBTBase copy() {
|
||||
NBTTagList<K> list = this.createInstance();
|
||||
public Tag copy() {
|
||||
TagList<K> list = this.createInstance();
|
||||
for(K tag : this.list) {
|
||||
list.list.add((K)tag.copy());
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ abstract class NBTTagList<K extends NBTBase> 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() {
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -10,12 +10,12 @@ import common.collect.Maps;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
public class NBTTagCompound extends NBTBase {
|
||||
private Map<String, NBTBase> tags = Maps.<String, NBTBase>newHashMap();
|
||||
public class TagObject extends Tag {
|
||||
private Map<String, Tag> tags = Maps.<String, Tag>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<String, NBTBase> entry : this.tags.entrySet()) {
|
||||
for(Entry<String, Tag> 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());
|
27
common/src/main/java/common/nbt/TagObjectList.java
Normal file
27
common/src/main/java/common/nbt/TagObjectList.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagObjectList extends TagList<TagObject> {
|
||||
protected byte getId() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
protected TagList<TagObject> 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);
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
27
common/src/main/java/common/nbt/TagStringList.java
Normal file
27
common/src/main/java/common/nbt/TagStringList.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package common.nbt;
|
||||
|
||||
public class TagStringList extends TagList<TagString> {
|
||||
protected byte getId() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
protected byte getType() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected TagList<TagString> 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));
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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<IClientPlayer> {
|
||||
private int entityId;
|
||||
private NBTTagCompound dimension;
|
||||
private TagObject dimension;
|
||||
private int type;
|
||||
private boolean editor;
|
||||
|
||||
|
|
|
@ -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<IClientPlayer>
|
||||
{
|
||||
private NBTTagCompound dimension;
|
||||
private TagObject dimension;
|
||||
private int type;
|
||||
private boolean editor;
|
||||
|
||||
|
|
|
@ -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<IClientPlayer>
|
||||
{
|
||||
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<IClientPlayer>
|
|||
handler.handleEntityNBT(this);
|
||||
}
|
||||
|
||||
public NBTTagCompound getTagCompound()
|
||||
public TagObject getTagCompound()
|
||||
{
|
||||
return this.tagCompound;
|
||||
}
|
||||
|
|
|
@ -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<IClientPlayer>
|
|||
{
|
||||
private BlockPos blockPos;
|
||||
private int type;
|
||||
private NBTTagCompound nbt;
|
||||
private TagObject nbt;
|
||||
|
||||
public SPacketUpdateTileEntity()
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ public class SPacketUpdateTileEntity implements Packet<IClientPlayer>
|
|||
{
|
||||
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<IClientPlayer>
|
|||
return this.type == TileRegistry.CLASS_TO_ID.get(tile.getClass());
|
||||
}
|
||||
|
||||
public NBTTagCompound getNbtCompound()
|
||||
public TagObject getNbtCompound()
|
||||
{
|
||||
return this.nbt;
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"))
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue