diff options
Diffstat (limited to 'src/main/java')
35 files changed, 80 insertions, 346 deletions
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 92013756..bd0377ae 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -47,7 +47,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); // CraftBukkit end - log.info("Starting minecraft server version 1.4.6"); + log.info("Starting minecraft server version 1.4.7"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 381a6312..ebe0ed06 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1165,7 +1165,7 @@ public abstract class Entity { // Reset the persistence for tamed animals if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) { - entity.persistent = !entity.bj(); + entity.persistent = !entity.isTypeNotPersistent(); } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index d35ba418..916b9dc9 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -250,11 +250,10 @@ public class EntityArrow extends Entity implements IProjectile { } } - // CraftBukkit start if (this.shooter != null) { EnchantmentThorns.a(this.shooter, entityliving, this.random); } - // CraftBukkit end + if (this.shooter != null && movingobjectposition.entity != this.shooter && movingobjectposition.entity instanceof EntityHuman && this.shooter instanceof EntityPlayer) { ((EntityPlayer) this.shooter).playerConnection.sendPacket(new Packet70Bed(6, 0)); } diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index ab778b40..1f64c1f6 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -32,7 +32,7 @@ public class EntityCreeper extends EntityMonster { } public int as() { - return this.aG() == null ? 3 : 3 + (this.health - 1); + return this.getGoalTarget() == null ? 3 : 3 + (this.health - 1); } protected void a(float f) { diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java index 65b8714c..64454f5b 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -2,8 +2,8 @@ package net.minecraft.server; public class EntityFireworks extends Entity { - private int a; - public int b; // CraftBukkit - private -> public + private int ticksFlown; + public int expectedLifespan; // CraftBukkit - private -> public public EntityFireworks(World world) { super(world); @@ -11,12 +11,12 @@ public class EntityFireworks extends Entity { } protected void a() { - this.datawatcher.a(8, new ItemStack(0, 0, 0)); + this.datawatcher.a(8, 5); } public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) { super(world); - this.a = 0; + this.ticksFlown = 0; this.a(0.25F, 0.25F); this.setPosition(d0, d1, d2); this.height = 0.0F; @@ -35,7 +35,7 @@ public class EntityFireworks extends Entity { this.motX = this.random.nextGaussian() * 0.001D; this.motZ = this.random.nextGaussian() * 0.001D; this.motY = 0.05D; - this.b = 10 * i + this.random.nextInt(6) + this.random.nextInt(7); + this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7); } public void j_() { @@ -69,25 +69,25 @@ public class EntityFireworks extends Entity { this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; - if (this.a == 0) { + if (this.ticksFlown == 0) { this.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F); } - ++this.a; - if (this.world.isStatic && this.a % 2 < 2) { + ++this.ticksFlown; + if (this.world.isStatic && this.ticksFlown % 2 < 2) { this.world.addParticle("fireworksSpark", this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D); } - if (!this.world.isStatic && this.a > this.b) { + if (!this.world.isStatic && this.ticksFlown > this.expectedLifespan) { this.world.broadcastEntityEffect(this, (byte) 17); this.die(); } } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.setInt("Life", this.a); - nbttagcompound.setInt("LifeTime", this.b); - ItemStack itemstack = this.datawatcher.f(8); + nbttagcompound.setInt("Life", this.ticksFlown); + nbttagcompound.setInt("LifeTime", this.expectedLifespan); + ItemStack itemstack = this.datawatcher.getItemStack(8); if (itemstack != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); @@ -98,12 +98,12 @@ public class EntityFireworks extends Entity { } public void a(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.getInt("Life"); - this.b = nbttagcompound.getInt("LifeTime"); + this.ticksFlown = nbttagcompound.getInt("Life"); + this.expectedLifespan = nbttagcompound.getInt("LifeTime"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem"); if (nbttagcompound1 != null) { - ItemStack itemstack = ItemStack.a(nbttagcompound1); + ItemStack itemstack = ItemStack.createStack(nbttagcompound1); if (itemstack != null) { this.datawatcher.watch(8, itemstack); diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java index e6e260fa..c0655dfb 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -62,7 +62,7 @@ public class EntityIronGolem extends EntityGolem { protected void o(Entity entity) { if (entity instanceof IMonster && this.aB().nextInt(20) == 0) { - this.b((EntityLiving) entity); + this.setGoalTarget((EntityLiving) entity); } super.o(entity); diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index 1cb66dfe..b8b6d52e 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -197,7 +197,7 @@ public class EntityItem extends Entity { // CraftBukkit start if (nbttagcompound1 != null) { - ItemStack itemstack = ItemStack.a(nbttagcompound1); + ItemStack itemstack = ItemStack.createStack(nbttagcompound1); if (itemstack != null) { this.setItemStack(itemstack); } else { @@ -279,7 +279,7 @@ public class EntityItem extends Entity { } public ItemStack getItemStack() { - ItemStack itemstack = this.getDataWatcher().f(10); + ItemStack itemstack = this.getDataWatcher().getItemStack(10); if (itemstack == null) { System.out.println("Item entity " + this.id + " has no item?!"); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 005b8617..7d2e633b 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -76,7 +76,7 @@ public abstract class EntityLiving extends Entity { private Navigation navigation; protected final PathfinderGoalSelector goalSelector; protected final PathfinderGoalSelector targetSelector; - private EntityLiving bN; + private EntityLiving goalTarget; private EntitySenses bO; private float bP; private ChunkCoordinates bQ = new ChunkCoordinates(0, 0, 0); @@ -87,7 +87,7 @@ public abstract class EntityLiving extends Entity { public boolean bq = false; public int br = 0; public boolean canPickUpLoot = false; // CraftBukkit - protected -> public - public boolean persistent = !this.bj(); // CraftBukkit - private -> public, change value + public boolean persistent = !this.isTypeNotPersistent(); // CraftBukkit - private -> public, change value protected int bt; protected double bu; protected double bv; @@ -196,12 +196,12 @@ public abstract class EntityLiving extends Entity { return false; } - public EntityLiving aG() { - return this.bN; + public EntityLiving getGoalTarget() { + return this.goalTarget; } - public void b(EntityLiving entityliving) { - this.bN = entityliving; + public void setGoalTarget(EntityLiving entityliving) { + this.goalTarget = entityliving; } public boolean a(Class oclass) { @@ -1187,7 +1187,7 @@ public abstract class EntityLiving extends Entity { nbttaglist = nbttagcompound.getList("Equipment"); for (i = 0; i < this.equipment.length; ++i) { - this.equipment[i] = ItemStack.a((NBTTagCompound) nbttaglist.get(i)); + this.equipment[i] = ItemStack.createStack((NBTTagCompound) nbttaglist.get(i)); } } @@ -1430,7 +1430,7 @@ public abstract class EntityLiving extends Entity { this.am = true; } - protected boolean bj() { + protected boolean isTypeNotPersistent() { return true; } @@ -1827,7 +1827,7 @@ public abstract class EntityLiving extends Entity { } public int as() { - if (this.aG() == null) { + if (this.getGoalTarget() == null) { return 3; } else { int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // this.getMaxHealth() -> this.maxHealth diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 7ae71297..712853d1 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -801,7 +801,7 @@ public class EntityMinecart extends Entity implements IInventory { int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { - this.items[j] = ItemStack.a(nbttagcompound1); + this.items[j] = ItemStack.createStack(nbttagcompound1); } } } diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java index ff3aca23..68b08ae7 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -48,7 +48,7 @@ public class EntityOcelot extends EntityTameableAnimal { } } - protected boolean bj() { + protected boolean isTypeNotPersistent() { return !this.isTamed(); } @@ -100,7 +100,7 @@ public class EntityOcelot extends EntityTameableAnimal { if (this.isInvulnerable()) { return false; } else { - this.d.a(false); + this.d.setSitting(false); return super.damageEntity(damagesource, i); } } @@ -114,7 +114,7 @@ public class EntityOcelot extends EntityTameableAnimal { if (this.isTamed()) { if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) { - this.d.a(!this.isSitting()); + this.d.setSitting(!this.isSitting()); } } else if (this.e.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) { if (!entityhuman.abilities.canInstantlyBuild) { @@ -132,7 +132,7 @@ public class EntityOcelot extends EntityTameableAnimal { this.setCatType(1 + this.world.random.nextInt(3)); this.setOwnerName(entityhuman.name); this.f(true); - this.d.a(true); + this.d.setSitting(true); this.world.broadcastEntityEffect(this, (byte) 7); } else { this.f(false); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 86e6ea98..99f12181 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -617,7 +617,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - public void m() { + public void triggerHealthUpdate() { this.cl = -99999999; this.lastSentExp = -1; // CraftBukkit - Added to reset } diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java index aa6def05..5d402dc8 100644 --- a/src/main/java/net/minecraft/server/EntityPotion.java +++ b/src/main/java/net/minecraft/server/EntityPotion.java @@ -138,7 +138,7 @@ public class EntityPotion extends EntityProjectile { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); if (nbttagcompound.hasKey("Potion")) { - this.c = ItemStack.a(nbttagcompound.getCompound("Potion")); + this.c = ItemStack.createStack(nbttagcompound.getCompound("Potion")); } else { this.setPotionValue(nbttagcompound.getInt("potionValue")); } diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java index 36154225..daa9845e 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java @@ -83,9 +83,9 @@ public class EntityWitch extends EntityMonster implements IRangedEntity { short1 = 16307; } else if (this.random.nextFloat() < 0.05F && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth -> this.maxHealth short1 = 16341; - } else if (this.random.nextFloat() < 0.25F && this.aG() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aG().e(this) > 121.0D) { + } else if (this.random.nextFloat() < 0.25F && this.getGoalTarget() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.getGoalTarget().e(this) > 121.0D) { short1 = 16274; - } else if (this.random.nextFloat() < 0.25F && this.aG() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aG().e(this) > 121.0D) { + } else if (this.random.nextFloat() < 0.25F && this.getGoalTarget() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.getGoalTarget().e(this) > 121.0D) { short1 = 16274; } diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java index b671bd50..2dc6e98f 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -244,8 +244,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity { } } - if (this.aG() != null) { - this.c(0, this.aG().id); + if (this.getGoalTarget() != null) { + this.c(0, this.getGoalTarget().id); } else { this.c(0, 0); } diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java index 8ee33180..d413d8e8 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -35,8 +35,8 @@ public class EntityWolf extends EntityTameableAnimal { return true; } - public void b(EntityLiving entityliving) { - super.b(entityliving); + public void setGoalTarget(EntityLiving entityliving) { + super.setGoalTarget(entityliving); if (entityliving instanceof EntityHuman) { this.setAngry(true); } @@ -75,7 +75,7 @@ public class EntityWolf extends EntityTameableAnimal { } } - protected boolean bj() { + protected boolean isTypeNotPersistent() { // CraftBukkit - added && !this.isTamed() return this.isAngry() && !this.isTamed(); } @@ -171,7 +171,7 @@ public class EntityWolf extends EntityTameableAnimal { } else { Entity entity = damagesource.getEntity(); - this.d.a(false); + this.d.setSitting(false); if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { i = (i + 1) / 2; } @@ -221,7 +221,7 @@ public class EntityWolf extends EntityTameableAnimal { } if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) { - this.d.a(!this.isSitting()); + this.d.setSitting(!this.isSitting()); this.bF = false; this.setPathEntity((PathEntity) null); } @@ -240,8 +240,8 @@ public class EntityWolf extends EntityTameableAnimal { boolean updateMaxHealth = this.getMaxHealth() == this.maxHealth; // CraftBukkit this.setTamed(true); this.setPathEntity((PathEntity) null); - this.b((EntityLiving) null); - this.d.a(true); + this.setGoalTarget((EntityLiving) null); + this.d.setSitting(true); // CraftBukkit start if (updateMaxHealth) { this.maxHealth = this.getMaxHealth(); diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java index af7c748d..4e379cd7 100644 --- a/src/main/java/net/minecraft/server/InventoryEnderChest.java +++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java @@ -64,7 +64,7 @@ public class InventoryEnderChest extends InventorySubcontainer { int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.getSize()) { - this.setItem(j, ItemStack.a(nbttagcompound)); + this.setItem(j, ItemStack.createStack(nbttagcompound)); } } } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 7c1bbec3..8f0a5ad2 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -41,7 +41,7 @@ public final class ItemStack { this.setData(k); // CraftBukkit } - public static ItemStack a(NBTTagCompound nbttagcompound) { + public static ItemStack createStack(NBTTagCompound nbttagcompound) { ItemStack itemstack = new ItemStack(); itemstack.c(nbttagcompound); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 2f200385..4bdf8aaa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -758,7 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } public String getVersion() { - return "1.4.6"; + return "1.4.7"; } public int y() { diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java deleted file mode 100644 index 0e021c66..00000000 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ /dev/null @@ -1,263 +0,0 @@ -package net.minecraft.server; - -import java.io.DataInput; -import java.io.DataOutput; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.Callable; - -public class NBTTagCompound extends NBTBase { - - private Map map = new HashMap(); - - public NBTTagCompound() { - super(""); - } - - public NBTTagCompound(String s) { - super(s); - } - - void write(DataOutput dataoutput) { - Iterator iterator = this.map.values().iterator(); - - while (iterator.hasNext()) { - NBTBase nbtbase = (NBTBase) iterator.next(); - - NBTBase.a(nbtbase, dataoutput); - } - - // CraftBukkit start - try { - dataoutput.writeByte(0); - } catch (java.io.IOException ex) { - ex.printStackTrace(); - } - // CraftBukkit end - } - - void load(DataInput datainput) { - this.map.clear(); - - NBTBase nbtbase; - - while ((nbtbase = NBTBase.b(datainput)).getTypeId() != 0) { - this.map.put(nbtbase.getName(), nbtbase); - } - } - - public Collection c() { - return this.map.values(); - } - - public byte getTypeId() { - return (byte) 10; - } - - public void set(String s, NBTBase nbtbase) { - this.map.put(s, nbtbase.setName(s)); - } - - public void setByte(String s, byte b0) { - this.map.put(s, new NBTTagByte(s, b0)); - } - - public void setShort(String s, short short1) { - this.map.put(s, new NBTTagShort(s, short1)); - } - - public void setInt(String s, int i) { - this.map.put(s, new NBTTagInt(s, i)); - } - - public void setLong(String s, long i) { - this.map.put(s, new NBTTagLong(s, i)); - } - - public void setFloat(String s, float f) { - this.map.put(s, new NBTTagFloat(s, f)); - } - - public void setDouble(String s, double d0) { - this.map.put(s, new NBTTagDouble(s, d0)); - } - - public void setString(String s, String s1) { - this.map.put(s, new NBTTagString(s, s1)); - } - - public void setByteArray(String s, byte[] abyte) { - this.map.put(s, new NBTTagByteArray(s, abyte)); - } - - public void setIntArray(String s, int[] aint) { - this.map.put(s, new NBTTagIntArray(s, aint)); - } - - public void setCompound(String s, NBTTagCompound nbttagcompound) { - this.map.put(s, nbttagcompound.setName(s)); - } - - public void setBoolean(String s, boolean flag) { - this.setByte(s, (byte) (flag ? 1 : 0)); - } - - public NBTBase get(String s) { - return (NBTBase) this.map.get(s); - } - - public boolean hasKey(String s) { - return this.map.containsKey(s); - } - - public byte getByte(String s) { - try { - return !this.map.containsKey(s) ? 0 : ((NBTTagByte) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 1, classcastexception)); - } - } - - public short getShort(String s) { - try { - return !this.map.containsKey(s) ? 0 : ((NBTTagShort) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 2, classcastexception)); - } - } - - public int getInt(String s) { - try { - return !this.map.containsKey(s) ? 0 : ((NBTTagInt) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 3, classcastexception)); - } - } - - public long getLong(String s) { - try { - return !this.map.containsKey(s) ? 0L : ((NBTTagLong) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 4, classcastexception)); - } - } - - public float getFloat(String s) { - try { - return !this.map.containsKey(s) ? 0.0F : ((NBTTagFloat) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 5, classcastexception)); - } - } - - public double getDouble(String s) { - try { - return !this.map.containsKey(s) ? 0.0D : ((NBTTagDouble) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 6, classcastexception)); - } - } - - public String getString(String s) { - try { - return !this.map.containsKey(s) ? "" : ((NBTTagString) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 8, classcastexception)); - } - } - - public byte[] getByteArray(String s) { - try { - return !this.map.containsKey(s) ? new byte[0] : ((NBTTagByteArray) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 7, classcastexception)); - } - } - - public int[] getIntArray(String s) { - try { - return !this.map.containsKey(s) ? new int[0] : ((NBTTagIntArray) this.map.get(s)).data; - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 11, classcastexception)); - } - } - - public NBTTagCompound getCompound(String s) { - try { - return !this.map.containsKey(s) ? new NBTTagCompound(s) : (NBTTagCompound) this.map.get(s); - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 10, classcastexception)); - } - } - - public NBTTagList getList(String s) { - try { - return !this.map.containsKey(s) ? new NBTTagList(s) : (NBTTagList) this.map.get(s); - } catch (ClassCastException classcastexception) { - throw new ReportedException(this.a(s, 9, classcastexception)); - } - } - - public boolean getBoolean(String s) { - return this.getByte(s) != 0; - } - - public void o(String s) { - this.map.remove(s); - } - - public String toString() { - return "" + this.map.size() + " entries"; - } - - public boolean d() { - return this.map.isEmpty(); - } - - private CrashReport a(String s, int i, ClassCastException classcastexception) { - CrashReport crashreport = CrashReport.a(classcastexception, "Reading NBT data"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Corrupt NBT tag", 1); - - crashreportsystemdetails.a("Tag type found", (Callable) (new CrashReportCorruptNBTTag(this, s))); - crashreportsystemdetails.a("Tag type expected", (Callable) (new CrashReportCorruptNBTTag2(this, i))); - crashreportsystemdetails.a("Tag name", s); - if (this.getName() != null && this.getName().length() > 0) { - crashreportsystemdetails.a("Tag parent", this.getName()); - } - - return crashreport; - } - - public NBTBase clone() { - NBTTagCompound nbttagcompound = new NBTTagCompound(this.getName()); - Iterator iterator = this.map.keySet().iterator(); - - while (iterator.hasNext()) { - String s = (String) iterator.next(); - - nbttagcompound.set(s, ((NBTBase) this.map.get(s)).clone()); - } - - return nbttagcompound; - } - - public boolean equals(Object object) { - if (super.equals(object)) { - NBTTagCompound nbttagcompound = (NBTTagCompound) object; - - return this.map.entrySet().equals(nbttagcompound.map.entrySet()); - } else { - return false; - } - } - - public int hashCode() { - return super.hashCode() ^ this.map.hashCode(); - } - - static Map a(NBTTagCompound nbttagcompound) { - return nbttagcompound.map; - } -} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java index bf496af8..fe9132d7 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java @@ -28,7 +28,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal { } public boolean a() { - EntityLiving entityliving = this.a.aG(); + EntityLiving entityliving = this.a.getGoalTarget(); if (entityliving == null) { return false; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java index 6cec26b1..016fe877 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java @@ -29,7 +29,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal { } public boolean a() { - EntityLiving entityliving = this.b.aG(); + EntityLiving entityliving = this.b.getGoalTarget(); if (entityliving == null) { return false; @@ -43,7 +43,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal { } public boolean b() { - EntityLiving entityliving = this.b.aG(); + EntityLiving entityliving = this.b.getGoalTarget(); return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.e(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ)))); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSit.java b/src/main/java/net/minecraft/server/PathfinderGoalSit.java index 3b9b97a5..a7c32bdd 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSit.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSit.java @@ -12,7 +12,7 @@ public class PathfinderGoalSit extends PathfinderGoal { public boolean a() { if (!this.a.isTamed()) { - return this.b && this.a.aG() == null; // CraftBukkit - Allow sitting for wild animals + return this.b && this.a.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals } else if (this.a.H()) { return false; } else if (!this.a.onGround) { @@ -33,7 +33,7 @@ public class PathfinderGoalSit extends PathfinderGoal { this.a.setSitting(false); } - public void a(boolean flag) { + public void setSitting(boolean flag) { this.b = flag; } } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java index 2eb04228..c65f3dd7 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java @@ -27,7 +27,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { } public boolean b() { - EntityLiving entityliving = this.d.aG(); + EntityLiving entityliving = this.d.getGoalTarget(); if (entityliving == null) { return false; @@ -55,7 +55,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { } public void d() { - this.d.b((EntityLiving) null); + this.d.setGoalTarget((EntityLiving) null); } protected boolean a(EntityLiving entityliving, boolean flag) { @@ -118,12 +118,10 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { - if (this.d instanceof EntityCreature) { - ((EntityCreature) this.d).target = null; - } + this.d.setGoalTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { - this.d.b((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); + this.d.setGoalTarget((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); } if (this.d instanceof EntityCreature) { ((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index dd29094f..94b62ac9 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -60,7 +60,7 @@ public class PlayerConnection extends Connection { private long j; private static Random k = new Random(); private long l; - private volatile int m = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "m"); // CraftBukkit - multithreaded field + private volatile int chatThrottle = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field private int x = 0; private double y; private double z; @@ -119,7 +119,7 @@ public class PlayerConnection extends Connection { } // CraftBukkit start - for (int spam; (spam = this.m) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; + for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; /* Use thread-safe field access instead if (this.m > 0) { --this.m; diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java index 288cb220..f40b1e98 100644 --- a/src/main/java/net/minecraft/server/PlayerInventory.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -344,7 +344,7 @@ public class PlayerInventory implements IInventory { for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; - ItemStack itemstack = ItemStack.a(nbttagcompound); + ItemStack itemstack = ItemStack.createStack(nbttagcompound); if (itemstack != null) { if (j >= 0 && j < this.items.length) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index c43a6edd..04ee0de4 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -759,7 +759,7 @@ public abstract class PlayerList { public void updateClient(EntityPlayer entityplayer) { entityplayer.updateInventory(entityplayer.defaultContainer); - entityplayer.m(); + entityplayer.triggerHealthUpdate(); entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex)); } diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java index 418a2262..f047c856 100644 --- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java +++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java @@ -175,7 +175,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory { byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { - this.items[b0] = ItemStack.a(nbttagcompound1); + this.items[b0] = ItemStack.createStack(nbttagcompound1); } } diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index 0d1637c7..4f002501 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -114,7 +114,7 @@ public class TileEntityChest extends TileEntity implements IInventory { int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { - this.items[j] = ItemStack.a(nbttagcompound1); + this.items[j] = ItemStack.createStack(nbttagcompound1); } } } diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java index a7aa950a..c0a69704 100644 --- a/src/main/java/net/minecraft/server/TileEntityDispenser.java +++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java @@ -132,7 +132,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory { int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { - this.items[j] = ItemStack.a(nbttagcompound1); + this.items[j] = ItemStack.createStack(nbttagcompound1); } } } diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 17b9611a..d9745ba8 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -107,7 +107,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { - this.items[b0] = ItemStack.a(nbttagcompound1); + this.items[b0] = ItemStack.createStack(nbttagcompound1); } } diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index b6ad98c4..e415b6a7 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -9,7 +9,7 @@ public class TileEntityMobSpawner extends TileEntity { public int spawnDelay = -1; public String mobName = "Pig"; // CraftBukkit - private -> public - private List mobs = null; + private List mobs = null; private TileEntityMobSpawnerData spawnData = null; public double b; public double c = 0.0D; @@ -221,7 +221,7 @@ public class TileEntityMobSpawner extends TileEntity { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.b(nbttagcompound); - nbttagcompound.o("SpawnPotentials"); + nbttagcompound.remove("SpawnPotentials"); return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 863078f8..943ce856 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -22,11 +22,11 @@ public class CraftFirework extends CraftEntity implements Firework { public CraftFirework(CraftServer server, EntityFireworks entity) { super(server, entity); - ItemStack item = getHandle().getDataWatcher().f(FIREWORK_ITEM_INDEX); + ItemStack item = getHandle().getDataWatcher().getItemStack(FIREWORK_ITEM_INDEX); if (item == null) { item = new ItemStack(Item.FIREWORKS); - getHandle().getDataWatcher().a(FIREWORK_ITEM_INDEX, item); // register + getHandle().getDataWatcher().watch(FIREWORK_ITEM_INDEX, item); } this.item = CraftItemStack.asCraftMirror(item); @@ -59,7 +59,7 @@ public class CraftFirework extends CraftEntity implements Firework { item.setItemMeta(meta); // Copied from EntityFireworks constructor, update firework lifetime/power - getHandle().b = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7); + getHandle().expectedLifespan = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7); getHandle().getDataWatcher().h(FIREWORK_ITEM_INDEX); // Update } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 90abccef..f0e24d2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -948,11 +948,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setMaxHealth(int amount) { super.setMaxHealth(amount); - getHandle().m(); // Update health + getHandle().triggerHealthUpdate(); } public void resetMaxHealth() { super.resetMaxHealth(); - getHandle().m(); // Update health + getHandle().triggerHealthUpdate(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java index 0134bda7..f62d8bcb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -62,7 +62,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat } public void setSitting(boolean sitting) { - getHandle().q().a(sitting); + getHandle().getGoalSit().setSitting(sitting); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 85835ca7..96bf95ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -238,8 +238,8 @@ public final class CraftItemStack extends ItemStack { return 0; } if (size == 1) { - handle.tag.o(ENCHANTMENTS.NBT); - if (handle.tag.d()) { + handle.tag.remove(ENCHANTMENTS.NBT); + if (handle.tag.isEmpty()) { handle.tag = null; } return level; @@ -388,6 +388,6 @@ public final class CraftItemStack extends ItemStack { } static boolean hasItemMeta(net.minecraft.server.ItemStack item) { - return !(item == null || item.tag == null || item.tag.d()); + return !(item == null || item.tag == null || item.tag.isEmpty()); } } |