change nbt format
This commit is contained in:
parent
ad4949af16
commit
17aad1f023
124 changed files with 2063 additions and 2986 deletions
|
@ -81,9 +81,9 @@ public class GuiMerchant extends GuiContainer
|
||||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||||
int k = this.selectedMerchantRecipe;
|
int k = this.selectedMerchantRecipe;
|
||||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
ItemStack itemstack = merchantrecipe.getBuying();
|
||||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
ItemStack itemstack1 = merchantrecipe.getSecondBuy();
|
||||||
ItemStack itemstack2 = merchantrecipe.getItemToSell();
|
ItemStack itemstack2 = merchantrecipe.getSelling();
|
||||||
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
||||||
if(itemstack1 != null)
|
if(itemstack1 != null)
|
||||||
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
||||||
|
@ -180,9 +180,9 @@ public class GuiMerchant extends GuiContainer
|
||||||
// int j = (this.height - this.ySize) / 2;
|
// int j = (this.height - this.ySize) / 2;
|
||||||
int k = this.selectedMerchantRecipe;
|
int k = this.selectedMerchantRecipe;
|
||||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
ItemStack itemstack = merchantrecipe.getBuying();
|
||||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
ItemStack itemstack1 = merchantrecipe.getSecondBuy();
|
||||||
ItemStack itemstack2 = merchantrecipe.getItemToSell();
|
ItemStack itemstack2 = merchantrecipe.getSelling();
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
ItemRenderer.enableGUIStandardItemLighting();
|
ItemRenderer.enableGUIStandardItemLighting();
|
||||||
GlState.disableLighting();
|
GlState.disableLighting();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import common.entity.Entity;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
import common.item.ItemDye;
|
import common.item.ItemDye;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -192,7 +192,7 @@ public class EntityFirework
|
||||||
{
|
{
|
||||||
private int fireworkAge;
|
private int fireworkAge;
|
||||||
private final EffectRenderer theEffectRenderer;
|
private final EffectRenderer theEffectRenderer;
|
||||||
private NBTTagList fireworkExplosions;
|
private NBTTagTagList fireworkExplosions;
|
||||||
boolean twinkle;
|
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_, NBTTagCompound p_i46464_15_)
|
||||||
|
@ -206,21 +206,21 @@ public class EntityFirework
|
||||||
|
|
||||||
if (p_i46464_15_ != null)
|
if (p_i46464_15_ != null)
|
||||||
{
|
{
|
||||||
this.fireworkExplosions = p_i46464_15_.getTagList("Explosions", 10);
|
this.fireworkExplosions = p_i46464_15_.getTagList("Explosions");
|
||||||
|
|
||||||
if (this.fireworkExplosions.tagCount() == 0)
|
if (this.fireworkExplosions.size() == 0)
|
||||||
{
|
{
|
||||||
this.fireworkExplosions = null;
|
this.fireworkExplosions = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1;
|
this.particleMaxAge = this.fireworkExplosions.size() * 2 - 1;
|
||||||
|
|
||||||
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
|
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = this.fireworkExplosions.getTag(i);
|
||||||
|
|
||||||
if (nbttagcompound.getBoolean("Flicker"))
|
if (nbttagcompound.getBool("Flicker"))
|
||||||
{
|
{
|
||||||
this.twinkle = true;
|
this.twinkle = true;
|
||||||
this.particleMaxAge += 15;
|
this.particleMaxAge += 15;
|
||||||
|
@ -242,15 +242,15 @@ public class EntityFirework
|
||||||
boolean flag = this.isFarAway();
|
boolean flag = this.isFarAway();
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
|
|
||||||
if (this.fireworkExplosions.tagCount() >= 3)
|
if (this.fireworkExplosions.size() >= 3)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
|
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = this.fireworkExplosions.getTag(i);
|
||||||
|
|
||||||
if (nbttagcompound.getByte("Type") == 1)
|
if (nbttagcompound.getByte("Type") == 1)
|
||||||
{
|
{
|
||||||
|
@ -265,13 +265,13 @@ public class EntityFirework
|
||||||
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s1, 20.0F);
|
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s1, 20.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.tagCount())
|
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.size())
|
||||||
{
|
{
|
||||||
int k = this.fireworkAge / 2;
|
int k = this.fireworkAge / 2;
|
||||||
NBTTagCompound nbttagcompound1 = this.fireworkExplosions.getCompoundTagAt(k);
|
NBTTagCompound nbttagcompound1 = this.fireworkExplosions.getTag(k);
|
||||||
int l = nbttagcompound1.getByte("Type");
|
int l = nbttagcompound1.getByte("Type");
|
||||||
boolean flag4 = nbttagcompound1.getBoolean("Trail");
|
boolean flag4 = nbttagcompound1.getBool("Trail");
|
||||||
boolean flag2 = nbttagcompound1.getBoolean("Flicker");
|
boolean flag2 = nbttagcompound1.getBool("Flicker");
|
||||||
int[] aint = nbttagcompound1.getIntArray("Colors");
|
int[] aint = nbttagcompound1.getIntArray("Colors");
|
||||||
int[] aint1 = nbttagcompound1.getIntArray("FadeColors");
|
int[] aint1 = nbttagcompound1.getIntArray("FadeColors");
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class TileEntityItemStackRenderer
|
||||||
// {
|
// {
|
||||||
// NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();
|
// NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();
|
||||||
//
|
//
|
||||||
// if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
|
// if (nbttagcompound.hasString("SkullOwner") && nbttagcompound.getString("SkullOwner").length() > 0)
|
||||||
// {
|
// {
|
||||||
// user = nbttagcompound.getString("SkullOwner");
|
// user = nbttagcompound.getString("SkullOwner");
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||||
|
|
||||||
import common.log.Log;
|
import common.log.Log;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
|
|
||||||
public class Attributes
|
public class Attributes
|
||||||
{
|
{
|
||||||
|
@ -40,13 +40,13 @@ public class Attributes
|
||||||
/**
|
/**
|
||||||
* Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
|
* Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
|
||||||
*/
|
*/
|
||||||
public static NBTTagList writeBaseAttributeMapToNBT(AttributeMap map)
|
public static NBTTagTagList writeBaseAttributeMapToNBT(AttributeMap map)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (AttributeInstance iattributeinstance : map.getAllAttributes())
|
for (AttributeInstance iattributeinstance : map.getAllAttributes())
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
|
nbttaglist.add(writeAttributeInstanceToNBT(iattributeinstance));
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttaglist;
|
return nbttaglist;
|
||||||
|
@ -65,17 +65,17 @@ public class Attributes
|
||||||
|
|
||||||
if (collection != null && !collection.isEmpty())
|
if (collection != null && !collection.isEmpty())
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (AttributeModifier attributemodifier : collection)
|
for (AttributeModifier attributemodifier : collection)
|
||||||
{
|
{
|
||||||
if (attributemodifier.isSaved())
|
if (attributemodifier.isSaved())
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(writeAttributeModifierToNBT(attributemodifier));
|
nbttaglist.add(writeAttributeModifierToNBT(attributemodifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttagcompound.setTag("Modifiers", nbttaglist);
|
nbttagcompound.setTagList("Modifiers", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
|
@ -89,16 +89,16 @@ public class Attributes
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setString("Name", modifier.getName());
|
nbttagcompound.setString("Name", modifier.getName());
|
||||||
nbttagcompound.setDouble("Amount", modifier.getAmount());
|
nbttagcompound.setDouble("Amount", modifier.getAmount());
|
||||||
nbttagcompound.setBoolean("Multiply", modifier.isMultiplied());
|
nbttagcompound.setBool("Multiply", modifier.isMultiplied());
|
||||||
nbttagcompound.setLong("AttrId", modifier.getID());
|
nbttagcompound.setLong("AttrId", modifier.getID());
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAttributeModifiers(AttributeMap map, NBTTagList list)
|
public static void setAttributeModifiers(AttributeMap map, NBTTagTagList list)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < list.tagCount(); ++i)
|
for (int i = 0; i < list.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = list.getTag(i);
|
||||||
AttributeInstance iattributeinstance = map.getAttributeInstanceByName(nbttagcompound.getString("Name"));
|
AttributeInstance iattributeinstance = map.getAttributeInstanceByName(nbttagcompound.getString("Name"));
|
||||||
|
|
||||||
if (iattributeinstance != null)
|
if (iattributeinstance != null)
|
||||||
|
@ -116,13 +116,13 @@ public class Attributes
|
||||||
{
|
{
|
||||||
instance.setBaseValue(compound.getDouble("Base"));
|
instance.setBaseValue(compound.getDouble("Base"));
|
||||||
|
|
||||||
if (compound.hasKey("Modifiers", 9))
|
if (compound.hasTagList("Modifiers"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = compound.getTagList("Modifiers", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Modifiers");
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
AttributeModifier attributemodifier = readAttributeModifierFromNBT(nbttaglist.getCompoundTagAt(i));
|
AttributeModifier attributemodifier = readAttributeModifierFromNBT(nbttaglist.getTag(i));
|
||||||
|
|
||||||
if (attributemodifier != null)
|
if (attributemodifier != null)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ public class Attributes
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new AttributeModifier(id, compound.getString("Name"), compound.getDouble("Amount"), compound.getBoolean("Multiply"));
|
return new AttributeModifier(id, compound.getString("Name"), compound.getDouble("Amount"), compound.getBool("Multiply"));
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,10 +127,10 @@ public class BlockBanner extends BlockContainer
|
||||||
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
|
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
tileentity.writeToNBT(nbttagcompound);
|
tileentity.writeToNBT(nbttagcompound);
|
||||||
nbttagcompound.removeTag("x");
|
nbttagcompound.remove("x");
|
||||||
nbttagcompound.removeTag("y");
|
nbttagcompound.remove("y");
|
||||||
nbttagcompound.removeTag("z");
|
nbttagcompound.remove("z");
|
||||||
nbttagcompound.removeTag("id");
|
nbttagcompound.remove("id");
|
||||||
itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
|
itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
|
||||||
spawnAsEntity(worldIn, pos, itemstack);
|
spawnAsEntity(worldIn, pos, itemstack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import common.init.Blocks;
|
||||||
import common.init.MetalType;
|
import common.init.MetalType;
|
||||||
import common.init.UniverseRegistry;
|
import common.init.UniverseRegistry;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagStringList;
|
||||||
import common.nbt.NBTTagString;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -813,7 +813,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
private static Dimension getByNbt(NBTTagCompound tag, boolean mapOnly, boolean generator, boolean partialGen, boolean all) {
|
private static Dimension getByNbt(NBTTagCompound tag, boolean mapOnly, boolean generator, boolean partialGen, boolean all) {
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
DimType type = DimType.getByName(tag.getString("Type"));
|
DimType type = DimType.getByName(tag.getString("Type"));
|
||||||
int id = tag.getInteger("ID");
|
int id = tag.getInt("ID");
|
||||||
String name = tag.getString("Name");
|
String name = tag.getString("Name");
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case STAR:
|
case STAR:
|
||||||
|
@ -848,7 +848,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
|
|
||||||
public final Dimension copy(int id, String name) {
|
public final Dimension copy(int id, String name) {
|
||||||
NBTTagCompound tag = this.toNbt(true, false, true);
|
NBTTagCompound tag = this.toNbt(true, false, true);
|
||||||
tag.setInteger("ID", id);
|
tag.setInt("ID", id);
|
||||||
tag.setString("Name", name);
|
tag.setString("Name", name);
|
||||||
return getByNbt(tag, false, true, false, true);
|
return getByNbt(tag, false, true, false, true);
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
if(generator || partialGen) {
|
if(generator || partialGen) {
|
||||||
this.seed = tag.getLong("Seed");
|
this.seed = tag.getLong("Seed");
|
||||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
this.seaLevel = tag.getInteger("SeaLevel");
|
this.seaLevel = tag.getInt("SeaLevel");
|
||||||
this.filler = BlockRegistry.getFromIdName(tag.getString("FillerBlock"), Blocks.stone.getState());
|
this.filler = BlockRegistry.getFromIdName(tag.getString("FillerBlock"), Blocks.stone.getState());
|
||||||
this.liquid = BlockRegistry.getFromIdName(tag.getString("LiquidBlock"), Blocks.water.getState());
|
this.liquid = BlockRegistry.getFromIdName(tag.getString("LiquidBlock"), Blocks.water.getState());
|
||||||
}
|
}
|
||||||
|
@ -891,26 +891,26 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.noiseGen.biomeScaleOffset = tag.getFloat("BScaleOffset");
|
this.noiseGen.biomeScaleOffset = tag.getFloat("BScaleOffset");
|
||||||
this.generatorType = GeneratorType.getByName(tag.getString("Generator"));
|
this.generatorType = GeneratorType.getByName(tag.getString("Generator"));
|
||||||
this.replacerType = ReplacerType.getByName(tag.getString("Replacer"));
|
this.replacerType = ReplacerType.getByName(tag.getString("Replacer"));
|
||||||
this.mobs = tag.getBoolean("MobGen");
|
this.mobs = tag.getBool("MobGen");
|
||||||
this.snow = tag.getBoolean("SnowGen");
|
this.snow = tag.getBool("SnowGen");
|
||||||
this.ceiling = tag.getBoolean("Ceiling");
|
this.ceiling = tag.getBool("Ceiling");
|
||||||
this.caves = tag.getBoolean("Caves");
|
this.caves = tag.getBool("Caves");
|
||||||
this.ravines = tag.getBoolean("Ravines");
|
this.ravines = tag.getBool("Ravines");
|
||||||
this.strideCaves = tag.getBoolean("AltCaves");
|
this.strideCaves = tag.getBool("AltCaves");
|
||||||
this.useStrongholds = tag.getBoolean("Strongholds");
|
this.useStrongholds = tag.getBool("Strongholds");
|
||||||
this.useVillages = tag.getBoolean("Villages");
|
this.useVillages = tag.getBool("Villages");
|
||||||
this.useMineshafts = tag.getBoolean("Mineshafts");
|
this.useMineshafts = tag.getBool("Mineshafts");
|
||||||
this.useScattered = tag.getBoolean("Scattered");
|
this.useScattered = tag.getBool("Scattered");
|
||||||
this.useFortresses = tag.getBoolean("Fortresses");
|
this.useFortresses = tag.getBool("Fortresses");
|
||||||
this.dungeons = tag.getInteger("Dungeons");
|
this.dungeons = tag.getInt("Dungeons");
|
||||||
this.biomeSize = tag.getInteger("BiomeSize");
|
this.biomeSize = tag.getInt("BiomeSize");
|
||||||
this.riverSize = tag.getInteger("RiverSize");
|
this.riverSize = tag.getInt("RiverSize");
|
||||||
this.snowRarity = tag.getInteger("SnowRarity");
|
this.snowRarity = tag.getInt("SnowRarity");
|
||||||
this.seaRarity = tag.getInteger("SeaRarity");
|
this.seaRarity = tag.getInt("SeaRarity");
|
||||||
this.addRarity = tag.getInteger("AddRarity");
|
this.addRarity = tag.getInt("AddRarity");
|
||||||
// this.biomeRarity = tag.getInteger("BiomeRarity");
|
// this.biomeRarity = tag.getInteger("BiomeRarity");
|
||||||
this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome"));
|
this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome"));
|
||||||
this.semiFixed = tag.getBoolean("SemiFixed");
|
this.semiFixed = tag.getBool("SemiFixed");
|
||||||
this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather"));
|
this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather"));
|
||||||
this.defaultWeather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
|
this.defaultWeather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
|
||||||
this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves"));
|
this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves"));
|
||||||
|
@ -920,85 +920,85 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.getState());
|
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.getState());
|
||||||
this.alt2 = BlockRegistry.getFromIdName(tag.getString("AltBlock2"), Blocks.sand.getState());
|
this.alt2 = BlockRegistry.getFromIdName(tag.getString("AltBlock2"), Blocks.sand.getState());
|
||||||
this.caveFiller = BlockRegistry.getFromIdName(tag.getString("CaveFillBlock"), Blocks.lava.getState());
|
this.caveFiller = BlockRegistry.getFromIdName(tag.getString("CaveFillBlock"), Blocks.lava.getState());
|
||||||
if(tag.hasKey("Layers", 9)) {
|
if(tag.hasStringList("Layers")) {
|
||||||
NBTTagList list = tag.getTagList("Layers", 8);
|
NBTTagStringList list = tag.getStringList("Layers");
|
||||||
this.layers = new State[list.tagCount()];
|
this.layers = new State[list.size()];
|
||||||
for(int z = 0; z < this.layers.length; z++) {
|
for(int z = 0; z < this.layers.length; z++) {
|
||||||
this.layers[z] = BlockRegistry.getFromIdName(list.getStringTagAt(z), Blocks.stone.getState());
|
this.layers[z] = BlockRegistry.getFromIdName(list.getString(z), Blocks.stone.getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.layers = null;
|
this.layers = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("AddBiomes", 9)) {
|
if(tag.hasStringList("AddBiomes")) {
|
||||||
NBTTagList list = tag.getTagList("AddBiomes", 8);
|
NBTTagStringList list = tag.getStringList("AddBiomes");
|
||||||
if(list.hasNoTags()) {
|
if(list.isEmpty()) {
|
||||||
this.addBiomes = null;
|
this.addBiomes = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.addBiomes = new Biome[list.tagCount()];
|
this.addBiomes = new Biome[list.size()];
|
||||||
for(int z = 0; z < this.addBiomes.length; z++) {
|
for(int z = 0; z < this.addBiomes.length; z++) {
|
||||||
this.addBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
this.addBiomes[z] = Biome.findByName(list.getString(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.addBiomes = null;
|
this.addBiomes = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("FrostBiomes", 9)) {
|
if(tag.hasStringList("FrostBiomes")) {
|
||||||
NBTTagList list = tag.getTagList("FrostBiomes", 8);
|
NBTTagStringList list = tag.getStringList("FrostBiomes");
|
||||||
if(list.hasNoTags()) {
|
if(list.isEmpty()) {
|
||||||
this.frostBiomes = null;
|
this.frostBiomes = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.frostBiomes = new Biome[list.tagCount()];
|
this.frostBiomes = new Biome[list.size()];
|
||||||
for(int z = 0; z < this.frostBiomes.length; z++) {
|
for(int z = 0; z < this.frostBiomes.length; z++) {
|
||||||
this.frostBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
this.frostBiomes[z] = Biome.findByName(list.getString(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.frostBiomes = null;
|
this.frostBiomes = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("ColdBiomes", 9)) {
|
if(tag.hasStringList("ColdBiomes")) {
|
||||||
NBTTagList list = tag.getTagList("ColdBiomes", 8);
|
NBTTagStringList list = tag.getStringList("ColdBiomes");
|
||||||
if(list.hasNoTags()) {
|
if(list.isEmpty()) {
|
||||||
this.coldBiomes = null;
|
this.coldBiomes = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.coldBiomes = new Biome[list.tagCount()];
|
this.coldBiomes = new Biome[list.size()];
|
||||||
for(int z = 0; z < this.coldBiomes.length; z++) {
|
for(int z = 0; z < this.coldBiomes.length; z++) {
|
||||||
this.coldBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
this.coldBiomes[z] = Biome.findByName(list.getString(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.coldBiomes = null;
|
this.coldBiomes = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("MediumBiomes", 9)) {
|
if(tag.hasStringList("MediumBiomes")) {
|
||||||
NBTTagList list = tag.getTagList("MediumBiomes", 8);
|
NBTTagStringList list = tag.getStringList("MediumBiomes");
|
||||||
if(list.hasNoTags()) {
|
if(list.isEmpty()) {
|
||||||
this.mediumBiomes = null;
|
this.mediumBiomes = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.mediumBiomes = new Biome[list.tagCount()];
|
this.mediumBiomes = new Biome[list.size()];
|
||||||
for(int z = 0; z < this.mediumBiomes.length; z++) {
|
for(int z = 0; z < this.mediumBiomes.length; z++) {
|
||||||
this.mediumBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
this.mediumBiomes[z] = Biome.findByName(list.getString(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.mediumBiomes = null;
|
this.mediumBiomes = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("HotBiomes", 9)) {
|
if(tag.hasStringList("HotBiomes")) {
|
||||||
NBTTagList list = tag.getTagList("HotBiomes", 8);
|
NBTTagStringList list = tag.getStringList("HotBiomes");
|
||||||
if(list.hasNoTags()) {
|
if(list.isEmpty()) {
|
||||||
this.hotBiomes = null;
|
this.hotBiomes = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hotBiomes = new Biome[list.tagCount()];
|
this.hotBiomes = new Biome[list.size()];
|
||||||
for(int z = 0; z < this.hotBiomes.length; z++) {
|
for(int z = 0; z < this.hotBiomes.length; z++) {
|
||||||
this.hotBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
this.hotBiomes[z] = Biome.findByName(list.getString(z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1006,38 +1006,38 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.hotBiomes = null;
|
this.hotBiomes = null;
|
||||||
}
|
}
|
||||||
this.ores.clear();
|
this.ores.clear();
|
||||||
if(tag.hasKey("Ores", 9)) {
|
if(tag.hasTagList("Ores")) {
|
||||||
NBTTagList list = tag.getTagList("Ores", 10);
|
NBTTagTagList list = tag.getTagList("Ores");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
NBTTagCompound gen = list.getTag(z);
|
||||||
this.ores.add(new Ore(BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
this.ores.add(new Ore(BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||||
gen.getInteger("Count"), gen.getInteger("Add"), gen.getInteger("Size"),
|
gen.getInt("Count"), gen.getInt("Add"), gen.getInt("Size"),
|
||||||
gen.getInteger("MinC"), gen.getInteger("MaxS"), gen.getBoolean("Distrib")));
|
gen.getInt("MinC"), gen.getInt("MaxS"), gen.getBool("Distrib")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lakes.clear();
|
this.lakes.clear();
|
||||||
if(tag.hasKey("Lakes", 9)) {
|
if(tag.hasTagList("Lakes")) {
|
||||||
NBTTagList list = tag.getTagList("Lakes", 10);
|
NBTTagTagList list = tag.getTagList("Lakes");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
NBTTagCompound gen = list.getTag(z);
|
||||||
this.lakes.add(new Lake(
|
this.lakes.add(new Lake(
|
||||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||||
gen.hasKey("Filler", 8) ? BlockRegistry.getFromIdName(gen.getString("Filler"), null) : null,
|
gen.hasString("Filler") ? BlockRegistry.getFromIdName(gen.getString("Filler"), null) : null,
|
||||||
gen.hasKey("Top", 8) ? BlockRegistry.getFromIdName(gen.getString("Top"), null) : null,
|
gen.hasString("Top") ? BlockRegistry.getFromIdName(gen.getString("Top"), null) : null,
|
||||||
gen.getInteger("Chance"), gen.getInteger("Min"), gen.getInteger("Max"), gen.getBoolean("Ratiod")));
|
gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Ratiod")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.liquids.clear();
|
this.liquids.clear();
|
||||||
if(tag.hasKey("Liquids", 9)) {
|
if(tag.hasTagList("Liquids")) {
|
||||||
NBTTagList list = tag.getTagList("Liquids", 10);
|
NBTTagTagList list = tag.getTagList("Liquids");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
NBTTagCompound gen = list.getTag(z);
|
||||||
this.liquids.add(new Liquid(
|
this.liquids.add(new Liquid(
|
||||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||||
gen.getInteger("Chance"), gen.getInteger("Min"), gen.getInteger("Max"), gen.getBoolean("Lower")));
|
gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Lower")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.populated = !tag.hasKey("NoPopulation", 1) || !tag.getBoolean("NoPopulation");
|
this.populated = !tag.hasBool("NoPopulation") || !tag.getBool("NoPopulation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1045,14 +1045,14 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.readNbt(tag);
|
this.readNbt(tag);
|
||||||
}
|
}
|
||||||
// this.readNbt(tag);
|
// this.readNbt(tag);
|
||||||
// this.customName = tag.hasKey("CustomName", 8) ? tag.getString("CustomName") : null;
|
// this.customName = tag.hasString("CustomName") ? tag.getString("CustomName") : null;
|
||||||
if(all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
this.denseFog = tag.getBoolean("DenseFog");
|
this.denseFog = tag.getBool("DenseFog");
|
||||||
this.timeQualifier = tag.getInteger("ImperialTime");
|
this.timeQualifier = tag.getInt("ImperialTime");
|
||||||
this.brightness = tag.getInteger("Brightness");
|
this.brightness = tag.getInt("Brightness");
|
||||||
this.skyColor = tag.getInteger("SkyColor");
|
this.skyColor = tag.getInt("SkyColor");
|
||||||
this.fogColor = tag.getInteger("FogColor");
|
this.fogColor = tag.getInt("FogColor");
|
||||||
this.cloudColor = tag.getInteger("CloudColor");
|
this.cloudColor = tag.getInt("CloudColor");
|
||||||
this.gravity = tag.getFloat("Gravity");
|
this.gravity = tag.getFloat("Gravity");
|
||||||
this.temperature = tag.getFloat("Temperature");
|
this.temperature = tag.getFloat("Temperature");
|
||||||
this.orbitOffset = tag.getFloat("OrbitOffset");
|
this.orbitOffset = tag.getFloat("OrbitOffset");
|
||||||
|
@ -1062,26 +1062,26 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.orbitalPeriod = tag.getLong("OrbitalPeriod");
|
this.orbitalPeriod = tag.getLong("OrbitalPeriod");
|
||||||
this.rotationPeriod = tag.getLong("RotationPeriod");
|
this.rotationPeriod = tag.getLong("RotationPeriod");
|
||||||
this.cloudTexture = CloudType.getByName(tag.getString("CloudTexture"));
|
this.cloudTexture = CloudType.getByName(tag.getString("CloudTexture"));
|
||||||
this.skyboxTexture = tag.hasKey("SkyBoxTexture", 8) ?
|
this.skyboxTexture = tag.hasString("SkyBoxTexture") ?
|
||||||
SkyboxType.getByName(tag.getString("SkyBoxTexture")) : null;
|
SkyboxType.getByName(tag.getString("SkyBoxTexture")) : null;
|
||||||
if(tag.hasKey("StarColor", 3)) {
|
if(tag.hasInt("StarColor")) {
|
||||||
this.setStarColor(tag.getInteger("StarColor"));
|
this.setStarColor(tag.getInt("StarColor"));
|
||||||
}
|
}
|
||||||
else if(tag.hasKey("StarColorFnc", 10)) {
|
else if(tag.hasTag("StarColorFnc")) {
|
||||||
NBTTagCompound fnc = tag.getCompoundTag("StarColorFnc");
|
NBTTagCompound fnc = tag.getTag("StarColorFnc");
|
||||||
this.setStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
this.setStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
||||||
fnc.getInteger("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
fnc.getInt("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.starColorFunc = null;
|
this.starColorFunc = null;
|
||||||
}
|
}
|
||||||
if(tag.hasKey("DStarColor", 3)) {
|
if(tag.hasInt("DStarColor")) {
|
||||||
this.setDeepStarColor(tag.getInteger("DStarColor"));
|
this.setDeepStarColor(tag.getInt("DStarColor"));
|
||||||
}
|
}
|
||||||
else if(tag.hasKey("DStarColorFnc", 10)) {
|
else if(tag.hasTag("DStarColorFnc")) {
|
||||||
NBTTagCompound fnc = tag.getCompoundTag("DStarColorFnc");
|
NBTTagCompound fnc = tag.getTag("DStarColorFnc");
|
||||||
this.setDeepStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
this.setDeepStarColorSin(fnc.getFloat("Period"), fnc.getFloat("Det"), fnc.getFloat("Dist"),
|
||||||
fnc.getInteger("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
fnc.getInt("Color"), fnc.getByte("DetChn"), fnc.getByte("DistChn"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.deepstarColorFunc = null;
|
this.deepstarColorFunc = null;
|
||||||
|
@ -1103,7 +1103,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
if(generator || partialGen) {
|
if(generator || partialGen) {
|
||||||
tag.setLong("Seed", this.seed);
|
tag.setLong("Seed", this.seed);
|
||||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
tag.setInteger("SeaLevel", this.seaLevel);
|
tag.setInt("SeaLevel", this.seaLevel);
|
||||||
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
||||||
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
||||||
}
|
}
|
||||||
|
@ -1128,28 +1128,28 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
tag.setFloat("BScaleOffset", this.noiseGen.biomeScaleOffset);
|
tag.setFloat("BScaleOffset", this.noiseGen.biomeScaleOffset);
|
||||||
tag.setString("Generator", this.generatorType.getName());
|
tag.setString("Generator", this.generatorType.getName());
|
||||||
tag.setString("Replacer", this.replacerType.getName());
|
tag.setString("Replacer", this.replacerType.getName());
|
||||||
tag.setBoolean("MobGen", this.mobs);
|
tag.setBool("MobGen", this.mobs);
|
||||||
tag.setBoolean("SnowGen", this.snow);
|
tag.setBool("SnowGen", this.snow);
|
||||||
tag.setBoolean("Ceiling", this.ceiling);
|
tag.setBool("Ceiling", this.ceiling);
|
||||||
tag.setBoolean("Caves", this.caves);
|
tag.setBool("Caves", this.caves);
|
||||||
tag.setBoolean("Ravines", this.ravines);
|
tag.setBool("Ravines", this.ravines);
|
||||||
tag.setBoolean("AltCaves", this.strideCaves);
|
tag.setBool("AltCaves", this.strideCaves);
|
||||||
tag.setBoolean("Strongholds", this.useStrongholds);
|
tag.setBool("Strongholds", this.useStrongholds);
|
||||||
tag.setBoolean("Villages", this.useVillages);
|
tag.setBool("Villages", this.useVillages);
|
||||||
tag.setBoolean("Mineshafts", this.useMineshafts);
|
tag.setBool("Mineshafts", this.useMineshafts);
|
||||||
tag.setBoolean("Scattered", this.useScattered);
|
tag.setBool("Scattered", this.useScattered);
|
||||||
tag.setBoolean("Fortresses", this.useFortresses);
|
tag.setBool("Fortresses", this.useFortresses);
|
||||||
tag.setInteger("Dungeons", this.dungeons);
|
tag.setInt("Dungeons", this.dungeons);
|
||||||
tag.setInteger("BiomeSize", this.biomeSize);
|
tag.setInt("BiomeSize", this.biomeSize);
|
||||||
tag.setInteger("RiverSize", this.riverSize);
|
tag.setInt("RiverSize", this.riverSize);
|
||||||
tag.setInteger("SnowRarity", this.snowRarity);
|
tag.setInt("SnowRarity", this.snowRarity);
|
||||||
tag.setInteger("SeaRarity", this.seaRarity);
|
tag.setInt("SeaRarity", this.seaRarity);
|
||||||
tag.setInteger("AddRarity", this.addRarity);
|
tag.setInt("AddRarity", this.addRarity);
|
||||||
// tag.setInteger("BiomeRarity", this.biomeRarity);
|
// tag.setInteger("BiomeRarity", this.biomeRarity);
|
||||||
// if(this.defaultBiome != null)
|
// if(this.defaultBiome != null)
|
||||||
tag.setString("DefaultBiome", this.defaultBiome.name.toLowerCase());
|
tag.setString("DefaultBiome", this.defaultBiome.name.toLowerCase());
|
||||||
// if(this.mainBiome != null)
|
// if(this.mainBiome != null)
|
||||||
tag.setBoolean("SemiFixed", this.semiFixed);
|
tag.setBool("SemiFixed", this.semiFixed);
|
||||||
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
||||||
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
||||||
tag.setString("TopBlock", BlockRegistry.toIdName(this.top));
|
tag.setString("TopBlock", BlockRegistry.toIdName(this.top));
|
||||||
|
@ -1158,64 +1158,64 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
tag.setString("AltBlock2", BlockRegistry.toIdName(this.alt2));
|
tag.setString("AltBlock2", BlockRegistry.toIdName(this.alt2));
|
||||||
tag.setString("CaveFillBlock", BlockRegistry.toIdName(this.caveFiller));
|
tag.setString("CaveFillBlock", BlockRegistry.toIdName(this.caveFiller));
|
||||||
if(this.layers != null) {
|
if(this.layers != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(State gen : this.layers) {
|
for(State gen : this.layers) {
|
||||||
list.appendTag(new NBTTagString(BlockRegistry.toIdName(gen)));
|
list.add(BlockRegistry.toIdName(gen));
|
||||||
}
|
}
|
||||||
tag.setTag("Layers", list);
|
tag.setStringList("Layers", list);
|
||||||
}
|
}
|
||||||
if(this.addBiomes != null) {
|
if(this.addBiomes != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(Biome biome : this.addBiomes) {
|
for(Biome biome : this.addBiomes) {
|
||||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
list.add(biome.name.toLowerCase());
|
||||||
}
|
}
|
||||||
tag.setTag("AddBiomes", list);
|
tag.setStringList("AddBiomes", list);
|
||||||
}
|
}
|
||||||
if(this.frostBiomes != null) {
|
if(this.frostBiomes != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(Biome biome : this.frostBiomes) {
|
for(Biome biome : this.frostBiomes) {
|
||||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
list.add(biome.name.toLowerCase());
|
||||||
}
|
}
|
||||||
tag.setTag("FrostBiomes", list);
|
tag.setStringList("FrostBiomes", list);
|
||||||
}
|
}
|
||||||
if(this.coldBiomes != null) {
|
if(this.coldBiomes != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(Biome biome : this.coldBiomes) {
|
for(Biome biome : this.coldBiomes) {
|
||||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
list.add(biome.name.toLowerCase());
|
||||||
}
|
}
|
||||||
tag.setTag("ColdBiomes", list);
|
tag.setStringList("ColdBiomes", list);
|
||||||
}
|
}
|
||||||
if(this.mediumBiomes != null) {
|
if(this.mediumBiomes != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(Biome biome : this.mediumBiomes) {
|
for(Biome biome : this.mediumBiomes) {
|
||||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
list.add(biome.name.toLowerCase());
|
||||||
}
|
}
|
||||||
tag.setTag("MediumBiomes", list);
|
tag.setStringList("MediumBiomes", list);
|
||||||
}
|
}
|
||||||
if(this.hotBiomes != null) {
|
if(this.hotBiomes != null) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagStringList list = new NBTTagStringList();
|
||||||
for(Biome biome : this.hotBiomes) {
|
for(Biome biome : this.hotBiomes) {
|
||||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
list.add(biome.name.toLowerCase());
|
||||||
}
|
}
|
||||||
tag.setTag("HotBiomes", list);
|
tag.setStringList("HotBiomes", list);
|
||||||
}
|
}
|
||||||
if(!this.ores.isEmpty()) {
|
if(!this.ores.isEmpty()) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagTagList list = new NBTTagTagList();
|
||||||
for(Ore gen : this.ores) {
|
for(Ore gen : this.ores) {
|
||||||
NBTTagCompound ore = new NBTTagCompound();
|
NBTTagCompound ore = new NBTTagCompound();
|
||||||
ore.setString("Block", BlockRegistry.toIdName(gen.state));
|
ore.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||||
ore.setBoolean("Distrib", gen.dist);
|
ore.setBool("Distrib", gen.dist);
|
||||||
ore.setInteger("Size", gen.size);
|
ore.setInt("Size", gen.size);
|
||||||
ore.setInteger("Count", gen.count);
|
ore.setInt("Count", gen.count);
|
||||||
ore.setInteger("Add", gen.more);
|
ore.setInt("Add", gen.more);
|
||||||
ore.setInteger("MinC", gen.min);
|
ore.setInt("MinC", gen.min);
|
||||||
ore.setInteger("MaxS", gen.max);
|
ore.setInt("MaxS", gen.max);
|
||||||
list.appendTag(ore);
|
list.add(ore);
|
||||||
}
|
}
|
||||||
tag.setTag("Ores", list);
|
tag.setTagList("Ores", list);
|
||||||
}
|
}
|
||||||
if(!this.lakes.isEmpty()) {
|
if(!this.lakes.isEmpty()) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagTagList list = new NBTTagTagList();
|
||||||
for(Lake gen : this.lakes) {
|
for(Lake gen : this.lakes) {
|
||||||
NBTTagCompound lake = new NBTTagCompound();
|
NBTTagCompound lake = new NBTTagCompound();
|
||||||
lake.setString("Block", BlockRegistry.toIdName(gen.state));
|
lake.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||||
|
@ -1223,29 +1223,29 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
lake.setString("Filler", BlockRegistry.toIdName(gen.filler));
|
lake.setString("Filler", BlockRegistry.toIdName(gen.filler));
|
||||||
if(gen.top != null)
|
if(gen.top != null)
|
||||||
lake.setString("Top", BlockRegistry.toIdName(gen.top));
|
lake.setString("Top", BlockRegistry.toIdName(gen.top));
|
||||||
lake.setBoolean("Ratiod", gen.ratiod);
|
lake.setBool("Ratiod", gen.ratiod);
|
||||||
lake.setInteger("Chance", gen.chance);
|
lake.setInt("Chance", gen.chance);
|
||||||
lake.setInteger("Min", gen.minHeight);
|
lake.setInt("Min", gen.minHeight);
|
||||||
lake.setInteger("Max", gen.maxHeight);
|
lake.setInt("Max", gen.maxHeight);
|
||||||
list.appendTag(lake);
|
list.add(lake);
|
||||||
}
|
}
|
||||||
tag.setTag("Lakes", list);
|
tag.setTagList("Lakes", list);
|
||||||
}
|
}
|
||||||
if(!this.liquids.isEmpty()) {
|
if(!this.liquids.isEmpty()) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagTagList list = new NBTTagTagList();
|
||||||
for(Liquid gen : this.liquids) {
|
for(Liquid gen : this.liquids) {
|
||||||
NBTTagCompound liquid = new NBTTagCompound();
|
NBTTagCompound liquid = new NBTTagCompound();
|
||||||
liquid.setString("Block", BlockRegistry.toIdName(gen.state));
|
liquid.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||||
liquid.setBoolean("Lower", gen.lower);
|
liquid.setBool("Lower", gen.lower);
|
||||||
liquid.setInteger("Chance", gen.chance);
|
liquid.setInt("Chance", gen.chance);
|
||||||
liquid.setInteger("Min", gen.minHeight);
|
liquid.setInt("Min", gen.minHeight);
|
||||||
liquid.setInteger("Max", gen.maxHeight);
|
liquid.setInt("Max", gen.maxHeight);
|
||||||
list.appendTag(liquid);
|
list.add(liquid);
|
||||||
}
|
}
|
||||||
tag.setTag("Liquids", list);
|
tag.setTagList("Liquids", list);
|
||||||
}
|
}
|
||||||
if(!this.populated)
|
if(!this.populated)
|
||||||
tag.setBoolean("NoPopulation", true);
|
tag.setBool("NoPopulation", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1256,12 +1256,12 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
// if(this.customName != null)
|
// if(this.customName != null)
|
||||||
// tag.setString("CustomName", this.customName);
|
// tag.setString("CustomName", this.customName);
|
||||||
if(all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
tag.setBoolean("DenseFog", this.denseFog);
|
tag.setBool("DenseFog", this.denseFog);
|
||||||
tag.setInteger("ImperialTime", this.timeQualifier);
|
tag.setInt("ImperialTime", this.timeQualifier);
|
||||||
tag.setInteger("Brightness", this.brightness);
|
tag.setInt("Brightness", this.brightness);
|
||||||
tag.setInteger("SkyColor", this.skyColor);
|
tag.setInt("SkyColor", this.skyColor);
|
||||||
tag.setInteger("FogColor", this.fogColor);
|
tag.setInt("FogColor", this.fogColor);
|
||||||
tag.setInteger("CloudColor", this.cloudColor);
|
tag.setInt("CloudColor", this.cloudColor);
|
||||||
tag.setFloat("Gravity", this.gravity);
|
tag.setFloat("Gravity", this.gravity);
|
||||||
tag.setFloat("Temperature", this.temperature);
|
tag.setFloat("Temperature", this.temperature);
|
||||||
tag.setFloat("OrbitOffset", this.orbitOffset);
|
tag.setFloat("OrbitOffset", this.orbitOffset);
|
||||||
|
@ -1274,27 +1274,27 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
if(this.skyboxTexture != null)
|
if(this.skyboxTexture != null)
|
||||||
tag.setString("SkyBoxTexture", this.skyboxTexture.toString());
|
tag.setString("SkyBoxTexture", this.skyboxTexture.toString());
|
||||||
if(this.starColorFunc instanceof SingleColorGen) {
|
if(this.starColorFunc instanceof SingleColorGen) {
|
||||||
tag.setInteger("StarColor", ((SingleColorGen)this.starColorFunc).color);
|
tag.setInt("StarColor", ((SingleColorGen)this.starColorFunc).color);
|
||||||
}
|
}
|
||||||
else if(this.starColorFunc instanceof SinusColorGen) {
|
else if(this.starColorFunc instanceof SinusColorGen) {
|
||||||
NBTTagCompound fnc = new NBTTagCompound();
|
NBTTagCompound fnc = new NBTTagCompound();
|
||||||
fnc.setFloat("Period", ((SinusColorGen)this.starColorFunc).period);
|
fnc.setFloat("Period", ((SinusColorGen)this.starColorFunc).period);
|
||||||
fnc.setFloat("Det", ((SinusColorGen)this.starColorFunc).det);
|
fnc.setFloat("Det", ((SinusColorGen)this.starColorFunc).det);
|
||||||
fnc.setFloat("Dist", ((SinusColorGen)this.starColorFunc).dist);
|
fnc.setFloat("Dist", ((SinusColorGen)this.starColorFunc).dist);
|
||||||
fnc.setInteger("Color", ((SinusColorGen)this.starColorFunc).color);
|
fnc.setInt("Color", ((SinusColorGen)this.starColorFunc).color);
|
||||||
fnc.setByte("DetChn", (byte)((SinusColorGen)this.starColorFunc).detChn);
|
fnc.setByte("DetChn", (byte)((SinusColorGen)this.starColorFunc).detChn);
|
||||||
fnc.setByte("DistChn", (byte)((SinusColorGen)this.starColorFunc).distChn);
|
fnc.setByte("DistChn", (byte)((SinusColorGen)this.starColorFunc).distChn);
|
||||||
tag.setTag("StarColorFnc", fnc);
|
tag.setTag("StarColorFnc", fnc);
|
||||||
}
|
}
|
||||||
if(this.deepstarColorFunc instanceof SingleColorGen) {
|
if(this.deepstarColorFunc instanceof SingleColorGen) {
|
||||||
tag.setInteger("DStarColor", ((SingleColorGen)this.deepstarColorFunc).color);
|
tag.setInt("DStarColor", ((SingleColorGen)this.deepstarColorFunc).color);
|
||||||
}
|
}
|
||||||
else if(this.deepstarColorFunc instanceof SinusColorGen) {
|
else if(this.deepstarColorFunc instanceof SinusColorGen) {
|
||||||
NBTTagCompound fnc = new NBTTagCompound();
|
NBTTagCompound fnc = new NBTTagCompound();
|
||||||
fnc.setFloat("Period", ((SinusColorGen)this.deepstarColorFunc).period);
|
fnc.setFloat("Period", ((SinusColorGen)this.deepstarColorFunc).period);
|
||||||
fnc.setFloat("Det", ((SinusColorGen)this.deepstarColorFunc).det);
|
fnc.setFloat("Det", ((SinusColorGen)this.deepstarColorFunc).det);
|
||||||
fnc.setFloat("Dist", ((SinusColorGen)this.deepstarColorFunc).dist);
|
fnc.setFloat("Dist", ((SinusColorGen)this.deepstarColorFunc).dist);
|
||||||
fnc.setInteger("Color", ((SinusColorGen)this.deepstarColorFunc).color);
|
fnc.setInt("Color", ((SinusColorGen)this.deepstarColorFunc).color);
|
||||||
fnc.setByte("DetChn", (byte)((SinusColorGen)this.deepstarColorFunc).detChn);
|
fnc.setByte("DetChn", (byte)((SinusColorGen)this.deepstarColorFunc).detChn);
|
||||||
fnc.setByte("DistChn", (byte)((SinusColorGen)this.deepstarColorFunc).distChn);
|
fnc.setByte("DistChn", (byte)((SinusColorGen)this.deepstarColorFunc).distChn);
|
||||||
tag.setTag("DStarColorFnc", fnc);
|
tag.setTag("DStarColorFnc", fnc);
|
||||||
|
@ -1305,7 +1305,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
|
|
||||||
public final NBTTagCompound toNbt() {
|
public final NBTTagCompound toNbt() {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tag.setInteger("ID", this.id);
|
tag.setInt("ID", this.id);
|
||||||
tag.setString("Name", this.name);
|
tag.setString("Name", this.name);
|
||||||
tag.setString("Type", this.getType().getName());
|
tag.setString("Type", this.getType().getName());
|
||||||
return tag;
|
return tag;
|
||||||
|
|
|
@ -14,7 +14,7 @@ public abstract class Nameable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readNbt(NBTTagCompound tag) {
|
public void readNbt(NBTTagCompound tag) {
|
||||||
this.customName = tag.hasKey("CustomName", 8) ? tag.getString("CustomName") : null;
|
this.customName = tag.hasString("CustomName") ? tag.getString("CustomName") : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeNbt(NBTTagCompound tag) {
|
public void writeNbt(NBTTagCompound tag) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import common.init.Items;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.rng.WeightedList;
|
import common.rng.WeightedList;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class EnchantmentHelper
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = stack.getEnchantmentTagList();
|
NBTTagTagList nbttaglist = stack.getEnchantmentTagList();
|
||||||
|
|
||||||
if (nbttaglist == null)
|
if (nbttaglist == null)
|
||||||
{
|
{
|
||||||
|
@ -53,10 +53,10 @@ public class EnchantmentHelper
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
int j = nbttaglist.getCompoundTagAt(i).getShort("id");
|
int j = nbttaglist.getTag(i).getShort("id");
|
||||||
int k = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
int k = nbttaglist.getTag(i).getShort("lvl");
|
||||||
|
|
||||||
if (j == enchID)
|
if (j == enchID)
|
||||||
{
|
{
|
||||||
|
@ -72,14 +72,14 @@ public class EnchantmentHelper
|
||||||
public static Map<Integer, Integer> getEnchantments(ItemStack stack)
|
public static Map<Integer, Integer> getEnchantments(ItemStack stack)
|
||||||
{
|
{
|
||||||
Map<Integer, Integer> map = Maps.<Integer, Integer>newLinkedHashMap();
|
Map<Integer, Integer> map = Maps.<Integer, Integer>newLinkedHashMap();
|
||||||
NBTTagList nbttaglist = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList();
|
NBTTagTagList nbttaglist = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList();
|
||||||
|
|
||||||
if (nbttaglist != null)
|
if (nbttaglist != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
int j = nbttaglist.getCompoundTagAt(i).getShort("id");
|
int j = nbttaglist.getTag(i).getShort("id");
|
||||||
int k = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
int k = nbttaglist.getTag(i).getShort("lvl");
|
||||||
map.put(j, k);
|
map.put(j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class EnchantmentHelper
|
||||||
*/
|
*/
|
||||||
public static void setEnchantments(Map<Integer, Integer> enchMap, ItemStack stack)
|
public static void setEnchantments(Map<Integer, Integer> enchMap, ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
Iterator iterator = enchMap.keySet().iterator();
|
Iterator iterator = enchMap.keySet().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
|
@ -105,7 +105,7 @@ public class EnchantmentHelper
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setShort("id", (short)i);
|
nbttagcompound.setShort("id", (short)i);
|
||||||
nbttagcompound.setShort("lvl", (short)enchMap.get(i).intValue());
|
nbttagcompound.setShort("lvl", (short)enchMap.get(i).intValue());
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
|
|
||||||
if (stack.getItem() == Items.enchanted_book)
|
if (stack.getItem() == Items.enchanted_book)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ public class EnchantmentHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbttaglist.tagCount() > 0)
|
if (nbttaglist.size() > 0)
|
||||||
{
|
{
|
||||||
if (stack.getItem() != Items.enchanted_book)
|
if (stack.getItem() != Items.enchanted_book)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ public class EnchantmentHelper
|
||||||
}
|
}
|
||||||
else if (stack.hasTagCompound())
|
else if (stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().remove("ench");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,14 +161,14 @@ public class EnchantmentHelper
|
||||||
{
|
{
|
||||||
if (stack != null)
|
if (stack != null)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = stack.getEnchantmentTagList();
|
NBTTagTagList nbttaglist = stack.getEnchantmentTagList();
|
||||||
|
|
||||||
if (nbttaglist != null)
|
if (nbttaglist != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
int j = nbttaglist.getCompoundTagAt(i).getShort("id");
|
int j = nbttaglist.getTag(i).getShort("id");
|
||||||
int k = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
int k = nbttaglist.getTag(i).getShort("lvl");
|
||||||
|
|
||||||
if (Enchantment.getEnchantmentById(j) != null)
|
if (Enchantment.getEnchantmentById(j) != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,9 +28,8 @@ import common.item.Item;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagDouble;
|
import common.nbt.NBTTagDoubleList;
|
||||||
import common.nbt.NBTTagFloat;
|
import common.nbt.NBTTagFloatList;
|
||||||
import common.nbt.NBTTagList;
|
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
|
@ -1498,13 +1497,13 @@ public abstract class Entity
|
||||||
// tagCompund.setString("ObjectTag", this.tag);
|
// tagCompund.setString("ObjectTag", this.tag);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
tagCompund.setTag("Pos", this.newDoubleNBTList(this.posX, this.posY, this.posZ));
|
tagCompund.setDoubleList("Pos", this.newDoubleNBTList(this.posX, this.posY, this.posZ));
|
||||||
tagCompund.setTag("Motion", this.newDoubleNBTList(this.motionX, this.motionY, this.motionZ));
|
tagCompund.setDoubleList("Motion", this.newDoubleNBTList(this.motionX, this.motionY, this.motionZ));
|
||||||
tagCompund.setTag("Rotation", this.newFloatNBTList(this.rotYaw, this.rotPitch));
|
tagCompund.setFloatList("Rotation", this.newFloatNBTList(this.rotYaw, this.rotPitch));
|
||||||
tagCompund.setFloat("FallDistance", this.fallDistance);
|
tagCompund.setFloat("FallDistance", this.fallDistance);
|
||||||
tagCompund.setShort("Fire", (short)this.fire);
|
tagCompund.setShort("Fire", (short)this.fire);
|
||||||
// tagCompund.setShort("Air", (short)this.getAir());
|
// tagCompund.setShort("Air", (short)this.getAir());
|
||||||
tagCompund.setBoolean("OnGround", this.onGround);
|
tagCompund.setBool("OnGround", this.onGround);
|
||||||
// tagCompund.setBoolean("Invulnerable", this.invulnerable);
|
// tagCompund.setBoolean("Invulnerable", this.invulnerable);
|
||||||
// tagCompund.setInteger("PortalCooldown", this.portalTimer);
|
// tagCompund.setInteger("PortalCooldown", this.portalTimer);
|
||||||
|
|
||||||
|
@ -1520,7 +1519,7 @@ public abstract class Entity
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(this.ignoreFall)
|
if(this.ignoreFall)
|
||||||
tagCompund.setBoolean("IgnoreFall", this.ignoreFall);
|
tagCompund.setBool("IgnoreFall", this.ignoreFall);
|
||||||
|
|
||||||
this.writeEntityToNBT(tagCompund);
|
this.writeEntityToNBT(tagCompund);
|
||||||
|
|
||||||
|
@ -1540,16 +1539,16 @@ public abstract class Entity
|
||||||
*/
|
*/
|
||||||
public void readFromNBT(NBTTagCompound tagCompund)
|
public void readFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
// if(tagCompund.hasKey("PersistID", 4))
|
// if(tagCompund.hasLong("PersistID"))
|
||||||
// this.setPersistentId(tagCompund.getLong("PersistID"));
|
// this.setPersistentId(tagCompund.getLong("PersistID"));
|
||||||
// this.setTag(tagCompund.getString("ObjectTag"));
|
// this.setTag(tagCompund.getString("ObjectTag"));
|
||||||
|
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("Pos", 6);
|
NBTTagDoubleList nbttaglist = tagCompund.getDoubleList("Pos");
|
||||||
NBTTagList nbttaglist1 = tagCompund.getTagList("Motion", 6);
|
NBTTagDoubleList nbttaglist1 = tagCompund.getDoubleList("Motion");
|
||||||
NBTTagList nbttaglist2 = tagCompund.getTagList("Rotation", 5);
|
NBTTagFloatList nbttaglist2 = tagCompund.getFloatList("Rotation");
|
||||||
this.motionX = nbttaglist1.getDoubleAt(0);
|
this.motionX = nbttaglist1.getDouble(0);
|
||||||
this.motionY = nbttaglist1.getDoubleAt(1);
|
this.motionY = nbttaglist1.getDouble(1);
|
||||||
this.motionZ = nbttaglist1.getDoubleAt(2);
|
this.motionZ = nbttaglist1.getDouble(2);
|
||||||
|
|
||||||
if (Math.abs(this.motionX) > 10.0D)
|
if (Math.abs(this.motionX) > 10.0D)
|
||||||
{
|
{
|
||||||
|
@ -1566,31 +1565,31 @@ public abstract class Entity
|
||||||
this.motionZ = 0.0D;
|
this.motionZ = 0.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prevX = this.lastTickPosX = this.posX = nbttaglist.getDoubleAt(0);
|
this.prevX = this.lastTickPosX = this.posX = nbttaglist.getDouble(0);
|
||||||
this.prevY = this.lastTickPosY = this.posY = nbttaglist.getDoubleAt(1);
|
this.prevY = this.lastTickPosY = this.posY = nbttaglist.getDouble(1);
|
||||||
this.prevZ = this.lastTickPosZ = this.posZ = nbttaglist.getDoubleAt(2);
|
this.prevZ = this.lastTickPosZ = this.posZ = nbttaglist.getDouble(2);
|
||||||
this.prevYaw = this.rotYaw = nbttaglist2.getFloatAt(0);
|
this.prevYaw = this.rotYaw = nbttaglist2.getFloat(0);
|
||||||
this.prevPitch = this.rotPitch = nbttaglist2.getFloatAt(1);
|
this.prevPitch = this.rotPitch = nbttaglist2.getFloat(1);
|
||||||
this.setRotationYawHead(this.rotYaw);
|
this.setRotationYawHead(this.rotYaw);
|
||||||
this.setRenderYawOffset(this.rotYaw);
|
this.setRenderYawOffset(this.rotYaw);
|
||||||
this.fallDistance = tagCompund.getFloat("FallDistance");
|
this.fallDistance = tagCompund.getFloat("FallDistance");
|
||||||
this.fire = tagCompund.getShort("Fire");
|
this.fire = tagCompund.getShort("Fire");
|
||||||
// this.setAir(tagCompund.getShort("Air"));
|
// this.setAir(tagCompund.getShort("Air"));
|
||||||
this.onGround = tagCompund.getBoolean("OnGround");
|
this.onGround = tagCompund.getBool("OnGround");
|
||||||
// this.invulnerable = tagCompund.getBoolean("Invulnerable");
|
// this.invulnerable = tagCompund.getBoolean("Invulnerable");
|
||||||
// this.portalTimer = tagCompund.getInteger("PortalCooldown");
|
// this.portalTimer = tagCompund.getInteger("PortalCooldown");
|
||||||
|
|
||||||
this.setPosition(this.posX, this.posY, this.posZ);
|
this.setPosition(this.posX, this.posY, this.posZ);
|
||||||
this.setRotation(this.rotYaw, this.rotPitch);
|
this.setRotation(this.rotYaw, this.rotPitch);
|
||||||
|
|
||||||
if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0)
|
if (tagCompund.hasString("CustomName") && tagCompund.getString("CustomName").length() > 0)
|
||||||
{
|
{
|
||||||
this.setCustomNameTag(tagCompund.getString("CustomName"));
|
this.setCustomNameTag(tagCompund.getString("CustomName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible"));
|
// this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible"));
|
||||||
// this.setSilent(tagCompund.getBoolean("Silent"));
|
// this.setSilent(tagCompund.getBoolean("Silent"));
|
||||||
this.ignoreFall = tagCompund.getBoolean("IgnoreFall");
|
this.ignoreFall = tagCompund.getBool("IgnoreFall");
|
||||||
this.readEntityFromNBT(tagCompund);
|
this.readEntityFromNBT(tagCompund);
|
||||||
|
|
||||||
if (this.shouldSetPosAfterLoading())
|
if (this.shouldSetPosAfterLoading())
|
||||||
|
@ -1629,13 +1628,13 @@ public abstract class Entity
|
||||||
/**
|
/**
|
||||||
* creates a NBT list from the array of doubles passed to this function
|
* creates a NBT list from the array of doubles passed to this function
|
||||||
*/
|
*/
|
||||||
protected NBTTagList newDoubleNBTList(double... numbers)
|
protected NBTTagDoubleList newDoubleNBTList(double... numbers)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagDoubleList nbttaglist = new NBTTagDoubleList();
|
||||||
|
|
||||||
for (double d0 : numbers)
|
for (double d0 : numbers)
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(new NBTTagDouble(d0));
|
nbttaglist.add(d0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttaglist;
|
return nbttaglist;
|
||||||
|
@ -1644,13 +1643,13 @@ public abstract class Entity
|
||||||
/**
|
/**
|
||||||
* Returns a new NBTTagList filled with the specified floats
|
* Returns a new NBTTagList filled with the specified floats
|
||||||
*/
|
*/
|
||||||
protected NBTTagList newFloatNBTList(float... numbers)
|
protected NBTTagFloatList newFloatNBTList(float... numbers)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagFloatList nbttaglist = new NBTTagFloatList();
|
||||||
|
|
||||||
for (float f : numbers)
|
for (float f : numbers)
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(new NBTTagFloat(f));
|
nbttaglist.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttaglist;
|
return nbttaglist;
|
||||||
|
|
|
@ -178,12 +178,8 @@ public class EntityChicken extends EntityAnimal
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.chickenJockey = tagCompund.getBoolean("IsChickenJockey");
|
this.chickenJockey = tagCompund.getBool("IsChickenJockey");
|
||||||
|
this.timeUntilNextEgg = tagCompund.getInt("EggLayTime");
|
||||||
if (tagCompund.hasKey("EggLayTime"))
|
|
||||||
{
|
|
||||||
this.timeUntilNextEgg = tagCompund.getInteger("EggLayTime");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,8 +196,8 @@ public class EntityChicken extends EntityAnimal
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("IsChickenJockey", this.chickenJockey);
|
tagCompound.setBool("IsChickenJockey", this.chickenJockey);
|
||||||
tagCompound.setInteger("EggLayTime", this.timeUntilNextEgg);
|
tagCompound.setInt("EggLayTime", this.timeUntilNextEgg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
|
@ -32,7 +32,7 @@ import common.item.ItemMonsterPlacer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.pathfinding.PathNavigateGround;
|
import common.pathfinding.PathNavigateGround;
|
||||||
import common.potion.Potion;
|
import common.potion.Potion;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -1390,19 +1390,19 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("EatingHaystack", this.isEatingHaystack());
|
tagCompound.setBool("EatingHaystack", this.isEatingHaystack());
|
||||||
tagCompound.setBoolean("ChestedHorse", this.isChested());
|
tagCompound.setBool("ChestedHorse", this.isChested());
|
||||||
tagCompound.setBoolean("HasReproduced", this.getHasReproduced());
|
tagCompound.setBool("HasReproduced", this.getHasReproduced());
|
||||||
tagCompound.setBoolean("Bred", this.isBreeding());
|
tagCompound.setBool("Bred", this.isBreeding());
|
||||||
tagCompound.setInteger("Type", this.getHorseType());
|
tagCompound.setInt("Type", this.getHorseType());
|
||||||
tagCompound.setInteger("Variant", this.getHorseVariant());
|
tagCompound.setInt("Variant", this.getHorseVariant());
|
||||||
tagCompound.setInteger("Temper", this.getTemper());
|
tagCompound.setInt("Temper", this.getTemper());
|
||||||
tagCompound.setBoolean("Tame", this.isTame());
|
tagCompound.setBool("Tame", this.isTame());
|
||||||
// tagCompound.setString("Owner", this.getOwnerId());
|
// tagCompound.setString("Owner", this.getOwnerId());
|
||||||
|
|
||||||
if (this.isChested())
|
if (this.isChested())
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 2; i < this.horseChest.getSizeInventory(); ++i)
|
for (int i = 2; i < this.horseChest.getSizeInventory(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -1413,11 +1413,11 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
itemstack.writeToNBT(nbttagcompound);
|
itemstack.writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Items", nbttaglist);
|
tagCompound.setTagList("Items", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.horseChest.getStackInSlot(1) != null)
|
if (this.horseChest.getStackInSlot(1) != null)
|
||||||
|
@ -1437,17 +1437,17 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setEatingHaystack(tagCompund.getBoolean("EatingHaystack"));
|
this.setEatingHaystack(tagCompund.getBool("EatingHaystack"));
|
||||||
this.setBreeding(tagCompund.getBoolean("Bred"));
|
this.setBreeding(tagCompund.getBool("Bred"));
|
||||||
this.setChested(tagCompund.getBoolean("ChestedHorse"));
|
this.setChested(tagCompund.getBool("ChestedHorse"));
|
||||||
this.setHasReproduced(tagCompund.getBoolean("HasReproduced"));
|
this.setHasReproduced(tagCompund.getBool("HasReproduced"));
|
||||||
this.setHorseType(tagCompund.getInteger("Type"));
|
this.setHorseType(tagCompund.getInt("Type"));
|
||||||
this.setHorseVariant(tagCompund.getInteger("Variant"));
|
this.setHorseVariant(tagCompund.getInt("Variant"));
|
||||||
this.setTemper(tagCompund.getInteger("Temper"));
|
this.setTemper(tagCompund.getInt("Temper"));
|
||||||
this.setHorseTamed(tagCompund.getBoolean("Tame"));
|
this.setHorseTamed(tagCompund.getBool("Tame"));
|
||||||
// String s = "";
|
// String s = "";
|
||||||
//
|
//
|
||||||
// if (tagCompund.hasKey("Owner", 8))
|
// if (tagCompund.hasString("Owner"))
|
||||||
// {
|
// {
|
||||||
// s = tagCompund.getString("Owner");
|
// s = tagCompund.getString("Owner");
|
||||||
// }
|
// }
|
||||||
|
@ -1466,12 +1466,12 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
|
|
||||||
if (this.isChested())
|
if (this.isChested())
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = tagCompund.getTagList("Items");
|
||||||
this.initHorseChest();
|
this.initHorseChest();
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 2 && j < this.horseChest.getSizeInventory())
|
if (j >= 2 && j < this.horseChest.getSizeInventory())
|
||||||
|
@ -1481,9 +1481,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("ArmorItem", 10))
|
if (tagCompund.hasTag("ArmorItem"))
|
||||||
{
|
{
|
||||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("ArmorItem"));
|
ItemStack itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getTag("ArmorItem"));
|
||||||
|
|
||||||
if (itemstack != null && isArmorItem(itemstack.getItem()))
|
if (itemstack != null && isArmorItem(itemstack.getItem()))
|
||||||
{
|
{
|
||||||
|
@ -1491,16 +1491,16 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("SaddleItem", 10))
|
if (tagCompund.hasTag("SaddleItem"))
|
||||||
{
|
{
|
||||||
ItemStack itemstack1 = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("SaddleItem"));
|
ItemStack itemstack1 = ItemStack.loadItemStackFromNBT(tagCompund.getTag("SaddleItem"));
|
||||||
|
|
||||||
if (itemstack1 != null && itemstack1.getItem() == Items.saddle)
|
if (itemstack1 != null && itemstack1.getItem() == Items.saddle)
|
||||||
{
|
{
|
||||||
this.horseChest.setInventorySlotContents(0, itemstack1);
|
this.horseChest.setInventorySlotContents(0, itemstack1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tagCompund.getBoolean("Saddle"))
|
else if (tagCompund.getBool("Saddle"))
|
||||||
{
|
{
|
||||||
this.horseChest.setInventorySlotContents(0, new ItemStack(Items.saddle));
|
this.horseChest.setInventorySlotContents(0, new ItemStack(Items.saddle));
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class EntityOcelot extends EntityTameable
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("CatType", this.getTameSkin());
|
tagCompound.setInt("CatType", this.getTameSkin());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +135,7 @@ public class EntityOcelot extends EntityTameable
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setTameSkin(tagCompund.getInteger("CatType"));
|
this.setTameSkin(tagCompund.getInt("CatType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class EntityPig extends EntityAnimal
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("Saddle", this.getSaddled());
|
tagCompound.setBool("Saddle", this.getSaddled());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ public class EntityPig extends EntityAnimal
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setSaddled(tagCompund.getBoolean("Saddle"));
|
this.setSaddled(tagCompund.getBool("Saddle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -200,14 +200,14 @@ public class EntityRabbit extends EntityAnimal {
|
||||||
|
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound) {
|
public void writeEntityToNBT(NBTTagCompound tagCompound) {
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("RabbitType", this.getRabbitType());
|
tagCompound.setInt("RabbitType", this.getRabbitType());
|
||||||
tagCompound.setInteger("MoreCarrotTicks", this.foodCooldown);
|
tagCompound.setInt("MoreCarrotTicks", this.foodCooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund) {
|
public void readEntityFromNBT(NBTTagCompound tagCompund) {
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setRabbitType(tagCompund.getInteger("RabbitType"));
|
this.setRabbitType(tagCompund.getInt("RabbitType"));
|
||||||
this.foodCooldown = tagCompund.getInteger("MoreCarrotTicks");
|
this.foodCooldown = tagCompund.getInt("MoreCarrotTicks");
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected String getJumpingSound() {
|
// protected String getJumpingSound() {
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class EntitySheep extends EntityAnimal
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("Sheared", this.getSheared());
|
tagCompound.setBool("Sheared", this.getSheared());
|
||||||
tagCompound.setByte("Color", (byte)this.getFleeceColor().getMetadata());
|
tagCompound.setByte("Color", (byte)this.getFleeceColor().getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ public class EntitySheep extends EntityAnimal
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setSheared(tagCompund.getBoolean("Sheared"));
|
this.setSheared(tagCompund.getBool("Sheared"));
|
||||||
this.setFleeceColor(DyeColor.byMetadata(tagCompund.getByte("Color")));
|
this.setFleeceColor(DyeColor.byMetadata(tagCompund.getByte("Color")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class EntityWolf extends EntityTameable
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("Angry", this.isAngry());
|
tagCompound.setBool("Angry", this.isAngry());
|
||||||
tagCompound.setByte("CollarColor", (byte)this.getCollarColor().getDyeDamage());
|
tagCompound.setByte("CollarColor", (byte)this.getCollarColor().getDyeDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +152,9 @@ public class EntityWolf extends EntityTameable
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setAngry(tagCompund.getBoolean("Angry"));
|
this.setAngry(tagCompund.getBool("Angry"));
|
||||||
|
|
||||||
if (tagCompund.hasKey("CollarColor", 99))
|
if (tagCompund.hasByte("CollarColor"))
|
||||||
{
|
{
|
||||||
this.setCollarColor(DyeColor.byDyeDamage(tagCompund.getByte("CollarColor")));
|
this.setCollarColor(DyeColor.byDyeDamage(tagCompund.getByte("CollarColor")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,11 +755,11 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
*/
|
*/
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
if (tagCompund.getBoolean("CustomDisplayTile"))
|
if (tagCompund.getBool("CustomDisplayTile"))
|
||||||
{
|
{
|
||||||
int i = tagCompund.getInteger("DisplayData");
|
int i = tagCompund.getInt("DisplayData");
|
||||||
|
|
||||||
if (tagCompund.hasKey("DisplayTile", 8))
|
if (tagCompund.hasString("DisplayTile"))
|
||||||
{
|
{
|
||||||
Block block = BlockRegistry.getByIdFallback(tagCompund.getString("DisplayTile"));
|
Block block = BlockRegistry.getByIdFallback(tagCompund.getString("DisplayTile"));
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Block block1 = BlockRegistry.getBlockById(tagCompund.getInteger("DisplayTile"));
|
Block block1 = BlockRegistry.getBlockById(tagCompund.getInt("DisplayTile"));
|
||||||
|
|
||||||
if (block1 == null)
|
if (block1 == null)
|
||||||
{
|
{
|
||||||
|
@ -786,10 +786,10 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setDisplayTileOffset(tagCompund.getInteger("DisplayOffset"));
|
this.setDisplayTileOffset(tagCompund.getInt("DisplayOffset"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0)
|
if (tagCompund.hasString("CustomName") && tagCompund.getString("CustomName").length() > 0)
|
||||||
{
|
{
|
||||||
this.entityName = tagCompund.getString("CustomName");
|
this.entityName = tagCompund.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
@ -802,12 +802,12 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
{
|
{
|
||||||
if (this.hasDisplayTile())
|
if (this.hasDisplayTile())
|
||||||
{
|
{
|
||||||
tagCompound.setBoolean("CustomDisplayTile", true);
|
tagCompound.setBool("CustomDisplayTile", true);
|
||||||
State iblockstate = this.getDisplayTile();
|
State iblockstate = this.getDisplayTile();
|
||||||
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(iblockstate.getBlock());
|
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(iblockstate.getBlock());
|
||||||
tagCompound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation.toString());
|
tagCompound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation.toString());
|
||||||
tagCompound.setInteger("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate));
|
tagCompound.setInt("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate));
|
||||||
tagCompound.setInteger("DisplayOffset", this.getDisplayTileOffset());
|
tagCompound.setInt("DisplayOffset", this.getDisplayTileOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityName != null && this.entityName.length() > 0)
|
if (this.entityName != null && this.entityName.length() > 0)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import common.inventory.Container;
|
||||||
import common.inventory.InventoryHelper;
|
import common.inventory.InventoryHelper;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.tileentity.ILockableContainer;
|
import common.tileentity.ILockableContainer;
|
||||||
import common.tileentity.LockCode;
|
import common.tileentity.LockCode;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -190,7 +190,7 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
||||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.minecartContainerItems.length; ++i)
|
for (int i = 0; i < this.minecartContainerItems.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -199,11 +199,11 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.minecartContainerItems[i].writeToNBT(nbttagcompound);
|
this.minecartContainerItems[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Items", nbttaglist);
|
tagCompound.setTagList("Items", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,12 +212,12 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = tagCompund.getTagList("Items");
|
||||||
this.minecartContainerItems = new ItemStack[this.getSizeInventory()];
|
this.minecartContainerItems = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 0 && j < this.minecartContainerItems.length)
|
if (j >= 0 && j < this.minecartContainerItems.length)
|
||||||
|
|
|
@ -64,14 +64,14 @@ public class EntityExplosion extends Entity
|
||||||
|
|
||||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("Progress", this.progress);
|
tagCompound.setInt("Progress", this.progress);
|
||||||
tagCompound.setInteger("Radius", this.radius);
|
tagCompound.setInt("Radius", this.radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
this.progress = tagCompund.getInteger("Progress");
|
this.progress = tagCompund.getInt("Progress");
|
||||||
this.radius = tagCompund.getInteger("Radius");
|
this.radius = tagCompund.getInt("Radius");
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getEyeHeight()
|
public float getEyeHeight()
|
||||||
|
|
|
@ -153,11 +153,11 @@ public class EntityFalling extends Entity implements IObjectData
|
||||||
|
|
||||||
for (String s : this.tileEntityData.getKeySet())
|
for (String s : this.tileEntityData.getKeySet())
|
||||||
{
|
{
|
||||||
NBTBase nbtbase = this.tileEntityData.getTag(s);
|
NBTBase nbtbase = this.tileEntityData.get(s);
|
||||||
|
|
||||||
if (!s.equals("x") && !s.equals("y") && !s.equals("z"))
|
if (!s.equals("x") && !s.equals("y") && !s.equals("z"))
|
||||||
{
|
{
|
||||||
nbttagcompound.setTag(s, nbtbase.copy());
|
nbttagcompound.set(s, nbtbase.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,10 +235,10 @@ public class EntityFalling extends Entity implements IObjectData
|
||||||
tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString());
|
tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString());
|
||||||
tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile));
|
tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile));
|
||||||
tagCompound.setByte("Time", (byte)this.fallTime);
|
tagCompound.setByte("Time", (byte)this.fallTime);
|
||||||
tagCompound.setBoolean("DropItem", this.shouldDropItem);
|
tagCompound.setBool("DropItem", this.shouldDropItem);
|
||||||
tagCompound.setBoolean("HurtEntities", this.hurtEntities);
|
tagCompound.setBool("HurtEntities", this.hurtEntities);
|
||||||
tagCompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
tagCompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
||||||
tagCompound.setInteger("FallHurtMax", this.fallHurtMax);
|
tagCompound.setInt("FallHurtMax", this.fallHurtMax);
|
||||||
|
|
||||||
if (this.tileEntityData != null)
|
if (this.tileEntityData != null)
|
||||||
{
|
{
|
||||||
|
@ -253,41 +253,27 @@ public class EntityFalling extends Entity implements IObjectData
|
||||||
{
|
{
|
||||||
int i = tagCompund.getByte("Data") & 255;
|
int i = tagCompund.getByte("Data") & 255;
|
||||||
|
|
||||||
if (tagCompund.hasKey("Block", 8))
|
if (tagCompund.hasString("Block"))
|
||||||
{
|
{
|
||||||
this.fallTile = BlockRegistry.getByIdFallback(tagCompund.getString("Block")).getStateFromMeta(i);
|
this.fallTile = BlockRegistry.getByIdFallback(tagCompund.getString("Block")).getStateFromMeta(i);
|
||||||
}
|
}
|
||||||
else if (tagCompund.hasKey("TileID", 99))
|
|
||||||
{
|
|
||||||
this.fallTile = BlockRegistry.getBlockById(tagCompund.getInteger("TileID")).getStateFromMeta(i);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.fallTile = BlockRegistry.getBlockById(tagCompund.getByte("Tile") & 255).getStateFromMeta(i);
|
this.fallTile = Blocks.sand.getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fallTime = tagCompund.getByte("Time") & 255;
|
this.fallTime = tagCompund.getByte("Time") & 255;
|
||||||
Block block = this.fallTile.getBlock();
|
Block block = this.fallTile.getBlock();
|
||||||
|
|
||||||
if (tagCompund.hasKey("HurtEntities", 99))
|
this.hurtEntities = tagCompund.getBool("HurtEntities");
|
||||||
{
|
this.fallHurtAmount = tagCompund.getFloat("FallHurtAmount");
|
||||||
this.hurtEntities = tagCompund.getBoolean("HurtEntities");
|
this.fallHurtMax = tagCompund.getInt("FallHurtMax");
|
||||||
this.fallHurtAmount = tagCompund.getFloat("FallHurtAmount");
|
|
||||||
this.fallHurtMax = tagCompund.getInteger("FallHurtMax");
|
|
||||||
}
|
|
||||||
else if (block == Blocks.anvil)
|
|
||||||
{
|
|
||||||
this.hurtEntities = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tagCompund.hasKey("DropItem", 99))
|
this.shouldDropItem = tagCompund.getBool("DropItem");
|
||||||
{
|
|
||||||
this.shouldDropItem = tagCompund.getBoolean("DropItem");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tagCompund.hasKey("TileEntityData", 10))
|
if (tagCompund.hasTag("TileEntityData"))
|
||||||
{
|
{
|
||||||
this.tileEntityData = tagCompund.getCompoundTag("TileEntityData");
|
this.tileEntityData = tagCompund.getTag("TileEntityData");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == null || block == Blocks.air)
|
if (block == null || block == Blocks.air)
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class EntityFireworks extends Entity
|
||||||
{
|
{
|
||||||
this.dataWatcher.updateObject(8, givenItem);
|
this.dataWatcher.updateObject(8, givenItem);
|
||||||
NBTTagCompound nbttagcompound = givenItem.getTagCompound();
|
NBTTagCompound nbttagcompound = givenItem.getTagCompound();
|
||||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks");
|
NBTTagCompound nbttagcompound1 = nbttagcompound.getTag("Fireworks");
|
||||||
|
|
||||||
if (nbttagcompound1 != null)
|
if (nbttagcompound1 != null)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ public class EntityFireworks extends Entity
|
||||||
|
|
||||||
if (itemstack != null && itemstack.hasTagCompound())
|
if (itemstack != null && itemstack.hasTagCompound())
|
||||||
{
|
{
|
||||||
nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks");
|
nbttagcompound = itemstack.getTagCompound().getTag("Fireworks");
|
||||||
}
|
}
|
||||||
|
|
||||||
((AWorldClient)this.worldObj).makeFireworks(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
|
((AWorldClient)this.worldObj).makeFireworks(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
|
||||||
|
@ -169,8 +169,8 @@ public class EntityFireworks extends Entity
|
||||||
*/
|
*/
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("Life", this.fireworkAge);
|
tagCompound.setInt("Life", this.fireworkAge);
|
||||||
tagCompound.setInteger("LifeTime", this.lifetime);
|
tagCompound.setInt("LifeTime", this.lifetime);
|
||||||
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
|
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
|
||||||
|
|
||||||
if (itemstack != null)
|
if (itemstack != null)
|
||||||
|
@ -186,9 +186,9 @@ public class EntityFireworks extends Entity
|
||||||
*/
|
*/
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
this.fireworkAge = tagCompund.getInteger("Life");
|
this.fireworkAge = tagCompund.getInt("Life");
|
||||||
this.lifetime = tagCompund.getInteger("LifeTime");
|
this.lifetime = tagCompund.getInt("LifeTime");
|
||||||
NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("FireworksItem");
|
NBTTagCompound nbttagcompound = tagCompund.getTag("FireworksItem");
|
||||||
|
|
||||||
if (nbttagcompound != null)
|
if (nbttagcompound != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class EntityHopperCart extends EntityCartContainer implements IHopper
|
||||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("TransferCooldown", this.transferTicker);
|
tagCompound.setInt("TransferCooldown", this.transferTicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,7 +213,7 @@ public class EntityHopperCart extends EntityCartContainer implements IHopper
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.transferTicker = tagCompund.getInteger("TransferCooldown");
|
this.transferTicker = tagCompund.getInt("TransferCooldown");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -372,10 +372,7 @@ public class EntityItem extends Entity
|
||||||
this.health = tagCompund.getShort("Health") & 255;
|
this.health = tagCompund.getShort("Health") & 255;
|
||||||
this.age = tagCompund.getShort("Age");
|
this.age = tagCompund.getShort("Age");
|
||||||
|
|
||||||
if (tagCompund.hasKey("PickupDelay"))
|
this.delayBeforeCanPickup = tagCompund.getShort("PickupDelay");
|
||||||
{
|
|
||||||
this.delayBeforeCanPickup = tagCompund.getShort("PickupDelay");
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (tagCompund.hasKey("Owner"))
|
// if (tagCompund.hasKey("Owner"))
|
||||||
// {
|
// {
|
||||||
|
@ -387,7 +384,7 @@ public class EntityItem extends Entity
|
||||||
// this.thrower = tagCompund.getString("Thrower");
|
// this.thrower = tagCompund.getString("Thrower");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item");
|
NBTTagCompound nbttagcompound = tagCompund.getTag("Item");
|
||||||
this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound));
|
this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound));
|
||||||
|
|
||||||
if (this.getEntityItem() == null)
|
if (this.getEntityItem() == null)
|
||||||
|
|
|
@ -95,12 +95,12 @@ public class EntityNuke extends Entity
|
||||||
|
|
||||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("Fuse", this.fuse);
|
tagCompound.setInt("Fuse", this.fuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
this.fuse = tagCompund.getInteger("Fuse");
|
this.fuse = tagCompund.getInt("Fuse");
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getEyeHeight()
|
public float getEyeHeight()
|
||||||
|
|
|
@ -209,11 +209,7 @@ public class EntityTntCart extends EntityCart
|
||||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
|
this.minecartTNTFuse = tagCompund.getInt("TNTFuse");
|
||||||
if (tagCompund.hasKey("TNTFuse", 99))
|
|
||||||
{
|
|
||||||
this.minecartTNTFuse = tagCompund.getInteger("TNTFuse");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -222,6 +218,6 @@ public class EntityTntCart extends EntityCart
|
||||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("TNTFuse", this.minecartTNTFuse);
|
tagCompound.setInt("TNTFuse", this.minecartTNTFuse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,13 @@ public class EntityGargoyle extends EntityFlyingNPC
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("Invul", this.getInvulTime());
|
tagCompound.setInt("Invul", this.getInvulTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setInvulTime(tagCompund.getInteger("Invul"));
|
this.setInvulTime(tagCompund.getInt("Invul"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLivingUpdate()
|
public void onLivingUpdate()
|
||||||
|
|
|
@ -64,11 +64,11 @@ public class EntityHaunter extends EntityNPC {
|
||||||
|
|
||||||
if (this.isCharged())
|
if (this.isCharged())
|
||||||
{
|
{
|
||||||
tagCompound.setBoolean("Charge", true);
|
tagCompound.setBool("Charge", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setShort("Fuse", (short)this.fuseTime);
|
tagCompound.setShort("Fuse", (short)this.fuseTime);
|
||||||
tagCompound.setBoolean("ignited", this.hasIgnited());
|
tagCompound.setBool("ignited", this.hasIgnited());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +77,11 @@ public class EntityHaunter extends EntityNPC {
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setCharged(tagCompund.getBoolean("Charge"));
|
this.setCharged(tagCompund.getBool("Charge"));
|
||||||
|
|
||||||
if (tagCompund.hasKey("Fuse", 99))
|
this.fuseTime = tagCompund.getShort("Fuse");
|
||||||
{
|
|
||||||
this.fuseTime = tagCompund.getShort("Fuse");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tagCompund.getBoolean("ignited"))
|
if (tagCompund.getBool("ignited"))
|
||||||
{
|
{
|
||||||
this.ignite();
|
this.ignite();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ import common.item.ItemSword;
|
||||||
import common.item.ItemTool;
|
import common.item.ItemTool;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.network.IClientPlayer;
|
import common.network.IClientPlayer;
|
||||||
import common.network.IPlayer;
|
import common.network.IPlayer;
|
||||||
import common.packet.CPacketPlayerPosition;
|
import common.packet.CPacketPlayerPosition;
|
||||||
|
@ -3385,22 +3385,22 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// super.readEntityFromNBT(tagCompund);
|
// super.readEntityFromNBT(tagCompund);
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
|
|
||||||
// if(tagCompund.hasKey("CanPickUpLoot", 1)) {
|
// if(tagCompund.hasBoolean("CanPickUpLoot")) {
|
||||||
// this.setCanPickUpLoot(tagCompund.getBoolean("CanPickUpLoot"));
|
// this.setCanPickUpLoot(tagCompund.getBoolean("CanPickUpLoot"));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(tagCompund.hasKey("Equipment", 9)) {
|
if(tagCompund.hasTagList("Equipment")) {
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("Equipment", 10);
|
NBTTagTagList nbttaglist = tagCompund.getTagList("Equipment");
|
||||||
|
|
||||||
for(int i = 0; i < this.equipment.length; ++i) {
|
for(int i = 0; i < this.equipment.length; ++i) {
|
||||||
this.equipment[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));
|
this.equipment[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getTag(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.setSpecies(tagCompund.getString("Species"));
|
// this.setSpecies(tagCompund.getString("Species"));
|
||||||
this.setChar(tagCompund.getString("Char"));
|
this.setChar(tagCompund.getString("Char"));
|
||||||
this.setCape(tagCompund.getString("Cape"));
|
this.setCape(tagCompund.getString("Cape"));
|
||||||
this.isWilling = tagCompund.getBoolean("Willing");
|
this.isWilling = tagCompund.getBool("Willing");
|
||||||
this.setMating(tagCompund.getBoolean("Mating"));
|
this.setMating(tagCompund.getBool("Mating"));
|
||||||
Alignment // align;
|
Alignment // align;
|
||||||
// try {
|
// try {
|
||||||
align = Alignment.getByName(tagCompund.getString("Align"));
|
align = Alignment.getByName(tagCompund.getString("Align"));
|
||||||
|
@ -3409,9 +3409,9 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// align = this.getNaturalAlign(this.rand);
|
// align = this.getNaturalAlign(this.rand);
|
||||||
// }
|
// }
|
||||||
this.setAlignment(align);
|
this.setAlignment(align);
|
||||||
this.setManaPoints(tagCompund.getInteger("Mana"));
|
this.setManaPoints(tagCompund.getInt("Mana"));
|
||||||
Enum type = null;
|
Enum type = null;
|
||||||
if(tagCompund.hasKey("ClassType", 8) && this.species != null && this.species.classEnum != null) {
|
if(tagCompund.hasString("ClassType") && this.species != null && this.species.classEnum != null) {
|
||||||
type = this.species.classnames.get(tagCompund.getString("ClassType"));
|
type = this.species.classnames.get(tagCompund.getString("ClassType"));
|
||||||
// try {
|
// try {
|
||||||
// type = Enum.valueOf(this.species.classEnum, tagCompund.getString("ClassType").toUpperCase());
|
// type = Enum.valueOf(this.species.classEnum, tagCompund.getString("ClassType").toUpperCase());
|
||||||
|
@ -3421,13 +3421,13 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
this.setNpcClass(type);
|
this.setNpcClass(type);
|
||||||
this.setHeight(tagCompund.hasKey("Height", 5) ? tagCompund.getFloat("Height") : this.getBaseSize());
|
this.setHeight(tagCompund.hasFloat("Height") ? tagCompund.getFloat("Height") : this.getBaseSize());
|
||||||
|
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = tagCompund.getTagList("Items");
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));
|
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getTag(i));
|
||||||
|
|
||||||
if (itemstack != null)
|
if (itemstack != null)
|
||||||
{
|
{
|
||||||
|
@ -3435,10 +3435,12 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tagCompund.hasKey("Offers", 10))
|
if(tagCompund.hasTagList("Offers")) {
|
||||||
this.trades = new MerchantRecipeList(tagCompund.getCompoundTag("Offers"));
|
this.trades = new MerchantRecipeList();
|
||||||
this.healTimer = tagCompund.getInteger("healTimer");
|
this.trades.fromNbt(tagCompund.getTagList("Offers"));
|
||||||
if(tagCompund.hasKey("Skin", 7))
|
}
|
||||||
|
this.healTimer = tagCompund.getInt("healTimer");
|
||||||
|
if(tagCompund.hasByteArray("Skin"))
|
||||||
this.skin = tagCompund.getByteArray("Skin");
|
this.skin = tagCompund.getByteArray("Skin");
|
||||||
|
|
||||||
// this.setCanPickUpLoot(true);
|
// this.setCanPickUpLoot(true);
|
||||||
|
@ -3446,15 +3448,15 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
|
|
||||||
if(this.isPlayer()) {
|
if(this.isPlayer()) {
|
||||||
// this.entityUniqueID = getOfflineUUID(this.user);
|
// this.entityUniqueID = getOfflineUUID(this.user);
|
||||||
NBTTagList nbttaglist0 = tagCompund.getTagList("Inventory", 10);
|
NBTTagTagList nbttaglist0 = tagCompund.getTagList("Inventory");
|
||||||
this.inventory.readFromNBT(nbttaglist0);
|
this.inventory.readFromNBT(nbttaglist0);
|
||||||
this.inventory.currentItem = tagCompund.getInteger("SelectedItemSlot");
|
this.inventory.currentItem = tagCompund.getInt("SelectedItemSlot");
|
||||||
// this.sleeping = tagCompund.getBoolean("Sleeping");
|
// this.sleeping = tagCompund.getBoolean("Sleeping");
|
||||||
// this.sleepTimer = tagCompund.getShort("SleepTimer");
|
// this.sleepTimer = tagCompund.getShort("SleepTimer");
|
||||||
this.experience = tagCompund.getFloat("XpP");
|
this.experience = tagCompund.getFloat("XpP");
|
||||||
this.experienceLevel = tagCompund.getInteger("XpLevel");
|
this.experienceLevel = tagCompund.getInt("XpLevel");
|
||||||
this.experienceTotal = tagCompund.getInteger("XpTotal");
|
this.experienceTotal = tagCompund.getInt("XpTotal");
|
||||||
this.xpSeed = tagCompund.getInteger("XpSeed");
|
this.xpSeed = tagCompund.getInt("XpSeed");
|
||||||
|
|
||||||
if (this.xpSeed == 0)
|
if (this.xpSeed == 0)
|
||||||
{
|
{
|
||||||
|
@ -3470,32 +3472,32 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// this.wakeUpPlayer();
|
// this.wakeUpPlayer();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (tagCompund.hasKey("SpawnX", 99) && tagCompund.hasKey("SpawnY", 99) && tagCompund.hasKey("SpawnZ", 99))
|
if (tagCompund.hasInt("SpawnX") && tagCompund.hasInt("SpawnY") && tagCompund.hasInt("SpawnZ"))
|
||||||
{
|
{
|
||||||
this.spawnPos = new WorldPos(tagCompund.getInteger("SpawnX"), tagCompund.getInteger("SpawnY"),
|
this.spawnPos = new WorldPos(tagCompund.getInt("SpawnX"), tagCompund.getInt("SpawnY"),
|
||||||
tagCompund.getInteger("SpawnZ"), tagCompund.getInteger("SpawnDim"));
|
tagCompund.getInt("SpawnZ"), tagCompund.getInt("SpawnDim"));
|
||||||
// this.spawnForced = tagCompund.getBoolean("SpawnForced");
|
// this.spawnForced = tagCompund.getBoolean("SpawnForced");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("OriginX", 99) && tagCompund.hasKey("OriginY", 99) && tagCompund.hasKey("OriginZ", 99))
|
if (tagCompund.hasInt("OriginX") && tagCompund.hasInt("OriginY") && tagCompund.hasInt("OriginZ"))
|
||||||
{
|
{
|
||||||
this.originPos = new WorldPos(tagCompund.getInteger("OriginX"), tagCompund.getInteger("OriginY"),
|
this.originPos = new WorldPos(tagCompund.getInt("OriginX"), tagCompund.getInt("OriginY"),
|
||||||
tagCompund.getInteger("OriginZ"), tagCompund.getInteger("OriginDim"));
|
tagCompund.getInt("OriginZ"), tagCompund.getInt("OriginDim"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.foodStats.readNBT(tagCompund);
|
// this.foodStats.readNBT(tagCompund);
|
||||||
// this.readCapabilitiesFromNBT(tagCompund);
|
// this.readCapabilitiesFromNBT(tagCompund);
|
||||||
this.flying = tagCompund.getBoolean("flying") && (this.hasEffect(Potion.FLYING) || this.canNaturallyFly());
|
this.flying = tagCompund.getBool("flying") && (this.hasEffect(Potion.FLYING) || this.canNaturallyFly());
|
||||||
// if(tagCompund.hasKey("speed", 99))
|
// if(tagCompund.hasKey("speed", 99))
|
||||||
// this.speed = tagCompund.getFloat("speed");
|
// this.speed = tagCompund.getFloat("speed");
|
||||||
// this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable");
|
// this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable");
|
||||||
// this.disableTargetPersist = tagCompund.getBoolean("neverTarget");
|
// this.disableTargetPersist = tagCompund.getBoolean("neverTarget");
|
||||||
// this.allowFlyingPersist = tagCompund.getBoolean("alwaysFly");
|
// this.allowFlyingPersist = tagCompund.getBoolean("alwaysFly");
|
||||||
this.noclip = tagCompund.getBoolean("noClip");
|
this.noclip = tagCompund.getBool("noClip");
|
||||||
|
|
||||||
if (tagCompund.hasKey("WarpItems", 9))
|
if (tagCompund.hasTagList("WarpItems"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist1 = tagCompund.getTagList("WarpItems", 10);
|
NBTTagTagList nbttaglist1 = tagCompund.getTagList("WarpItems");
|
||||||
this.warpChest.loadInventoryFromNBT(nbttaglist1);
|
this.warpChest.loadInventoryFromNBT(nbttaglist1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3507,8 +3509,8 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// model = ModelType.HUMANOID;
|
// model = ModelType.HUMANOID;
|
||||||
// }
|
// }
|
||||||
// this.setModel(model);
|
// this.setModel(model);
|
||||||
// this.setModelParts(tagCompund.hasKey("PartFlags", 3) ? tagCompund.getInteger("PartFlags") : ~ModelPart.ARMS_SLIM.getMask());
|
// this.setModelParts(tagCompund.hasInt("PartFlags") ? tagCompund.getInteger("PartFlags") : ~ModelPart.ARMS_SLIM.getMask());
|
||||||
// if(tagCompund.hasKey("PlayerScale", 5))
|
// if(tagCompund.hasFloat("PlayerScale"))
|
||||||
// this.setPlayerHeight(tagCompund.getFloat("PlayerScale"));
|
// this.setPlayerHeight(tagCompund.getFloat("PlayerScale"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3532,7 +3534,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
|
|
||||||
// tagCompound.setBoolean("CanPickUpLoot", this.canPickUpLoot());
|
// tagCompound.setBoolean("CanPickUpLoot", this.canPickUpLoot());
|
||||||
NBTTagList nbttaglist0 = new NBTTagList();
|
NBTTagTagList nbttaglist0 = new NBTTagTagList();
|
||||||
|
|
||||||
for(int i = 0; i < this.equipment.length; ++i) {
|
for(int i = 0; i < this.equipment.length; ++i) {
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
@ -3541,23 +3543,23 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
this.equipment[i].writeToNBT(nbttagcompound);
|
this.equipment[i].writeToNBT(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttaglist0.appendTag(nbttagcompound);
|
nbttaglist0.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Equipment", nbttaglist0);
|
tagCompound.setTagList("Equipment", nbttaglist0);
|
||||||
// tagCompound.setString("Species", this.getSpecies());
|
// tagCompound.setString("Species", this.getSpecies());
|
||||||
tagCompound.setString("Char", this.getChar());
|
tagCompound.setString("Char", this.getChar());
|
||||||
tagCompound.setString("Cape", this.getCape());
|
tagCompound.setString("Cape", this.getCape());
|
||||||
tagCompound.setBoolean("Willing", this.isWilling);
|
tagCompound.setBool("Willing", this.isWilling);
|
||||||
tagCompound.setBoolean("Mating", this.isMating());
|
tagCompound.setBool("Mating", this.isMating());
|
||||||
tagCompound.setString("Align", this.alignment.name);
|
tagCompound.setString("Align", this.alignment.name);
|
||||||
tagCompound.setFloat("Height", this.getHeight());
|
tagCompound.setFloat("Height", this.getHeight());
|
||||||
tagCompound.setInteger("Mana", this.getManaPoints());
|
tagCompound.setInt("Mana", this.getManaPoints());
|
||||||
Enum type = this.getNpcClass();
|
Enum type = this.getNpcClass();
|
||||||
if(type != null)
|
if(type != null)
|
||||||
tagCompound.setString("ClassType", this.species.classnames.inverse().get(type));
|
tagCompound.setString("ClassType", this.species.classnames.inverse().get(type));
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.extraInventory.getSizeInventory(); ++i)
|
for (int i = 0; i < this.extraInventory.getSizeInventory(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -3565,14 +3567,14 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
|
|
||||||
if (itemstack != null)
|
if (itemstack != null)
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound()));
|
nbttaglist.add(itemstack.writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Items", nbttaglist);
|
tagCompound.setTagList("Items", nbttaglist);
|
||||||
if(this.trades != null)
|
if(this.trades != null)
|
||||||
tagCompound.setTag("Offers", this.trades.getRecipiesAsTags());
|
tagCompound.setTagList("Offers", this.trades.toNbt());
|
||||||
tagCompound.setInteger("healTimer", this.healTimer);
|
tagCompound.setInt("healTimer", this.healTimer);
|
||||||
if(this.skin != null)
|
if(this.skin != null)
|
||||||
tagCompound.setByteArray("Skin", this.skin);
|
tagCompound.setByteArray("Skin", this.skin);
|
||||||
|
|
||||||
|
@ -3585,44 +3587,44 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
this.getAttributeMap().applyAttributeModifiers(itemstack.getAttributeModifiers(2), z, itemstack.stackSize);
|
this.getAttributeMap().applyAttributeModifiers(itemstack.getAttributeModifiers(2), z, itemstack.stackSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tagCompound.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList()));
|
tagCompound.setTagList("Inventory", this.inventory.writeToNBT(new NBTTagTagList()));
|
||||||
tagCompound.setInteger("SelectedItemSlot", this.inventory.currentItem);
|
tagCompound.setInt("SelectedItemSlot", this.inventory.currentItem);
|
||||||
// tagCompound.setBoolean("Sleeping", this.sleeping);
|
// tagCompound.setBoolean("Sleeping", this.sleeping);
|
||||||
// tagCompound.setShort("SleepTimer", (short)this.sleepTimer);
|
// tagCompound.setShort("SleepTimer", (short)this.sleepTimer);
|
||||||
tagCompound.setFloat("XpP", this.experience);
|
tagCompound.setFloat("XpP", this.experience);
|
||||||
tagCompound.setInteger("XpLevel", this.experienceLevel);
|
tagCompound.setInt("XpLevel", this.experienceLevel);
|
||||||
tagCompound.setInteger("XpTotal", this.experienceTotal);
|
tagCompound.setInt("XpTotal", this.experienceTotal);
|
||||||
tagCompound.setInteger("XpSeed", this.xpSeed);
|
tagCompound.setInt("XpSeed", this.xpSeed);
|
||||||
// tagCompound.setInteger("Score", this.getScore());
|
// tagCompound.setInteger("Score", this.getScore());
|
||||||
// tagCompound.setInteger("Mana", this.getManaPoints());
|
// tagCompound.setInteger("Mana", this.getManaPoints());
|
||||||
|
|
||||||
if (this.spawnPos != null)
|
if (this.spawnPos != null)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("SpawnX", this.spawnPos.getX());
|
tagCompound.setInt("SpawnX", this.spawnPos.getX());
|
||||||
tagCompound.setInteger("SpawnY", this.spawnPos.getY());
|
tagCompound.setInt("SpawnY", this.spawnPos.getY());
|
||||||
tagCompound.setInteger("SpawnZ", this.spawnPos.getZ());
|
tagCompound.setInt("SpawnZ", this.spawnPos.getZ());
|
||||||
tagCompound.setInteger("SpawnDim", this.spawnPos.getDimension());
|
tagCompound.setInt("SpawnDim", this.spawnPos.getDimension());
|
||||||
// tagCompound.setBoolean("SpawnForced", this.spawnForced);
|
// tagCompound.setBoolean("SpawnForced", this.spawnForced);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.originPos != null)
|
if (this.originPos != null)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("OriginX", this.originPos.getX());
|
tagCompound.setInt("OriginX", this.originPos.getX());
|
||||||
tagCompound.setInteger("OriginY", this.originPos.getY());
|
tagCompound.setInt("OriginY", this.originPos.getY());
|
||||||
tagCompound.setInteger("OriginZ", this.originPos.getZ());
|
tagCompound.setInt("OriginZ", this.originPos.getZ());
|
||||||
tagCompound.setInteger("OriginDim", this.originPos.getDimension());
|
tagCompound.setInt("OriginDim", this.originPos.getDimension());
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.foodStats.writeNBT(tagCompound);
|
// this.foodStats.writeNBT(tagCompound);
|
||||||
// this.writeCapabilitiesToNBT(tagCompound);
|
// this.writeCapabilitiesToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("flying", this.flying);
|
tagCompound.setBool("flying", this.flying);
|
||||||
// tagCompound.setFloat("speed", this.speed);
|
// tagCompound.setFloat("speed", this.speed);
|
||||||
// tagCompound.setBoolean("alwaysInvulnerable", this.disableDamagePersist);
|
// tagCompound.setBoolean("alwaysInvulnerable", this.disableDamagePersist);
|
||||||
// tagCompound.setBoolean("neverTarget", this.disableTargetPersist);
|
// tagCompound.setBoolean("neverTarget", this.disableTargetPersist);
|
||||||
// tagCompound.setBoolean("alwaysFly", this.allowFlyingPersist);
|
// tagCompound.setBoolean("alwaysFly", this.allowFlyingPersist);
|
||||||
tagCompound.setBoolean("noClip", this.noclip);
|
tagCompound.setBool("noClip", this.noclip);
|
||||||
|
|
||||||
tagCompound.setTag("WarpItems", this.warpChest.saveInventoryToNBT());
|
tagCompound.setTagList("WarpItems", this.warpChest.saveInventoryToNBT());
|
||||||
ItemStack itemstack = this.inventory.getCurrentItem();
|
ItemStack itemstack = this.inventory.getCurrentItem();
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() != null)
|
if (itemstack != null && itemstack.getItem() != null)
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class EntitySlime extends EntityNPC
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
// tagCompound.setInteger("Size", this.getSlimeSize() - 1);
|
// tagCompound.setInteger("Size", this.getSlimeSize() - 1);
|
||||||
tagCompound.setBoolean("wasOnGround", this.wasOnGround);
|
tagCompound.setBool("wasOnGround", this.wasOnGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ public class EntitySlime extends EntityNPC
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// this.setSlimeSize(i + 1);
|
// this.setSlimeSize(i + 1);
|
||||||
this.wasOnGround = tagCompund.getBoolean("wasOnGround");
|
this.wasOnGround = tagCompund.getBool("wasOnGround");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ParticleType getParticleType()
|
protected ParticleType getParticleType()
|
||||||
|
|
|
@ -477,8 +477,10 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
||||||
tagCompound.setShort("yTile", (short)this.yTile);
|
tagCompound.setShort("yTile", (short)this.yTile);
|
||||||
tagCompound.setShort("zTile", (short)this.zTile);
|
tagCompound.setShort("zTile", (short)this.zTile);
|
||||||
tagCompound.setShort("life", (short)this.ticksInGround);
|
tagCompound.setShort("life", (short)this.ticksInGround);
|
||||||
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
if(this.inTile != null) {
|
||||||
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
String id = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
||||||
|
tagCompound.setString("inTile", id == null ? "" : id.toString());
|
||||||
|
}
|
||||||
tagCompound.setByte("inData", (byte)this.inData);
|
tagCompound.setByte("inData", (byte)this.inData);
|
||||||
tagCompound.setByte("shake", (byte)this.arrowShake);
|
tagCompound.setByte("shake", (byte)this.arrowShake);
|
||||||
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||||
|
@ -496,32 +498,22 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
||||||
this.zTile = tagCompund.getShort("zTile");
|
this.zTile = tagCompund.getShort("zTile");
|
||||||
this.ticksInGround = tagCompund.getShort("life");
|
this.ticksInGround = tagCompund.getShort("life");
|
||||||
|
|
||||||
if (tagCompund.hasKey("inTile", 8))
|
if (tagCompund.hasString("inTile"))
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getBlockById(tagCompund.getByte("inTile") & 255);
|
this.inTile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inData = tagCompund.getByte("inData") & 255;
|
this.inData = tagCompund.getByte("inData") & 255;
|
||||||
this.arrowShake = tagCompund.getByte("shake") & 255;
|
this.arrowShake = tagCompund.getByte("shake") & 255;
|
||||||
this.inGround = tagCompund.getByte("inGround") == 1;
|
this.inGround = tagCompund.getByte("inGround") == 1;
|
||||||
|
|
||||||
if (tagCompund.hasKey("damage", 99))
|
this.damage = tagCompund.getDouble("damage");
|
||||||
{
|
|
||||||
this.damage = tagCompund.getDouble("damage");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tagCompund.hasKey("pickup", 99))
|
this.canBePickedUp = tagCompund.getByte("pickup");
|
||||||
{
|
|
||||||
this.canBePickedUp = tagCompund.getByte("pickup");
|
|
||||||
}
|
|
||||||
else if (tagCompund.hasKey("player", 99))
|
|
||||||
{
|
|
||||||
this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -349,15 +349,14 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData
|
||||||
|
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("damage", this.damage);
|
tagCompound.setInt("damage", this.damage);
|
||||||
tagCompound.setInteger("age", this.age);
|
tagCompound.setInt("age", this.age);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
if(tagCompund.hasKey("damage", 99))
|
this.damage = tagCompund.getInt("damage");
|
||||||
this.damage = tagCompund.getInteger("damage");
|
this.age = tagCompund.getInt("age");
|
||||||
this.age = tagCompund.getInteger("age");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canTriggerWalking()
|
protected boolean canTriggerWalking()
|
||||||
|
|
|
@ -67,17 +67,17 @@ public class EntityDie extends EntityThrowable implements IObjectData
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("Sides", this.sides);
|
tagCompound.setInt("Sides", this.sides);
|
||||||
tagCompound.setInteger("Value", this.getValue());
|
tagCompound.setInt("Value", this.getValue());
|
||||||
tagCompound.setBoolean("NoPickup", this.noPickup);
|
tagCompound.setBool("NoPickup", this.noPickup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.sides = tagCompund.getInteger("Sides");
|
this.sides = tagCompund.getInt("Sides");
|
||||||
this.setValue(tagCompund.getInteger("Value"));
|
this.setValue(tagCompund.getInt("Value"));
|
||||||
this.noPickup = tagCompund.getBoolean("NoPickup");
|
this.noPickup = tagCompund.getBool("NoPickup");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPacketData() {
|
public int getPacketData() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class EntityFireball extends EntityProjectile
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("ExplosionPower", this.explosionPower);
|
tagCompound.setInt("ExplosionPower", this.explosionPower);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,10 +68,6 @@ public class EntityFireball extends EntityProjectile
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
|
this.explosionPower = tagCompund.getInt("ExplosionPower");
|
||||||
if (tagCompund.hasKey("ExplosionPower", 99))
|
|
||||||
{
|
|
||||||
this.explosionPower = tagCompund.getInteger("ExplosionPower");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,8 +522,10 @@ public class EntityHook extends Entity implements IObjectData
|
||||||
tagCompound.setShort("xTile", (short)this.xTile);
|
tagCompound.setShort("xTile", (short)this.xTile);
|
||||||
tagCompound.setShort("yTile", (short)this.yTile);
|
tagCompound.setShort("yTile", (short)this.yTile);
|
||||||
tagCompound.setShort("zTile", (short)this.zTile);
|
tagCompound.setShort("zTile", (short)this.zTile);
|
||||||
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
if(this.inTile != null) {
|
||||||
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
String id = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
||||||
|
tagCompound.setString("inTile", id == null ? "" : id.toString());
|
||||||
|
}
|
||||||
tagCompound.setByte("shake", (byte)this.shake);
|
tagCompound.setByte("shake", (byte)this.shake);
|
||||||
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
@ -537,13 +539,13 @@ public class EntityHook extends Entity implements IObjectData
|
||||||
this.yTile = tagCompund.getShort("yTile");
|
this.yTile = tagCompund.getShort("yTile");
|
||||||
this.zTile = tagCompund.getShort("zTile");
|
this.zTile = tagCompund.getShort("zTile");
|
||||||
|
|
||||||
if (tagCompund.hasKey("inTile", 8))
|
if (tagCompund.hasString("inTile"))
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getBlockById(tagCompund.getByte("inTile") & 255);
|
this.inTile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shake = tagCompund.getByte("shake") & 255;
|
this.shake = tagCompund.getByte("shake") & 255;
|
||||||
|
|
|
@ -162,13 +162,13 @@ public class EntityPotion extends EntityThrowable implements IObjectData
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
|
|
||||||
if (tagCompund.hasKey("Potion", 10))
|
if (tagCompund.hasTag("Potion"))
|
||||||
{
|
{
|
||||||
this.potionDamage = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("Potion"));
|
this.potionDamage = ItemStack.loadItemStackFromNBT(tagCompund.getTag("Potion"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.setPotionDamage(tagCompund.getInteger("potionValue"));
|
this.setPotionDamage(tagCompund.getInt("potionValue"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.potionDamage == null)
|
if (this.potionDamage == null)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.entity.types.EntityLiving;
|
||||||
import common.init.BlockRegistry;
|
import common.init.BlockRegistry;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagDoubleList;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
|
@ -262,8 +262,8 @@ public abstract class EntityProjectile extends Entity
|
||||||
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
||||||
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
||||||
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||||
tagCompound.setTag("direction", this.newDoubleNBTList(this.motionX, this.motionY, this.motionZ));
|
tagCompound.setDoubleList("direction", this.newDoubleNBTList(this.motionX, this.motionY, this.motionZ));
|
||||||
tagCompound.setInteger("Age", this.age);
|
tagCompound.setInt("Age", this.age);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,7 +275,7 @@ public abstract class EntityProjectile extends Entity
|
||||||
this.yTile = tagCompund.getShort("yTile");
|
this.yTile = tagCompund.getShort("yTile");
|
||||||
this.zTile = tagCompund.getShort("zTile");
|
this.zTile = tagCompund.getShort("zTile");
|
||||||
|
|
||||||
if (tagCompund.hasKey("inTile", 8))
|
if (tagCompund.hasString("inTile"))
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
||||||
}
|
}
|
||||||
|
@ -286,18 +286,18 @@ public abstract class EntityProjectile extends Entity
|
||||||
|
|
||||||
this.inGround = tagCompund.getByte("inGround") == 1;
|
this.inGround = tagCompund.getByte("inGround") == 1;
|
||||||
|
|
||||||
if (tagCompund.hasKey("direction", 9))
|
if (tagCompund.hasDoubleList("direction"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
|
NBTTagDoubleList nbttaglist = tagCompund.getDoubleList("direction");
|
||||||
this.motionX = nbttaglist.getDoubleAt(0);
|
this.motionX = nbttaglist.getDouble(0);
|
||||||
this.motionY = nbttaglist.getDoubleAt(1);
|
this.motionY = nbttaglist.getDouble(1);
|
||||||
this.motionZ = nbttaglist.getDoubleAt(2);
|
this.motionZ = nbttaglist.getDouble(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
this.age = tagCompund.getInteger("Age");
|
this.age = tagCompund.getInt("Age");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,7 +103,7 @@ public abstract class EntityAnimal extends EntityLiving
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(tagCompound);
|
super.writeEntityToNBT(tagCompound);
|
||||||
tagCompound.setInteger("InLove", this.inLove);
|
tagCompound.setInt("InLove", this.inLove);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +112,7 @@ public abstract class EntityAnimal extends EntityLiving
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
this.setInLove(tagCompund.getInteger("InLove"), true);
|
this.setInLove(tagCompund.getInt("InLove"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,7 +48,7 @@ import common.item.ItemMonsterPlacer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.network.IPlayer;
|
import common.network.IPlayer;
|
||||||
import common.packet.SPacketEntityAttach;
|
import common.packet.SPacketEntityAttach;
|
||||||
import common.packet.SPacketAnimation;
|
import common.packet.SPacketAnimation;
|
||||||
|
@ -541,13 +541,13 @@ public abstract class EntityLiving extends Entity
|
||||||
*/
|
*/
|
||||||
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
public void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
tagCompound.setInteger("Health", this.getHealth());
|
tagCompound.setInt("Health", this.getHealth());
|
||||||
// tagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth())));
|
// tagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth())));
|
||||||
tagCompound.setShort("HurtTime", (short)this.hurtTime);
|
tagCompound.setShort("HurtTime", (short)this.hurtTime);
|
||||||
tagCompound.setInteger("HurtByTimestamp", this.lastAttacked);
|
tagCompound.setInt("HurtByTimestamp", this.lastAttacked);
|
||||||
tagCompound.setFloat("Radiation", this.radiation);
|
tagCompound.setFloat("Radiation", this.radiation);
|
||||||
tagCompound.setShort("DeathTime", (short)this.deathTime);
|
tagCompound.setShort("DeathTime", (short)this.deathTime);
|
||||||
tagCompound.setInteger("Absorption", this.getAbsorptionAmount());
|
tagCompound.setInt("Absorption", this.getAbsorptionAmount());
|
||||||
|
|
||||||
for (ItemStack itemstack : this.getInventory())
|
for (ItemStack itemstack : this.getInventory())
|
||||||
{
|
{
|
||||||
|
@ -557,7 +557,7 @@ public abstract class EntityLiving extends Entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Attributes", Attributes.writeBaseAttributeMapToNBT(this.getAttributeMap()));
|
tagCompound.setTagList("Attributes", Attributes.writeBaseAttributeMapToNBT(this.getAttributeMap()));
|
||||||
|
|
||||||
for (ItemStack itemstack1 : this.getInventory())
|
for (ItemStack itemstack1 : this.getInventory())
|
||||||
{
|
{
|
||||||
|
@ -569,17 +569,17 @@ public abstract class EntityLiving extends Entity
|
||||||
|
|
||||||
if (!this.effects.isEmpty())
|
if (!this.effects.isEmpty())
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (PotionEffect potioneffect : this.effects.values())
|
for (PotionEffect potioneffect : this.effects.values())
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(potioneffect.toNbt());
|
nbttaglist.add(potioneffect.toNbt());
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("ActiveEffects", nbttaglist);
|
tagCompound.setTagList("ActiveEffects", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setBoolean("Leashed", this.leashed);
|
tagCompound.setBool("Leashed", this.leashed);
|
||||||
|
|
||||||
if(this.leashedTo != null) {
|
if(this.leashedTo != null) {
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
|
@ -590,9 +590,9 @@ public abstract class EntityLiving extends Entity
|
||||||
// else
|
// else
|
||||||
if(this.leashedTo instanceof EntityLeashKnot) {
|
if(this.leashedTo instanceof EntityLeashKnot) {
|
||||||
BlockPos blockpos = ((EntityLeashKnot)this.leashedTo).getHangingPosition();
|
BlockPos blockpos = ((EntityLeashKnot)this.leashedTo).getHangingPosition();
|
||||||
nbttagcompound1.setInteger("X", blockpos.getX());
|
nbttagcompound1.setInt("X", blockpos.getX());
|
||||||
nbttagcompound1.setInteger("Y", blockpos.getY());
|
nbttagcompound1.setInt("Y", blockpos.getY());
|
||||||
nbttagcompound1.setInteger("Z", blockpos.getZ());
|
nbttagcompound1.setInt("Z", blockpos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
tagCompound.setTag("Leash", nbttagcompound1);
|
tagCompound.setTag("Leash", nbttagcompound1);
|
||||||
|
@ -601,7 +601,7 @@ public abstract class EntityLiving extends Entity
|
||||||
// if(this.isAIDisabled()) {
|
// if(this.isAIDisabled()) {
|
||||||
// tagCompound.setBoolean("NoAI", this.isAIDisabled());
|
// tagCompound.setBoolean("NoAI", this.isAIDisabled());
|
||||||
// }
|
// }
|
||||||
tagCompound.setInteger("Age", this.getGrowingAge());
|
tagCompound.setInt("Age", this.getGrowingAge());
|
||||||
if(this.description != null)
|
if(this.description != null)
|
||||||
tagCompound.setString("Description", this.description);
|
tagCompound.setString("Description", this.description);
|
||||||
}
|
}
|
||||||
|
@ -611,20 +611,20 @@ public abstract class EntityLiving extends Entity
|
||||||
*/
|
*/
|
||||||
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
public void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||||
{
|
{
|
||||||
this.setAbsorptionAmount(tagCompund.getInteger("Absorption"));
|
this.setAbsorptionAmount(tagCompund.getInt("Absorption"));
|
||||||
|
|
||||||
if (tagCompund.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.client)
|
if (tagCompund.hasTagList("Attributes") && this.worldObj != null && !this.worldObj.client)
|
||||||
{
|
{
|
||||||
Attributes.setAttributeModifiers(this.getAttributeMap(), tagCompund.getTagList("Attributes", 10));
|
Attributes.setAttributeModifiers(this.getAttributeMap(), tagCompund.getTagList("Attributes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("ActiveEffects", 9))
|
if (tagCompund.hasTagList("ActiveEffects"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = tagCompund.getTagList("ActiveEffects", 10);
|
NBTTagTagList nbttaglist = tagCompund.getTagList("ActiveEffects");
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
PotionEffect potioneffect = PotionEffect.fromNbt(nbttagcompound);
|
PotionEffect potioneffect = PotionEffect.fromNbt(nbttagcompound);
|
||||||
|
|
||||||
if (potioneffect != null && !potioneffect.getPotion().isInstant())
|
if (potioneffect != null && !potioneffect.getPotion().isInstant())
|
||||||
|
@ -634,9 +634,9 @@ public abstract class EntityLiving extends Entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagCompund.hasKey("Health", 3))
|
if (tagCompund.hasInt("Health"))
|
||||||
{
|
{
|
||||||
this.setHealth(tagCompund.getInteger("Health"));
|
this.setHealth(tagCompund.getInt("Health"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -658,20 +658,20 @@ public abstract class EntityLiving extends Entity
|
||||||
|
|
||||||
this.hurtTime = tagCompund.getShort("HurtTime");
|
this.hurtTime = tagCompund.getShort("HurtTime");
|
||||||
this.deathTime = tagCompund.getShort("DeathTime");
|
this.deathTime = tagCompund.getShort("DeathTime");
|
||||||
this.lastAttacked = tagCompund.getInteger("HurtByTimestamp");
|
this.lastAttacked = tagCompund.getInt("HurtByTimestamp");
|
||||||
this.radiation = tagCompund.getFloat("Radiation");
|
this.radiation = tagCompund.getFloat("Radiation");
|
||||||
|
|
||||||
if(!(this.isPlayer())) {
|
if(!(this.isPlayer())) {
|
||||||
this.leashed = tagCompund.getBoolean("Leashed");
|
this.leashed = tagCompund.getBool("Leashed");
|
||||||
|
|
||||||
if(this.leashed && tagCompund.hasKey("Leash", 10)) {
|
if(this.leashed && tagCompund.hasTag("Leash")) {
|
||||||
this.leashTag = tagCompund.getCompoundTag("Leash");
|
this.leashTag = tagCompund.getTag("Leash");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.setNoAI(tagCompund.getBoolean("NoAI"));
|
// this.setNoAI(tagCompund.getBoolean("NoAI"));
|
||||||
this.setGrowingAge(tagCompund.getInteger("Age"));
|
this.setGrowingAge(tagCompund.getInt("Age"));
|
||||||
this.description = tagCompund.hasKey("Description", 8) ? tagCompund.getString("Description") : null;
|
this.description = tagCompund.hasString("Description") ? tagCompund.getString("Description") : null;
|
||||||
if(this.description != null && this.description.isEmpty())
|
if(this.description != null && this.description.isEmpty())
|
||||||
this.description = null;
|
this.description = null;
|
||||||
}
|
}
|
||||||
|
@ -3121,7 +3121,7 @@ public abstract class EntityLiving extends Entity
|
||||||
|
|
||||||
private void recreateLeash() {
|
private void recreateLeash() {
|
||||||
if(this.leashed && this.leashTag != null) {
|
if(this.leashed && this.leashTag != null) {
|
||||||
// if(this.leashTag.hasKey("PlayerName", 8)) {
|
// if(this.leashTag.hasString("PlayerName")) {
|
||||||
// String id = this.leashTag.getString("PlayerName");
|
// String id = this.leashTag.getString("PlayerName");
|
||||||
// if(!id.isEmpty()) {
|
// if(!id.isEmpty()) {
|
||||||
// for(EntityNPC entitylivingbase : this.worldObj.getEntitiesWithinAABB(EntityNPC.class,
|
// for(EntityNPC entitylivingbase : this.worldObj.getEntitiesWithinAABB(EntityNPC.class,
|
||||||
|
@ -3134,9 +3134,9 @@ public abstract class EntityLiving extends Entity
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
if(this.leashTag.hasKey("X", 99) && this.leashTag.hasKey("Y", 99) && this.leashTag.hasKey("Z", 99)) {
|
if(this.leashTag.hasInt("X") && this.leashTag.hasInt("Y") && this.leashTag.hasInt("Z")) {
|
||||||
BlockPos blockpos = new BlockPos(this.leashTag.getInteger("X"), this.leashTag.getInteger("Y"),
|
BlockPos blockpos = new BlockPos(this.leashTag.getInt("X"), this.leashTag.getInt("Y"),
|
||||||
this.leashTag.getInteger("Z"));
|
this.leashTag.getInt("Z"));
|
||||||
EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(this.worldObj, blockpos);
|
EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(this.worldObj, blockpos);
|
||||||
|
|
||||||
if(entityleashknot == null) {
|
if(entityleashknot == null) {
|
||||||
|
|
|
@ -38,8 +38,8 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
|
||||||
// tagCompound.setString("Owner", this.getOwnerId());
|
// tagCompound.setString("Owner", this.getOwnerId());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
tagCompound.setBoolean("Tame", this.isTamed());
|
tagCompound.setBool("Tame", this.isTamed());
|
||||||
tagCompound.setBoolean("Sitting", this.isSitting());
|
tagCompound.setBool("Sitting", this.isSitting());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
|
||||||
super.readEntityFromNBT(tagCompund);
|
super.readEntityFromNBT(tagCompund);
|
||||||
// String s = "";
|
// String s = "";
|
||||||
//
|
//
|
||||||
// if (tagCompund.hasKey("Owner", 8))
|
// if (tagCompund.hasString("Owner"))
|
||||||
// {
|
// {
|
||||||
// s = tagCompund.getString("Owner");
|
// s = tagCompund.getString("Owner");
|
||||||
// }
|
// }
|
||||||
|
@ -61,9 +61,9 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
|
||||||
// this.setTamed(true);
|
// this.setTamed(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.setTamed(tagCompund.getBoolean("Tame"));
|
this.setTamed(tagCompund.getBool("Tame"));
|
||||||
this.aiSit.setSitting(tagCompund.getBoolean("Sitting"));
|
this.aiSit.setSitting(tagCompund.getBool("Sitting"));
|
||||||
this.setSitting(tagCompund.getBoolean("Sitting"));
|
this.setSitting(tagCompund.getBool("Sitting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -308,8 +308,10 @@ public abstract class EntityThrowable extends Entity implements IProjectile
|
||||||
tagCompound.setShort("xTile", (short)this.xTile);
|
tagCompound.setShort("xTile", (short)this.xTile);
|
||||||
tagCompound.setShort("yTile", (short)this.yTile);
|
tagCompound.setShort("yTile", (short)this.yTile);
|
||||||
tagCompound.setShort("zTile", (short)this.zTile);
|
tagCompound.setShort("zTile", (short)this.zTile);
|
||||||
String resourcelocation = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
if(this.inTile != null) {
|
||||||
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
String id = BlockRegistry.REGISTRY.getNameForObject(this.inTile);
|
||||||
|
tagCompound.setString("inTile", id == null ? "" : id.toString());
|
||||||
|
}
|
||||||
tagCompound.setByte("shake", (byte)this.throwableShake);
|
tagCompound.setByte("shake", (byte)this.throwableShake);
|
||||||
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||||
|
|
||||||
|
@ -330,13 +332,13 @@ public abstract class EntityThrowable extends Entity implements IProjectile
|
||||||
this.yTile = tagCompund.getShort("yTile");
|
this.yTile = tagCompund.getShort("yTile");
|
||||||
this.zTile = tagCompund.getShort("zTile");
|
this.zTile = tagCompund.getShort("zTile");
|
||||||
|
|
||||||
if (tagCompund.hasKey("inTile", 8))
|
if (tagCompund.hasString("inTile"))
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
this.inTile = BlockRegistry.getByIdFallback(tagCompund.getString("inTile"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.inTile = BlockRegistry.getBlockById(tagCompund.getByte("inTile") & 255);
|
this.inTile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.throwableShake = tagCompund.getByte("shake") & 255;
|
this.throwableShake = tagCompund.getByte("shake") & 255;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import common.item.ItemArmor;
|
||||||
import common.item.ItemDye;
|
import common.item.ItemDye;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.tileentity.TileEntityBanner;
|
import common.tileentity.TileEntityBanner;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -617,22 +617,22 @@ public abstract class CraftingRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound nbttagcompound1 = itemstack.getSubCompound("BlockEntityTag", true);
|
NBTTagCompound nbttagcompound1 = itemstack.getSubCompound("BlockEntityTag", true);
|
||||||
NBTTagList nbttaglist = null;
|
NBTTagTagList nbttaglist = null;
|
||||||
|
|
||||||
if (nbttagcompound1.hasKey("Patterns", 9))
|
if (nbttagcompound1.hasTagList("Patterns"))
|
||||||
{
|
{
|
||||||
nbttaglist = nbttagcompound1.getTagList("Patterns", 10);
|
nbttaglist = nbttagcompound1.getTagList("Patterns");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nbttaglist = new NBTTagList();
|
nbttaglist = new NBTTagTagList();
|
||||||
nbttagcompound1.setTag("Patterns", nbttaglist);
|
nbttagcompound1.setTagList("Patterns", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setString("Pattern", tileentitybanner$enumbannerpattern.getPatternID());
|
nbttagcompound.setString("Pattern", tileentitybanner$enumbannerpattern.getPatternID());
|
||||||
nbttagcompound.setInteger("Color", k);
|
nbttagcompound.setInt("Color", k);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemstack;
|
return itemstack;
|
||||||
|
@ -971,19 +971,19 @@ public abstract class CraftingRegistry
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2)
|
for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2)
|
||||||
{
|
{
|
||||||
ItemStack itemstack3 = inv.getStackInSlot(k2);
|
ItemStack itemstack3 = inv.getStackInSlot(k2);
|
||||||
|
|
||||||
if (itemstack3 != null && itemstack3.getItem() == Items.firework_charge && itemstack3.hasTagCompound() && itemstack3.getTagCompound().hasKey("Explosion", 10))
|
if (itemstack3 != null && itemstack3.getItem() == Items.firework_charge && itemstack3.hasTagCompound() && itemstack3.getTagCompound().hasTag("Explosion"))
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(itemstack3.getTagCompound().getCompoundTag("Explosion"));
|
nbttaglist.add(itemstack3.getTagCompound().getTag("Explosion"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttagcompound3.setTag("Explosions", nbttaglist);
|
nbttagcompound3.setTagList("Explosions", nbttaglist);
|
||||||
nbttagcompound3.setByte("Flight", (byte)j);
|
nbttagcompound3.setByte("Flight", (byte)j);
|
||||||
nbttagcompound1.setTag("Fireworks", nbttagcompound3);
|
nbttagcompound1.setTag("Fireworks", nbttagcompound3);
|
||||||
this.field_92102_a.setTagCompound(nbttagcompound1);
|
this.field_92102_a.setTagCompound(nbttagcompound1);
|
||||||
|
@ -1011,11 +1011,11 @@ public abstract class CraftingRegistry
|
||||||
}
|
}
|
||||||
else if (itemstack2.getItem() == Items.glowstone_dust)
|
else if (itemstack2.getItem() == Items.glowstone_dust)
|
||||||
{
|
{
|
||||||
nbttagcompound2.setBoolean("Flicker", true);
|
nbttagcompound2.setBool("Flicker", true);
|
||||||
}
|
}
|
||||||
else if (itemstack2.getItem() == Items.diamond)
|
else if (itemstack2.getItem() == Items.diamond)
|
||||||
{
|
{
|
||||||
nbttagcompound2.setBoolean("Trail", true);
|
nbttagcompound2.setBool("Trail", true);
|
||||||
}
|
}
|
||||||
else if (itemstack2.getItem() == Items.fire_charge)
|
else if (itemstack2.getItem() == Items.fire_charge)
|
||||||
{
|
{
|
||||||
|
@ -1080,7 +1080,7 @@ public abstract class CraftingRegistry
|
||||||
|
|
||||||
if (this.field_92102_a != null && this.field_92102_a.hasTagCompound())
|
if (this.field_92102_a != null && this.field_92102_a.hasTagCompound())
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound4 = this.field_92102_a.getTagCompound().getCompoundTag("Explosion");
|
NBTTagCompound nbttagcompound4 = this.field_92102_a.getTagCompound().getTag("Explosion");
|
||||||
|
|
||||||
if (nbttagcompound4 == null)
|
if (nbttagcompound4 == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -435,7 +435,7 @@ public abstract class DispenserRegistry {
|
||||||
// {
|
// {
|
||||||
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||||
//
|
//
|
||||||
// if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
|
// if (nbttagcompound.hasString("SkullOwner") && nbttagcompound.getString("SkullOwner").length() > 0)
|
||||||
// {
|
// {
|
||||||
// user = nbttagcompound.getString("SkullOwner");
|
// user = nbttagcompound.getString("SkullOwner");
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -30,7 +30,7 @@ import common.log.Log;
|
||||||
import common.nbt.NBTException;
|
import common.nbt.NBTException;
|
||||||
import common.nbt.NBTParser;
|
import common.nbt.NBTParser;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.PortalType;
|
import common.util.PortalType;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -93,16 +93,16 @@ public abstract class UniverseRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadNbt(NBTTagCompound tag) {
|
public static void loadNbt(NBTTagCompound tag) {
|
||||||
NBTTagList list = tag.getTagList("Dimensions", 10);
|
NBTTagTagList list = tag.getTagList("Dimensions");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
Dimension dim = Dimension.getByNbt(list.getCompoundTagAt(z));
|
Dimension dim = Dimension.getByNbt(list.getTag(z));
|
||||||
if(!REGISTRY.containsKey(dim.getDimensionId()) && !ALIASES.containsKey(dim.getDimensionName()))
|
if(!REGISTRY.containsKey(dim.getDimensionId()) && !ALIASES.containsKey(dim.getDimensionName()))
|
||||||
register(dim);
|
register(dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = tag.getTagList("Names", 10);
|
list = tag.getTagList("Names");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
NBTTagCompound data = list.getTag(z);
|
||||||
String id = data.getString("ID");
|
String id = data.getString("ID");
|
||||||
// if(BASE_ALIASES.containsKey(id)) {
|
// if(BASE_ALIASES.containsKey(id)) {
|
||||||
Dimension dim = ALIASES.get(id);
|
Dimension dim = ALIASES.get(id);
|
||||||
|
@ -111,9 +111,9 @@ public abstract class UniverseRegistry {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
list = tag.getTagList("Sectors", 10);
|
list = tag.getTagList("Sectors");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
NBTTagCompound data = list.getTag(z);
|
||||||
String id = data.getString("ID");
|
String id = data.getString("ID");
|
||||||
Sector sector = SECTORS.get(id);
|
Sector sector = SECTORS.get(id);
|
||||||
if(sector == null)
|
if(sector == null)
|
||||||
|
@ -121,9 +121,9 @@ public abstract class UniverseRegistry {
|
||||||
sector.readNbt(data);
|
sector.readNbt(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = tag.getTagList("Galaxies", 10);
|
list = tag.getTagList("Galaxies");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
NBTTagCompound data = list.getTag(z);
|
||||||
String id = data.getString("ID");
|
String id = data.getString("ID");
|
||||||
Galaxy galaxy = GALAXIES.get(id);
|
Galaxy galaxy = GALAXIES.get(id);
|
||||||
if(galaxy == null)
|
if(galaxy == null)
|
||||||
|
@ -131,9 +131,9 @@ public abstract class UniverseRegistry {
|
||||||
galaxy.readNbt(data);
|
galaxy.readNbt(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = tag.getTagList("Domains", 10);
|
list = tag.getTagList("Domains");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound data = list.getCompoundTagAt(z);
|
NBTTagCompound data = list.getTag(z);
|
||||||
String id = data.getString("ID");
|
String id = data.getString("ID");
|
||||||
Domain domain = DOMAINS.get(id);
|
Domain domain = DOMAINS.get(id);
|
||||||
if(domain == null)
|
if(domain == null)
|
||||||
|
@ -141,9 +141,9 @@ public abstract class UniverseRegistry {
|
||||||
domain.readNbt(data);
|
domain.readNbt(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = tag.getTagList("Barycenters", 10);
|
list = tag.getTagList("Barycenters");
|
||||||
for(int z = 0; z < list.tagCount(); z++) {
|
for(int z = 0; z < list.size(); z++) {
|
||||||
NBTTagCompound link = list.getCompoundTagAt(z);
|
NBTTagCompound link = list.getTag(z);
|
||||||
if(!assign(link.getString("Celestial"), link.getString("Center")))
|
if(!assign(link.getString("Celestial"), link.getString("Center")))
|
||||||
Log.TICK.warn("Konnte '" + link.getString("Celestial") + "' nicht zu '" + link.getString("Center") + "' zuweisen");
|
Log.TICK.warn("Konnte '" + link.getString("Celestial") + "' nicht zu '" + link.getString("Center") + "' zuweisen");
|
||||||
}
|
}
|
||||||
|
@ -152,72 +152,72 @@ public abstract class UniverseRegistry {
|
||||||
public static NBTTagCompound saveNbt() {
|
public static NBTTagCompound saveNbt() {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagTagList list = new NBTTagTagList();
|
||||||
for(Dimension dim : DIMENSIONS) {
|
for(Dimension dim : DIMENSIONS) {
|
||||||
if(!BASE_REGISTRY.containsKey(dim.getDimensionId()) && dim != Space.INSTANCE)
|
if(!BASE_REGISTRY.containsKey(dim.getDimensionId()) && dim != Space.INSTANCE)
|
||||||
list.appendTag(dim.toNbt());
|
list.add(dim.toNbt());
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Dimensions", list);
|
tag.setTagList("Dimensions", list);
|
||||||
|
|
||||||
list = new NBTTagList();
|
list = new NBTTagTagList();
|
||||||
for(Dimension dim : DIMENSIONS) {
|
for(Dimension dim : DIMENSIONS) {
|
||||||
if(/* BASE_REGISTRY.containsKey(dim.getDimensionId()) */ dim != Space.INSTANCE) {
|
if(/* BASE_REGISTRY.containsKey(dim.getDimensionId()) */ dim != Space.INSTANCE) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
dim.writeNbt(data);
|
dim.writeNbt(data);
|
||||||
if(!data.hasNoTags()) {
|
if(!data.isEmpty()) {
|
||||||
data.setString("ID", dim.getDimensionName());
|
data.setString("ID", dim.getDimensionName());
|
||||||
list.appendTag(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Names", list);
|
tag.setTagList("Names", list);
|
||||||
|
|
||||||
list = new NBTTagList();
|
list = new NBTTagTagList();
|
||||||
for(Sector sector : SECTORS.values()) {
|
for(Sector sector : SECTORS.values()) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
sector.writeNbt(data);
|
sector.writeNbt(data);
|
||||||
if(!data.hasNoTags()) {
|
if(!data.isEmpty()) {
|
||||||
data.setString("ID", sector.id);
|
data.setString("ID", sector.id);
|
||||||
list.appendTag(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Sectors", list);
|
tag.setTagList("Sectors", list);
|
||||||
|
|
||||||
list = new NBTTagList();
|
list = new NBTTagTagList();
|
||||||
for(Galaxy galaxy : GALAXIES.values()) {
|
for(Galaxy galaxy : GALAXIES.values()) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
galaxy.writeNbt(data);
|
galaxy.writeNbt(data);
|
||||||
if(!data.hasNoTags()) {
|
if(!data.isEmpty()) {
|
||||||
data.setString("ID", galaxy.id);
|
data.setString("ID", galaxy.id);
|
||||||
list.appendTag(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Galaxies", list);
|
tag.setTagList("Galaxies", list);
|
||||||
|
|
||||||
list = new NBTTagList();
|
list = new NBTTagTagList();
|
||||||
for(Domain domain : DOMAINS.values()) {
|
for(Domain domain : DOMAINS.values()) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
domain.writeNbt(data);
|
domain.writeNbt(data);
|
||||||
if(!data.hasNoTags()) {
|
if(!data.isEmpty()) {
|
||||||
data.setString("ID", domain.id);
|
data.setString("ID", domain.id);
|
||||||
list.appendTag(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Domains", list);
|
tag.setTagList("Domains", list);
|
||||||
|
|
||||||
list = new NBTTagList();
|
list = new NBTTagTagList();
|
||||||
for(Entry<Moon, Planet> entry : MOON_MAP.entrySet()) {
|
for(Entry<Moon, Planet> entry : MOON_MAP.entrySet()) {
|
||||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||||
continue;
|
continue;
|
||||||
NBTTagCompound link = new NBTTagCompound();
|
NBTTagCompound link = new NBTTagCompound();
|
||||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||||
link.setString("Center", entry.getValue().getDimensionName());
|
link.setString("Center", entry.getValue().getDimensionName());
|
||||||
list.appendTag(link);
|
list.add(link);
|
||||||
}
|
}
|
||||||
for(Entry<Planet, Star> entry : PLANET_MAP.entrySet()) {
|
for(Entry<Planet, Star> entry : PLANET_MAP.entrySet()) {
|
||||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||||
|
@ -225,7 +225,7 @@ public abstract class UniverseRegistry {
|
||||||
NBTTagCompound link = new NBTTagCompound();
|
NBTTagCompound link = new NBTTagCompound();
|
||||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||||
link.setString("Center", entry.getValue().getDimensionName());
|
link.setString("Center", entry.getValue().getDimensionName());
|
||||||
list.appendTag(link);
|
list.add(link);
|
||||||
}
|
}
|
||||||
for(Entry<Star, Sector> entry : STAR_MAP.entrySet()) {
|
for(Entry<Star, Sector> entry : STAR_MAP.entrySet()) {
|
||||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||||
|
@ -233,7 +233,7 @@ public abstract class UniverseRegistry {
|
||||||
NBTTagCompound link = new NBTTagCompound();
|
NBTTagCompound link = new NBTTagCompound();
|
||||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||||
link.setString("Center", entry.getValue().id);
|
link.setString("Center", entry.getValue().id);
|
||||||
list.appendTag(link);
|
list.add(link);
|
||||||
}
|
}
|
||||||
for(Entry<Sector, Galaxy> entry : SECTOR_MAP.entrySet()) {
|
for(Entry<Sector, Galaxy> entry : SECTOR_MAP.entrySet()) {
|
||||||
if(BASE_MAP.containsKey(entry.getKey().id))
|
if(BASE_MAP.containsKey(entry.getKey().id))
|
||||||
|
@ -241,7 +241,7 @@ public abstract class UniverseRegistry {
|
||||||
NBTTagCompound link = new NBTTagCompound();
|
NBTTagCompound link = new NBTTagCompound();
|
||||||
link.setString("Celestial", entry.getKey().id);
|
link.setString("Celestial", entry.getKey().id);
|
||||||
link.setString("Center", entry.getValue().id);
|
link.setString("Center", entry.getValue().id);
|
||||||
list.appendTag(link);
|
list.add(link);
|
||||||
}
|
}
|
||||||
for(Entry<Area, Domain> entry : AREA_MAP.entrySet()) {
|
for(Entry<Area, Domain> entry : AREA_MAP.entrySet()) {
|
||||||
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
if(BASE_REGISTRY.containsKey(entry.getKey().getDimensionId()))
|
||||||
|
@ -249,10 +249,10 @@ public abstract class UniverseRegistry {
|
||||||
NBTTagCompound link = new NBTTagCompound();
|
NBTTagCompound link = new NBTTagCompound();
|
||||||
link.setString("Celestial", entry.getKey().getDimensionName());
|
link.setString("Celestial", entry.getKey().getDimensionName());
|
||||||
link.setString("Center", entry.getValue().id);
|
link.setString("Center", entry.getValue().id);
|
||||||
list.appendTag(link);
|
list.add(link);
|
||||||
}
|
}
|
||||||
if(!list.hasNoTags())
|
if(!list.isEmpty())
|
||||||
tag.setTag("Barycenters", list);
|
tag.setTagList("Barycenters", list);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
@ -709,40 +709,40 @@ public abstract class UniverseRegistry {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
NBTTagCompound dtag = dim.toNbt(true);
|
NBTTagCompound dtag = dim.toNbt(true);
|
||||||
if(ptag.getBoolean("ClearGenerator")) {
|
if(ptag.getBool("ClearGenerator")) {
|
||||||
ptag.removeTag("ClearGenerator");
|
ptag.remove("ClearGenerator");
|
||||||
dtag.removeTag("FloorBlock");
|
dtag.remove("FloorBlock");
|
||||||
dtag.removeTag("CeilingBlock");
|
dtag.remove("CeilingBlock");
|
||||||
dtag.removeTag("Layers");
|
dtag.remove("Layers");
|
||||||
dtag.removeTag("AddBiomes");
|
dtag.remove("AddBiomes");
|
||||||
dtag.removeTag("FrostBiomes");
|
dtag.remove("FrostBiomes");
|
||||||
dtag.removeTag("ColdBiomes");
|
dtag.remove("ColdBiomes");
|
||||||
dtag.removeTag("MediumBiomes");
|
dtag.remove("MediumBiomes");
|
||||||
dtag.removeTag("HotBiomes");
|
dtag.remove("HotBiomes");
|
||||||
dtag.removeTag("Ores");
|
dtag.remove("Ores");
|
||||||
dtag.removeTag("Lakes");
|
dtag.remove("Lakes");
|
||||||
dtag.removeTag("Liquids");
|
dtag.remove("Liquids");
|
||||||
dtag.setString("Generator", GeneratorType.FLAT.getName());
|
dtag.setString("Generator", GeneratorType.FLAT.getName());
|
||||||
dtag.setString("Replacer", ReplacerType.NONE.getName());
|
dtag.setString("Replacer", ReplacerType.NONE.getName());
|
||||||
// dtag.setBoolean("MobGen", false);
|
// dtag.setBoolean("MobGen", false);
|
||||||
// dtag.setBoolean("SnowGen", false);
|
// dtag.setBoolean("SnowGen", false);
|
||||||
dtag.setBoolean("Caves", false);
|
dtag.setBool("Caves", false);
|
||||||
dtag.setBoolean("Ravines", false);
|
dtag.setBool("Ravines", false);
|
||||||
dtag.setBoolean("AltCaves", false);
|
dtag.setBool("AltCaves", false);
|
||||||
dtag.setBoolean("Strongholds", false);
|
dtag.setBool("Strongholds", false);
|
||||||
dtag.setBoolean("Villages", false);
|
dtag.setBool("Villages", false);
|
||||||
dtag.setBoolean("Mineshafts", false);
|
dtag.setBool("Mineshafts", false);
|
||||||
dtag.setBoolean("Scattered", false);
|
dtag.setBool("Scattered", false);
|
||||||
dtag.setBoolean("Fortresses", false);
|
dtag.setBool("Fortresses", false);
|
||||||
dtag.setInteger("Dungeons", 0);
|
dtag.setInt("Dungeons", 0);
|
||||||
dtag.setInteger("BiomeSize", 0);
|
dtag.setInt("BiomeSize", 0);
|
||||||
dtag.setInteger("RiverSize", 4);
|
dtag.setInt("RiverSize", 4);
|
||||||
dtag.setInteger("SnowRarity", 6);
|
dtag.setInt("SnowRarity", 6);
|
||||||
dtag.setInteger("SeaRarity", 50);
|
dtag.setInt("SeaRarity", 50);
|
||||||
dtag.setInteger("AddRarity", 50);
|
dtag.setInt("AddRarity", 50);
|
||||||
dtag.setInteger("SeaLevel", 0);
|
dtag.setInt("SeaLevel", 0);
|
||||||
dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase());
|
dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase());
|
||||||
dtag.setBoolean("SemiFixed", false);
|
dtag.setBool("SemiFixed", false);
|
||||||
// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
||||||
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
||||||
dtag.setString("FillerBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
dtag.setString("FillerBlock", BlockRegistry.toIdName(Blocks.air.getState()));
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class ContainerRepair extends Container
|
||||||
|
|
||||||
if (repStack != null)
|
if (repStack != null)
|
||||||
{
|
{
|
||||||
isBook = repStack.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(repStack).tagCount() > 0;
|
isBook = repStack.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(repStack).size() > 0;
|
||||||
|
|
||||||
if (newStack.isItemStackDamageable() && newStack.getItem().getIsRepairable(stack, repStack))
|
if (newStack.isItemStackDamageable() && newStack.getItem().getIsRepairable(stack, repStack))
|
||||||
{
|
{
|
||||||
|
|
|
@ -224,21 +224,21 @@ public class InventoryMerchant implements IInventory
|
||||||
|
|
||||||
if (merchantrecipelist != null)
|
if (merchantrecipelist != null)
|
||||||
{
|
{
|
||||||
MerchantRecipe merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack, itemstack1, this.currentRecipeIndex);
|
MerchantRecipe merchantrecipe = merchantrecipelist.canUse(itemstack, itemstack1, this.currentRecipeIndex);
|
||||||
|
|
||||||
if (merchantrecipe != null) // && !merchantrecipe.isRecipeDisabled())
|
if (merchantrecipe != null) // && !merchantrecipe.isRecipeDisabled())
|
||||||
{
|
{
|
||||||
this.currentRecipe = merchantrecipe;
|
this.currentRecipe = merchantrecipe;
|
||||||
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
|
this.setInventorySlotContents(2, merchantrecipe.getSelling().copy());
|
||||||
}
|
}
|
||||||
else if (itemstack1 != null)
|
else if (itemstack1 != null)
|
||||||
{
|
{
|
||||||
merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack1, itemstack, this.currentRecipeIndex);
|
merchantrecipe = merchantrecipelist.canUse(itemstack1, itemstack, this.currentRecipeIndex);
|
||||||
|
|
||||||
if (merchantrecipe != null) // && !merchantrecipe.isRecipeDisabled())
|
if (merchantrecipe != null) // && !merchantrecipe.isRecipeDisabled())
|
||||||
{
|
{
|
||||||
this.currentRecipe = merchantrecipe;
|
this.currentRecipe = merchantrecipe;
|
||||||
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
|
this.setInventorySlotContents(2, merchantrecipe.getSelling().copy());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.item.Item;
|
||||||
import common.item.ItemArmor;
|
import common.item.ItemArmor;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
|
|
||||||
public class InventoryPlayer implements IInventory
|
public class InventoryPlayer implements IInventory
|
||||||
{
|
{
|
||||||
|
@ -450,7 +450,7 @@ public class InventoryPlayer implements IInventory
|
||||||
*
|
*
|
||||||
* @param nbtTagListIn List to append tags to
|
* @param nbtTagListIn List to append tags to
|
||||||
*/
|
*/
|
||||||
public NBTTagList writeToNBT(NBTTagList nbtTagListIn)
|
public NBTTagTagList writeToNBT(NBTTagTagList nbtTagListIn)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.mainInventory.length; ++i)
|
for (int i = 0; i < this.mainInventory.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +459,7 @@ public class InventoryPlayer implements IInventory
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.mainInventory[i].writeToNBT(nbttagcompound);
|
this.mainInventory[i].writeToNBT(nbttagcompound);
|
||||||
nbtTagListIn.appendTag(nbttagcompound);
|
nbtTagListIn.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ public class InventoryPlayer implements IInventory
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
nbttagcompound1.setByte("Slot", (byte)(j + 100));
|
nbttagcompound1.setByte("Slot", (byte)(j + 100));
|
||||||
this.armorInventory[j].writeToNBT(nbttagcompound1);
|
this.armorInventory[j].writeToNBT(nbttagcompound1);
|
||||||
nbtTagListIn.appendTag(nbttagcompound1);
|
nbtTagListIn.add(nbttagcompound1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,14 +482,14 @@ public class InventoryPlayer implements IInventory
|
||||||
*
|
*
|
||||||
* @param nbtTagListIn tagList to read from
|
* @param nbtTagListIn tagList to read from
|
||||||
*/
|
*/
|
||||||
public void readFromNBT(NBTTagList nbtTagListIn)
|
public void readFromNBT(NBTTagTagList nbtTagListIn)
|
||||||
{
|
{
|
||||||
this.mainInventory = new ItemStack[36];
|
this.mainInventory = new ItemStack[36];
|
||||||
this.armorInventory = new ItemStack[4];
|
this.armorInventory = new ItemStack[4];
|
||||||
|
|
||||||
for (int i = 0; i < nbtTagListIn.tagCount(); ++i)
|
for (int i = 0; i < nbtTagListIn.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbtTagListIn.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbtTagListIn.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
|
||||||
public class InventoryWarpChest extends InventoryBasic
|
public class InventoryWarpChest extends InventoryBasic
|
||||||
|
@ -21,16 +21,16 @@ public class InventoryWarpChest extends InventoryBasic
|
||||||
this.associatedChest = chestTileEntity;
|
this.associatedChest = chestTileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadInventoryFromNBT(NBTTagList p_70486_1_)
|
public void loadInventoryFromNBT(NBTTagTagList p_70486_1_)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.getSizeInventory(); ++i)
|
for (int i = 0; i < this.getSizeInventory(); ++i)
|
||||||
{
|
{
|
||||||
this.setInventorySlotContents(i, (ItemStack)null);
|
this.setInventorySlotContents(i, (ItemStack)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 0; k < p_70486_1_.tagCount(); ++k)
|
for (int k = 0; k < p_70486_1_.size(); ++k)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = p_70486_1_.getCompoundTagAt(k);
|
NBTTagCompound nbttagcompound = p_70486_1_.getTag(k);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 0 && j < this.getSizeInventory())
|
if (j >= 0 && j < this.getSizeInventory())
|
||||||
|
@ -40,9 +40,9 @@ public class InventoryWarpChest extends InventoryBasic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagList saveInventoryToNBT()
|
public NBTTagTagList saveInventoryToNBT()
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.getSizeInventory(); ++i)
|
for (int i = 0; i < this.getSizeInventory(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ public class InventoryWarpChest extends InventoryBasic
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
itemstack.writeToNBT(nbttagcompound);
|
itemstack.writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ public class SlotMerchantResult extends Slot
|
||||||
|
|
||||||
private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem)
|
private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = trade.getItemToBuy();
|
ItemStack itemstack = trade.getBuying();
|
||||||
ItemStack itemstack1 = trade.getSecondItemToBuy();
|
ItemStack itemstack1 = trade.getSecondBuy();
|
||||||
|
|
||||||
if (firstItem != null && firstItem.getItem() == itemstack.getItem())
|
if (firstItem != null && firstItem.getItem() == itemstack.getItem())
|
||||||
{
|
{
|
||||||
|
|
|
@ -470,14 +470,14 @@ public class Item
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//// if(tag.hasKey("display")) {
|
//// if(tag.hasKey("display")) {
|
||||||
//// if(!tag.hasKey("display", 10)) {
|
//// if(!tag.hasTag("display")) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
//// NBTTagCompound display = tag.getCompoundTag("display");
|
//// NBTTagCompound display = tag.getCompoundTag("display");
|
||||||
//// keys = display.getKeySet();
|
//// keys = display.getKeySet();
|
||||||
//// z = keys.size();
|
//// z = keys.size();
|
||||||
// if(tag.hasKey("Name")) {
|
// if(tag.hasKey("Name")) {
|
||||||
// if(!tag.hasKey("Name", 8)) {
|
// if(!tag.hasString("Name")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// if(tag.getString("Name").length() > 64) {
|
// if(tag.getString("Name").length() > 64) {
|
||||||
|
@ -497,7 +497,7 @@ public class Item
|
||||||
//// }
|
//// }
|
||||||
//// }
|
//// }
|
||||||
//// else {
|
//// else {
|
||||||
//// if(!display.hasKey("Lore", 9)) {
|
//// if(!display.hasList("Lore")) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
//// NBTTagList lore = display.getTagList("Lore", 8);
|
//// NBTTagList lore = display.getTagList("Lore", 8);
|
||||||
|
@ -508,7 +508,7 @@ public class Item
|
||||||
//// z--;
|
//// z--;
|
||||||
//// }
|
//// }
|
||||||
//// if(display.hasKey("color")) {
|
//// if(display.hasKey("color")) {
|
||||||
//// if(!display.hasKey("color", 3)) {
|
//// if(!display.hasInt("color")) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
//// if(!this.canBeDyed()) {
|
//// if(!this.canBeDyed()) {
|
||||||
|
@ -521,7 +521,7 @@ public class Item
|
||||||
//// }
|
//// }
|
||||||
//// }
|
//// }
|
||||||
// if(tag.hasKey("RepairCost")) {
|
// if(tag.hasKey("RepairCost")) {
|
||||||
// if(!tag.hasKey("RepairCost", 3)) {
|
// if(!tag.hasInt("RepairCost")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// if(tag.getInteger("RepairCost") < 1) {
|
// if(tag.getInteger("RepairCost") < 1) {
|
||||||
|
@ -529,7 +529,7 @@ public class Item
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if(tag.hasKey("ench")) {
|
// if(tag.hasKey("ench")) {
|
||||||
// if(!tag.hasKey("ench", 9)) {
|
// if(!tag.hasList("ench")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// NBTTagList ench = tag.getTagList("ench", 10);
|
// NBTTagList ench = tag.getTagList("ench", 10);
|
||||||
|
@ -542,7 +542,7 @@ public class Item
|
||||||
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
||||||
// for(int e = 0; e < ench.tagCount(); e++) {
|
// for(int e = 0; e < ench.tagCount(); e++) {
|
||||||
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
||||||
// if(ec.getKeySet().size() != 2 || !ec.hasKey("id", 2) || !ec.hasKey("lvl", 2)) {
|
// if(ec.getKeySet().size() != 2 || !ec.hasShort("id") || !ec.hasShort("lvl")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// int id = ec.getShort("id");
|
// int id = ec.getShort("id");
|
||||||
|
@ -569,12 +569,12 @@ public class Item
|
||||||
// }
|
// }
|
||||||
//// if(adv) {
|
//// if(adv) {
|
||||||
//// if(tag.hasKey("Unbreakable")) {
|
//// if(tag.hasKey("Unbreakable")) {
|
||||||
//// if(!tag.hasKey("Unbreakable", 1)) {
|
//// if(!tag.hasBoolean("Unbreakable")) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
//// }
|
//// }
|
||||||
//// if(tag.hasKey("HideFlags")) {
|
//// if(tag.hasKey("HideFlags")) {
|
||||||
//// if(!tag.hasKey("HideFlags", 3)) {
|
//// if(!tag.hasInt("HideFlags")) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
//// }
|
//// }
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class ItemArmor extends Item
|
||||||
*/
|
*/
|
||||||
public boolean hasColor(ItemStack stack)
|
public boolean hasColor(ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.material.canBeDyed() && stack.hasTagCompound() && stack.getTagCompound().hasKey("color", 3);
|
return this.material.canBeDyed() && stack.hasTagCompound() && stack.getTagCompound().hasInt("color");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,13 +160,13 @@ public class ItemArmor extends Item
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound();
|
NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||||
|
|
||||||
if (nbttagcompound != null && nbttagcompound.hasKey("color", 3))
|
if (nbttagcompound != null && nbttagcompound.hasInt("color"))
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
||||||
//
|
//
|
||||||
// if (nbttagcompound1 != null && nbttagcompound1.hasKey("color", 3))
|
// if (nbttagcompound1 != null && nbttagcompound1.hasInt("color"))
|
||||||
// {
|
// {
|
||||||
return nbttagcompound.getInteger("color");
|
return nbttagcompound.getInt("color");
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,10 +187,10 @@ public class ItemArmor extends Item
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
||||||
|
|
||||||
if (nbttagcompound.hasKey("color"))
|
if (nbttagcompound.hasInt("color"))
|
||||||
{
|
{
|
||||||
nbttagcompound.removeTag("color");
|
nbttagcompound.remove("color");
|
||||||
if(nbttagcompound.hasNoTags())
|
if(nbttagcompound.isEmpty())
|
||||||
stack.setTagCompound(null);
|
stack.setTagCompound(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,12 +218,12 @@ public class ItemArmor extends Item
|
||||||
|
|
||||||
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
|
||||||
//
|
//
|
||||||
// if (!nbttagcompound.hasKey("display", 10))
|
// if (!nbttagcompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// nbttagcompound.setTag("display", nbttagcompound1);
|
// nbttagcompound.setTag("display", nbttagcompound1);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
nbttagcompound.setInteger("color", color);
|
nbttagcompound.setInt("color", color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +289,8 @@ public class ItemArmor extends Item
|
||||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
||||||
if(this.material.canBeDyed()) {
|
if(this.material.canBeDyed()) {
|
||||||
int color = this.material.getDefaultColor();
|
int color = this.material.getDefaultColor();
|
||||||
if(stack.hasTagCompound() && stack.getTagCompound().hasKey("color", 3))
|
if(stack.hasTagCompound() && stack.getTagCompound().hasInt("color"))
|
||||||
color = stack.getTagCompound().getInteger("color");
|
color = stack.getTagCompound().getInt("color");
|
||||||
tooltip.add("Farbe: #" + Integer.toHexString(color).toUpperCase());
|
tooltip.add("Farbe: #" + Integer.toHexString(color).toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.model.ItemMeshDefinition;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.tileentity.TileEntityBanner;
|
import common.tileentity.TileEntityBanner;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -98,14 +98,14 @@ public class ItemBanner extends ItemBlock
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
||||||
|
|
||||||
if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
|
if (nbttagcompound != null && nbttagcompound.hasTagList("Patterns"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);
|
NBTTagTagList nbttaglist = nbttagcompound.getTagList("Patterns");
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
|
for (int i = 0; i < nbttaglist.size() && i < 6; ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound1 = nbttaglist.getTag(i);
|
||||||
DyeColor enumdyecolor = DyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
|
DyeColor enumdyecolor = DyeColor.byDyeDamage(nbttagcompound1.getInt("Color"));
|
||||||
TileEntityBanner.EnumBannerPattern pattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));
|
TileEntityBanner.EnumBannerPattern pattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));
|
||||||
|
|
||||||
if (pattern != null)
|
if (pattern != null)
|
||||||
|
@ -138,7 +138,7 @@ public class ItemBanner extends ItemBlock
|
||||||
for (DyeColor enumdyecolor : DyeColor.values())
|
for (DyeColor enumdyecolor : DyeColor.values())
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), (NBTTagList)null);
|
TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null);
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
nbttagcompound1.setTag("BlockEntityTag", nbttagcompound);
|
nbttagcompound1.setTag("BlockEntityTag", nbttagcompound);
|
||||||
ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage());
|
ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage());
|
||||||
|
@ -160,9 +160,9 @@ public class ItemBanner extends ItemBlock
|
||||||
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
||||||
DyeColor enumdyecolor = null;
|
DyeColor enumdyecolor = null;
|
||||||
|
|
||||||
if (nbttagcompound != null && nbttagcompound.hasKey("Base"))
|
if (nbttagcompound != null && nbttagcompound.hasInt("Base"))
|
||||||
{
|
{
|
||||||
enumdyecolor = DyeColor.byDyeDamage(nbttagcompound.getInteger("Base"));
|
enumdyecolor = DyeColor.byDyeDamage(nbttagcompound.getInt("Base"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -174,12 +174,12 @@ public class ItemBanner extends ItemBlock
|
||||||
|
|
||||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||||
// if(tag.hasKey("BlockEntityTag")) {
|
// if(tag.hasKey("BlockEntityTag")) {
|
||||||
// if(!tag.hasKey("BlockEntityTag", 10)) {
|
// if(!tag.hasTag("BlockEntityTag")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// NBTTagCompound etag = tag.getCompoundTag("BlockEntityTag");
|
// NBTTagCompound etag = tag.getCompoundTag("BlockEntityTag");
|
||||||
// if(etag.hasKey("Patterns")) {
|
// if(etag.hasKey("Patterns")) {
|
||||||
// if(!etag.hasKey("Patterns", 9)) {
|
// if(!etag.hasList("Patterns")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// NBTTagList patterns = etag.getTagList("Patterns", 10);
|
// NBTTagList patterns = etag.getTagList("Patterns", 10);
|
||||||
|
@ -192,7 +192,7 @@ public class ItemBanner extends ItemBlock
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if(etag.hasKey("Base")) {
|
// if(etag.hasKey("Base")) {
|
||||||
// if(!etag.hasKey("Base", 3)) {
|
// if(!etag.hasInt("Base")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class ItemBlock extends Item
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
if (p_179224_3_.hasTagCompound() && p_179224_3_.getTagCompound().hasKey("BlockEntityTag", 10))
|
if (p_179224_3_.hasTagCompound() && p_179224_3_.getTagCompound().hasTag("BlockEntityTag"))
|
||||||
{
|
{
|
||||||
TileEntity tileentity = worldIn.getTileEntity(stack);
|
TileEntity tileentity = worldIn.getTileEntity(stack);
|
||||||
|
|
||||||
|
@ -121,11 +121,11 @@ public class ItemBlock extends Item
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy();
|
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy();
|
||||||
tileentity.writeToNBT(nbttagcompound);
|
tileentity.writeToNBT(nbttagcompound);
|
||||||
NBTTagCompound nbttagcompound2 = (NBTTagCompound)p_179224_3_.getTagCompound().getTag("BlockEntityTag");
|
NBTTagCompound nbttagcompound2 = (NBTTagCompound)p_179224_3_.getTagCompound().get("BlockEntityTag");
|
||||||
nbttagcompound.merge(nbttagcompound2);
|
nbttagcompound.merge(nbttagcompound2);
|
||||||
nbttagcompound.setInteger("x", stack.getX());
|
nbttagcompound.setInt("x", stack.getX());
|
||||||
nbttagcompound.setInteger("y", stack.getY());
|
nbttagcompound.setInt("y", stack.getY());
|
||||||
nbttagcompound.setInteger("z", stack.getZ());
|
nbttagcompound.setInt("z", stack.getZ());
|
||||||
|
|
||||||
if (!nbttagcompound.equals(nbttagcompound1))
|
if (!nbttagcompound.equals(nbttagcompound1))
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ public class ItemBlock extends Item
|
||||||
//
|
//
|
||||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||||
// if(tag.hasKey("BlockEntityTag")) {
|
// if(tag.hasKey("BlockEntityTag")) {
|
||||||
// if(!tag.hasKey("BlockEntityTag", 10)) {
|
// if(!tag.hasTag("BlockEntityTag")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.model.ItemMeshDefinition;
|
import common.model.ItemMeshDefinition;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
|
|
||||||
public class ItemEnchantedBook extends Item
|
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);
|
// return this.getEnchantments(stack).tagCount() > 0 ? ChatFormat.YELLOW : super.getColor(stack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public NBTTagList getEnchantments(ItemStack stack)
|
public NBTTagTagList getEnchantments(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound();
|
NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||||
return nbttagcompound != null && nbttagcompound.hasKey("StoredEnchantments", 9) ? (NBTTagList)nbttagcompound.getTag("StoredEnchantments") : new NBTTagList();
|
return nbttagcompound != null && nbttagcompound.hasTagList("StoredEnchantments") ? nbttagcompound.getTagList("StoredEnchantments") : new NBTTagTagList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,14 +60,14 @@ public class ItemEnchantedBook extends Item
|
||||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||||
{
|
{
|
||||||
super.addInformation(stack, playerIn, tooltip);
|
super.addInformation(stack, playerIn, tooltip);
|
||||||
NBTTagList nbttaglist = this.getEnchantments(stack);
|
NBTTagTagList nbttaglist = this.getEnchantments(stack);
|
||||||
|
|
||||||
if (nbttaglist != null)
|
if (nbttaglist != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
int j = nbttaglist.getCompoundTagAt(i).getShort("id");
|
int j = nbttaglist.getTag(i).getShort("id");
|
||||||
int k = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
int k = nbttaglist.getTag(i).getShort("lvl");
|
||||||
|
|
||||||
if (Enchantment.getEnchantmentById(j) != null)
|
if (Enchantment.getEnchantmentById(j) != null)
|
||||||
{
|
{
|
||||||
|
@ -82,12 +82,12 @@ public class ItemEnchantedBook extends Item
|
||||||
*/
|
*/
|
||||||
public void addEnchantment(ItemStack stack, RngEnchantment enchantment)
|
public void addEnchantment(ItemStack stack, RngEnchantment enchantment)
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = this.getEnchantments(stack);
|
NBTTagTagList nbttaglist = this.getEnchantments(stack);
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
|
|
||||||
if (nbttagcompound.getShort("id") == enchantment.enchantmentobj.effectId)
|
if (nbttagcompound.getShort("id") == enchantment.enchantmentobj.effectId)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ public class ItemEnchantedBook extends Item
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
nbttagcompound1.setShort("id", (short)enchantment.enchantmentobj.effectId);
|
nbttagcompound1.setShort("id", (short)enchantment.enchantmentobj.effectId);
|
||||||
nbttagcompound1.setShort("lvl", (short)enchantment.enchantmentLevel);
|
nbttagcompound1.setShort("lvl", (short)enchantment.enchantmentLevel);
|
||||||
nbttaglist.appendTag(nbttagcompound1);
|
nbttaglist.add(nbttagcompound1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stack.hasTagCompound())
|
if (!stack.hasTagCompound())
|
||||||
|
@ -114,7 +114,7 @@ public class ItemEnchantedBook extends Item
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.getTagCompound().setTag("StoredEnchantments", nbttaglist);
|
stack.getTagCompound().setTagList("StoredEnchantments", nbttaglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +153,7 @@ public class ItemEnchantedBook extends Item
|
||||||
//
|
//
|
||||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||||
// if(tag.hasKey("StoredEnchantments")) {
|
// if(tag.hasKey("StoredEnchantments")) {
|
||||||
// if(!tag.hasKey("StoredEnchantments", 9)) {
|
// if(!tag.hasList("StoredEnchantments")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// NBTTagList ench = tag.getTagList("StoredEnchantments", 10);
|
// NBTTagList ench = tag.getTagList("StoredEnchantments", 10);
|
||||||
|
@ -166,7 +166,7 @@ public class ItemEnchantedBook extends Item
|
||||||
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
||||||
// for(int e = 0; e < ench.tagCount(); e++) {
|
// for(int e = 0; e < ench.tagCount(); e++) {
|
||||||
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
||||||
// if(ec.getKeySet().size() != 2 || !ec.hasKey("id", 2) || !ec.hasKey("lvl", 2)) {
|
// if(ec.getKeySet().size() != 2 || !ec.hasShort("id") || !ec.hasShort("lvl")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// int id = ec.getShort("id");
|
// int id = ec.getShort("id");
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.collect.Lists;
|
||||||
import common.entity.item.EntityFireworks;
|
import common.entity.item.EntityFireworks;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -43,22 +43,22 @@ public class ItemFirework extends Item
|
||||||
{
|
{
|
||||||
if (stack.hasTagCompound())
|
if (stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Fireworks");
|
NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Fireworks");
|
||||||
|
|
||||||
if (nbttagcompound != null)
|
if (nbttagcompound != null)
|
||||||
{
|
{
|
||||||
if (nbttagcompound.hasKey("Flight", 99))
|
if (nbttagcompound.hasByte("Flight"))
|
||||||
{
|
{
|
||||||
tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight"));
|
tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight"));
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);
|
NBTTagTagList nbttaglist = nbttagcompound.getTagList("Explosions");
|
||||||
|
|
||||||
if (nbttaglist != null && nbttaglist.tagCount() > 0)
|
if (nbttaglist != null && nbttaglist.size() > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound1 = nbttaglist.getTag(i);
|
||||||
List<String> list = Lists.<String>newArrayList();
|
List<String> list = Lists.<String>newArrayList();
|
||||||
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
|
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,7 @@ import common.color.DyeColor;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.nbt.NBTBase;
|
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagIntArray;
|
|
||||||
|
|
||||||
public class ItemFireworkCharge extends Item
|
public class ItemFireworkCharge extends Item
|
||||||
{
|
{
|
||||||
|
@ -22,58 +20,44 @@ public class ItemFireworkCharge extends Item
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NBTBase nbtbase = getExplosionTag(stack, "Colors");
|
if (stack.hasTagCompound())
|
||||||
|
|
||||||
if (!(nbtbase instanceof NBTTagIntArray))
|
|
||||||
{
|
{
|
||||||
return 9079434;
|
NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Explosion");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NBTTagIntArray nbttagintarray = (NBTTagIntArray)nbtbase;
|
|
||||||
int[] aint = nbttagintarray.getIntArray();
|
|
||||||
|
|
||||||
if (aint.length == 1)
|
if (nbttagcompound != null)
|
||||||
{
|
{
|
||||||
return aint[0];
|
if(nbttagcompound.hasIntArray("Colors")) {
|
||||||
}
|
int[] aint = nbttagcompound.getIntArray("Colors");
|
||||||
else
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int j = 0;
|
|
||||||
int k = 0;
|
|
||||||
|
|
||||||
for (int l : aint)
|
if (aint.length == 1)
|
||||||
{
|
{
|
||||||
i += (l & 16711680) >> 16;
|
return aint[0];
|
||||||
j += (l & 65280) >> 8;
|
}
|
||||||
k += (l & 255) >> 0;
|
else
|
||||||
}
|
{
|
||||||
|
int i = 0;
|
||||||
|
int j = 0;
|
||||||
|
int k = 0;
|
||||||
|
|
||||||
i = i / aint.length;
|
for (int l : aint)
|
||||||
j = j / aint.length;
|
{
|
||||||
k = k / aint.length;
|
i += (l & 16711680) >> 16;
|
||||||
return i << 16 | j << 8 | k;
|
j += (l & 65280) >> 8;
|
||||||
|
k += (l & 255) >> 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = i / aint.length;
|
||||||
|
j = j / aint.length;
|
||||||
|
k = k / aint.length;
|
||||||
|
return i << 16 | j << 8 | k;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 9079434;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NBTBase getExplosionTag(ItemStack stack, String key)
|
|
||||||
{
|
|
||||||
if (stack.hasTagCompound())
|
|
||||||
{
|
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Explosion");
|
|
||||||
|
|
||||||
if (nbttagcompound != null)
|
|
||||||
{
|
|
||||||
return nbttagcompound.getTag(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* allows items to add custom lines of information to the mouseover description
|
* allows items to add custom lines of information to the mouseover description
|
||||||
*/
|
*/
|
||||||
|
@ -81,7 +65,7 @@ public class ItemFireworkCharge extends Item
|
||||||
{
|
{
|
||||||
if (stack.hasTagCompound())
|
if (stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Explosion");
|
NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("Explosion");
|
||||||
|
|
||||||
if (nbttagcompound != null)
|
if (nbttagcompound != null)
|
||||||
{
|
{
|
||||||
|
@ -175,14 +159,14 @@ public class ItemFireworkCharge extends Item
|
||||||
tooltip.add(s1);
|
tooltip.add(s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean flag3 = nbt.getBoolean("Trail");
|
boolean flag3 = nbt.getBool("Trail");
|
||||||
|
|
||||||
if (flag3)
|
if (flag3)
|
||||||
{
|
{
|
||||||
tooltip.add("Schweif");
|
tooltip.add("Schweif");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean flag4 = nbt.getBoolean("Flicker");
|
boolean flag4 = nbt.getBool("Flicker");
|
||||||
|
|
||||||
if (flag4)
|
if (flag4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ItemPotion extends Item
|
||||||
|
|
||||||
public List<PotionEffect> getEffects(ItemStack stack)
|
public List<PotionEffect> getEffects(ItemStack stack)
|
||||||
{
|
{
|
||||||
// if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
|
// if (stack.hasTagCompound() && stack.getTagCompound().hasList("CustomPotionEffects"))
|
||||||
// {
|
// {
|
||||||
// List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
|
// List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
|
||||||
// NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
|
// NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
|
||||||
|
@ -414,7 +414,7 @@ public class ItemPotion extends Item
|
||||||
// if(!adv) {
|
// if(!adv) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// if(!tag.hasKey("CustomPotionEffects", 9)) {
|
// if(!tag.hasList("CustomPotionEffects")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// NBTTagList effects = tag.getTagList("CustomPotionEffects", 10);
|
// NBTTagList effects = tag.getTagList("CustomPotionEffects", 10);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class ItemSign extends Item
|
||||||
//
|
//
|
||||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||||
// if(tag.hasKey("BlockEntityTag")) {
|
// if(tag.hasKey("BlockEntityTag")) {
|
||||||
// if(!tag.hasKey("BlockEntityTag", 10)) {
|
// if(!tag.hasTag("BlockEntityTag")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ItemSkull extends Item
|
||||||
// {
|
// {
|
||||||
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||||
//
|
//
|
||||||
// if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
|
// if (nbttagcompound.hasString("SkullOwner") && nbttagcompound.getString("SkullOwner").length() > 0)
|
||||||
// {
|
// {
|
||||||
// user = nbttagcompound.getString("SkullOwner");
|
// user = nbttagcompound.getString("SkullOwner");
|
||||||
// }
|
// }
|
||||||
|
@ -153,7 +153,7 @@ public class ItemSkull extends Item
|
||||||
// {
|
// {
|
||||||
// if (stack.hasTagCompound())
|
// if (stack.hasTagCompound())
|
||||||
// {
|
// {
|
||||||
// if (stack.getTagCompound().hasKey("SkullOwner", 8))
|
// if (stack.getTagCompound().hasString("SkullOwner"))
|
||||||
// {
|
// {
|
||||||
// return super.getDisplay(stack) + " von " + stack.getTagCompound().getString("SkullOwner");
|
// return super.getDisplay(stack) + " von " + stack.getTagCompound().getString("SkullOwner");
|
||||||
// }
|
// }
|
||||||
|
@ -171,7 +171,7 @@ public class ItemSkull extends Item
|
||||||
//// if(!adv) {
|
//// if(!adv) {
|
||||||
//// return false;
|
//// return false;
|
||||||
//// }
|
//// }
|
||||||
// if(!tag.hasKey("SkullOwner", 8)) {
|
// if(!tag.hasString("SkullOwner")) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -21,7 +21,7 @@ import common.init.BlockRegistry;
|
||||||
import common.init.ItemRegistry;
|
import common.init.ItemRegistry;
|
||||||
import common.nbt.NBTBase;
|
import common.nbt.NBTBase;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -198,7 +198,7 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
String resourcelocation = ItemRegistry.REGISTRY.getNameForObject(this.item);
|
String resourcelocation = ItemRegistry.REGISTRY.getNameForObject(this.item);
|
||||||
nbt.setString("id", resourcelocation == null ? "air" : resourcelocation.toString());
|
nbt.setString("id", resourcelocation == null ? "air" : resourcelocation.toString());
|
||||||
nbt.setInteger("Count", this.stackSize);
|
nbt.setInt("Count", this.stackSize);
|
||||||
nbt.setShort("Damage", (short)this.itemDamage);
|
nbt.setShort("Damage", (short)this.itemDamage);
|
||||||
|
|
||||||
if (this.stackTagCompound != null)
|
if (this.stackTagCompound != null)
|
||||||
|
@ -214,7 +214,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
if (nbt.hasKey("id", 8))
|
if (nbt.hasString("id"))
|
||||||
{
|
{
|
||||||
this.item = ItemRegistry.getRegisteredItem(nbt.getString("id"));
|
this.item = ItemRegistry.getRegisteredItem(nbt.getString("id"));
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ public final class ItemStack
|
||||||
this.item = ItemRegistry.getItemById(nbt.getShort("id"));
|
this.item = ItemRegistry.getItemById(nbt.getShort("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stackSize = nbt.getInteger("Count");
|
this.stackSize = nbt.getInt("Count");
|
||||||
this.itemDamage = nbt.getShort("Damage");
|
this.itemDamage = nbt.getShort("Damage");
|
||||||
|
|
||||||
if (this.itemDamage < 0)
|
if (this.itemDamage < 0)
|
||||||
|
@ -231,9 +231,9 @@ public final class ItemStack
|
||||||
this.itemDamage = 0;
|
this.itemDamage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.hasKey("tag", 10))
|
if (nbt.hasTag("tag"))
|
||||||
{
|
{
|
||||||
this.stackTagCompound = nbt.getCompoundTag("tag");
|
this.stackTagCompound = nbt.getTag("tag");
|
||||||
|
|
||||||
if (this.item != null)
|
if (this.item != null)
|
||||||
{
|
{
|
||||||
|
@ -581,9 +581,9 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public NBTTagCompound getSubCompound(String key, boolean create)
|
public NBTTagCompound getSubCompound(String key, boolean create)
|
||||||
{
|
{
|
||||||
if (this.stackTagCompound != null && this.stackTagCompound.hasKey(key, 10))
|
if (this.stackTagCompound != null && this.stackTagCompound.hasTag(key))
|
||||||
{
|
{
|
||||||
return this.stackTagCompound.getCompoundTag(key);
|
return this.stackTagCompound.getTag(key);
|
||||||
}
|
}
|
||||||
else if (create)
|
else if (create)
|
||||||
{
|
{
|
||||||
|
@ -597,9 +597,9 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagList getEnchantmentTagList()
|
public NBTTagTagList getEnchantmentTagList()
|
||||||
{
|
{
|
||||||
return this.stackTagCompound == null ? null : this.stackTagCompound.getTagList("ench", 10);
|
return this.stackTagCompound == null ? null : this.stackTagCompound.getTagList("ench");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -617,11 +617,11 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
String s = this.getItem().getDisplay(this);
|
String s = this.getItem().getDisplay(this);
|
||||||
|
|
||||||
if (this.stackTagCompound != null && this.stackTagCompound.hasKey("Name", 8))
|
if (this.stackTagCompound != null && this.stackTagCompound.hasString("Name"))
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
||||||
//
|
//
|
||||||
// if (nbttagcompound.hasKey("Name", 8))
|
// if (nbttagcompound.hasString("Name"))
|
||||||
// {
|
// {
|
||||||
s = this.stackTagCompound.getString("Name");
|
s = this.stackTagCompound.getString("Name");
|
||||||
// }
|
// }
|
||||||
|
@ -645,7 +645,7 @@ public final class ItemStack
|
||||||
this.stackTagCompound = new NBTTagCompound();
|
this.stackTagCompound = new NBTTagCompound();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!this.stackTagCompound.hasKey("display", 10))
|
// if (!this.stackTagCompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
||||||
// }
|
// }
|
||||||
|
@ -661,7 +661,7 @@ public final class ItemStack
|
||||||
// this.stackTagCompound = new NBTTagCompound();
|
// this.stackTagCompound = new NBTTagCompound();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (!this.stackTagCompound.hasKey("display", 10))
|
// if (!this.stackTagCompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
||||||
// }
|
// }
|
||||||
|
@ -681,7 +681,7 @@ public final class ItemStack
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (!this.stackTagCompound.hasKey("display", 10))
|
// if (!this.stackTagCompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
@ -727,12 +727,12 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
if (this.stackTagCompound != null)
|
if (this.stackTagCompound != null)
|
||||||
{
|
{
|
||||||
if (this.stackTagCompound.hasKey("Name", 8))
|
if (this.stackTagCompound.hasString("Name"))
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
||||||
this.stackTagCompound.removeTag("Name");
|
this.stackTagCompound.remove("Name");
|
||||||
|
|
||||||
if (this.stackTagCompound.hasNoTags())
|
if (this.stackTagCompound.isEmpty())
|
||||||
{
|
{
|
||||||
// this.stackTagCompound.removeTag("display");
|
// this.stackTagCompound.removeTag("display");
|
||||||
//
|
//
|
||||||
|
@ -749,7 +749,7 @@ public final class ItemStack
|
||||||
// {
|
// {
|
||||||
// if (this.stackTagCompound != null)
|
// if (this.stackTagCompound != null)
|
||||||
// {
|
// {
|
||||||
// if (this.stackTagCompound.hasKey("display", 10))
|
// if (this.stackTagCompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
||||||
// nbttagcompound.removeTag("Lore");
|
// nbttagcompound.removeTag("Lore");
|
||||||
|
@ -772,7 +772,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public boolean hasDisplayName()
|
public boolean hasDisplayName()
|
||||||
{
|
{
|
||||||
return this.stackTagCompound != null && this.stackTagCompound.hasKey("Name", 8);
|
return this.stackTagCompound != null && this.stackTagCompound.hasString("Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getTooltip(EntityNPC playerIn)
|
public List<String> getTooltip(EntityNPC playerIn)
|
||||||
|
@ -842,14 +842,14 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
// if ((i1 & 1) == 0)
|
// if ((i1 & 1) == 0)
|
||||||
// {
|
// {
|
||||||
NBTTagList nbttaglist = this.getEnchantmentTagList();
|
NBTTagTagList nbttaglist = this.getEnchantmentTagList();
|
||||||
|
|
||||||
if (nbttaglist != null)
|
if (nbttaglist != null)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nbttaglist.tagCount(); ++j)
|
for (int j = 0; j < nbttaglist.size(); ++j)
|
||||||
{
|
{
|
||||||
int k = nbttaglist.getCompoundTagAt(j).getShort("id");
|
int k = nbttaglist.getTag(j).getShort("id");
|
||||||
int l = nbttaglist.getCompoundTagAt(j).getShort("lvl");
|
int l = nbttaglist.getTag(j).getShort("lvl");
|
||||||
|
|
||||||
if (Enchantment.getEnchantmentById(k) != null)
|
if (Enchantment.getEnchantmentById(k) != null)
|
||||||
{
|
{
|
||||||
|
@ -859,11 +859,11 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (this.stackTagCompound.hasKey("display", 10))
|
// if (this.stackTagCompound.hasTag("display"))
|
||||||
// {
|
// {
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
||||||
//
|
//
|
||||||
// if (nbttagcompound.hasKey("color", 3))
|
// if (nbttagcompound.hasInt("color"))
|
||||||
// {
|
// {
|
||||||
// if (advanced)
|
// if (advanced)
|
||||||
// {
|
// {
|
||||||
|
@ -934,12 +934,12 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasTagCompound() && this.getTagCompound().getBoolean("Unbreakable")) // && (i1 & 4) == 0)
|
if (this.hasTagCompound() && this.getTagCompound().getBool("Unbreakable")) // && (i1 & 4) == 0)
|
||||||
{
|
{
|
||||||
list.add(TextColor.BLUE + "Unzerstörbar");
|
list.add(TextColor.BLUE + "Unzerstörbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9) && (i1 & 8) == 0)
|
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy") && (i1 & 8) == 0)
|
||||||
// {
|
// {
|
||||||
// NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanDestroy", 8);
|
// NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanDestroy", 8);
|
||||||
//
|
//
|
||||||
|
@ -964,7 +964,7 @@ public final class ItemStack
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9) && (i1 & 16) == 0)
|
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn") && (i1 & 16) == 0)
|
||||||
// {
|
// {
|
||||||
// NBTTagList nbttaglist3 = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
// NBTTagList nbttaglist3 = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
||||||
//
|
//
|
||||||
|
@ -1036,16 +1036,16 @@ public final class ItemStack
|
||||||
this.setTagCompound(new NBTTagCompound());
|
this.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.stackTagCompound.hasKey("ench", 9))
|
if (!this.stackTagCompound.hasTagList("ench"))
|
||||||
{
|
{
|
||||||
this.stackTagCompound.setTag("ench", new NBTTagList());
|
this.stackTagCompound.setTagList("ench", new NBTTagTagList());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList nbttaglist = this.stackTagCompound.getTagList("ench", 10);
|
NBTTagTagList nbttaglist = this.stackTagCompound.getTagList("ench");
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setShort("id", (short)ench.effectId);
|
nbttagcompound.setShort("id", (short)ench.effectId);
|
||||||
nbttagcompound.setShort("lvl", (short)(/* (byte) */ level));
|
nbttagcompound.setShort("lvl", (short)(/* (byte) */ level));
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1055,17 +1055,17 @@ public final class ItemStack
|
||||||
if(this.stackTagCompound == null) {
|
if(this.stackTagCompound == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!this.stackTagCompound.hasKey("ench", 9)) {
|
if(!this.stackTagCompound.hasTagList("ench")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NBTTagList oldEnch = this.stackTagCompound.getTagList("ench", 10);
|
NBTTagTagList oldEnch = this.stackTagCompound.getTagList("ench");
|
||||||
NBTTagList newEnch = new NBTTagList();
|
NBTTagTagList newEnch = new NBTTagTagList();
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
NBTTagCompound tag;
|
NBTTagCompound tag;
|
||||||
for(int z = 0; z < oldEnch.tagCount(); z++) {
|
for(int z = 0; z < oldEnch.size(); z++) {
|
||||||
tag = oldEnch.getCompoundTagAt(z);
|
tag = oldEnch.getTag(z);
|
||||||
if(tag.getShort("id") != ench.effectId) {
|
if(tag.getShort("id") != ench.effectId) {
|
||||||
newEnch.appendTag(tag);
|
newEnch.add(tag);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -1074,14 +1074,14 @@ public final class ItemStack
|
||||||
if(!changed) {
|
if(!changed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(newEnch.tagCount() == 0) {
|
if(newEnch.size() == 0) {
|
||||||
this.stackTagCompound.removeTag("ench");
|
this.stackTagCompound.remove("ench");
|
||||||
if(this.stackTagCompound.hasNoTags()) {
|
if(this.stackTagCompound.isEmpty()) {
|
||||||
this.stackTagCompound = null;
|
this.stackTagCompound = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.stackTagCompound.setTag("ench", newEnch);
|
this.stackTagCompound.setTagList("ench", newEnch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1093,11 +1093,11 @@ public final class ItemStack
|
||||||
if(this.stackTagCompound == null) {
|
if(this.stackTagCompound == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!this.stackTagCompound.hasKey("ench", 9)) {
|
if(!this.stackTagCompound.hasTagList("ench")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.stackTagCompound.removeTag("ench");
|
this.stackTagCompound.remove("ench");
|
||||||
if(this.stackTagCompound.hasNoTags()) {
|
if(this.stackTagCompound.isEmpty()) {
|
||||||
this.stackTagCompound = null;
|
this.stackTagCompound = null;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1108,7 +1108,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public boolean isItemEnchanted()
|
public boolean isItemEnchanted()
|
||||||
{
|
{
|
||||||
return this.stackTagCompound != null && this.stackTagCompound.hasKey("ench", 9);
|
return this.stackTagCompound != null && this.stackTagCompound.hasTagList("ench");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTagInfo(String key, NBTBase value)
|
public void setTagInfo(String key, NBTBase value)
|
||||||
|
@ -1118,7 +1118,7 @@ public final class ItemStack
|
||||||
this.setTagCompound(new NBTTagCompound());
|
this.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stackTagCompound.setTag(key, value);
|
this.stackTagCompound.set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean canEditBlocks()
|
// public boolean canEditBlocks()
|
||||||
|
@ -1155,7 +1155,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public int getRepairCost()
|
public int getRepairCost()
|
||||||
{
|
{
|
||||||
return this.hasTagCompound() && this.stackTagCompound.hasKey("RepairCost", 3) ? this.stackTagCompound.getInteger("RepairCost") : 0;
|
return this.hasTagCompound() && this.stackTagCompound.hasInt("RepairCost") ? this.stackTagCompound.getInt("RepairCost") : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1167,11 +1167,11 @@ public final class ItemStack
|
||||||
if(this.stackTagCompound == null) {
|
if(this.stackTagCompound == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!this.stackTagCompound.hasKey("RepairCost", 3)) {
|
if(!this.stackTagCompound.hasInt("RepairCost")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.stackTagCompound.removeTag("RepairCost");
|
this.stackTagCompound.remove("RepairCost");
|
||||||
if(this.stackTagCompound.hasNoTags()) {
|
if(this.stackTagCompound.isEmpty()) {
|
||||||
this.stackTagCompound = null;
|
this.stackTagCompound = null;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1182,14 +1182,14 @@ public final class ItemStack
|
||||||
this.stackTagCompound = new NBTTagCompound();
|
this.stackTagCompound = new NBTTagCompound();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stackTagCompound.setInteger("RepairCost", cost);
|
this.stackTagCompound.setInt("RepairCost", cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Attribute, Set<AttributeModifier>> getAttributeModifiers(int type)
|
public Map<Attribute, Set<AttributeModifier>> getAttributeModifiers(int type)
|
||||||
{
|
{
|
||||||
Map<Attribute, Set<AttributeModifier>> multimap;
|
Map<Attribute, Set<AttributeModifier>> multimap;
|
||||||
|
|
||||||
// if ((type & 1) == 1 && this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers", 9))
|
// if ((type & 1) == 1 && this.hasTagCompound() && this.stackTagCompound.hasList("AttributeModifiers"))
|
||||||
// {
|
// {
|
||||||
// multimap = HashMultimap.<String, AttributeModifier>create();
|
// multimap = HashMultimap.<String, AttributeModifier>create();
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);
|
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);
|
||||||
|
@ -1236,7 +1236,7 @@ public final class ItemStack
|
||||||
// {
|
// {
|
||||||
// this.canDestroyCacheBlock = blockIn;
|
// this.canDestroyCacheBlock = blockIn;
|
||||||
//
|
//
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9))
|
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy"))
|
||||||
// {
|
// {
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8);
|
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8);
|
||||||
//
|
//
|
||||||
|
@ -1267,7 +1267,7 @@ public final class ItemStack
|
||||||
// {
|
// {
|
||||||
// this.canPlaceOnCacheBlock = blockIn;
|
// this.canPlaceOnCacheBlock = blockIn;
|
||||||
//
|
//
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9))
|
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn"))
|
||||||
// {
|
// {
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
||||||
//
|
//
|
||||||
|
|
|
@ -4,120 +4,57 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public abstract class NBTBase
|
public abstract class NBTBase {
|
||||||
{
|
protected static NBTBase createNewByType(byte id) {
|
||||||
public static final String[] NBT_TYPES = new String[] {"END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"};
|
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;
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
abstract void read(DataInput input, int depth, SizeTracker tracker) throws IOException;
|
||||||
*/
|
public abstract String toString();
|
||||||
abstract void write(DataOutput output) throws IOException;
|
public abstract byte getId();
|
||||||
|
public abstract NBTBase copy();
|
||||||
|
|
||||||
abstract void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException;
|
public boolean equals(Object other) {
|
||||||
|
return other instanceof NBTBase && this.getId() == ((NBTBase)other).getId();
|
||||||
|
}
|
||||||
|
|
||||||
public abstract String toString();
|
public int hashCode() {
|
||||||
|
return this.getId();
|
||||||
/**
|
}
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public abstract byte getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new NBTBase object that corresponds with the passed in id.
|
|
||||||
*/
|
|
||||||
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 NBTTagList();
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
return new NBTTagCompound();
|
|
||||||
|
|
||||||
case 11:
|
|
||||||
return new NBTTagIntArray();
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public abstract NBTBase copy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this compound has no tags.
|
|
||||||
*/
|
|
||||||
public boolean hasNoTags()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
|
||||||
{
|
|
||||||
if (!(p_equals_1_ instanceof NBTBase))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)p_equals_1_;
|
|
||||||
return this.getId() == nbtbase.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return this.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getString()
|
|
||||||
{
|
|
||||||
return this.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract static class NBTPrimitive extends NBTBase
|
|
||||||
{
|
|
||||||
public abstract long getLong();
|
|
||||||
|
|
||||||
public abstract int getInt();
|
|
||||||
|
|
||||||
public abstract short getShort();
|
|
||||||
|
|
||||||
public abstract byte getByte();
|
|
||||||
|
|
||||||
public abstract double getDouble();
|
|
||||||
|
|
||||||
public abstract float getFloat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package common.nbt;
|
package common.nbt;
|
||||||
|
|
||||||
public class NBTException extends Exception
|
public class NBTException extends Exception {
|
||||||
{
|
public NBTException(String message) {
|
||||||
public NBTException(String p_i45136_1_)
|
super(message);
|
||||||
{
|
}
|
||||||
super(p_i45136_1_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,20 +17,17 @@ public class NBTLoader {
|
||||||
public static NBTTagCompound readGZip(File file) throws IOException {
|
public static NBTTagCompound readGZip(File file) throws IOException {
|
||||||
DataInputStream in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))));
|
DataInputStream in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))));
|
||||||
NBTTagCompound tag;
|
NBTTagCompound tag;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tag = read(in, NBTSizeTracker.INFINITE);
|
tag = read(in, SizeTracker.INFINITE);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeGZip(NBTTagCompound tag, File file) throws IOException {
|
public static void writeGZip(NBTTagCompound tag, File file) throws IOException {
|
||||||
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));
|
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
write(tag, out);
|
write(tag, out);
|
||||||
}
|
}
|
||||||
|
@ -39,110 +36,13 @@ public class NBTLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException
|
public static NBTTagCompound read(DataInput in, SizeTracker tracker) throws IOException {
|
||||||
// {
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
// File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp");
|
tag.read(in, 0, tracker);
|
||||||
//
|
return tag;
|
||||||
// if (file1.exists())
|
|
||||||
// {
|
|
||||||
// file1.delete();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// write(p_74793_0_, file1);
|
|
||||||
//
|
|
||||||
// if (p_74793_1_.exists())
|
|
||||||
// {
|
|
||||||
// p_74793_1_.delete();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (p_74793_1_.exists())
|
|
||||||
// {
|
|
||||||
// throw new IOException("Failed to delete " + p_74793_1_);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// file1.renameTo(p_74793_1_);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException
|
|
||||||
// {
|
|
||||||
// DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_));
|
|
||||||
//
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// write(p_74795_0_, dataoutputstream);
|
|
||||||
// }
|
|
||||||
// finally
|
|
||||||
// {
|
|
||||||
// dataoutputstream.close();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static NBTTagCompound read(File p_74797_0_) throws IOException
|
|
||||||
// {
|
|
||||||
// if (!p_74797_0_.exists())
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// DataInputStream datainputstream = new DataInputStream(new FileInputStream(p_74797_0_));
|
|
||||||
// NBTTagCompound nbttagcompound;
|
|
||||||
//
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// nbttagcompound = read(datainputstream, NBTSizeTracker.INFINITE);
|
|
||||||
// }
|
|
||||||
// finally
|
|
||||||
// {
|
|
||||||
// datainputstream.close();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return nbttagcompound;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static NBTTagCompound read(DataInputStream in) throws IOException {
|
|
||||||
return read(in, NBTSizeTracker.INFINITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NBTTagCompound read(DataInput in, NBTSizeTracker tracker) throws IOException {
|
|
||||||
NBTBase tag = readType(in, 0, tracker);
|
|
||||||
|
|
||||||
if(tag instanceof NBTTagCompound) {
|
|
||||||
return (NBTTagCompound)tag;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new IOException("Root tag must be a named compound tag");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(NBTTagCompound tag, DataOutput out) throws IOException {
|
public static void write(NBTTagCompound tag, DataOutput out) throws IOException {
|
||||||
writeTag(tag, out);
|
tag.write(out);
|
||||||
}
|
|
||||||
|
|
||||||
private static void writeTag(NBTBase tag, DataOutput out) throws IOException {
|
|
||||||
out.writeByte(tag.getId());
|
|
||||||
|
|
||||||
if(tag.getId() != 0) {
|
|
||||||
out.writeUTF("");
|
|
||||||
tag.write(out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static NBTBase readType(DataInput in, int depth, NBTSizeTracker tracker) throws IOException {
|
|
||||||
byte type = in.readByte();
|
|
||||||
|
|
||||||
if(type == 0) {
|
|
||||||
return new NBTTagEnd();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
in.readUTF();
|
|
||||||
NBTBase tag = NBTBase.createNewByType(type);
|
|
||||||
|
|
||||||
tag.read(in, depth, tracker);
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,7 +401,7 @@ public class NBTParser
|
||||||
|
|
||||||
for (NBTParser.Any jsontonbt$any : this.field_150491_b)
|
for (NBTParser.Any jsontonbt$any : this.field_150491_b)
|
||||||
{
|
{
|
||||||
nbttagcompound.setTag(jsontonbt$any.json, jsontonbt$any.parse());
|
nbttagcompound.set(jsontonbt$any.json, jsontonbt$any.parse());
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
|
@ -419,11 +419,28 @@ public class NBTParser
|
||||||
|
|
||||||
public NBTBase parse() throws NBTException
|
public NBTBase parse() throws NBTException
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = null;
|
||||||
|
|
||||||
for (NBTParser.Any jsontonbt$any : this.field_150492_b)
|
for (NBTParser.Any jsontonbt$any : this.field_150492_b)
|
||||||
{
|
{
|
||||||
nbttaglist.appendTag(jsontonbt$any.parse());
|
NBTBase tag = jsontonbt$any.parse();
|
||||||
|
if(nbttaglist == null) {
|
||||||
|
switch(tag.getId()) {
|
||||||
|
case 8:
|
||||||
|
nbttaglist = new NBTTagStringList();
|
||||||
|
case 10:
|
||||||
|
nbttaglist = new NBTTagTagList();
|
||||||
|
case 5:
|
||||||
|
nbttaglist = new NBTTagFloatList();
|
||||||
|
case 6:
|
||||||
|
nbttaglist = new NBTTagDoubleList();
|
||||||
|
case 11:
|
||||||
|
nbttaglist = new NBTTagIntArrayList();
|
||||||
|
default:
|
||||||
|
throw new NBTException("Type cannot be put in a list: " + jsontonbt$any.json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nbttaglist.add(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttaglist;
|
return nbttaglist;
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package common.nbt;
|
|
||||||
|
|
||||||
public class NBTSizeTracker
|
|
||||||
{
|
|
||||||
public static final NBTSizeTracker INFINITE = new NBTSizeTracker(0L)
|
|
||||||
{
|
|
||||||
public void read(long bits)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private final long max;
|
|
||||||
private long read;
|
|
||||||
|
|
||||||
public NBTSizeTracker(long max)
|
|
||||||
{
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tracks the reading of the given amount of bits(!)
|
|
||||||
*/
|
|
||||||
public void read(long bits)
|
|
||||||
{
|
|
||||||
this.read += bits / 8L;
|
|
||||||
|
|
||||||
if (this.read > this.max)
|
|
||||||
{
|
|
||||||
throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,9 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagByte extends NBTBase.NBTPrimitive
|
class NBTTagByte extends NBTBase
|
||||||
{
|
{
|
||||||
/** The byte value for the tag. */
|
|
||||||
private byte data;
|
private byte data;
|
||||||
|
|
||||||
NBTTagByte()
|
NBTTagByte()
|
||||||
|
@ -18,23 +17,17 @@ public class NBTTagByte extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeByte(this.data);
|
output.writeByte(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(72L);
|
sizeTracker.read(9);
|
||||||
this.data = input.readByte();
|
this.data = input.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)1;
|
return (byte)1;
|
||||||
|
@ -45,19 +38,16 @@ public class NBTTagByte extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data + "b";
|
return "" + this.data + "b";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagByte(this.data);
|
return new NBTTagByte(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagByte nbttagbyte = (NBTTagByte)p_equals_1_;
|
NBTTagByte nbttagbyte = (NBTTagByte)other;
|
||||||
return this.data == nbttagbyte.data;
|
return this.data == nbttagbyte.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -71,33 +61,8 @@ public class NBTTagByte extends NBTBase.NBTPrimitive
|
||||||
return super.hashCode() ^ this.data;
|
return super.hashCode() ^ this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong()
|
|
||||||
{
|
|
||||||
return (long)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt()
|
|
||||||
{
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getShort()
|
|
||||||
{
|
|
||||||
return (short)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getByte()
|
public byte getByte()
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDouble()
|
|
||||||
{
|
|
||||||
return (double)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloat()
|
|
||||||
{
|
|
||||||
return (float)this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,73 +5,52 @@ import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class NBTTagByteArray extends NBTBase
|
class NBTTagByteArray extends NBTBase {
|
||||||
{
|
private byte[] data;
|
||||||
/** The byte array stored in the tag. */
|
|
||||||
private byte[] data;
|
|
||||||
|
|
||||||
NBTTagByteArray()
|
NBTTagByteArray() {
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public NBTTagByteArray(byte[] data)
|
public NBTTagByteArray(byte[] data) {
|
||||||
{
|
this.data = data;
|
||||||
this.data = data;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
void write(DataOutput output) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
output.writeInt(this.data.length);
|
||||||
*/
|
output.write(this.data);
|
||||||
void write(DataOutput output) throws IOException
|
}
|
||||||
{
|
|
||||||
output.writeInt(this.data.length);
|
|
||||||
output.write(this.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
{
|
tracker.read(24);
|
||||||
sizeTracker.read(192L);
|
int len = input.readInt();
|
||||||
int i = input.readInt();
|
tracker.read(len);
|
||||||
sizeTracker.read((long)(8 * i));
|
this.data = new byte[len];
|
||||||
this.data = new byte[i];
|
input.readFully(this.data);
|
||||||
input.readFully(this.data);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public byte getId() {
|
||||||
* Gets the type byte for the tag.
|
return (byte)7;
|
||||||
*/
|
}
|
||||||
public byte getId()
|
|
||||||
{
|
|
||||||
return (byte)7;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return "[" + this.data.length + " bytes]";
|
||||||
return "[" + this.data.length + " bytes]";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public NBTBase copy() {
|
||||||
* Creates a clone of the tag.
|
byte[] data = new byte[this.data.length];
|
||||||
*/
|
System.arraycopy(this.data, 0, data, 0, this.data.length);
|
||||||
public NBTBase copy()
|
return new NBTTagByteArray(data);
|
||||||
{
|
}
|
||||||
byte[] abyte = new byte[this.data.length];
|
|
||||||
System.arraycopy(this.data, 0, abyte, 0, this.data.length);
|
|
||||||
return new NBTTagByteArray(abyte);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other) {
|
||||||
{
|
return super.equals(other) && Arrays.equals(this.data, ((NBTTagByteArray)other).data);
|
||||||
return super.equals(p_equals_1_) ? Arrays.equals(this.data, ((NBTTagByteArray)p_equals_1_).data) : false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
public int hashCode() {
|
||||||
{
|
return super.hashCode() ^ Arrays.hashCode(this.data);
|
||||||
return super.hashCode() ^ Arrays.hashCode(this.data);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getByteArray()
|
public byte[] getByteArray() {
|
||||||
{
|
return this.data;
|
||||||
return this.data;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,476 +10,309 @@ import common.collect.Maps;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class NBTTagCompound extends NBTBase
|
public class NBTTagCompound extends NBTBase {
|
||||||
{
|
private Map<String, NBTBase> tags = Maps.<String, NBTBase>newHashMap();
|
||||||
private Map<String, NBTBase> tagMap = Maps.<String, NBTBase>newHashMap();
|
|
||||||
|
|
||||||
/**
|
void write(DataOutput output) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
for(String key : this.tags.keySet()) {
|
||||||
*/
|
NBTBase tag = this.tags.get(key);
|
||||||
void write(DataOutput output) throws IOException
|
output.writeByte(tag.getId());
|
||||||
{
|
if(tag.getId() != 0) {
|
||||||
for (String s : this.tagMap.keySet())
|
output.writeUTF(key);
|
||||||
{
|
tag.write(output);
|
||||||
NBTBase nbtbase = (NBTBase)this.tagMap.get(s);
|
}
|
||||||
writeEntry(s, nbtbase, output);
|
}
|
||||||
}
|
output.writeByte(0);
|
||||||
|
}
|
||||||
|
|
||||||
output.writeByte(0);
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
}
|
tracker.read(48);
|
||||||
|
if(depth > 512)
|
||||||
|
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
||||||
|
this.tags.clear();
|
||||||
|
byte id;
|
||||||
|
while((id = input.readByte()) != 0) {
|
||||||
|
String key = input.readUTF();
|
||||||
|
tracker.read(28 + 2 * key.length());
|
||||||
|
NBTBase tag = NBTBase.createNewByType(id);
|
||||||
|
tag.read(input, depth + 1, tracker);
|
||||||
|
if(this.tags.put(key, tag) != null)
|
||||||
|
tracker.read(36);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
public Set<String> getKeySet() {
|
||||||
{
|
return this.tags.keySet();
|
||||||
sizeTracker.read(384L);
|
}
|
||||||
|
|
||||||
if (depth > 512)
|
public byte getId() {
|
||||||
{
|
return (byte)10;
|
||||||
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.tagMap.clear();
|
|
||||||
byte b0;
|
|
||||||
|
|
||||||
while ((b0 = readType(input, sizeTracker)) != 0)
|
public void set(String key, NBTBase value) {
|
||||||
{
|
this.tags.put(key, value);
|
||||||
String s = readKey(input, sizeTracker);
|
}
|
||||||
sizeTracker.read((long)(224 + 16 * s.length()));
|
|
||||||
NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker);
|
|
||||||
|
|
||||||
if (this.tagMap.put(s, nbtbase) != null)
|
public void setTag(String key, NBTTagCompound value) {
|
||||||
{
|
this.tags.put(key, value);
|
||||||
sizeTracker.read(288L);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getKeySet()
|
public void setFloatList(String key, NBTTagFloatList value) {
|
||||||
{
|
this.tags.put(key, value);
|
||||||
return this.tagMap.keySet();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setDoubleList(String key, NBTTagDoubleList value) {
|
||||||
* Gets the type byte for the tag.
|
this.tags.put(key, value);
|
||||||
*/
|
}
|
||||||
public byte getId()
|
|
||||||
{
|
|
||||||
return (byte)10;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setStringList(String key, NBTTagStringList value) {
|
||||||
* Stores the given tag into the map with the given string key. This is mostly used to store tag lists.
|
this.tags.put(key, value);
|
||||||
*/
|
}
|
||||||
public void setTag(String key, NBTBase value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setIntArrayList(String key, NBTTagIntArrayList value) {
|
||||||
* Stores a new NBTTagByte with the given byte value into the map with the given string key.
|
this.tags.put(key, value);
|
||||||
*/
|
}
|
||||||
public void setByte(String key, byte value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagByte(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setTagList(String key, NBTTagTagList value) {
|
||||||
* Stores a new NBTTagShort with the given short value into the map with the given string key.
|
this.tags.put(key, value);
|
||||||
*/
|
}
|
||||||
public void setShort(String key, short value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagShort(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setByte(String key, byte value) {
|
||||||
* Stores a new NBTTagInt with the given integer value into the map with the given string key.
|
this.tags.put(key, new NBTTagByte(value));
|
||||||
*/
|
}
|
||||||
public void setInteger(String key, int value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagInt(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setShort(String key, short value) {
|
||||||
* Stores a new NBTTagLong with the given long value into the map with the given string key.
|
this.tags.put(key, new NBTTagShort(value));
|
||||||
*/
|
}
|
||||||
public void setLong(String key, long value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagLong(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setInt(String key, int value) {
|
||||||
* Stores a new NBTTagFloat with the given float value into the map with the given string key.
|
this.tags.put(key, new NBTTagInt(value));
|
||||||
*/
|
}
|
||||||
public void setFloat(String key, float value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagFloat(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setLong(String key, long value) {
|
||||||
* Stores a new NBTTagDouble with the given double value into the map with the given string key.
|
this.tags.put(key, new NBTTagLong(value));
|
||||||
*/
|
}
|
||||||
public void setDouble(String key, double value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagDouble(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setFloat(String key, float value) {
|
||||||
* Stores a new NBTTagString with the given string value into the map with the given string key.
|
this.tags.put(key, new NBTTagFloat(value));
|
||||||
*/
|
}
|
||||||
public void setString(String key, String value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagString(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setDouble(String key, double value) {
|
||||||
* Stores a new NBTTagByteArray with the given array as data into the map with the given string key.
|
this.tags.put(key, new NBTTagDouble(value));
|
||||||
*/
|
}
|
||||||
public void setByteArray(String key, byte[] value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagByteArray(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setString(String key, String value) {
|
||||||
* Stores a new NBTTagIntArray with the given array as data into the map with the given string key.
|
this.tags.put(key, new NBTTagString(value));
|
||||||
*/
|
}
|
||||||
public void setIntArray(String key, int[] value)
|
|
||||||
{
|
|
||||||
this.tagMap.put(key, new NBTTagIntArray(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setByteArray(String key, byte[] value) {
|
||||||
* Stores the given boolean value as a NBTTagByte, storing 1 for true and 0 for false, using the given string key.
|
this.tags.put(key, new NBTTagByteArray(value));
|
||||||
*/
|
}
|
||||||
public void setBoolean(String key, boolean value)
|
|
||||||
{
|
|
||||||
this.setByte(key, (byte)(value ? 1 : 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setIntArray(String key, int[] value) {
|
||||||
* gets a generic tag with the specified name
|
this.tags.put(key, new NBTTagIntArray(value));
|
||||||
*/
|
}
|
||||||
public NBTBase getTag(String key)
|
|
||||||
{
|
|
||||||
return (NBTBase)this.tagMap.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setBool(String key, boolean value) {
|
||||||
* Gets the ID byte for the given tag key
|
this.setByte(key, (byte)(value ? 1 : 0));
|
||||||
*/
|
}
|
||||||
public byte getTagId(String key)
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagMap.get(key);
|
|
||||||
return nbtbase != null ? nbtbase.getId() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public NBTBase get(String key) {
|
||||||
* Returns whether the given string has been previously stored as a key in the map.
|
return this.tags.get(key);
|
||||||
*/
|
}
|
||||||
public boolean hasKey(String key)
|
|
||||||
{
|
|
||||||
return this.tagMap.containsKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasKey(String key, int type)
|
public byte getTagId(String key) {
|
||||||
{
|
NBTBase tag = this.tags.get(key);
|
||||||
int i = this.getTagId(key);
|
return tag != null ? tag.getId() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (i == type)
|
private boolean hasKey(String key, int type) {
|
||||||
{
|
int id = this.getTagId(key);
|
||||||
return true;
|
return id == type || (type == 99 && id >= 1 && id <= 6);
|
||||||
}
|
}
|
||||||
else if (type != 99)
|
|
||||||
{
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public boolean hasBool(String key) {
|
||||||
}
|
return this.hasByte(key);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
return i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasByte(String key) {
|
||||||
* Retrieves a byte value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 1);
|
||||||
*/
|
}
|
||||||
public byte getByte(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getByte();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return (byte)0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasShort(String key) {
|
||||||
* Retrieves a short value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 2);
|
||||||
*/
|
}
|
||||||
public short getShort(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getShort();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return (short)0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasInt(String key) {
|
||||||
* Retrieves an integer value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 3);
|
||||||
*/
|
}
|
||||||
public int getInteger(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getInt();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasLong(String key) {
|
||||||
* Retrieves a long value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 4);
|
||||||
*/
|
}
|
||||||
public long getLong(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0L : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getLong();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasFloat(String key) {
|
||||||
* Retrieves a float value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 5);
|
||||||
*/
|
}
|
||||||
public float getFloat(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0.0F : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getFloat();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasDouble(String key) {
|
||||||
* Retrieves a double value using the specified key, or 0 if no such key was stored.
|
return this.hasKey(key, 6);
|
||||||
*/
|
}
|
||||||
public double getDouble(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 99) ? 0.0D : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getDouble();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return 0.0D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasString(String key) {
|
||||||
* Retrieves a string value using the specified key, or an empty string if no such key was stored.
|
return this.hasKey(key, 8);
|
||||||
*/
|
}
|
||||||
public String getString(String key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 8) ? "" : ((NBTBase)this.tagMap.get(key)).getString();
|
|
||||||
}
|
|
||||||
catch (ClassCastException var3)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasByteArray(String key) {
|
||||||
* Retrieves a byte array using the specified key, or a zero-length array if no such key was stored.
|
return this.hasKey(key, 7);
|
||||||
*/
|
}
|
||||||
public byte[] getByteArray(String key)
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 7) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(key)).getByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasIntArray(String key) {
|
||||||
* Retrieves an int array using the specified key, or a zero-length array if no such key was stored.
|
return this.hasKey(key, 11);
|
||||||
*/
|
}
|
||||||
public int[] getIntArray(String key)
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(key)).getIntArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasTag(String key) {
|
||||||
* Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was
|
return this.hasKey(key, 10);
|
||||||
* stored.
|
}
|
||||||
*/
|
|
||||||
public NBTTagCompound getCompoundTag(String key)
|
|
||||||
{
|
|
||||||
return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound)this.tagMap.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasFloatList(String key) {
|
||||||
* Gets the NBTTagList object with the given name. Args: name, NBTBase type
|
return this.hasKey(key, 13);
|
||||||
*/
|
}
|
||||||
public NBTTagList getTagList(String key, int type)
|
|
||||||
{
|
|
||||||
if (this.getTagId(key) != 9)
|
|
||||||
{
|
|
||||||
return new NBTTagList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NBTTagList nbttaglist = (NBTTagList)this.tagMap.get(key);
|
|
||||||
return nbttaglist.tagCount() > 0 && nbttaglist.getTagType() != type ? new NBTTagList() : nbttaglist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasDoubleList(String key) {
|
||||||
* Retrieves a boolean value using the specified key, or false if no such key was stored. This uses the getByte
|
return this.hasKey(key, 14);
|
||||||
* method.
|
}
|
||||||
*/
|
|
||||||
public boolean getBoolean(String key)
|
|
||||||
{
|
|
||||||
return this.getByte(key) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean hasStringList(String key) {
|
||||||
* Remove the specified tag.
|
return this.hasKey(key, 9);
|
||||||
*/
|
}
|
||||||
public void removeTag(String key)
|
|
||||||
{
|
|
||||||
this.tagMap.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public boolean hasIntArrayList(String key) {
|
||||||
{
|
return this.hasKey(key, 15);
|
||||||
StringBuilder stringbuilder = new StringBuilder("{");
|
}
|
||||||
|
|
||||||
for (Entry<String, NBTBase> entry : this.tagMap.entrySet())
|
public boolean hasTagList(String key) {
|
||||||
{
|
return this.hasKey(key, 12);
|
||||||
if (stringbuilder.length() != 1)
|
}
|
||||||
{
|
|
||||||
stringbuilder.append(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
stringbuilder.append((String)entry.getKey()).append(':').append(entry.getValue());
|
public byte getByte(String key) {
|
||||||
}
|
return !this.hasKey(key, 1) ? 0 : ((NBTTagByte)this.tags.get(key)).getByte();
|
||||||
|
}
|
||||||
|
|
||||||
return stringbuilder.append('}').toString();
|
public short getShort(String key) {
|
||||||
}
|
return !this.hasKey(key, 2) ? 0 : ((NBTTagShort)this.tags.get(key)).getShort();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public int getInt(String key) {
|
||||||
* Return whether this compound has no tags.
|
return !this.hasKey(key, 3) ? 0 : ((NBTTagInt)this.tags.get(key)).getInt();
|
||||||
*/
|
}
|
||||||
public boolean hasNoTags()
|
|
||||||
{
|
|
||||||
return this.tagMap.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public long getLong(String key) {
|
||||||
* Creates a clone of the tag.
|
return !this.hasKey(key, 4) ? 0L : ((NBTTagLong)this.tags.get(key)).getLong();
|
||||||
*/
|
}
|
||||||
public NBTBase copy()
|
|
||||||
{
|
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
||||||
|
|
||||||
for (String s : this.tagMap.keySet())
|
public float getFloat(String key) {
|
||||||
{
|
return !this.hasKey(key, 5) ? 0.0F : ((NBTTagFloat)this.tags.get(key)).getFloat();
|
||||||
nbttagcompound.setTag(s, ((NBTBase)this.tagMap.get(s)).copy());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nbttagcompound;
|
public double getDouble(String key) {
|
||||||
}
|
return !this.hasKey(key, 6) ? 0.0D : ((NBTTagDouble)this.tags.get(key)).getDouble();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public String getString(String key) {
|
||||||
{
|
return !this.hasKey(key, 8) ? "" : ((NBTTagString)this.tags.get(key)).getString();
|
||||||
if (super.equals(p_equals_1_))
|
}
|
||||||
{
|
|
||||||
NBTTagCompound nbttagcompound = (NBTTagCompound)p_equals_1_;
|
|
||||||
return this.tagMap.entrySet().equals(nbttagcompound.tagMap.entrySet());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
public byte[] getByteArray(String key) {
|
||||||
{
|
return !this.hasKey(key, 7) ? new byte[0] : ((NBTTagByteArray)this.tags.get(key)).getByteArray();
|
||||||
return super.hashCode() ^ this.tagMap.hashCode();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void writeEntry(String name, NBTBase data, DataOutput output) throws IOException
|
public int[] getIntArray(String key) {
|
||||||
{
|
return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray)this.tags.get(key)).getIntArray();
|
||||||
output.writeByte(data.getId());
|
}
|
||||||
|
|
||||||
if (data.getId() != 0)
|
public NBTTagCompound getTag(String key) {
|
||||||
{
|
return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound)this.tags.get(key);
|
||||||
output.writeUTF(name);
|
}
|
||||||
data.write(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException
|
public NBTTagFloatList getFloatList(String key) {
|
||||||
{
|
return !this.hasKey(key, 13) ? new NBTTagFloatList() : (NBTTagFloatList)this.tags.get(key);
|
||||||
return input.readByte();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static String readKey(DataInput input, NBTSizeTracker sizeTracker) throws IOException
|
public NBTTagDoubleList getDoubleList(String key) {
|
||||||
{
|
return !this.hasKey(key, 14) ? new NBTTagDoubleList() : (NBTTagDoubleList)this.tags.get(key);
|
||||||
return input.readUTF();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
public NBTTagStringList getStringList(String key) {
|
||||||
{
|
return !this.hasKey(key, 9) ? new NBTTagStringList() : (NBTTagStringList)this.tags.get(key);
|
||||||
NBTBase nbtbase = NBTBase.createNewByType(id);
|
}
|
||||||
|
|
||||||
nbtbase.read(input, depth, sizeTracker);
|
public NBTTagIntArrayList getIntArrayList(String key) {
|
||||||
return nbtbase;
|
return !this.hasKey(key, 15) ? new NBTTagIntArrayList() : (NBTTagIntArrayList)this.tags.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public NBTTagTagList getTagList(String key) {
|
||||||
* Merges this NBTTagCompound with the given compound. Any sub-compounds are merged using the same methods, other
|
return !this.hasKey(key, 12) ? new NBTTagTagList() : (NBTTagTagList)this.tags.get(key);
|
||||||
* types of tags are overwritten from the given compound.
|
}
|
||||||
*/
|
|
||||||
public void merge(NBTTagCompound other)
|
|
||||||
{
|
|
||||||
for (String s : other.tagMap.keySet())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)other.tagMap.get(s);
|
|
||||||
|
|
||||||
if (nbtbase.getId() == 10)
|
public boolean getBool(String key) {
|
||||||
{
|
return this.getByte(key) != 0;
|
||||||
if (this.hasKey(s, 10))
|
}
|
||||||
{
|
|
||||||
NBTTagCompound nbttagcompound = this.getCompoundTag(s);
|
public void remove(String key) {
|
||||||
nbttagcompound.merge((NBTTagCompound)nbtbase);
|
this.tags.remove(key);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
public String toString() {
|
||||||
this.setTag(s, nbtbase.copy());
|
StringBuilder sb = new StringBuilder("{");
|
||||||
}
|
for(Entry<String, NBTBase> entry : this.tags.entrySet()) {
|
||||||
}
|
if(sb.length() != 1)
|
||||||
else
|
sb.append(',');
|
||||||
{
|
sb.append(entry.getKey()).append(':').append(entry.getValue());
|
||||||
this.setTag(s, nbtbase.copy());
|
}
|
||||||
}
|
return sb.append('}').toString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return this.tags.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTBase copy() {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
for(String s : this.tags.keySet()) {
|
||||||
|
tag.set(s, this.tags.get(s).copy());
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
return super.equals(other) && this.tags.entrySet().equals(((NBTTagCompound)other).tags.entrySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
return super.hashCode() ^ this.tags.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges this NBTTagCompound with the given compound. Any sub-compounds are
|
||||||
|
* merged using the same methods, other types of tags are overwritten from the
|
||||||
|
* given compound.
|
||||||
|
*/
|
||||||
|
public void merge(NBTTagCompound other) {
|
||||||
|
for(String key : other.tags.keySet()) {
|
||||||
|
NBTBase tag = other.tags.get(key);
|
||||||
|
if(tag.getId() == 10) {
|
||||||
|
if(this.hasKey(key, 10)) {
|
||||||
|
NBTTagCompound comp = this.getTag(key);
|
||||||
|
comp.merge((NBTTagCompound)tag);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.set(key, tag.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.set(key, tag.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import common.util.ExtMath;
|
class NBTTagDouble extends NBTBase
|
||||||
|
|
||||||
public class NBTTagDouble extends NBTBase.NBTPrimitive
|
|
||||||
{
|
{
|
||||||
/** The double value for the tag. */
|
|
||||||
private double data;
|
private double data;
|
||||||
|
|
||||||
NBTTagDouble()
|
NBTTagDouble()
|
||||||
|
@ -20,23 +17,17 @@ public class NBTTagDouble extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeDouble(this.data);
|
output.writeDouble(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(128L);
|
sizeTracker.read(16);
|
||||||
this.data = input.readDouble();
|
this.data = input.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)6;
|
return (byte)6;
|
||||||
|
@ -47,19 +38,16 @@ public class NBTTagDouble extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data + "d";
|
return "" + this.data + "d";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagDouble(this.data);
|
return new NBTTagDouble(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagDouble nbttagdouble = (NBTTagDouble)p_equals_1_;
|
NBTTagDouble nbttagdouble = (NBTTagDouble)other;
|
||||||
return this.data == nbttagdouble.data;
|
return this.data == nbttagdouble.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -74,33 +62,8 @@ public class NBTTagDouble extends NBTBase.NBTPrimitive
|
||||||
return super.hashCode() ^ (int)(i ^ i >>> 32);
|
return super.hashCode() ^ (int)(i ^ i >>> 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong()
|
|
||||||
{
|
|
||||||
return (long)Math.floor(this.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt()
|
|
||||||
{
|
|
||||||
return ExtMath.floord(this.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getShort()
|
|
||||||
{
|
|
||||||
return (short)(ExtMath.floord(this.data) & 65535);
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getByte()
|
|
||||||
{
|
|
||||||
return (byte)(ExtMath.floord(this.data) & 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble()
|
public double getDouble()
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getFloat()
|
|
||||||
{
|
|
||||||
return (float)this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
27
common/src/main/java/common/nbt/NBTTagDoubleList.java
Normal file
27
common/src/main/java/common/nbt/NBTTagDoubleList.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class NBTTagDoubleList extends NBTTagList<NBTTagDouble> {
|
||||||
|
public byte getId() {
|
||||||
|
return 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagList<NBTTagDouble> createInstance() {
|
||||||
|
return new NBTTagDoubleList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagDouble getDefault() {
|
||||||
|
return new NBTTagDouble(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDouble(int index) {
|
||||||
|
return this.get(index).getDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(double value) {
|
||||||
|
this.add(new NBTTagDouble(value));
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,38 +4,23 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagEnd extends NBTBase
|
class NBTTagEnd extends NBTBase {
|
||||||
{
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
tracker.read(8);
|
||||||
{
|
}
|
||||||
sizeTracker.read(64L);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
void write(DataOutput output) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
}
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public byte getId() {
|
||||||
* Gets the type byte for the tag.
|
return (byte)0;
|
||||||
*/
|
}
|
||||||
public byte getId()
|
|
||||||
{
|
|
||||||
return (byte)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return "END";
|
||||||
return "END";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public NBTBase copy() {
|
||||||
* Creates a clone of the tag.
|
return new NBTTagEnd();
|
||||||
*/
|
}
|
||||||
public NBTBase copy()
|
|
||||||
{
|
|
||||||
return new NBTTagEnd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import common.util.ExtMath;
|
class NBTTagFloat extends NBTBase
|
||||||
|
|
||||||
public class NBTTagFloat extends NBTBase.NBTPrimitive
|
|
||||||
{
|
{
|
||||||
/** The float value for the tag. */
|
|
||||||
private float data;
|
private float data;
|
||||||
|
|
||||||
NBTTagFloat()
|
NBTTagFloat()
|
||||||
|
@ -20,23 +17,17 @@ public class NBTTagFloat extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeFloat(this.data);
|
output.writeFloat(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(96L);
|
sizeTracker.read(12);
|
||||||
this.data = input.readFloat();
|
this.data = input.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)5;
|
return (byte)5;
|
||||||
|
@ -47,19 +38,16 @@ public class NBTTagFloat extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data + "f";
|
return "" + this.data + "f";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagFloat(this.data);
|
return new NBTTagFloat(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagFloat nbttagfloat = (NBTTagFloat)p_equals_1_;
|
NBTTagFloat nbttagfloat = (NBTTagFloat)other;
|
||||||
return this.data == nbttagfloat.data;
|
return this.data == nbttagfloat.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -73,31 +61,6 @@ public class NBTTagFloat extends NBTBase.NBTPrimitive
|
||||||
return super.hashCode() ^ Float.floatToIntBits(this.data);
|
return super.hashCode() ^ Float.floatToIntBits(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong()
|
|
||||||
{
|
|
||||||
return (long)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt()
|
|
||||||
{
|
|
||||||
return ExtMath.floorf(this.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getShort()
|
|
||||||
{
|
|
||||||
return (short)(ExtMath.floorf(this.data) & 65535);
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getByte()
|
|
||||||
{
|
|
||||||
return (byte)(ExtMath.floorf(this.data) & 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble()
|
|
||||||
{
|
|
||||||
return (double)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloat()
|
public float getFloat()
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
|
|
27
common/src/main/java/common/nbt/NBTTagFloatList.java
Normal file
27
common/src/main/java/common/nbt/NBTTagFloatList.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class NBTTagFloatList extends NBTTagList<NBTTagFloat> {
|
||||||
|
public byte getId() {
|
||||||
|
return 13;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagList<NBTTagFloat> createInstance() {
|
||||||
|
return new NBTTagFloatList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagFloat getDefault() {
|
||||||
|
return new NBTTagFloat(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getFloat(int index) {
|
||||||
|
return this.get(index).getFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(float value) {
|
||||||
|
this.add(new NBTTagFloat(value));
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagInt extends NBTBase.NBTPrimitive
|
class NBTTagInt extends NBTBase
|
||||||
{
|
{
|
||||||
/** The integer value for the tag. */
|
|
||||||
private int data;
|
private int data;
|
||||||
|
|
||||||
NBTTagInt()
|
NBTTagInt()
|
||||||
|
@ -18,23 +17,17 @@ public class NBTTagInt extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeInt(this.data);
|
output.writeInt(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(96L);
|
sizeTracker.read(12);
|
||||||
this.data = input.readInt();
|
this.data = input.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)3;
|
return (byte)3;
|
||||||
|
@ -45,19 +38,16 @@ public class NBTTagInt extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data;
|
return "" + this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagInt(this.data);
|
return new NBTTagInt(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagInt nbttagint = (NBTTagInt)p_equals_1_;
|
NBTTagInt nbttagint = (NBTTagInt)other;
|
||||||
return this.data == nbttagint.data;
|
return this.data == nbttagint.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -71,33 +61,8 @@ public class NBTTagInt extends NBTBase.NBTPrimitive
|
||||||
return super.hashCode() ^ this.data;
|
return super.hashCode() ^ this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong()
|
|
||||||
{
|
|
||||||
return (long)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt()
|
public int getInt()
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getShort()
|
|
||||||
{
|
|
||||||
return (short)(this.data & 65535);
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getByte()
|
|
||||||
{
|
|
||||||
return (byte)(this.data & 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble()
|
|
||||||
{
|
|
||||||
return (double)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloat()
|
|
||||||
{
|
|
||||||
return (float)this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,88 +5,60 @@ import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class NBTTagIntArray extends NBTBase
|
class NBTTagIntArray extends NBTBase {
|
||||||
{
|
private int[] data;
|
||||||
/** The array of saved integers */
|
|
||||||
private int[] intArray;
|
|
||||||
|
|
||||||
NBTTagIntArray()
|
NBTTagIntArray() {
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public NBTTagIntArray(int[] p_i45132_1_)
|
public NBTTagIntArray(int[] data) {
|
||||||
{
|
this.data = data;
|
||||||
this.intArray = p_i45132_1_;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
void write(DataOutput output) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
output.writeInt(this.data.length);
|
||||||
*/
|
for(int i = 0; i < this.data.length; ++i) {
|
||||||
void write(DataOutput output) throws IOException
|
output.writeInt(this.data[i]);
|
||||||
{
|
}
|
||||||
output.writeInt(this.intArray.length);
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.intArray.length; ++i)
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
{
|
tracker.read(24);
|
||||||
output.writeInt(this.intArray[i]);
|
int len = input.readInt();
|
||||||
}
|
tracker.read(4 * len);
|
||||||
}
|
this.data = new int[len];
|
||||||
|
for(int z = 0; z < len; z++) {
|
||||||
|
this.data[z] = input.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
public byte getId() {
|
||||||
{
|
return (byte)11;
|
||||||
sizeTracker.read(192L);
|
}
|
||||||
int i = input.readInt();
|
|
||||||
sizeTracker.read((long)(32 * i));
|
|
||||||
this.intArray = new int[i];
|
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
public String toString() {
|
||||||
{
|
StringBuilder sb = new StringBuilder("[");
|
||||||
this.intArray[j] = input.readInt();
|
for(int i : this.data) {
|
||||||
}
|
sb.append(i + ",");
|
||||||
}
|
}
|
||||||
|
return sb.append("]").toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public NBTBase copy() {
|
||||||
* Gets the type byte for the tag.
|
int[] data = new int[this.data.length];
|
||||||
*/
|
System.arraycopy(this.data, 0, data, 0, this.data.length);
|
||||||
public byte getId()
|
return new NBTTagIntArray(data);
|
||||||
{
|
}
|
||||||
return (byte)11;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public boolean equals(Object other) {
|
||||||
{
|
return super.equals(other) && Arrays.equals(this.data, ((NBTTagIntArray)other).data);
|
||||||
String s = "[";
|
}
|
||||||
|
|
||||||
for (int i : this.intArray)
|
public int hashCode() {
|
||||||
{
|
return super.hashCode() ^ Arrays.hashCode(this.data);
|
||||||
s = s + i + ",";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return s + "]";
|
public int[] getIntArray() {
|
||||||
}
|
return this.data;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
|
||||||
{
|
|
||||||
int[] aint = new int[this.intArray.length];
|
|
||||||
System.arraycopy(this.intArray, 0, aint, 0, this.intArray.length);
|
|
||||||
return new NBTTagIntArray(aint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
|
||||||
{
|
|
||||||
return super.equals(p_equals_1_) ? Arrays.equals(this.intArray, ((NBTTagIntArray)p_equals_1_).intArray) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return super.hashCode() ^ Arrays.hashCode(this.intArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getIntArray()
|
|
||||||
{
|
|
||||||
return this.intArray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
27
common/src/main/java/common/nbt/NBTTagIntArrayList.java
Normal file
27
common/src/main/java/common/nbt/NBTTagIntArrayList.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class NBTTagIntArrayList extends NBTTagList<NBTTagIntArray> {
|
||||||
|
public byte getId() {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagList<NBTTagIntArray> createInstance() {
|
||||||
|
return new NBTTagIntArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagIntArray getDefault() {
|
||||||
|
return new NBTTagIntArray(new int[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getIntArray(int index) {
|
||||||
|
return this.get(index).getIntArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(int[] value) {
|
||||||
|
this.add(new NBTTagIntArray(value));
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,292 +9,86 @@ import java.util.List;
|
||||||
import common.collect.Lists;
|
import common.collect.Lists;
|
||||||
import common.log.Log;
|
import common.log.Log;
|
||||||
|
|
||||||
public class NBTTagList extends NBTBase
|
abstract class NBTTagList<K extends NBTBase> extends NBTBase {
|
||||||
{
|
private List<K> list = Lists.newArrayList();
|
||||||
private List<NBTBase> tagList = Lists.<NBTBase>newArrayList();
|
|
||||||
|
|
||||||
/**
|
void write(DataOutput output) throws IOException {
|
||||||
* The type byte for the tags in the list - they must all be of the same type.
|
output.writeInt(this.list.size());
|
||||||
*/
|
for(int z = 0; z < this.list.size(); z++) {
|
||||||
private byte tagType = 0;
|
this.list.get(z).write(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
tracker.read(36);
|
||||||
*/
|
if(depth > 512)
|
||||||
void write(DataOutput output) throws IOException
|
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
||||||
{
|
int len = input.readInt();
|
||||||
if (!this.tagList.isEmpty())
|
tracker.read(4 * len);
|
||||||
{
|
this.list = new ArrayList<K>(len);
|
||||||
this.tagType = ((NBTBase)this.tagList.get(0)).getId();
|
for(int z = 0; z < len; z++) {
|
||||||
}
|
K tag = (K)NBTBase.createNewByType(this.getType());
|
||||||
else
|
tag.read(input, depth + 1, tracker);
|
||||||
{
|
this.list.add(tag);
|
||||||
this.tagType = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output.writeByte(this.tagType);
|
public abstract byte getId();
|
||||||
output.writeInt(this.tagList.size());
|
public abstract byte getType();
|
||||||
|
public abstract NBTTagList<K> createInstance();
|
||||||
|
public abstract K getDefault();
|
||||||
|
|
||||||
for (int i = 0; i < this.tagList.size(); ++i)
|
public String toString() {
|
||||||
{
|
StringBuilder sb = new StringBuilder("[");
|
||||||
((NBTBase)this.tagList.get(i)).write(output);
|
for(int z = 0; z < this.list.size(); z++) {
|
||||||
}
|
if(z != 0)
|
||||||
}
|
sb.append(',');
|
||||||
|
sb.append(z).append(':').append(this.list.get(z));
|
||||||
|
}
|
||||||
|
return sb.append(']').toString();
|
||||||
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
protected void add(K tag) {
|
||||||
{
|
this.list.add(tag);
|
||||||
sizeTracker.read(296L);
|
}
|
||||||
|
|
||||||
if (depth > 512)
|
public void set(int index, K tag) {
|
||||||
{
|
if(index < 0 || index >= this.list.size()) {
|
||||||
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
|
Log.IO.error("Index außerhalb des Bereiches um Tag in Tag-Liste zu setzen");
|
||||||
}
|
return;
|
||||||
else
|
}
|
||||||
{
|
this.list.set(index, tag);
|
||||||
this.tagType = input.readByte();
|
}
|
||||||
int i = input.readInt();
|
|
||||||
|
|
||||||
if (this.tagType == 0 && i > 0)
|
public K remove(int index) {
|
||||||
{
|
return this.list.remove(index);
|
||||||
throw new RuntimeException("Missing type on ListTag");
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sizeTracker.read(32L * (long)i);
|
|
||||||
this.tagList = new ArrayList<NBTBase>(i);
|
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
public boolean isEmpty() {
|
||||||
{
|
return this.list.isEmpty();
|
||||||
NBTBase nbtbase = NBTBase.createNewByType(this.tagType);
|
}
|
||||||
nbtbase.read(input, depth + 1, sizeTracker);
|
|
||||||
this.tagList.add(nbtbase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
protected K get(int index) {
|
||||||
* Gets the type byte for the tag.
|
return index >= 0 && index < this.list.size() ? this.list.get(index) : this.getDefault();
|
||||||
*/
|
}
|
||||||
public byte getId()
|
|
||||||
{
|
|
||||||
return (byte)9;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public int size() {
|
||||||
{
|
return this.list.size();
|
||||||
StringBuilder stringbuilder = new StringBuilder("[");
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.tagList.size(); ++i)
|
public NBTBase copy() {
|
||||||
{
|
NBTTagList<K> list = this.createInstance();
|
||||||
if (i != 0)
|
for(K tag : this.list) {
|
||||||
{
|
list.list.add((K)tag.copy());
|
||||||
stringbuilder.append(',');
|
}
|
||||||
}
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
stringbuilder.append(i).append(':').append(this.tagList.get(i));
|
public boolean equals(Object other) {
|
||||||
}
|
return super.equals(other) && this.list.equals(((NBTTagList)other).list);
|
||||||
|
}
|
||||||
|
|
||||||
return stringbuilder.append(']').toString();
|
public int hashCode() {
|
||||||
}
|
return super.hashCode() ^ this.list.hashCode();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Adds the provided tag to the end of the list. There is no check to verify this tag is of the same type as any
|
|
||||||
* previous tag.
|
|
||||||
*/
|
|
||||||
public void appendTag(NBTBase nbt)
|
|
||||||
{
|
|
||||||
if (nbt.getId() == 0)
|
|
||||||
{
|
|
||||||
Log.IO.warn("Ungültiger End-Tag zu Tag-Liste hinzugefügt");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (this.tagType == 0)
|
|
||||||
{
|
|
||||||
this.tagType = nbt.getId();
|
|
||||||
}
|
|
||||||
else if (this.tagType != nbt.getId())
|
|
||||||
{
|
|
||||||
Log.IO.warn("Füge ungleiche Tag-Typen zu Tag-Liste hinzu");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.tagList.add(nbt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the given index to the given tag
|
|
||||||
*/
|
|
||||||
public void set(int idx, NBTBase nbt)
|
|
||||||
{
|
|
||||||
if (nbt.getId() == 0)
|
|
||||||
{
|
|
||||||
Log.IO.warn("Ungültiger End-Tag zu Tag-Liste hinzugefügt");
|
|
||||||
}
|
|
||||||
else if (idx >= 0 && idx < this.tagList.size())
|
|
||||||
{
|
|
||||||
if (this.tagType == 0)
|
|
||||||
{
|
|
||||||
this.tagType = nbt.getId();
|
|
||||||
}
|
|
||||||
else if (this.tagType != nbt.getId())
|
|
||||||
{
|
|
||||||
Log.IO.warn("Füge ungleiche Tag-Typen zu Tag-Liste hinzu");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.tagList.set(idx, nbt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.IO.warn("Index außerhalb des Bereiches um Tag in Tag-Liste zu setzen");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a tag at the given index.
|
|
||||||
*/
|
|
||||||
public NBTBase removeTag(int i)
|
|
||||||
{
|
|
||||||
return (NBTBase)this.tagList.remove(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this compound has no tags.
|
|
||||||
*/
|
|
||||||
public boolean hasNoTags()
|
|
||||||
{
|
|
||||||
return this.tagList.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the NBTTagCompound at the specified index in the list
|
|
||||||
*/
|
|
||||||
public NBTTagCompound getCompoundTagAt(int i)
|
|
||||||
{
|
|
||||||
if (i >= 0 && i < this.tagList.size())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagList.get(i);
|
|
||||||
return nbtbase.getId() == 10 ? (NBTTagCompound)nbtbase : new NBTTagCompound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new NBTTagCompound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getIntArrayAt(int i)
|
|
||||||
{
|
|
||||||
if (i >= 0 && i < this.tagList.size())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagList.get(i);
|
|
||||||
return nbtbase.getId() == 11 ? ((NBTTagIntArray)nbtbase).getIntArray() : new int[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new int[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDoubleAt(int i)
|
|
||||||
{
|
|
||||||
if (i >= 0 && i < this.tagList.size())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagList.get(i);
|
|
||||||
return nbtbase.getId() == 6 ? ((NBTTagDouble)nbtbase).getDouble() : 0.0D;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0.0D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloatAt(int i)
|
|
||||||
{
|
|
||||||
if (i >= 0 && i < this.tagList.size())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagList.get(i);
|
|
||||||
return nbtbase.getId() == 5 ? ((NBTTagFloat)nbtbase).getFloat() : 0.0F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the tag String value at the specified index in the list
|
|
||||||
*/
|
|
||||||
public String getStringTagAt(int i)
|
|
||||||
{
|
|
||||||
if (i >= 0 && i < this.tagList.size())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = (NBTBase)this.tagList.get(i);
|
|
||||||
return nbtbase.getId() == 8 ? nbtbase.getString() : nbtbase.toString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the tag at the given position
|
|
||||||
*/
|
|
||||||
public NBTBase get(int idx)
|
|
||||||
{
|
|
||||||
return (NBTBase)(idx >= 0 && idx < this.tagList.size() ? (NBTBase)this.tagList.get(idx) : new NBTTagEnd());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of tags in the list.
|
|
||||||
*/
|
|
||||||
public int tagCount()
|
|
||||||
{
|
|
||||||
return this.tagList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
|
||||||
{
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
|
||||||
nbttaglist.tagType = this.tagType;
|
|
||||||
|
|
||||||
for (NBTBase nbtbase : this.tagList)
|
|
||||||
{
|
|
||||||
NBTBase nbtbase1 = nbtbase.copy();
|
|
||||||
nbttaglist.tagList.add(nbtbase1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nbttaglist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
|
||||||
{
|
|
||||||
if (super.equals(p_equals_1_))
|
|
||||||
{
|
|
||||||
NBTTagList nbttaglist = (NBTTagList)p_equals_1_;
|
|
||||||
|
|
||||||
if (this.tagType == nbttaglist.tagType)
|
|
||||||
{
|
|
||||||
return this.tagList.equals(nbttaglist.tagList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return super.hashCode() ^ this.tagList.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTagType()
|
|
||||||
{
|
|
||||||
return this.tagType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagLong extends NBTBase.NBTPrimitive
|
class NBTTagLong extends NBTBase
|
||||||
{
|
{
|
||||||
/** The long value for the tag. */
|
|
||||||
private long data;
|
private long data;
|
||||||
|
|
||||||
NBTTagLong()
|
NBTTagLong()
|
||||||
|
@ -18,23 +17,17 @@ public class NBTTagLong extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeLong(this.data);
|
output.writeLong(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(128L);
|
sizeTracker.read(16);
|
||||||
this.data = input.readLong();
|
this.data = input.readLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)4;
|
return (byte)4;
|
||||||
|
@ -45,19 +38,16 @@ public class NBTTagLong extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data + "L";
|
return "" + this.data + "L";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagLong(this.data);
|
return new NBTTagLong(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagLong nbttaglong = (NBTTagLong)p_equals_1_;
|
NBTTagLong nbttaglong = (NBTTagLong)other;
|
||||||
return this.data == nbttaglong.data;
|
return this.data == nbttaglong.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,29 +65,4 @@ public class NBTTagLong extends NBTBase.NBTPrimitive
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInt()
|
|
||||||
{
|
|
||||||
return (int)(this.data & -1L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getShort()
|
|
||||||
{
|
|
||||||
return (short)((int)(this.data & 65535L));
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getByte()
|
|
||||||
{
|
|
||||||
return (byte)((int)(this.data & 255L));
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble()
|
|
||||||
{
|
|
||||||
return (double)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloat()
|
|
||||||
{
|
|
||||||
return (float)this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagShort extends NBTBase.NBTPrimitive
|
class NBTTagShort extends NBTBase
|
||||||
{
|
{
|
||||||
/** The short value for the tag. */
|
|
||||||
private short data;
|
private short data;
|
||||||
|
|
||||||
public NBTTagShort()
|
public NBTTagShort()
|
||||||
|
@ -18,23 +17,17 @@ public class NBTTagShort extends NBTBase.NBTPrimitive
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
|
||||||
*/
|
|
||||||
void write(DataOutput output) throws IOException
|
void write(DataOutput output) throws IOException
|
||||||
{
|
{
|
||||||
output.writeShort(this.data);
|
output.writeShort(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
void read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException
|
||||||
{
|
{
|
||||||
sizeTracker.read(80L);
|
sizeTracker.read(10);
|
||||||
this.data = input.readShort();
|
this.data = input.readShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type byte for the tag.
|
|
||||||
*/
|
|
||||||
public byte getId()
|
public byte getId()
|
||||||
{
|
{
|
||||||
return (byte)2;
|
return (byte)2;
|
||||||
|
@ -45,19 +38,16 @@ public class NBTTagShort extends NBTBase.NBTPrimitive
|
||||||
return "" + this.data + "s";
|
return "" + this.data + "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a clone of the tag.
|
|
||||||
*/
|
|
||||||
public NBTBase copy()
|
public NBTBase copy()
|
||||||
{
|
{
|
||||||
return new NBTTagShort(this.data);
|
return new NBTTagShort(this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
if (super.equals(p_equals_1_))
|
if (super.equals(other))
|
||||||
{
|
{
|
||||||
NBTTagShort nbttagshort = (NBTTagShort)p_equals_1_;
|
NBTTagShort nbttagshort = (NBTTagShort)other;
|
||||||
return this.data == nbttagshort.data;
|
return this.data == nbttagshort.data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -71,33 +61,8 @@ public class NBTTagShort extends NBTBase.NBTPrimitive
|
||||||
return super.hashCode() ^ this.data;
|
return super.hashCode() ^ this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong()
|
|
||||||
{
|
|
||||||
return (long)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInt()
|
|
||||||
{
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getShort()
|
public short getShort()
|
||||||
{
|
{
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getByte()
|
|
||||||
{
|
|
||||||
return (byte)(this.data & 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble()
|
|
||||||
{
|
|
||||||
return (double)this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getFloat()
|
|
||||||
{
|
|
||||||
return (float)this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,90 +4,53 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NBTTagString extends NBTBase
|
class NBTTagString extends NBTBase {
|
||||||
{
|
private String data;
|
||||||
/** The string value for the tag (cannot be empty). */
|
|
||||||
private String data;
|
|
||||||
|
|
||||||
public NBTTagString()
|
public NBTTagString() {
|
||||||
{
|
this.data = "";
|
||||||
this.data = "";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public NBTTagString(String data)
|
public NBTTagString(String data) {
|
||||||
{
|
if(data == null)
|
||||||
this.data = data;
|
throw new IllegalArgumentException("null is not allowed");
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
if (data == null)
|
void write(DataOutput output) throws IOException {
|
||||||
{
|
output.writeUTF(this.data);
|
||||||
throw new IllegalArgumentException("Empty string not allowed");
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
void read(DataInput input, int depth, SizeTracker tracker) throws IOException {
|
||||||
* Write the actual data contents of the tag, implemented in NBT extension classes
|
tracker.read(36);
|
||||||
*/
|
this.data = input.readUTF();
|
||||||
void write(DataOutput output) throws IOException
|
tracker.read(2 * this.data.length());
|
||||||
{
|
}
|
||||||
output.writeUTF(this.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
|
public byte getId() {
|
||||||
{
|
return (byte)8;
|
||||||
sizeTracker.read(288L);
|
}
|
||||||
this.data = input.readUTF();
|
|
||||||
sizeTracker.read((long)(16 * this.data.length()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public String toString() {
|
||||||
* Gets the type byte for the tag.
|
return "\"" + this.data.replace("\"", "\\\"") + "\"";
|
||||||
*/
|
}
|
||||||
public byte getId()
|
|
||||||
{
|
|
||||||
return (byte)8;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public NBTBase copy() {
|
||||||
{
|
return new NBTTagString(this.data);
|
||||||
return "\"" + this.data.replace("\"", "\\\"") + "\"";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public boolean equals(Object other) {
|
||||||
* Creates a clone of the tag.
|
if(!super.equals(other))
|
||||||
*/
|
return false;
|
||||||
public NBTBase copy()
|
NBTTagString tag = (NBTTagString)other;
|
||||||
{
|
return this.data == null && tag.data == null || this.data != null && this.data.equals(tag.data);
|
||||||
return new NBTTagString(this.data);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public int hashCode() {
|
||||||
* Return whether this compound has no tags.
|
return super.hashCode() ^ this.data.hashCode();
|
||||||
*/
|
}
|
||||||
public boolean hasNoTags()
|
|
||||||
{
|
|
||||||
return this.data.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object p_equals_1_)
|
public String getString() {
|
||||||
{
|
return this.data;
|
||||||
if (!super.equals(p_equals_1_))
|
}
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NBTTagString nbttagstring = (NBTTagString)p_equals_1_;
|
|
||||||
return this.data == null && nbttagstring.data == null || this.data != null && this.data.equals(nbttagstring.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return super.hashCode() ^ this.data.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getString()
|
|
||||||
{
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
27
common/src/main/java/common/nbt/NBTTagStringList.java
Normal file
27
common/src/main/java/common/nbt/NBTTagStringList.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class NBTTagStringList extends NBTTagList<NBTTagString> {
|
||||||
|
public byte getId() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagList<NBTTagString> createInstance() {
|
||||||
|
return new NBTTagStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagString getDefault() {
|
||||||
|
return new NBTTagString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString(int index) {
|
||||||
|
return this.get(index).getString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String value) {
|
||||||
|
this.add(new NBTTagString(value));
|
||||||
|
}
|
||||||
|
}
|
27
common/src/main/java/common/nbt/NBTTagTagList.java
Normal file
27
common/src/main/java/common/nbt/NBTTagTagList.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class NBTTagTagList extends NBTTagList<NBTTagCompound> {
|
||||||
|
public byte getId() {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagList<NBTTagCompound> createInstance() {
|
||||||
|
return new NBTTagTagList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound getDefault() {
|
||||||
|
return new NBTTagCompound();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound getTag(int index) {
|
||||||
|
return this.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(NBTTagCompound value) {
|
||||||
|
super.add(value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,79 +0,0 @@
|
||||||
package common.nbt;
|
|
||||||
|
|
||||||
public final class NBTUtil
|
|
||||||
{
|
|
||||||
public static boolean compareTags(NBTBase tag1, NBTBase tag2, boolean lists)
|
|
||||||
{
|
|
||||||
if (tag1 == tag2)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (tag1 == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (tag2 == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (!tag1.getClass().equals(tag2.getClass()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (tag1 instanceof NBTTagCompound)
|
|
||||||
{
|
|
||||||
NBTTagCompound nbttagcompound = (NBTTagCompound)tag1;
|
|
||||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound)tag2;
|
|
||||||
|
|
||||||
for (String s : nbttagcompound.getKeySet())
|
|
||||||
{
|
|
||||||
NBTBase nbtbase1 = nbttagcompound.getTag(s);
|
|
||||||
|
|
||||||
if (!compareTags(nbtbase1, nbttagcompound1.getTag(s), lists))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (tag1 instanceof NBTTagList && lists)
|
|
||||||
{
|
|
||||||
NBTTagList nbttaglist = (NBTTagList)tag1;
|
|
||||||
NBTTagList nbttaglist1 = (NBTTagList)tag2;
|
|
||||||
|
|
||||||
if (nbttaglist.tagCount() == 0)
|
|
||||||
{
|
|
||||||
return nbttaglist1.tagCount() == 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
|
||||||
{
|
|
||||||
NBTBase nbtbase = nbttaglist.get(i);
|
|
||||||
boolean flag = false;
|
|
||||||
|
|
||||||
for (int j = 0; j < nbttaglist1.tagCount(); ++j)
|
|
||||||
{
|
|
||||||
if (compareTags(nbtbase, nbttaglist1.get(j), lists))
|
|
||||||
{
|
|
||||||
flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!flag)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return tag1.equals(tag2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
22
common/src/main/java/common/nbt/SizeTracker.java
Executable file
22
common/src/main/java/common/nbt/SizeTracker.java
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
package common.nbt;
|
||||||
|
|
||||||
|
public class SizeTracker {
|
||||||
|
public static final SizeTracker INFINITE = new SizeTracker(0) {
|
||||||
|
public void read(int bytes) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private final int max;
|
||||||
|
|
||||||
|
private int read;
|
||||||
|
|
||||||
|
public SizeTracker(int max) {
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void read(int bytes) {
|
||||||
|
this.read += bytes;
|
||||||
|
if(this.read > this.max)
|
||||||
|
throw new RuntimeException("Versuchte einen Tag zu lesen, der zu groß war: Habe " + this.read + " Bytes, " + this.max + " Bytes maximal erlaubt");
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import java.nio.charset.Charset;
|
||||||
import common.init.ItemRegistry;
|
import common.init.ItemRegistry;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTLoader;
|
import common.nbt.NBTLoader;
|
||||||
import common.nbt.NBTSizeTracker;
|
import common.nbt.SizeTracker;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.net.buffer.ByteBuf;
|
import common.net.buffer.ByteBuf;
|
||||||
import common.net.buffer.ByteBufInputStream;
|
import common.net.buffer.ByteBufInputStream;
|
||||||
|
@ -111,7 +111,7 @@ public class PacketBuffer {
|
||||||
if(b == 0)
|
if(b == 0)
|
||||||
return null;
|
return null;
|
||||||
this.buf.readerIndex(i);
|
this.buf.readerIndex(i);
|
||||||
return NBTLoader.read(new ByteBufInputStream(this.buf), new NBTSizeTracker(2097152L));
|
return NBTLoader.read(new ByteBufInputStream(this.buf), new SizeTracker(2097152));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeItemStack(ItemStack stack) {
|
public void writeItemStack(ItemStack stack) {
|
||||||
|
|
|
@ -69,9 +69,9 @@ public class SPacketTrades implements Packet<IClientPlayer>
|
||||||
for (int i = 0; i < this.recipes.size(); ++i)
|
for (int i = 0; i < this.recipes.size(); ++i)
|
||||||
{
|
{
|
||||||
MerchantRecipe merchantrecipe = (MerchantRecipe)this.recipes.get(i);
|
MerchantRecipe merchantrecipe = (MerchantRecipe)this.recipes.get(i);
|
||||||
buf.writeItemStack(merchantrecipe.getItemToBuy());
|
buf.writeItemStack(merchantrecipe.getBuying());
|
||||||
buf.writeItemStack(merchantrecipe.getItemToSell());
|
buf.writeItemStack(merchantrecipe.getSelling());
|
||||||
ItemStack itemstack = merchantrecipe.getSecondItemToBuy();
|
ItemStack itemstack = merchantrecipe.getSecondBuy();
|
||||||
buf.writeBoolean(itemstack != null);
|
buf.writeBoolean(itemstack != null);
|
||||||
|
|
||||||
if (itemstack != null)
|
if (itemstack != null)
|
||||||
|
|
|
@ -139,16 +139,16 @@ public class PotionEffect {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setString("Type", this.potion.getName());
|
nbt.setString("Type", this.potion.getName());
|
||||||
nbt.setByte("Amplifier", (byte)this.amplifier);
|
nbt.setByte("Amplifier", (byte)this.amplifier);
|
||||||
nbt.setInteger("Duration", this.duration);
|
nbt.setInt("Duration", this.duration);
|
||||||
nbt.setInteger("Remaining", this.remaining);
|
nbt.setInt("Remaining", this.remaining);
|
||||||
nbt.setBoolean("Ambient", this.ambient);
|
nbt.setBool("Ambient", this.ambient);
|
||||||
nbt.setBoolean("Particles", this.particles);
|
nbt.setBool("Particles", this.particles);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionEffect fromNbt(NBTTagCompound nbt) {
|
public static PotionEffect fromNbt(NBTTagCompound nbt) {
|
||||||
Potion potion = Potion.getByName(nbt.getString("Type"));
|
Potion potion = Potion.getByName(nbt.getString("Type"));
|
||||||
return potion == null ? null : new PotionEffect(potion, nbt.getInteger("Duration"), (int)(nbt.getByte("Amplifier") & 255), nbt.getBoolean("Ambient"), nbt.getBoolean("Particles"))
|
return potion == null ? null : new PotionEffect(potion, nbt.getInt("Duration"), (int)(nbt.getByte("Amplifier") & 255), nbt.getBool("Ambient"), nbt.getBool("Particles"))
|
||||||
.setRemaining(nbt.getInteger("Remaining"));
|
.setRemaining(nbt.getInt("Remaining"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class LockCode
|
||||||
|
|
||||||
public static LockCode fromNBT(NBTTagCompound nbt)
|
public static LockCode fromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
if (nbt.hasKey("Lock", 8))
|
if (nbt.hasString("Lock"))
|
||||||
{
|
{
|
||||||
String s = nbt.getString("Lock");
|
String s = nbt.getString("Lock");
|
||||||
return new LockCode(s);
|
return new LockCode(s);
|
||||||
|
|
|
@ -24,19 +24,19 @@ public class MachineResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNbt(NBTTagCompound tag) {
|
public void readFromNbt(NBTTagCompound tag) {
|
||||||
this.amount = tag.getInteger("Amount");
|
this.amount = tag.getInt("Amount");
|
||||||
this.capacity = tag.getInteger("Capacity");
|
this.capacity = tag.getInt("Capacity");
|
||||||
this.undercharge = tag.getInteger("Under");
|
this.undercharge = tag.getInt("Under");
|
||||||
this.overcharge = tag.getInteger("Over");
|
this.overcharge = tag.getInt("Over");
|
||||||
this.entropy = tag.getInteger("Entropy");
|
this.entropy = tag.getInt("Entropy");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNbt(NBTTagCompound tag) {
|
public void writeToNbt(NBTTagCompound tag) {
|
||||||
tag.setInteger("Amount", this.amount);
|
tag.setInt("Amount", this.amount);
|
||||||
tag.setInteger("Capacity", this.capacity);
|
tag.setInt("Capacity", this.capacity);
|
||||||
tag.setInteger("Under", this.undercharge);
|
tag.setInt("Under", this.undercharge);
|
||||||
tag.setInteger("Over", this.overcharge);
|
tag.setInt("Over", this.overcharge);
|
||||||
tag.setInteger("Entropy", this.entropy);
|
tag.setInt("Entropy", this.entropy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(int value) {
|
public void setValue(int value) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public abstract class TileEntity
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z"));
|
this.pos = new BlockPos(compound.getInt("x"), compound.getInt("y"), compound.getInt("z"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound compound)
|
public void writeToNBT(NBTTagCompound compound)
|
||||||
|
@ -69,9 +69,9 @@ public abstract class TileEntity
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
compound.setString("id", s);
|
compound.setString("id", s);
|
||||||
compound.setInteger("x", this.pos.getX());
|
compound.setInt("x", this.pos.getX());
|
||||||
compound.setInteger("y", this.pos.getY());
|
compound.setInt("y", this.pos.getY());
|
||||||
compound.setInteger("z", this.pos.getZ());
|
compound.setInt("z", this.pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import common.init.Blocks;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.network.Packet;
|
import common.network.Packet;
|
||||||
import common.packet.SPacketUpdateTileEntity;
|
import common.packet.SPacketUpdateTileEntity;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class TileEntityBanner extends TileEntity
|
||||||
private int baseColor;
|
private int baseColor;
|
||||||
|
|
||||||
/** A list of all the banner patterns. */
|
/** A list of all the banner patterns. */
|
||||||
private NBTTagList patterns;
|
private NBTTagTagList patterns;
|
||||||
private boolean field_175119_g;
|
private boolean field_175119_g;
|
||||||
private List<TileEntityBanner.EnumBannerPattern> patternList;
|
private List<TileEntityBanner.EnumBannerPattern> patternList;
|
||||||
private List<DyeColor> colorList;
|
private List<DyeColor> colorList;
|
||||||
|
@ -32,18 +32,18 @@ public class TileEntityBanner extends TileEntity
|
||||||
{
|
{
|
||||||
this.patterns = null;
|
this.patterns = null;
|
||||||
|
|
||||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10))
|
if (stack.hasTagCompound() && stack.getTagCompound().hasTag("BlockEntityTag"))
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("BlockEntityTag");
|
NBTTagCompound nbttagcompound = stack.getTagCompound().getTag("BlockEntityTag");
|
||||||
|
|
||||||
if (nbttagcompound.hasKey("Patterns"))
|
if (nbttagcompound.hasTagList("Patterns"))
|
||||||
{
|
{
|
||||||
this.patterns = (NBTTagList)nbttagcompound.getTagList("Patterns", 10).copy();
|
this.patterns = (NBTTagTagList)nbttagcompound.getTagList("Patterns").copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbttagcompound.hasKey("Base", 99))
|
if (nbttagcompound.hasInt("Base"))
|
||||||
{
|
{
|
||||||
this.baseColor = nbttagcompound.getInteger("Base");
|
this.baseColor = nbttagcompound.getInt("Base");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -67,21 +67,21 @@ public class TileEntityBanner extends TileEntity
|
||||||
setBaseColorAndPatterns(compound, this.baseColor, this.patterns);
|
setBaseColorAndPatterns(compound, this.baseColor, this.patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBaseColorAndPatterns(NBTTagCompound compound, int baseColorIn, NBTTagList patternsIn)
|
public static void setBaseColorAndPatterns(NBTTagCompound compound, int baseColorIn, NBTTagTagList patternsIn)
|
||||||
{
|
{
|
||||||
compound.setInteger("Base", baseColorIn);
|
compound.setInt("Base", baseColorIn);
|
||||||
|
|
||||||
if (patternsIn != null)
|
if (patternsIn != null)
|
||||||
{
|
{
|
||||||
compound.setTag("Patterns", patternsIn);
|
compound.setTagList("Patterns", patternsIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.baseColor = compound.getInteger("Base");
|
this.baseColor = compound.getInt("Base");
|
||||||
this.patterns = compound.getTagList("Patterns", 10);
|
this.patterns = compound.getTagList("Patterns");
|
||||||
this.patternList = null;
|
this.patternList = null;
|
||||||
this.colorList = null;
|
this.colorList = null;
|
||||||
this.patternResourceLocation = null;
|
this.patternResourceLocation = null;
|
||||||
|
@ -105,7 +105,7 @@ public class TileEntityBanner extends TileEntity
|
||||||
public static int getBaseColor(ItemStack stack)
|
public static int getBaseColor(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
||||||
return nbttagcompound != null && nbttagcompound.hasKey("Base") ? nbttagcompound.getInteger("Base") : stack.getMetadata();
|
return nbttagcompound != null && nbttagcompound.hasInt("Base") ? nbttagcompound.getInt("Base") : stack.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,7 +114,7 @@ public class TileEntityBanner extends TileEntity
|
||||||
public static int getPatterns(ItemStack stack)
|
public static int getPatterns(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
||||||
return nbttagcompound != null && nbttagcompound.hasKey("Patterns") ? nbttagcompound.getTagList("Patterns", 10).tagCount() : 0;
|
return nbttagcompound != null && nbttagcompound.hasTagList("Patterns") ? nbttagcompound.getTagList("Patterns").size() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TileEntityBanner.EnumBannerPattern> getPatternList()
|
public List<TileEntityBanner.EnumBannerPattern> getPatternList()
|
||||||
|
@ -123,7 +123,7 @@ public class TileEntityBanner extends TileEntity
|
||||||
return this.patternList;
|
return this.patternList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagList getPatterns()
|
public NBTTagTagList getPatterns()
|
||||||
{
|
{
|
||||||
return this.patterns;
|
return this.patterns;
|
||||||
}
|
}
|
||||||
|
@ -162,15 +162,15 @@ public class TileEntityBanner extends TileEntity
|
||||||
|
|
||||||
if (this.patterns != null)
|
if (this.patterns != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.patterns.tagCount(); ++i)
|
for (int i = 0; i < this.patterns.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = this.patterns.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = this.patterns.getTag(i);
|
||||||
TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern"));
|
TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern"));
|
||||||
|
|
||||||
if (tileentitybanner$enumbannerpattern != null)
|
if (tileentitybanner$enumbannerpattern != null)
|
||||||
{
|
{
|
||||||
this.patternList.add(tileentitybanner$enumbannerpattern);
|
this.patternList.add(tileentitybanner$enumbannerpattern);
|
||||||
int j = nbttagcompound.getInteger("Color");
|
int j = nbttagcompound.getInt("Color");
|
||||||
this.colorList.add(DyeColor.byDyeDamage(j));
|
this.colorList.add(DyeColor.byDyeDamage(j));
|
||||||
this.patternResourceLocation = this.patternResourceLocation + tileentitybanner$enumbannerpattern.getPatternID() + j;
|
this.patternResourceLocation = this.patternResourceLocation + tileentitybanner$enumbannerpattern.getPatternID() + j;
|
||||||
}
|
}
|
||||||
|
@ -191,19 +191,19 @@ public class TileEntityBanner extends TileEntity
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
|
||||||
|
|
||||||
if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9))
|
if (nbttagcompound != null && nbttagcompound.hasTagList("Patterns"))
|
||||||
{
|
{
|
||||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);
|
NBTTagTagList nbttaglist = nbttagcompound.getTagList("Patterns");
|
||||||
|
|
||||||
if (nbttaglist.tagCount() > 0)
|
if (nbttaglist.size() > 0)
|
||||||
{
|
{
|
||||||
nbttaglist.removeTag(nbttaglist.tagCount() - 1);
|
nbttaglist.remove(nbttaglist.size() - 1);
|
||||||
|
|
||||||
if (nbttaglist.hasNoTags())
|
if (nbttaglist.isEmpty())
|
||||||
{
|
{
|
||||||
stack.getTagCompound().removeTag("BlockEntityTag");
|
stack.getTagCompound().remove("BlockEntityTag");
|
||||||
|
|
||||||
if (stack.getTagCompound().hasNoTags())
|
if (stack.getTagCompound().isEmpty())
|
||||||
{
|
{
|
||||||
stack.setTagCompound((NBTTagCompound)null);
|
stack.setTagCompound((NBTTagCompound)null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,9 +304,9 @@ public class TileEntityBeacon extends TileEntity implements ITickable
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.primaryEffect = compound.hasKey("Primary", 8) ? this.getEffect(compound.getString("Primary")) : null;
|
this.primaryEffect = compound.hasString("Primary") ? this.getEffect(compound.getString("Primary")) : null;
|
||||||
this.secondaryEffect = compound.hasKey("Secondary", 8) ? this.getEffect(compound.getString("Secondary")) : null;
|
this.secondaryEffect = compound.hasString("Secondary") ? this.getEffect(compound.getString("Secondary")) : null;
|
||||||
this.levels = compound.getInteger("Levels");
|
this.levels = compound.getInt("Levels");
|
||||||
// try {
|
// try {
|
||||||
this.beamColor = DyeColor.getByName(compound.getString("Color"));
|
this.beamColor = DyeColor.getByName(compound.getString("Color"));
|
||||||
// }
|
// }
|
||||||
|
@ -322,7 +322,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable
|
||||||
compound.setString("Primary", this.primaryEffect.getName());
|
compound.setString("Primary", this.primaryEffect.getName());
|
||||||
if(this.secondaryEffect != null)
|
if(this.secondaryEffect != null)
|
||||||
compound.setString("Secondary", this.secondaryEffect.getName());
|
compound.setString("Secondary", this.secondaryEffect.getName());
|
||||||
compound.setInteger("Levels", this.levels);
|
compound.setInt("Levels", this.levels);
|
||||||
compound.setString("Color", this.beamColor.getName());
|
compound.setString("Color", this.beamColor.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import common.item.Item;
|
||||||
import common.item.ItemPotion;
|
import common.item.ItemPotion;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.potion.PotionEffect;
|
import common.potion.PotionEffect;
|
||||||
import common.potion.PotionHelper;
|
import common.potion.PotionHelper;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -230,12 +230,12 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.brewingItemStacks = new ItemStack[this.getSizeInventory()];
|
this.brewingItemStacks = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot");
|
int j = nbttagcompound.getByte("Slot");
|
||||||
|
|
||||||
if (j >= 0 && j < this.brewingItemStacks.length)
|
if (j >= 0 && j < this.brewingItemStacks.length)
|
||||||
|
@ -246,7 +246,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
||||||
|
|
||||||
this.brewTime = compound.getShort("BrewTime");
|
this.brewTime = compound.getShort("BrewTime");
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.customName = compound.getString("CustomName");
|
this.customName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
||||||
{
|
{
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
compound.setShort("BrewTime", (short)this.brewTime);
|
compound.setShort("BrewTime", (short)this.brewTime);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.brewingItemStacks.length; ++i)
|
for (int i = 0; i < this.brewingItemStacks.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -265,11 +265,11 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.brewingItemStacks[i].writeToNBT(nbttagcompound);
|
this.brewingItemStacks[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.inventory.InventoryLargeChest;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -164,17 +164,17 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
this.chestContents = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.customName = compound.getString("CustomName");
|
this.customName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 0 && j < this.chestContents.length)
|
if (j >= 0 && j < this.chestContents.length)
|
||||||
|
@ -187,7 +187,7 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
||||||
public void writeToNBT(NBTTagCompound compound)
|
public void writeToNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.chestContents.length; ++i)
|
for (int i = 0; i < this.chestContents.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -196,11 +196,11 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.chestContents[i].writeToNBT(nbttagcompound);
|
this.chestContents[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,13 +9,13 @@ public class TileEntityComparator extends TileEntity
|
||||||
public void writeToNBT(NBTTagCompound compound)
|
public void writeToNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
compound.setInteger("OutputSignal", this.outputSignal);
|
compound.setInt("OutputSignal", this.outputSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.outputSignal = compound.getInteger("OutputSignal");
|
this.outputSignal = compound.getInt("OutputSignal");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOutputSignal()
|
public int getOutputSignal()
|
||||||
|
|
|
@ -7,7 +7,7 @@ import common.inventory.IInventory;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
|
|
||||||
public class TileEntityDispenser extends TileEntityLockable implements IInventory
|
public class TileEntityDispenser extends TileEntityLockable implements IInventory
|
||||||
|
@ -155,12 +155,12 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.stacks = new ItemStack[this.getSizeInventory()];
|
this.stacks = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot") & 255;
|
int j = nbttagcompound.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 0 && j < this.stacks.length)
|
if (j >= 0 && j < this.stacks.length)
|
||||||
|
@ -169,7 +169,7 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.customName = compound.getString("CustomName");
|
this.customName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
||||||
public void writeToNBT(NBTTagCompound compound)
|
public void writeToNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.stacks.length; ++i)
|
for (int i = 0; i < this.stacks.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -187,11 +187,11 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.stacks[i].writeToNBT(nbttagcompound);
|
this.stacks[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class TileEntityEnchantmentTable extends TileEntity implements ITickable,
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.customName = compound.getString("CustomName");
|
this.customName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import common.item.ItemStack;
|
||||||
import common.item.ItemSword;
|
import common.item.ItemSword;
|
||||||
import common.item.ItemTool;
|
import common.item.ItemTool;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
|
||||||
|
@ -159,12 +159,12 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
|
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot");
|
int j = nbttagcompound.getByte("Slot");
|
||||||
|
|
||||||
if (j >= 0 && j < this.furnaceItemStacks.length)
|
if (j >= 0 && j < this.furnaceItemStacks.length)
|
||||||
|
@ -178,7 +178,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
||||||
this.totalCookTime = compound.getShort("CookTimeTotal");
|
this.totalCookTime = compound.getShort("CookTimeTotal");
|
||||||
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
|
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.furnaceCustomName = compound.getString("CustomName");
|
this.furnaceCustomName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
||||||
compound.setShort("BurnTime", (short)this.furnaceBurnTime);
|
compound.setShort("BurnTime", (short)this.furnaceBurnTime);
|
||||||
compound.setShort("CookTime", (short)this.cookTime);
|
compound.setShort("CookTime", (short)this.cookTime);
|
||||||
compound.setShort("CookTimeTotal", (short)this.totalCookTime);
|
compound.setShort("CookTimeTotal", (short)this.totalCookTime);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.furnaceItemStacks.length; ++i)
|
for (int i = 0; i < this.furnaceItemStacks.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -199,11 +199,11 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.furnaceItemStacks[i].writeToNBT(nbttagcompound);
|
this.furnaceItemStacks[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ import common.inventory.ISidedInventory;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
|
@ -33,19 +33,19 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
|
||||||
public void readFromNBT(NBTTagCompound compound)
|
public void readFromNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.inventory = new ItemStack[this.getSizeInventory()];
|
this.inventory = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
if (compound.hasKey("CustomName", 8))
|
if (compound.hasString("CustomName"))
|
||||||
{
|
{
|
||||||
this.customName = compound.getString("CustomName");
|
this.customName = compound.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.transferCooldown = compound.getInteger("TransferCooldown");
|
this.transferCooldown = compound.getInt("TransferCooldown");
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot");
|
int j = nbttagcompound.getByte("Slot");
|
||||||
|
|
||||||
if (j >= 0 && j < this.inventory.length)
|
if (j >= 0 && j < this.inventory.length)
|
||||||
|
@ -58,7 +58,7 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
|
||||||
public void writeToNBT(NBTTagCompound compound)
|
public void writeToNBT(NBTTagCompound compound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.inventory.length; ++i)
|
for (int i = 0; i < this.inventory.length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -67,12 +67,12 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.inventory[i].writeToNBT(nbttagcompound);
|
this.inventory[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
compound.setInteger("TransferCooldown", this.transferCooldown);
|
compound.setInt("TransferCooldown", this.transferCooldown);
|
||||||
|
|
||||||
if (this.hasCustomName())
|
if (this.hasCustomName())
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import common.inventory.ContainerMachine;
|
||||||
import common.inventory.InventoryPlayer;
|
import common.inventory.InventoryPlayer;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.nbt.NBTTagCompound;
|
import common.nbt.NBTTagCompound;
|
||||||
import common.nbt.NBTTagList;
|
import common.nbt.NBTTagTagList;
|
||||||
import common.network.Packet;
|
import common.network.Packet;
|
||||||
import common.packet.SPacketUpdateTileEntity;
|
import common.packet.SPacketUpdateTileEntity;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
|
@ -82,10 +82,10 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH
|
||||||
public void readFromNBT(NBTTagCompound compound) {
|
public void readFromNBT(NBTTagCompound compound) {
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
|
||||||
NBTTagList nbttaglist = compound.getTagList("Items", 10);
|
NBTTagTagList nbttaglist = compound.getTagList("Items");
|
||||||
this.clear();
|
this.clear();
|
||||||
for(int i = 0; i < nbttaglist.tagCount(); ++i) {
|
for(int i = 0; i < nbttaglist.size(); ++i) {
|
||||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound = nbttaglist.getTag(i);
|
||||||
int j = nbttagcompound.getByte("Slot");
|
int j = nbttagcompound.getByte("Slot");
|
||||||
|
|
||||||
if(j >= 0 && j < this.inventory.length) {
|
if(j >= 0 && j < this.inventory.length) {
|
||||||
|
@ -93,43 +93,43 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nbttaglist = compound.getTagList("Resources", 10);
|
nbttaglist = compound.getTagList("Resources");
|
||||||
for(MachineResource res : this.resources) {
|
for(MachineResource res : this.resources) {
|
||||||
res.reset();
|
res.reset();
|
||||||
}
|
}
|
||||||
for(int i = 0; i < nbttaglist.tagCount() && i < this.inventory.length; ++i) {
|
for(int i = 0; i < nbttaglist.size() && i < this.inventory.length; ++i) {
|
||||||
this.resources[i].readFromNbt(nbttaglist.getCompoundTagAt(i));
|
this.resources[i].readFromNbt(nbttaglist.getTag(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.isCreative = compound.getBoolean("Creative");
|
// this.isCreative = compound.getBoolean("Creative");
|
||||||
this.temperature = compound.getInteger("Temperature");
|
this.temperature = compound.getInt("Temperature");
|
||||||
this.status = Status.values()[(int)compound.getByte("Status") % Status.values().length];
|
this.status = Status.values()[(int)compound.getByte("Status") % Status.values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound compound) {
|
public void writeToNBT(NBTTagCompound compound) {
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagTagList nbttaglist = new NBTTagTagList();
|
||||||
for(int i = 0; i < this.inventory.length; ++i) {
|
for(int i = 0; i < this.inventory.length; ++i) {
|
||||||
if(this.inventory[i] != null) {
|
if(this.inventory[i] != null) {
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
nbttagcompound.setByte("Slot", (byte)i);
|
nbttagcompound.setByte("Slot", (byte)i);
|
||||||
this.inventory[i].writeToNBT(nbttagcompound);
|
this.inventory[i].writeToNBT(nbttagcompound);
|
||||||
nbttaglist.appendTag(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compound.setTag("Items", nbttaglist);
|
compound.setTagList("Items", nbttaglist);
|
||||||
|
|
||||||
nbttaglist = new NBTTagList();
|
nbttaglist = new NBTTagTagList();
|
||||||
for(int z = 0; z < this.resources.length; z++) {
|
for(int z = 0; z < this.resources.length; z++) {
|
||||||
NBTTagCompound res = new NBTTagCompound();
|
NBTTagCompound res = new NBTTagCompound();
|
||||||
this.resources[z].writeToNbt(res);
|
this.resources[z].writeToNbt(res);
|
||||||
nbttaglist.appendTag(res);
|
nbttaglist.add(res);
|
||||||
}
|
}
|
||||||
compound.setTag("Resources", nbttaglist);
|
compound.setTagList("Resources", nbttaglist);
|
||||||
|
|
||||||
// compound.setBoolean("Creative", this.isCreative);
|
// compound.setBoolean("Creative", this.isCreative);
|
||||||
compound.setInteger("Temperature", this.temperature);
|
compound.setInt("Temperature", this.temperature);
|
||||||
compound.setByte("Status", (byte)this.status.ordinal());
|
compound.setByte("Status", (byte)this.status.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,20 +168,20 @@ public class TileEntityMobSpawner extends TileEntity implements ITickable
|
||||||
this.mobID = nbt.getString("EntityId");
|
this.mobID = nbt.getString("EntityId");
|
||||||
this.spawnDelay = nbt.getShort("Delay");
|
this.spawnDelay = nbt.getShort("Delay");
|
||||||
|
|
||||||
if (nbt.hasKey("MinSpawnDelay", 99))
|
if (nbt.hasShort("MinSpawnDelay"))
|
||||||
{
|
{
|
||||||
this.minSpawnDelay = nbt.getShort("MinSpawnDelay");
|
this.minSpawnDelay = nbt.getShort("MinSpawnDelay");
|
||||||
this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay");
|
this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay");
|
||||||
this.spawnCount = nbt.getShort("SpawnCount");
|
this.spawnCount = nbt.getShort("SpawnCount");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.hasKey("MaxNearbyEntities", 99))
|
if (nbt.hasShort("MaxNearbyEntities"))
|
||||||
{
|
{
|
||||||
this.maxNearbyEntities = nbt.getShort("MaxNearbyEntities");
|
this.maxNearbyEntities = nbt.getShort("MaxNearbyEntities");
|
||||||
this.activatingRangeFromPlayer = nbt.getShort("RequiredPlayerRange");
|
this.activatingRangeFromPlayer = nbt.getShort("RequiredPlayerRange");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.hasKey("SpawnRange", 99))
|
if (nbt.hasShort("SpawnRange"))
|
||||||
{
|
{
|
||||||
this.spawnRange = nbt.getShort("SpawnRange");
|
this.spawnRange = nbt.getShort("SpawnRange");
|
||||||
}
|
}
|
||||||
|
|
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