Update CraftBukkit to Minecraft 1.4.7

This commit is contained in:
feildmaster 2013-01-17 03:28:44 -06:00
parent 315127782a
commit e59af9908b
36 changed files with 83 additions and 349 deletions

View file

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.4.6-R0.4-SNAPSHOT</version> <version>1.4.7-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name> <name>CraftBukkit</name>
<url>http://www.bukkit.org</url> <url>http://www.bukkit.org</url>
@ -12,8 +12,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version> <api.version>unknown</api.version>
<junit.version>4.11</junit.version> <junit.version>4.11</junit.version>
<minecraft.version>1.4.6</minecraft.version> <minecraft.version>1.4.7</minecraft.version>
<minecraft_version>1_4_6</minecraft_version> <minecraft_version>1_4_R1</minecraft_version>
</properties> </properties>
<scm> <scm>

View file

@ -47,7 +47,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end // 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) { 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\""); log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }

View file

@ -1165,7 +1165,7 @@ public abstract class Entity {
// Reset the persistence for tamed animals // Reset the persistence for tamed animals
if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) { if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
entity.persistent = !entity.bj(); entity.persistent = !entity.isTypeNotPersistent();
} }
} }
// CraftBukkit end // CraftBukkit end

View file

@ -250,11 +250,10 @@ public class EntityArrow extends Entity implements IProjectile {
} }
} }
// CraftBukkit start
if (this.shooter != null) { if (this.shooter != null) {
EnchantmentThorns.a(this.shooter, entityliving, this.random); 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) { 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)); ((EntityPlayer) this.shooter).playerConnection.sendPacket(new Packet70Bed(6, 0));
} }

View file

@ -32,7 +32,7 @@ public class EntityCreeper extends EntityMonster {
} }
public int as() { 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) { protected void a(float f) {

View file

@ -2,8 +2,8 @@ package net.minecraft.server;
public class EntityFireworks extends Entity { public class EntityFireworks extends Entity {
private int a; private int ticksFlown;
public int b; // CraftBukkit - private -> public public int expectedLifespan; // CraftBukkit - private -> public
public EntityFireworks(World world) { public EntityFireworks(World world) {
super(world); super(world);
@ -11,12 +11,12 @@ public class EntityFireworks extends Entity {
} }
protected void a() { 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) { public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) {
super(world); super(world);
this.a = 0; this.ticksFlown = 0;
this.a(0.25F, 0.25F); this.a(0.25F, 0.25F);
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.height = 0.0F; this.height = 0.0F;
@ -35,7 +35,7 @@ public class EntityFireworks extends Entity {
this.motX = this.random.nextGaussian() * 0.001D; this.motX = this.random.nextGaussian() * 0.001D;
this.motZ = this.random.nextGaussian() * 0.001D; this.motZ = this.random.nextGaussian() * 0.001D;
this.motY = 0.05D; 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_() { public void j_() {
@ -69,25 +69,25 @@ public class EntityFireworks extends Entity {
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 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.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F);
} }
++this.a; ++this.ticksFlown;
if (this.world.isStatic && this.a % 2 < 2) { 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); 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.world.broadcastEntityEffect(this, (byte) 17);
this.die(); this.die();
} }
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setInt("Life", this.a); nbttagcompound.setInt("Life", this.ticksFlown);
nbttagcompound.setInt("LifeTime", this.b); nbttagcompound.setInt("LifeTime", this.expectedLifespan);
ItemStack itemstack = this.datawatcher.f(8); ItemStack itemstack = this.datawatcher.getItemStack(8);
if (itemstack != null) { if (itemstack != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -98,12 +98,12 @@ public class EntityFireworks extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.getInt("Life"); this.ticksFlown = nbttagcompound.getInt("Life");
this.b = nbttagcompound.getInt("LifeTime"); this.expectedLifespan = nbttagcompound.getInt("LifeTime");
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem");
if (nbttagcompound1 != null) { if (nbttagcompound1 != null) {
ItemStack itemstack = ItemStack.a(nbttagcompound1); ItemStack itemstack = ItemStack.createStack(nbttagcompound1);
if (itemstack != null) { if (itemstack != null) {
this.datawatcher.watch(8, itemstack); this.datawatcher.watch(8, itemstack);

View file

@ -62,7 +62,7 @@ public class EntityIronGolem extends EntityGolem {
protected void o(Entity entity) { protected void o(Entity entity) {
if (entity instanceof IMonster && this.aB().nextInt(20) == 0) { if (entity instanceof IMonster && this.aB().nextInt(20) == 0) {
this.b((EntityLiving) entity); this.setGoalTarget((EntityLiving) entity);
} }
super.o(entity); super.o(entity);

View file

@ -197,7 +197,7 @@ public class EntityItem extends Entity {
// CraftBukkit start // CraftBukkit start
if (nbttagcompound1 != null) { if (nbttagcompound1 != null) {
ItemStack itemstack = ItemStack.a(nbttagcompound1); ItemStack itemstack = ItemStack.createStack(nbttagcompound1);
if (itemstack != null) { if (itemstack != null) {
this.setItemStack(itemstack); this.setItemStack(itemstack);
} else { } else {
@ -279,7 +279,7 @@ public class EntityItem extends Entity {
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {
ItemStack itemstack = this.getDataWatcher().f(10); ItemStack itemstack = this.getDataWatcher().getItemStack(10);
if (itemstack == null) { if (itemstack == null) {
System.out.println("Item entity " + this.id + " has no item?!"); System.out.println("Item entity " + this.id + " has no item?!");

View file

@ -76,7 +76,7 @@ public abstract class EntityLiving extends Entity {
private Navigation navigation; private Navigation navigation;
protected final PathfinderGoalSelector goalSelector; protected final PathfinderGoalSelector goalSelector;
protected final PathfinderGoalSelector targetSelector; protected final PathfinderGoalSelector targetSelector;
private EntityLiving bN; private EntityLiving goalTarget;
private EntitySenses bO; private EntitySenses bO;
private float bP; private float bP;
private ChunkCoordinates bQ = new ChunkCoordinates(0, 0, 0); private ChunkCoordinates bQ = new ChunkCoordinates(0, 0, 0);
@ -87,7 +87,7 @@ public abstract class EntityLiving extends Entity {
public boolean bq = false; public boolean bq = false;
public int br = 0; public int br = 0;
public boolean canPickUpLoot = false; // CraftBukkit - protected -> public 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 int bt;
protected double bu; protected double bu;
protected double bv; protected double bv;
@ -196,12 +196,12 @@ public abstract class EntityLiving extends Entity {
return false; return false;
} }
public EntityLiving aG() { public EntityLiving getGoalTarget() {
return this.bN; return this.goalTarget;
} }
public void b(EntityLiving entityliving) { public void setGoalTarget(EntityLiving entityliving) {
this.bN = entityliving; this.goalTarget = entityliving;
} }
public boolean a(Class oclass) { public boolean a(Class oclass) {
@ -1187,7 +1187,7 @@ public abstract class EntityLiving extends Entity {
nbttaglist = nbttagcompound.getList("Equipment"); nbttaglist = nbttagcompound.getList("Equipment");
for (i = 0; i < this.equipment.length; ++i) { 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; this.am = true;
} }
protected boolean bj() { protected boolean isTypeNotPersistent() {
return true; return true;
} }
@ -1827,7 +1827,7 @@ public abstract class EntityLiving extends Entity {
} }
public int as() { public int as() {
if (this.aG() == null) { if (this.getGoalTarget() == null) {
return 3; return 3;
} else { } else {
int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // this.getMaxHealth() -> this.maxHealth int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // this.getMaxHealth() -> this.maxHealth

View file

@ -801,7 +801,7 @@ public class EntityMinecart extends Entity implements IInventory {
int j = nbttagcompound1.getByte("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.createStack(nbttagcompound1);
} }
} }
} }

View file

@ -48,7 +48,7 @@ public class EntityOcelot extends EntityTameableAnimal {
} }
} }
protected boolean bj() { protected boolean isTypeNotPersistent() {
return !this.isTamed(); return !this.isTamed();
} }
@ -100,7 +100,7 @@ public class EntityOcelot extends EntityTameableAnimal {
if (this.isInvulnerable()) { if (this.isInvulnerable()) {
return false; return false;
} else { } else {
this.d.a(false); this.d.setSitting(false);
return super.damageEntity(damagesource, i); return super.damageEntity(damagesource, i);
} }
} }
@ -114,7 +114,7 @@ public class EntityOcelot extends EntityTameableAnimal {
if (this.isTamed()) { if (this.isTamed()) {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) { 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) { } else if (this.e.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
if (!entityhuman.abilities.canInstantlyBuild) { if (!entityhuman.abilities.canInstantlyBuild) {
@ -132,7 +132,7 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(1 + this.world.random.nextInt(3)); this.setCatType(1 + this.world.random.nextInt(3));
this.setOwnerName(entityhuman.name); this.setOwnerName(entityhuman.name);
this.f(true); this.f(true);
this.d.a(true); this.d.setSitting(true);
this.world.broadcastEntityEffect(this, (byte) 7); this.world.broadcastEntityEffect(this, (byte) 7);
} else { } else {
this.f(false); this.f(false);

View file

@ -617,7 +617,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void m() { public void triggerHealthUpdate() {
this.cl = -99999999; this.cl = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset this.lastSentExp = -1; // CraftBukkit - Added to reset
} }

View file

@ -138,7 +138,7 @@ public class EntityPotion extends EntityProjectile {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
if (nbttagcompound.hasKey("Potion")) { if (nbttagcompound.hasKey("Potion")) {
this.c = ItemStack.a(nbttagcompound.getCompound("Potion")); this.c = ItemStack.createStack(nbttagcompound.getCompound("Potion"));
} else { } else {
this.setPotionValue(nbttagcompound.getInt("potionValue")); this.setPotionValue(nbttagcompound.getInt("potionValue"));
} }

View file

@ -83,9 +83,9 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
short1 = 16307; short1 = 16307;
} else if (this.random.nextFloat() < 0.05F && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth -> this.maxHealth } else if (this.random.nextFloat() < 0.05F && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth -> this.maxHealth
short1 = 16341; 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; 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; short1 = 16274;
} }

View file

@ -244,8 +244,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
} }
} }
if (this.aG() != null) { if (this.getGoalTarget() != null) {
this.c(0, this.aG().id); this.c(0, this.getGoalTarget().id);
} else { } else {
this.c(0, 0); this.c(0, 0);
} }

View file

@ -35,8 +35,8 @@ public class EntityWolf extends EntityTameableAnimal {
return true; return true;
} }
public void b(EntityLiving entityliving) { public void setGoalTarget(EntityLiving entityliving) {
super.b(entityliving); super.setGoalTarget(entityliving);
if (entityliving instanceof EntityHuman) { if (entityliving instanceof EntityHuman) {
this.setAngry(true); this.setAngry(true);
} }
@ -75,7 +75,7 @@ public class EntityWolf extends EntityTameableAnimal {
} }
} }
protected boolean bj() { protected boolean isTypeNotPersistent() {
// CraftBukkit - added && !this.isTamed() // CraftBukkit - added && !this.isTamed()
return this.isAngry() && !this.isTamed(); return this.isAngry() && !this.isTamed();
} }
@ -171,7 +171,7 @@ public class EntityWolf extends EntityTameableAnimal {
} else { } else {
Entity entity = damagesource.getEntity(); Entity entity = damagesource.getEntity();
this.d.a(false); this.d.setSitting(false);
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
i = (i + 1) / 2; 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)) { 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.bF = false;
this.setPathEntity((PathEntity) null); this.setPathEntity((PathEntity) null);
} }
@ -240,8 +240,8 @@ public class EntityWolf extends EntityTameableAnimal {
boolean updateMaxHealth = this.getMaxHealth() == this.maxHealth; // CraftBukkit boolean updateMaxHealth = this.getMaxHealth() == this.maxHealth; // CraftBukkit
this.setTamed(true); this.setTamed(true);
this.setPathEntity((PathEntity) null); this.setPathEntity((PathEntity) null);
this.b((EntityLiving) null); this.setGoalTarget((EntityLiving) null);
this.d.a(true); this.d.setSitting(true);
// CraftBukkit start // CraftBukkit start
if (updateMaxHealth) { if (updateMaxHealth) {
this.maxHealth = this.getMaxHealth(); this.maxHealth = this.getMaxHealth();

View file

@ -64,7 +64,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
int j = nbttagcompound.getByte("Slot") & 255; int j = nbttagcompound.getByte("Slot") & 255;
if (j >= 0 && j < this.getSize()) { if (j >= 0 && j < this.getSize()) {
this.setItem(j, ItemStack.a(nbttagcompound)); this.setItem(j, ItemStack.createStack(nbttagcompound));
} }
} }
} }

View file

@ -41,7 +41,7 @@ public final class ItemStack {
this.setData(k); // CraftBukkit this.setData(k); // CraftBukkit
} }
public static ItemStack a(NBTTagCompound nbttagcompound) { public static ItemStack createStack(NBTTagCompound nbttagcompound) {
ItemStack itemstack = new ItemStack(); ItemStack itemstack = new ItemStack();
itemstack.c(nbttagcompound); itemstack.c(nbttagcompound);

View file

@ -758,7 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} }
public String getVersion() { public String getVersion() {
return "1.4.6"; return "1.4.7";
} }
public int y() { public int y() {

View file

@ -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;
}
}

View file

@ -28,7 +28,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
} }
public boolean a() { public boolean a() {
EntityLiving entityliving = this.a.aG(); EntityLiving entityliving = this.a.getGoalTarget();
if (entityliving == null) { if (entityliving == null) {
return false; return false;

View file

@ -29,7 +29,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
} }
public boolean a() { public boolean a() {
EntityLiving entityliving = this.b.aG(); EntityLiving entityliving = this.b.getGoalTarget();
if (entityliving == null) { if (entityliving == null) {
return false; return false;
@ -43,7 +43,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
} }
public boolean b() { 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)))); 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))));
} }

View file

@ -12,7 +12,7 @@ public class PathfinderGoalSit extends PathfinderGoal {
public boolean a() { public boolean a() {
if (!this.a.isTamed()) { 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()) { } else if (this.a.H()) {
return false; return false;
} else if (!this.a.onGround) { } else if (!this.a.onGround) {
@ -33,7 +33,7 @@ public class PathfinderGoalSit extends PathfinderGoal {
this.a.setSitting(false); this.a.setSitting(false);
} }
public void a(boolean flag) { public void setSitting(boolean flag) {
this.b = flag; this.b = flag;
} }
} }

View file

@ -27,7 +27,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
} }
public boolean b() { public boolean b() {
EntityLiving entityliving = this.d.aG(); EntityLiving entityliving = this.d.getGoalTarget();
if (entityliving == null) { if (entityliving == null) {
return false; return false;
@ -55,7 +55,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
} }
public void d() { public void d() {
this.d.b((EntityLiving) null); this.d.setGoalTarget((EntityLiving) null);
} }
protected boolean a(EntityLiving entityliving, boolean flag) { 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); org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason);
if (event.isCancelled() || event.getTarget() == null) { if (event.isCancelled() || event.getTarget() == null) {
if (this.d instanceof EntityCreature) { this.d.setGoalTarget(null);
((EntityCreature) this.d).target = null;
}
return false; return false;
} else if (entityliving.getBukkitEntity() != event.getTarget()) { } 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) { if (this.d instanceof EntityCreature) {
((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); ((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();

View file

@ -60,7 +60,7 @@ public class PlayerConnection extends Connection {
private long j; private long j;
private static Random k = new Random(); private static Random k = new Random();
private long l; 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 int x = 0;
private double y; private double y;
private double z; private double z;
@ -119,7 +119,7 @@ public class PlayerConnection extends Connection {
} }
// CraftBukkit start // 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 /* Use thread-safe field access instead
if (this.m > 0) { if (this.m > 0) {
--this.m; --this.m;

View file

@ -344,7 +344,7 @@ public class PlayerInventory implements IInventory {
for (int i = 0; i < nbttaglist.size(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i); NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
int j = nbttagcompound.getByte("Slot") & 255; int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.a(nbttagcompound); ItemStack itemstack = ItemStack.createStack(nbttagcompound);
if (itemstack != null) { if (itemstack != null) {
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {

View file

@ -759,7 +759,7 @@ public abstract class PlayerList {
public void updateClient(EntityPlayer entityplayer) { public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer); entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.m(); entityplayer.triggerHealthUpdate();
entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex)); entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
} }

View file

@ -175,7 +175,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.items.length) { if (b0 >= 0 && b0 < this.items.length) {
this.items[b0] = ItemStack.a(nbttagcompound1); this.items[b0] = ItemStack.createStack(nbttagcompound1);
} }
} }

View file

@ -114,7 +114,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
int j = nbttagcompound1.getByte("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.createStack(nbttagcompound1);
} }
} }
} }

View file

@ -132,7 +132,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
int j = nbttagcompound1.getByte("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.createStack(nbttagcompound1);
} }
} }
} }

View file

@ -107,7 +107,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.items.length) { if (b0 >= 0 && b0 < this.items.length) {
this.items[b0] = ItemStack.a(nbttagcompound1); this.items[b0] = ItemStack.createStack(nbttagcompound1);
} }
} }

View file

@ -9,7 +9,7 @@ public class TileEntityMobSpawner extends TileEntity {
public int spawnDelay = -1; public int spawnDelay = -1;
public String mobName = "Pig"; // CraftBukkit - private -> public public String mobName = "Pig"; // CraftBukkit - private -> public
private List mobs = null; private List mobs = null;
private TileEntityMobSpawnerData spawnData = null; private TileEntityMobSpawnerData spawnData = null;
public double b; public double b;
public double c = 0.0D; public double c = 0.0D;
@ -221,7 +221,7 @@ public class TileEntityMobSpawner extends TileEntity {
NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound); this.b(nbttagcompound);
nbttagcompound.o("SpawnPotentials"); nbttagcompound.remove("SpawnPotentials");
return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound); return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound);
} }

View file

@ -22,11 +22,11 @@ public class CraftFirework extends CraftEntity implements Firework {
public CraftFirework(CraftServer server, EntityFireworks entity) { public CraftFirework(CraftServer server, EntityFireworks entity) {
super(server, entity); super(server, entity);
ItemStack item = getHandle().getDataWatcher().f(FIREWORK_ITEM_INDEX); ItemStack item = getHandle().getDataWatcher().getItemStack(FIREWORK_ITEM_INDEX);
if (item == null) { if (item == null) {
item = new ItemStack(Item.FIREWORKS); 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); this.item = CraftItemStack.asCraftMirror(item);
@ -59,7 +59,7 @@ public class CraftFirework extends CraftEntity implements Firework {
item.setItemMeta(meta); item.setItemMeta(meta);
// Copied from EntityFireworks constructor, update firework lifetime/power // 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 getHandle().getDataWatcher().h(FIREWORK_ITEM_INDEX); // Update
} }

View file

@ -948,11 +948,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setMaxHealth(int amount) { public void setMaxHealth(int amount) {
super.setMaxHealth(amount); super.setMaxHealth(amount);
getHandle().m(); // Update health getHandle().triggerHealthUpdate();
} }
public void resetMaxHealth() { public void resetMaxHealth() {
super.resetMaxHealth(); super.resetMaxHealth();
getHandle().m(); // Update health getHandle().triggerHealthUpdate();
} }
} }

View file

@ -62,7 +62,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
} }
public void setSitting(boolean sitting) { public void setSitting(boolean sitting) {
getHandle().q().a(sitting); getHandle().getGoalSit().setSitting(sitting);
} }
@Override @Override

View file

@ -238,8 +238,8 @@ public final class CraftItemStack extends ItemStack {
return 0; return 0;
} }
if (size == 1) { if (size == 1) {
handle.tag.o(ENCHANTMENTS.NBT); handle.tag.remove(ENCHANTMENTS.NBT);
if (handle.tag.d()) { if (handle.tag.isEmpty()) {
handle.tag = null; handle.tag = null;
} }
return level; return level;
@ -388,6 +388,6 @@ public final class CraftItemStack extends ItemStack {
} }
static boolean hasItemMeta(net.minecraft.server.ItemStack item) { 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());
} }
} }