From 0118a20d6a4d5637504b26998bfd96c7a65ddbe1 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Sat, 24 Sep 2011 22:03:31 +0100 Subject: Update to mcdev rename revision 01 for 1.8.1 --- .../net/minecraft/server/ChunkProviderServer.java | 4 +- src/main/java/net/minecraft/server/Entity.java | 12 +- .../java/net/minecraft/server/EntityCreeper.java | 6 +- .../java/net/minecraft/server/EntityEnderman.java | 4 +- .../java/net/minecraft/server/EntityFireball.java | 24 +- src/main/java/net/minecraft/server/EntityFish.java | 410 --------------------- .../net/minecraft/server/EntityFishingHook.java | 410 +++++++++++++++++++++ .../java/net/minecraft/server/EntityGhast.java | 8 +- .../java/net/minecraft/server/EntityHuman.java | 34 +- .../java/net/minecraft/server/EntityLiving.java | 54 +-- .../java/net/minecraft/server/EntityMonster.java | 2 +- src/main/java/net/minecraft/server/EntityPig.java | 2 +- .../java/net/minecraft/server/EntityPigZombie.java | 2 +- .../java/net/minecraft/server/EntityPlayer.java | 6 +- .../java/net/minecraft/server/EntitySheep.java | 8 +- .../java/net/minecraft/server/EntityTracker.java | 50 +-- .../net/minecraft/server/EntityTrackerEntry.java | 12 +- .../net/minecraft/server/EntityWeatherStorm.java | 2 +- src/main/java/net/minecraft/server/EntityWolf.java | 18 +- .../java/net/minecraft/server/FoodMetaData.java | 2 +- .../java/net/minecraft/server/InventoryPlayer.java | 2 +- .../java/net/minecraft/server/ItemFishingRod.java | 2 +- src/main/java/net/minecraft/server/ItemFood.java | 2 +- src/main/java/net/minecraft/server/ItemStack.java | 4 +- .../java/net/minecraft/server/MinecraftServer.java | 10 +- .../java/net/minecraft/server/NetLoginHandler.java | 6 +- .../net/minecraft/server/NetServerHandler.java | 4 +- .../java/net/minecraft/server/PropertyManager.java | 3 +- .../server/ServerConfigurationManager.java | 56 +-- src/main/java/net/minecraft/server/World.java | 16 +- src/main/java/net/minecraft/server/WorldData.java | 186 +++++----- .../java/net/minecraft/server/WorldServer.java | 2 +- .../java/org/bukkit/craftbukkit/CraftChunk.java | 12 +- .../org/bukkit/craftbukkit/CraftOfflinePlayer.java | 14 +- .../java/org/bukkit/craftbukkit/CraftServer.java | 25 +- .../java/org/bukkit/craftbukkit/CraftWorld.java | 12 +- .../org/bukkit/craftbukkit/entity/CraftEntity.java | 2 +- .../bukkit/craftbukkit/entity/CraftFireball.java | 2 +- .../org/bukkit/craftbukkit/entity/CraftFish.java | 10 +- .../org/bukkit/craftbukkit/entity/CraftPlayer.java | 18 +- 40 files changed, 728 insertions(+), 730 deletions(-) delete mode 100644 src/main/java/net/minecraft/server/EntityFish.java create mode 100644 src/main/java/net/minecraft/server/EntityFishingHook.java (limited to 'src/main') diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 364ade8a..4aef10cb 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -219,7 +219,7 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean unloadChunks() { - if (!this.world.canSave) { + if (!this.world.savingDisabled) { // CraftBukkit start org.bukkit.Server server = this.world.getServer(); for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) { @@ -251,6 +251,6 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean canSave() { - return !this.world.canSave; + return !this.world.savingDisabled; } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 0333078c..38e407bf 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -125,7 +125,7 @@ public abstract class Entity { protected abstract void b(); - public DataWatcher al() { + public DataWatcher getDataWatcher() { return this.datawatcher; } @@ -206,7 +206,7 @@ public abstract class Entity { this.lastYaw = this.yaw; int i; - if (this.at()) { + if (this.isSprinting()) { int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); @@ -1231,11 +1231,11 @@ public abstract class Entity { this.a(1, flag); } - public boolean at() { + public boolean isSprinting() { return this.e(3); } - public void g(boolean flag) { + public void setSprinting(boolean flag) { this.a(3, flag); } @@ -1244,11 +1244,11 @@ public abstract class Entity { } protected boolean e(int i) { - return (this.datawatcher.a(0) & 1 << i) != 0; + return (this.datawatcher.getByte(0) & 1 << i) != 0; } protected void a(int i, boolean flag) { - byte b0 = this.datawatcher.a(0); + byte b0 = this.datawatcher.getByte(0); if (flag) { this.datawatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << i))); diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index 4729167d..0a1be51d 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -24,7 +24,7 @@ public class EntityCreeper extends EntityMonster { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - if (this.datawatcher.a(17) == 1) { + if (this.datawatcher.getByte(17) == 1) { nbttagcompound.a("powered", true); } } @@ -129,7 +129,7 @@ public class EntityCreeper extends EntityMonster { } public boolean isPowered() { - return this.datawatcher.a(17) == 1; + return this.datawatcher.getByte(17) == 1; } protected int k() { @@ -137,7 +137,7 @@ public class EntityCreeper extends EntityMonster { } private int w() { - return this.datawatcher.a(16); + return this.datawatcher.getByte(16); } private void b(int i) { diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index 85a7a609..2890c9af 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -284,7 +284,7 @@ public class EntityEnderman extends EntityMonster { } public int getCarriedId() { - return this.datawatcher.a(16); + return this.datawatcher.getByte(16); } public void setCarriedData(int i) { @@ -292,7 +292,7 @@ public class EntityEnderman extends EntityMonster { } public int getCarriedData() { - return this.datawatcher.a(17); + return this.datawatcher.getByte(17); } static { diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 1383b30d..99937ae9 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -24,9 +24,9 @@ public class EntityFireball extends Entity { public EntityLiving shooter; private int k; private int l = 0; - public double c; - public double d; - public double e; + public double dirX; + public double dirY; + public double dirZ; public float yield = 1; // CraftBukkit public boolean isIncendiary = true; // CraftBukkit @@ -56,9 +56,9 @@ public class EntityFireball extends Entity { d2 += this.random.nextGaussian() * 0.4D; double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); - this.c = d0 / d3 * 0.1D; - this.d = d1 / d3 * 0.1D; - this.e = d2 / d3 * 0.1D; + this.dirX = d0 / d3 * 0.1D; + this.dirY = d1 / d3 * 0.1D; + this.dirZ = d2 / d3 * 0.1D; } public void s_() { @@ -210,9 +210,9 @@ public class EntityFireball extends Entity { f2 = 0.8F; } - this.motX += this.c; - this.motY += this.d; - this.motZ += this.e; + this.motX += this.dirX; + this.motY += this.dirY; + this.motZ += this.dirZ; this.motX *= (double) f2; this.motY *= (double) f2; this.motZ *= (double) f2; @@ -251,9 +251,9 @@ public class EntityFireball extends Entity { this.motX = vec3d.a; this.motY = vec3d.b; this.motZ = vec3d.c; - this.c = this.motX * 0.1D; - this.d = this.motY * 0.1D; - this.e = this.motZ * 0.1D; + this.dirX = this.motX * 0.1D; + this.dirY = this.motY * 0.1D; + this.dirZ = this.motZ * 0.1D; } return true; diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java deleted file mode 100644 index c3af567c..00000000 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ /dev/null @@ -1,410 +0,0 @@ -package net.minecraft.server; - -import java.util.List; - -// CraftBukkit start -import org.bukkit.entity.Projectile; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerFishEvent; -// CraftBukkit end - -public class EntityFish extends Entity { - - private int d = -1; - private int e = -1; - private int f = -1; - private int g = 0; - private boolean h = false; - public int a = 0; - public EntityHuman owner; - private int i; - private int j = 0; - private int k = 0; - public Entity c = null; - private int l; - private double m; - private double n; - private double o; - private double p; - private double q; - - public EntityFish(World world) { - super(world); - this.b(0.25F, 0.25F); - this.bZ = true; - } - - public EntityFish(World world, EntityHuman entityhuman) { - super(world); - this.bZ = true; - this.owner = entityhuman; - this.owner.hookedFish = this; - this.b(0.25F, 0.25F); - this.setPositionRotation(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch); - this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); - this.locY -= 0.10000000149011612D; - this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); - this.setPosition(this.locX, this.locY, this.locZ); - this.height = 0.0F; - float f = 0.4F; - - this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); - this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); - this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f); - this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); - } - - protected void b() {} - - public void a(double d0, double d1, double d2, float f, float f1) { - float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); - - d0 /= (double) f2; - d1 /= (double) f2; - d2 /= (double) f2; - d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; - d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; - d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; - d0 *= (double) f; - d1 *= (double) f; - d2 *= (double) f; - this.motX = d0; - this.motY = d1; - this.motZ = d2; - float f3 = MathHelper.a(d0 * d0 + d2 * d2); - - this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); - this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); - this.i = 0; - } - - public void s_() { - super.s_(); - if (this.l > 0) { - double d0 = this.locX + (this.m - this.locX) / (double) this.l; - double d1 = this.locY + (this.n - this.locY) / (double) this.l; - double d2 = this.locZ + (this.o - this.locZ) / (double) this.l; - - double d3; - - for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { - ; - } - - while (d3 >= 180.0D) { - d3 -= 360.0D; - } - - this.yaw = (float) ((double) this.yaw + d3 / (double) this.l); - this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l); - --this.l; - this.setPosition(d0, d1, d2); - this.c(this.yaw, this.pitch); - } else { - if (!this.world.isStatic) { - ItemStack itemstack = this.owner.K(); - - if (this.owner.dead || !this.owner.ac() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.h(this.owner) > 1024.0D) { - this.die(); - this.owner.hookedFish = null; - return; - } - - if (this.c != null) { - if (!this.c.dead) { - this.locX = this.c.locX; - this.locY = this.c.boundingBox.b + (double) this.c.width * 0.8D; - this.locZ = this.c.locZ; - return; - } - - this.c = null; - } - } - - if (this.a > 0) { - --this.a; - } - - if (this.h) { - int i = this.world.getTypeId(this.d, this.e, this.f); - - if (i == this.g) { - ++this.i; - if (this.i == 1200) { - this.die(); - } - - return; - } - - this.h = false; - this.motX *= (double) (this.random.nextFloat() * 0.2F); - this.motY *= (double) (this.random.nextFloat() * 0.2F); - this.motZ *= (double) (this.random.nextFloat() * 0.2F); - this.i = 0; - this.j = 0; - } else { - ++this.j; - } - - Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ); - Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); - MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1); - - vec3d = Vec3D.create(this.locX, this.locY, this.locZ); - vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); - if (movingobjectposition != null) { - vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); - } - - Entity entity = null; - List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D)); - double d4 = 0.0D; - - double d5; - - for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - - if (entity1.r_() && (entity1 != this.owner || this.j >= 5)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); - - if (movingobjectposition1 != null) { - d5 = vec3d.b(movingobjectposition1.f); - if (d5 < d4 || d4 == 0.0D) { - entity = entity1; - d4 = d5; - } - } - } - } - - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - - if (movingobjectposition != null) { - if (movingobjectposition.entity != null) { - // CraftBukkit start - // TODO add EntityDamagedByProjectileEvent : fishing hook? - boolean stick; - if (movingobjectposition.entity instanceof EntityLiving) { - org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); - Projectile projectile = (Projectile) this.getBukkitEntity(); - - // TODO @see EntityArrow#162 - EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0); - this.world.getServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { - stick = !projectile.doesBounce(); - } else { - // this function returns if the fish should stick in or not, i.e. !bounce - stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), event.getDamage()); - } - } else { - stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), 0); - } - if (!stick) { - // CraftBukkit end - this.c = movingobjectposition.entity; - } - } else { - this.h = true; - } - } - - if (!this.h) { - this.move(this.motX, this.motY, this.motZ); - float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); - - this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); - - for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { - ; - } - - while (this.pitch - this.lastPitch >= 180.0F) { - this.lastPitch += 360.0F; - } - - while (this.yaw - this.lastYaw < -180.0F) { - this.lastYaw -= 360.0F; - } - - while (this.yaw - this.lastYaw >= 180.0F) { - this.lastYaw += 360.0F; - } - - this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; - this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; - float f2 = 0.92F; - - if (this.onGround || this.positionChanged) { - f2 = 0.5F; - } - - byte b0 = 5; - double d6 = 0.0D; - - for (int k = 0; k < b0; ++k) { - double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D; - double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D; - AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f); - - if (this.world.b(axisalignedbb1, Material.WATER)) { - d6 += 1.0D / (double) b0; - } - } - - if (d6 > 0.0D) { - if (this.k > 0) { - --this.k; - } else { - short short1 = 500; - - if (this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) { - short1 = 300; - } - - if (this.random.nextInt(short1) == 0) { - this.k = this.random.nextInt(30) + 10; - this.motY -= 0.20000000298023224D; - this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); - float f3 = (float) MathHelper.floor(this.boundingBox.b); - - float f4; - int l; - float f5; - - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - this.world.a("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); - } - - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ); - } - } - } - } - - if (this.k > 0) { - this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D; - } - - d5 = d6 * 2.0D - 1.0D; - this.motY += 0.03999999910593033D * d5; - if (d6 > 0.0D) { - f2 = (float) ((double) f2 * 0.9D); - this.motY *= 0.8D; - } - - this.motX *= (double) f2; - this.motY *= (double) f2; - this.motZ *= (double) f2; - this.setPosition(this.locX, this.locY, this.locZ); - } - } - } - - public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) this.d); - nbttagcompound.a("yTile", (short) this.e); - nbttagcompound.a("zTile", (short) this.f); - nbttagcompound.a("inTile", (byte) this.g); - nbttagcompound.a("shake", (byte) this.a); - nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); - } - - public void a(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.d("xTile"); - this.e = nbttagcompound.d("yTile"); - this.f = nbttagcompound.d("zTile"); - this.g = nbttagcompound.c("inTile") & 255; - this.a = nbttagcompound.c("shake") & 255; - this.h = nbttagcompound.c("inGround") == 1; - } - - public int i() { - byte b0 = 0; - - if (this.c != null) { - // CraftBukkit start - PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), this.c.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY); - this.world.getServer().getPluginManager().callEvent(playerFishEvent); - - if (playerFishEvent.isCancelled()) { - this.die(); - this.owner.hookedFish = null; - return 0; - } - // CraftBukkit end - double d0 = this.owner.locX - this.locX; - double d1 = this.owner.locY - this.locY; - double d2 = this.owner.locZ - this.locZ; - double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); - double d4 = 0.1D; - - this.c.motX += d0 * d4; - this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D; - this.c.motZ += d2 * d4; - b0 = 3; - } else if (this.k > 0) { - EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH)); - // CraftBukkit start - PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); - this.world.getServer().getPluginManager().callEvent(playerFishEvent); - - if (playerFishEvent.isCancelled()) { - this.die(); - this.owner.hookedFish = null; - return 0; - } - // CraftBukkit end - double d5 = this.owner.locX - this.locX; - double d6 = this.owner.locY - this.locY; - double d7 = this.owner.locZ - this.locZ; - double d8 = (double) MathHelper.a(d5 * d5 + d6 * d6 + d7 * d7); - double d9 = 0.1D; - - entityitem.motX = d5 * d9; - entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D; - entityitem.motZ = d7 * d9; - this.world.addEntity(entityitem); - this.owner.a(StatisticList.B, 1); - b0 = 1; - } - - if (this.h) { - // CraftBukkit start - PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND); - this.world.getServer().getPluginManager().callEvent(playerFishEvent); - - if (playerFishEvent.isCancelled()) { - this.die(); - this.owner.hookedFish = null; - return 0; - } - // CraftBukkit end - b0 = 2; - } - - // CraftBukkit start - if (b0 == 0) { - PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT); - this.world.getServer().getPluginManager().callEvent(playerFishEvent); - } - // CraftBukkit end - this.die(); - this.owner.hookedFish = null; - return b0; - } -} diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java new file mode 100644 index 00000000..a1ab1f25 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +1,410 @@ +package net.minecraft.server; + +import java.util.List; + +// CraftBukkit start +import org.bukkit.entity.Projectile; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerFishEvent; +// CraftBukkit end + +public class EntityFishingHook extends Entity { + + private int d = -1; + private int e = -1; + private int f = -1; + private int g = 0; + private boolean h = false; + public int a = 0; + public EntityHuman owner; + private int i; + private int j = 0; + private int k = 0; + public Entity c = null; + private int l; + private double m; + private double n; + private double o; + private double p; + private double q; + + public EntityFishingHook(World world) { + super(world); + this.b(0.25F, 0.25F); + this.bZ = true; + } + + public EntityFishingHook(World world, EntityHuman entityhuman) { + super(world); + this.bZ = true; + this.owner = entityhuman; + this.owner.hookedFish = this; + this.b(0.25F, 0.25F); + this.setPositionRotation(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch); + this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.locY -= 0.10000000149011612D; + this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.setPosition(this.locX, this.locY, this.locZ); + this.height = 0.0F; + float f = 0.4F; + + this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f); + this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); + } + + protected void b() {} + + public void a(double d0, double d1, double d2, float f, float f1) { + float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); + + d0 /= (double) f2; + d1 /= (double) f2; + d2 /= (double) f2; + d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d0 *= (double) f; + d1 *= (double) f; + d2 *= (double) f; + this.motX = d0; + this.motY = d1; + this.motZ = d2; + float f3 = MathHelper.a(d0 * d0 + d2 * d2); + + this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); + this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); + this.i = 0; + } + + public void s_() { + super.s_(); + if (this.l > 0) { + double d0 = this.locX + (this.m - this.locX) / (double) this.l; + double d1 = this.locY + (this.n - this.locY) / (double) this.l; + double d2 = this.locZ + (this.o - this.locZ) / (double) this.l; + + double d3; + + for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { + ; + } + + while (d3 >= 180.0D) { + d3 -= 360.0D; + } + + this.yaw = (float) ((double) this.yaw + d3 / (double) this.l); + this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l); + --this.l; + this.setPosition(d0, d1, d2); + this.c(this.yaw, this.pitch); + } else { + if (!this.world.isStatic) { + ItemStack itemstack = this.owner.K(); + + if (this.owner.dead || !this.owner.ac() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.h(this.owner) > 1024.0D) { + this.die(); + this.owner.hookedFish = null; + return; + } + + if (this.c != null) { + if (!this.c.dead) { + this.locX = this.c.locX; + this.locY = this.c.boundingBox.b + (double) this.c.width * 0.8D; + this.locZ = this.c.locZ; + return; + } + + this.c = null; + } + } + + if (this.a > 0) { + --this.a; + } + + if (this.h) { + int i = this.world.getTypeId(this.d, this.e, this.f); + + if (i == this.g) { + ++this.i; + if (this.i == 1200) { + this.die(); + } + + return; + } + + this.h = false; + this.motX *= (double) (this.random.nextFloat() * 0.2F); + this.motY *= (double) (this.random.nextFloat() * 0.2F); + this.motZ *= (double) (this.random.nextFloat() * 0.2F); + this.i = 0; + this.j = 0; + } else { + ++this.j; + } + + Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ); + Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1); + + vec3d = Vec3D.create(this.locX, this.locY, this.locZ); + vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + if (movingobjectposition != null) { + vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); + } + + Entity entity = null; + List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D)); + double d4 = 0.0D; + + double d5; + + for (int j = 0; j < list.size(); ++j) { + Entity entity1 = (Entity) list.get(j); + + if (entity1.r_() && (entity1 != this.owner || this.j >= 5)) { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); + + if (movingobjectposition1 != null) { + d5 = vec3d.b(movingobjectposition1.f); + if (d5 < d4 || d4 == 0.0D) { + entity = entity1; + d4 = d5; + } + } + } + } + + if (entity != null) { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null) { + if (movingobjectposition.entity != null) { + // CraftBukkit start + // TODO add EntityDamagedByProjectileEvent : fishing hook? + boolean stick; + if (movingobjectposition.entity instanceof EntityLiving) { + org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); + Projectile projectile = (Projectile) this.getBukkitEntity(); + + // TODO @see EntityArrow#162 + EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0); + this.world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + stick = !projectile.doesBounce(); + } else { + // this function returns if the fish should stick in or not, i.e. !bounce + stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), event.getDamage()); + } + } else { + stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), 0); + } + if (!stick) { + // CraftBukkit end + this.c = movingobjectposition.entity; + } + } else { + this.h = true; + } + } + + if (!this.h) { + this.move(this.motX, this.motY, this.motZ); + float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); + + this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); + + for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { + ; + } + + while (this.pitch - this.lastPitch >= 180.0F) { + this.lastPitch += 360.0F; + } + + while (this.yaw - this.lastYaw < -180.0F) { + this.lastYaw -= 360.0F; + } + + while (this.yaw - this.lastYaw >= 180.0F) { + this.lastYaw += 360.0F; + } + + this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; + this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; + float f2 = 0.92F; + + if (this.onGround || this.positionChanged) { + f2 = 0.5F; + } + + byte b0 = 5; + double d6 = 0.0D; + + for (int k = 0; k < b0; ++k) { + double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D; + double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D; + AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f); + + if (this.world.b(axisalignedbb1, Material.WATER)) { + d6 += 1.0D / (double) b0; + } + } + + if (d6 > 0.0D) { + if (this.k > 0) { + --this.k; + } else { + short short1 = 500; + + if (this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) { + short1 = 300; + } + + if (this.random.nextInt(short1) == 0) { + this.k = this.random.nextInt(30) + 10; + this.motY -= 0.20000000298023224D; + this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + float f3 = (float) MathHelper.floor(this.boundingBox.b); + + float f4; + int l; + float f5; + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); + } + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ); + } + } + } + } + + if (this.k > 0) { + this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D; + } + + d5 = d6 * 2.0D - 1.0D; + this.motY += 0.03999999910593033D * d5; + if (d6 > 0.0D) { + f2 = (float) ((double) f2 * 0.9D); + this.motY *= 0.8D; + } + + this.motX *= (double) f2; + this.motY *= (double) f2; + this.motZ *= (double) f2; + this.setPosition(this.locX, this.locY, this.locZ); + } + } + } + + public void b(NBTTagCompound nbttagcompound) { + nbttagcompound.a("xTile", (short) this.d); + nbttagcompound.a("yTile", (short) this.e); + nbttagcompound.a("zTile", (short) this.f); + nbttagcompound.a("inTile", (byte) this.g); + nbttagcompound.a("shake", (byte) this.a); + nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); + } + + public void a(NBTTagCompound nbttagcompound) { + this.d = nbttagcompound.d("xTile"); + this.e = nbttagcompound.d("yTile"); + this.f = nbttagcompound.d("zTile"); + this.g = nbttagcompound.c("inTile") & 255; + this.a = nbttagcompound.c("shake") & 255; + this.h = nbttagcompound.c("inGround") == 1; + } + + public int i() { + byte b0 = 0; + + if (this.c != null) { + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), this.c.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); + + if (playerFishEvent.isCancelled()) { + this.die(); + this.owner.hookedFish = null; + return 0; + } + // CraftBukkit end + double d0 = this.owner.locX - this.locX; + double d1 = this.owner.locY - this.locY; + double d2 = this.owner.locZ - this.locZ; + double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); + double d4 = 0.1D; + + this.c.motX += d0 * d4; + this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D; + this.c.motZ += d2 * d4; + b0 = 3; + } else if (this.k > 0) { + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH)); + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); + + if (playerFishEvent.isCancelled()) { + this.die(); + this.owner.hookedFish = null; + return 0; + } + // CraftBukkit end + double d5 = this.owner.locX - this.locX; + double d6 = this.owner.locY - this.locY; + double d7 = this.owner.locZ - this.locZ; + double d8 = (double) MathHelper.a(d5 * d5 + d6 * d6 + d7 * d7); + double d9 = 0.1D; + + entityitem.motX = d5 * d9; + entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D; + entityitem.motZ = d7 * d9; + this.world.addEntity(entityitem); + this.owner.a(StatisticList.B, 1); + b0 = 1; + } + + if (this.h) { + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); + + if (playerFishEvent.isCancelled()) { + this.die(); + this.owner.hookedFish = null; + return 0; + } + // CraftBukkit end + b0 = 2; + } + + // CraftBukkit start + if (b0 == 0) { + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); + } + // CraftBukkit end + this.die(); + this.owner.hookedFish = null; + return b0; + } +} diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java index 62d8baf3..2ef30782 100644 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -31,13 +31,13 @@ public class EntityGhast extends EntityFlying implements IMonster { public void s_() { super.s_(); - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png"; } protected void c_() { - if (!this.world.isStatic && this.world.spawnMonsters == 0) { + if (!this.world.isStatic && this.world.difficulty == 0) { this.die(); } @@ -140,7 +140,7 @@ public class EntityGhast extends EntityFlying implements IMonster { } if (!this.world.isStatic) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); byte b1 = (byte) (this.f > 10 ? 1 : 0); if (b0 != b1) { @@ -186,7 +186,7 @@ public class EntityGhast extends EntityFlying implements IMonster { } public boolean d() { - return this.random.nextInt(20) == 0 && super.d() && this.world.spawnMonsters > 0; + return this.random.nextInt(20) == 0 && super.d() && this.world.difficulty > 0; } public int m() { diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index ab564492..e77ba569 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -62,7 +62,7 @@ public abstract class EntityHuman extends EntityLiving { protected float O = 0.1F; protected float P = 0.02F; private int f = 0; - public EntityFish hookedFish = null; + public EntityFishingHook hookedFish = null; public EntityHuman(World world) { super(world); @@ -152,7 +152,7 @@ public abstract class EntityHuman extends EntityLiving { super.s_(); if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) { - this.x(); + this.closeInventory(); this.activeContainer = this.defaultContainer; } @@ -251,7 +251,7 @@ public abstract class EntityHuman extends EntityLiving { return this.health <= 0 || this.isSleeping(); } - protected void x() { + protected void closeInventory() { this.activeContainer = this.defaultContainer; } @@ -267,7 +267,7 @@ public abstract class EntityHuman extends EntityLiving { } private int o() { - return this.a(MobEffectList.e) ? 6 - (1 + this.b(MobEffectList.e).c()) * 1 : (this.a(MobEffectList.f) ? 6 + (1 + this.b(MobEffectList.f).c()) * 2 : 6); + return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6); } protected void c_() { @@ -291,7 +291,7 @@ public abstract class EntityHuman extends EntityLiving { --this.n; } - if (this.world.spawnMonsters == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { + if (this.world.difficulty == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { // CraftBukkit - added regain reason of "REGEN" for filtering purposes. this.c(1, RegainReason.REGEN); } @@ -301,7 +301,7 @@ public abstract class EntityHuman extends EntityLiving { super.s(); this.aj = this.O; this.ak = this.P; - if (this.at()) { + if (this.isSprinting()) { this.aj = (float) ((double) this.aj + (double) this.O * 0.3D); this.ak = (float) ((double) this.ak + (double) this.P * 0.3D); } @@ -442,12 +442,12 @@ public abstract class EntityHuman extends EntityLiving { f /= 5.0F; } - if (this.a(MobEffectList.e)) { - f *= 1.0F + (float) (this.b(MobEffectList.e).c() + 1) * 0.2F; + if (this.hasEffect(MobEffectList.FASTER_DIG)) { + f *= 1.0F + (float) (this.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F; } - if (this.a(MobEffectList.f)) { - f *= 1.0F - (float) (this.b(MobEffectList.f).c() + 1) * 0.2F; + if (this.hasEffect(MobEffectList.SLOWER_DIG)) { + f *= 1.0F - (float) (this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F; } return f; @@ -534,15 +534,15 @@ public abstract class EntityHuman extends EntityLiving { Entity entity = damagesource.getEntity(); if (entity instanceof EntityMonster || entity instanceof EntityArrow) { - if (this.world.spawnMonsters == 0) { + if (this.world.difficulty == 0) { i = 0; } - if (this.world.spawnMonsters == 1) { + if (this.world.difficulty == 1) { i = i / 3 + 1; } - if (this.world.spawnMonsters == 3) { + if (this.world.difficulty == 3) { i = i * 3 / 2; } } @@ -726,11 +726,11 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end if (flag1) { - if (this.at()) { + if (this.isSprinting()) { entity.b((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * 1.0F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * 1.0F)); this.motX *= 0.6D; this.motZ *= 0.6D; - this.g(false); + this.setSprinting(false); } if (flag) { @@ -975,7 +975,7 @@ public abstract class EntityHuman extends EntityLiving { protected void S() { super.S(); this.a(StatisticList.u, 1); - if (this.at()) { + if (this.isSprinting()) { this.b(0.8F); } else { this.b(0.2F); @@ -1026,7 +1026,7 @@ public abstract class EntityHuman extends EntityLiving { i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { this.a(StatisticList.l, i); - if (this.at()) { + if (this.isSprinting()) { this.b(0.099999994F * (float) i * 0.01F); } else { this.b(0.01F * (float) i * 0.01F); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 533638d8..05870457 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -59,7 +59,7 @@ public abstract class EntityLiving extends Entity { private int c = 0; public int aD = 0; public int aE = 0; - protected HashMap aF = new HashMap(); + protected HashMap effects = new HashMap(); protected int aG; protected double aH; protected double aI; @@ -144,7 +144,7 @@ public abstract class EntityLiving extends Entity { int i; - if (this.ac() && this.a(Material.WATER) && !this.b_() && !this.aF.containsKey(Integer.valueOf(MobEffectList.o.H))) { + if (this.ac() && this.a(Material.WATER) && !this.b_() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) { --this.airTicks; if (this.airTicks == -20) { this.airTicks = 0; @@ -691,17 +691,17 @@ public abstract class EntityLiving extends Entity { nbttagcompound.a("HurtTime", (short) this.hurtTicks); nbttagcompound.a("DeathTime", (short) this.deathTicks); nbttagcompound.a("AttackTime", (short) this.attackTicks); - if (!this.aF.isEmpty()) { + if (!this.effects.isEmpty()) { NBTTagList nbttaglist = new NBTTagList(); - Iterator iterator = this.aF.values().iterator(); + Iterator iterator = this.effects.values().iterator(); while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Id", (byte) mobeffect.a()); - nbttagcompound1.a("Amplifier", (byte) mobeffect.c()); - nbttagcompound1.a("Duration", mobeffect.b()); + nbttagcompound1.a("Id", (byte) mobeffect.getEffectId()); + nbttagcompound1.a("Amplifier", (byte) mobeffect.getAmplifier()); + nbttagcompound1.a("Duration", mobeffect.getDuration()); nbttaglist.a((NBTBase) nbttagcompound1); } @@ -727,7 +727,7 @@ public abstract class EntityLiving extends Entity { byte b1 = nbttagcompound1.c("Amplifier"); int j = nbttagcompound1.e("Duration"); - this.aF.put(Integer.valueOf(b0), new MobEffect(b0, j, b1)); + this.effects.put(Integer.valueOf(b0), new MobEffect(b0, j, b1)); } } } @@ -832,7 +832,7 @@ public abstract class EntityLiving extends Entity { protected void S() { this.motY = 0.41999998688697815D; - if (this.at()) { + if (this.isSprinting()) { float f = this.yaw * 0.017453292F; this.motX -= (double) (MathHelper.sin(f) * 0.2F); @@ -1021,37 +1021,37 @@ public abstract class EntityLiving extends Entity { } protected void aj() { - Iterator iterator = this.aF.keySet().iterator(); + Iterator iterator = this.effects.keySet().iterator(); while (iterator.hasNext()) { Integer integer = (Integer) iterator.next(); - MobEffect mobeffect = (MobEffect) this.aF.get(integer); + MobEffect mobeffect = (MobEffect) this.effects.get(integer); - if (!mobeffect.a(this) && !this.world.isStatic) { + if (!mobeffect.tick(this) && !this.world.isStatic) { iterator.remove(); this.c(mobeffect); } } } - public Collection ak() { - return this.aF.values(); + public Collection getEffects() { + return this.effects.values(); } - public boolean a(MobEffectList mobeffectlist) { - return this.aF.containsKey(Integer.valueOf(mobeffectlist.H)); + public boolean hasEffect(MobEffectList mobeffectlist) { + return this.effects.containsKey(Integer.valueOf(mobeffectlist.id)); } - public MobEffect b(MobEffectList mobeffectlist) { - return (MobEffect) this.aF.get(Integer.valueOf(mobeffectlist.H)); + public MobEffect getEffect(MobEffectList mobeffectlist) { + return (MobEffect) this.effects.get(Integer.valueOf(mobeffectlist.id)); } - public void d(MobEffect mobeffect) { - if (this.aF.containsKey(Integer.valueOf(mobeffect.a()))) { - ((MobEffect) this.aF.get(Integer.valueOf(mobeffect.a()))).a(mobeffect); - this.b((MobEffect) this.aF.get(Integer.valueOf(mobeffect.a()))); + public void addEffect(MobEffect mobeffect) { + if (this.effects.containsKey(Integer.valueOf(mobeffect.getEffectId()))) { + ((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))).a(mobeffect); + this.b((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))); } else { - this.aF.put(Integer.valueOf(mobeffect.a()), mobeffect); + this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect); this.a(mobeffect); } } @@ -1065,12 +1065,12 @@ public abstract class EntityLiving extends Entity { protected float D() { float f = 1.0F; - if (this.a(MobEffectList.c)) { - f *= 1.0F + 0.2F * (float) (this.b(MobEffectList.c).c() + 1); + if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) { + f *= 1.0F + 0.2F * (float) (this.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier() + 1); } - if (this.a(MobEffectList.d)) { - f *= 1.0F - 0.15F * (float) (this.b(MobEffectList.d).c() + 1); + if (this.hasEffect(MobEffectList.SLOWER_MOVEMENT)) { + f *= 1.0F - 0.15F * (float) (this.getEffect(MobEffectList.SLOWER_MOVEMENT).getAmplifier() + 1); } return f; diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index 6e68d17d..2edf909f 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -29,7 +29,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { public void s_() { super.s_(); - if (!this.world.isStatic && this.world.spawnMonsters == 0) { + if (!this.world.isStatic && this.world.difficulty == 0) { this.die(); } } diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java index c38d5a74..c4c00194 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -53,7 +53,7 @@ public class EntityPig extends EntityAnimal { } public boolean hasSaddle() { - return (this.datawatcher.a(16) & 1) != 0; + return (this.datawatcher.getByte(16) & 1) != 0; } public void setSaddle(boolean flag) { diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 6113c510..3c4cbd98 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -31,7 +31,7 @@ public class EntityPigZombie extends EntityZombie { } public boolean d() { - return this.world.spawnMonsters > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); + return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); } public void b(NBTTagCompound nbttagcompound) { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 6525269d..b782a093 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -172,7 +172,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.inventory.armor[i] = null; } - this.x(); + this.closeInventory(); // CraftBukkit end } @@ -265,7 +265,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (this.I) { //if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit if (this.activeContainer != this.defaultContainer) { - this.x(); + this.closeInventory(); } if (this.vehicle != null) { @@ -463,7 +463,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(ItemStack itemstack) {} - public void x() { + public void closeInventory() { this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); this.z(); } diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java index f32ecb2a..64bce954 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -82,21 +82,21 @@ public class EntitySheep extends EntityAnimal { } public int getColor() { - return this.datawatcher.a(16) & 15; + return this.datawatcher.getByte(16) & 15; } public void setColor(int i) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & 240 | i & 15))); } public boolean isSheared() { - return (this.datawatcher.a(16) & 16) != 0; + return (this.datawatcher.getByte(16) & 16) != 0; } public void setSheared(boolean flag) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); if (flag) { this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 16))); diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java index ee5e9986..a62eaf0b 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -8,7 +8,7 @@ import java.util.Set; public class EntityTracker { private Set a = new HashSet(); - private EntityList b = new EntityList(); + private EntityList trackedEntities = new EntityList(); private MinecraftServer c; private int d; private int e; @@ -22,7 +22,7 @@ public class EntityTracker { // CraftBukkit - synchronized public synchronized void track(Entity entity) { if (entity instanceof EntityPlayer) { - this.a(entity, 512, 2); + this.addEntity(entity, 512, 2); EntityPlayer entityplayer = (EntityPlayer) entity; Iterator iterator = this.a.iterator(); @@ -33,55 +33,55 @@ public class EntityTracker { entitytrackerentry.b(entityplayer); } } - } else if (entity instanceof EntityFish) { - this.a(entity, 64, 5, true); + } else if (entity instanceof EntityFishingHook) { + this.addEntity(entity, 64, 5, true); } else if (entity instanceof EntityArrow) { - this.a(entity, 64, 20, false); + this.addEntity(entity, 64, 20, false); } else if (entity instanceof EntityFireball) { - this.a(entity, 64, 10, false); + this.addEntity(entity, 64, 10, false); } else if (entity instanceof EntitySnowball) { - this.a(entity, 64, 10, true); + this.addEntity(entity, 64, 10, true); } else if (entity instanceof EntityEgg) { - this.a(entity, 64, 10, true); + this.addEntity(entity, 64, 10, true); } else if (entity instanceof EntityItem) { - this.a(entity, 64, 20, true); + this.addEntity(entity, 64, 20, true); } else if (entity instanceof EntityMinecart) { - this.a(entity, 160, 5, true); + this.addEntity(entity, 160, 5, true); } else if (entity instanceof EntityBoat) { - this.a(entity, 160, 5, true); + this.addEntity(entity, 160, 5, true); } else if (entity instanceof EntitySquid) { - this.a(entity, 160, 3, true); + this.addEntity(entity, 160, 3, true); } else if (entity instanceof IAnimal) { - this.a(entity, 160, 3, true); + this.addEntity(entity, 160, 3, true); } else if (entity instanceof EntityTNTPrimed) { - this.a(entity, 160, 10, true); + this.addEntity(entity, 160, 10, true); } else if (entity instanceof EntityFallingSand) { - this.a(entity, 160, 20, true); + this.addEntity(entity, 160, 20, true); } else if (entity instanceof EntityPainting) { - this.a(entity, 160, Integer.MAX_VALUE, false); + this.addEntity(entity, 160, Integer.MAX_VALUE, false); } else if (entity instanceof EntityExperienceOrb) { - this.a(entity, 160, 20, true); + this.addEntity(entity, 160, 20, true); } } - public void a(Entity entity, int i, int j) { - this.a(entity, i, j, false); + public void addEntity(Entity entity, int i, int j) { + this.addEntity(entity, i, j, false); } // CraftBukkit - synchronized - public synchronized void a(Entity entity, int i, int j, boolean flag) { + public synchronized void addEntity(Entity entity, int i, int j, boolean flag) { if (i > this.d) { i = this.d; } - if (this.b.b(entity.id)) { + if (this.trackedEntities.b(entity.id)) { // CraftBukkit - removed exception throw as tracking an already tracked entity theoretically shouldn't cause any issues. // throw new IllegalStateException("Entity is already tracked!"); } else { EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag); this.a.add(entitytrackerentry); - this.b.a(entity.id, entitytrackerentry); + this.trackedEntities.a(entity.id, entitytrackerentry); entitytrackerentry.scanPlayers(this.c.getWorldServer(this.e).players); } } @@ -99,7 +99,7 @@ public class EntityTracker { } } - EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.b.d(entity.id); + EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.id); if (entitytrackerentry1 != null) { this.a.remove(entitytrackerentry1); @@ -137,7 +137,7 @@ public class EntityTracker { // CraftBukkit - synchronized public synchronized void a(Entity entity, Packet packet) { - EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id); + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id); if (entitytrackerentry != null) { entitytrackerentry.a(packet); @@ -146,7 +146,7 @@ public class EntityTracker { // CraftBukkit - synchronized public synchronized void sendPacketToEntity(Entity entity, Packet packet) { - EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id); + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id); if (entitytrackerentry != null) { entitytrackerentry.b(packet); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index 4368f16d..bee64153 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -108,7 +108,7 @@ public class EntityTrackerEntry { this.a((Packet) object); } - DataWatcher datawatcher = this.tracker.al(); + DataWatcher datawatcher = this.tracker.getDataWatcher(); if (datawatcher.a()) { this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher))); @@ -212,7 +212,7 @@ public class EntityTrackerEntry { if (this.tracker instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) this.tracker; - Iterator iterator = entityliving.ak().iterator(); + Iterator iterator = entityliving.getEffects().iterator(); while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); @@ -271,7 +271,7 @@ public class EntityTrackerEntry { return new Packet23VehicleSpawn(this.tracker, 1); } else if (this.tracker instanceof IAnimal) { return new Packet24MobSpawn((EntityLiving) this.tracker); - } else if (this.tracker instanceof EntityFish) { + } else if (this.tracker instanceof EntityFishingHook) { return new Packet23VehicleSpawn(this.tracker, 90); } else if (this.tracker instanceof EntityArrow) { Entity entity = ((EntityArrow) this.tracker).shooter; @@ -286,9 +286,9 @@ public class EntityTrackerEntry { Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, shooter); // CraftBukkit end - packet23vehiclespawn.e = (int) (entityfireball.c * 8000.0D); - packet23vehiclespawn.f = (int) (entityfireball.d * 8000.0D); - packet23vehiclespawn.g = (int) (entityfireball.e * 8000.0D); + packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D); + packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D); + packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D); return packet23vehiclespawn; } else if (this.tracker instanceof EntityEgg) { return new Packet23VehicleSpawn(this.tracker, 62); diff --git a/src/main/java/net/minecraft/server/EntityWeatherStorm.java b/src/main/java/net/minecraft/server/EntityWeatherStorm.java index b9adf026..6706e4f0 100644 --- a/src/main/java/net/minecraft/server/EntityWeatherStorm.java +++ b/src/main/java/net/minecraft/server/EntityWeatherStorm.java @@ -37,7 +37,7 @@ public class EntityWeatherStorm extends EntityWeather { this.a = this.random.nextLong(); this.c = this.random.nextInt(3) + 1; // CraftBukkit - if (!isEffect && world.spawnMonsters >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { + if (!isEffect && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { int i = MathHelper.floor(d0); int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java index cc4b15de..2fa72eed 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -69,7 +69,7 @@ public class EntityWolf extends EntityAnimal { } protected String h() { - return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); } protected String i() { @@ -382,7 +382,7 @@ public class EntityWolf extends EntityAnimal { if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) { ItemFood itemfood = (ItemFood) Item.byId[itemstack.id]; - if (itemfood.m() && this.datawatcher.b(18) < 20) { + if (itemfood.m() && this.datawatcher.getInt(18) < 20) { --itemstack.count; this.c(itemfood.k(), RegainReason.EATING); // Craftbukkit if (itemstack.count <= 0) { @@ -428,7 +428,7 @@ public class EntityWolf extends EntityAnimal { } public String getOwnerName() { - return this.datawatcher.c(17); + return this.datawatcher.getString(17); } public void setOwnerName(String s) { @@ -436,11 +436,11 @@ public class EntityWolf extends EntityAnimal { } public boolean isSitting() { - return (this.datawatcher.a(16) & 1) != 0; + return (this.datawatcher.getByte(16) & 1) != 0; } public void setSitting(boolean flag) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); if (flag) { this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1))); @@ -450,11 +450,11 @@ public class EntityWolf extends EntityAnimal { } public boolean isAngry() { - return (this.datawatcher.a(16) & 2) != 0; + return (this.datawatcher.getByte(16) & 2) != 0; } public void setAngry(boolean flag) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); if (flag) { this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 2))); @@ -464,11 +464,11 @@ public class EntityWolf extends EntityAnimal { } public boolean isTamed() { - return (this.datawatcher.a(16) & 4) != 0; + return (this.datawatcher.getByte(16) & 4) != 0; } public void setTamed(boolean flag) { - byte b0 = this.datawatcher.a(16); + byte b0 = this.datawatcher.getByte(16); if (flag) { this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 4))); diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 768e42d7..c07c921a 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -27,7 +27,7 @@ public class FoodMetaData { } public void a(EntityHuman entityhuman) { - int i = entityhuman.world.spawnMonsters; + int i = entityhuman.world.difficulty; this.e = this.foodLevel; if (this.exhaustionLevel > 4.0F) { diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index fecaa40d..27c5c3ff 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -5,7 +5,7 @@ public class InventoryPlayer implements IInventory { public ItemStack[] items = new ItemStack[36]; public ItemStack[] armor = new ItemStack[4]; public int itemInHandIndex = 0; - public EntityHuman d; // CraftBukkit - private -> public + public EntityHuman d; private ItemStack f; public boolean e = false; diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java index c913be6e..cf5715a4 100644 --- a/src/main/java/net/minecraft/server/ItemFishingRod.java +++ b/src/main/java/net/minecraft/server/ItemFishingRod.java @@ -27,7 +27,7 @@ public class ItemFishingRod extends Item { // CraftBukkit end world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (b.nextFloat() * 0.4F + 0.8F)); if (!world.isStatic) { - world.addEntity(new EntityFish(world, entityhuman)); + world.addEntity(new EntityFishingHook(world, entityhuman)); } entityhuman.v(); diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java index de2baffa..dd02041f 100644 --- a/src/main/java/net/minecraft/server/ItemFood.java +++ b/src/main/java/net/minecraft/server/ItemFood.java @@ -39,7 +39,7 @@ public class ItemFood extends Item { // CraftBukkit end if (!world.isStatic && this.bx > 0 && world.random.nextFloat() < this.bA) { - entityhuman.d(new MobEffect(this.bx, this.by * 20, this.bz)); + entityhuman.addEffect(new MobEffect(this.bx, this.by * 20, this.bz)); } return itemstack; diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 64d53648..eb4f2b30 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -102,7 +102,7 @@ public final class ItemStack { } public boolean d() { - return Item.byId[this.id].e() > 0; + return Item.byId[this.id].getMaxDurability() > 0; } public boolean usesData() { @@ -126,7 +126,7 @@ public final class ItemStack { } public int i() { - return Item.byId[this.id].e(); + return Item.byId[this.id].getMaxDurability(); } public void damage(int i, Entity entity) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 1fc7940f..cff20b59 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -229,9 +229,9 @@ public class MinecraftServer implements Runnable, ICommandListener { world.tracker = new EntityTracker(this, dimension); world.addIWorldAccess(new WorldManager(this, world)); - world.spawnMonsters = this.propertyManager.getInt("difficulty", 1); + world.difficulty = this.propertyManager.getInt("difficulty", 1); world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); - world.p().d(j); + world.p().setGameType(j); this.worlds.add(world); this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); } @@ -312,7 +312,7 @@ public class MinecraftServer implements Runnable, ICommandListener { } WorldServer world = this.worlds.get(0); - if (!world.canSave) { + if (!world.savingDisabled) { this.serverConfigurationManager.savePlayers(); } // CraftBukkit end @@ -339,7 +339,7 @@ public class MinecraftServer implements Runnable, ICommandListener { // CraftBukkit end } - public void a() { + public void safeShutdown() { this.isRunning = false; } @@ -464,7 +464,7 @@ public class MinecraftServer implements Runnable, ICommandListener { ; } - worldserver.cleanUp(); + worldserver.tickEntities(); } // } // CraftBukkit diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 59ce9327..e1c7ba6a 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -91,14 +91,14 @@ public class NetLoginHandler extends NetHandler { WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); - entityplayer.itemInWorldManager.b(worldserver.p().n()); + entityplayer.itemInWorldManager.b(worldserver.p().getGameType()); NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer); int i = entityplayer.id; long j = worldserver.getSeed(); int k = entityplayer.itemInWorldManager.a(); byte b0 = (byte) worldserver.worldProvider.dimension; - byte b1 = (byte) worldserver.spawnMonsters; + byte b1 = (byte) worldserver.difficulty; worldserver.getClass(); // CraftBukkit start -- Don't send a higher than 126 MaxPlayer size, otherwise the PlayerInfo window won't render correctly. @@ -117,7 +117,7 @@ public class NetLoginHandler extends NetHandler { netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); this.server.networkListenThread.a(netserverhandler); netserverhandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // CraftBukkit - add support for player specific time - Iterator iterator = entityplayer.ak().iterator(); + Iterator iterator = entityplayer.getEffects().iterator(); while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 11c2438d..0f4dcf10 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -863,9 +863,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } else if (packet19entityaction.animation == 2) { this.player.setSneak(false); } else if (packet19entityaction.animation == 4) { - this.player.g(true); + this.player.setSprinting(true); } else if (packet19entityaction.animation == 5) { - this.player.g(false); + this.player.setSprinting(false); } else if (packet19entityaction.animation == 3) { this.player.a(false, true, true); this.checkMovement = false; diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java index 6a186b54..5108b1cf 100644 --- a/src/main/java/net/minecraft/server/PropertyManager.java +++ b/src/main/java/net/minecraft/server/PropertyManager.java @@ -90,8 +90,7 @@ public class PropertyManager { } } - public void b(String s, boolean flag) { - flag = this.getOverride(s, flag); // CraftBukkit + public void setBoolean(String s, boolean flag) { this.properties.setProperty(s, "" + flag); this.savePropertiesFile(); } diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 1a78fa3b..16c85b31 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -35,14 +35,14 @@ public class ServerConfigurationManager { public int maxPlayers; // CraftBukkit - private -> public public Set banByName = new HashSet(); // CraftBukkit - private -> public public Set banByIP = new HashSet(); // CraftBukkit - private -> public - private Set h = new HashSet(); - private Set i = new HashSet(); + private Set operators = new HashSet(); + private Set whitelist = new HashSet(); private File j; private File k; private File l; private File m; public PlayerFileData playerFileData; // CraftBukkit - private - >public - public boolean o; // Craftbukkit - private -> public + public boolean hasWhitelist; // Craftbukkit - private -> public private int p = 0; // CraftBukkit start @@ -63,7 +63,7 @@ public class ServerConfigurationManager { // CraftBukkit - removed playermanagers this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20); - this.o = minecraftserver.propertyManager.getBoolean("white-list", false); + this.hasWhitelist = minecraftserver.propertyManager.getBoolean("white-list", false); this.i(); this.k(); this.m(); @@ -271,7 +271,7 @@ public class ServerConfigurationManager { // CraftBukkit start byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); - entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.spawnMonsters, worldserver.getSeed(), 128, entityplayer1.itemInWorldManager.a())); + entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getSeed(), 128, entityplayer1.itemInWorldManager.a())); entityplayer1.spawnIn(worldserver); entityplayer1.dead = false; entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch)); @@ -375,12 +375,12 @@ public class ServerConfigurationManager { return s; } - public void a(String s) { + public void addUserBan(String s) { this.banByName.add(s.toLowerCase()); this.j(); } - public void b(String s) { + public void removeUserBan(String s) { this.banByName.remove(s.toLowerCase()); this.j(); } @@ -418,12 +418,12 @@ public class ServerConfigurationManager { } } - public void c(String s) { + public void addIpBan(String s) { this.banByIP.add(s.toLowerCase()); this.l(); } - public void d(String s) { + public void removeIpBan(String s) { this.banByIP.remove(s.toLowerCase()); this.l(); } @@ -461,8 +461,8 @@ public class ServerConfigurationManager { } } - public void e(String s) { - this.h.add(s.toLowerCase()); + public void addOp(String s) { + this.operators.add(s.toLowerCase()); this.n(); // Craftbukkit start @@ -473,8 +473,8 @@ public class ServerConfigurationManager { // Craftbukkit end } - public void f(String s) { - this.h.remove(s.toLowerCase()); + public void removeOp(String s) { + this.operators.remove(s.toLowerCase()); this.n(); // Craftbukkit start @@ -487,12 +487,12 @@ public class ServerConfigurationManager { private void m() { try { - this.h.clear(); + this.operators.clear(); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l)); String s = ""; while ((s = bufferedreader.readLine()) != null) { - this.h.add(s.trim().toLowerCase()); + this.operators.add(s.trim().toLowerCase()); } bufferedreader.close(); @@ -505,7 +505,7 @@ public class ServerConfigurationManager { private void n() { try { PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false)); - Iterator iterator = this.h.iterator(); + Iterator iterator = this.operators.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); @@ -522,12 +522,12 @@ public class ServerConfigurationManager { private void o() { try { - this.i.clear(); + this.whitelist.clear(); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m)); String s = ""; while ((s = bufferedreader.readLine()) != null) { - this.i.add(s.trim().toLowerCase()); + this.whitelist.add(s.trim().toLowerCase()); } bufferedreader.close(); @@ -539,7 +539,7 @@ public class ServerConfigurationManager { private void p() { try { PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false)); - Iterator iterator = this.i.iterator(); + Iterator iterator = this.whitelist.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); @@ -555,11 +555,11 @@ public class ServerConfigurationManager { public boolean isWhitelisted(String s) { s = s.trim().toLowerCase(); - return !this.o || this.h.contains(s) || this.i.contains(s); + return !this.hasWhitelist || this.operators.contains(s) || this.whitelist.contains(s); } public boolean isOp(String s) { - return this.h.contains(s.trim().toLowerCase()); + return this.operators.contains(s.trim().toLowerCase()); } public EntityPlayer i(String s) { @@ -633,21 +633,21 @@ public class ServerConfigurationManager { public void a(int i, int j, int k, TileEntity tileentity) {} - public void k(String s) { - this.i.add(s); + public void addWhitelist(String s) { + this.whitelist.add(s); this.p(); } - public void l(String s) { - this.i.remove(s); + public void removeWhitelist(String s) { + this.whitelist.remove(s); this.p(); } - public Set e() { - return this.i; + public Set getWhitelisted() { + return this.whitelist; } - public void f() { + public void reloadWhitelist() { this.o(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index f4cf254d..1872cd94 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -31,11 +31,11 @@ import org.bukkit.block.BlockState; public class World implements IBlockAccess { - public final int a = 7; - public final int b = 11; - public final int c = 128; - public final int d = 127; - public final int e = 63; + public final int heightBits = 7; + public final int heightBitsPlusFour = 11; + public final int height = 128; + public final int heightMinusOne = 127; + public final int seaLevel = 63; public boolean f = false; public List entityList = new ArrayList(); private List M = new ArrayList(); @@ -59,7 +59,7 @@ public class World implements IBlockAccess { public boolean suppressPhysics = false; private long S = System.currentTimeMillis(); protected int u = 40; - public int spawnMonsters; + public int difficulty; public Random random = new Random(); public boolean x = false; public WorldProvider worldProvider; // CraftBukkit - remove final @@ -1038,7 +1038,7 @@ public class World implements IBlockAccess { } } - public void cleanUp() { + public void tickEntities() { int i; Entity entity; @@ -1604,7 +1604,7 @@ public class World implements IBlockAccess { if (this.everyoneDeeplySleeping()) { boolean flag = false; - if (this.allowMonsters && this.spawnMonsters >= 1) { + if (this.allowMonsters && this.difficulty >= 1) { flag = SpawnerCreature.a(this, this.players); } diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java index 7d88c11e..c824df21 100644 --- a/src/main/java/net/minecraft/server/WorldData.java +++ b/src/main/java/net/minecraft/server/WorldData.java @@ -4,82 +4,82 @@ import java.util.List; public class WorldData { - private long a; - private int b; - private int c; - private int d; - private long e; - private long f; - private long g; - private NBTTagCompound h; - private int i; + private long seed; + private int spawnX; + private int spawnY; + private int spawnZ; + private long time; + private long lastPlayed; + private long sizeOnDisk; + private NBTTagCompound playerData; + private int dimension; public String name; // CraftBukkit - private -> public - private int k; - private boolean l; - private int m; - private boolean n; - private int o; - public int p; // CraftBukkit - private -> public - private boolean q; + private int version; + private boolean isRaining; + private int rainTicks; + private boolean isThundering; + private int thunderTicks; + private int gameType; + private boolean useMapFeatures; public WorldData(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.getLong("RandomSeed"); - this.p = nbttagcompound.e("GameType"); + this.seed = nbttagcompound.getLong("RandomSeed"); + this.gameType = nbttagcompound.e("GameType"); if (nbttagcompound.hasKey("MapFeatures")) { - this.q = nbttagcompound.m("MapFeatures"); + this.useMapFeatures = nbttagcompound.m("MapFeatures"); } else { - this.q = true; + this.useMapFeatures = true; } - this.b = nbttagcompound.e("SpawnX"); - this.c = nbttagcompound.e("SpawnY"); - this.d = nbttagcompound.e("SpawnZ"); - this.e = nbttagcompound.getLong("Time"); - this.f = nbttagcompound.getLong("LastPlayed"); - this.g = nbttagcompound.getLong("SizeOnDisk"); + this.spawnX = nbttagcompound.e("SpawnX"); + this.spawnY = nbttagcompound.e("SpawnY"); + this.spawnZ = nbttagcompound.e("SpawnZ"); + this.time = nbttagcompound.getLong("Time"); + this.lastPlayed = nbttagcompound.getLong("LastPlayed"); + this.sizeOnDisk = nbttagcompound.getLong("SizeOnDisk"); this.name = nbttagcompound.getString("LevelName"); - this.k = nbttagcompound.e("version"); - this.m = nbttagcompound.e("rainTime"); - this.l = nbttagcompound.m("raining"); - this.o = nbttagcompound.e("thunderTime"); - this.n = nbttagcompound.m("thundering"); + this.version = nbttagcompound.e("version"); + this.rainTicks = nbttagcompound.e("rainTime"); + this.isRaining = nbttagcompound.m("raining"); + this.thunderTicks = nbttagcompound.e("thunderTime"); + this.isThundering = nbttagcompound.m("thundering"); if (nbttagcompound.hasKey("Player")) { - this.h = nbttagcompound.k("Player"); - this.i = this.h.e("Dimension"); + this.playerData = nbttagcompound.k("Player"); + this.dimension = this.playerData.e("Dimension"); } } public WorldData(WorldSettings worldsettings, String s) { - this.a = worldsettings.a(); - this.p = worldsettings.b(); - this.q = worldsettings.c(); + this.seed = worldsettings.a(); + this.gameType = worldsettings.b(); + this.useMapFeatures = worldsettings.c(); this.name = s; } public WorldData(WorldData worlddata) { - this.a = worlddata.a; - this.p = worlddata.p; - this.q = worlddata.q; - this.b = worlddata.b; - this.c = worlddata.c; - this.d = worlddata.d; - this.e = worlddata.e; - this.f = worlddata.f; - this.g = worlddata.g; - this.h = worlddata.h; - this.i = worlddata.i; + this.seed = worlddata.seed; + this.gameType = worlddata.gameType; + this.useMapFeatures = worlddata.useMapFeatures; + this.spawnX = worlddata.spawnX; + this.spawnY = worlddata.spawnY; + this.spawnZ = worlddata.spawnZ; + this.time = worlddata.time; + this.lastPlayed = worlddata.lastPlayed; + this.sizeOnDisk = worlddata.sizeOnDisk; + this.playerData = worlddata.playerData; + this.dimension = worlddata.dimension; this.name = worlddata.name; - this.k = worlddata.k; - this.m = worlddata.m; - this.l = worlddata.l; - this.o = worlddata.o; - this.n = worlddata.n; + this.version = worlddata.version; + this.rainTicks = worlddata.rainTicks; + this.isRaining = worlddata.isRaining; + this.thunderTicks = worlddata.thunderTicks; + this.isThundering = worlddata.isThundering; } public NBTTagCompound a() { NBTTagCompound nbttagcompound = new NBTTagCompound(); - this.a(nbttagcompound, this.h); + this.a(nbttagcompound, this.playerData); return nbttagcompound; } @@ -102,66 +102,66 @@ public class WorldData { } private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { - nbttagcompound.setLong("RandomSeed", this.a); - nbttagcompound.a("GameType", this.p); - nbttagcompound.a("MapFeatures", this.q); - nbttagcompound.a("SpawnX", this.b); - nbttagcompound.a("SpawnY", this.c); - nbttagcompound.a("SpawnZ", this.d); - nbttagcompound.setLong("Time", this.e); - nbttagcompound.setLong("SizeOnDisk", this.g); + nbttagcompound.setLong("RandomSeed", this.seed); + nbttagcompound.a("GameType", this.gameType); + nbttagcompound.a("MapFeatures", this.useMapFeatures); + nbttagcompound.a("SpawnX", this.spawnX); + nbttagcompound.a("SpawnY", this.spawnY); + nbttagcompound.a("SpawnZ", this.spawnZ); + nbttagcompound.setLong("Time", this.time); + nbttagcompound.setLong("SizeOnDisk", this.sizeOnDisk); nbttagcompound.setLong("LastPlayed", System.currentTimeMillis()); nbttagcompound.setString("LevelName", this.name); - nbttagcompound.a("version", this.k); - nbttagcompound.a("rainTime", this.m); - nbttagcompound.a("raining", this.l); - nbttagcompound.a("thunderTime", this.o); - nbttagcompound.a("thundering", this.n); + nbttagcompound.a("version", this.version); + nbttagcompound.a("rainTime", this.rainTicks); + nbttagcompound.a("raining", this.isRaining); + nbttagcompound.a("thunderTime", this.thunderTicks); + nbttagcompound.a("thundering", this.isThundering); if (nbttagcompound1 != null) { nbttagcompound.a("Player", nbttagcompound1); } } public long getSeed() { - return this.a; + return this.seed; } public int c() { - return this.b; + return this.spawnX; } public int d() { - return this.c; + return this.spawnY; } public int e() { - return this.d; + return this.spawnZ; } public long f() { - return this.e; + return this.time; } public long g() { - return this.g; + return this.sizeOnDisk; } public int h() { - return this.i; + return this.dimension; } public void a(long i) { - this.e = i; + this.time = i; } public void b(long i) { - this.g = i; + this.sizeOnDisk = i; } public void setSpawn(int i, int j, int k) { - this.b = i; - this.c = j; - this.d = k; + this.spawnX = i; + this.spawnY = j; + this.spawnZ = k; } public void a(String s) { @@ -169,54 +169,54 @@ public class WorldData { } public int i() { - return this.k; + return this.version; } public void a(int i) { - this.k = i; + this.version = i; } public boolean isThundering() { - return this.n; + return this.isThundering; } public void setThundering(boolean flag) { - this.n = flag; + this.isThundering = flag; } public int getThunderDuration() { - return this.o; + return this.thunderTicks; } public void setThunderDuration(int i) { - this.o = i; + this.thunderTicks = i; } public boolean hasStorm() { - return this.l; + return this.isRaining; } public void setStorm(boolean flag) { - this.l = flag; + this.isRaining = flag; } public int getWeatherDuration() { - return this.m; + return this.rainTicks; } public void setWeatherDuration(int i) { - this.m = i; + this.rainTicks = i; } - public int n() { - return this.p; + public int getGameType() { + return this.gameType; } public boolean o() { - return this.q; + return this.useMapFeatures; } - public void d(int i) { - this.p = i; + public void setGameType(int i) { + this.gameType = i; } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 3faa9ac4..c077d03d 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -18,7 +18,7 @@ public class WorldServer extends World implements BlockChangeDelegate { public ChunkProviderServer chunkProviderServer; public boolean weirdIsOpCache = false; - public boolean canSave; + public boolean savingDisabled; public final MinecraftServer server; // CraftBukkit - private -> public final private EntityList Q = new EntityList(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index c03f1c7a..9a3c4b53 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -154,7 +154,7 @@ public class CraftChunk implements Chunk { if (includeBiome || includeBiomeTempRain) { WorldChunkManager wcm = chunk.world.getWorldChunkManager(); - BiomeBase[] biomeBase = wcm.b((BiomeBase[])null, getX() << 4, getZ() << 4, 16, 16); + BiomeBase[] biomeBase = wcm.getBiomes((BiomeBase[])null, getX() << 4, getZ() << 4, 16, 16); if (includeBiome) { biome = new BiomeBase[256]; @@ -164,10 +164,10 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - float[] dat = wcm.a((float[]) null, getX() << 4, getZ() << 4, 16, 16); + float[] dat = wcm.getTemperatures((float[]) null, getX() << 4, getZ() << 4, 16, 16); for(int i = 0; i < 256; i++) biomeTemp[i] = dat[i]; - dat = wcm.b((float[]) null, getX() << 4, getZ() << 4, 16, 16); + dat = wcm.getWetness((float[]) null, getX() << 4, getZ() << 4, 16, 16); for(int i = 0; i < 256; i++) biomeRain[i] = dat[i]; } @@ -212,7 +212,7 @@ public class CraftChunk implements Chunk { if (includeBiome || includeBiomeTempRain) { WorldChunkManager wcm = world.getHandle().getWorldChunkManager(); - BiomeBase[] biomeBase = wcm.b((BiomeBase[])null, x << 4, z << 4, 16, 16); + BiomeBase[] biomeBase = wcm.getBiomes((BiomeBase[])null, x << 4, z << 4, 16, 16); if (includeBiome) { biome = new BiomeBase[256]; @@ -222,10 +222,10 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - float[] dat = wcm.a((float[]) null, x << 4, z << 4, 16, 16); + float[] dat = wcm.getTemperatures((float[]) null, x << 4, z << 4, 16, 16); for(int i = 0; i < 256; i++) biomeTemp[i] = dat[i]; - dat = wcm.b((float[]) null, x << 4, z << 4, 16, 16); + dat = wcm.getWetness((float[]) null, x << 4, z << 4, 16, 16); for(int i = 0; i < 256; i++) biomeRain[i] = dat[i]; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index 6e5c9c50..9c488ea2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -32,9 +32,9 @@ public class CraftOfflinePlayer implements OfflinePlayer { if (value == isOp()) return; if (value) { - server.getHandle().e(getName().toLowerCase()); + server.getHandle().addOp(getName().toLowerCase()); } else { - server.getHandle().f(getName().toLowerCase()); + server.getHandle().removeOp(getName().toLowerCase()); } } @@ -44,21 +44,21 @@ public class CraftOfflinePlayer implements OfflinePlayer { public void setBanned(boolean value) { if (value) { - server.getHandle().a(name.toLowerCase()); + server.getHandle().addUserBan(name.toLowerCase()); } else { - server.getHandle().b(name.toLowerCase()); + server.getHandle().removeUserBan(name.toLowerCase()); } } public boolean isWhitelisted() { - return server.getHandle().e().contains(name.toLowerCase()); + return server.getHandle().getWhitelisted().contains(name.toLowerCase()); } public void setWhitelisted(boolean value) { if (value) { - server.getHandle().k(name.toLowerCase()); + server.getHandle().addWhitelist(name.toLowerCase()); } else { - server.getHandle().l(name.toLowerCase()); + server.getHandle().removeWhitelist(name.toLowerCase()); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 7d1ce471..9129b58e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -366,7 +366,7 @@ public final class CraftServer implements Server { console.propertyManager = config; boolean animals = config.getBoolean("spawn-animals", console.spawnAnimals); - boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).spawnMonsters > 0); + boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).difficulty > 0); console.onlineMode = config.getBoolean("online-mode", console.onlineMode); console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals); @@ -374,7 +374,7 @@ public final class CraftServer implements Server { console.allowFlight = config.getBoolean("allow-flight", console.allowFlight); for (WorldServer world : console.worlds) { - world.spawnMonsters = monsters ? 1 : 0; + world.difficulty = monsters ? 1 : 0; world.setSpawnFlags(monsters, animals); } @@ -506,7 +506,7 @@ public final class CraftServer implements Server { internal.tracker = new EntityTracker(console, dimension); internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal)); - internal.spawnMonsters = 1; + internal.difficulty = 1; internal.setSpawnFlags(true, true); console.worlds.add(internal); @@ -757,7 +757,7 @@ public final class CraftServer implements Server { } public void shutdown() { - console.a(); + console.safeShutdown(); } public int broadcast(String message, String permission) { @@ -790,11 +790,11 @@ public final class CraftServer implements Server { } public void banIP(String address) { - server.c(address); + server.addIpBan(address); } public void unbanIP(String address) { - server.d(address); + server.removeIpBan(address); } public Set getBannedPlayers() { @@ -808,15 +808,14 @@ public final class CraftServer implements Server { } public void setWhitelist(boolean value) { - server.o = value; - console.propertyManager.b("white-list", value); - console.propertyManager.savePropertiesFile(); + server.hasWhitelist = value; + console.propertyManager.setBoolean("white-list", value); } public Set getWhitelistedPlayers() { Set result = new HashSet(); - for (Object name : server.e()) { + for (Object name : server.getWhitelisted()) { result.add(getOfflinePlayer((String)name)); } @@ -824,11 +823,11 @@ public final class CraftServer implements Server { } public void reloadWhitelist() { - server.f(); + server.reloadWhitelist(); } public GameMode getDefaultGameMode() { - return GameMode.getByValue(console.worlds.get(0).worldData.p); + return GameMode.getByValue(console.worlds.get(0).worldData.getGameType()); } public void setDefaultGameMode(GameMode mode) { @@ -837,7 +836,7 @@ public final class CraftServer implements Server { } for (World world : getWorlds()) { - ((CraftWorld)world).getHandle().worldData.p = mode.getValue(); + ((CraftWorld)world).getHandle().worldData.setGameType(mode.getValue()); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index ab507664..fc88acb6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -561,20 +561,20 @@ public class CraftWorld implements World { } public void save() { - boolean oldSave = world.canSave; + boolean oldSave = world.savingDisabled; - world.canSave = false; + world.savingDisabled = false; world.save(true, null); - world.canSave = oldSave; + world.savingDisabled = oldSave; } public boolean isAutoSave() { - return !world.canSave; + return !world.savingDisabled; } public void setAutoSave(boolean value) { - world.canSave = !value; + world.savingDisabled = !value; } public boolean hasStorm() { @@ -767,7 +767,7 @@ public class CraftWorld implements World { // what is this, I don't even } else if (Fish.class.isAssignableFrom(clazz)) { // this is not a fish, it's a bobber, and it's probably useless - entity = new EntityFish(world); + entity = new EntityFishingHook(world); entity.setLocation(x, y, z, pitch, yaw); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 36760e94..569a0bd9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -83,7 +83,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { else if (entity instanceof EntityEgg) { return new CraftEgg(server, (EntityEgg) entity); } else if (entity instanceof EntityFallingSand) { return new CraftFallingSand(server, (EntityFallingSand) entity); } else if (entity instanceof EntityFireball) { return new CraftFireball(server, (EntityFireball) entity); } - else if (entity instanceof EntityFish) { return new CraftFish(server, (EntityFish) entity); } + else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); } else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); } else if (entity instanceof EntityWeather) { if (entity instanceof EntityWeatherStorm) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index cdc8b396..1de19a62 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -50,7 +50,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball { } public Vector getDirection() { - return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e); + return new Vector(((EntityFireball) getHandle()).dirX, ((EntityFireball) getHandle()).dirY, ((EntityFireball) getHandle()).dirZ); } public void setDirection(Vector direction) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java index 61ccd0de..cff09a80 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java @@ -1,6 +1,6 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityFish; +import net.minecraft.server.EntityFishingHook; import net.minecraft.server.EntityHuman; import org.bukkit.craftbukkit.CraftServer; @@ -8,7 +8,7 @@ import org.bukkit.entity.Fish; import org.bukkit.entity.LivingEntity; public class CraftFish extends AbstractProjectile implements Fish { - public CraftFish(CraftServer server, EntityFish entity) { + public CraftFish(CraftServer server, EntityFishingHook entity) { super(server, entity); } @@ -18,8 +18,8 @@ public class CraftFish extends AbstractProjectile implements Fish { } public LivingEntity getShooter() { - if (((EntityFish) getHandle()).owner != null) { - return (LivingEntity) ((EntityFish) getHandle()).owner.getBukkitEntity(); + if (((EntityFishingHook) getHandle()).owner != null) { + return (LivingEntity) ((EntityFishingHook) getHandle()).owner.getBukkitEntity(); } return null; @@ -28,7 +28,7 @@ public class CraftFish extends AbstractProjectile implements Fish { public void setShooter(LivingEntity shooter) { if (shooter instanceof CraftHumanEntity) { - ((EntityFish) getHandle()).owner = (EntityHuman) ((CraftHumanEntity) shooter).entity; + ((EntityFishingHook) getHandle()).owner = (EntityHuman) ((CraftHumanEntity) shooter).entity; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 7ce51a20..2476be75 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -47,9 +47,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (value == isOp()) return; if (value) { - server.getHandle().e(getName()); + server.getHandle().addOp(getName()); } else { - server.getHandle().f(getName()); + server.getHandle().removeOp(getName()); } perm.recalculatePermissions(); @@ -299,11 +299,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean isSprinting() { - return getHandle().at(); + return getHandle().isSprinting(); } public void setSprinting(boolean sprinting) { - getHandle().g(sprinting); + getHandle().setSprinting(sprinting); } public void loadData() { @@ -398,21 +398,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setBanned(boolean value) { if (value) { - server.getHandle().a(getName().toLowerCase()); + server.getHandle().addUserBan(getName().toLowerCase()); } else { - server.getHandle().b(getName().toLowerCase()); + server.getHandle().removeUserBan(getName().toLowerCase()); } } public boolean isWhitelisted() { - return server.getHandle().e().contains(getName().toLowerCase()); + return server.getHandle().getWhitelisted().contains(getName().toLowerCase()); } public void setWhitelisted(boolean value) { if (value) { - server.getHandle().k(getName().toLowerCase()); + server.getHandle().addWhitelist(getName().toLowerCase()); } else { - server.getHandle().l(getName().toLowerCase()); + server.getHandle().removeWhitelist(getName().toLowerCase()); } } -- cgit v1.2.3