mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 12:41:50 +01:00
Update CraftBukkit to Minecraft 1.4.7
This commit is contained in:
parent
315127782a
commit
e59af9908b
36 changed files with 83 additions and 349 deletions
6
pom.xml
6
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.4.6-R0.4-SNAPSHOT</version>
|
||||
<version>1.4.7-R0.1-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>http://www.bukkit.org</url>
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<api.version>unknown</api.version>
|
||||
<junit.version>4.11</junit.version>
|
||||
<minecraft.version>1.4.6</minecraft.version>
|
||||
<minecraft_version>1_4_6</minecraft_version>
|
||||
<minecraft.version>1.4.7</minecraft.version>
|
||||
<minecraft_version>1_4_R1</minecraft_version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
|
|
|
@ -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\"");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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?!");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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))));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue