summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/BlockBloodStone.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockButton.java70
-rw-r--r--src/main/java/net/minecraft/server/BlockCactus.java18
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java46
-rw-r--r--src/main/java/net/minecraft/server/BlockDoor.java57
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java30
-rw-r--r--src/main/java/net/minecraft/server/BlockFlowing.java22
-rw-r--r--src/main/java/net/minecraft/server/BlockLeaves.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockLever.java54
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java32
-rw-r--r--src/main/java/net/minecraft/server/BlockPumpkin.java14
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java61
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneWire.java69
-rw-r--r--src/main/java/net/minecraft/server/BlockSign.java9
-rw-r--r--src/main/java/net/minecraft/server/BlockSoil.java42
-rw-r--r--src/main/java/net/minecraft/server/BlockStationary.java8
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java209
-rw-r--r--src/main/java/net/minecraft/server/ChunkProviderServer.java166
-rw-r--r--src/main/java/net/minecraft/server/ConsoleCommandHandler.java186
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogManager.java3
-rw-r--r--src/main/java/net/minecraft/server/Entity.java162
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java60
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java41
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java93
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java38
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java68
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java42
-rw-r--r--src/main/java/net/minecraft/server/EntityFish.java88
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java124
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java53
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java88
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java177
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java32
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java46
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java113
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java6
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowball.java58
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java10
-rw-r--r--src/main/java/net/minecraft/server/EntityTNTPrimed.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java18
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java188
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java4
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java144
-rw-r--r--src/main/java/net/minecraft/server/IInventory.java12
-rw-r--r--src/main/java/net/minecraft/server/InventoryCraftResult.java26
-rw-r--r--src/main/java/net/minecraft/server/InventoryCrafting.java40
-rw-r--r--src/main/java/net/minecraft/server/InventoryLargeChest.java34
-rw-r--r--src/main/java/net/minecraft/server/InventoryPlayer.java160
-rw-r--r--src/main/java/net/minecraft/server/ItemBed.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java94
-rw-r--r--src/main/java/net/minecraft/server/ItemBoat.java20
-rw-r--r--src/main/java/net/minecraft/server/ItemBucket.java46
-rw-r--r--src/main/java/net/minecraft/server/ItemDoor.java12
-rw-r--r--src/main/java/net/minecraft/server/ItemFlintAndSteel.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemHoe.java16
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java97
-rw-r--r--src/main/java/net/minecraft/server/ItemMinecart.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemRedstone.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemReed.java24
-rw-r--r--src/main/java/net/minecraft/server/ItemSeeds.java10
-rw-r--r--src/main/java/net/minecraft/server/ItemSign.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java18
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java208
-rw-r--r--src/main/java/net/minecraft/server/NetLoginHandler.java69
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java540
-rw-r--r--src/main/java/net/minecraft/server/NetworkManager.java53
-rw-r--r--src/main/java/net/minecraft/server/Packet.java3
-rw-r--r--src/main/java/net/minecraft/server/PlayerInstance.java102
-rw-r--r--src/main/java/net/minecraft/server/PlayerManager.java22
-rw-r--r--src/main/java/net/minecraft/server/PropertyManager.java29
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java218
-rw-r--r--src/main/java/net/minecraft/server/Slot.java24
-rw-r--r--src/main/java/net/minecraft/server/ThreadCommandReader.java14
-rw-r--r--src/main/java/net/minecraft/server/ThreadLoginVerifier.java107
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java56
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java60
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java128
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java64
-rw-r--r--src/main/java/net/minecraft/server/World.java584
-rw-r--r--src/main/java/net/minecraft/server/WorldData.java16
-rw-r--r--src/main/java/net/minecraft/server/WorldGenBigTree.java10
-rw-r--r--src/main/java/net/minecraft/server/WorldGenForest.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga1.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga2.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTrees.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldManager.java14
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java54
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftChunk.java22
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java60
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java142
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java54
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftChest.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java14
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftSign.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java56
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java3
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java36
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java2
115 files changed, 3152 insertions, 3172 deletions
diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java
index 9b2c0baf..5148d3f5 100644
--- a/src/main/java/net/minecraft/server/BlockBloodStone.java
+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java
@@ -13,8 +13,8 @@ public class BlockBloodStone extends Block {
}
// Craftbukkit start
- public void a(World world, int i, int j, int k, int l) {
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java
index 9ed938e9..3a36bb9d 100644
--- a/src/main/java/net/minecraft/server/BlockButton.java
+++ b/src/main/java/net/minecraft/server/BlockButton.java
@@ -28,11 +28,11 @@ public class BlockButton extends Block {
return false;
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : world.d(i, j, k + 1)));
}
- public void d(World world, int i, int j, int k, int l) {
+ public void postPlace(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
int j1 = i1 & 8;
@@ -49,14 +49,14 @@ public class BlockButton extends Block {
i1 = this.g(world, i, j, k);
}
- world.c(i, j, k, i1 + j1);
+ world.setData(i, j, k, i1 + j1);
}
private int g(World world, int i, int j, int k) {
return world.d(i - 1, j, k) ? 1 : (world.d(i + 1, j, k) ? 2 : (world.d(i, j, k - 1) ? 3 : (world.d(i, j, k + 1) ? 4 : 1)));
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
if (this.h(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
@@ -79,15 +79,15 @@ public class BlockButton extends Block {
if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
}
}
private boolean h(World world, int i, int j, int k) {
- if (!this.a(world, i, j, k)) {
+ if (!this.canPlace(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
return false;
} else {
return true;
@@ -119,10 +119,10 @@ public class BlockButton extends Block {
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.a(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman);
}
- public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
int l = world.getData(i, j, k);
int i1 = l & 7;
int j1 = 8 - (l & 8);
@@ -144,20 +144,20 @@ public class BlockButton extends Block {
}
// CraftBukkit end
- world.c(i, j, k, i1 + j1);
+ world.setData(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k);
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
- world.h(i, j, k, this.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
+ world.applyPhysics(i, j, k, this.id);
if (i1 == 1) {
- world.h(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
} else if (i1 == 2) {
- world.h(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
} else if (i1 == 3) {
- world.h(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
} else if (i1 == 4) {
- world.h(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
} else {
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
world.c(i, j, k, this.id, this.b());
@@ -165,27 +165,27 @@ public class BlockButton extends Block {
}
}
- public void b(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
if ((l & 8) > 0) {
- world.h(i, j, k, this.id);
+ world.applyPhysics(i, j, k, this.id);
int i1 = l & 7;
if (i1 == 1) {
- world.h(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
} else if (i1 == 2) {
- world.h(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
} else if (i1 == 3) {
- world.h(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
} else if (i1 == 4) {
- world.h(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
} else {
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
}
- super.b(world, i, j, k);
+ super.remove(world, i, j, k);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@@ -204,7 +204,7 @@ public class BlockButton extends Block {
}
}
- public boolean c() {
+ public boolean isPowerSource() {
return true;
}
@@ -217,28 +217,30 @@ public class BlockButton extends Block {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
+
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
server.getPluginManager().callEvent(eventRedstone);
+
if (eventRedstone.getNewCurrent() > 0) return;
// CraftBukkit end
- world.c(i, j, k, l & 7);
- world.h(i, j, k, this.id);
+ world.setData(i, j, k, l & 7);
+ world.applyPhysics(i, j, k, this.id);
int i1 = l & 7;
if (i1 == 1) {
- world.h(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
} else if (i1 == 2) {
- world.h(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
} else if (i1 == 3) {
- world.h(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
} else if (i1 == 4) {
- world.h(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
} else {
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
world.b(i, j, k, i, j, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 90aab767..c187615e 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -28,10 +28,10 @@ public class BlockCactus extends Block {
int i1 = world.getData(i, j, k);
if (i1 == 15) {
- world.e(i, j + 1, k, this.id);
- world.c(i, j, k, 0);
+ world.setTypeId(i, j + 1, k, this.id);
+ world.setData(i, j, k, 0);
} else {
- world.c(i, j, k, i1 + 1);
+ world.setData(i, j, k, i1 + 1);
}
}
}
@@ -51,14 +51,14 @@ public class BlockCactus extends Block {
return false;
}
- public boolean a(World world, int i, int j, int k) {
- return !super.a(world, i, j, k) ? false : this.f(world, i, j, k);
+ public boolean canPlace(World world, int i, int j, int k) {
+ return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
}
@@ -91,11 +91,11 @@ public class BlockCactus extends Block {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- entity.a((Entity) null, event.getDamage());
+ entity.damageEntity((Entity) null, event.getDamage());
}
return;
}
// CraftBukkit end
- entity.a((Entity) null, 1);
+ entity.damageEntity((Entity) null, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index 24abbf9f..9adce396 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -45,14 +45,14 @@ public class BlockDispenser extends BlockContainer {
b0 = 4;
}
- world.c(i, j, k, b0);
+ world.setData(i, j, k, b0);
}
public int a(int i) {
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId + 1 : this.textureId));
}
- public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.isStatic) {
return true;
} else {
@@ -64,7 +64,7 @@ public class BlockDispenser extends BlockContainer {
}
// CraftBukkit - private->public
- public void b(World world, int i, int j, int k, Random random) {
+ public void dispense(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
float f = 0.0F;
float f1 = 0.0F;
@@ -86,7 +86,7 @@ public class BlockDispenser extends BlockContainer {
double d2 = (double) k + (double) f1 * 0.5D + 0.5D;
if (itemstack == null) {
- world.a((double) i, (double) j, (double) k, "random.click", 1.0F, 1.2F);
+ world.makeSound((double) i, (double) j, (double) k, "random.click", 1.0F, 1.2F);
} else {
double d3;
@@ -94,20 +94,20 @@ public class BlockDispenser extends BlockContainer {
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
entityarrow.a((double) f, 0.10000000149011612D, (double) f1, 1.1F, 6.0F);
- world.a((Entity) entityarrow);
- world.a((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
+ world.addEntity(entityarrow);
+ world.makeSound((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
} else if (itemstack.id == Item.EGG.id) {
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
entityegg.a((double) f, 0.10000000149011612D, (double) f1, 1.1F, 6.0F);
- world.a((Entity) entityegg);
- world.a((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
+ world.addEntity(entityegg);
+ world.makeSound((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
} else if (itemstack.id == Item.SNOW_BALL.id) {
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
entitysnowball.a((double) f, 0.10000000149011612D, (double) f1, 1.1F, 6.0F);
- world.a((Entity) entitysnowball);
- world.a((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
+ world.addEntity(entitysnowball);
+ world.makeSound((double) i, (double) j, (double) k, "random.bow", 1.0F, 1.2F);
} else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
@@ -118,8 +118,8 @@ public class BlockDispenser extends BlockContainer {
entityitem.motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
entityitem.motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
entityitem.motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
- world.a((Entity) entityitem);
- world.a((double) i, (double) j, (double) k, "random.click", 1.0F, 1.0F);
+ world.addEntity(entityitem);
+ world.makeSound((double) i, (double) j, (double) k, "random.click", 1.0F, 1.0F);
}
for (int i1 = 0; i1 < 10; ++i1) {
@@ -136,9 +136,9 @@ public class BlockDispenser extends BlockContainer {
}
}
- public void a(World world, int i, int j, int k, int l) {
- if (l > 0 && Block.byId[l].c()) {
- boolean flag = world.p(i, j, k) || world.p(i, j + 1, k);
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ if (l > 0 && Block.byId[l].isPowerSource()) {
+ boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
if (flag) {
world.c(i, j, k, this.id, this.b());
@@ -147,8 +147,8 @@ public class BlockDispenser extends BlockContainer {
}
public void a(World world, int i, int j, int k, Random random) {
- if (world.p(i, j, k) || world.p(i, j + 1, k)) {
- this.b(world, i, j, k, random);
+ if (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k)) {
+ this.dispense(world, i, j, k, random);
}
}
@@ -156,23 +156,23 @@ public class BlockDispenser extends BlockContainer {
return new TileEntityDispenser();
}
- public void a(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = MathHelper.b((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0) {
- world.c(i, j, k, 2);
+ world.setData(i, j, k, 2);
}
if (l == 1) {
- world.c(i, j, k, 5);
+ world.setData(i, j, k, 5);
}
if (l == 2) {
- world.c(i, j, k, 3);
+ world.setData(i, j, k, 3);
}
if (l == 3) {
- world.c(i, j, k, 4);
+ world.setData(i, j, k, 4);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index fea50660..6a1f8342 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -51,7 +51,7 @@ public class BlockDoor extends Block {
}
public AxisAlignedBB d(World world, int i, int j, int k) {
- this.a((IBlockAccess) world, i, j, k);
+ this.a(world, i, j, k);
return super.d(world, i, j, k);
}
@@ -81,10 +81,10 @@ public class BlockDoor extends Block {
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.a(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman);
}
- public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
if (this.material == Material.ORE) {
return true;
} else {
@@ -92,21 +92,21 @@ public class BlockDoor extends Block {
if ((l & 8) != 0) {
if (world.getTypeId(i, j - 1, k) == this.id) {
- this.a(world, i, j - 1, k, entityhuman);
+ this.interact(world, i, j - 1, k, entityhuman);
}
return true;
} else {
if (world.getTypeId(i, j + 1, k) == this.id) {
- world.c(i, j + 1, k, (l ^ 4) + 8);
+ world.setData(i, j + 1, k, (l ^ 4) + 8);
}
- world.c(i, j, k, l ^ 4);
+ world.setData(i, j, k, l ^ 4);
world.b(i, j - 1, k, i, j, k);
if (Math.random() < 0.5D) {
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.random.nextFloat() * 0.1F + 0.9F);
} else {
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.random.nextFloat() * 0.1F + 0.9F);
}
return true;
@@ -114,56 +114,56 @@ public class BlockDoor extends Block {
}
}
- public void a(World world, int i, int j, int k, boolean flag) {
+ public void setDoor(World world, int i, int j, int k, boolean flag) {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
if (world.getTypeId(i, j - 1, k) == this.id) {
- this.a(world, i, j - 1, k, flag);
+ this.setDoor(world, i, j - 1, k, flag);
}
} else {
boolean flag1 = (world.getData(i, j, k) & 4) > 0;
if (flag1 != flag) {
if (world.getTypeId(i, j + 1, k) == this.id) {
- world.c(i, j + 1, k, (l ^ 4) + 8);
+ world.setData(i, j + 1, k, (l ^ 4) + 8);
}
- world.c(i, j, k, l ^ 4);
+ world.setData(i, j, k, l ^ 4);
world.b(i, j - 1, k, i, j, k);
if (Math.random() < 0.5D) {
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.random.nextFloat() * 0.1F + 0.9F);
} else {
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.random.nextFloat() * 0.1F + 0.9F);
}
}
}
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
if ((i1 & 8) != 0) {
if (world.getTypeId(i, j - 1, k) != this.id) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
- if (l > 0 && Block.byId[l].c()) {
- this.a(world, i, j - 1, k, l);
+ if (l > 0 && Block.byId[l].isPowerSource()) {
+ this.doPhysics(world, i, j - 1, k, l);
}
} else {
boolean flag = false;
if (world.getTypeId(i, j + 1, k) != this.id) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
flag = true;
}
if (!world.d(i, j - 1, k)) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
- world.e(i, j + 1, k, 0);
+ world.setTypeId(i, j + 1, k, 0);
}
}
@@ -171,8 +171,8 @@ public class BlockDoor extends Block {
if (!world.isStatic) {
this.a_(world, i, j, k, i1);
}
- } else if (l > 0 && Block.byId[l].c()) {
- boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);
+ } else if (l > 0 && Block.byId[l].isPowerSource()) {
+ boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
// Craftbukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld();
@@ -185,8 +185,11 @@ public class BlockDoor extends Block {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15: 0, power);
server.getPluginManager().callEvent(eventRedstone);
- this.a(world, i, j, k, eventRedstone.getNewCurrent() > 0);
+
+ flag1 = eventRedstone.getNewCurrent() > 0;
// Craftbukkit end
+
+ this.setDoor(world, i, j, k, flag1);
}
}
}
@@ -196,7 +199,7 @@ public class BlockDoor extends Block {
}
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
- this.a((IBlockAccess) world, i, j, k);
+ this.a(world, i, j, k);
return super.a(world, i, j, k, vec3d, vec3d1);
}
@@ -204,7 +207,7 @@ public class BlockDoor extends Block {
return (i & 4) == 0 ? i - 1 & 3 : i & 3;
}
- public boolean a(World world, int i, int j, int k) {
- return j >= 127 ? false : world.d(i, j - 1, k) && super.a(world, i, j, k) && super.a(world, i, j + 1, k);
+ public boolean canPlace(World world, int i, int j, int k) {
+ return j >= 127 ? false : world.d(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index b3cfc9e8..aed57422 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -53,17 +53,16 @@ public class BlockFire extends Block {
int l = world.getData(i, j, k);
if (l < 15) {
- world.c(i, j, k, l + 1);
+ world.setData(i, j, k, l + 1);
world.c(i, j, k, this.id, this.b());
}
if (!flag && !this.g(world, i, j, k)) {
if (!world.d(i, j - 1, k) || l > 3) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
- // CraftBukkit - Cast to IBlockAccess
- } else if (!flag && !this.b((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
- world.e(i, j, k, 0);
+ } else if (!flag && !this.b(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
+ world.setTypeId(i, j, k, 0);
} else {
if (l % 2 == 0 && l > 2) {
this.a(world, i + 1, j, k, 300, random);
@@ -106,7 +105,7 @@ public class BlockFire extends Block {
}
// CraftBukkit end
- world.e(i1, k1, j1, this.id);
+ world.setTypeId(i1, k1, j1, this.id);
}
}
}
@@ -142,21 +141,18 @@ public class BlockFire extends Block {
// CraftBukkit end
if (random.nextInt(2) == 0) {
- world.e(i, j, k, this.id);
+ world.setTypeId(i, j, k, this.id);
} else {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
if (flag) {
- Block.TNT.b(world, i, j, k, 0);
+ Block.TNT.postBreak(world, i, j, k, 0);
}
}
}
- // CraftBukkit start -- fix cast to IBlockAccess
- private boolean g(World world1, int i, int j, int k) {
- IBlockAccess world = (IBlockAccess) world1;
- // CraftBukkit end
+ private boolean g(World world, int i, int j, int k) {
return this.b(world, i + 1, j, k) ? true : (this.b(world, i - 1, j, k) ? true : (this.b(world, i, j - 1, k) ? true : (this.b(world, i, j + 1, k) ? true : (this.b(world, i, j, k - 1) ? true : this.b(world, i, j, k + 1)))));
}
@@ -191,20 +187,20 @@ public class BlockFire extends Block {
return i1 > l ? i1 : l;
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
return world.d(i, j - 1, k) || this.g(world, i, j, k);
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
}
public void e(World world, int i, int j, int k) {
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.a_(world, i, j, k)) {
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
} else {
world.c(i, j, k, this.id, this.b());
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index c7d78b9b..9848abad 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -23,9 +23,9 @@ public class BlockFlowing extends BlockFluids {
private void i(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- world.setTypeIdAndData(i, j, k, this.id + 1, l);
+ world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
world.b(i, j, k, i, j, k);
- world.g(i, j, k);
+ world.notify(i, j, k);
}
public void a(World world, int i, int j, int k, Random random) {
@@ -38,7 +38,7 @@ public class BlockFlowing extends BlockFluids {
int l = this.g(world, i, j, k);
byte b0 = 1;
- if (this.material == Material.LAVA && !world.m.d) {
+ if (this.material == Material.LAVA && !world.worldProvider.d) {
b0 = 2;
}
@@ -85,11 +85,11 @@ public class BlockFlowing extends BlockFluids {
if (i1 != l) {
l = i1;
if (i1 < 0) {
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
} else {
- world.c(i, j, k, i1);
+ world.setData(i, j, k, i1);
world.c(i, j, k, this.id, this.b());
- world.h(i, j, k, this.id);
+ world.applyPhysics(i, j, k, this.id);
}
} else if (flag) {
this.i(world, i, j, k);
@@ -107,9 +107,9 @@ public class BlockFlowing extends BlockFluids {
if (!event.isCancelled()) {
if (l >= 8) {
- world.b(i, j - 1, k, this.id, l);
+ world.setTypeIdAndData(i, j - 1, k, this.id, l);
} else {
- world.b(i, j - 1, k, this.id, l + 8);
+ world.setTypeIdAndData(i, j - 1, k, this.id, l + 8);
}
}
// CraftBukkit end
@@ -137,7 +137,7 @@ public class BlockFlowing extends BlockFluids {
}
if (!event.isCancelled()) {
- this.f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
+ this.flow(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
}
}
index++;
@@ -146,7 +146,7 @@ public class BlockFlowing extends BlockFluids {
}
}
- private void f(World world, int i, int j, int k, int l) {
+ private void flow(World world, int i, int j, int k, int l) {
if (this.l(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k);
@@ -158,7 +158,7 @@ public class BlockFlowing extends BlockFluids {
}
}
- world.b(i, j, k, this.id, l);
+ world.setTypeIdAndData(i, j, k, this.id, l);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index bd1a330d..05a45eb3 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -19,7 +19,7 @@ public class BlockLeaves extends BlockLeavesBase {
this.a(true);
}
- public void b(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k) {
byte b0 = 1;
int l = b0 + 1;
@@ -32,7 +32,7 @@ public class BlockLeaves extends BlockLeavesBase {
if (l1 == Block.LEAVES.id) {
int i2 = world.getData(i + i1, j + j1, k + k1);
- world.d(i + i1, j + j1, k + k1, i2 | 4);
+ world.setRawData(i + i1, j + j1, k + k1, i2 | 4);
}
}
}
@@ -114,7 +114,7 @@ public class BlockLeaves extends BlockLeavesBase {
l1 = this.a[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
- world.c(i, j, k, l & -5);
+ world.setData(i, j, k, l & -5);
} else {
this.g(world, i, j, k);
}
@@ -133,7 +133,7 @@ public class BlockLeaves extends BlockLeavesBase {
// CraftBukkit end
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
public int a(Random random) {
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index 71b8def7..aee41afa 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -21,17 +21,17 @@ public class BlockLever extends Block {
return false;
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : (world.d(i, j, k + 1) ? true : world.d(i, j - 1, k))));
}
- public void d(World world, int i, int j, int k, int l) {
+ public void postPlace(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
if (l == 1 && world.d(i, j - 1, k)) {
- i1 = 5 + world.k.nextInt(2);
+ i1 = 5 + world.random.nextInt(2);
}
if (l == 2 && world.d(i, j, k + 1)) {
@@ -50,10 +50,10 @@ public class BlockLever extends Block {
i1 = 1;
}
- world.c(i, j, k, i1 + j1);
+ world.setData(i, j, k, i1 + j1);
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
if (this.g(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
@@ -80,15 +80,15 @@ public class BlockLever extends Block {
if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
}
}
private boolean g(World world, int i, int j, int k) {
- if (!this.a(world, i, j, k)) {
+ if (!this.canPlace(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
return false;
} else {
return true;
@@ -114,10 +114,10 @@ public class BlockLever extends Block {
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.a(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman);
}
- public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.isStatic) {
return true;
} else {
@@ -140,47 +140,47 @@ public class BlockLever extends Block {
}
// CraftBukkit end
- world.c(i, j, k, i1 + j1);
+ world.setData(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k);
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 > 0 ? 0.6F : 0.5F);
- world.h(i, j, k, this.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 > 0 ? 0.6F : 0.5F);
+ world.applyPhysics(i, j, k, this.id);
if (i1 == 1) {
- world.h(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
} else if (i1 == 2) {
- world.h(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
} else if (i1 == 3) {
- world.h(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
} else if (i1 == 4) {
- world.h(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
} else {
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
return true;
}
}
- public void b(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
if ((l & 8) > 0) {
- world.h(i, j, k, this.id);
+ world.applyPhysics(i, j, k, this.id);
int i1 = l & 7;
if (i1 == 1) {
- world.h(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
} else if (i1 == 2) {
- world.h(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
} else if (i1 == 3) {
- world.h(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
} else if (i1 == 4) {
- world.h(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
} else {
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
}
- super.b(world, i, j, k);
+ super.remove(world, i, j, k);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@@ -199,7 +199,7 @@ public class BlockLever extends Block {
}
}
- public boolean c() {
+ public boolean isPowerSource() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index b48bb22b..44efad96 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -40,13 +40,13 @@ public class BlockPressurePlate extends Block {
return false;
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
return world.d(i, j - 1, k);
}
public void e(World world, int i, int j, int k) {}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
if (!world.d(i, j - 1, k)) {
@@ -55,7 +55,7 @@ public class BlockPressurePlate extends Block {
if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
}
@@ -129,19 +129,19 @@ public class BlockPressurePlate extends Block {
// CraftBukkit end
if (flag1 && !flag) {
- world.c(i, j, k, 1);
- world.h(i, j, k, this.id);
- world.h(i, j - 1, k, this.id);
+ world.setData(i, j, k, 1);
+ world.applyPhysics(i, j, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
world.b(i, j, k, i, j, k);
- world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag1 && flag) {
- world.c(i, j, k, 0);
- world.h(i, j, k, this.id);
- world.h(i, j - 1, k, this.id);
+ world.setData(i, j, k, 0);
+ world.applyPhysics(i, j, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
world.b(i, j, k, i, j, k);
- world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1) {
@@ -149,15 +149,15 @@ public class BlockPressurePlate extends Block {
}
}
- public void b(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
if (l > 0) {
- world.h(i, j, k, this.id);
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
}
- super.b(world, i, j, k);
+ super.remove(world, i, j, k);
}
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
@@ -179,7 +179,7 @@ public class BlockPressurePlate extends Block {
return world.getData(i, j, k) == 0 ? false : l == 1;
}
- public boolean c() {
+ public boolean isPowerSource() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java
index 0de996b4..ccec76ba 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java
@@ -1,10 +1,8 @@
package net.minecraft.server;
-// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.block.BlockRedstoneEvent;
-// CraftBukkit end
public class BlockPumpkin extends Block {
@@ -41,21 +39,21 @@ public class BlockPumpkin extends Block {
super.e(world, i, j, k);
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
return (l == 0 || Block.byId[l].material.isLiquid()) && world.d(i, j - 1, k);
}
- public void a(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = MathHelper.b((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
- world.c(i, j, k, l);
+ world.setData(i, j, k, l);
}
// Craftbukkit start
- public void a(World world, int i, int j, int k, int l) {
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 35b45841..dadad293 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -12,7 +12,7 @@ import org.bukkit.plugin.PluginManager;
public class BlockRedstoneTorch extends BlockTorch {
- private boolean a = false;
+ private boolean isOn = false;
private static List b = new ArrayList();
public int a(int i, int j) {
@@ -21,7 +21,7 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean a(World world, int i, int j, int k, boolean flag) {
if (flag) {
- b.add(new RedstoneUpdateInfo(i, j, k, world.l()));
+ b.add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
}
int l = 0;
@@ -42,7 +42,7 @@ public class BlockRedstoneTorch extends BlockTorch {
protected BlockRedstoneTorch(int i, int j, boolean flag) {
super(i, j);
- this.a = flag;
+ this.isOn = flag;
this.a(true);
}
@@ -55,29 +55,29 @@ public class BlockRedstoneTorch extends BlockTorch {
super.e(world, i, j, k);
}
- if (this.a) {
- world.h(i, j - 1, k, this.id);
- world.h(i, j + 1, k, this.id);
- world.h(i - 1, j, k, this.id);
- world.h(i + 1, j, k, this.id);
- world.h(i, j, k - 1, this.id);
- world.h(i, j, k + 1, this.id);
+ if (this.isOn) {
+ world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
}
}
- public void b(World world, int i, int j, int k) {
- if (this.a) {
- world.h(i, j - 1, k, this.id);
- world.h(i, j + 1, k, this.id);
- world.h(i - 1, j, k, this.id);
- world.h(i + 1, j, k, this.id);
- world.h(i, j, k - 1, this.id);
- world.h(i, j, k + 1, this.id);
+ public void remove(World world, int i, int j, int k) {
+ if (this.isOn) {
+ world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- if (!this.a) {
+ if (!this.isOn) {
return false;
} else {
int i1 = iblockaccess.getData(i, j, k);
@@ -89,24 +89,24 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean g(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- return l == 5 && world.j(i, j - 1, k, 0) ? true : (l == 3 && world.j(i, j, k - 1, 2) ? true : (l == 4 && world.j(i, j, k + 1, 3) ? true : (l == 1 && world.j(i - 1, j, k, 4) ? true : l == 2 && world.j(i + 1, j, k, 5))));
+ return l == 5 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5))));
}
public void a(World world, int i, int j, int k, Random random) {
boolean flag = this.g(world, i, j, k);
- while (b.size() > 0 && world.l() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
+ while (b.size() > 0 && world.getTime() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
b.remove(0);
}
// CraftBukkit start
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
PluginManager man = ((WorldServer) world).getServer().getPluginManager();
- int oldCurrent = this.a ? 15 : 0;
+ int oldCurrent = this.isOn ? 15 : 0;
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
// CraftBukkit end
- if (this.a) {
+ if (this.isOn) {
if (flag) {
// CraftBukkit start
if (oldCurrent != 0) {
@@ -117,9 +117,9 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
// CraftBukkit end
- world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
if (this.a(world, i, j, k, true)) {
- world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int l = 0; l < 5; ++l) {
double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
@@ -140,25 +140,24 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
// CraftBukkit end
- world.b(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
}
}
- public void a(World world, int i, int j, int k, int l) {
- super.a(world, i, j, k, l);
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ super.doPhysics(world, i, j, k, l);
world.c(i, j, k, this.id, this.b());
}
public boolean c(World world, int i, int j, int k, int l) {
- // CraftBukkit -- cast to IBlockAccess
- return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false;
+ return l == 0 ? this.b(world, i, j, k, l) : false;
}
public int a(int i, Random random) {
return Block.REDSTONE_TORCH_ON.id;
}
- public boolean c() {
+ public boolean isPowerSource() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 254399fa..d9d473fb 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -32,7 +32,7 @@ public class BlockRedstoneWire extends Block {
return false;
}
- public boolean a(World world, int i, int j, int k) {
+ public boolean canPlace(World world, int i, int j, int k) {
return world.d(i, j - 1, k);
}
@@ -45,7 +45,7 @@ public class BlockRedstoneWire extends Block {
for (int l = 0; l < arraylist.size(); ++l) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
- world.h(chunkposition.a, chunkposition.b, chunkposition.c, this.id);
+ world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
}
}
@@ -54,7 +54,7 @@ public class BlockRedstoneWire extends Block {
int l1 = 0;
this.a = false;
- boolean flag = world.p(i, j, k);
+ boolean flag = world.isBlockIndirectlyPowered(i, j, k);
this.a = true;
int i2;
@@ -84,15 +84,15 @@ public class BlockRedstoneWire extends Block {
}
if (j2 != l || j != i1 || k2 != j1) {
- l1 = this.f(world, j2, j, k2, l1);
+ l1 = this.getPower(world, j2, j, k2, l1);
}
if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) {
if (j2 != l || j + 1 != i1 || k2 != j1) {
- l1 = this.f(world, j2, j + 1, k2, l1);
+ l1 = this.getPower(world, j2, j + 1, k2, l1);
}
} else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
- l1 = this.f(world, j2, j - 1, k2, l1);
+ l1 = this.getPower(world, j2, j - 1, k2, l1);
}
}
@@ -114,7 +114,7 @@ public class BlockRedstoneWire extends Block {
if (k1 != l1) {
world.h = true;
- world.c(i, j, k, l1);
+ world.setData(i, j, k, l1);
world.b(i, j, k, i, j, k);
world.h = false;
@@ -144,7 +144,7 @@ public class BlockRedstoneWire extends Block {
}
boolean flag1 = false;
- int i3 = this.f(world, j2, j, k2, -1);
+ int i3 = this.getPower(world, j2, j, k2, -1);
l1 = world.getData(i, j, k);
if (l1 > 0) {
@@ -155,7 +155,7 @@ public class BlockRedstoneWire extends Block {
this.a(world, j2, j, k2, i, j, k);
}
- i3 = this.f(world, j2, l2, k2, -1);
+ i3 = this.getPower(world, j2, l2, k2, -1);
l1 = world.getData(i, j, k);
if (l1 > 0) {
--l1;
@@ -180,13 +180,13 @@ public class BlockRedstoneWire extends Block {
private void h(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
- world.h(i, j, k, this.id);
- world.h(i - 1, j, k, this.id);
- world.h(i + 1, j, k, this.id);
- world.h(i, j, k - 1, this.id);
- world.h(i, j, k + 1, this.id);
- world.h(i, j - 1, k, this.id);
- world.h(i, j + 1, k, this.id);
+ world.applyPhysics(i, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
}
}
@@ -194,8 +194,8 @@ public class BlockRedstoneWire extends Block {
super.e(world, i, j, k);
if (!world.isStatic) {
this.g(world, i, j, k);
- world.h(i, j + 1, k, this.id);
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
this.h(world, i - 1, j, k);
this.h(world, i + 1, j, k);
this.h(world, i, j, k - 1);
@@ -226,11 +226,11 @@ public class BlockRedstoneWire extends Block {
}
}
- public void b(World world, int i, int j, int k) {
- super.b(world, i, j, k);
+ public void remove(World world, int i, int j, int k) {
+ super.remove(world, i, j, k);
if (!world.isStatic) {
- world.h(i, j + 1, k, this.id);
- world.h(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
this.g(world, i, j, k);
this.h(world, i - 1, j, k);
this.h(world, i + 1, j, k);
@@ -262,8 +262,8 @@ public class BlockRedstoneWire extends Block {
}
}
- // Craftbukkit private-> public
- public int f(World world, int i, int j, int k, int l) {
+ // Craftbukkit private->public
+ public int getPower(World world, int i, int j, int k, int l) {
if (world.getTypeId(i, j, k) != this.id) {
return l;
} else {
@@ -273,21 +273,21 @@ public class BlockRedstoneWire extends Block {
}
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
int i1 = world.getData(i, j, k);
- boolean flag = this.a(world, i, j, k);
+ boolean flag = this.canPlace(world, i, j, k);
if (!flag) {
this.a_(world, i, j, k, i1);
- world.e(i, j, k, 0);
- } else
- // Craftbukkit
- if ((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l || Block.DIODE_ON.id == l) {
+ world.setTypeId(i, j, k, 0);
+ } else {
+ // Craftbukkit
+ if ((Block.byId[l] != null && Block.byId[l].isPowerSource()) || Block.DIODE_OFF.id == l || Block.DIODE_ON.id == l)
this.g(world, i, j, k);
}
- super.a(world, i, j, k, l);
+ super.doPhysics(world, i, j, k, l);
}
}
@@ -296,8 +296,7 @@ public class BlockRedstoneWire extends Block {
}
public boolean c(World world, int i, int j, int k, int l) {
- // CraftBukkit -- cast to IBlockAccess
- return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l);
+ return !this.a ? false : this.b(world, i, j, k, l);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@@ -335,13 +334,13 @@ public class BlockRedstoneWire extends Block {
}
}
- public boolean c() {
+ public boolean isPowerSource() {
return this.a;
}
public static boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getTypeId(i, j, k);
- return l == Block.REDSTONE_WIRE.id ? true : (l == 0 ? false : Block.byId[l].c());
+ return l == Block.REDSTONE_WIRE.id ? true : (l == 0 ? false : Block.byId[l].isPowerSource());
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java
index f185c62a..c9dd407f 100644
--- a/src/main/java/net/minecraft/server/BlockSign.java
+++ b/src/main/java/net/minecraft/server/BlockSign.java
@@ -73,7 +73,7 @@ public class BlockSign extends BlockContainer {
return Item.SIGN.id;
}
- public void a(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
if (this.b) {
@@ -103,17 +103,18 @@ public class BlockSign extends BlockContainer {
if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k));
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
}
- super.a(world, i, j, k, l);
+ super.doPhysics(world, i, j, k, l);
// CraftBukkit start
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) {
+ if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
Block block = craftWorld.getBlockAt(i, j, k);
int power = block.getBlockPower();
+
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
server.getPluginManager().callEvent(eventRedstone);
}
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index f88f7609..5e2c4220 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -1,10 +1,14 @@
package net.minecraft.server;
import java.util.Random;
+
+// CraftBukkit start
+import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.Cancellable;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
public class BlockSoil extends Block {
@@ -31,34 +35,36 @@ public class BlockSoil extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (random.nextInt(5) == 0) {
if (this.h(world, i, j, k)) {
- world.c(i, j, k, 7);
+ world.setData(i, j, k, 7);
} else {
int l = world.getData(i, j, k);
if (l > 0) {
- world.c(i, j, k, l - 1);
+ world.setData(i, j, k, l - 1);
} else if (!this.g(world, i, j, k)) {
- world.e(i, j, k, Block.DIRT.id);
+ world.setTypeId(i, j, k, Block.DIRT.id);
}
}
}
}
public void b(World world, int i, int j, int k, Entity entity) {
- // CraftBukkit start - Interact Soil
- Cancellable cancellable;
- if (entity instanceof EntityHuman) {
- cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, Action.PHYSICAL, i, j, k, -1, null);
- }
- else {
- cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer)world).getWorld().getBlockAt(i, j, k));
- }
- if (!cancellable.isCancelled()) {
- if (world.k.nextInt(4) == 0) {
- world.e(i, j, k, Block.DIRT.id);
+ if (world.random.nextInt(4) == 0) {
+ // CraftBukkit start - Interact Soil
+ Cancellable cancellable;
+ if (entity instanceof EntityHuman) {
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, Action.PHYSICAL, i, j, k, -1, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
+ Bukkit.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+ if (cancellable.isCancelled()) {
+ return;
}
+ // Craftbukkit end
+
+ world.setTypeId(i, j, k, Block.DIRT.id);
}
- // Craftbukkit end
}
private boolean g(World world, int i, int j, int k) {
@@ -89,12 +95,12 @@ public class BlockSoil extends Block {
return false;
}
- public void a(World world, int i, int j, int k, int l) {
- super.a(world, i, j, k, l);
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ super.doPhysics(world, i, j, k, l);
Material material = world.getMaterial(i, j + 1, k);
if (material.isBuildable()) {
- world.e(i, j, k, Block.DIRT.id);
+ world.setTypeId(i, j, k, Block.DIRT.id);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
index 0d38b6fd..133b32b6 100644
--- a/src/main/java/net/minecraft/server/BlockStationary.java
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -20,8 +20,8 @@ public class BlockStationary extends BlockFluids {
}
}
- public void a(World world, int i, int j, int k, int l) {
- super.a(world, i, j, k, l);
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ super.doPhysics(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) {
this.i(world, i, j, k);
}
@@ -31,7 +31,7 @@ public class BlockStationary extends BlockFluids {
int l = world.getData(i, j, k);
world.h = true;
- world.setTypeIdAndData(i, j, k, this.id - 1, l);
+ world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
world.b(i, j, k, i, j, k);
world.c(i, j, k, this.id - 1, this.b());
world.h = false;
@@ -69,7 +69,7 @@ public class BlockStationary extends BlockFluids {
}
// CraftBukkit end
- world.e(i, j, k, Block.FIRE.id);
+ world.setTypeId(i, j, k, Block.FIRE.id);
return;
}
} else if (Block.byId[j1].material.isSolid()) {
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 8b44d873..a36b330f 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -17,36 +17,36 @@ public class Chunk {
public static boolean a;
public byte[] b;
public boolean c;
- public World d;
+ public World world;
public NibbleArray e;
public NibbleArray f;
public NibbleArray g;
public byte[] h;
public int i;
- public final int j;
- public final int k;
- public Map l;
- public List[] m;
- public boolean n;
+ public final int x;
+ public final int z;
+ public Map tileEntities;
+ public List[] entitySlices;
+ public boolean done;
public boolean o;
public boolean p;
public boolean q;
public long r;
public Chunk(World world, int i, int j) {
- this.l = new HashMap();
- this.m = new List[8];
- this.n = false;
+ this.tileEntities = new HashMap();
+ this.entitySlices = new List[8];
+ this.done = false;
this.o = false;
this.q = false;
this.r = 0L;
- this.d = world;
- this.j = i;
- this.k = j;
+ this.world = world;
+ this.x = i;
+ this.z = j;
this.h = new byte[256];
- for (int k = 0; k < this.m.length; ++k) {
- this.m[k] = new ArrayList();
+ for (int k = 0; k < this.entitySlices.length; ++k) {
+ this.entitySlices[k] = new ArrayList();
}
// CraftBukkit start
@@ -69,7 +69,7 @@ public class Chunk {
}
public boolean a(int i, int j) {
- return i == this.j && j == this.k;
+ return i == this.x && j == this.z;
}
public int b(int i, int j) {
@@ -99,7 +99,7 @@ public class Chunk {
i = l;
}
- if (!this.d.m.e) {
+ if (!this.world.worldProvider.e) {
int j1 = 15;
int k1 = 127;
@@ -126,12 +126,12 @@ public class Chunk {
this.o = true;
}
- public void c() {}
+ public void loadNOP() {}
private void c(int i, int j) {
int k = this.b(i, j);
- int l = this.j * 16 + i;
- int i1 = this.k * 16 + j;
+ int l = this.x * 16 + i;
+ int i1 = this.z * 16 + j;
this.f(l - 1, i1, k);
this.f(l + 1, i1, k);
@@ -140,13 +140,13 @@ public class Chunk {
}
private void f(int i, int j, int k) {
- int l = this.d.d(i, j);
+ int l = this.world.getHighestBlockYAt(i, j);
if (l > k) {
- this.d.a(EnumSkyBlock.SKY, i, k, j, i, l, j);
+ this.world.a(EnumSkyBlock.SKY, i, k, j, i, l, j);
this.o = true;
} else if (l < k) {
- this.d.a(EnumSkyBlock.SKY, i, l, j, i, k, j);
+ this.world.a(EnumSkyBlock.SKY, i, l, j, i, k, j);
this.o = true;
}
}
@@ -164,7 +164,7 @@ public class Chunk {
}
if (i1 != l) {
- this.d.g(i, k, i1, l);
+ this.world.g(i, k, i1, l);
this.h[k << 4 | i] = (byte) i1;
int k1;
int l1;
@@ -186,14 +186,14 @@ public class Chunk {
this.i = k1;
}
- k1 = this.j * 16 + i;
- l1 = this.k * 16 + k;
+ k1 = this.x * 16 + i;
+ l1 = this.z * 16 + k;
if (i1 < l) {
for (i2 = i1; i2 < l; ++i2) {
this.f.a(i, i2, k, 15);
}
} else {
- this.d.a(EnumSkyBlock.SKY, k1, l, l1, k1, i1, l1);
+ this.world.a(EnumSkyBlock.SKY, k1, l, l1, k1, i1, l1);
for (i2 = l; i2 < i1; ++i2) {
this.f.a(i, i2, k, 0);
@@ -206,7 +206,7 @@ public class Chunk {
for (j2 = i1; i1 > 0 && i2 > 0; this.f.a(i, i1, k, i2)) {
--i1;
- int k2 = Block.q[this.a(i, i1, k)];
+ int k2 = Block.q[this.getTypeId(i, i1, k)];
if (k2 == 0) {
k2 = 1;
@@ -218,19 +218,19 @@ public class Chunk {
}
}
- while (i1 > 0 && Block.q[this.a(i, i1 - 1, k)] == 0) {
+ while (i1 > 0 && Block.q[this.getTypeId(i, i1 - 1, k)] == 0) {
--i1;
}
if (i1 != j2) {
- this.d.a(EnumSkyBlock.SKY, k1 - 1, i1, l1 - 1, k1 + 1, j2, l1 + 1);
+ this.world.a(EnumSkyBlock.SKY, k1 - 1, i1, l1 - 1, k1 + 1, j2, l1 + 1);
}
this.o = true;
}
}
- public int a(int i, int j, int k) {
+ public int getTypeId(int i, int j, int k) {
return this.b[i << 11 | k << 7 | j] & 255;
}
@@ -242,16 +242,16 @@ public class Chunk {
if (k1 == l && this.e.a(i, j, k) == i1) {
return false;
} else {
- int l1 = this.j * 16 + i;
- int i2 = this.k * 16 + k;
+ int l1 = this.x * 16 + i;
+ int i2 = this.z * 16 + k;
this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255);
- if (k1 != 0 && !this.d.isStatic) {
- Block.byId[k1].b(this.d, l1, j, i2);
+ if (k1 != 0 && !this.world.isStatic) {
+ Block.byId[k1].remove(this.world, l1, j, i2);
}
this.e.a(i, j, k, i1);
- if (!this.d.m.e) {
+ if (!this.world.worldProvider.e) {
if (Block.q[b0 & 255] != 0) {
if (j >= j1) {
this.g(i, j + 1, k);
@@ -260,14 +260,14 @@ public class Chunk {
this.g(i, j, k);
}
- this.d.a(EnumSkyBlock.SKY, l1, j, i2, l1, j, i2);
+ this.world.a(EnumSkyBlock.SKY, l1, j, i2, l1, j, i2);
}
- this.d.a(EnumSkyBlock.BLOCK, l1, j, i2, l1, j, i2);
+ this.world.a(EnumSkyBlock.BLOCK, l1, j, i2, l1, j, i2);
this.c(i, k);
this.e.a(i, j, k, i1);
if (l != 0) {
- Block.byId[l].e(this.d, l1, j, i2);
+ Block.byId[l].e(this.world, l1, j, i2);
}
this.o = true;
@@ -283,12 +283,12 @@ public class Chunk {
if (j1 == l) {
return false;
} else {
- int k1 = this.j * 16 + i;
- int l1 = this.k * 16 + k;
+ int k1 = this.x * 16 + i;
+ int l1 = this.z * 16 + k;
this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255);
if (j1 != 0) {
- Block.byId[j1].b(this.d, k1, j, l1);
+ Block.byId[j1].remove(this.world, k1, j, l1);
}
this.e.a(i, j, k, 0);
@@ -300,11 +300,11 @@ public class Chunk {
this.g(i, j, k);
}
- this.d.a(EnumSkyBlock.SKY, k1, j, l1, k1, j, l1);
- this.d.a(EnumSkyBlock.BLOCK, k1, j, l1, k1, j, l1);
+ this.world.a(EnumSkyBlock.SKY, k1, j, l1, k1, j, l1);
+ this.world.a(EnumSkyBlock.BLOCK, k1, j, l1, k1, j, l1);
this.c(i, k);
- if (l != 0 && !this.d.isStatic) {
- Block.byId[l].e(this.d, k1, j, l1);
+ if (l != 0 && !this.world.isStatic) {
+ Block.byId[l].e(this.world, k1, j, l1);
}
this.o = true;
@@ -312,7 +312,7 @@ public class Chunk {
}
}
- public int b(int i, int j, int k) {
+ public int getData(int i, int j, int k) {
return this.e.a(i, j, k);
}
@@ -357,31 +357,31 @@ public class Chunk {
public void a(Entity entity) {
this.q = true;
- int i = MathHelper.b(entity.locX / 16.0D);
- int j = MathHelper.b(entity.locZ / 16.0D);
+ int i = MathHelper.floor(entity.locX / 16.0D);
+ int j = MathHelper.floor(entity.locZ / 16.0D);
- if (i != this.j || j != this.k) {
+ if (i != this.x || j != this.z) {
System.out.println("Wrong location! " + entity);
// CraftBukkit
- System.out.println("" + entity.locX + "," + entity.locZ + "(" + i + "," + j + ") vs " + this.j + "," + this.k);
+ System.out.println("" + entity.locX + "," + entity.locZ + "(" + i + "," + j + ") vs " + this.x + "," + this.z);
Thread.dumpStack();
}
- int k = MathHelper.b(entity.locY / 16.0D);
+ int k = MathHelper.floor(entity.locY / 16.0D);
if (k < 0) {
k = 0;
}
- if (k >= this.m.length) {
- k = this.m.length - 1;
+ if (k >= this.entitySlices.length) {
+ k = this.entitySlices.length - 1;
}
entity.bA = true;
- entity.chunkX = this.j;
+ entity.chunkX = this.x;
entity.bC = k;
- entity.chunkZ = this.k;
- this.m[k].add(entity);
+ entity.chunkZ = this.z;
+ this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
@@ -393,11 +393,11 @@ public class Chunk {
i = 0;
}
- if (i >= this.m.length) {
- i = this.m.length - 1;
+ if (i >= this.entitySlices.length) {
+ i = this.entitySlices.length - 1;
}
- this.m[i].remove(entity);
+ this.entitySlices[i].remove(entity);
}
public boolean c(int i, int j, int k) {
@@ -406,28 +406,28 @@ public class Chunk {
public TileEntity d(int i, int j, int k) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
- TileEntity tileentity = (TileEntity) this.l.get(chunkposition);
+ TileEntity tileentity = (TileEntity) this.tileEntities.get(chunkposition);
if (tileentity == null) {
- int l = this.a(i, j, k);
+ int l = this.getTypeId(i, j, k);
- if (!Block.p[l]) {
+ if (!Block.isTileEntity[l]) {
return null;
}
BlockContainer blockcontainer = (BlockContainer) Block.byId[l];
- blockcontainer.e(this.d, this.j * 16 + i, j, this.k * 16 + k);
- tileentity = (TileEntity) this.l.get(chunkposition);
+ blockcontainer.e(this.world, this.x * 16 + i, j, this.z * 16 + k);
+ tileentity = (TileEntity) this.tileEntities.get(chunkposition);
}
return tileentity;
}
public void a(TileEntity tileentity) {
- int i = tileentity.e - this.j * 16;
+ int i = tileentity.e - this.x * 16;
int j = tileentity.f;
- int k = tileentity.g - this.k * 16;
+ int k = tileentity.g - this.z * 16;
this.a(i, j, k, tileentity);
}
@@ -435,20 +435,20 @@ public class Chunk {
public void a(int i, int j, int k, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
- tileentity.d = this.d;
- tileentity.e = this.j * 16 + i;
+ tileentity.world = this.world;
+ tileentity.e = this.x * 16 + i;
tileentity.f = j;
- tileentity.g = this.k * 16 + k;
- if (this.a(i, j, k) != 0 && Block.byId[this.a(i, j, k)] instanceof BlockContainer) {
+ tileentity.g = this.z * 16 + k;
+ if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
if (this.c) {
- if (this.l.get(chunkposition) != null) {
- this.d.c.remove(this.l.get(chunkposition));
+ if (this.tileEntities.get(chunkposition) != null) {
+ this.world.c.remove(this.tileEntities.get(chunkposition));
}
- this.d.c.add(tileentity);
+ this.world.c.add(tileentity);
}
- this.l.put(chunkposition, tileentity);
+ this.tileEntities.put(chunkposition, tileentity);
} else {
System.out.println("Attempted to place a tile entity where there was no entity tile!");
}
@@ -458,41 +458,40 @@ public class Chunk {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
if (this.c) {
- this.d.c.remove(this.l.remove(chunkposition));
+ this.world.c.remove(this.tileEntities.remove(chunkposition));
}
}
- public void d() {
+ public void addEntities() {
this.c = true;
- this.d.c.addAll(this.l.values());
+ this.world.c.addAll(this.tileEntities.values());
- for (int i = 0; i < this.m.length; ++i) {
- this.d.a(this.m[i]);
+ for (int i = 0; i < this.entitySlices.length; ++i) {
+ this.world.a(this.entitySlices[i]);
}
}
- public void e() {
+ public void removeEntities() {
this.c = false;
- this.d.c.removeAll(this.l.values());
-
- for (int i = 0; i < this.m.length; ++i) {
- Iterator<Object> iter = this.m[i].iterator();
+ this.world.c.removeAll(this.tileEntities.values());
+ for (int i = 0; i < this.entitySlices.length; ++i) {
// Craftbukkit start
- while(iter.hasNext()) {
- Entity e = (Entity)iter.next();
- int cx = Location.locToBlock(e.locX) >> 4;
- int cz = Location.locToBlock(e.locZ) >> 4;
-
- if ((e instanceof EntityPlayer) && ((cx != this.j) || (cz != this.k))) {
- EntityPlayer player = (EntityPlayer)e;
+ Iterator<Object> iter = this.entitySlices[i].iterator();
+ while (iter.hasNext()) {
+ Entity entity = (Entity) iter.next();
+ int cx = Location.locToBlock(entity.locX) >> 4;
+ int cz = Location.locToBlock(entity.locZ) >> 4;
+
+ if ((entity instanceof EntityPlayer) && ((cx != this.x) || (cz != this.z))) {
+ EntityPlayer player = (EntityPlayer) entity;
iter.remove(); // Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
}
}
// Craftbukkit end
- this.d.b(this.m[i]);
+ this.world.b(this.entitySlices[i]);
}
}
@@ -501,19 +500,19 @@ public class Chunk {
}
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) {
- int i = MathHelper.b((axisalignedbb.b - 2.0D) / 16.0D);
- int j = MathHelper.b((axisalignedbb.e + 2.0D) / 16.0D);
+ int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
+ int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
if (i < 0) {
i = 0;
}
- if (j >= this.m.length) {
- j = this.m.length - 1;
+ if (j >= this.entitySlices.length) {
+ j = this.entitySlices.length - 1;
}
for (int k = i; k <= j; ++k) {
- List list1 = this.m[k];
+ List list1 = this.entitySlices[k];
for (int l = 0; l < list1.size(); ++l) {
Entity entity1 = (Entity) list1.get(l);
@@ -526,19 +525,19 @@ public class Chunk {
}
public void a(Class oclass, AxisAlignedBB axisalignedbb, List list) {
- int i = MathHelper.b((axisalignedbb.b - 2.0D) / 16.0D);
- int j = MathHelper.b((axisalignedbb.e + 2.0D) / 16.0D);
+ int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
+ int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
if (i < 0) {
i = 0;
}
- if (j >= this.m.length) {
- j = this.m.length - 1;
+ if (j >= this.entitySlices.length) {
+ j = this.entitySlices.length - 1;
}
for (int k = i; k <= j; ++k) {
- List list1 = this.m[k];
+ List list1 = this.entitySlices[k];
for (int l = 0; l < list1.size(); ++l) {
Entity entity = (Entity) list1.get(l);
@@ -555,10 +554,10 @@ public class Chunk {
return false;
} else {
if (flag) {
- if (this.q && this.d.l() != this.r) {
+ if (this.q && this.world.getTime() != this.r) {
return true;
}
- } else if (this.q && this.d.l() >= this.r + 600L) {
+ } else if (this.q && this.world.getTime() >= this.r + 600L) {
return true;
}
@@ -612,7 +611,7 @@ public class Chunk {
}
public Random a(long i) {
- return new Random(this.d.k() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i);
+ return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
}
public boolean g() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 1f7282f0..5255e861 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -21,62 +21,62 @@ import org.bukkit.event.world.ChunkUnloadEvent;
public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit start
- public LongHashset a = new LongHashset();
- public Chunk b;
- public IChunkProvider c;
+ public LongHashset unloadQueue = new LongHashset();
+ public Chunk emptyChunk;
+ public IChunkProvider chunkProvider; // CraftBukkit
private IChunkLoader d;
- public LongHashtable<Chunk> e = new LongHashtable<Chunk>();
- public List f = new ArrayList();
- public WorldServer g;
+ public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
+ public List chunkList = new ArrayList();
+ public WorldServer world;
// CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
- this.b = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0);
- this.g = worldserver;
+ this.emptyChunk = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0);
+ this.world = worldserver;
this.d = ichunkloader;
- this.c = ichunkprovider;
+ this.chunkProvider = ichunkprovider;
}
- public boolean a(int i, int j) {
- return this.e.containsKey(i, j); // CraftBukkit
+ public boolean isChunkLoaded(int i, int j) {
+ return this.chunks.containsKey(i, j); // CraftBukkit
}
- public void d(int i, int j) {
- ChunkCoordinates chunkcoordinates = this.g.m();
- int k = i * 16 + 8 - chunkcoordinates.a;
- int l = j * 16 + 8 - chunkcoordinates.c;
+ public void queueUnload(int i, int j) {
+ ChunkCoordinates chunkcoordinates = this.world.getSpawn();
+ int k = i * 16 + 8 - chunkcoordinates.x;
+ int l = j * 16 + 8 - chunkcoordinates.z;
short short1 = 128;
if (k < -short1 || k > short1 || l < -short1 || l > short1) {
- this.a.add(i, j); // CraftBukkit
+ this.unloadQueue.add(i, j); // CraftBukkit
}
}
- public Chunk c(int i, int j) {
+ public Chunk getChunkAt(int i, int j) {
// CraftBukkit start
- this.a.remove(i, j);
- Chunk chunk = (Chunk) this.e.get(i, j);
+ this.unloadQueue.remove(i, j);
+ Chunk chunk = (Chunk) this.chunks.get(i, j);
// CraftBukkit end
if (chunk == null) {
- chunk = this.e(i, j);
+ chunk = this.loadChunk(i, j);
if (chunk == null) {
- if (this.c == null) {
- chunk = this.b;
+ if (this.chunkProvider == null) {
+ chunk = this.emptyChunk;
} else {
- chunk = this.c.b(i, j);
+ chunk = this.chunkProvider.getOrCreateChunk(i, j);
}
}
- this.e.put(i, j, chunk); // CraftBukkit
- this.f.add(chunk);
+ this.chunks.put(i, j, chunk); // CraftBukkit
+ this.chunkList.add(chunk);
if (chunk != null) {
- chunk.c();
- chunk.d();
+ chunk.loadNOP();
+ chunk.addEntities();
}
// CraftBukkit start
- CraftServer server = g.getServer();
+ CraftServer server = this.world.getServer();
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
@@ -87,53 +87,52 @@ public class ChunkProviderServer implements IChunkProvider {
}
// CraftBukkit end
- if (!chunk.n && this.a(i + 1, j + 1) && this.a(i, j + 1) && this.a(i + 1, j)) {
- this.a(this, i, j);
+ if (!chunk.done && this.isChunkLoaded(i + 1, j + 1) && this.isChunkLoaded(i, j + 1) && this.isChunkLoaded(i + 1, j)) {
+ this.getChunkAt(this, i, j);
}
- if (this.a(i - 1, j) && !this.b(i - 1, j).n && this.a(i - 1, j + 1) && this.a(i, j + 1) && this.a(i - 1, j)) {
- this.a(this, i - 1, j);
+ if (this.isChunkLoaded(i - 1, j) && !this.getOrCreateChunk(i - 1, j).done && this.isChunkLoaded(i - 1, j + 1) && this.isChunkLoaded(i, j + 1) && this.isChunkLoaded(i - 1, j)) {
+ this.getChunkAt(this, i - 1, j);
}
- if (this.a(i, j - 1) && !this.b(i, j - 1).n && this.a(i + 1, j - 1) && this.a(i, j - 1) && this.a(i + 1, j)) {
- this.a(this, i, j - 1);
+ if (this.isChunkLoaded(i, j - 1) && !this.getOrCreateChunk(i, j - 1).done && this.isChunkLoaded(i + 1, j - 1) && this.isChunkLoaded(i, j - 1) && this.isChunkLoaded(i + 1, j)) {
+ this.getChunkAt(this, i, j - 1);
}
- if (this.a(i - 1, j - 1) && !this.b(i - 1, j - 1).n && this.a(i - 1, j - 1) && this.a(i, j - 1) && this.a(i - 1, j)) {
- this.a(this, i - 1, j - 1);
+ if (this.isChunkLoaded(i - 1, j - 1) && !this.getOrCreateChunk(i - 1, j - 1).done && this.isChunkLoaded(i - 1, j - 1) && this.isChunkLoaded(i, j - 1) && this.isChunkLoaded(i - 1, j)) {
+ this.getChunkAt(this, i - 1, j - 1);
}
}
return chunk;
}
- public Chunk b(int i, int j) {
+ public Chunk getOrCreateChunk(int i, int j) {
// CraftBukkit start
- Chunk chunk = (Chunk) this.e.get(i, j);
-
- chunk = chunk == null ? (this.g.r ? this.c(i, j) : this.b) : chunk;
- if (chunk == this.b) return chunk;
- if (i != chunk.j || j != chunk.k) {
- MinecraftServer.a.info("Chunk (" + chunk.j + ", " + chunk.k +") stored at (" + i + ", " + j + ")");
- MinecraftServer.a.info(chunk.getClass().getName());
- Throwable x = new Throwable();
- x.fillInStackTrace();
- x.printStackTrace();
+ Chunk chunk = (Chunk) this.chunks.get(i, j);
+
+ chunk = chunk == null ? (this.world.isLoading ? this.getChunkAt(i, j) : this.emptyChunk) : chunk;
+ if (chunk == this.emptyChunk) return chunk;
+ if (i != chunk.x || j != chunk.z) {
+ MinecraftServer.log.info("Chunk (" + chunk.x + ", " + chunk.z +") stored at (" + i + ", " + j + ")");
+ MinecraftServer.log.info(chunk.getClass().getName());
+ Throwable ex = new Throwable();
+ ex.fillInStackTrace();
+ ex.printStackTrace();
}
return chunk;
// CraftBukkit end
}
- // CraftBukkit - private->public
- public Chunk e(int i, int j) {
+ public Chunk loadChunk(int i, int j) {// CraftBukkit - private->public
if (this.d == null) {
return null;
} else {
try {
- Chunk chunk = this.d.a(this.g, i, j);
+ Chunk chunk = this.d.a(this.world, i, j);
if (chunk != null) {
- chunk.r = this.g.l();
+ chunk.r = this.world.getTime();
}
return chunk;
@@ -144,53 +143,51 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
- // CraftBukkit - private->public
- public void a(Chunk chunk) {
+ public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private->public
if (this.d != null) {
try {
- this.d.b(this.g, chunk);
+ this.d.b(this.world, chunk);
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
- // CraftBukkit - private->public
- public void b(Chunk chunk) {
+ public void saveChunk(Chunk chunk) { // CraftBukkit - private->public
if (this.d != null) {
try {
- chunk.r = this.g.l();
- this.d.a(this.g, chunk);
+ chunk.r = this.world.getTime();
+ this.d.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace();
}
}
}
- public void a(IChunkProvider ichunkprovider, int i, int j) {
- Chunk chunk = this.b(i, j);
+ public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
+ Chunk chunk = this.getOrCreateChunk(i, j);
- if (!chunk.n) {
- chunk.n = true;
- if (this.c != null) {
- this.c.a(ichunkprovider, i, j);
+ if (!chunk.done) {
+ chunk.done = true;
+ if (this.chunkProvider != null) {
+ this.chunkProvider.getChunkAt(ichunkprovider, i, j);
chunk.f();
}
}
}
- public boolean a(boolean flag, IProgressUpdate iprogressupdate) {
+ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
int i = 0;
- for (int j = 0; j < this.f.size(); ++j) {
- Chunk chunk = (Chunk) this.f.get(j);
+ for (int j = 0; j < this.chunkList.size(); ++j) {
+ Chunk chunk = (Chunk) this.chunkList.get(j);
if (flag && !chunk.p) {
- this.a(chunk);
+ this.saveChunkNOP(chunk);
}
if (chunk.a(flag)) {
- this.b(chunk);
+ this.saveChunk(chunk);
chunk.o = false;
++i;
if (i == 24 && !flag) {
@@ -210,25 +207,26 @@ public class ChunkProviderServer implements IChunkProvider {
return true;
}
- public boolean a() {
- if (!this.g.w) {
+ public boolean unloadChunks() {
+ if (!this.world.w) {
// CraftBukkit start
- Server server = g.getServer();
- for (int i = 0; i < 50 && !this.a.isEmpty(); i++) {
- long chunkcoordinates = this.a.popFirst();
- Chunk chunk = e.get(chunkcoordinates);
+ Server server = this.world.getServer();
+ for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) {
+ long chunkcoordinates = this.unloadQueue.popFirst();
+ Chunk chunk = this.chunks.get(chunkcoordinates);
if (chunk == null) continue;
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
-
- chunk.e();
- this.b(chunk);
- this.a(chunk);
- this.e.remove(chunkcoordinates);
- this.f.remove(chunk);
+ this.world.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
+
+ chunk.removeEntities();
+ this.saveChunk(chunk);
+ this.saveChunkNOP(chunk);
+ //this.unloadQueue.remove(integer);
+ this.chunks.remove(chunkcoordinates); // CraftBukkit
+ this.chunkList.remove(chunk);
}
}
// CraftBukkit end
@@ -238,10 +236,10 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
- return this.c.a();
+ return this.chunkProvider.unloadChunks();
}
public boolean b() {
- return !this.g.w;
+ return !this.world.w;
}
}
diff --git a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
index 255e90d6..54447619 100644
--- a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
+++ b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
@@ -7,39 +7,36 @@ import java.util.logging.Logger;
public class ConsoleCommandHandler {
private static Logger a = Logger.getLogger("Minecraft");
- private MinecraftServer b;
+ private MinecraftServer server;
+ private ICommandListener listener; // CraftBukkit
public ConsoleCommandHandler(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
+ this.server = minecraftserver;
}
- // CraftBukkit - All calls to the following below:
- // this.a( String s1, String msg );
- // are changed to:
- // this.notify( ICommandListener icommandlistener, String msg );
-
- public boolean a(ServerCommand servercommand) { // CraftBukkit - returns boolean
- String s = servercommand.a;
+ public boolean handle(ServerCommand servercommand) { // CraftBukkit - returns boolean
+ String s = servercommand.command;
ICommandListener icommandlistener = servercommand.b;
- String s1 = icommandlistener.c();
- WorldServer worldserver = this.b.worlds.get(0); // CraftBukkit
- ServerConfigurationManager serverconfigurationmanager = this.b.f;
+ String s1 = icommandlistener.getName();
+ WorldServer worldserver = this.server.worlds.get(0); // CraftBukkit
+ listener = icommandlistener; // CraftBukkit
+ ServerConfigurationManager serverconfigurationmanager = this.server.serverConfigurationManager;
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
if (s.toLowerCase().startsWith("list")) {
- icommandlistener.b("Connected players: " + serverconfigurationmanager.c());
+ icommandlistener.sendMessage("Connected players: " + serverconfigurationmanager.c());
} else if (s.toLowerCase().startsWith("stop")) {
- this.notify(icommandlistener, "Stopping the server.."); // CraftBukkit - notify command sender
- this.b.a();
+ this.print(s1, "Stopping the server..");
+ this.server.a();
} else if (s.toLowerCase().startsWith("save-all")) {
- this.notify(icommandlistener, "Forcing save.."); // CraftBukkit - notify command sender
- this.b.f(); // CraftBukkit - We should save all worlds on save-all.
- this.notify(icommandlistener, "Save complete."); // CraftBukkit - notify command sender
+ this.print(s1, "Forcing save..");
+ this.server.saveChunks(); // CraftBukkit - We should save all worlds on save-all.
+ this.print(s1, "Save complete.");
} else if (s.toLowerCase().startsWith("save-off")) {
- this.notify(icommandlistener, "Disabling level saving.."); // CraftBukkit - notify command sender
+ this.print(s1, "Disabling level saving..");
worldserver.w = true;
} else if (s.toLowerCase().startsWith("save-on")) {
- this.notify(icommandlistener, "Enabling level saving.."); // CraftBukkit - notify command sender
+ this.print(s1, "Enabling level saving..");
worldserver.w = false;
} else {
String s2;
@@ -47,36 +44,36 @@ public class ConsoleCommandHandler {
if (s.toLowerCase().startsWith("op ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.e(s2);
- this.notify(icommandlistener, "Opping " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "Opping " + s2);
serverconfigurationmanager.a(s2, "\u00A7eYou are now op!");
} else if (s.toLowerCase().startsWith("deop ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.f(s2);
serverconfigurationmanager.a(s2, "\u00A7eYou are no longer op!");
- this.notify(icommandlistener, "De-opping " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "De-opping " + s2);
} else if (s.toLowerCase().startsWith("ban-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.c(s2);
- this.notify(icommandlistener, "Banning ip " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "Banning ip " + s2);
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.d(s2);
- this.notify(icommandlistener, "Pardoning ip " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "Pardoning ip " + s2);
} else {
EntityPlayer entityplayer;
if (s.toLowerCase().startsWith("ban ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.a(s2);
- this.notify(icommandlistener, "Banning " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "Banning " + s2);
entityplayer = serverconfigurationmanager.i(s2);
if (entityplayer != null) {
- entityplayer.a.a("Banned by admin");
+ entityplayer.netServerHandler.disconnect("Banned by admin");
}
} else if (s.toLowerCase().startsWith("pardon ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.b(s2);
- this.notify(icommandlistener, "Pardoning " + s2); // CraftBukkit - notify command sender
+ this.print(s1, "Pardoning " + s2);
} else {
int i;
@@ -87,8 +84,8 @@ public class ConsoleCommandHandler {
// CraftBukkit end
entityplayer = null;
- for (i = 0; i < serverconfigurationmanager.b.size(); ++i) {
- EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.b.get(i);
+ for (i = 0; i < serverconfigurationmanager.players.size(); ++i) {
+ EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.players.get(i);
if (entityplayer1.name.equalsIgnoreCase(s2)) {
entityplayer = entityplayer1;
@@ -96,10 +93,10 @@ public class ConsoleCommandHandler {
}
if (entityplayer != null) {
- entityplayer.a.a("Kicked by admin");
- this.notify(icommandlistener, "Kicking " + entityplayer.name); // CraftBukkit - notify command sender
+ entityplayer.netServerHandler.disconnect("Kicked by admin");
+ this.print(s1, "Kicking " + entityplayer.name);
} else {
- icommandlistener.b("Can\'t find user " + s2 + ". No kick.");
+ icommandlistener.sendMessage("Can\'t find user " + s2 + ". No kick.");
}
} else {
String[] astring;
@@ -111,15 +108,15 @@ public class ConsoleCommandHandler {
entityplayer = serverconfigurationmanager.i(astring[1]);
entityplayer2 = serverconfigurationmanager.i(astring[2]);
if (entityplayer == null) {
- icommandlistener.b("Can\'t find user " + astring[1] + ". No tp.");
+ icommandlistener.sendMessage("Can\'t find user " + astring[1] + ". No tp.");
} else if (entityplayer2 == null) {
- icommandlistener.b("Can\'t find user " + astring[2] + ". No tp.");
+ icommandlistener.sendMessage("Can\'t find user " + astring[2] + ". No tp.");
} else {
- entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
- this.notify(icommandlistener, "Teleporting " + astring[1] + " to " + astring[2] + "."); // CraftBukkit - notify command sender
+ entityplayer.netServerHandler.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
+ this.print(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
}
} else {
- icommandlistener.b("Syntax error, please provice a source and a target.");
+ icommandlistener.sendMessage("Syntax error, please provice a source and a target.");
}
} else {
String s3;
@@ -127,7 +124,7 @@ public class ConsoleCommandHandler {
if (s.toLowerCase().startsWith("give ")) {
astring = s.split(" ");
if (astring.length != 3 && astring.length != 4) {
- return true;
+ return true; // CraftBukkit
}
s3 = astring[1];
@@ -137,7 +134,7 @@ public class ConsoleCommandHandler {
int j = Integer.parseInt(astring[2]);
if (Item.byId[j] != null) {
- this.notify(icommandlistener, "Giving " + entityplayer2.name + " some " + j); // CraftBukkit - notify command sender
+ this.print(s1, "Giving " + entityplayer2.name + " some " + j);
int k = 1;
if (astring.length > 3) {
@@ -154,18 +151,18 @@ public class ConsoleCommandHandler {
entityplayer2.b(new ItemStack(j, k, 0));
} else {
- icommandlistener.b("There\'s no item with id " + j);
+ icommandlistener.sendMessage("There\'s no item with id " + j);
}
} catch (NumberFormatException numberformatexception) {
- icommandlistener.b("There\'s no item with id " + astring[2]);
+ icommandlistener.sendMessage("There\'s no item with id " + astring[2]);
}
} else {
- icommandlistener.b("Can\'t find user " + s3);
+ icommandlistener.sendMessage("Can\'t find user " + s3);
}
} else if (s.toLowerCase().startsWith("time ")) {
astring = s.split(" ");
if (astring.length != 3) {
- return true;
+ return true; // CraftBukkit
}
s3 = astring[1];
@@ -173,21 +170,21 @@ public class ConsoleCommandHandler {
try {
i = Integer.parseInt(astring[2]);
if ("add".equalsIgnoreCase(s3)) {
- worldserver.a(worldserver.k() + (long) i);
- this.notify(icommandlistener, "Added " + i + " to time"); // CraftBukkit - notify command sender
+ worldserver.setTime(worldserver.getTime() + (long) i);
+ this.print(s1, "Added " + i + " to time");
} else if ("set".equalsIgnoreCase(s3)) {
- worldserver.a((long) i);
- this.notify(icommandlistener, "Set time to " + i); // CraftBukkit - notify command sender
+ worldserver.setTime((long) i);
+ this.print(s1, "Set time to " + i);
} else {
- icommandlistener.b("Unknown method, use either \"add\" or \"set\"");
+ icommandlistener.sendMessage("Unknown method, use either \"add\" or \"set\"");
}
} catch (NumberFormatException numberformatexception1) {
- icommandlistener.b("Unable to convert time value, " + astring[2]);
+ icommandlistener.sendMessage("Unable to convert time value, " + astring[2]);
}
} else if (s.toLowerCase().startsWith("say ")) {
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "] " + s);
- serverconfigurationmanager.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s)));
+ serverconfigurationmanager.sendAll(new Packet3Chat("\u00A7d[Server] " + s));
} else if (s.toLowerCase().startsWith("tell ")) {
astring = s.split(" ");
if (astring.length >= 3) {
@@ -197,14 +194,14 @@ public class ConsoleCommandHandler {
s = "\u00A77" + s1 + " whispers " + s;
a.info(s);
if (!serverconfigurationmanager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
- icommandlistener.b("There\'s no player by that name online.");
+ icommandlistener.sendMessage("There\'s no player by that name online.");
}
}
} else if (s.toLowerCase().startsWith("whitelist ")) {
this.a(s1, s, icommandlistener);
} else {
- icommandlistener.b("Unknown console command. Type \"help\" for help."); // CraftBukkit - Send to listener not log
- return false;
+ icommandlistener.sendMessage("Unknown console command. Type \"help\" for help."); // CraftBukkit
+ return false; // CraftBukkit
}
}
}
@@ -215,23 +212,24 @@ public class ConsoleCommandHandler {
this.a(icommandlistener);
}
- return true;
+ return true; // CraftBukkit
}
private void a(String s, String s1, ICommandListener icommandlistener) {
String[] astring = s1.split(" ");
+ listener = icommandlistener; // CraftBukkit
if (astring.length >= 2) {
String s2 = astring[1].toLowerCase();
if ("on".equals(s2)) {
- this.notify(icommandlistener, "Turned on white-listing"); // CraftBukkit - notify command sender
- this.b.d.b("white-list", true);
+ this.print(s, "Turned on white-listing");
+ this.server.propertyManager.b("white-list", true);
} else if ("off".equals(s2)) {
- this.notify(icommandlistener, "Turned off white-listing"); // CraftBukkit - notify command sender
- this.b.d.b("white-list", false);
+ this.print(s, "Turned off white-listing");
+ this.server.propertyManager.b("white-list", false);
} else if ("list".equals(s2)) {
- Set set = this.b.f.e();
+ Set set = this.server.serverConfigurationManager.e();
String s3 = "";
String s4;
@@ -240,63 +238,55 @@ public class ConsoleCommandHandler {
s4 = (String) iterator.next();
}
- icommandlistener.b("White-listed players: " + s3);
+ icommandlistener.sendMessage("White-listed players: " + s3);
} else {
String s5;
if ("add".equals(s2) && astring.length == 3) {
s5 = astring[2].toLowerCase();
- this.b.f.k(s5);
- this.notify(icommandlistener, "Added " + s5 + " to white-list"); // CraftBukkit - notify command sender
+ this.server.serverConfigurationManager.k(s5);
+ this.print(s, "Added " + s5 + " to white-list");
} else if ("remove".equals(s2) && astring.length == 3) {
s5 = astring[2].toLowerCase();
- this.b.f.l(s5);
- this.notify(icommandlistener, "Removed " + s5 + " from white-list"); // CraftBukkit - notify command sender
+ this.server.serverConfigurationManager.l(s5);
+ this.print(s, "Removed " + s5 + " from white-list");
} else if ("reload".equals(s2)) {
- this.b.f.f();
- this.notify(icommandlistener, "Reloaded white-list from file"); // CraftBukkit - notify command sender
+ this.server.serverConfigurationManager.f();
+ this.print(s, "Reloaded white-list from file");
}
}
}
}
private void a(ICommandListener icommandlistener) {
- icommandlistener.b("To run the server without a gui, start it like this:");
- icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
- icommandlistener.b("Console commands:");
- icommandlistener.b(" help or ? shows this message");
- icommandlistener.b(" kick <player> removes a player from the server");
- icommandlistener.b(" ban <player> bans a player from the server");
- icommandlistener.b(" pardon <player> pardons a banned player so that they can connect again");
- icommandlistener.b(" ban-ip <ip> bans an IP address from the server");
- icommandlistener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
- icommandlistener.b(" op <player> turns a player into an op");
- icommandlistener.b(" deop <player> removes op status from a player");
- icommandlistener.b(" tp <player1> <player2> moves one player to the same location as another player");
- icommandlistener.b(" give <player> <id> [num] gives a player a resource");
- icommandlistener.b(" tell <player> <message> sends a private message to a player");
- icommandlistener.b(" stop gracefully stops the server");
- icommandlistener.b(" save-all forces a server-wide level save");
- icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)");
- icommandlistener.b(" save-on re-enables terrain saving");
- icommandlistener.b(" list lists all currently connected players");
- icommandlistener.b(" say <message> broadcasts a message to all players");
- icommandlistener.b(" time <add|set> <amount> adds to or sets the world time (0-24000)");
- }
-
- // CraftBukkit start
- // Notify sender and ops / log
- private void notify(ICommandListener commandListener, String msg ) {
- commandListener.b( msg );
- this.a( commandListener.c(), msg );
+ icommandlistener.sendMessage("To run the server without a gui, start it like this:");
+ icommandlistener.sendMessage(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
+ icommandlistener.sendMessage("Console commands:");
+ icommandlistener.sendMessage(" help or ? shows this message");
+ icommandlistener.sendMessage(" kick <player> removes a player from the server");
+ icommandlistener.sendMessage(" ban <player> bans a player from the server");
+ icommandlistener.sendMessage(" pardon <player> pardons a banned player so that they can connect again");
+ icommandlistener.sendMessage(" ban-ip <ip> bans an IP address from the server");
+ icommandlistener.sendMessage(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
+ icommandlistener.sendMessage(" op <player> turns a player into an op");
+ icommandlistener.sendMessage(" deop <player> removes op status from a player");
+ icommandlistener.sendMessage(" tp <player1> <player2> moves one player to the same location as another player");
+ icommandlistener.sendMessage(" give <player> <id> [num] gives a player a resource");
+ icommandlistener.sendMessage(" tell <player> <message> sends a private message to a player");
+ icommandlistener.sendMessage(" stop gracefully stops the server");
+ icommandlistener.sendMessage(" save-all forces a server-wide level save");
+ icommandlistener.sendMessage(" save-off disables terrain saving (useful for backup scripts)");
+ icommandlistener.sendMessage(" save-on re-enables terrain saving");
+ icommandlistener.sendMessage(" list lists all currently connected players");
+ icommandlistener.sendMessage(" say <message> broadcasts a message to all players");
+ icommandlistener.sendMessage(" time <add|set> <amount> adds to or sets the world time (0-24000)");
}
- // CraftBukkit end
- private void a(String s, String s1) {
+ private void print(String s, String s1) {
+ listener.sendMessage(s1); // CraftBukkit
String s2 = s + ": " + s1;
- // CraftBukkit - This notifies ops and logs
- this.b.f.j("\u00A77(" + s2 + ")");
+ this.server.serverConfigurationManager.j("\u00A77(" + s2 + ")");
a.info(s2);
}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java
index a4da25d3..d7708b41 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogManager.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java
@@ -20,7 +20,7 @@ public class ConsoleLogManager {
public ConsoleLogManager() {}
// Craftbukkit - change of method signature!
- public static void a(MinecraftServer server) {
+ public static void init(MinecraftServer server) {
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter();
a.setUseParentHandlers(false);
@@ -34,6 +34,7 @@ public class ConsoleLogManager {
consolehandler.setFormatter(new ShortConsoleLogFormatter(server));
global.addHandler(consolehandler);
// CraftBukkit end
+
a.addHandler(consolehandler);
try {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 84df2677..9e551c8f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -42,10 +42,10 @@ public abstract class Entity {
public float lastPitch;
public final AxisAlignedBB boundingBox;
public boolean onGround;
- public boolean aW;
+ public boolean positionChanged;
public boolean aX;
public boolean aY;
- public boolean aZ;
+ public boolean velocityChanged;
public boolean ba;
public boolean dead;
public float height;
@@ -88,7 +88,7 @@ public abstract class Entity {
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false;
this.aY = false;
- this.aZ = false;
+ this.velocityChanged = false;
this.ba = true;
this.dead = false;
this.height = 0.0F;
@@ -116,7 +116,7 @@ public abstract class Entity {
this.datawatcher = new DataWatcher();
this.bA = false;
this.world = world;
- this.a(0.0D, 0.0D, 0.0D);
+ this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
this.a();
}
@@ -135,7 +135,7 @@ public abstract class Entity {
return this.id;
}
- public void D() {
+ public void die() {
this.dead = true;
}
@@ -148,16 +148,16 @@ public abstract class Entity {
// Craftbukkit start
if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY) || (Float.isNaN(f))) {
if (this instanceof EntityPlayer) {
- System.err.println(((CraftPlayer)this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
- ((CraftPlayer)this.getBukkitEntity()).kickPlayer("Nope");
+ System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
}
f = 0;
}
if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY) || (Float.isNaN(f1))) {
if (this instanceof EntityPlayer) {
- System.err.println(((CraftPlayer)this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
- ((CraftPlayer)this.getBukkitEntity()).kickPlayer("Nope");
+ System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
}
f1 = 0;
}
@@ -167,7 +167,7 @@ public abstract class Entity {
// Craftbukkit end
}
- public void a(double d0, double d1, double d2) {
+ public void setPosition(double d0, double d1, double d2) {
this.locX = d0;
this.locY = d1;
this.locZ = d2;
@@ -201,8 +201,8 @@ public abstract class Entity {
f = 1.0F;
}
- this.world.a(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
- float f1 = (float) MathHelper.b(this.boundingBox.b);
+ this.world.makeSound(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ float f1 = (float) MathHelper.floor(this.boundingBox.b);
int i;
float f2;
@@ -250,10 +250,10 @@ public abstract class Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.a((Entity) null, event.getDamage());
+ this.damageEntity((Entity) null, event.getDamage());
}
} else {
- this.a((Entity) null, 1);
+ this.damageEntity((Entity) null, 1);
}
// CraftBukkit end
}
@@ -293,7 +293,7 @@ public abstract class Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.a((Entity) null, event.getDamage());
+ this.damageEntity((Entity) null, event.getDamage());
}
if (this.fireTicks <= 0) {
@@ -311,23 +311,23 @@ public abstract class Entity {
}
// CraftBukkit end
- this.a((Entity) null, 4);
+ this.damageEntity((Entity) null, 4);
this.fireTicks = 600;
}
}
protected void R() {
- this.D();
+ this.die();
}
public boolean b(double d0, double d1, double d2) {
AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2);
- List list = this.world.a(this, axisalignedbb);
+ List list = this.world.getEntities(this, axisalignedbb);
return list.size() > 0 ? false : !this.world.b(axisalignedbb);
}
- public void c(double d0, double d1, double d2) {
+ public void move(double d0, double d1, double d2) {
if (this.bn) {
this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
@@ -339,13 +339,13 @@ public abstract class Entity {
double d5 = d0;
double d6 = d1;
double d7 = d2;
- AxisAlignedBB axisalignedbb = this.boundingBox.b();
- boolean flag = this.onGround && this.Z();
+ AxisAlignedBB axisalignedbb = this.boundingBox.clone();
+ boolean flag = this.onGround && this.isSneaking();
if (flag) {
double d8;
- for (d8 = 0.05D; d0 != 0.0D && this.world.a(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) {
+ for (d8 = 0.05D; d0 != 0.0D && this.world.getEntities(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) {
if (d0 < d8 && d0 >= -d8) {
d0 = 0.0D;
} else if (d0 > 0.0D) {
@@ -355,7 +355,7 @@ public abstract class Entity {
}
}
- for (; d2 != 0.0D && this.world.a(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) {
+ for (; d2 != 0.0D && this.world.getEntities(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) {
if (d2 < d8 && d2 >= -d8) {
d2 = 0.0D;
} else if (d2 > 0.0D) {
@@ -366,7 +366,7 @@ public abstract class Entity {
}
}
- List list = this.world.a(this, this.boundingBox.a(d0, d1, d2));
+ List list = this.world.getEntities(this, this.boundingBox.a(d0, d1, d2));
for (int i = 0; i < list.size(); ++i) {
d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
@@ -417,10 +417,10 @@ public abstract class Entity {
d0 = d5;
d1 = (double) this.bm;
d2 = d7;
- AxisAlignedBB axisalignedbb1 = this.boundingBox.b();
+ AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
this.boundingBox.b(axisalignedbb);
- list = this.world.a(this, this.boundingBox.a(d5, d1, d7));
+ list = this.world.getEntities(this, this.boundingBox.a(d5, d1, d7));
for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@@ -468,10 +468,10 @@ public abstract class Entity {
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bl;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
- this.aW = d5 != d0 || d7 != d2;
+ this.positionChanged = d5 != d0 || d7 != d2;
this.aX = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D;
- this.aY = this.aW || this.aX;
+ this.aY = this.positionChanged || this.aX;
this.a(d1, this.onGround);
if (d5 != d0) {
this.motX = 0.0D;
@@ -492,10 +492,10 @@ public abstract class Entity {
int j1;
// CraftBukkit start
- if ((this.aW) && (getBukkitEntity() instanceof Vehicle)) {
+ if ((this.positionChanged) && (getBukkitEntity() instanceof Vehicle)) {
Vehicle vehicle = (Vehicle) getBukkitEntity();
org.bukkit.World wrld = ((WorldServer) world).getWorld();
- org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ));
+ org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.floor(locX), MathHelper.floor(locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(locZ));
if (d5 > d0) {
block = block.getFace(BlockFace.SOUTH);
@@ -514,9 +514,9 @@ public abstract class Entity {
if (this.l() && !flag) {
this.bg = (float) ((double) this.bg + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
- l = MathHelper.b(this.locX);
- i1 = MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height);
- j1 = MathHelper.b(this.locZ);
+ l = MathHelper.floor(this.locX);
+ i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
+ j1 = MathHelper.floor(this.locZ);
k = this.world.getTypeId(l, i1, j1);
if (this.bg > (float) this.b && k > 0) {
++this.b;
@@ -524,21 +524,21 @@ public abstract class Entity {
if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) {
stepsound = Block.SNOW.stepSound;
- this.world.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
+ this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
} else if (!Block.byId[k].material.isLiquid()) {
- this.world.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
+ this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
Block.byId[k].b(this.world, l, i1, j1, this);
}
}
- l = MathHelper.b(this.boundingBox.a);
- i1 = MathHelper.b(this.boundingBox.b);
- j1 = MathHelper.b(this.boundingBox.c);
- k = MathHelper.b(this.boundingBox.d);
- int k1 = MathHelper.b(this.boundingBox.e);
- int l1 = MathHelper.b(this.boundingBox.f);
+ l = MathHelper.floor(this.boundingBox.a);
+ i1 = MathHelper.floor(this.boundingBox.b);
+ j1 = MathHelper.floor(this.boundingBox.c);
+ k = MathHelper.floor(this.boundingBox.d);
+ int k1 = MathHelper.floor(this.boundingBox.e);
+ int l1 = MathHelper.floor(this.boundingBox.f);
if (this.world.a(l, i1, j1, k, k1, l1)) {
for (int i2 = l; i2 <= k; ++i2) {
@@ -583,7 +583,7 @@ public abstract class Entity {
}
if (flag2 && this.fireTicks > 0) {
- this.world.a(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.world.makeSound(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
this.fireTicks = -this.maxFireTicks;
}
}
@@ -620,14 +620,14 @@ public abstract class Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (event.isCancelled() || event.getDamage() == 0) {
+ if (event.isCancelled()) {
return;
}
i = event.getDamage();
}
// CraftBukkit end
- this.a((Entity) null, i);
+ this.damageEntity((Entity) null, i);
}
}
@@ -639,9 +639,9 @@ public abstract class Entity {
public boolean a(Material material) {
double d0 = this.locY + (double) this.q();
- int i = MathHelper.b(this.locX);
- int j = MathHelper.d((float) MathHelper.b(d0));
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.d((float) MathHelper.floor(d0));
+ int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k);
if (l != 0 && Block.byId[l].material == material) {
@@ -673,8 +673,8 @@ public abstract class Entity {
f3 = f2 / f3;
f *= f3;
f1 *= f3;
- float f4 = MathHelper.a(this.yaw * 3.1415927F / 180.0F);
- float f5 = MathHelper.b(this.yaw * 3.1415927F / 180.0F);
+ float f4 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F);
+ float f5 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F);
this.motX += (double) (f * f5 - f1 * f4);
this.motZ += (double) (f1 * f5 + f * f4);
@@ -682,15 +682,15 @@ public abstract class Entity {
}
public float c(float f) {
- int i = MathHelper.b(this.locX);
+ int i = MathHelper.floor(this.locX);
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
- int j = MathHelper.b(this.locY - (double) this.height + d0);
- int k = MathHelper.b(this.locZ);
+ int j = MathHelper.floor(this.locY - (double) this.height + d0);
+ int k = MathHelper.floor(this.locZ);
- return this.world.a(MathHelper.b(this.boundingBox.a), MathHelper.b(this.boundingBox.b), MathHelper.b(this.boundingBox.c), MathHelper.b(this.boundingBox.d), MathHelper.b(this.boundingBox.e), MathHelper.b(this.boundingBox.f)) ? this.world.l(i, j, k) : 0.0F;
+ return this.world.a(MathHelper.floor(this.boundingBox.a), MathHelper.floor(this.boundingBox.b), MathHelper.floor(this.boundingBox.c), MathHelper.floor(this.boundingBox.d), MathHelper.floor(this.boundingBox.e), MathHelper.floor(this.boundingBox.f)) ? this.world.l(i, j, k) : 0.0F;
}
- public void b(double d0, double d1, double d2, float f, float f1) {
+ public void setLocation(double d0, double d1, double d2, float f, float f1) {
this.lastX = this.locX = d0;
this.lastY = this.locY = d1;
this.lastZ = this.locZ = d2;
@@ -707,17 +707,17 @@ public abstract class Entity {
this.lastYaw -= 360.0F;
}
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.c(f, f1);
}
- public void c(double d0, double d1, double d2, float f, float f1) {
+ public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
this.bi = this.lastX = this.locX = d0;
this.bj = this.lastY = this.locY = d1 + (double) this.height;
this.bk = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
public float f(Entity entity) {
@@ -754,7 +754,7 @@ public abstract class Entity {
public void b(EntityHuman entityhuman) {}
- public void h(Entity entity) {
+ public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
@@ -789,10 +789,10 @@ public abstract class Entity {
}
protected void W() {
- this.aZ = true;
+ this.velocityChanged = true;
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
this.W();
return false;
}
@@ -811,7 +811,7 @@ public abstract class Entity {
String s = this.X();
if (!this.dead && s != null) {
- nbttagcompound.a("id", s);
+ nbttagcompound.setString("id", s);
this.d(nbttagcompound);
return true;
} else {
@@ -827,7 +827,7 @@ public abstract class Entity {
nbttagcompound.a("Fire", (short) this.fireTicks);
nbttagcompound.a("Air", (short) this.airTicks);
nbttagcompound.a("OnGround", this.onGround);
- nbttagcompound.a("World", world.q.j); // CraftBukkit
+ nbttagcompound.setString("World", world.worldData.name); // CraftBukkit
this.a(nbttagcompound);
}
@@ -836,7 +836,7 @@ public abstract class Entity {
NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");
- this.a(0.0D, 0.0D, 0.0D);
+ this.setPosition(0.0D, 0.0D, 0.0D);
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
@@ -868,16 +868,16 @@ public abstract class Entity {
this.onGround = nbttagcompound.m("OnGround");
// CraftBukkit start
- if (nbttagcompound.b("World")) {
- String worldName = nbttagcompound.i("World");
+ if (nbttagcompound.hasKey("World")) {
+ String worldName = nbttagcompound.getString("World");
for (WorldServer world: ((WorldServer) this.world).getServer().getServer().worlds) {
- if ((world.q.j.equals(worldName)) && (world != this.world)) {
+ if ((world.worldData.name.equals(worldName)) && (world != this.world)) {
this.world = world;
if (this instanceof EntityHuman) {
EntityPlayer player = (EntityPlayer)this;
- player.c = new ItemInWorldManager(world);
- player.c.a = player;
+ player.itemInWorldManager = new ItemInWorldManager(world);
+ player.itemInWorldManager.player = player;
}
break;
}
@@ -885,7 +885,7 @@ public abstract class Entity {
}
// CraftBukkit end
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.b(nbttagcompound);
}
@@ -936,8 +936,8 @@ public abstract class Entity {
public EntityItem a(ItemStack itemstack, float f) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
- entityitem.c = 10;
- this.world.a((Entity) entityitem);
+ entityitem.pickupDelay = 10;
+ this.world.addEntity(entityitem);
return entityitem;
}
@@ -946,9 +946,9 @@ public abstract class Entity {
}
public boolean E() {
- int i = MathHelper.b(this.locX);
- int j = MathHelper.b(this.locY + (double) this.q());
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locY + (double) this.q());
+ int k = MathHelper.floor(this.locZ);
return this.world.d(i, j, k);
}
@@ -1016,7 +1016,7 @@ public abstract class Entity {
}
public void h_() {
- this.passenger.a(this.locX, this.locY + this.k() + this.passenger.C(), this.locZ);
+ this.passenger.setPosition(this.locX, this.locY + this.k() + this.passenger.C(), this.locZ);
}
public double C() {
@@ -1027,7 +1027,7 @@ public abstract class Entity {
return (double) this.width * 0.75D;
}
- public void b(Entity entity) {
+ public void mount(Entity entity) {
// CraftBukkit start
setPassengerOf(entity);
}
@@ -1060,7 +1060,7 @@ public abstract class Entity {
}
// CraftBukkit end
- this.c(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch);
+ this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null;
}
@@ -1078,7 +1078,7 @@ public abstract class Entity {
this.vehicle.passenger = null;
this.vehicle = null;
- this.c(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch);
+ this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch);
} else {
if (this.vehicle != null) {
this.vehicle.passenger = null;
@@ -1099,15 +1099,15 @@ public abstract class Entity {
public void Y() {}
- public ItemStack[] k_() {
+ public ItemStack[] getEquipment() {
return null;
}
- public boolean Z() {
+ public boolean isSneaking() {
return this.d(1);
}
- public void e(boolean flag) {
+ public void setSneak(boolean flag) {
this.a(1, flag);
}
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 509e1181..140ae882 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -17,7 +17,7 @@ public class EntityArrow extends Entity {
private int f = 0;
private boolean g = false;
public int a = 0;
- public EntityLiving b;
+ public EntityLiving shooter;
private int h;
private int i = 0;
@@ -29,23 +29,23 @@ public class EntityArrow extends Entity {
public EntityArrow(World world, double d0, double d1, double d2) {
super(world);
this.b(0.5F, 0.5F);
- this.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
public EntityArrow(World world, EntityLiving entityliving) {
super(world);
- this.b = entityliving;
+ this.shooter = entityliving;
this.b(0.5F, 0.5F);
- this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
+ this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
- this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
- this.a(this.locX, this.locY, this.locZ);
+ 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;
- this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F));
- this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F));
- this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F));
+ this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
+ this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
+ this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F));
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
}
@@ -92,7 +92,7 @@ public class EntityArrow extends Entity {
if (i == this.f) {
++this.h;
if (this.h == 1200) {
- this.D();
+ this.die();
}
return;
@@ -108,14 +108,14 @@ public class EntityArrow extends Entity {
++this.i;
}
- Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
+ vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
Entity entity = null;
@@ -127,7 +127,7 @@ public class EntityArrow extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.d_() && (entity1 != this.b || this.i >= 5)) {
+ if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -150,7 +150,7 @@ public class EntityArrow extends Entity {
float f2;
if (movingobjectposition != null) {
- if (movingobjectposition.g != null) {
+ if (movingobjectposition.entity != null) {
// CraftBukkit start
boolean stick;
if (entity instanceof EntityLiving) {
@@ -158,8 +158,8 @@ public class EntityArrow extends Entity {
// TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
// or leave as DamageCause.ENTITY_ATTACK
- org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
- org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
+ org.bukkit.entity.Entity shooter = (this.shooter == null) ? null : this.shooter.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
// TODO deal with arrows being fired from a non-entity
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
@@ -169,18 +169,18 @@ public class EntityArrow extends Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
// this function returns if the arrow should stick in or not, i.e. !bounce
- stick = movingobjectposition.g.a(this.b, event.getDamage());
+ stick = movingobjectposition.entity.damageEntity(this.shooter, event.getDamage());
} else {
// event was cancelled, get if the arrow should bounce or not
stick = !event.getBounce();
}
} else {
- stick = movingobjectposition.g.a(this.b, 4);
+ stick = movingobjectposition.entity.damageEntity(this.shooter, 4);
}
if (stick) {
// CraftBukkit end
- this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
- this.D();
+ this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
+ this.die();
} else {
this.motX *= -0.10000000149011612D;
this.motY *= -0.10000000149011612D;
@@ -201,7 +201,7 @@ public class EntityArrow extends Entity {
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
- this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
+ this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.g = true;
this.a = 7;
}
@@ -248,7 +248,7 @@ public class EntityArrow extends Entity {
this.motY *= (double) f3;
this.motZ *= (double) f3;
this.motY -= (double) f1;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -271,10 +271,10 @@ public class EntityArrow extends Entity {
public void b(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.g && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
- this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
- entityhuman.b(this, 1);
- this.D();
+ if (this.g && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
+ this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ entityhuman.receive(this, 1);
+ this.die();
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 51f83379..365c0a80 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -18,7 +18,7 @@ import org.bukkit.event.vehicle.VehicleUpdateEvent;
public class EntityBoat extends Entity {
- public int a;
+ public int damage;
public int b;
public int c;
private int d;
@@ -31,7 +31,8 @@ public class EntityBoat extends Entity {
// CraftBukkit start
public double maxSpeed = 0.4D;
- public void h(Entity entity) {
+ @Override
+ public void collide(Entity entity) {
CraftServer server = ((WorldServer) this.world).getServer();
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
@@ -43,13 +44,13 @@ public class EntityBoat extends Entity {
return;
}
- super.h(entity);
+ super.collide(entity);
}
// CraftBukkit end
public EntityBoat(World world) {
super(world);
- this.a = 0;
+ this.damage = 0;
this.b = 0;
this.c = 1;
this.aD = true;
@@ -77,7 +78,7 @@ public class EntityBoat extends Entity {
public EntityBoat(World world, double d0, double d1, double d2) {
this(world);
- this.a(d0, d1 + (double) this.height, d2);
+ this.setPosition(d0, d1 + (double) this.height, d2);
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
@@ -97,7 +98,7 @@ public class EntityBoat extends Entity {
return (double) this.width * 0.0D - 0.30000001192092896D;
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@@ -114,16 +115,16 @@ public class EntityBoat extends Entity {
this.c = -this.c;
this.b = 10;
- this.a += i * 10;
+ this.damage += i * 10;
this.W();
- if (this.a > 40) {
+ if (this.damage > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
- this.a = 40; // Maximize damage so this doesn't get triggered again right away
+ this.damage = 40; // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
@@ -138,7 +139,7 @@ public class EntityBoat extends Entity {
this.a(Item.STICK.id, 1, 0.0F);
}
- this.D();
+ this.die();
}
return true;
@@ -165,8 +166,8 @@ public class EntityBoat extends Entity {
--this.b;
}
- if (this.a > 0) {
- --this.a;
+ if (this.damage > 0) {
+ --this.damage;
}
this.lastX = this.locX;
@@ -207,13 +208,13 @@ public class EntityBoat extends Entity {
this.yaw = (float) ((double) this.yaw + d6 / (double) this.d);
this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
--this.d;
- this.a(d3, d4, d5);
+ this.setPosition(d3, d4, d5);
this.c(this.yaw, this.pitch);
} else {
d3 = this.locX + this.motX;
d4 = this.locY + this.motY;
d5 = this.locZ + this.motZ;
- this.a(d3, d4, d5);
+ this.setPosition(d3, d4, d5);
if (this.onGround) {
this.motX *= 0.5D;
this.motY *= 0.5D;
@@ -256,7 +257,7 @@ public class EntityBoat extends Entity {
this.motZ *= 0.5D;
}
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
d5 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
double d7;
@@ -282,9 +283,9 @@ public class EntityBoat extends Entity {
}
}
- if (this.aW && d5 > 0.15D) {
+ if (this.positionChanged && d5 > 0.15D) {
if (!this.world.isStatic) {
- this.D();
+ this.die();
int k;
@@ -354,7 +355,7 @@ public class EntityBoat extends Entity {
Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
- entity.h(this);
+ entity.collide(this);
}
}
}
@@ -370,7 +371,7 @@ public class EntityBoat extends Entity {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
- this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.C(), this.locZ + d1);
+ this.passenger.setPosition(this.locX + d0, this.locY + this.k() + this.passenger.C(), this.locZ + d1);
}
}
@@ -396,7 +397,7 @@ public class EntityBoat extends Entity {
}
// CraftBukkit end
- entityhuman.b((Entity) this);
+ entityhuman.mount(this);
}
return true;
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 7e7b175f..e14d4ea6 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -44,7 +44,7 @@ public class EntityCow extends EntityAnimal {
}
public boolean a(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.inventory.b();
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
// CraftBukkit start - got milk?
@@ -59,7 +59,7 @@ public class EntityCow extends EntityAnimal {
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
itemstack = new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data );
- entityhuman.inventory.a(entityhuman.inventory.c, itemstack);
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, itemstack);
// CraftBukkit end
return true;
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index af2eb83f..8b73c92d 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -9,10 +9,9 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
// CraftBukkit end
public class EntityCreature extends EntityLiving {
- // CraftBukkit start - both public
- public PathEntity a;
- public Entity d;
- // CraftBukkit end
+
+ public PathEntity pathEntity; // CraftBukkit - public
+ public Entity target; // CraftBukkit - public
protected boolean e = false;
public EntityCreature(World world) {
@@ -27,9 +26,9 @@ public class EntityCreature extends EntityLiving {
this.e = this.u();
float f = 16.0F;
- if (this.d == null) {
+ if (this.target == null) {
// CraftBukkit start
- Entity target = this.m();
+ Entity target = this.findTarget();
if (target != null) {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
CraftServer server = ((WorldServer) this.world).getServer();
@@ -37,17 +36,17 @@ public class EntityCreature extends EntityLiving {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
- this.d = null;
+ this.target = null;
} else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
+ this.target = ((CraftEntity) event.getTarget()).getHandle();
}
}
}
// CraftBukkit end
- if (this.d != null) {
- this.a = this.world.a(this, this.d, f);
+ if (this.target != null) {
+ this.pathEntity = this.world.findPath(this, this.target, f);
}
- } else if (!this.d.N()) {
+ } else if (!this.target.N()) {
// CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
CraftServer server = ((WorldServer) this.world).getServer();
@@ -55,23 +54,23 @@ public class EntityCreature extends EntityLiving {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
- this.d = null;
+ this.target = null;
} else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
+ this.target = ((CraftEntity) event.getTarget()).getHandle();
}
}
// CraftBukkit end
} else {
- float f1 = this.d.f(this);
+ float f1 = this.target.f(this);
- if (this.e(this.d)) {
- this.a(this.d, f1);
+ if (this.e(this.target)) {
+ this.a(this.target, f1);
}
}
- if (!this.e && this.d != null && (this.a == null || this.random.nextInt(20) == 0)) {
- this.a = this.world.a(this, this.d, f);
- } else if (!this.e && (this.a == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0)) {
+ if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
+ this.pathEntity = this.world.findPath(this, this.target, f);
+ } else if (!this.e && (this.pathEntity == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0)) {
boolean flag = false;
int i = -1;
int j = -1;
@@ -79,9 +78,9 @@ public class EntityCreature extends EntityLiving {
float f2 = -99999.0F;
for (int l = 0; l < 10; ++l) {
- int i1 = MathHelper.b(this.locX + (double) this.random.nextInt(13) - 6.0D);
- int j1 = MathHelper.b(this.locY + (double) this.random.nextInt(7) - 3.0D);
- int k1 = MathHelper.b(this.locZ + (double) this.random.nextInt(13) - 6.0D);
+ int i1 = MathHelper.floor(this.locX + (double) this.random.nextInt(13) - 6.0D);
+ int j1 = MathHelper.floor(this.locY + (double) this.random.nextInt(7) - 3.0D);
+ int k1 = MathHelper.floor(this.locZ + (double) this.random.nextInt(13) - 6.0D);
float f3 = this.a(i1, j1, k1);
if (f3 > f2) {
@@ -94,26 +93,26 @@ public class EntityCreature extends EntityLiving {
}
if (flag) {
- this.a = this.world.a(this, i, j, k, 10.0F);
+ this.pathEntity = this.world.a(this, i, j, k, 10.0F);
}
}
- int l1 = MathHelper.b(this.boundingBox.b);
+ int l1 = MathHelper.floor(this.boundingBox.b);
boolean flag1 = this.g_();
boolean flag2 = this.V();
this.pitch = 0.0F;
- if (this.a != null && this.random.nextInt(100) != 0) {
- Vec3D vec3d = this.a.a(this);
+ if (this.pathEntity != null && this.random.nextInt(100) != 0) {
+ Vec3D vec3d = this.pathEntity.a(this);
double d0 = (double) (this.length * 2.0F);
while (vec3d != null && vec3d.d(this.locX, vec3d.b, this.locZ) < d0 * d0) {
- this.a.a();
- if (this.a.b()) {
+ this.pathEntity.a();
+ if (this.pathEntity.b()) {
vec3d = null;
- this.a = null;
+ this.pathEntity = null;
} else {
- vec3d = this.a.a(this);
+ vec3d = this.pathEntity.a(this);
}
}
@@ -143,15 +142,15 @@ public class EntityCreature extends EntityLiving {
}
this.yaw += f5;
- if (this.e && this.d != null) {
- double d4 = this.d.locX - this.locX;
- double d5 = this.d.locZ - this.locZ;
+ if (this.e && this.target != null) {
+ double d4 = this.target.locX - this.locX;
+ double d5 = this.target.locZ - this.locZ;
float f6 = this.yaw;
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
- this.au = -MathHelper.a(f5) * this.av * 1.0F;
- this.av = MathHelper.b(f5) * this.av * 1.0F;
+ this.au = -MathHelper.sin(f5) * this.av * 1.0F;
+ this.av = MathHelper.cos(f5) * this.av * 1.0F;
}
if (d3 > 0.0D) {
@@ -159,11 +158,11 @@ public class EntityCreature extends EntityLiving {
}
}
- if (this.d != null) {
- this.a(this.d, 30.0F, 30.0F);
+ if (this.target != null) {
+ this.a(this.target, 30.0F, 30.0F);
}
- if (this.aW) {
+ if (this.positionChanged) {
this.ax = true;
}
@@ -172,7 +171,7 @@ public class EntityCreature extends EntityLiving {
}
} else {
super.c_();
- this.a = null;
+ this.pathEntity = null;
}
}
@@ -182,31 +181,31 @@ public class EntityCreature extends EntityLiving {
return 0.0F;
}
- protected Entity m() {
+ protected Entity findTarget() {
return null;
}
public boolean b() {
- int i = MathHelper.b(this.locX);
- int j = MathHelper.b(this.boundingBox.b);
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.boundingBox.b);
+ int k = MathHelper.floor(this.locZ);
return super.b() && this.a(i, j, k) >= 0.0F;
}
public boolean z() {
- return this.a != null;
+ return this.pathEntity != null;
}
public void a(PathEntity pathentity) {
- this.a = pathentity;
+ this.pathEntity = pathentity;
}
public Entity A() {
- return this.d;
+ return this.target;
}
public void c(Entity entity) {
- this.d = entity;
+ this.target = entity;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index e7439d79..cc6a97a6 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -8,7 +8,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EntityCreeper extends EntityMonster {
- int a;
+ int fuseTicks;
int b;
public EntityCreeper(World world) {
@@ -30,21 +30,21 @@ public class EntityCreeper extends EntityMonster {
}
public void f_() {
- this.b = this.a;
+ this.b = this.fuseTicks;
if (this.world.isStatic) {
int i = this.v();
- if (i > 0 && this.a == 0) {
- this.world.a(this, "random.fuse", 1.0F, 0.5F);
+ if (i > 0 && this.fuseTicks == 0) {
+ this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
}
- this.a += i;
- if (this.a < 0) {
- this.a = 0;
+ this.fuseTicks += i;
+ if (this.fuseTicks < 0) {
+ this.fuseTicks = 0;
}
- if (this.a >= 30) {
- this.a = 30;
+ if (this.fuseTicks >= 30) {
+ this.fuseTicks = 30;
}
}
@@ -71,18 +71,18 @@ public class EntityCreeper extends EntityMonster {
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.e(-1);
- --this.a;
- if (this.a < 0) {
- this.a = 0;
+ --this.fuseTicks;
+ if (this.fuseTicks < 0) {
+ this.fuseTicks = 0;
}
} else {
- if (this.a == 0) {
- this.world.a(this, "random.fuse", 1.0F, 0.5F);
+ if (this.fuseTicks == 0) {
+ this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
}
this.e(1);
- ++this.a;
- if (this.a >= 30) {
+ ++this.fuseTicks;
+ if (this.fuseTicks >= 30) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
@@ -90,10 +90,10 @@ public class EntityCreeper extends EntityMonster {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
- this.D();
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
+ this.die();
} else {
- this.a = 0;
+ this.fuseTicks = 0;
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index 220e020d..32efe891 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -21,7 +21,7 @@ public class EntityEgg extends Entity {
private int e = 0;
private boolean f = false;
public int a = 0;
- private EntityLiving g;
+ private EntityLiving thrower;
private int h;
private int i = 0;
@@ -34,19 +34,19 @@ public class EntityEgg extends Entity {
public EntityEgg(World world, EntityLiving entityliving) {
super(world);
- this.g = entityliving;
+ this.thrower = entityliving;
this.b(0.25F, 0.25F);
- this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
+ this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
- this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
- this.a(this.locX, this.locY, this.locZ);
+ 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.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
+ 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);
}
@@ -54,7 +54,7 @@ public class EntityEgg extends Entity {
super(world);
this.h = 0;
this.b(0.25F, 0.25F);
- this.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
@@ -95,7 +95,7 @@ public class EntityEgg extends Entity {
if (i == this.e) {
++this.h;
if (this.h == 1200) {
- this.D();
+ this.die();
}
return;
@@ -111,14 +111,14 @@ public class EntityEgg extends Entity {
++this.i;
}
- Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
+ vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
if (!this.world.isStatic) {
@@ -129,7 +129,7 @@ public class EntityEgg extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
+ if (entity1.d_() && (entity1 != this.thrower || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -152,12 +152,12 @@ public class EntityEgg extends Entity {
if (movingobjectposition != null) {
// CraftBukkit start
- if (movingobjectposition.g != null) {
+ if (movingobjectposition.entity != null) {
boolean stick;
- if (movingobjectposition.g instanceof EntityLiving) {
+ if (movingobjectposition.entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
- org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
+ org.bukkit.entity.Entity shooter = (this.thrower == null) ? null : this.thrower.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
@@ -168,13 +168,13 @@ public class EntityEgg extends Entity {
if (!event.isCancelled()) {
// this function returns if the egg should stick or not, i.e. !bounce
- stick = movingobjectposition.g.a(this.g, event.getDamage());
+ stick = movingobjectposition.entity.damageEntity(this.thrower, event.getDamage());
} else {
// event was cancelled, get if the egg should bounce or not
stick = !event.getBounce();
}
} else {
- stick = movingobjectposition.g.a(this.g, 0);
+ stick = movingobjectposition.entity.damageEntity(this.thrower, 0);
}
if (stick) {
@@ -190,9 +190,9 @@ public class EntityEgg extends Entity {
CreatureType hatchingType = CreatureType.CHICKEN;
- if (this.g instanceof EntityPlayer) {
+ if (this.thrower instanceof EntityPlayer) {
CraftServer server = ((WorldServer) this.world).getServer();
- Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity();
+ Player player = (this.thrower == null) ? null : (Player) this.thrower.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
server.getPluginManager().callEvent(event);
@@ -258,9 +258,9 @@ public class EntityEgg extends Entity {
// The world we're spawning in accepts this creature
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
- if ((isAnimal && this.world.E) || (!isAnimal && this.world.D)) {
- entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
- this.world.a(entity);
+ if ((isAnimal && this.world.allowAnimals) || (!isAnimal && this.world.allowMonsters)) {
+ entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
+ this.world.addEntity(entity);
}
}
}
@@ -270,7 +270,7 @@ public class EntityEgg extends Entity {
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
}
- this.D();
+ this.die();
}
this.locX += this.motX;
@@ -315,7 +315,7 @@ public class EntityEgg extends Entity {
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.motY -= (double) f3;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -337,10 +337,10 @@ public class EntityEgg extends Entity {
}
public void b(EntityHuman entityhuman) {
- if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
- this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
- entityhuman.b(this, 1);
- this.D();
+ if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
+ this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ entityhuman.receive(this, 1);
+ this.die();
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index d9727151..cee2b283 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -19,7 +19,7 @@ public class EntityFireball extends Entity {
private int h = 0;
private boolean i = false;
public int a = 0;
- private EntityLiving j;
+ private EntityLiving shooter;
private int k;
private int l = 0;
public double b;
@@ -35,10 +35,10 @@ public class EntityFireball extends Entity {
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(world);
- this.j = entityliving;
+ this.shooter = entityliving;
this.b(1.0F, 1.0F);
- this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.a(this.locX, this.locY, this.locZ);
+ this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F;
this.motX = this.motY = this.motZ = 0.0D;
d0 += this.random.nextGaussian() * 0.4D;
@@ -64,7 +64,7 @@ public class EntityFireball extends Entity {
if (i == this.h) {
++this.k;
if (this.k == 1200) {
- this.D();
+ this.die();
}
return;
@@ -80,14 +80,14 @@ public class EntityFireball extends Entity {
++this.l;
}
- Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
+ vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
Entity entity = null;
@@ -97,7 +97,7 @@ public class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.d_() && (entity1 != this.j || this.l >= 25)) {
+ if (entity1.d_() && (entity1 != this.shooter || this.l >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -119,12 +119,12 @@ public class EntityFireball extends Entity {
if (movingobjectposition != null) {
// CraftBukkit start
- if (movingobjectposition.g != null) {
+ if (movingobjectposition.entity != null) {
boolean stick;
- if (movingobjectposition.g instanceof EntityLiving) {
+ if (movingobjectposition.entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity shooter = (this.j == null) ? null : this.j.getBukkitEntity();
- org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
+ org.bukkit.entity.Entity shooter = (this.shooter == null) ? null : this.shooter.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
@@ -135,13 +135,13 @@ public class EntityFireball extends Entity {
if (!event.isCancelled()) {
// this function returns if the fireball should stick or not, i.e. !bounce
- stick = movingobjectposition.g.a(this.j, event.getDamage());
+ stick = movingobjectposition.entity.damageEntity(this.shooter, event.getDamage());
} else {
// event was cancelled, get if the fireball should bounce or not
stick = !event.getBounce();
}
} else {
- stick = movingobjectposition.g.a(this.j, 0);
+ stick = movingobjectposition.entity.damageEntity(this.shooter, 0);
}
if (stick) {
;
@@ -154,8 +154,8 @@ public class EntityFireball extends Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
// give 'this' instead of (Entity) null so we know what causes the damage
- this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
- this.D();
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
+ this.die();
}
// CraftBukkit end
}
@@ -204,7 +204,7 @@ public class EntityFireball extends Entity {
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -229,7 +229,7 @@ public class EntityFireball extends Entity {
return true;
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
this.W();
if (entity != null) {
Vec3D vec3d = entity.S();
diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java
index 542ec468..486a862a 100644
--- a/src/main/java/net/minecraft/server/EntityFish.java
+++ b/src/main/java/net/minecraft/server/EntityFish.java
@@ -17,7 +17,7 @@ public class EntityFish extends Entity {
private int g = 0;
private boolean h = false;
public int a = 0;
- public EntityHuman b;
+ public EntityHuman owner;
private int i;
private int j = 0;
private int k = 0;
@@ -38,20 +38,20 @@ public class EntityFish extends Entity {
public EntityFish(World world, EntityHuman entityhuman) {
super(world);
- this.b = entityhuman;
- this.b.hookedFish = this;
+ this.owner = entityhuman;
+ this.owner.hookedFish = this;
this.b(0.25F, 0.25F);
- this.c(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch);
- this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
+ 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.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
- this.a(this.locX, this.locY, this.locZ);
+ 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.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
+ 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);
}
@@ -97,15 +97,15 @@ public class EntityFish extends Entity {
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.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.b.A();
+ ItemStack itemstack = this.owner.A();
- if (this.b.dead || !this.b.N() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) {
- this.D();
- this.b.hookedFish = null;
+ if (this.owner.dead || !this.owner.N() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.g(this.owner) > 1024.0D) {
+ this.die();
+ this.owner.hookedFish = null;
return;
}
@@ -131,7 +131,7 @@ public class EntityFish extends Entity {
if (i == this.g) {
++this.i;
if (this.i == 1200) {
- this.D();
+ this.die();
}
return;
@@ -147,14 +147,14 @@ public class EntityFish extends Entity {
++this.j;
}
- Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
+ vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
Entity entity = null;
@@ -166,7 +166,7 @@ public class EntityFish extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.d_() && (entity1 != this.b || this.j >= 5)) {
+ if (entity1.d_() && (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);
@@ -186,14 +186,14 @@ public class EntityFish extends Entity {
}
if (movingobjectposition != null) {
- if (movingobjectposition.g != null) {
+ if (movingobjectposition.entity != null) {
// CraftBukkit start
// TODO add EntityDamagedByProjectileEvent : fishing hook?
boolean stick;
- if (movingobjectposition.g instanceof EntityLiving) {
+ if (movingobjectposition.entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
- org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
+ org.bukkit.entity.Entity shooter = (this.owner == null) ? null : this.owner.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
@@ -204,17 +204,17 @@ public class EntityFish extends Entity {
if (!event.isCancelled()) {
// this function returns if the fish should stick or not, i.e. !bounce
- stick = movingobjectposition.g.a(this.b, event.getDamage());
+ stick = movingobjectposition.entity.damageEntity(this.owner, event.getDamage());
} else {
// event was cancelled, get if the fish should bounce or not
stick = !event.getBounce();
}
} else {
- stick = movingobjectposition.g.a(this.b, 0);
+ stick = movingobjectposition.entity.damageEntity(this.owner, 0);
}
if (!stick) {
// CraftBukkit end
- this.c = movingobjectposition.g;
+ this.c = movingobjectposition.entity;
}
} else {
this.h = true;
@@ -222,7 +222,7 @@ public class EntityFish extends Entity {
}
if (!this.h) {
- this.c(this.motX, this.motY, this.motZ);
+ 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);
@@ -247,7 +247,7 @@ public class EntityFish extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.92F;
- if (this.onGround || this.aW) {
+ if (this.onGround || this.positionChanged) {
f2 = 0.5F;
}
@@ -270,8 +270,8 @@ public class EntityFish extends Entity {
} else if (this.random.nextInt(500) == 0) {
this.k = this.random.nextInt(30) + 10;
this.motY -= 0.20000000298023224D;
- this.world.a(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
- float f3 = (float) MathHelper.b(this.boundingBox.b);
+ 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);
int l;
float f4;
@@ -305,7 +305,7 @@ public class EntityFish extends Entity {
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
}
}
@@ -332,9 +332,9 @@ public class EntityFish extends Entity {
byte b0 = 0;
if (this.c != null) {
- double d0 = this.b.locX - this.locX;
- double d1 = this.b.locY - this.locY;
- double d2 = this.b.locZ - this.locZ;
+ 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;
@@ -344,17 +344,17 @@ public class EntityFish extends Entity {
b0 = 3;
} else if (this.k > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
- double d5 = this.b.locX - this.locX;
- double d6 = this.b.locY - this.locY;
- double d7 = this.b.locZ - this.locZ;
+ 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.a((Entity) entityitem);
- this.b.a(StatisticList.x, 1);
+ this.world.addEntity(entityitem);
+ this.owner.a(StatisticList.x, 1);
b0 = 1;
}
@@ -362,8 +362,8 @@ public class EntityFish extends Entity {
b0 = 2;
}
- this.D();
- this.b.hookedFish = null;
+ this.die();
+ this.owner.hookedFish = null;
return b0;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index f77ea7cf..a33b0fe6 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -40,9 +40,7 @@ public abstract class EntityHuman extends EntityLiving {
public boolean fauxSleeping;
// CraftBukkit end
private ChunkCoordinates b;
- // CraftBukkit start
- public int sleepTicks;
- // CraftBukkit end
+ public int sleepTicks; // CraftBukkit (public)
public float z;
public float A;
private ChunkCoordinates d;
@@ -54,9 +52,9 @@ public abstract class EntityHuman extends EntityLiving {
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic);
this.activeContainer = this.defaultContainer;
this.height = 1.62F;
- ChunkCoordinates chunkcoordinates = world.m();
+ ChunkCoordinates chunkcoordinates = world.getSpawn();
- this.c((double) chunkcoordinates.a + 0.5D, (double) (chunkcoordinates.b + 1), (double) chunkcoordinates.c + 0.5D, 0.0F, 0.0F);
+ this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
this.health = 20;
this.P = "humanoid";
this.O = 180.0F;
@@ -70,7 +68,7 @@ public abstract class EntityHuman extends EntityLiving {
}
public void f_() {
- if (this.F()) {
+ if (this.isSleeping()) {
++this.sleepTicks;
if (this.sleepTicks > 100) {
this.sleepTicks = 100;
@@ -133,7 +131,7 @@ public abstract class EntityHuman extends EntityLiving {
}
protected boolean p_() {
- return this.health <= 0 || this.F();
+ return this.health <= 0 || this.isSleeping();
}
protected void u() {
@@ -161,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving {
}
public void r() {
- if (this.world.j == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
+ if (this.world.spawnMonsters == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
this.b(1);
}
@@ -208,7 +206,7 @@ public abstract class EntityHuman extends EntityLiving {
public void a(Entity entity) {
super.a(entity);
this.b(0.2F, 0.2F);
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.motY = 0.10000000149011612D;
if (this.name.equals("Notch")) {
this.a(new ItemStack(Item.APPLE, 1), true);
@@ -216,8 +214,8 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.h();
if (entity != null) {
- this.motX = (double) (-MathHelper.b((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
- this.motZ = (double) (-MathHelper.a((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motX = (double) (-MathHelper.cos((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motZ = (double) (-MathHelper.sin((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@@ -236,7 +234,7 @@ public abstract class EntityHuman extends EntityLiving {
}
public void z() {
- this.a(this.inventory.a(this.inventory.c, 1), false);
+ this.a(this.inventory.a(this.inventory.itemInHandIndex, 1), false);
}
public void b(ItemStack itemstack) {
@@ -247,7 +245,7 @@ public abstract class EntityHuman extends EntityLiving {
if (itemstack != null) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.q(), this.locZ, itemstack);
- entityitem.c = 40;
+ entityitem.pickupDelay = 40;
float f = 0.1F;
float f1;
@@ -255,14 +253,14 @@ public abstract class EntityHuman extends EntityLiving {
f1 = this.random.nextFloat() * 0.5F;
float f2 = this.random.nextFloat() * 3.1415927F * 2.0F;
- entityitem.motX = (double) (-MathHelper.a(f2) * f1);
- entityitem.motZ = (double) (MathHelper.b(f2) * f1);
+ entityitem.motX = (double) (-MathHelper.sin(f2) * f1);
+ entityitem.motZ = (double) (MathHelper.cos(f2) * f1);
entityitem.motY = 0.20000000298023224D;
} else {
f = 0.3F;
- entityitem.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- entityitem.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- entityitem.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f + 0.1F);
+ entityitem.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
+ entityitem.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
+ entityitem.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f + 0.1F);
f = 0.02F;
f1 = this.random.nextFloat() * 3.1415927F * 2.0F;
f *= this.random.nextFloat();
@@ -294,7 +292,7 @@ public abstract class EntityHuman extends EntityLiving {
}
protected void a(EntityItem entityitem) {
- this.world.a((Entity) entityitem);
+ this.world.addEntity(entityitem);
}
public float a(Block block) {
@@ -324,11 +322,11 @@ public abstract class EntityHuman extends EntityLiving {
this.sleeping = nbttagcompound.m("Sleeping");
this.sleepTicks = nbttagcompound.d("SleepTimer");
if (this.sleeping) {
- this.b = new ChunkCoordinates(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ));
+ this.b = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
- if (nbttagcompound.b("SpawnX") && nbttagcompound.b("SpawnY") && nbttagcompound.b("SpawnZ")) {
+ if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
this.d = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("SpawnZ"));
}
}
@@ -340,9 +338,9 @@ public abstract class EntityHuman extends EntityLiving {
nbttagcompound.a("Sleeping", this.sleeping);
nbttagcompound.a("SleepTimer", (short) this.sleepTicks);
if (this.d != null) {
- nbttagcompound.a("SpawnX", this.d.a);
- nbttagcompound.a("SpawnY", this.d.b);
- nbttagcompound.a("SpawnZ", this.d.c);
+ nbttagcompound.a("SpawnX", this.d.x);
+ nbttagcompound.a("SpawnY", this.d.y);
+ nbttagcompound.a("SpawnZ", this.d.z);
}
}
@@ -350,7 +348,7 @@ public abstract class EntityHuman extends EntityLiving {
public void b(int i, int j, int k) {}
- public void b(Entity entity, int i) {}
+ public void receive(Entity entity, int i) {}
public float q() {
return 0.12F;
@@ -360,25 +358,25 @@ public abstract class EntityHuman extends EntityLiving {
this.height = 1.62F;
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
this.at = 0;
if (this.health <= 0) {
return false;
} else {
- if (this.F()) {
+ if (this.isSleeping()) {
this.a(true, true, false);
}
if (entity instanceof EntityMonster || entity instanceof EntityArrow) {
- if (this.world.j == 0) {
+ if (this.world.spawnMonsters == 0) {
i = 0;
}
- if (this.world.j == 1) {
+ if (this.world.spawnMonsters == 1) {
i = i / 3 + 1;
}
- if (this.world.j == 3) {
+ if (this.world.spawnMonsters == 3) {
i = i * 3 / 2;
}
}
@@ -388,8 +386,8 @@ public abstract class EntityHuman extends EntityLiving {
} else {
Object object = entity;
- if (entity instanceof EntityArrow && ((EntityArrow) entity).b != null) {
- object = ((EntityArrow) entity).b;
+ if (entity instanceof EntityArrow && ((EntityArrow) entity).shooter != null) {
+ object = ((EntityArrow) entity).shooter;
}
// CraftBukkit start - this is here instead of EntityMonster because EntityLiving(s) that aren't monsters
@@ -413,7 +411,7 @@ public abstract class EntityHuman extends EntityLiving {
}
this.a(StatisticList.t, i);
- return super.a(entity, i);
+ return super.damageEntity(entity, i);
}
}
}
@@ -474,11 +472,11 @@ public abstract class EntityHuman extends EntityLiving {
}
public ItemStack A() {
- return this.inventory.b();
+ return this.inventory.getItemInHand();
}
public void B() {
- this.inventory.a(this.inventory.c, (ItemStack) null);
+ this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
public double C() {
@@ -512,7 +510,7 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
- entity.a(this, i);
+ entity.damageEntity(this, i);
ItemStack itemstack = this.A();
if (itemstack != null && entity instanceof EntityLiving) {
@@ -535,8 +533,8 @@ public abstract class EntityHuman extends EntityLiving {
public void a(ItemStack itemstack) {}
- public void D() {
- super.D();
+ public void die() {
+ super.die();
this.defaultContainer.a(this);
if (this.activeContainer != null) {
this.activeContainer.a(this);
@@ -548,8 +546,8 @@ public abstract class EntityHuman extends EntityLiving {
}
public EnumBedError a(int i, int j, int k) {
- if (!this.F() && this.N()) {
- if (this.world.m.c) {
+ if (!this.isSleeping() && this.N()) {
+ if (this.world.worldProvider.c) {
return EnumBedError.NOT_POSSIBLE_HERE;
} else if (this.world.d()) {
return EnumBedError.NOT_POSSIBLE_NOW;
@@ -561,16 +559,16 @@ public abstract class EntityHuman extends EntityLiving {
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
server.getPluginManager().callEvent(event);
-
+
if (event.isCancelled()) {
return EnumBedError.OTHER_PROBLEM;
}
}
// CraftBukkit end
-
+
this.b(0.2F, 0.2F);
this.height = 0.2F;
- if (this.world.f(i, j, k)) {
+ if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
int i1 = BlockBed.c(l);
float f = 0.5F;
@@ -594,9 +592,9 @@ public abstract class EntityHuman extends EntityLiving {
}
this.e(i1);
- this.a((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
+ this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
- this.a((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
+ this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
}
this.sleeping = true;
@@ -604,7 +602,7 @@ public abstract class EntityHuman extends EntityLiving {
this.b = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
- this.world.q();
+ this.world.everyoneSleeping();
}
return EnumBedError.OK;
@@ -643,19 +641,19 @@ public abstract class EntityHuman extends EntityLiving {
ChunkCoordinates chunkcoordinates = this.b;
ChunkCoordinates chunkcoordinates1 = this.b;
- if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c) == Block.BED.id) {
- BlockBed.a(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, false);
- chunkcoordinates1 = BlockBed.f(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0);
+ if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
+ BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
+ chunkcoordinates1 = BlockBed.f(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
if (chunkcoordinates1 == null) {
- chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.a, chunkcoordinates.b + 1, chunkcoordinates.c);
+ chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
}
- this.a((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + this.height + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F));
+ this.setPosition((double) ((float) chunkcoordinates1.x + 0.5F), (double) ((float) chunkcoordinates1.y + this.height + 0.1F), (double) ((float) chunkcoordinates1.z + 0.5F));
}
this.sleeping = false;
if (!this.world.isStatic && flag1) {
- this.world.q();
+ this.world.everyoneSleeping();
}
// CraftBukkit start
@@ -664,7 +662,7 @@ public abstract class EntityHuman extends EntityLiving {
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block bed;
if (chunkcoordinates != null) {
- bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c);
+ bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
} else {
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
}
@@ -685,30 +683,30 @@ public abstract class EntityHuman extends EntityLiving {
}
private boolean m() {
- return this.world.getTypeId(this.b.a, this.b.b, this.b.c) == Block.BED.id;
+ return this.world.getTypeId(this.b.x, this.b.y, this.b.z) == Block.BED.id;
}
- public static ChunkCoordinates a(World world, ChunkCoordinates chunkcoordinates) {
+ public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates) {
IChunkProvider ichunkprovider = world.n();
- ichunkprovider.c(chunkcoordinates.a - 3 >> 4, chunkcoordinates.c - 3 >> 4);
- ichunkprovider.c(chunkcoordinates.a + 3 >> 4, chunkcoordinates.c - 3 >> 4);
- ichunkprovider.c(chunkcoordinates.a - 3 >> 4, chunkcoordinates.c + 3 >> 4);
- ichunkprovider.c(chunkcoordinates.a + 3 >> 4, chunkcoordinates.c + 3 >> 4);
- if (world.getTypeId(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c) != Block.BED.id) {
+ ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
+ ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
+ ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4);
+ ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4);
+ if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) != Block.BED.id) {
return null;
} else {
- ChunkCoordinates chunkcoordinates1 = BlockBed.f(world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0);
+ ChunkCoordinates chunkcoordinates1 = BlockBed.f(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
return chunkcoordinates1;
}
}
- public boolean F() {
+ public boolean isSleeping() {
return this.sleeping;
}
- public boolean G() {
+ public boolean isDeeplySleeping() {
return this.sleeping && this.sleepTicks >= 100;
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 50299f72..3540abd4 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -8,10 +8,10 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
public class EntityItem extends Entity {
- public ItemStack a;
+ public ItemStack itemStack;
private int e;
public int b = 0;
- public int c;
+ public int pickupDelay;
private int f = 5;
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
@@ -19,8 +19,8 @@ public class EntityItem extends Entity {
super(world);
this.b(0.25F, 0.25F);
this.height = this.width / 2.0F;
- this.a(d0, d1, d2);
- this.a = itemstack;
+ this.setPosition(d0, d1, d2);
+ this.itemStack = itemstack;
this.yaw = (float) (Math.random() * 360.0D);
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
this.motY = 0.20000000298023224D;
@@ -41,28 +41,28 @@ public class EntityItem extends Entity {
public void f_() {
super.f_();
- if (this.c > 0) {
- --this.c;
+ if (this.pickupDelay > 0) {
+ --this.pickupDelay;
}
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- if (this.world.getMaterial(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) == Material.LAVA) {
+ if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
this.motY = 0.20000000298023224D;
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
- this.world.a(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
+ this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
this.g(this.locX, this.locY, this.locZ);
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
float f = 0.98F;
if (this.onGround) {
f = 0.58800006F;
- int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
+ int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
if (i > 0) {
f = Block.byId[i].frictionFactor * 0.98F;
@@ -79,7 +79,7 @@ public class EntityItem extends Entity {
++this.e;
++this.b;
if (this.b >= 6000) {
- this.D();
+ this.die();
}
}
@@ -88,9 +88,9 @@ public class EntityItem extends Entity {
}
private boolean g(double d0, double d1, double d2) {
- int i = MathHelper.b(d0);
- int j = MathHelper.b(d1);
- int k = MathHelper.b(d2);
+ int i = MathHelper.floor(d0);
+ int j = MathHelper.floor(d1);
+ int k = MathHelper.floor(d2);
double d3 = d0 - (double) i;
double d4 = d1 - (double) j;
double d5 = d2 - (double) k;
@@ -166,14 +166,14 @@ public class EntityItem extends Entity {
}
protected void a(int i) {
- this.a((Entity) null, i);
+ this.damageEntity((Entity) null, i);
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
this.W();
this.f -= i;
if (this.f <= 0) {
- this.D();
+ this.die();
}
return false;
@@ -182,7 +182,7 @@ public class EntityItem extends Entity {
public void a(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) ((byte) this.f));
nbttagcompound.a("Age", (short) this.b);
- nbttagcompound.a("Item", this.a.a(new NBTTagCompound()));
+ nbttagcompound.a("Item", this.itemStack.a(new NBTTagCompound()));
}
public void b(NBTTagCompound nbttagcompound) {
@@ -190,26 +190,27 @@ public class EntityItem extends Entity {
this.b = nbttagcompound.d("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item");
- this.a = new ItemStack(nbttagcompound1);
+ this.itemStack = new ItemStack(nbttagcompound1);
}
public void b(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- int i = this.a.count;
+ int i = this.itemStack.count;
// CraftBukkit start
- if (this.c == 0) {
+ if (this.pickupDelay == 0) {
Player player = (Player) entityhuman.getBukkitEntity();
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (Item) this.getBukkitEntity());
((WorldServer) world).getServer().getPluginManager().callEvent(event);
- if (!event.isCancelled() && entityhuman.inventory.a(this.a)) {
- this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
- entityhuman.b(this, i);
- this.D();
+ if (event.isCancelled() || !entityhuman.inventory.canHold(this.itemStack)) {
+ return;
}
+ // CraftBukkit end
+ this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ entityhuman.receive(this, i);
+ this.die();
}
- // CraftBukkit end
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3dcc4bc3..730602fc 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -75,7 +75,7 @@ public abstract class EntityLiving extends Entity {
super(world);
this.aD = true;
this.E = (float) (Math.random() + 1.0D) * 0.01F;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.D = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.bm = 0.5F;
@@ -84,7 +84,7 @@ public abstract class EntityLiving extends Entity {
protected void a() {}
public boolean e(Entity entity) {
- return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.q(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.q(), entity.locZ)) == null;
+ return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.q(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.q(), entity.locZ)) == null;
}
public boolean d_() {
@@ -107,7 +107,7 @@ public abstract class EntityLiving extends Entity {
String s = this.e();
if (s != null) {
- this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.world.makeSound(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
@@ -129,8 +129,8 @@ public abstract class EntityLiving extends Entity {
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, damage);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled() && event.getDamage() != 0) {
- this.a((Entity) null, event.getDamage());
+ if (!event.isCancelled()) {
+ this.damageEntity((Entity) null, event.getDamage());
}
// CraftBukkit end
}
@@ -163,8 +163,8 @@ public abstract class EntityLiving extends Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled() && event.getDamage() != 0) {
- this.a((Entity) null, event.getDamage());
+ if (!event.isCancelled()) {
+ this.damageEntity((Entity) null, event.getDamage());
}
// CraftBukkit end
}
@@ -191,7 +191,7 @@ public abstract class EntityLiving extends Entity {
++this.deathTicks;
if (this.deathTicks > 20) {
this.Q();
- this.D();
+ this.die();
for (i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
@@ -338,7 +338,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (this.world.isStatic) {
return false;
} else {
@@ -387,12 +387,12 @@ public abstract class EntityLiving extends Entity {
if (this.health <= 0) {
if (flag) {
- this.world.a(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.world.makeSound(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
this.a(entity);
} else if (flag) {
- this.world.a(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.world.makeSound(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
return true;
@@ -488,16 +488,16 @@ public abstract class EntityLiving extends Entity {
server.getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getDamage() != 0) {
- this.a((Entity) null, event.getDamage());
+ this.damageEntity((Entity) null, event.getDamage());
}
// CraftBukkit end
- int j = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.b(this.locZ));
+ int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
if (j > 0) {
StepSound stepsound = Block.byId[j].stepSound;
- this.world.a(this, stepsound.c(), stepsound.a() * 0.5F, stepsound.b() * 0.75F);
+ this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
}
}
}
@@ -508,23 +508,23 @@ public abstract class EntityLiving extends Entity {
if (this.g_()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
this.motZ *= 0.800000011920929D;
this.motY -= 0.02D;
- if (this.aW && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
+ if (this.positionChanged && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
} else if (this.V()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.5D;
this.motY *= 0.5D;
this.motZ *= 0.5D;
this.motY -= 0.02D;
- if (this.aW && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
+ if (this.positionChanged && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
} else {
@@ -532,7 +532,7 @@ public abstract class EntityLiving extends Entity {
if (this.onGround) {
f2 = 0.54600006F;
- int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
+ int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
if (i > 0) {
f2 = Block.byId[i].frictionFactor * 0.91F;
@@ -545,7 +545,7 @@ public abstract class EntityLiving extends Entity {
f2 = 0.91F;
if (this.onGround) {
f2 = 0.54600006F;
- int j = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
+ int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
if (j > 0) {
f2 = Block.byId[j].frictionFactor * 0.91F;
@@ -558,13 +558,13 @@ public abstract class EntityLiving extends Entity {
this.motY = -0.15D;
}
- if (this.Z() && this.motY < 0.0D) {
+ if (this.isSneaking() && this.motY < 0.0D) {
this.motY = 0.0D;
}
}
- this.c(this.motX, this.motY, this.motZ);
- if (this.aW && this.n()) {
+ this.move(this.motX, this.motY, this.motZ);
+ if (this.positionChanged && this.n()) {
this.motY = 0.2D;
}
@@ -588,9 +588,9 @@ public abstract class EntityLiving extends Entity {
}
public boolean n() {
- int i = MathHelper.b(this.locX);
- int j = MathHelper.b(this.boundingBox.b);
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.boundingBox.b);
+ int k = MathHelper.floor(this.locZ);
return this.world.getTypeId(i, j, k) == Block.LADDER.id || this.world.getTypeId(i, j + 1, k) == Block.LADDER.id;
}
@@ -604,7 +604,7 @@ public abstract class EntityLiving extends Entity {
public void b(NBTTagCompound nbttagcompound) {
this.health = nbttagcompound.d("Health");
- if (!nbttagcompound.b("Health")) {
+ if (!nbttagcompound.hasKey("Health")) {
this.health = 10;
}
@@ -640,7 +640,7 @@ public abstract class EntityLiving extends Entity {
this.yaw = (float) ((double) this.yaw + d3 / (double) this.al);
this.pitch = (float) ((double) this.pitch + (this.aq - (double) this.pitch) / (double) this.al);
--this.al;
- this.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch);
}
@@ -677,7 +677,7 @@ public abstract class EntityLiving extends Entity {
Entity entity = (Entity) list.get(i);
if (entity.e_()) {
- entity.h(this);
+ entity.collide(this);
}
}
}
@@ -706,14 +706,14 @@ public abstract class EntityLiving extends Entity {
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 16384.0D) {
- this.D();
+ this.die();
}
if (this.at > 600 && this.random.nextInt(800) == 0) {
if (d3 < 1024.0D) {
this.at = 0;
} else {
- this.D();
+ this.die();
}
}
}
@@ -812,7 +812,7 @@ public abstract class EntityLiving extends Entity {
public void Q() {}
public boolean b() {
- return this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
+ return this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
}
protected void R() {
@@ -829,7 +829,7 @@ public abstract class EntityLiving extends Entity {
return;
}
damageDone = event.getDamage();
- this.a((Entity) null, damageDone);
+ this.damageEntity((Entity) null, damageDone);
// CraftBukkit end
}
@@ -844,20 +844,20 @@ public abstract class EntityLiving extends Entity {
float f4;
if (f == 1.0F) {
- f1 = MathHelper.b(-this.yaw * 0.017453292F - 3.1415927F);
- f2 = MathHelper.a(-this.yaw * 0.017453292F - 3.1415927F);
- f3 = -MathHelper.b(-this.pitch * 0.017453292F);
- f4 = MathHelper.a(-this.pitch * 0.017453292F);
- return Vec3D.b((double) (f2 * f3), (double) f4, (double) (f1 * f3));
+ f1 = MathHelper.cos(-this.yaw * 0.017453292F - 3.1415927F);
+ f2 = MathHelper.sin(-this.yaw * 0.017453292F - 3.1415927F);
+ f3 = -MathHelper.cos(-this.pitch * 0.017453292F);
+ f4 = MathHelper.sin(-this.pitch * 0.017453292F);
+ return Vec3D.create((double) (f2 * f3), (double) f4, (double) (f1 * f3));
} else {
f1 = this.lastPitch + (this.pitch - this.lastPitch) * f;
f2 = this.lastYaw + (this.yaw - this.lastYaw) * f;
- f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
- f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
- float f5 = -MathHelper.b(-f1 * 0.017453292F);
- float f6 = MathHelper.a(-f1 * 0.017453292F);
+ f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
+ f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
- return Vec3D.b((double) (f4 * f5), (double) f6, (double) (f3 * f5));
+ return Vec3D.create((double) (f4 * f5), (double) f6, (double) (f3 * f5));
}
}
@@ -865,7 +865,7 @@ public abstract class EntityLiving extends Entity {
return 4;
}
- public boolean F() {
+ public boolean isSleeping() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index fb87d30b..c9465cdd 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -12,16 +12,16 @@ import org.bukkit.event.vehicle.*;
public class EntityMinecart extends Entity implements IInventory {
- private ItemStack[] h;
- public int a;
+ private ItemStack[] items;
+ public int damage;
public int b;
public int c;
private boolean i;
- public int d;
+ public int type;
public int e;
public double f;
public double g;
- private static final int[][][] j = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
+ private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
private int k;
private double l;
private double m;
@@ -40,14 +40,14 @@ public class EntityMinecart extends Entity implements IInventory {
public double maxSpeed = 0.4D;
public ItemStack[] getContents() {
- return this.h;
+ return this.items;
}
// CraftBukkit end
public EntityMinecart(World world) {
super(world);
- this.h = new ItemStack[27]; // CraftBukkit
- this.a = 0;
+ this.items = new ItemStack[27]; // CraftBukkit
+ this.damage = 0;
this.b = 0;
this.c = 1;
this.i = false;
@@ -76,14 +76,14 @@ public class EntityMinecart extends Entity implements IInventory {
public EntityMinecart(World world, double d0, double d1, double d2, int i) {
this(world);
- this.a(d0, d1 + (double) this.height, d2);
+ this.setPosition(d0, d1 + (double) this.height, d2);
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
this.lastX = d0;
this.lastY = d1;
this.lastZ = d2;
- this.d = i;
+ this.type = i;
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
@@ -98,7 +98,7 @@ public class EntityMinecart extends Entity implements IInventory {
return (double) this.width * 0.0D - 0.30000001192092896D;
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@@ -118,27 +118,27 @@ public class EntityMinecart extends Entity implements IInventory {
this.c = -this.c;
this.b = 10;
this.W();
- this.a += i * 10;
- if (this.a > 40) {
+ this.damage += i * 10;
+ if (this.damage > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
- this.a = 40; // Maximize damage so this doesn't get triggered again right away
+ this.damage = 40; // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
this.a(Item.MINECART.id, 1, 0.0F);
- if (this.d == 1) {
+ if (this.type == 1) {
this.a(Block.CHEST.id, 1, 0.0F);
- } else if (this.d == 2) {
+ } else if (this.type == 2) {
this.a(Block.FURNACE.id, 1, 0.0F);
}
- this.D();
+ this.die();
}
return true;
@@ -151,9 +151,9 @@ public class EntityMinecart extends Entity implements IInventory {
return !this.dead;
}
- public void D() {
- for (int i = 0; i < this.q_(); ++i) {
- ItemStack itemstack = this.c_(i);
+ public void die() {
+ for (int i = 0; i < this.getSize(); ++i) {
+ ItemStack itemstack = this.getItem(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.8F + 0.1F;
@@ -168,18 +168,18 @@ public class EntityMinecart extends Entity implements IInventory {
}
itemstack.count -= j;
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.h()));
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
- this.world.a((Entity) entityitem);
+ this.world.addEntity(entityitem);
}
}
}
- super.D();
+ super.die();
}
public void f_() {
@@ -195,8 +195,8 @@ public class EntityMinecart extends Entity implements IInventory {
--this.b;
}
- if (this.a > 0) {
- --this.a;
+ if (this.damage > 0) {
+ --this.damage;
}
double d0;
@@ -218,10 +218,10 @@ public class EntityMinecart extends Entity implements IInventory {
this.yaw = (float) ((double) this.yaw + d0 / (double) this.k);
this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k);
--this.k;
- this.a(d1, d2, d3);
+ this.setPosition(d1, d2, d3);
this.c(this.yaw, this.pitch);
} else {
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
this.c(this.yaw, this.pitch);
}
} else {
@@ -229,9 +229,9 @@ public class EntityMinecart extends Entity implements IInventory {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- int i = MathHelper.b(this.locX);
- int j = MathHelper.b(this.locY);
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locY);
+ int k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j - 1, k) == Block.RAILS.id) {
--j;
@@ -267,8 +267,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ -= d0;
}
- // CraftBukkit -- be explicit.
- int[][] aint = EntityMinecart.j[l];
+ int[][] aint = matrix[l];
double d5 = (double) (aint[1][0] - aint[0][0]);
double d6 = (double) (aint[1][2] - aint[0][2]);
double d7 = Math.sqrt(d5 * d5 + d6 * d6);
@@ -310,7 +309,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.locX = d11 + d5 * d10;
this.locZ = d12 + d6 * d10;
- this.a(this.locX, this.locY + (double) this.height, this.locZ);
+ this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
d15 = this.motX;
d17 = this.motZ;
if (this.passenger != null) {
@@ -334,11 +333,11 @@ public class EntityMinecart extends Entity implements IInventory {
d17 = d4;
}
- this.c(d15, 0.0D, d17);
- if (aint[0][1] != 0 && MathHelper.b(this.locX) - i == aint[0][0] && MathHelper.b(this.locZ) - k == aint[0][2]) {
- this.a(this.locX, this.locY + (double) aint[0][1], this.locZ);
- } else if (aint[1][1] != 0 && MathHelper.b(this.locX) - i == aint[1][0] && MathHelper.b(this.locZ) - k == aint[1][2]) {
- this.a(this.locX, this.locY + (double) aint[1][1], this.locZ);
+ this.move(d15, 0.0D, d17);
+ if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
+ this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
+ } else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
+ this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
}
// CraftBukkit
@@ -347,7 +346,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motY *= 0.0D;
this.motZ *= 0.996999979019165D;
} else {
- if (this.d == 2) {
+ if (this.type == 2) {
d16 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
if (d16 > 0.01D) {
flag = true;
@@ -383,11 +382,11 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ = this.motZ / d9 * (d9 + d19);
}
- this.a(this.locX, vec3d1.b, this.locZ);
+ this.setPosition(this.locX, vec3d1.b, this.locZ);
}
- int i1 = MathHelper.b(this.locX);
- int j1 = MathHelper.b(this.locZ);
+ int i1 = MathHelper.floor(this.locX);
+ int j1 = MathHelper.floor(this.locZ);
if (i1 != i || j1 != k) {
d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -395,7 +394,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ = d9 * (double) (j1 - k);
}
- if (this.d == 2) {
+ if (this.type == 2) {
double d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
@@ -435,7 +434,7 @@ public class EntityMinecart extends Entity implements IInventory {
// CraftBukkit start
}
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
if (!this.onGround) {
// CraftBukkit start
this.motX *= flyingX;
@@ -495,7 +494,7 @@ public class EntityMinecart extends Entity implements IInventory {
Entity entity = (Entity) list.get(k1);
if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
- entity.h(this);
+ entity.collide(this);
}
}
}
@@ -516,9 +515,9 @@ public class EntityMinecart extends Entity implements IInventory {
}
public Vec3D g(double d0, double d1, double d2) {
- int i = MathHelper.b(d0);
- int j = MathHelper.b(d1);
- int k = MathHelper.b(d2);
+ int i = MathHelper.floor(d0);
+ int j = MathHelper.floor(d1);
+ int k = MathHelper.floor(d2);
if (this.world.getTypeId(i, j - 1, k) == Block.RAILS.id) {
--j;
@@ -532,7 +531,7 @@ public class EntityMinecart extends Entity implements IInventory {
d1 = (double) (j + 1);
}
- int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit
+ int[][] aint = matrix[l];
double d3 = 0.0D;
double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
@@ -569,27 +568,27 @@ public class EntityMinecart extends Entity implements IInventory {
d1 += 0.5D;
}
- return Vec3D.b(d0, d1, d2);
+ return Vec3D.create(d0, d1, d2);
} else {
return null;
}
}
protected void a(NBTTagCompound nbttagcompound) {
- nbttagcompound.a("Type", this.d);
- if (this.d == 2) {
+ nbttagcompound.a("Type", this.type);
+ if (this.type == 2) {
nbttagcompound.a("PushX", this.f);
nbttagcompound.a("PushZ", this.g);
nbttagcompound.a("Fuel", (short) this.e);
- } else if (this.d == 1) {
+ } else if (this.type == 1) {
NBTTagList nbttaglist = new NBTTagList();
- for (int i = 0; i < this.h.length; ++i) {
- if (this.h[i] != null) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i);
- this.h[i].a(nbttagcompound1);
+ this.items[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1);
}
}
@@ -599,28 +598,28 @@ public class EntityMinecart extends Entity implements IInventory {
}
protected void b(NBTTagCompound nbttagcompound) {
- this.d = nbttagcompound.e("Type");
- if (this.d == 2) {
+ this.type = nbttagcompound.e("Type");
+ if (this.type == 2) {
this.f = nbttagcompound.h("PushX");
this.g = nbttagcompound.h("PushZ");
this.e = nbttagcompound.d("Fuel");
- } else if (this.d == 1) {
+ } else if (this.type == 1) {
NBTTagList nbttaglist = nbttagcompound.l("Items");
- this.h = new ItemStack[this.q_()];
+ this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.c("Slot") & 255;
- if (j >= 0 && j < this.h.length) {
- this.h[j] = new ItemStack(nbttagcompound1);
+ if (j >= 0 && j < this.items.length) {
+ this.items[j] = new ItemStack(nbttagcompound1);
}
}
}
}
- public void h(Entity entity) {
+ public void collide(Entity entity) {
if (!this.world.isStatic) {
if (entity != this.passenger) {
// CraftBukkit start
@@ -635,14 +634,14 @@ public class EntityMinecart extends Entity implements IInventory {
return;
}
- if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && this.d == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
+ if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && this.type == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
if (!collsionEvent.isPickupCancelled()) {
VehicleEnterEvent enterEvent = new VehicleEnterEvent(vehicle, hitEntity);
server.getPluginManager().callEvent(enterEvent);
if (!enterEvent.isCancelled()) {
- entity.b((Entity) this);
+ entity.mount(this);
}
}
}
@@ -675,13 +674,13 @@ public class EntityMinecart extends Entity implements IInventory {
double d4 = entity.motX + this.motX;
double d5 = entity.motZ + this.motZ;
- if (((EntityMinecart) entity).d == 2 && this.d != 2) {
+ if (((EntityMinecart) entity).type == 2 && this.type != 2) {
this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D;
this.f(entity.motX - d0, 0.0D, entity.motZ - d1);
entity.motX *= 0.699999988079071D;
entity.motZ *= 0.699999988079071D;
- } else if (((EntityMinecart) entity).d != 2 && this.d == 2) {
+ } else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D;
entity.f(this.motX + d0, 0.0D, this.motZ + d1);
@@ -706,26 +705,26 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
- public int q_() {
+ public int getSize() {
return 27;
}
- public ItemStack c_(int i) {
- return this.h[i];
+ public ItemStack getItem(int i) {
+ return this.items[i];
}
public ItemStack a(int i, int j) {
- if (this.h[i] != null) {
+ if (this.items[i] != null) {
ItemStack itemstack;
- if (this.h[i].count <= j) {
- itemstack = this.h[i];
- this.h[i] = null;
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
return itemstack;
} else {
- itemstack = this.h[i].a(j);
- if (this.h[i].count == 0) {
- this.h[i] = null;
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
}
return itemstack;
@@ -735,25 +734,25 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- this.h[i] = itemstack;
- if (itemstack != null && itemstack.count > this.r_()) {
- itemstack.count = this.r_();
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
}
}
- public String c() {
+ public String getName() {
return "Minecart";
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
- public void i() {}
+ public void update() {}
public boolean a(EntityHuman entityhuman) {
- if (this.d == 0) {
+ if (this.type == 0) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
}
@@ -772,18 +771,18 @@ public class EntityMinecart extends Entity implements IInventory {
}
// CraftBukkit end
- entityhuman.b((Entity) this);
+ entityhuman.mount(this);
}
- } else if (this.d == 1) {
+ } else if (this.type == 1) {
if (!this.world.isStatic) {
entityhuman.a((IInventory) this);
}
- } else if (this.d == 2) {
- ItemStack itemstack = entityhuman.inventory.b();
+ } else if (this.type == 2) {
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.COAL.id) {
if (--itemstack.count == 0) {
- entityhuman.inventory.a(entityhuman.inventory.c, (ItemStack) null);
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
this.e += 1200;
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 91b95075..b464df95 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -13,7 +13,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
public class EntityMonster extends EntityCreature implements IMonster {
- protected int c = 2;
+ protected int damage = 2;
public EntityMonster(World world) {
super(world);
@@ -32,19 +32,19 @@ public class EntityMonster extends EntityCreature implements IMonster {
public void f_() {
super.f_();
- if (this.world.j == 0) {
- this.D();
+ if (this.world.spawnMonsters == 0) {
+ this.die();
}
}
- protected Entity m() {
+ protected Entity findTarget() {
EntityHuman entityhuman = this.world.a(this, 16.0D);
return entityhuman != null && this.e(entityhuman) ? entityhuman : null;
}
- public boolean a(Entity entity, int i) {
- if (super.a(entity, i)) {
+ public boolean damageEntity(Entity entity, int i) {
+ if (super.damageEntity(entity, i)) {
if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) {
// CraftBukkit start
@@ -59,9 +59,9 @@ public class EntityMonster extends EntityCreature implements IMonster {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
- this.d = null;
+ this.target = null;
} else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
+ this.target = ((CraftEntity) event.getTarget()).getHandle();
}
}
// CraftBukkit end
@@ -88,17 +88,17 @@ public class EntityMonster extends EntityCreature implements IMonster {
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
- EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.c);
+ EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.damage);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled() && event.getDamage() != 0) {
- entity.a(this, event.getDamage());
+ if (!event.isCancelled()) {
+ entity.damageEntity(this, event.getDamage());
}
return;
}
// CraftBukkit end
- entity.a(this, this.c);
+ entity.damageEntity(this, this.damage);
}
}
@@ -115,14 +115,14 @@ public class EntityMonster extends EntityCreature implements IMonster {
}
public boolean b() {
- int i = MathHelper.b(this.locX);
- int j = MathHelper.b(this.boundingBox.b);
- int k = MathHelper.b(this.locZ);
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.boundingBox.b);
+ int k = MathHelper.floor(this.locZ);
if (this.world.a(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
return false;
} else {
- int l = this.world.j(i, j, k);
+ int l = this.world.getLightLevel(i, j, k);
return l <= this.random.nextInt(8) && super.b();
}
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 382bcdfb..3f8e1823 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -11,50 +11,50 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
public class EntityPigZombie extends EntityZombie {
- private int a = 0;
- private int b = 0;
+ private int angerLevel = 0;
+ private int soundDelay = 0;
private static final ItemStack f = new ItemStack(Item.GOLD_SWORD, 1);
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
this.az = 0.5F;
- this.c = 5;
+ this.damage = 5;
this.by = true;
}
public void f_() {
- this.az = this.d != null ? 0.95F : 0.5F;
- if (this.b > 0 && --this.b == 0) {
- this.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.az = this.target != null ? 0.95F : 0.5F;
+ if (this.soundDelay > 0 && --this.soundDelay == 0) {
+ this.world.makeSound(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.f_();
}
public boolean b() {
- return this.world.j > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
+ return this.world.spawnMonsters > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- nbttagcompound.a("Anger", (short) this.a);
+ nbttagcompound.a("Anger", (short) this.angerLevel);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- this.a = nbttagcompound.d("Anger");
+ this.angerLevel = nbttagcompound.d("Anger");
}
- protected Entity m() {
- return this.a == 0 ? null : super.m();
+ protected Entity findTarget() {
+ return this.angerLevel == 0 ? null : super.findTarget();
}
public void r() {
super.r();
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (entity instanceof EntityHuman) {
List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D));
@@ -71,7 +71,7 @@ public class EntityPigZombie extends EntityZombie {
this.d(entity);
}
- return super.a(entity, i);
+ return super.damageEntity(entity, i);
}
private void d(Entity entity) {
@@ -85,16 +85,20 @@ public class EntityPigZombie extends EntityZombie {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- if (event.getTarget() == null) {
- this.d = null;
- } else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
- this.a = 400 + this.random.nextInt(400);
- this.b = this.random.nextInt(40);
- }
+ if (event.isCancelled()) {
+ return;
+ }
+
+ if (event.getTarget() == null) {
+ this.target = null;
+ return;
}
+ entity = ((CraftEntity) event.getTarget()).getHandle();
// CraftBukkit end
+
+ this.target = entity;
+ this.angerLevel = 400 + this.random.nextInt(400);
+ this.soundDelay = this.random.nextInt(40);
}
protected String e() {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index bc403cfe..3adb9b44 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -18,9 +18,9 @@ import org.bukkit.event.entity.EntityDeathEvent;
public class EntityPlayer extends EntityHuman implements ICrafting {
- public NetServerHandler a;
+ public NetServerHandler netServerHandler;
public MinecraftServer b;
- public ItemInWorldManager c;
+ public ItemInWorldManager itemInWorldManager;
public double d;
public double e;
public List f = new LinkedList();
@@ -33,23 +33,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world);
- ChunkCoordinates chunkcoordinates = world.m();
- int i = chunkcoordinates.a;
- int j = chunkcoordinates.c;
- int k = chunkcoordinates.b;
+ ChunkCoordinates chunkcoordinates = world.getSpawn();
+ int i = chunkcoordinates.x;
+ int j = chunkcoordinates.z;
+ int k = chunkcoordinates.y;
- if (!world.m.e) {
+ if (!world.worldProvider.e) {
i += this.random.nextInt(20) - 10;
k = world.e(i, j);
j += this.random.nextInt(20) - 10;
}
- this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
+ this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver;
this.bm = 0.0F;
- iteminworldmanager.a = this;
+ iteminworldmanager.player = this;
this.name = s;
- this.c = iteminworldmanager;
+ this.itemInWorldManager = iteminworldmanager;
this.height = 0.0F;
// CraftBukkit start
@@ -60,11 +60,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public Location compassTarget;
// CraftBukkit end
- public void m() {
+ public void syncInventory() {
this.activeContainer.a((ICrafting) this);
}
- public ItemStack[] k_() {
+ public ItemStack[] getEquipment() {
return this.bG;
}
@@ -77,7 +77,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void f_() {
- this.c.a();
+ this.itemInWorldManager.a();
--this.bF;
this.activeContainer.a();
@@ -85,31 +85,31 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
ItemStack itemstack = this.b_(i);
if (itemstack != this.bG[i]) {
- this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack));
+ this.b.tracker.a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.bG[i] = itemstack;
}
}
}
public ItemStack b_(int i) {
- return i == 0 ? this.inventory.b() : this.inventory.b[i - 1];
+ return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
public void a(Entity entity) {
// CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
- for (int i = 0; i < inventory.a.length; ++i) {
- if (inventory.a[i] != null) {
- loot.add(new CraftItemStack(inventory.a[i]));
- inventory.a[i] = null;
+ for (int i = 0; i < inventory.items.length; ++i) {
+ if (inventory.items[i] != null) {
+ loot.add(new CraftItemStack(inventory.items[i]));
+ inventory.items[i] = null;
}
}
- for (int i = 0; i < inventory.b.length; ++i) {
- if (inventory.b[i] != null) {
- loot.add(new CraftItemStack(inventory.b[i]));
- inventory.b[i] = null;
+ for (int i = 0; i < inventory.armor.length; ++i) {
+ if (inventory.armor[i] != null) {
+ loot.add(new CraftItemStack(inventory.armor[i]));
+ inventory.armor[i] = null;
}
}
@@ -126,11 +126,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (this.bF > 0) {
return false;
} else {
- if (!this.b.n) {
+ if (!this.b.pvpMode) {
if (entity instanceof EntityHuman) {
return false;
}
@@ -138,13 +138,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (entity instanceof EntityArrow) {
EntityArrow entityarrow = (EntityArrow) entity;
- if (entityarrow.b instanceof EntityHuman) {
+ if (entityarrow.shooter instanceof EntityHuman) {
return false;
}
}
}
- return super.a(entity, i);
+ return super.damageEntity(entity, i);
}
}
@@ -160,7 +160,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (chunkcoordintpair != null) {
boolean flag1 = false;
- if (this.a.b() < 2) {
+ if (this.netServerHandler.b() < 2) {
flag1 = true;
}
@@ -168,8 +168,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.f.remove(chunkcoordintpair);
// CraftBukkit start
- this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.world)));
- List list = ((WorldServer) world).d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16);
+ this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, 128, 16, this.world));
+ List list = ((WorldServer) world).getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 128, chunkcoordintpair.z * 16 + 16);
// CraftBukkit end
for (int i = 0; i < list.size(); ++i) {
@@ -180,7 +180,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
if (this.health != this.bE) {
- this.a.b((Packet) (new Packet8UpdateHealth(this.health)));
+ this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health));
this.bE = this.health;
}
}
@@ -190,7 +190,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
Packet packet = tileentity.e();
if (packet != null) {
- this.a.b(packet);
+ this.netServerHandler.sendPacket(packet);
}
}
}
@@ -199,18 +199,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.r();
}
- public void b(Entity entity, int i) {
+ public void receive(Entity entity, int i) {
if (!entity.dead) {
if (entity instanceof EntityItem) {
- this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
+ this.b.tracker.a(entity, new Packet22Collect(entity.id, this.id));
}
if (entity instanceof EntityArrow) {
- this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
+ this.b.tracker.a(entity, new Packet22Collect(entity.id, this.id));
}
}
- super.b(entity, i);
+ super.receive(entity, i);
this.activeContainer.a();
}
@@ -218,7 +218,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (!this.p) {
this.q = -1;
this.p = true;
- this.b.k.a(this, new Packet18ArmAnimation(this, 1));
+ this.b.tracker.a(this, new Packet18ArmAnimation(this, 1));
}
}
@@ -228,34 +228,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
EnumBedError enumbederror = super.a(i, j, k);
if (enumbederror == EnumBedError.OK) {
- this.b.k.a(this, new Packet17(this, 0, i, j, k));
+ this.b.tracker.a(this, new Packet17(this, 0, i, j, k));
}
return enumbederror;
}
public void a(boolean flag, boolean flag1, boolean flag2) {
- if (this.F()) {
- this.b.k.b(this, new Packet18ArmAnimation(this, 3));
+ if (this.isSleeping()) {
+ this.b.tracker.b(this, new Packet18ArmAnimation(this, 3));
}
super.a(flag, flag1, flag2);
- this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+ this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
- public void b(Entity entity) {
+ public void mount(Entity entity) {
// CraftBukkit start
setPassengerOf(entity);
}
public void setPassengerOf(Entity entity) {
- // b(null) doesn't really fly for overloaded methods,
+ // mount(null) doesn't really fly for overloaded methods,
// so this method is needed
super.setPassengerOf(entity);
// CraftBukkit end
- this.a.b((Packet) (new Packet39AttachEntity(this, this.vehicle)));
- this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+
+ this.netServerHandler.sendPacket(new Packet39AttachEntity(this, this.vehicle));
+ this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
protected void a(double d0, boolean flag) {}
@@ -270,7 +271,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void b(int i, int j, int k) {
this.aa();
- this.a.b((Packet) (new Packet100OpenWindow(this.bH, 1, "Crafting", 9)));
+ this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 1, "Crafting", 9));
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this);
@@ -278,7 +279,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(IInventory iinventory) {
this.aa();
- this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.q_())));
+ this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = new ContainerChest(this.inventory, iinventory);
this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this);
@@ -286,7 +287,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(TileEntityFurnace tileentityfurnace) {
this.aa();
- this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.q_())));
+ this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this);
@@ -294,7 +295,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(TileEntityDispenser tileentitydispenser) {
this.aa();
- this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.q_())));
+ this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bH, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this);
@@ -303,30 +304,30 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, int i, ItemStack itemstack) {
if (!(container.a(i) instanceof SlotResult)) {
if (!this.h) {
- this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack)));
+ this.netServerHandler.sendPacket(new Packet103SetSlot(container.f, i, itemstack));
}
}
}
public void a(Container container, List list) {
- this.a.b((Packet) (new Packet104WindowItems(container.f, list)));
- this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.j())));
+ this.netServerHandler.sendPacket(new Packet104WindowItems(container.f, list));
+ this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j()));
}
public void a(Container container, int i, int j) {
- this.a.b((Packet) (new Packet105CraftProgressBar(container.f, i, j)));
+ this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.f, i, j));
}
public void a(ItemStack itemstack) {}
public void u() {
- this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f)));
+ this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.f));
this.w();
}
public void v() {
if (!this.h) {
- this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.j())));
+ this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j()));
}
}
@@ -339,7 +340,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.au = f;
this.av = f1;
this.ax = flag;
- this.e(flag1);
+ this.setSneak(flag1);
this.pitch = f2;
this.yaw = f3;
}
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index d61f3187..fbb88a5d 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -36,7 +36,7 @@ public class EntitySkeleton extends EntityMonster {
if (this.world.d()) {
float f = this.c(1.0F);
- if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity entity = this.getBukkitEntity();
@@ -66,8 +66,8 @@ public class EntitySkeleton extends EntityMonster {
double d2 = entity.locY - 0.20000000298023224D - entityarrow.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
- this.world.a(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
- this.world.a((Entity) entityarrow);
+ this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
+ this.world.addEntity(entityarrow);
entityarrow.a(d0, d2 + (double) f1, d1, 0.6F, 12.0F);
this.attackTicks = 30;
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java
index a2b8ee3c..2bd1eee4 100644
--- a/src/main/java/net/minecraft/server/EntitySnowball.java
+++ b/src/main/java/net/minecraft/server/EntitySnowball.java
@@ -17,7 +17,7 @@ public class EntitySnowball extends Entity {
private int e = 0;
private boolean f = false;
public int a = 0;
- private EntityLiving g;
+ private EntityLiving shooter;
private int h;
private int i = 0;
@@ -30,19 +30,19 @@ public class EntitySnowball extends Entity {
public EntitySnowball(World world, EntityLiving entityliving) {
super(world);
- this.g = entityliving;
+ this.shooter = entityliving;
this.b(0.25F, 0.25F);
- this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
+ this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
- this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
- this.a(this.locX, this.locY, this.locZ);
+ 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.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
- this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
+ 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);
}
@@ -50,7 +50,7 @@ public class EntitySnowball extends Entity {
super(world);
this.h = 0;
this.b(0.25F, 0.25F);
- this.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
@@ -91,7 +91,7 @@ public class EntitySnowball extends Entity {
if (i == this.e) {
++this.h;
if (this.h == 1200) {
- this.D();
+ this.die();
}
return;
@@ -107,14 +107,14 @@ public class EntitySnowball extends Entity {
++this.i;
}
- Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ 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.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
+ vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
if (!this.world.isStatic) {
@@ -125,7 +125,7 @@ public class EntitySnowball extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
+ if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -148,12 +148,12 @@ public class EntitySnowball extends Entity {
if (movingobjectposition != null) {
// CraftBukkit start
- if (movingobjectposition.g != null) {
+ if (movingobjectposition.entity != null) {
boolean stick;
- if (movingobjectposition.g instanceof EntityLiving) {
+ if (movingobjectposition.entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
- org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
+ org.bukkit.entity.Entity shooter = (this.shooter == null) ? null : this.shooter.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
@@ -164,13 +164,13 @@ public class EntitySnowball extends Entity {
if (!event.isCancelled()) {
// this function returns if the snowball should stick or not, i.e. !bounce
- stick = movingobjectposition.g.a(this.g, event.getDamage());
+ stick = movingobjectposition.entity.damageEntity(this.shooter, event.getDamage());
} else {
// event was cancelled, get if the snowball should bounce or not
stick = !event.getBounce();
}
} else {
- stick = movingobjectposition.g.a(this.g, 0);
+ stick = movingobjectposition.entity.damageEntity(this.shooter, 0);
}
if (stick) {
;
@@ -182,7 +182,7 @@ public class EntitySnowball extends Entity {
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
}
- this.D();
+ this.die();
}
this.locX += this.motX;
@@ -227,7 +227,7 @@ public class EntitySnowball extends Entity {
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.motY -= (double) f3;
- this.a(this.locX, this.locY, this.locZ);
+ this.setPosition(this.locX, this.locY, this.locZ);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -249,10 +249,10 @@ public class EntitySnowball extends Entity {
}
public void b(EntityHuman entityhuman) {
- if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
- this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
- entityhuman.b(this, 1);
- this.D();
+ if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
+ this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ entityhuman.receive(this, 1);
+ this.die();
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 8fba4bdf..5c2ed922 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
-// CraftBukkit end
+// CraftBukkit stop
public class EntitySpider extends EntityMonster {
@@ -24,7 +24,7 @@ public class EntitySpider extends EntityMonster {
return false;
}
- protected Entity m() {
+ protected Entity findTarget() {
float f = this.c(1.0F);
if (f < 0.5F) {
@@ -59,9 +59,9 @@ public class EntitySpider extends EntityMonster {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
- this.d = null;
+ this.target = null;
} else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
+ this.target = ((CraftEntity) event.getTarget()).getHandle();
}
return;
}
@@ -96,6 +96,6 @@ public class EntitySpider extends EntityMonster {
}
public boolean n() {
- return this.aW;
+ return this.positionChanged;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 7e85e6b5..456b9af6 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -20,12 +20,12 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world, double d0, double d1, double d2) {
this(world);
- this.a(d0, d1, d2);
+ this.setPosition(d0, d1, d2);
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
- this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F);
+ this.motX = (double) (-MathHelper.sin(f * 3.1415927F / 180.0F) * 0.02F);
this.motY = 0.20000000298023224D;
- this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F);
+ this.motZ = (double) (-MathHelper.cos(f * 3.1415927F / 180.0F) * 0.02F);
this.a = 80;
this.lastX = d0;
this.lastY = d1;
@@ -47,7 +47,7 @@ public class EntityTNTPrimed extends Entity {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- this.c(this.motX, this.motY, this.motZ);
+ this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
@@ -59,15 +59,15 @@ public class EntityTNTPrimed extends Entity {
if (this.a-- <= 0) {
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
- this.h();
- this.D();
+ this.explode();
+ this.die();
// CraftBukkit end
} else {
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
}
}
- private void h() {
+ private void explode() {
float f = 4.0F;
// CraftBukkit start
@@ -78,7 +78,7 @@ public class EntityTNTPrimed extends Entity {
if (!event.isCancelled()) {
// give 'this' instead of (Entity) null so we know what causes the damage
- this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 9f2c621d..05b4b2a3 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -14,7 +14,7 @@ public class EntityTracker {
public EntityTracker(MinecraftServer minecraftserver) {
this.c = minecraftserver;
- this.d = minecraftserver.f.a();
+ this.d = minecraftserver.serverConfigurationManager.a();
}
// CraftBukkit -- synchronized
@@ -27,7 +27,7 @@ public class EntityTracker {
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
- if (entitytrackerentry.a != entityplayer) {
+ if (entitytrackerentry.tracker != entityplayer) {
entitytrackerentry.b(entityplayer);
}
}
@@ -76,12 +76,12 @@ public class EntityTracker {
this.a.add(entitytrackerentry);
this.b.a(entity.id, entitytrackerentry);
// CraftBukkit
- entitytrackerentry.b(entity.world.d); // CraftBukkit
+ entitytrackerentry.scanPlayers(entity.world.players);
}
}
// CraftBukkit -- synchronized
- public synchronized void b(Entity entity) {
+ public synchronized void untrackEntity(Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
Iterator iterator = this.a.iterator();
@@ -110,9 +110,9 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
// CraftBukkit
- entitytrackerentry.a(entitytrackerentry.a.world.d);
- if (entitytrackerentry.m && entitytrackerentry.a instanceof EntityPlayer) {
- arraylist.add((EntityPlayer) entitytrackerentry.a);
+ entitytrackerentry.track(entitytrackerentry.tracker.world.players);
+ if (entitytrackerentry.m && entitytrackerentry.tracker instanceof EntityPlayer) {
+ arraylist.add((EntityPlayer) entitytrackerentry.tracker);
}
}
@@ -123,7 +123,7 @@ public class EntityTracker {
while (iterator1.hasNext()) {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
- if (entitytrackerentry1.a != entityplayer) {
+ if (entitytrackerentry1.tracker != entityplayer) {
entitytrackerentry1.b(entityplayer);
}
}
@@ -149,7 +149,7 @@ public class EntityTracker {
}
// CraftBukkit -- synchronized
- public synchronized void a(EntityPlayer entityplayer) {
+ public synchronized void trackPlayer(EntityPlayer entityplayer) {
Iterator iterator = this.a.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 2448897b..d31dde9e 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -7,7 +7,7 @@ import java.util.Set;
public class EntityTrackerEntry {
- public Entity a;
+ public Entity tracker;
public int b;
public int c;
public int d;
@@ -23,47 +23,47 @@ public class EntityTrackerEntry {
private double p;
private double q;
private boolean r = false;
- private boolean s;
+ private boolean isMoving;
public boolean m = false;
- public Set n = new HashSet();
+ public Set trackedPlayers = new HashSet();
public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) {
- this.a = entity;
+ this.tracker = entity;
this.b = i;
this.c = j;
- this.s = flag;
- this.d = MathHelper.b(entity.locX * 32.0D);
- this.e = MathHelper.b(entity.locY * 32.0D);
- this.f = MathHelper.b(entity.locZ * 32.0D);
+ this.isMoving = flag;
+ this.d = MathHelper.floor(entity.locX * 32.0D);
+ this.e = MathHelper.floor(entity.locY * 32.0D);
+ this.f = MathHelper.floor(entity.locZ * 32.0D);
this.g = MathHelper.d(entity.yaw * 256.0F / 360.0F);
this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F);
}
public boolean equals(Object object) {
- return object instanceof EntityTrackerEntry ? ((EntityTrackerEntry) object).a.id == this.a.id : false;
+ return object instanceof EntityTrackerEntry ? ((EntityTrackerEntry) object).tracker.id == this.tracker.id : false;
}
public int hashCode() {
- return this.a.id;
+ return this.tracker.id;
}
- public void a(List list) {
+ public void track(List list) {
this.m = false;
- if (!this.r || this.a.d(this.o, this.p, this.q) > 16.0D) {
- this.o = this.a.locX;
- this.p = this.a.locY;
- this.q = this.a.locZ;
+ if (!this.r || this.tracker.d(this.o, this.p, this.q) > 16.0D) {
+ this.o = this.tracker.locX;
+ this.p = this.tracker.locY;
+ this.q = this.tracker.locZ;
this.r = true;
this.m = true;
- this.b(list);
+ this.scanPlayers(list);
}
if (++this.l % this.c == 0) {
- int i = MathHelper.b(this.a.locX * 32.0D);
- int j = MathHelper.b(this.a.locY * 32.0D);
- int k = MathHelper.b(this.a.locZ * 32.0D);
- int l = MathHelper.d(this.a.yaw * 256.0F / 360.0F);
- int i1 = MathHelper.d(this.a.pitch * 256.0F / 360.0F);
+ int i = MathHelper.floor(this.tracker.locX * 32.0D);
+ int j = MathHelper.floor(this.tracker.locY * 32.0D);
+ int k = MathHelper.floor(this.tracker.locZ * 32.0D);
+ int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
+ int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
int j1 = i - this.d;
int k1 = j - this.e;
int l1 = k - this.f;
@@ -73,28 +73,28 @@ public class EntityTrackerEntry {
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) {
if (flag && flag1) {
- object = new Packet33RelEntityMoveLook(this.a.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
+ object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
} else if (flag) {
- object = new Packet31RelEntityMove(this.a.id, (byte) j1, (byte) k1, (byte) l1);
+ object = new Packet31RelEntityMove(this.tracker.id, (byte) j1, (byte) k1, (byte) l1);
} else if (flag1) {
- object = new Packet32EntityLook(this.a.id, (byte) l, (byte) i1);
+ object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
}
} else {
- object = new Packet34EntityTeleport(this.a.id, i, j, k, (byte) l, (byte) i1);
+ object = new Packet34EntityTeleport(this.tracker.id, i, j, k, (byte) l, (byte) i1);
}
- if (this.s) {
- double d0 = this.a.motX - this.i;
- double d1 = this.a.motY - this.j;
- double d2 = this.a.motZ - this.k;
+ if (this.isMoving) {
+ double d0 = this.tracker.motX - this.i;
+ double d1 = this.tracker.motY - this.j;
+ double d2 = this.tracker.motZ - this.k;
double d3 = 0.02D;
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d4 > d3 * d3 || d4 > 0.0D && this.a.motX == 0.0D && this.a.motY == 0.0D && this.a.motZ == 0.0D) {
- this.i = this.a.motX;
- this.j = this.a.motY;
- this.k = this.a.motZ;
- this.a((Packet) (new Packet28EntityVelocity(this.a.id, this.i, this.j, this.k)));
+ if (d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
+ this.i = this.tracker.motX;
+ this.j = this.tracker.motY;
+ this.k = this.tracker.motZ;
+ this.a((Packet) (new Packet28EntityVelocity(this.tracker.id, this.i, this.j, this.k)));
}
}
@@ -102,10 +102,10 @@ public class EntityTrackerEntry {
this.a((Packet) object);
}
- DataWatcher datawatcher = this.a.T();
+ DataWatcher datawatcher = this.tracker.T();
if (datawatcher.a()) {
- this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher)));
+ this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher)));
}
if (flag) {
@@ -120,142 +120,142 @@ public class EntityTrackerEntry {
}
}
- if (this.a.aZ) {
- this.b((Packet) (new Packet28EntityVelocity(this.a)));
- this.a.aZ = false;
+ if (this.tracker.velocityChanged) {
+ this.b((Packet) (new Packet28EntityVelocity(this.tracker)));
+ this.tracker.velocityChanged = false;
}
}
public void a(Packet packet) {
- Iterator iterator = this.n.iterator();
+ Iterator iterator = this.trackedPlayers.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- entityplayer.a.b(packet);
+ entityplayer.netServerHandler.sendPacket(packet);
}
}
public void b(Packet packet) {
this.a(packet);
- if (this.a instanceof EntityPlayer) {
- ((EntityPlayer) this.a).a.b(packet);
+ if (this.tracker instanceof EntityPlayer) {
+ ((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet);
}
}
public void a() {
- this.a((Packet) (new Packet29DestroyEntity(this.a.id)));
+ this.a((Packet) (new Packet29DestroyEntity(this.tracker.id)));
}
public void a(EntityPlayer entityplayer) {
- if (this.n.contains(entityplayer)) {
- this.n.remove(entityplayer);
+ if (this.trackedPlayers.contains(entityplayer)) {
+ this.trackedPlayers.remove(entityplayer);
}
}
public void b(EntityPlayer entityplayer) {
- if (entityplayer != this.a) {
+ if (entityplayer != this.tracker) {
double d0 = entityplayer.locX - (double) (this.d / 32);
double d1 = entityplayer.locZ - (double) (this.f / 32);
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
// CraftBukkit
- if ((!this.n.contains(entityplayer)) && (this.a.world == entityplayer.world)) {
- this.n.add(entityplayer);
- entityplayer.a.b(this.b());
- if (this.s) {
- entityplayer.a.b((Packet) (new Packet28EntityVelocity(this.a.id, this.a.motX, this.a.motY, this.a.motZ)));
+ if ((!this.trackedPlayers.contains(entityplayer)) && (this.tracker.world == entityplayer.world)) {
+ this.trackedPlayers.add(entityplayer);
+ entityplayer.netServerHandler.sendPacket(this.b());
+ if (this.isMoving) {
+ entityplayer.netServerHandler.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
}
- ItemStack[] aitemstack = this.a.k_();
+ ItemStack[] aitemstack = this.tracker.getEquipment();
if (aitemstack != null) {
for (int i = 0; i < aitemstack.length; ++i) {
- entityplayer.a.b((Packet) (new Packet5EntityEquipment(this.a.id, i, aitemstack[i])));
+ entityplayer.netServerHandler.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, aitemstack[i]));
}
}
}
- } else if (this.n.contains(entityplayer)) {
- this.n.remove(entityplayer);
- entityplayer.a.b((Packet) (new Packet29DestroyEntity(this.a.id)));
+ } else if (this.trackedPlayers.contains(entityplayer)) {
+ this.trackedPlayers.remove(entityplayer);
+ entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
}
}
}
- public void b(List list) {
+ public void scanPlayers(List list) {
for (int i = 0; i < list.size(); ++i) {
this.b((EntityPlayer) list.get(i));
}
}
private Packet b() {
- if (this.a instanceof EntityItem) {
- EntityItem entityitem = (EntityItem) this.a;
+ if (this.tracker instanceof EntityItem) {
+ EntityItem entityitem = (EntityItem) this.tracker;
Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem);
entityitem.locX = (double) packet21pickupspawn.b / 32.0D;
entityitem.locY = (double) packet21pickupspawn.c / 32.0D;
entityitem.locZ = (double) packet21pickupspawn.d / 32.0D;
return packet21pickupspawn;
- } else if (this.a instanceof EntityPlayer) {
- return new Packet20NamedEntitySpawn((EntityHuman) this.a);
+ } else if (this.tracker instanceof EntityPlayer) {
+ return new Packet20NamedEntitySpawn((EntityHuman) this.tracker);
} else {
- if (this.a instanceof EntityMinecart) {
- EntityMinecart entityminecart = (EntityMinecart) this.a;
+ if (this.tracker instanceof EntityMinecart) {
+ EntityMinecart entityminecart = (EntityMinecart) this.tracker;
- if (entityminecart.d == 0) {
- return new Packet23VehicleSpawn(this.a, 10);
+ if (entityminecart.type == 0) {
+ return new Packet23VehicleSpawn(this.tracker, 10);
}
- if (entityminecart.d == 1) {
- return new Packet23VehicleSpawn(this.a, 11);
+ if (entityminecart.type == 1) {
+ return new Packet23VehicleSpawn(this.tracker, 11);
}
- if (entityminecart.d == 2) {
- return new Packet23VehicleSpawn(this.a, 12);
+ if (entityminecart.type == 2) {
+ return new Packet23VehicleSpawn(this.tracker, 12);
}
}
- if (this.a instanceof EntityBoat) {
- return new Packet23VehicleSpawn(this.a, 1);
- } else if (this.a instanceof IAnimal) {
- return new Packet24MobSpawn((EntityLiving) this.a);
- } else if (this.a instanceof EntityFish) {
- return new Packet23VehicleSpawn(this.a, 90);
- } else if (this.a instanceof EntityArrow) {
- return new Packet23VehicleSpawn(this.a, 60);
- } else if (this.a instanceof EntitySnowball) {
- return new Packet23VehicleSpawn(this.a, 61);
- } else if (this.a instanceof EntityEgg) {
- return new Packet23VehicleSpawn(this.a, 62);
- } else if (this.a instanceof EntityTNTPrimed) {
- return new Packet23VehicleSpawn(this.a, 50);
+ if (this.tracker instanceof EntityBoat) {
+ return new Packet23VehicleSpawn(this.tracker, 1);
+ } else if (this.tracker instanceof IAnimal) {
+ return new Packet24MobSpawn((EntityLiving) this.tracker);
+ } else if (this.tracker instanceof EntityFish) {
+ return new Packet23VehicleSpawn(this.tracker, 90);
+ } else if (this.tracker instanceof EntityArrow) {
+ return new Packet23VehicleSpawn(this.tracker, 60);
+ } else if (this.tracker instanceof EntitySnowball) {
+ return new Packet23VehicleSpawn(this.tracker, 61);
+ } else if (this.tracker instanceof EntityEgg) {
+ return new Packet23VehicleSpawn(this.tracker, 62);
+ } else if (this.tracker instanceof EntityTNTPrimed) {
+ return new Packet23VehicleSpawn(this.tracker, 50);
} else {
- if (this.a instanceof EntityFallingSand) {
- EntityFallingSand entityfallingsand = (EntityFallingSand) this.a;
+ if (this.tracker instanceof EntityFallingSand) {
+ EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker;
if (entityfallingsand.a == Block.SAND.id) {
- return new Packet23VehicleSpawn(this.a, 70);
+ return new Packet23VehicleSpawn(this.tracker, 70);
}
if (entityfallingsand.a == Block.GRAVEL.id) {
- return new Packet23VehicleSpawn(this.a, 71);
+ return new Packet23VehicleSpawn(this.tracker, 71);
}
}
- if (this.a instanceof EntityPainting) {
- return new Packet25EntityPainting((EntityPainting) this.a);
+ if (this.tracker instanceof EntityPainting) {
+ return new Packet25EntityPainting((EntityPainting) this.tracker);
} else {
- throw new IllegalArgumentException("Don\'t know how to add " + this.a.getClass() + "!");
+ throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
}
}
}
}
public void c(EntityPlayer entityplayer) {
- if (this.n.contains(entityplayer)) {
- this.n.remove(entityplayer);
- entityplayer.a.b((Packet) (new Packet29DestroyEntity(this.a.id)));
+ if (this.trackedPlayers.contains(entityplayer)) {
+ this.trackedPlayers.remove(entityplayer);
+ entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index b9a82af3..a6e5979d 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -11,14 +11,14 @@ public class EntityZombie extends EntityMonster {
super(world);
this.texture = "/mob/zombie.png";
this.az = 0.5F;
- this.c = 5;
+ this.damage = 5;
}
public void r() {
if (this.world.d()) {
float f = this.c(1.0F);
- if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index f4afea11..57c131f3 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -22,27 +22,27 @@ public class Explosion {
public boolean a = false;
private Random h = new Random();
- private World i;
- public double b;
- public double c;
- public double d;
- public Entity e;
- public float f;
+ private World world;
+ public double posX;
+ public double posY;
+ public double posZ;
+ public Entity source;
+ public float size;
public Set g = new HashSet();
public boolean wasCanceled = false; // CraftBukkit
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
- this.i = world;
- this.e = entity;
- this.f = f;
- this.b = d0;
- this.c = d1;
- this.d = d2;
+ this.world = world;
+ this.source = entity;
+ this.size = f;
+ this.posX = d0;
+ this.posY = d1;
+ this.posZ = d2;
}
public void a() {
- float f = this.f;
+ float f = this.size;
byte b0 = 16;
int i;
@@ -64,20 +64,20 @@ public class Explosion {
d3 /= d6;
d4 /= d6;
d5 /= d6;
- float f1 = this.f * (0.7F + this.i.k.nextFloat() * 0.6F);
+ float f1 = this.size * (0.7F + this.world.random.nextFloat() * 0.6F);
- d0 = this.b;
- d1 = this.c;
- d2 = this.d;
+ d0 = this.posX;
+ d1 = this.posY;
+ d2 = this.posZ;
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) {
- int l = MathHelper.b(d0);
- int i1 = MathHelper.b(d1);
- int j1 = MathHelper.b(d2);
- int k1 = this.i.getTypeId(l, i1, j1);
+ int l = MathHelper.floor(d0);
+ int i1 = MathHelper.floor(d1);
+ int j1 = MathHelper.floor(d2);
+ int k1 = this.world.getTypeId(l, i1, j1);
if (k1 > 0) {
- f1 -= (Block.byId[k1].a(this.e) + 0.3F) * f2;
+ f1 -= (Block.byId[k1].a(this.source) + 0.3F) * f2;
}
if (f1 > 0.0F) {
@@ -93,41 +93,41 @@ public class Explosion {
}
}
- this.f *= 2.0F;
- i = MathHelper.b(this.b - (double) this.f - 1.0D);
- j = MathHelper.b(this.b + (double) this.f + 1.0D);
- k = MathHelper.b(this.c - (double) this.f - 1.0D);
- int l1 = MathHelper.b(this.c + (double) this.f + 1.0D);
- int i2 = MathHelper.b(this.d - (double) this.f - 1.0D);
- int j2 = MathHelper.b(this.d + (double) this.f + 1.0D);
- List list = this.i.b(this.e, AxisAlignedBB.b((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
- Vec3D vec3d = Vec3D.b(this.b, this.c, this.d);
+ this.size *= 2.0F;
+ i = MathHelper.floor(this.posX - (double) this.size - 1.0D);
+ j = MathHelper.floor(this.posX + (double) this.size + 1.0D);
+ k = MathHelper.floor(this.posY - (double) this.size - 1.0D);
+ int l1 = MathHelper.floor(this.posY + (double) this.size + 1.0D);
+ int i2 = MathHelper.floor(this.posZ - (double) this.size - 1.0D);
+ int j2 = MathHelper.floor(this.posZ + (double) this.size + 1.0D);
+ List list = this.world.b(this.source, AxisAlignedBB.b((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
+ Vec3D vec3d = Vec3D.create(this.posX, this.posY, this.posZ);
for (int k2 = 0; k2 < list.size(); ++k2) {
Entity entity = (Entity) list.get(k2);
- double d7 = entity.e(this.b, this.c, this.d) / (double) this.f;
+ double d7 = entity.e(this.posX, this.posY, this.posZ) / (double) this.size;
if (d7 <= 1.0D) {
- d0 = entity.locX - this.b;
- d1 = entity.locY - this.c;
- d2 = entity.locZ - this.d;
+ d0 = entity.locX - this.posX;
+ d1 = entity.locY - this.posY;
+ d2 = entity.locZ - this.posZ;
double d8 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= d8;
d1 /= d8;
d2 /= d8;
- double d9 = (double) this.i.a(vec3d, entity.boundingBox);
+ double d9 = (double) this.world.a(vec3d, entity.boundingBox);
double d10 = (1.0D - d7) * d9;
// CraftBukkit start - explosion damage hook
- CraftServer server = ((WorldServer) this.i).getServer();
+ CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType;
- int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.f + 1.0D);
+ int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
if (damagee == null) {
// nothing was hurt
- } else if (e == null) { // Block explosion
+ } else if (this.source == null) { // Block explosion
// TODO: get the x/y/z of the tnt block?
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
@@ -136,20 +136,20 @@ public class Explosion {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- entity.a(this.e, event.getDamage());
+ entity.damageEntity(this.source, event.getDamage());
entity.motX += d0 * d10;
entity.motY += d1 * d10;
entity.motZ += d2 * d10;
}
} else {
- org.bukkit.entity.Entity damager = this.e.getBukkitEntity();
+ org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
damageType = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- entity.a(this.e, event.getDamage());
+ entity.damageEntity(this.source, event.getDamage());
entity.motX += d0 * d10;
entity.motY += d1 * d10;
@@ -160,42 +160,42 @@ public class Explosion {
}
}
- this.f = f;
+ this.size = f;
ArrayList arraylist = new ArrayList();
arraylist.addAll(this.g);
if (this.a) {
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l2);
- int i3 = chunkposition.a;
- int j3 = chunkposition.b;
- int k3 = chunkposition.c;
- int l3 = this.i.getTypeId(i3, j3, k3);
- int i4 = this.i.getTypeId(i3, j3 - 1, k3);
+ int i3 = chunkposition.x;
+ int j3 = chunkposition.y;
+ int k3 = chunkposition.z;
+ int l3 = this.world.getTypeId(i3, j3, k3);
+ int i4 = this.world.getTypeId(i3, j3 - 1, k3);
if (l3 == 0 && Block.o[i4] && this.h.nextInt(3) == 0) {
- this.i.e(i3, j3, k3, Block.FIRE.id);
+ this.world.setTypeId(i3, j3, k3, Block.FIRE.id);
}
}
}
}
public void b() {
- this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.k.nextFloat() - this.i.k.nextFloat()) * 0.2F) * 0.7F);
+ this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
ArrayList arraylist = new ArrayList();
arraylist.addAll(this.g);
// CraftBukkit start
- Server server = ((WorldServer) this.i).getServer();
- CraftWorld world = ((WorldServer) this.i).getWorld();
- org.bukkit.entity.Entity explode = (this.e == null) ? null : this.e.getBukkitEntity();
- Location location = new Location(world, this.b, this.c, this.d);
+ Server server = ((WorldServer) this.world).getServer();
+ CraftWorld world = ((WorldServer) this.world).getWorld();
+ org.bukkit.entity.Entity explode = (this.source == null) ? null : this.source.getBukkitEntity();
+ Location location = new Location(world, this.posX, this.posY, this.posZ);
List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
for (int j = arraylist.size() - 1; j >= 0; j--) {
ChunkPosition cpos = (ChunkPosition) arraylist.get(j);
- org.bukkit.block.Block block = world.getBlockAt(cpos.a, cpos.b, cpos.c);
+ org.bukkit.block.Block block = world.getBlockAt(cpos.x, cpos.y, cpos.z);
if (!block.getType().equals(org.bukkit.Material.AIR)) {
blockList.add(block);
}
@@ -212,38 +212,38 @@ public class Explosion {
for (int i = arraylist.size() - 1; i >= 0; --i) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(i);
- int j = chunkposition.a;
- int k = chunkposition.b;
- int l = chunkposition.c;
- int i1 = this.i.getTypeId(j, k, l);
+ int j = chunkposition.x;
+ int k = chunkposition.y;
+ int l = chunkposition.z;
+ int i1 = this.world.getTypeId(j, k, l);
for (int j1 = 0; j1 < 1; ++j1) {
- double d0 = (double) ((float) j + this.i.k.nextFloat());
- double d1 = (double) ((float) k + this.i.k.nextFloat());
- double d2 = (double) ((float) l + this.i.k.nextFloat());
- double d3 = d0 - this.b;
- double d4 = d1 - this.c;
- double d5 = d2 - this.d;
+ double d0 = (double) ((float) j + this.world.random.nextFloat());
+ double d1 = (double) ((float) k + this.world.random.nextFloat());
+ double d2 = (double) ((float) l + this.world.random.nextFloat());
+ double d3 = d0 - this.posX;
+ double d4 = d1 - this.posY;
+ double d5 = d2 - this.posZ;
double d6 = (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
d4 /= d6;
d5 /= d6;
- double d7 = 0.5D / (d6 / (double) this.f + 0.1D);
+ double d7 = 0.5D / (d6 / (double) this.size + 0.1D);
- d7 *= (double) (this.i.k.nextFloat() * this.i.k.nextFloat() + 0.3F);
+ d7 *= (double) (this.world.random.nextFloat() * this.world.random.nextFloat() + 0.3F);
d3 *= d7;
d4 *= d7;
d5 *= d7;
- this.i.a("explode", (d0 + this.b * 1.0D) / 2.0D, (d1 + this.c * 1.0D) / 2.0D, (d2 + this.d * 1.0D) / 2.0D, d3, d4, d5);
- this.i.a("smoke", d0, d1, d2, d3, d4, d5);
+ this.world.a("explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5);
+ this.world.a("smoke", d0, d1, d2, d3, d4, d5);
}
if (i1 > 0) {
// CraftBukkit
- Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield());
- this.i.e(j, k, l, 0);
- Block.byId[i1].c(this.i, j, k, l);
+ Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield());
+ this.world.setTypeId(j, k, l, 0);
+ Block.byId[i1].c(this.world, j, k, l);
}
}
}
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
index 1c9c9e86..4cf849fa 100644
--- a/src/main/java/net/minecraft/server/IInventory.java
+++ b/src/main/java/net/minecraft/server/IInventory.java
@@ -2,19 +2,19 @@ package net.minecraft.server;
public interface IInventory {
- int q_();
+ int getSize();
- ItemStack c_(int i);
+ ItemStack getItem(int i);
ItemStack a(int i, int j);
- void a(int i, ItemStack itemstack);
+ void setItem(int i, ItemStack itemstack);
- String c();
+ String getName();
- int r_();
+ int getMaxStackSize();
- void i();
+ void update();
boolean a_(EntityHuman entityhuman);
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index 53d56374..3475a921 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -2,48 +2,48 @@ package net.minecraft.server;
public class InventoryCraftResult implements IInventory {
- private ItemStack[] a = new ItemStack[1];
+ private ItemStack[] items = new ItemStack[1];
// CraftBukkit start
public ItemStack[] getContents() {
- return a;
+ return items;
}
// CraftBukkit end
public InventoryCraftResult() {}
- public int q_() {
+ public int getSize() {
return 1;
}
- public ItemStack c_(int i) {
- return this.a[i];
+ public ItemStack getItem(int i) {
+ return this.items[i];
}
- public String c() {
+ public String getName() {
return "Result";
}
public ItemStack a(int i, int j) {
- if (this.a[i] != null) {
- ItemStack itemstack = this.a[i];
+ if (this.items[i] != null) {
+ ItemStack itemstack = this.items[i];
- this.a[i] = null;
+ this.items[i] = null;
return itemstack;
} else {
return null;
}
}
- public void a(int i, ItemStack itemstack) {
- this.a[i] = itemstack;
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
- public void i() {}
+ public void update() {}
public boolean a_(EntityHuman entityhuman) {
return true;
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java
index 5f0bae2e..e6411c16 100644
--- a/src/main/java/net/minecraft/server/InventoryCrafting.java
+++ b/src/main/java/net/minecraft/server/InventoryCrafting.java
@@ -2,59 +2,59 @@ package net.minecraft.server;
public class InventoryCrafting implements IInventory {
- private ItemStack[] a;
+ private ItemStack[] items;
private int b;
private Container c;
// CraftBukkit start
public ItemStack[] getContents() {
- return a;
+ return items;
}
// CraftBukkit end
public InventoryCrafting(Container container, int i, int j) {
int k = i * j;
- this.a = new ItemStack[k];
+ this.items = new ItemStack[k];
this.c = container;
this.b = i;
}
- public int q_() {
- return this.a.length;
+ public int getSize() {
+ return this.items.length;
}
- public ItemStack c_(int i) {
- return i >= this.q_() ? null : this.a[i];
+ public ItemStack getItem(int i) {
+ return i >= this.getSize() ? null : this.items[i];
}
public ItemStack b(int i, int j) {
if (i >= 0 && i < this.b) {
int k = i + j * this.b;
- return this.c_(k);
+ return this.getItem(k);
} else {
return null;
}
}
- public String c() {
+ public String getName() {
return "Crafting";
}
public ItemStack a(int i, int j) {
- if (this.a[i] != null) {
+ if (this.items[i] != null) {
ItemStack itemstack;
- if (this.a[i].count <= j) {
- itemstack = this.a[i];
- this.a[i] = null;
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
this.c.a((IInventory) this);
return itemstack;
} else {
- itemstack = this.a[i].a(j);
- if (this.a[i].count == 0) {
- this.a[i] = null;
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
}
this.c.a((IInventory) this);
@@ -65,16 +65,16 @@ public class InventoryCrafting implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- this.a[i] = itemstack;
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
this.c.a((IInventory) this);
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
- public void i() {}
+ public void update() {}
public boolean a_(EntityHuman entityhuman) {
return true;
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java
index 60e00852..4fe486e5 100644
--- a/src/main/java/net/minecraft/server/InventoryLargeChest.java
+++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java
@@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory {
// CraftBukkit start
public ItemStack[] getContents() {
- ItemStack[] result = new ItemStack[q_()];
+ ItemStack[] result = new ItemStack[getSize()];
for (int i = 0; i < result.length; i++) {
- result[i] = c_(i);
+ result[i] = getItem(i);
}
return result;
}
@@ -22,37 +22,37 @@ public class InventoryLargeChest implements IInventory {
this.c = iinventory1;
}
- public int q_() {
- return this.b.q_() + this.c.q_();
+ public int getSize() {
+ return this.b.getSize() + this.c.getSize();
}
- public String c() {
+ public String getName() {
return this.a;
}
- public ItemStack c_(int i) {
- return i >= this.b.q_() ? this.c.c_(i - this.b.q_()) : this.b.c_(i);
+ public ItemStack getItem(int i) {
+ return i >= this.b.getSize() ? this.c.getItem(i - this.b.getSize()) : this.b.getItem(i);
}
public ItemStack a(int i, int j) {
- return i >= this.b.q_() ? this.c.a(i - this.b.q_(), j) : this.b.a(i, j);
+ return i >= this.b.getSize() ? this.c.a(i - this.b.getSize(), j) : this.b.a(i, j);
}
- public void a(int i, ItemStack itemstack) {
- if (i >= this.b.q_()) {
- this.c.a(i - this.b.q_(), itemstack);
+ public void setItem(int i, ItemStack itemstack) {
+ if (i >= this.b.getSize()) {
+ this.c.setItem(i - this.b.getSize(), itemstack);
} else {
- this.b.a(i, itemstack);
+ this.b.setItem(i, itemstack);
}
}
- public int r_() {
- return this.b.r_();
+ public int getMaxStackSize() {
+ return this.b.getMaxStackSize();
}
- public void i() {
- this.b.i();
- this.c.i();
+ public void update() {
+ this.b.update();
+ this.c.update();
}
public boolean a_(EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java
index 6029352e..31c9e4f1 100644
--- a/src/main/java/net/minecraft/server/InventoryPlayer.java
+++ b/src/main/java/net/minecraft/server/InventoryPlayer.java
@@ -2,20 +2,20 @@ package net.minecraft.server;
public class InventoryPlayer implements IInventory {
- public ItemStack[] a = new ItemStack[36];
- public ItemStack[] b = new ItemStack[4];
- public int c = 0;
+ public ItemStack[] items = new ItemStack[36];
+ public ItemStack[] armor = new ItemStack[4];
+ public int itemInHandIndex = 0;
public EntityHuman d; // CraftBukkit - private->public
private ItemStack f;
public boolean e = false;
// CraftBukkit start
public ItemStack[] getContents() {
- return a;
+ return items;
}
public ItemStack[] getArmorContents() {
- return b;
+ return armor;
}
// CraftBukkit end
@@ -23,8 +23,8 @@ public class InventoryPlayer implements IInventory {
this.d = entityhuman;
}
- public ItemStack b() {
- return this.c < 9 && this.c >= 0 ? this.a[this.c] : null;
+ public ItemStack getItemInHand() {
+ return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null;
}
public static int e() {
@@ -32,8 +32,8 @@ public class InventoryPlayer implements IInventory {
}
private int d(int i) {
- for (int j = 0; j < this.a.length; ++j) {
- if (this.a[j] != null && this.a[j].id == i) {
+ for (int j = 0; j < this.items.length; ++j) {
+ if (this.items[j] != null && this.items[j].id == i) {
return j;
}
}
@@ -42,8 +42,8 @@ public class InventoryPlayer implements IInventory {
}
private int c(ItemStack itemstack) {
- for (int i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.r_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].c() && this.items[i].count < this.items[i].b() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].e() || this.items[i].getData() == itemstack.getData())) {
return i;
}
}
@@ -52,8 +52,8 @@ public class InventoryPlayer implements IInventory {
}
private int k() {
- for (int i = 0; i < this.a.length; ++i) {
- if (this.a[i] == null) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] == null) {
return i;
}
}
@@ -73,35 +73,35 @@ public class InventoryPlayer implements IInventory {
if (k < 0) {
return j;
} else {
- if (this.a[k] == null) {
- this.a[k] = new ItemStack(i, 0, itemstack.h());
+ if (this.items[k] == null) {
+ this.items[k] = new ItemStack(i, 0, itemstack.getData());
}
int l = j;
- if (j > this.a[k].b() - this.a[k].count) {
- l = this.a[k].b() - this.a[k].count;
+ if (j > this.items[k].b() - this.items[k].count) {
+ l = this.items[k].b() - this.items[k].count;
}
- if (l > this.r_() - this.a[k].count) {
- l = this.r_() - this.a[k].count;
+ if (l > this.getMaxStackSize() - this.items[k].count) {
+ l = this.getMaxStackSize() - this.items[k].count;
}
if (l == 0) {
return j;
} else {
j -= l;
- this.a[k].count += l;
- this.a[k].b = 5;
+ this.items[k].count += l;
+ this.items[k].b = 5;
return j;
}
}
}
public void f() {
- for (int i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null && this.a[i].b > 0) {
- --this.a[i].b;
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null && this.items[i].b > 0) {
+ --this.items[i].b;
}
}
}
@@ -112,15 +112,15 @@ public class InventoryPlayer implements IInventory {
if (j < 0) {
return false;
} else {
- if (--this.a[j].count <= 0) {
- this.a[j] = null;
+ if (--this.items[j].count <= 0) {
+ this.items[j] = null;
}
return true;
}
}
- public boolean a(ItemStack itemstack) {
+ public boolean canHold(ItemStack itemstack) {
if (!itemstack.f()) {
itemstack.count = this.d(itemstack);
if (itemstack.count == 0) {
@@ -131,8 +131,8 @@ public class InventoryPlayer implements IInventory {
int i = this.k();
if (i >= 0) {
- this.a[i] = itemstack;
- this.a[i].b = 5;
+ this.items[i] = itemstack;
+ this.items[i].b = 5;
return true;
} else {
return false;
@@ -140,11 +140,11 @@ public class InventoryPlayer implements IInventory {
}
public ItemStack a(int i, int j) {
- ItemStack[] aitemstack = this.a;
+ ItemStack[] aitemstack = this.items;
- if (i >= this.a.length) {
- aitemstack = this.b;
- i -= this.a.length;
+ if (i >= this.items.length) {
+ aitemstack = this.armor;
+ i -= this.items.length;
}
if (aitemstack[i] != null) {
@@ -167,12 +167,12 @@ public class InventoryPlayer implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- ItemStack[] aitemstack = this.a;
+ public void setItem(int i, ItemStack itemstack) {
+ ItemStack[] aitemstack = this.items;
if (i >= aitemstack.length) {
i -= aitemstack.length;
- aitemstack = this.b;
+ aitemstack = this.armor;
}
aitemstack[i] = itemstack;
@@ -181,8 +181,8 @@ public class InventoryPlayer implements IInventory {
public float a(Block block) {
float f = 1.0F;
- if (this.a[this.c] != null) {
- f *= this.a[this.c].a(block);
+ if (this.items[this.itemInHandIndex] != null) {
+ f *= this.items[this.itemInHandIndex].a(block);
}
return f;
@@ -192,20 +192,20 @@ public class InventoryPlayer implements IInventory {
int i;
NBTTagCompound nbttagcompound;
- for (i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null) {
+ for (i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) i);
- this.a[i].a(nbttagcompound);
+ this.items[i].a(nbttagcompound);
nbttaglist.a((NBTBase) nbttagcompound);
}
}
- for (i = 0; i < this.b.length; ++i) {
- if (this.b[i] != null) {
+ for (i = 0; i < this.armor.length; ++i) {
+ if (this.armor[i] != null) {
nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) (i + 100));
- this.b[i].a(nbttagcompound);
+ this.armor[i].a(nbttagcompound);
nbttaglist.a((NBTBase) nbttagcompound);
}
}
@@ -214,51 +214,51 @@ public class InventoryPlayer implements IInventory {
}
public void b(NBTTagList nbttaglist) {
- this.a = new ItemStack[36];
- this.b = new ItemStack[4];
+ this.items = new ItemStack[36];
+ this.armor = new ItemStack[4];
for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound.c("Slot") & 255;
ItemStack itemstack = new ItemStack(nbttagcompound);
- if (itemstack.a() != null) {
- if (j >= 0 && j < this.a.length) {
- this.a[j] = itemstack;
+ if (itemstack.getItem() != null) {
+ if (j >= 0 && j < this.items.length) {
+ this.items[j] = itemstack;
}
- if (j >= 100 && j < this.b.length + 100) {
- this.b[j - 100] = itemstack;
+ if (j >= 100 && j < this.armor.length + 100) {
+ this.armor[j - 100] = itemstack;
}
}
}
}
- public int q_() {
- return this.a.length + 4;
+ public int getSize() {
+ return this.items.length + 4;
}
- public ItemStack c_(int i) {
- ItemStack[] aitemstack = this.a;
+ public ItemStack getItem(int i) {
+ ItemStack[] aitemstack = this.items;
if (i >= aitemstack.length) {
i -= aitemstack.length;
- aitemstack = this.b;
+ aitemstack = this.armor;
}
return aitemstack[i];
}
- public String c() {
+ public String getName() {
return "Inventory";
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
public int a(Entity entity) {
- ItemStack itemstack = this.c_(this.c);
+ ItemStack itemstack = this.getItem(this.itemInHandIndex);
return itemstack != null ? itemstack.a(entity) : 1;
}
@@ -267,7 +267,7 @@ public class InventoryPlayer implements IInventory {
if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) {
return true;
} else {
- ItemStack itemstack = this.c_(this.c);
+ ItemStack itemstack = this.getItem(this.itemInHandIndex);
return itemstack != null ? itemstack.b(block) : false;
}
@@ -278,15 +278,15 @@ public class InventoryPlayer implements IInventory {
int j = 0;
int k = 0;
- for (int l = 0; l < this.b.length; ++l) {
- if (this.b[l] != null && this.b[l].a() instanceof ItemArmor) {
- int i1 = this.b[l].i();
- int j1 = this.b[l].g();
+ for (int l = 0; l < this.armor.length; ++l) {
+ if (this.armor[l] != null && this.armor[l].getItem() instanceof ItemArmor) {
+ int i1 = this.armor[l].i();
+ int j1 = this.armor[l].g();
int k1 = i1 - j1;
j += k1;
k += i1;
- int l1 = ((ItemArmor) this.b[l].a()).bj;
+ int l1 = ((ItemArmor) this.armor[l].getItem()).bj;
i += l1;
}
@@ -300,12 +300,12 @@ public class InventoryPlayer implements IInventory {
}
public void c(int i) {
- for (int j = 0; j < this.b.length; ++j) {
- if (this.b[j] != null && this.b[j].a() instanceof ItemArmor) {
- this.b[j].a(i, this.d);
- if (this.b[j].count == 0) {
- this.b[j].a(this.d);
- this.b[j] = null;
+ for (int j = 0; j < this.armor.length; ++j) {
+ if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
+ this.armor[j].damage(i, this.d);
+ if (this.armor[j].count == 0) {
+ this.armor[j].a(this.d);
+ this.armor[j] = null;
}
}
}
@@ -314,22 +314,22 @@ public class InventoryPlayer implements IInventory {
public void h() {
int i;
- for (i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null) {
- this.d.a(this.a[i], true);
- this.a[i] = null;
+ for (i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
+ this.d.a(this.items[i], true);
+ this.items[i] = null;
}
}
- for (i = 0; i < this.b.length; ++i) {
- if (this.b[i] != null) {
- this.d.a(this.b[i], true);
- this.b[i] = null;
+ for (i = 0; i < this.armor.length; ++i) {
+ if (this.armor[i] != null) {
+ this.d.a(this.armor[i], true);
+ this.armor[i] = null;
}
}
}
- public void i() {
+ public void update() {
this.e = true;
}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index 7debae06..51b2a02f 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -21,7 +21,7 @@ public class ItemBed extends Item {
++j;
BlockBed blockbed = (BlockBed) Block.BED;
- int i1 = MathHelper.b((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int i1 = MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3;
byte b0 = 0;
byte b1 = 0;
@@ -44,7 +44,7 @@ public class ItemBed extends Item {
if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.d(i, j - 1, k) && world.d(i + b0, j - 1, k + b1)) {
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- world.b(i, j, k, blockbed.id, i1);
+ world.setTypeIdAndData(i, j, k, blockbed.id, i1);
// CraftBukkit start - bed
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, blockbed);
@@ -55,7 +55,7 @@ public class ItemBed extends Item {
}
// CraftBukkit end
- world.b(i + b0, j, k + b1, blockbed.id, i1 + 8);
+ world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
--itemstack.count;
return true;
} else {
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index fda82cf6..d70a880d 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -9,11 +9,11 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class ItemBlock extends Item {
- private int a;
+ private int id;
public ItemBlock(int i) {
super(i);
- this.a = i + 256;
+ this.id = i + 256;
this.b(Block.byId[i + 256].a(2));
}
@@ -50,64 +50,64 @@ public class ItemBlock extends Item {
if (itemstack.count == 0) {
return false;
- } else {
- if (world.a(this.a, i, j, k, false)) {
- Block block = Block.byId[this.a];
+ } else if (world.a(this.id, i, j, k, false)) {
+ Block block = Block.byId[this.id];
- // CraftBukkit start - This executes the placement of the block
- BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
+ // CraftBukkit start - This executes the placement of the block
+ BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
- // Special case the silly stepstone :'(
- if (l == 1 && world.getTypeId(i, j - 1, k) == Block.STEP.id && itemstack.id == Block.STEP.id) {
- replacedBlockState = CraftBlockState.getBlockState(world, i, j - 1, k);
- }
- /**
- * @see net.minecraft.server.World#b(int i, int j, int k, int l, int i1)
- *
- * This replaces world.b(IIIII), we're doing this because we need to
- * hook between the 'placement' and the informing to 'world' so we can
- * sanely undo this.
- *
- * Whenever the call to 'world.b' changes we need to figure out again what to
- * replace this with.
- */
- if (world.setTypeIdAndData(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block
- BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
-
- if (event.isCancelled() || !event.canBuild()) {
- // CraftBukkit Undo!
-
- if ((this.a == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
- // Half steps automatically set the block below to a double
- world.setTypeId(i, j - 1, k, 44);
-
- } else {
-
- if (this.a == Block.ICE.id) {
- // Ice will explode if we set straight to 0
- world.setTypeId(i, j, k, 20);
- }
-
- world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
- }
+ // Special case the silly stepstone :'(
+ if (l == 1 && world.getTypeId(i, j - 1, k) == Block.STEP.id && itemstack.id == Block.STEP.id) {
+ replacedBlockState = CraftBlockState.getBlockState(world, i, j - 1, k);
+ }
+ /**
+ * @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
+ *
+ * This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
+ * hook between the 'placement' and the informing to 'world' so we can
+ * sanely undo this.
+ *
+ * Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
+ * replace this with.
+ */
+ if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
+ BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
+
+ if (event.isCancelled() || !event.canBuild()) {
+ // CraftBukkit Undo!
+
+ if ((this.id == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
+ // Half steps automatically set the block below to a double
+ world.setTypeId(i, j - 1, k, 44);
} else {
- world.f(i, j, k, a); // <-- world.b does this on success (tell the world)
- Block.byId[this.a].d(world, i, j, k, l);
- Block.byId[this.a].a(world, i, j, k, (EntityLiving) entityhuman);
- world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.c(), (block.stepSound.a() + 1.0F) / 2.0F, block.stepSound.b() * 0.8F);
- --itemstack.count;
+ if (this.id == Block.ICE.id) {
+ // Ice will explode if we set straight to 0
+ world.setTypeId(i, j, k, 20);
+ }
+
+ world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
}
- // CraftBukkit end
+
+ } else {
+ world.update(i, j, k, this.id); // <-- world.setTypeIdAndData does this on success (tell the world)
+
+ Block.byId[this.id].postPlace(world, i, j, k, l);
+ Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ --itemstack.count;
}
+ // CraftBukkit end
}
return true;
+ } else {
+ return false;
}
}
public String a() {
- return Block.byId[this.a].f();
+ return Block.byId[this.id].f();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index 393b94b5..a628a643 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -20,35 +20,35 @@ public class ItemBoat extends Item {
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
- Vec3D vec3d = Vec3D.b(d0, d1, d2);
- float f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
- float f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
- float f5 = -MathHelper.b(-f1 * 0.017453292F);
- float f6 = MathHelper.a(-f1 * 0.017453292F);
+ Vec3D vec3d = Vec3D.create(d0, d1, d2);
+ float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
+ float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
- Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
- MovingObjectPosition movingobjectposition = world.a(vec3d, vec3d1, true);
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
+ MovingObjectPosition movingobjectposition = world.rayTrace(vec3d, vec3d1, true);
if (movingobjectposition == null) {
return itemstack;
} else {
- if (movingobjectposition.a == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.TILE) {
int i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
if (!world.isStatic) {
// CraftBukkit start - Boat placement
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.e, itemstack);
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack);
if (event.isCancelled()) {
return itemstack;
}
// CraftBukkit end
- world.a((Entity) (new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.5F), (double) ((float) k + 0.5F))));
+ world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.5F), (double) ((float) k + 0.5F)));
}
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 56356b14..45aedd10 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -25,21 +25,21 @@ public class ItemBucket extends Item {
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
- Vec3D vec3d = Vec3D.b(d0, d1, d2);
- float f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
- float f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
- float f5 = -MathHelper.b(-f1 * 0.017453292F);
- float f6 = MathHelper.a(-f1 * 0.017453292F);
+ Vec3D vec3d = Vec3D.create(d0, d1, d2);
+ float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
+ float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
- Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
- MovingObjectPosition movingobjectposition = world.a(vec3d, vec3d1, this.a == 0);
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
+ MovingObjectPosition movingobjectposition = world.rayTrace(vec3d, vec3d1, this.a == 0);
if (movingobjectposition == null) {
return itemstack;
} else {
- if (movingobjectposition.a == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.TILE) {
int i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
@@ -61,7 +61,7 @@ public class ItemBucket extends Item {
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data); // CraftBukkit
}
@@ -77,13 +77,13 @@ public class ItemBucket extends Item {
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end
- world.e(i, j, k, 0);
+ world.setTypeId(i, j, k, 0);
return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data ); // CraftBukkit
}
} else {
if (this.a < 0) {
// CraftBukkit start
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, i, j, k, movingobjectposition.e, itemstack);
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, i, j, k, movingobjectposition.face, itemstack);
if (event.isCancelled()) {
return itemstack;
@@ -96,47 +96,47 @@ public class ItemBucket extends Item {
}
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
- if (movingobjectposition.e == 0) {
+ if (movingobjectposition.face == 0) {
--j;
}
- if (movingobjectposition.e == 1) {
+ if (movingobjectposition.face == 1) {
++j;
}
- if (movingobjectposition.e == 2) {
+ if (movingobjectposition.face == 2) {
--k;
}
- if (movingobjectposition.e == 3) {
+ if (movingobjectposition.face == 3) {
++k;
}
- if (movingobjectposition.e == 4) {
+ if (movingobjectposition.face == 4) {
--i;
}
- if (movingobjectposition.e == 5) {
+ if (movingobjectposition.face == 5) {
++i;
}
if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) {
// CraftBukkit start
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.e, itemstack);
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack);
if (event.isCancelled()) {
return itemstack;
}
// CraftBukkit end
- if (world.m.d && this.a == Block.WATER.id) {
- world.a(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
+ if (world.worldProvider.d && this.a == Block.WATER.id) {
+ world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
}
} else {
- world.b(i, j, k, this.a, 0);
+ world.setTypeIdAndData(i, j, k, this.a, 0);
}
// CraftBukkit start
@@ -146,9 +146,9 @@ public class ItemBucket extends Item {
// CraftBukkit end
}
}
- } else if (this.a == 0 && movingobjectposition.g instanceof EntityCow) {
+ } else if (this.a == 0 && movingobjectposition.entity instanceof EntityCow) {
// CraftBukkit start -- This codepath seems to be *NEVER* called
- Location loc = movingobjectposition.g.getBukkitEntity().getLocation();
+ Location loc = movingobjectposition.entity.getBukkitEntity().getLocation();
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index ead1b8f8..860426f0 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -32,10 +32,10 @@ public class ItemDoor extends Item {
block = Block.IRON_DOOR_BLOCK;
}
- if (!block.a(world, i, j, k)) {
+ if (!block.canPlace(world, i, j, k)) {
return false;
} else {
- int i1 = MathHelper.b((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
+ int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
byte b0 = 0;
byte b1 = 0;
@@ -74,8 +74,8 @@ public class ItemDoor extends Item {
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- world.e(i, j, k, block.id);
- world.c(i, j, k, i1);
+ world.setTypeId(i, j, k, block.id);
+ world.setData(i, j, k, i1);
// CraftBukkit start - bed
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
@@ -86,8 +86,8 @@ public class ItemDoor extends Item {
}
// CraftBukkit end
- world.e(i, j + 1, k, block.id);
- world.c(i, j + 1, k, i1 + 8);
+ world.setTypeId(i, j + 1, k, block.id);
+ world.setData(i, j + 1, k, i1 + 8);
--itemstack.count;
return true;
}
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index 29c57f15..845f647e 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -63,15 +63,15 @@ public class ItemFlintAndSteel extends Item {
boolean preventFire = eventIgnite.isCancelled();
if (preventFire) {
- itemstack.a(1, entityhuman);
+ itemstack.damage(1, entityhuman);
return false;
}
// CraftBukkit end
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
- world.e(i, j, k, Block.FIRE.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
+ world.setTypeId(i, j, k, Block.FIRE.id);
// CraftBukkit start
BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.FIRE.id);
@@ -83,7 +83,7 @@ public class ItemFlintAndSteel extends Item {
// CraftBukkit end
}
- itemstack.a(1, entityhuman);
+ itemstack.damage(1, entityhuman);
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index af52be9f..7a51c31d 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -24,13 +24,13 @@ public class ItemHoe extends Item {
} else {
Block block = Block.SOIL;
- world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.c(), (block.stepSound.a() + 1.0F) / 2.0F, block.stepSound.b() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
if (world.isStatic) {
return true;
} else {
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- world.e(i, j, k, block.id);
+ world.setTypeId(i, j, k, block.id);
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block);
@@ -40,19 +40,19 @@ public class ItemHoe extends Item {
}
// CraftBukkit end
- itemstack.a(1, entityhuman);
- if (world.k.nextInt(8) == 0 && i1 == Block.GRASS.id) {
+ itemstack.damage(1, entityhuman);
+ if (world.random.nextInt(8) == 0 && i1 == Block.GRASS.id) {
byte b0 = 1;
for (int j1 = 0; j1 < b0; ++j1) {
float f = 0.7F;
- float f1 = world.k.nextFloat() * f + (1.0F - f) * 0.5F;
+ float f1 = world.random.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = 1.2F;
- float f3 = world.k.nextFloat() * f + (1.0F - f) * 0.5F;
+ float f3 = world.random.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f1), (double) ((float) j + f2), (double) ((float) k + f3), new ItemStack(Item.SEEDS));
- entityitem.c = 10;
- world.a((Entity) entityitem);
+ entityitem.pickupDelay = 10;
+ world.addEntity(entityitem);
}
}
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index 8c4a1ae6..7b2178f6 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -12,14 +12,14 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class ItemInWorldManager {
- private World b;
- public EntityHuman a;
+ private World world;
+ public EntityHuman player;
private float c = 0.0F;
private int d;
private int e;
private int f;
private int g;
- private int h;
+ private int currentTick;
private boolean i;
private int j;
private int k;
@@ -27,18 +27,18 @@ public class ItemInWorldManager {
private int m;
public ItemInWorldManager(World world) {
- this.b = world;
+ this.world = world;
}
public void a() {
- this.h = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
if (this.i) {
- int i = this.h - this.m;
- int j = this.b.getTypeId(this.j, this.k, this.l);
+ int i = this.currentTick - this.m;
+ int j = this.world.getTypeId(this.j, this.k, this.l);
if (j != 0) {
Block block = Block.byId[j];
- float f = block.a(this.a) * (float) (i + 1);
+ float f = block.getDamage(this.player) * (float) (i + 1);
if (f >= 1.0F) {
this.i = false;
@@ -51,9 +51,9 @@ public class ItemInWorldManager {
}
// CraftBukkit added face
- public void a(int i, int j, int k, int face) {
+ public void dig(int i, int j, int k, int face) {
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- int l = this.b.getTypeId(i, j, k);
+ int l = this.world.getTypeId(i, j, k);
// CraftBukkit start
// Swings at air do *NOT* exist.
@@ -61,30 +61,30 @@ public class ItemInWorldManager {
return;
}
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.a, Action.LEFT_CLICK_BLOCK , i, j, k, face, this.a.inventory.b());
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK , i, j, k, face, this.player.inventory.getItemInHand());
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (l == Block.WOODEN_DOOR.id) {
// For some reason *BOTH* the bottom/top part have to be marked updated.
- boolean bottom = (this.b.getData(i, j, k) & 8) == 0;
- ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
- ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.b)));
+ boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
}
} else {
- Block.byId[l].b(this.b, i, j, k, this.a);
+ Block.byId[l].b(this.world, i, j, k, this.player);
}
// Handle hitting a block
- float toolDamage = Block.byId[l].a(this.a);
+ float toolDamage = Block.byId[l].getDamage(this.player);
if (event.useItemInHand() == Event.Result.DENY) {
// If we 'insta destroyed' then the client needs to be informed.
if (toolDamage > 1.0f) {
- ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
return;
}
- BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.a, i, j, k, this.a.inventory.b(), toolDamage >= 1.0f);
+ BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, i, j, k, this.player.inventory.getItemInHand(), toolDamage >= 1.0f);
if (blockEvent.isCancelled()) {
return;
@@ -106,13 +106,13 @@ public class ItemInWorldManager {
public void b(int i, int j, int k) {
if (i == this.e && j == this.f && k == this.g) {
- this.h = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- int l = this.h - this.d;
- int i1 = this.b.getTypeId(i, j, k);
+ this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ int l = this.currentTick - this.d;
+ int i1 = this.world.getTypeId(i, j, k);
if (i1 != 0) {
Block block = Block.byId[i1];
- float f = block.a(this.a) * (float) (l + 1);
+ float f = block.getDamage(this.player) * (float) (l + 1);
if (f >= 1.0F) {
this.d(i, j, k);
@@ -126,21 +126,20 @@ public class ItemInWorldManager {
}
// CraftBukkit start -- force blockreset to client
} else {
- ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// CraftBukkit end
}
this.c = 0.0F;
- this.e = 0;
}
public boolean c(int i, int j, int k) {
- Block block = Block.byId[this.b.getTypeId(i, j, k)];
- int l = this.b.getData(i, j, k);
- boolean flag = this.b.e(i, j, k, 0);
+ Block block = Block.byId[this.world.getTypeId(i, j, k)];
+ int l = this.world.getData(i, j, k);
+ boolean flag = this.world.setTypeId(i, j, k, 0);
if (block != null && flag) {
- block.b(this.b, i, j, k, l);
+ block.postBreak(this.world, i, j, k, l);
}
return flag;
@@ -148,10 +147,10 @@ public class ItemInWorldManager {
public boolean d(int i, int j, int k) {
// CraftBukkit start
- if (this.a instanceof EntityPlayer) {
- CraftServer server = ((WorldServer) this.b).getServer();
- org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k);
- org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.a.getBukkitEntity();
+ if (this.player instanceof EntityPlayer) {
+ CraftServer server = ((WorldServer) this.world).getServer();
+ org.bukkit.block.Block block = ((WorldServer) this.world).getWorld().getBlockAt(i, j, k);
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.player.getBukkitEntity();
BlockBreakEvent event = new BlockBreakEvent(block,player);
server.getPluginManager().callEvent(event);
@@ -162,44 +161,44 @@ public class ItemInWorldManager {
}
// CraftBukkit end
- int l = this.b.getTypeId(i, j, k);
- int i1 = this.b.getData(i, j, k);
+ int l = this.world.getTypeId(i, j, k);
+ int i1 = this.world.getData(i, j, k);
boolean flag = this.c(i, j, k);
- ItemStack itemstack = this.a.A();
+ ItemStack itemstack = this.player.A();
if (itemstack != null) {
- itemstack.a(l, i, j, k, this.a);
+ itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) {
- itemstack.a(this.a);
- this.a.B();
+ itemstack.a(this.player);
+ this.player.B();
}
}
- if (flag && this.a.b(Block.byId[l])) {
- Block.byId[l].a(this.b, this.a, i, j, k, i1);
- ((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
+ if (flag && this.player.b(Block.byId[l])) {
+ Block.byId[l].a(this.world, this.player, i, j, k, i1);
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
return flag;
}
- public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) {
+ public boolean useItem(EntityHuman entityhuman, World world, ItemStack itemstack) {
int i = itemstack.count;
ItemStack itemstack1 = itemstack.a(world, entityhuman);
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) {
return false;
} else {
- entityhuman.inventory.a[entityhuman.inventory.c] = itemstack1;
+ entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
if (itemstack1.count == 0) {
- entityhuman.inventory.a[entityhuman.inventory.c] = null;
+ entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
}
return true;
}
}
- public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l) {
+ public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l) {
int i1 = world.getTypeId(i, j, k);
// CraftBukkit start - Interact
@@ -210,18 +209,18 @@ public class ItemInWorldManager {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (i1 == Block.WOODEN_DOOR.id) {
boolean bottom = (world.getData(i, j, k) & 8) == 0;
- ((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)));
+ ((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world));
}
} else {
- result = Block.byId[i1].a(world, i, j, k, entityhuman);
+ result = Block.byId[i1].interact(world, i, j, k, entityhuman);
if (itemstack != null && !result) {
- result = itemstack.a(entityhuman, world, i, j, k, l);
+ result = itemstack.placeItem(entityhuman, world, i, j, k, l);
}
}
// If we have 'true' and no explicit deny *or* an explicit allow -- run the item part of the hook
if (itemstack != null && ((!result && event.useItemInHand() != Event.Result.DENY) || event.useItemInHand() == Event.Result.ALLOW)) {
- this.a(entityhuman, world, itemstack);
+ this.useItem(entityhuman, world, itemstack);
}
}
return result;
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
index ac09bf40..aecaa6fd 100644
--- a/src/main/java/net/minecraft/server/ItemMinecart.java
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -29,7 +29,7 @@ public class ItemMinecart extends Item {
}
// CraftBukkit end
- world.a((Entity) (new EntityMinecart(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a)));
+ world.addEntity(new EntityMinecart(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a));
}
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java
index 0ba156e6..ccb06bb7 100644
--- a/src/main/java/net/minecraft/server/ItemRedstone.java
+++ b/src/main/java/net/minecraft/server/ItemRedstone.java
@@ -43,10 +43,10 @@ public class ItemRedstone extends Item {
if (!world.isEmpty(i, j, k)) {
return false;
} else {
- if (Block.REDSTONE_WIRE.a(world, i, j, k)) {
+ if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- world.e(i, j, k, Block.REDSTONE_WIRE.id);
+ world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
// CraftBukkit start - redstone
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.REDSTONE_WIRE);
diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java
index 49338122..d4bb4be7 100644
--- a/src/main/java/net/minecraft/server/ItemReed.java
+++ b/src/main/java/net/minecraft/server/ItemReed.java
@@ -9,11 +9,11 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class ItemReed extends Item {
- private int a;
+ private int id;
public ItemReed(int i, Block block) {
super(i);
- this.a = block.id;
+ this.id = block.id;
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
@@ -50,33 +50,33 @@ public class ItemReed extends Item {
if (itemstack.count == 0) {
return false;
} else {
- if (world.a(this.a, i, j, k, false)) {
- Block block = Block.byId[this.a];
+ if (world.a(this.id, i, j, k, false)) {
+ Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
/**
- * @see net.minecraft.server.World#e(int i, int j, int k, int l)
+ * @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
*
- * This replaces world.e(IIII), we're doing this because we need to
+ * This replaces world.setTypeId(IIII), we're doing this because we need to
* hook between the 'placement' and the informing to 'world' so we can
* sanely undo this.
*
- * Whenever the call to 'world.e' changes we need to figure out again what to
+ * Whenever the call to 'world.setTypeId' changes we need to figure out again what to
* replace this with.
*/
- if (world.setTypeId(i, j, k, this.a)) { // <-- world.e does this to place the block
+ if (world.setRawTypeId(i, j, k, this.id)) { // <-- world.e does this to place the block
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
// CraftBukkit Undo -- this only has reed, repeater and pie blocks
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
} else {
- world.f(i, j, k, a); // <-- world.e does this on success (tell the world)
+ world.update(i, j, k, this.id); // <-- world.setTypeId does this on success (tell the world)
- Block.byId[this.a].d(world, i, j, k, l);
- Block.byId[this.a].a(world, i, j, k, (EntityLiving) entityhuman);
- world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.c(), (block.stepSound.a() + 1.0F) / 2.0F, block.stepSound.b() * 0.8F);
+ Block.byId[this.id].postPlace(world, i, j, k, l);
+ Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java
index 70e72595..6acf4f3f 100644
--- a/src/main/java/net/minecraft/server/ItemSeeds.java
+++ b/src/main/java/net/minecraft/server/ItemSeeds.java
@@ -9,11 +9,11 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class ItemSeeds extends Item {
- private int a;
+ private int id;
public ItemSeeds(int i, int j) {
super(i);
- this.a = j;
+ this.id = j;
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
@@ -23,12 +23,12 @@ public class ItemSeeds extends Item {
int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) {
- BlockState blockState = CraftBlockState.getBlockState( world, i, j + 1, k); // CraftBukkit
+ BlockState blockState = CraftBlockState.getBlockState(world, i, j + 1, k); // CraftBukkit
- world.e(i, j + 1, k, this.a);
+ world.setTypeId(i, j + 1, k, this.id);
// CraftBukkit start - seeds
- BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, this.a);
+ BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, this.id);
if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeId(0);
return false;
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index 5e3402db..614e317a 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -42,15 +42,15 @@ public class ItemSign extends Item {
++i;
}
- if (!Block.SIGN_POST.a(world, i, j, k)) {
+ if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
return false;
} else {
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
if (l == 1) {
- world.b(i, j, k, Block.SIGN_POST.id, MathHelper.b((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15);
+ world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15);
} else {
- world.b(i, j, k, Block.WALL_SIGN.id, l);
+ world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l);
}
// CraftBukkit start - sign
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 204710e6..1768ed6f 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -48,12 +48,12 @@ public final class ItemStack {
return new ItemStack(this.id, i, this.damage);
}
- public Item a() {
+ public Item getItem() {
return Item.byId[this.id];
}
- public boolean a(EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- boolean flag = this.a().a(this, entityhuman, world, i, j, k, l);
+ public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ boolean flag = this.getItem().a(this, entityhuman, world, i, j, k, l);
if (flag) {
entityhuman.a(StatisticList.A[this.id], 1);
@@ -63,11 +63,11 @@ public final class ItemStack {
}
public float a(Block block) {
- return this.a().a(this, block);
+ return this.getItem().a(this, block);
}
public ItemStack a(World world, EntityHuman entityhuman) {
- return this.a().a(this, world, entityhuman);
+ return this.getItem().a(this, world, entityhuman);
}
public NBTTagCompound a(NBTTagCompound nbttagcompound) {
@@ -84,7 +84,7 @@ public final class ItemStack {
}
public int b() {
- return this.a().b();
+ return this.getItem().getMaxStackSize();
}
public boolean c() {
@@ -107,7 +107,7 @@ public final class ItemStack {
return this.damage;
}
- public int h() {
+ public int getData() {
return this.damage;
}
@@ -115,7 +115,7 @@ public final class ItemStack {
return Item.byId[this.id].d();
}
- public void a(int i, Entity entity) {
+ public void damage(int i, Entity entity) {
if (this.d()) {
this.damage += i;
if (this.damage > this.i()) {
@@ -167,7 +167,7 @@ public final class ItemStack {
return new ItemStack(this.id, this.count, this.damage);
}
- public static boolean a(ItemStack itemstack, ItemStack itemstack1) {
+ public static boolean equals(ItemStack itemstack, ItemStack itemstack1) {
return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.c(itemstack1) : false);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ab873a5f..c66f0e09 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -24,28 +24,28 @@ import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.util.ServerShutdownThread;
import org.bukkit.event.world.WorldSaveEvent;
-
+// CraftBukkit
public class MinecraftServer implements Runnable, ICommandListener {
- public static Logger a = Logger.getLogger("Minecraft");
+ public static Logger log = Logger.getLogger("Minecraft");
public static HashMap b = new HashMap();
- public NetworkListenThread c;
- public PropertyManager d;
- // public WorldServer e; // CraftBukkit - removed
- public ServerConfigurationManager f;
- public ConsoleCommandHandler o; // CraftBukkit - made public
- private boolean p = true;
- public boolean g = false;
- int h = 0;
+ public NetworkListenThread networkListenThread;
+ public PropertyManager propertyManager;
+ // public WorldServer worldServer; // CraftBukkit - removed
+ public ServerConfigurationManager serverConfigurationManager;
+ public ConsoleCommandHandler consoleCommandHandler; // CraftBukkit - made public
+ private boolean isRunning = true;
+ public boolean isStopped = false;
+ int ticks = 0;
public String i;
public int j;
private List q = new ArrayList();
private List r = Collections.synchronizedList(new ArrayList());
- public EntityTracker k;
- public boolean l;
- public boolean m;
- public boolean n;
+ public EntityTracker tracker;
+ public boolean onlineMode;
+ public boolean spawnAnimals;
+ public boolean pvpMode;
// CraftBukkit start
public int spawnProtection;
@@ -70,64 +70,64 @@ public class MinecraftServer implements Runnable, ICommandListener {
// CraftBukkit end
}
- private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException
- this.o = new ConsoleCommandHandler(this);
+ private boolean init() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException
+ this.consoleCommandHandler = new ConsoleCommandHandler(this);
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
threadcommandreader.setDaemon(true);
threadcommandreader.start();
- ConsoleLogManager.a(this); // Craftbukkit
+ ConsoleLogManager.init(this); // Craftbukkit
// CraftBukkit start
- System.setOut(new PrintStream(new LoggerOutputStream(a, Level.INFO), true));
- System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true));
+ System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
+ System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end
- a.info("Starting minecraft server version Beta 1.4");
+ log.info("Starting minecraft server version Beta 1.3");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
- a.warning("**** NOT ENOUGH RAM!");
- a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
+ log.warning("**** NOT ENOUGH RAM!");
+ log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
- a.info("Loading properties");
- this.d = new PropertyManager(options); // CraftBukkit
- String s = this.d.a("server-ip", "");
+ log.info("Loading properties");
+ this.propertyManager = new PropertyManager(new File("server.properties"));
+ String s = this.propertyManager.getString("server-ip", "");
- this.l = this.d.a("online-mode", true);
- this.m = this.d.a("spawn-animals", true);
- this.n = this.d.a("pvp", true);
- this.spawnProtection = this.d.a("spawn-protection", 16); // CraftBukkit Configurable spawn protection start
+ this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
+ this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
+ this.pvpMode = this.propertyManager.getBoolean("pvp", true);
+ this.spawnProtection = this.propertyManager.getInt("spawn-protection", 16); // CraftBukkit Configurable spawn protection start
InetAddress inetaddress = null;
if (s.length() > 0) {
inetaddress = InetAddress.getByName(s);
}
- int i = this.d.a("server-port", 25565);
+ int i = this.propertyManager.getInt("server-port", 25565);
- a.info("Starting Minecraft server on " + (s.length() == 0 ? "*" : s) + ":" + i);
+ log.info("Starting Minecraft server on " + (s.length() == 0 ? "*" : s) + ":" + i);
try {
- this.c = new NetworkListenThread(this, inetaddress, i);
+ this.networkListenThread = new NetworkListenThread(this, inetaddress, i);
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
- a.warning("**** FAILED TO BIND TO PORT!");
- a.log(Level.WARNING, "The exception was: " + ioexception.toString());
- a.warning("Perhaps a server is already running on that port?");
+ log.warning("**** FAILED TO BIND TO PORT!");
+ log.log(Level.WARNING, "The exception was: " + ioexception.toString());
+ log.warning("Perhaps a server is already running on that port?");
return false;
}
- if (!this.l) {
- a.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- a.warning("The server will make no attempt to authenticate usernames. Beware.");
- a.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
- a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
+ if (!this.onlineMode) {
+ log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ log.warning("The server will make no attempt to authenticate usernames. Beware.");
+ log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ log.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
}
- this.f = new ServerConfigurationManager(this);
- this.k = new EntityTracker(this);
+ this.serverConfigurationManager = new ServerConfigurationManager(this);
+ this.tracker = new EntityTracker(this);
long j = System.nanoTime();
- String s1 = this.d.a("level-name", "world");
- String s2 = this.d.a("level-seed", "");
+ String s1 = this.propertyManager.getString("level-name", "world");
+ String s2 = this.propertyManager.getString("level-seed", "");
long k = (new Random()).nextLong();
if (s2.length() > 0) {
@@ -138,41 +138,41 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
}
- a.info("Preparing level \"" + s1 + "\"");
+ log.info("Preparing level \"" + s1 + "\"");
this.a(new WorldLoaderServer(new File(".")), s1, k);
// CraftBukkit start
long elapsed = System.nanoTime() - j;
String time = String.format( "%.3fs", elapsed / 10000000000.0D );
- a.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
+ log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
// CraftBukkit end
return true;
}
private void a(Convertable convertable, String s, long i) {
- if (convertable.a(s)) {
- a.info("Converting map!");
- convertable.a(s, new ConvertProgressUpdater(this));
+ if (convertable.isConvertable(s)) {
+ log.info("Converting map!");
+ convertable.convert(s, new ConvertProgressUpdater(this));
}
- a.info("Preparing start region");
+ log.info("Preparing start region");
// CraftBukkit start
- WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0, i);
- world.a(new WorldManager(this, world));
- world.j = this.d.a("spawn-monsters", true) ? 1 : 0;
- world.a(this.d.a("spawn-monsters", true), this.m);
- this.f.a(world);
+ WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.propertyManager.getBoolean("hellworld", false) ? -1 : 0, i);
+ world.addIWorldAccess(new WorldManager(this, world));
+ world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0;
+ world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
+ this.serverConfigurationManager.setPlayerFileData(world);
worlds.add(world);
// CraftBukkit end
short short1 = 196;
long j = System.currentTimeMillis();
- ChunkCoordinates chunkcoordinates = worlds.get(0).m(); // CraftBukkit
+ ChunkCoordinates chunkcoordinates = world.getSpawn(); // CraftBukkit
- for (int k = -short1; k <= short1 && this.p; k += 16) {
- for (int l = -short1; l <= short1 && this.p; l += 16) {
+ for (int k = -short1; k <= short1 && this.isRunning; k += 16) {
+ for (int l = -short1; l <= short1 && this.isRunning; l += 16) {
long i1 = System.currentTimeMillis();
if (i1 < j) {
@@ -189,9 +189,9 @@ public class MinecraftServer implements Runnable, ICommandListener {
// CraftBukkit start
for (WorldServer worldserver: worlds) {
- world.u.c(chunkcoordinates.a + k >> 4, chunkcoordinates.c + l >> 4);
+ world.chunkProviderServer.getChunkAt(chunkcoordinates.x + k >> 4, chunkcoordinates.z + l >> 4);
- while (world.f() && this.p) {
+ while (world.doLighting() && this.isRunning) {
;
}
}
@@ -205,7 +205,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
private void a(String s, int i) {
this.i = s;
this.j = i;
- a.info(s + ": " + i + "%");
+ log.info(s + ": " + i + "%");
}
private void e() {
@@ -215,66 +215,66 @@ public class MinecraftServer implements Runnable, ICommandListener {
server.loadPlugins(); // CraftBukkit
}
- void f() { // CraftBukkit - private -> default
- a.info("Saving chunks");
+ void saveChunks() { // CraftBukkit - private -> default
+ log.info("Saving chunks");
// CraftBukkit start
for (WorldServer world: worlds) {
- world.a(true, (IProgressUpdate) null);
- world.t();
+ world.save(true, (IProgressUpdate) null);
+ world.saveLevel();
WorldSaveEvent event = new WorldSaveEvent( world.getWorld() );
server.getPluginManager().callEvent( event );
}
- this.f.d(); // CraftBukkit - player data should be saved whenever a save happens.
+ this.serverConfigurationManager.savePlayers(); // CraftBukkit - player data should be saved whenever a save happens.
// CraftBukkit end
}
- public void g() { // Craftbukkit: private -> public
- a.info("Stopping server");
+ public void stop() { // Craftbukkit: private -> public
+ log.info("Stopping server");
// CraftBukkit start
if (server != null) {
server.disablePlugins();
}
// CraftBukkit end
- if (this.f != null) {
- this.f.d();
+ if (this.serverConfigurationManager != null) {
+ this.serverConfigurationManager.savePlayers();
}
if (this.worlds.size() > 0) { // CraftBukkit
- this.f();
+ this.saveChunks();
}
}
public void a() {
- this.p = false;
+ this.isRunning = false;
}
public void run() {
try {
- if (this.d()) {
+ if (this.init()) {
long i = System.currentTimeMillis();
- for (long j = 0L; this.p; Thread.sleep(1L)) {
+ for (long j = 0L; this.isRunning; Thread.sleep(1L)) {
long k = System.currentTimeMillis();
long l = k - i;
if (l > 2000L) {
- a.warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
+ log.warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
l = 2000L;
}
if (l < 0L) {
- a.warning("Time ran backwards! Did the system time change?");
+ log.warning("Time ran backwards! Did the system time change?");
l = 0L;
}
j += l;
i = k;
// CraftBukkit - TODO - Replace with loop?
- if (this.worlds.size() > 0 && this.worlds.get(0).s()) {
+ if (this.worlds.size() > 0 && this.worlds.get(0).everyoneDeeplySleeping()) {
this.h();
j = 0L;
} else {
@@ -285,7 +285,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
}
} else {
- while (this.p) {
+ while (this.isRunning) {
this.b();
try {
@@ -297,9 +297,9 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
} catch (Throwable throwable) {
throwable.printStackTrace();
- a.log(Level.SEVERE, "Unexpected exception", throwable);
+ log.log(Level.SEVERE, "Unexpected exception", throwable);
- while (this.p) {
+ while (this.isRunning) {
this.b();
try {
@@ -310,8 +310,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
} finally {
try {
- this.g();
- this.g = true;
+ this.stop();
+ this.isStopped = true;
} catch (Throwable throwable1) {
throwable1.printStackTrace();
} finally {
@@ -343,31 +343,31 @@ public class MinecraftServer implements Runnable, ICommandListener {
AxisAlignedBB.a();
Vec3D.a();
- ++this.h;
+ ++this.ticks;
// CraftBukkit start
- if (this.h % 20 == 0) {
- for (int i = 0; i < this.f.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i);
- entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.l())));
+ if (this.ticks % 20 == 0) {
+ for (int i = 0; i < this.serverConfigurationManager.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i);
+ entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime()));
}
}
- ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h);
+ ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.ticks);
for (WorldServer world: worlds) {
- world.h();
+ world.doTick();
- while (world.f()) {
+ while (world.doLighting()) {
;
}
- world.e();
+ world.cleanUp();
}
// CraftBukkit end
- this.c.a();
- this.f.b();
- this.k.a();
+ this.networkListenThread.a();
+ this.serverConfigurationManager.b();
+ this.tracker.a();
for (j = 0; j < this.q.size(); ++j) {
((IUpdatePlayerListBox) this.q.get(j)).a();
@@ -376,11 +376,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
try {
this.b();
} catch (Exception exception) {
- a.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
+ log.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
}
}
- public void a(String s, ICommandListener icommandlistener) {
+ public void issueCommand(String s, ICommandListener icommandlistener) {
this.r.add(new ServerCommand(s, icommandlistener));
}
@@ -388,8 +388,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
while (this.r.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.r.remove(0);
+ // this.consoleCommandHandler.a(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand
server.dispatchCommand(console, servercommand); // CraftBukkit
- // this.o.a(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand
}
}
@@ -405,7 +405,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
(new ThreadServerApplication("Server thread", minecraftserver)).start();
} catch (Exception exception) {
- a.log(Level.SEVERE, "Failed to start the minecraft server", exception);
+ log.log(Level.SEVERE, "Failed to start the minecraft server", exception);
}
}
@@ -413,19 +413,19 @@ public class MinecraftServer implements Runnable, ICommandListener {
return new File(s);
}
- public void b(String s) {
- a.info(s);
+ public void sendMessage(String s) {
+ log.info(s);
}
public void c(String s) {
- a.warning(s);
+ log.warning(s);
}
- public String c() {
+ public String getName() {
return "CONSOLE";
}
- public static boolean a(MinecraftServer minecraftserver) {
- return minecraftserver.p;
+ public static boolean isRunning(MinecraftServer minecraftserver) {
+ return minecraftserver.isRunning;
}
}
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java
index f155254a..97557a12 100644
--- a/src/main/java/net/minecraft/server/NetLoginHandler.java
+++ b/src/main/java/net/minecraft/server/NetLoginHandler.java
@@ -8,23 +8,23 @@ public class NetLoginHandler extends NetHandler {
public static Logger a = Logger.getLogger("Minecraft");
private static Random d = new Random();
- public NetworkManager b;
+ public NetworkManager networkManager;
public boolean c = false;
- private MinecraftServer e;
+ private MinecraftServer server;
private int f = 0;
private String g = null;
private Packet1Login h = null;
private String i = "";
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) {
- this.e = minecraftserver;
- this.b = new NetworkManager(socket, s, this);
- this.b.d = 0;
+ this.server = minecraftserver;
+ this.networkManager = new NetworkManager(socket, s, this);
+ this.networkManager.d = 0;
}
-
+
// CraftBukkit start
public Socket getSocket() {
- return b.f;
+ return networkManager.socket;
}
// CraftBukkit end
@@ -35,17 +35,17 @@ public class NetLoginHandler extends NetHandler {
}
if (this.f++ == 600) {
- this.a("Took too long to log in");
+ this.disconnect("Took too long to log in");
} else {
- this.b.a();
+ this.networkManager.a();
}
}
- public void a(String s) {
+ public void disconnect(String s) {
try {
a.info("Disconnecting " + this.b() + ": " + s);
- this.b.a((Packet) (new Packet255KickDisconnect(s)));
- this.b.c();
+ this.networkManager.a((Packet) (new Packet255KickDisconnect(s)));
+ this.networkManager.c();
this.c = true;
} catch (Exception exception) {
exception.printStackTrace();
@@ -53,50 +53,47 @@ public class NetLoginHandler extends NetHandler {
}
public void a(Packet2Handshake packet2handshake) {
- if (this.e.l) {
+ if (this.server.onlineMode) {
this.i = Long.toHexString(d.nextLong());
- this.b.a((Packet) (new Packet2Handshake(this.i)));
+ this.networkManager.a((Packet) (new Packet2Handshake(this.i)));
} else {
- this.b.a((Packet) (new Packet2Handshake("-")));
+ this.networkManager.a((Packet) (new Packet2Handshake("-")));
}
}
public void a(Packet1Login packet1login) {
- this.g = packet1login.b;
+ this.g = packet1login.name;
if (packet1login.a != 10) {
if (packet1login.a > 10) {
- this.a("Outdated server!");
+ this.disconnect("Outdated server!");
} else {
- this.a("Outdated client!");
+ this.disconnect("Outdated client!");
}
} else {
- if (!this.e.l) {
+ if (!this.server.onlineMode) {
this.b(packet1login);
} else {
- (new ThreadLoginVerifier(this, packet1login, e.server)).start();
+ (new ThreadLoginVerifier(this, packet1login, this.server.server)).start();
}
}
}
public void b(Packet1Login packet1login) {
- EntityPlayer entityplayer = this.e.f.a(this, packet1login.b, packet1login.c);
+ EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name, packet1login.c);
if (entityplayer != null) {
a.info(this.b() + " logged in with entity id " + entityplayer.id);
- NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer);
-
- // CraftBukkit start
- ChunkCoordinates chunkcoordinates = entityplayer.world.m();
- netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.k(), (byte) entityplayer.world.m.g)));
- netserverhandler.b((Packet) (new Packet6SpawnPosition(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c)));
- // this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game."))); // CraftBukkit - message moved to join event
- this.e.f.a(entityplayer);
- netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
- this.e.c.a(netserverhandler);
- netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.l())));
- // CraftBukkit end
+ ChunkCoordinates chunkcoordinates = entityplayer.world.getSpawn(); // CraftBukkit
+ NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
- entityplayer.m();
+ netserverhandler.sendPacket(new Packet1Login("", "", entityplayer.id, entityplayer.world.getSeed(), (byte) entityplayer.world.worldProvider.dimension)); // CraftBukkit
+ netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
+ // this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
+ this.server.serverConfigurationManager.a(entityplayer);
+ netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
+ this.server.networkListenThread.a(netserverhandler);
+ netserverhandler.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime())); // CraftBukkit
+ entityplayer.syncInventory();
}
this.c = true;
@@ -108,11 +105,11 @@ public class NetLoginHandler extends NetHandler {
}
public void a(Packet packet) {
- this.a("Protocol error");
+ this.disconnect("Protocol error");
}
public String b() {
- return this.g != null ? this.g + " [" + this.b.b().toString() + "]" : this.b.b().toString();
+ return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
}
static String a(NetLoginHandler netloginhandler) {
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 449df13d..8734ec9b 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -24,25 +24,25 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private static final int PLACE_DISTANCE_SQUARED = 6 * 6; // CraftBukkit here for now
public static Logger a = Logger.getLogger("Minecraft");
- public NetworkManager b;
- public boolean c = false;
- private MinecraftServer d;
- public EntityPlayer e; // CraftBukkit - private->public
+ public NetworkManager networkManager;
+ public boolean disconnected = false;
+ private MinecraftServer minecraftServer;
+ public EntityPlayer player; // CraftBukkit - private->public
private int f;
private int g;
private boolean h;
- private double i;
- private double j;
- private double k;
+ private double x;
+ private double y;
+ private double z;
private boolean l = true;
private Map m = new HashMap();
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
- this.d = minecraftserver;
- this.b = networkmanager;
+ this.minecraftServer = minecraftserver;
+ this.networkManager = networkmanager;
networkmanager.a((NetHandler) this);
- this.e = entityplayer;
- entityplayer.a = this;
+ this.player = entityplayer;
+ entityplayer.netServerHandler = this;
// CraftBukkit start
server = minecraftserver.server;
@@ -63,42 +63,42 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private int lastMaterial;
public CraftPlayer getPlayer() {
- return (e == null) ? null : (CraftPlayer) e.getBukkitEntity();
+ return (this.player == null) ? null : (CraftPlayer) player.getBukkitEntity();
}
// CraftBukkit end
public void a() {
this.h = false;
- this.b.a();
+ this.networkManager.a();
if (this.f - this.g > 20) {
- this.b((Packet) (new Packet0KeepAlive()));
+ this.sendPacket(new Packet0KeepAlive());
}
}
- public void a(String s) {
+ public void disconnect(String s) {
// CraftBukkit start
- String leaveMessage = "\u00A7e" + this.e.name + " left the game.";
- PlayerKickEvent event = new PlayerKickEvent(server.getPlayer(this.e), s, leaveMessage);
+ String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
+ PlayerKickEvent event = new PlayerKickEvent(server.getPlayer(this.player), s, leaveMessage);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
- this.b.a((Packet) (new Packet255KickDisconnect( event.getReason() )));
- this.b.c();
+ this.sendPacket(new Packet255KickDisconnect( event.getReason() ));
+ this.networkManager.c();
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null) {
- this.d.f.a((Packet) (new Packet3Chat(leaveMessage)));
+ this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
}
// CraftBukkit end
- this.d.f.c(this.e);
- this.c = true;
+ this.minecraftServer.serverConfigurationManager.disconnect(this.player);
+ this.disconnected = true;
}
public void a(Packet27 packet27) {
- this.e.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f());
+ this.player.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f());
}
public void a(Packet10Flying packet10flying) {
@@ -106,8 +106,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d0;
if (!this.l) {
- d0 = packet10flying.b - this.j;
- if (packet10flying.a == this.i && d0 * d0 < 0.01D && packet10flying.c == this.k) {
+ d0 = packet10flying.y - this.y;
+ if (packet10flying.x == this.x && d0 * d0 < 0.01D && packet10flying.z == this.z) {
this.l = true;
}
}
@@ -118,8 +118,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Location to = player.getLocation();
// Prevent 40 event-calls for less than a single pixel of movement >.>
- double delta = Math.pow( this.lastPosX - this.i, 2) + Math.pow( this.lastPosY - this.j, 2) + Math.pow( this.lastPosZ - this.k, 2);
- float deltaAngle = Math.abs(this.lastYaw - this.e.yaw) + Math.abs(this.lastPitch - this.e.pitch);
+ double delta = Math.pow( this.lastPosX - this.x, 2) + Math.pow( this.lastPosY - this.y, 2) + Math.pow( this.lastPosZ - this.z, 2);
+ float deltaAngle = Math.abs(this.lastYaw - this.player.yaw) + Math.abs(this.lastPitch - this.player.pitch);
if (delta > 1f/256 || deltaAngle > 10f) {
// Skip the first time we do this
@@ -130,45 +130,45 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
from = event.getFrom();
to = event.isCancelled() ? from : event.getTo();
- this.e.locX = to.getX();
- this.e.locY = to.getY();
- this.e.locZ = to.getZ();
- this.e.yaw = to.getYaw();
- this.e.pitch = to.getPitch();
+ this.player.locX = to.getX();
+ this.player.locY = to.getY();
+ this.player.locZ = to.getZ();
+ this.player.yaw = to.getYaw();
+ this.player.pitch = to.getPitch();
}
- this.lastPosX = this.e.locX;
- this.lastPosY = this.e.locY;
- this.lastPosZ = this.e.locZ;
- this.lastYaw = this.e.yaw;
- this.lastPitch = this.e.pitch;
+ this.lastPosX = this.player.locX;
+ this.lastPosY = this.player.locY;
+ this.lastPosZ = this.player.locZ;
+ this.lastYaw = this.player.yaw;
+ this.lastPitch = this.player.pitch;
}
- if (Math.abs(packet10flying.a) > 32000000 || Math.abs(packet10flying.c) > 32000000) {
+ if (Math.abs(packet10flying.x) > 32000000 || Math.abs(packet10flying.z) > 32000000) {
System.err.println(player.getName() + " was caught trying to crash the server with an invalid position.");
player.kickPlayer("Nope!");
return;
}
- if (Double.isNaN(packet10flying.a) || packet10flying.a == Double.POSITIVE_INFINITY || packet10flying.a == Double.NEGATIVE_INFINITY) {
+ if (Double.isNaN(packet10flying.x) || packet10flying.x == Double.POSITIVE_INFINITY || packet10flying.x == Double.NEGATIVE_INFINITY) {
System.err.println(player.getName() + " was caught trying to set an invalid position.");
player.kickPlayer("Nope!");
return;
}
- if (Double.isNaN(packet10flying.b) || packet10flying.b == Double.POSITIVE_INFINITY || packet10flying.b == Double.NEGATIVE_INFINITY) {
+ if (Double.isNaN(packet10flying.y) || packet10flying.y == Double.POSITIVE_INFINITY || packet10flying.y == Double.NEGATIVE_INFINITY) {
System.err.println(player.getName() + " was caught trying to set an invalid position.");
player.kickPlayer("Nope!");
return;
}
- if (Double.isNaN(packet10flying.c) || packet10flying.c == Double.POSITIVE_INFINITY || packet10flying.c == Double.NEGATIVE_INFINITY) {
+ if (Double.isNaN(packet10flying.z) || packet10flying.z == Double.POSITIVE_INFINITY || packet10flying.z == Double.NEGATIVE_INFINITY) {
System.err.println(player.getName() + " was caught trying to set an invalid position.");
player.kickPlayer("Nope!");
return;
}
- if (Double.isNaN(packet10flying.d) || packet10flying.d == Double.POSITIVE_INFINITY || packet10flying.d == Double.NEGATIVE_INFINITY) {
+ if (Double.isNaN(packet10flying.stance) || packet10flying.stance == Double.POSITIVE_INFINITY || packet10flying.stance == Double.NEGATIVE_INFINITY) {
System.err.println(player.getName() + " was caught trying to set an invalid position.");
player.kickPlayer("Nope!");
return;
@@ -181,133 +181,133 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d3;
double d4;
- if (this.e.vehicle != null) {
- float f = this.e.yaw;
- float f1 = this.e.pitch;
+ if (this.player.vehicle != null) {
+ float f = this.player.yaw;
+ float f1 = this.player.pitch;
- this.e.vehicle.h_();
- d1 = this.e.locX;
- d2 = this.e.locY;
- d3 = this.e.locZ;
+ this.player.vehicle.h_();
+ d1 = this.player.locX;
+ d2 = this.player.locY;
+ d3 = this.player.locZ;
double d5 = 0.0D;
d4 = 0.0D;
- if (packet10flying.i) {
- f = packet10flying.e;
- f1 = packet10flying.f;
+ if (packet10flying.hasLook) {
+ f = packet10flying.yaw;
+ f1 = packet10flying.pitch;
}
- if (packet10flying.h && packet10flying.b == -999.0D && packet10flying.d == -999.0D) {
- d5 = packet10flying.a;
- d4 = packet10flying.c;
+ if (packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
+ d5 = packet10flying.x;
+ d4 = packet10flying.z;
}
- this.e.onGround = packet10flying.g;
- this.e.a(true);
- this.e.c(d5, 0.0D, d4);
- this.e.b(d1, d2, d3, f, f1);
- this.e.motX = d5;
- this.e.motZ = d4;
- if (this.e.vehicle != null) {
+ this.player.onGround = packet10flying.g;
+ this.player.a(true);
+ this.player.move(d5, 0.0D, d4);
+ this.player.setLocation(d1, d2, d3, f, f1);
+ this.player.motX = d5;
+ this.player.motZ = d4;
+ if (this.player.vehicle != null) {
// CraftBukkit
- ((WorldServer) this.e.world).b(this.e.vehicle, true);
+ ((WorldServer) this.player.world).vehicleEnteredWorld(this.player.vehicle, true);
}
- if (this.e.vehicle != null) {
- this.e.vehicle.h_();
+ if (this.player.vehicle != null) {
+ this.player.vehicle.h_();
}
- this.d.f.b(this.e);
- this.i = this.e.locX;
- this.j = this.e.locY;
- this.k = this.e.locZ;
+ this.minecraftServer.serverConfigurationManager.b(this.player);
+ this.x = this.player.locX;
+ this.y = this.player.locY;
+ this.z = this.player.locZ;
// CraftBukkit
- this.e.world.f(this.e);
+ ((WorldServer) this.player.world).playerJoinedWorld(this.player);
return;
}
- d0 = this.e.locY;
- this.i = this.e.locX;
- this.j = this.e.locY;
- this.k = this.e.locZ;
- d1 = this.e.locX;
- d2 = this.e.locY;
- d3 = this.e.locZ;
- float f2 = this.e.yaw;
- float f3 = this.e.pitch;
+ d0 = this.player.locY;
+ this.x = this.player.locX;
+ this.y = this.player.locY;
+ this.z = this.player.locZ;
+ d1 = this.player.locX;
+ d2 = this.player.locY;
+ d3 = this.player.locZ;
+ float f2 = this.player.yaw;
+ float f3 = this.player.pitch;
- if (packet10flying.h && packet10flying.b == -999.0D && packet10flying.d == -999.0D) {
+ if (packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
packet10flying.h = false;
}
if (packet10flying.h) {
- d1 = packet10flying.a;
- d2 = packet10flying.b;
- d3 = packet10flying.c;
- d4 = packet10flying.d - packet10flying.b;
+ d1 = packet10flying.x;
+ d2 = packet10flying.y;
+ d3 = packet10flying.z;
+ d4 = packet10flying.stance - packet10flying.y;
if (d4 > 1.65D || d4 < 0.1D) {
- this.a("Illegal stance");
- a.warning(this.e.name + " had an illegal stance: " + d4);
+ this.disconnect("Illegal stance");
+ a.warning(this.player.name + " had an illegal stance: " + d4);
d4 = 1.62D; // CraftBukkit - reset the stance to 'the normal' height
}
}
// Craftbukkit start - better fix for invalid position issues; should be fixed in 1.5
- d4 = d1 - this.e.locX;
- double d6 = d2 - this.e.locY;
- double d7 = d3 - this.e.locZ;
+ d4 = d1 - this.player.locX;
+ double d6 = d2 - this.player.locY;
+ double d7 = d3 - this.player.locZ;
float f4 = 0.0625F;
- if (d6 > -0.5D || d6 < 0.5D) {
+ if (d6 > -0.5D || d6 < 0.5D) {
d6 = 0.0D;
}
- d7 = d3 - this.e.locZ;
+ d7 = d3 - this.player.locZ;
double d8 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false;
- if (d8 > 6.25D && !this.e.F()) {
+ if (d8 > 6.25D && !this.player.isSleeping()) {
flag1 = true;
- a.warning(this.e.name + " was caught moving faster than the maximum allowed speed. Possible malicious activity?");
- this.a(this.i, this.j, this.k, f2, f3);
- return;
+ a.warning(this.player.name + " moved wrongly!");
+ System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
+ System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ);
}
- this.e.c(d4, d6, d7);
- d4 = d1 - this.e.locX;
- d6 = d2 - this.e.locY;
+ this.player.move(d4, d6, d7);
+ d4 = d1 - this.player.locX;
+ d6 = d2 - this.player.locY;
if (d6 > -0.5D || d6 < 0.5D) {
d6 = 0.0D;
}
- d7 = d3 - this.e.locZ;
+ d7 = d3 - this.player.locZ;
- if (packet10flying.i) {
- f2 = packet10flying.e;
- f3 = packet10flying.f;
+ if (packet10flying.hasLook) {
+ f2 = packet10flying.yaw;
+ f3 = packet10flying.pitch;
}
// Craftbukkit end
- this.e.a(true);
- this.e.bl = 0.0F;
- this.e.b(this.i, this.j, this.k, f2, f3);
+ this.player.a(true);
+ this.player.bl = 0.0F;
+ this.player.setLocation(this.x, this.y, this.z, f2, f3);
// CraftBukkit
- boolean flag = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0;
+ boolean flag = ((WorldServer) this.player.world).getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
- this.e.b(d1, d2, d3, f2, f3);
+ this.player.setLocation(d1, d2, d3, f2, f3);
// CraftBukkit
- boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0;
+ boolean flag2 = ((WorldServer) this.player.world).getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
- if (flag && (flag1 || !flag2) && !this.e.F()) {
- this.a(this.i, this.j, this.k, f2, f3);
+ if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
+ this.a(this.x, this.y, this.z, f2, f3);
return;
}
- this.e.onGround = packet10flying.g;
- this.d.f.b(this.e);
- this.e.b(this.e.locY - d0, packet10flying.g);
+ this.player.onGround = packet10flying.g;
+ this.minecraftServer.serverConfigurationManager.b(this.player);
+ this.player.b(this.player.locY - d0, packet10flying.g);
}
}
@@ -340,11 +340,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
this.l = false;
- this.i = d0;
- this.j = d1;
- this.k = d2;
- this.e.b(d0, d1, d2, f, f1);
- this.e.a.b((Packet) (new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)));
+ this.x = d0;
+ this.y = d1;
+ this.z = d2;
+ this.player.setLocation(d0, d1, d2, f, f1);
+ this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
// CraftBukkit -- Returns TRUE if the teleport was successful
return !event.isCancelled();
@@ -352,10 +352,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet14BlockDig packet14blockdig) {
if (packet14blockdig.e == 4) {
- this.e.z();
+ this.player.z();
} else {
// CraftBukkit
- boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name);
+ boolean flag = ((WorldServer) this.player.world).weirdIsOpCache = this.minecraftServer.serverConfigurationManager.isOp(this.player.name);
boolean flag1 = false;
if (packet14blockdig.e == 0) {
@@ -371,9 +371,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int k = packet14blockdig.c;
if (flag1) {
- double d0 = this.e.locX - ((double) i + 0.5D);
- double d1 = this.e.locY - ((double) j + 0.5D);
- double d2 = this.e.locZ - ((double) k + 0.5D);
+ double d0 = this.player.locX - ((double) i + 0.5D);
+ double d1 = this.player.locY - ((double) j + 0.5D);
+ double d2 = this.player.locZ - ((double) k + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) {
@@ -382,9 +382,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
// CraftBukkit
- ChunkCoordinates chunkcoordinates = this.e.world.m();
- int l = (int) MathHelper.e((float) (i - chunkcoordinates.a));
- int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
+ ChunkCoordinates chunkcoordinates = ((WorldServer) this.player.world).getSpawn();
+ int l = (int) MathHelper.abs((float) (i - chunkcoordinates.x));
+ int i1 = (int) MathHelper.abs((float) (k - chunkcoordinates.z));
if (l > i1) {
i1 = l;
@@ -392,26 +392,26 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet14blockdig.e == 0) {
// CraftBukkit
- if (i1 > this.d.spawnProtection || flag) {
+ if (i1 > this.minecraftServer.spawnProtection || flag) {
// CraftBukkit add face argument
- this.e.c.a(i, j, k, packet14blockdig.d);
+ this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
}
} else if (packet14blockdig.e == 2) {
- this.e.c.b(i, j, k);
+ this.player.itemInWorldManager.b(i, j, k);
} else if (packet14blockdig.e == 3) {
- double d4 = this.e.locX - ((double) i + 0.5D);
- double d5 = this.e.locY - ((double) j + 0.5D);
- double d6 = this.e.locZ - ((double) k + 0.5D);
+ double d4 = this.player.locX - ((double) i + 0.5D);
+ double d5 = this.player.locY - ((double) j + 0.5D);
+ double d6 = this.player.locZ - ((double) k + 0.5D);
double d7 = d4 * d4 + d5 * d5 + d6 * d6;
if (d7 < 256.0D) {
// CraftBukkit
- this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
+ this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.player.world));
}
}
// CraftBukkit
- ((WorldServer) this.e.world).v = false;
+ ((WorldServer) this.player.world).weirdIsOpCache = false;
}
}
@@ -425,14 +425,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// second one. This sadly has to remain until Mojang makes their packets saner. :(
// -- Grum
- if (packet15place.d == 255) {
- if (packet15place.e != null && packet15place.e.id == lastMaterial && lastPacket != null && packet15place.j - lastPacket < 100) {
+ if (packet15place.face == 255) {
+ if (packet15place.itemstack != null && packet15place.itemstack.id == lastMaterial && lastPacket != null && packet15place.timestamp - lastPacket < 100) {
lastPacket = null;
return;
}
} else {
- lastMaterial = packet15place.e == null ? -1 : packet15place.e.id;
- lastPacket = packet15place.j;
+ lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
+ lastPacket = packet15place.timestamp;
}
// CraftBukkit if rightclick decremented the item, always send the update packet.
@@ -442,20 +442,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
- ItemStack itemstack = this.e.inventory.b();
+ ItemStack itemstack = this.player.inventory.getItemInHand();
+ // boolean flag = this.minecraftServer.worldServer.weirdIsOpCache = this.minecraftServer.serverConfigurationManager.isOp(this.player.name);
- // boolean flag = this.d.e.v = this.d.f.h(this.e.name); // CraftBukkit
-
- if (packet15place.d == 255) {
+ if (packet15place.face == 255) {
if (itemstack == null) {
return;
}
// CraftBukkit start
int itemstackAmount = itemstack.count;
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack);
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack);
if (event.useItemInHand() != Event.Result.DENY) {
- this.e.c.a(this.e, this.e.world, itemstack);
+ this.player.itemInWorldManager.useItem(this.player, this.player.world, itemstack);
}
// CraftBukkit notch decrements the counter by 1 in the above method with food,
@@ -467,12 +466,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int i = packet15place.a;
int j = packet15place.b;
int k = packet15place.c;
- int l = packet15place.d;
-
- // CraftBukkit
- ChunkCoordinates chunkcoordinates = this.e.world.m();
- int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
- int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
+ int l = packet15place.face;
+ ChunkCoordinates chunkcoordinates = ((WorldServer) this.player.world).getSpawn(); // CraftBukkit
+ int i1 = (int) MathHelper.abs((float) (i - chunkcoordinates.x));
+ int j1 = (int) MathHelper.abs((float) (k - chunkcoordinates.z));
if (i1 > j1) {
j1 = i1;
@@ -485,8 +482,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
- this.e.c.a(this.e, this.e.world, itemstack, i, j, k, l);
- this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
+ this.player.itemInWorldManager.interact(this.player, this.player.world, itemstack, i, j, k, l);
+ this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.player.world));
// CraftBukkit end
if (l == 0) {
@@ -514,78 +511,75 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
// CraftBukkit
- this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
+ this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.player.world));
}
if (itemstack != null && itemstack.count == 0) {
- this.e.inventory.a[this.e.inventory.c] = null;
+ this.player.inventory.items[this.player.inventory.itemInHandIndex] = null;
}
- this.e.h = true;
- this.e.inventory.a[this.e.inventory.c] = ItemStack.b(this.e.inventory.a[this.e.inventory.c]);
- Slot slot = this.e.activeContainer.a(this.e.inventory, this.e.inventory.c);
-
- this.e.activeContainer.a();
- this.e.h = false;
+ this.player.h = true;
+ this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
+ Slot slot = this.player.activeContainer.a(this.player.inventory, this.player.inventory.itemInHandIndex);
- // CraftBukkit
- if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) {
- this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.a, this.e.inventory.b())));
+ this.player.activeContainer.a();
+ this.player.h = false;
+ if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) { // CraftBukkit
+ this.sendPacket(new Packet103SetSlot(this.player.activeContainer.f, slot.a, this.player.inventory.getItemInHand()));
}
// CraftBukkit
- ((WorldServer) this.e.world).v = false;
+ ((WorldServer) this.player.world).weirdIsOpCache = false;
}
public void a(String s, Object[] aobject) {
- // CraftBukkit start -- rarely it would send a disconnect line twice
- if (!this.c) {
- a.info(this.e.name + " lost connection: " + s);
- String quitMessage = this.d.f.c(this.e);
- if (quitMessage != null) {
- this.d.f.a((Packet) (new Packet3Chat(quitMessage)));
- }
- }
- // CraftBukkit end
- this.c = true;
+ if (this.disconnected) return; // CraftBukkit -- rarely it would send a disconnect line twice
+
+ a.info(this.player.name + " lost connection: " + s);
+ this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + this.player.name + " left the game."));
+ this.minecraftServer.serverConfigurationManager.disconnect(this.player);
+ this.disconnected = true;
}
public void a(Packet packet) {
a.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
- this.a("Protocol error, unexpected packet");
+ this.disconnect("Protocol error, unexpected packet");
}
- public void b(Packet packet) {
+ public void sendPacket(Packet packet) {
// CraftBukkit
if (packet instanceof Packet6SpawnPosition) {
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
- this.e.compassTarget = new Location(getPlayer().getWorld(), packet6.a, packet6.b, packet6.c);
+ this.player.compassTarget = new Location(getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
}
// CraftBukkit
- this.b.a(packet);
+ this.networkManager.a(packet);
this.g = this.f;
}
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
- // CraftBukkit start
- PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), e.inventory.c, packet16blockitemswitch.a);
- server.getPluginManager().callEvent(event);
- // CraftBukkit end
-
- this.e.inventory.c = packet16blockitemswitch.a;
+ if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.e()) {
+ // CraftBukkit start
+ PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
+ server.getPluginManager().callEvent(event);
+ // CraftBukkit end
+ this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
+ } else {
+ a.warning(this.player.name + " tried to set an invalid carried item");
+ }
}
public void a(Packet3Chat packet3chat) {
String s = packet3chat.a;
if (s.length() > 100) {
- this.a("Chat message too long");
+ this.disconnect("Chat message too long");
} else {
s = s.trim();
for (int i = 0; i < s.length(); ++i) {
if (FontAllowedCharacters.a.indexOf(s.charAt(i)) < 0) {
- this.a("Illegal characters in chat");
+ this.disconnect("Illegal characters in chat");
return;
}
}
@@ -597,7 +591,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public boolean chat(String msg) {
if (msg.startsWith("/")) {
- this.c(msg);
+ this.handleCommand(msg);
return true;
} else {
// CraftBukkit start
@@ -621,7 +615,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
// CraftBukkit end
- private void c(String s) {
+ private void handleCommand(String s) {
// CraftBukkit start
CraftPlayer player = getPlayer();
@@ -648,33 +642,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit stop
if (s.toLowerCase().startsWith("/me ")) {
- s = "* " + this.e.name + " " + s.substring(s.indexOf(" ")).trim();
+ s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
a.info(s);
- this.d.f.a((Packet) (new Packet3Chat(s)));
+ this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
} else if (s.toLowerCase().startsWith("/kill")) {
- this.e.a((Entity) null, 1000);
+ this.player.damageEntity((Entity) null, 1000);
} else if (s.toLowerCase().startsWith("/tell ")) {
String[] astring = s.split(" ");
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
- s = "\u00A77" + this.e.name + " whispers " + s;
+ s = "\u00A77" + this.player.name + " whispers " + s;
a.info(s + " to " + astring[1]);
- if (!this.d.f.a(astring[1], (Packet) (new Packet3Chat(s)))) {
- this.b((Packet) (new Packet3Chat("\u00A7cThere\'s no player by that name online.")));
+ if (!this.minecraftServer.serverConfigurationManager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
+ this.sendPacket(new Packet3Chat("\u00A7cThere\'s no player by that name online."));
}
}
} else {
String s1;
- if (this.d.f.h(this.e.name)) {
+ if (this.minecraftServer.serverConfigurationManager.isOp(this.player.name)) {
s1 = s.substring(1);
- a.info(this.e.name + " issued server command: " + s1);
- this.d.a(s1, this);
+ a.info(this.player.name + " issued server command: " + s1);
+ this.minecraftServer.issueCommand(s1, this);
} else {
s1 = s.substring(1);
- a.info(this.e.name + " tried command: " + s1);
+ a.info(this.player.name + " tried command: " + s1);
}
}
}
@@ -683,25 +677,25 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet18armanimation.b == 1) {
// CraftBukkit -- raytrace to look for 'rogue armswings'
float f = 1.0F;
- float f1 = this.e.lastPitch + (this.e.pitch - this.e.lastPitch) * f;
- float f2 = this.e.lastYaw + (this.e.yaw - this.e.lastYaw) * f;
- double d0 = this.e.lastX + (this.e.locX - this.e.lastX) * (double) f;
- double d1 = this.e.lastY + (this.e.locY - this.e.lastY) * (double) f + 1.62D - (double) this.e.height;
- double d2 = this.e.lastZ + (this.e.locZ - this.e.lastZ) * (double) f;
- Vec3D vec3d = Vec3D.b(d0, d1, d2);
-
- float f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
- float f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
- float f5 = -MathHelper.b(-f1 * 0.017453292F);
- float f6 = MathHelper.a(-f1 * 0.017453292F);
+ float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
+ float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
+ double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f;
+ double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height;
+ double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
+ Vec3D vec3d = Vec3D.create(d0, d1, d2);
+
+ float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
+ float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
- Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
- MovingObjectPosition movingobjectposition = this.e.world.a(vec3d, vec3d1, true);
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
+ MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true);
- if (movingobjectposition == null || movingobjectposition.a != EnumMovingObjectType.TILE) {
- CraftEventFactory.callPlayerInteractEvent(this.e, Action.LEFT_CLICK_AIR, this.e.inventory.b());
+ if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
}
// Arm swing animation
@@ -710,13 +704,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
server.getPluginManager().callEvent(event);
// CraftBukkit end
- this.e.m_();
+ this.player.m_();
}
}
public void a(Packet19EntityAction packet19entityaction) {
- // CraftBukkit: Toggle Sneak
- if (packet19entityaction.b == 1 || packet19entityaction.b == 2) {
+ // CraftBukkit start
+ if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) {
Player player = getPlayer();
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(player);
server.getPluginManager().callEvent(event);
@@ -724,107 +718,109 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
}
- // CraftBukkit: Set Sneaking
+ // CraftBukkit end
- if (packet19entityaction.b == 1) {
- this.e.e(true);
- } else if (packet19entityaction.b == 2) {
- this.e.e(false);
- } else if (packet19entityaction.b == 3) {
- this.e.a(false, true, true);
+ if (packet19entityaction.animation == 1) {
+ this.player.setSneak(true);
+ } else if (packet19entityaction.animation == 2) {
+ this.player.setSneak(false);
+ } else if (packet19entityaction.animation == 3) {
+ this.player.a(false, true, true);
this.l = false;
}
}
public void a(Packet255KickDisconnect packet255kickdisconnect) {
- this.b.a("disconnect.quitting", new Object[0]);
+ this.networkManager.a("disconnect.quitting", new Object[0]);
}
public int b() {
- return this.b.d();
+ return this.networkManager.d();
}
- public void b(String s) {
- this.b((Packet) (new Packet3Chat("\u00A77" + s)));
+ public void sendMessage(String s) {
+ this.sendPacket(new Packet3Chat("\u00A77" + s));
}
- public String c() {
- return this.e.name;
+ public String getName() {
+ return this.player.name;
}
public void a(Packet7UseEntity packet7useentity) {
// CraftBukkit
- Entity entity = ((WorldServer) this.e.world).a(packet7useentity.b);
+ Entity entity = ((WorldServer) this.player.world).getEntity(packet7useentity.target);
- if (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) {
+ if (entity != null && this.player.e(entity) && this.player.f(entity) < 4.0F) {
if (packet7useentity.c == 0) {
- this.e.c(entity);
+ this.player.c(entity);
} else if (packet7useentity.c == 1) {
- this.e.d(entity);
+ this.player.d(entity);
}
}
}
public void a(Packet9Respawn packet9respawn) {
- if (this.e.health <= 0) {
- this.e = this.d.f.d(this.e);
+ if (this.player.health <= 0) {
+ this.player = this.minecraftServer.serverConfigurationManager.d(this.player);
// CraftBukkit start
CraftPlayer player = getPlayer();
- player.setHandle(this.e);
+ player.setHandle(this.player);
// CraftBukkit end
}
}
public void a(Packet101CloseWindow packet101closewindow) {
- this.e.w();
+ this.player.w();
}
public void a(Packet102WindowClick packet102windowclick) {
- if (this.e.activeContainer.f == packet102windowclick.a && this.e.activeContainer.c(this.e)) {
- ItemStack itemstack = this.e.activeContainer.a(packet102windowclick.b, packet102windowclick.c, this.e);
-
- if (ItemStack.a(packet102windowclick.e, itemstack)) {
- this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
- this.e.h = true;
- this.e.activeContainer.a();
- this.e.v();
- this.e.h = false;
+ if (this.player.activeContainer.f == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
+ ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, this.player);
+
+ if (ItemStack.equals(packet102windowclick.e, itemstack)) {
+ this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
+ this.player.h = true;
+ this.player.activeContainer.a();
+ this.player.v();
+ this.player.h = false;
} else {
- this.m.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d));
- this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)));
- this.e.activeContainer.a(this.e, false);
+ this.m.put(Integer.valueOf(this.player.activeContainer.f), Short.valueOf(packet102windowclick.d));
+ this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
+ this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
- for (int i = 0; i < this.e.activeContainer.e.size(); ++i) {
- arraylist.add(((Slot) this.e.activeContainer.e.get(i)).a());
+ for (int i = 0; i < this.player.activeContainer.e.size(); ++i) {
+ arraylist.add(((Slot) this.player.activeContainer.e.get(i)).getItem());
}
- this.e.a(this.e.activeContainer, arraylist);
+ this.player.a(this.player.activeContainer, arraylist);
}
}
}
public void a(Packet106Transaction packet106transaction) {
- Short oshort = (Short) this.m.get(Integer.valueOf(this.e.activeContainer.f));
+ Short oshort = (Short) this.m.get(Integer.valueOf(this.player.activeContainer.f));
- if (oshort != null && packet106transaction.b == oshort.shortValue() && this.e.activeContainer.f == packet106transaction.a && !this.e.activeContainer.c(this.e)) {
- this.e.activeContainer.a(this.e, true);
+ if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.f == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
+ this.player.activeContainer.a(this.player, true);
}
}
public void a(Packet130UpdateSign packet130updatesign) {
// CraftBukkit start
- if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) {
- TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c);
+ if (((WorldServer) this.player.world).isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
+ TileEntity tileentity = ((WorldServer) this.player.world).getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z);
+ // CraftBukkit end
+
if (tileentity instanceof TileEntitySign) {
- TileEntitySign tileentitysign = (TileEntitySign)tileentity;
+ TileEntitySign tileentitysign = (TileEntitySign) tileentity;
+
if (!tileentitysign.a()) {
- this.d.c("Player " + this.e.name + " just tried to change non-editable sign");
+ this.minecraftServer.c("Player " + this.player.name + " just tried to change non-editable sign");
return;
}
}
- // CraftBukkit end
int i;
int j;
@@ -832,31 +828,31 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
for (j = 0; j < 4; ++j) {
boolean flag = true;
- if (packet130updatesign.d[j].length() > 15) {
+ if (packet130updatesign.lines[j].length() > 15) {
flag = false;
} else {
- for (i = 0; i < packet130updatesign.d[j].length(); ++i) {
- if (FontAllowedCharacters.a.indexOf(packet130updatesign.d[j].charAt(i)) < 0) {
+ for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
+ if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
flag = false;
}
}
}
if (!flag) {
- packet130updatesign.d[j] = "!?";
+ packet130updatesign.lines[j] = "!?";
}
}
if (tileentity instanceof TileEntitySign) {
- j = packet130updatesign.a;
- int k = packet130updatesign.b;
+ j = packet130updatesign.x;
+ int k = packet130updatesign.y;
- i = packet130updatesign.c;
+ i = packet130updatesign.z;
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
// CraftBukkit start - SIGN_CHANGE hook
- Player player = server.getPlayer(this.e);
- SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.e), packet130updatesign.d);
+ Player player = server.getPlayer(this.player);
+ SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.player), packet130updatesign.lines);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -869,13 +865,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
for (int l = 0; l < 4; ++l) {
- tileentitysign1.a[l] = event.getLine(l);
+ tileentitysign1.lines[l] = event.getLine(l);
// CraftBukkit
}
- tileentitysign1.i();
+ tileentitysign1.update();
// CraftBukkit
- this.e.world.g(j, k, i);
+ ((WorldServer) this.player.world).notify(i, k, j);
}
}
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 649de1d9..6fd24057 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -2,15 +2,13 @@ package net.minecraft.server;
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
-import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import java.io.IOException; // CraftBukkit
public class NetworkManager {
@@ -18,10 +16,10 @@ public class NetworkManager {
public static int b;
public static int c;
private Object e = new Object();
- public Socket f; // CraftBukkit private->public
+ public Socket socket; // CraftBukkit -- private->public
private final SocketAddress g;
- private DataInputStream h;
- private DataOutputStream i;
+ private DataInputStream input;
+ private DataOutputStream output;
private boolean j = true;
private List k = Collections.synchronizedList(new ArrayList());
private List l = Collections.synchronizedList(new ArrayList());
@@ -39,25 +37,18 @@ public class NetworkManager {
private int w = 50;
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
- this.f = socket;
+ this.socket = socket;
this.g = socket.getRemoteSocketAddress();
this.n = nethandler;
- // Craftbukkit start
try {
- socket.setSoTimeout(30000);
+ socket.setSoTimeout(30000); // Craftbukkit start
socket.setTrafficClass(24);
- } catch (SocketException socketexception) {
+ this.input = new DataInputStream(socket.getInputStream());
+ this.output = new DataOutputStream(socket.getOutputStream());
+ } catch (IOException socketexception) {
System.err.println(socketexception.getMessage());
}
-
- try {
- this.h = new DataInputStream(socket.getInputStream());
- this.i = new DataOutputStream(socket.getOutputStream());
- } catch (IOException ex) {
- Logger.getLogger(NetworkManager.class.getName()).log(Level.SEVERE, null, ex);
- }
- // Craftbukkit end
this.q = new NetworkReaderThread(this, s + " read thread");
this.p = new NetworkWriterThread(this, s + " write thread");
@@ -90,7 +81,7 @@ public class NetworkManager {
Object object;
Packet packet;
- if (!this.l.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.l.get(0)).j >= (long) this.d)) {
+ if (!this.l.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.l.get(0)).timestamp >= (long) this.d)) {
flag = false;
object = this.e;
synchronized (this.e) {
@@ -98,10 +89,10 @@ public class NetworkManager {
this.v -= packet.a() + 1;
}
- Packet.a(packet, this.i);
+ Packet.a(packet, this.output);
}
- if ((flag || this.w-- <= 0) && !this.m.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.m.get(0)).j >= (long) this.d)) {
+ if ((flag || this.w-- <= 0) && !this.m.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.m.get(0)).timestamp >= (long) this.d)) {
flag = false;
object = this.e;
synchronized (this.e) {
@@ -109,7 +100,7 @@ public class NetworkManager {
this.v -= packet.a() + 1;
}
- Packet.a(packet, this.i);
+ Packet.a(packet, this.output);
this.w = 50;
}
@@ -127,7 +118,7 @@ public class NetworkManager {
private void f() {
try {
- Packet packet = Packet.b(this.h);
+ Packet packet = Packet.b(this.input);
if (packet != null) {
this.k.add(packet);
@@ -155,22 +146,22 @@ public class NetworkManager {
this.j = false;
try {
- this.h.close();
- this.h = null;
+ this.input.close();
+ this.input = null;
} catch (Throwable throwable) {
;
}
try {
- this.i.close();
- this.i = null;
+ this.output.close();
+ this.output = null;
} catch (Throwable throwable1) {
;
}
try {
- this.f.close();
- this.f = null;
+ this.socket.close();
+ this.socket = null;
} catch (Throwable throwable2) {
;
}
@@ -203,7 +194,7 @@ public class NetworkManager {
}
}
- public SocketAddress b() {
+ public SocketAddress getSocketAddress() {
return this.g;
}
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index 1e6cdc14..faf80557 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -6,6 +6,7 @@ import java.io.EOFException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+
// Craftbukkit start
import java.net.SocketException;
import java.net.SocketTimeoutException;
@@ -15,7 +16,7 @@ public abstract class Packet {
private static Map a = new HashMap();
private static Map b = new HashMap();
- public final long j = System.currentTimeMillis();
+ public final long timestamp = System.currentTimeMillis();
public boolean k = false;
private static HashMap c;
private static int d;
diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java
index 6fc6cf73..deb8be1a 100644
--- a/src/main/java/net/minecraft/server/PlayerInstance.java
+++ b/src/main/java/net/minecraft/server/PlayerInstance.java
@@ -6,11 +6,11 @@ import java.util.List;
class PlayerInstance {
private List b;
- private int c;
- private int d;
+ private int chunkX;
+ private int chunkZ;
private ChunkCoordIntPair e;
- private short[] f;
- private int g;
+ private short[] dirtyBlocks;
+ private int dirtyCount;
private int h;
private int i;
private int j;
@@ -18,27 +18,27 @@ class PlayerInstance {
private int l;
private int m;
- final PlayerManager a;
+ final PlayerManager playerManager;
public PlayerInstance(PlayerManager playermanager, int i, int j) {
- this.a = playermanager;
+ this.playerManager = playermanager;
this.b = new ArrayList();
- this.f = new short[10];
- this.g = 0;
- this.c = i;
- this.d = j;
+ this.dirtyBlocks = new short[10];
+ this.dirtyCount = 0;
+ this.chunkX = i;
+ this.chunkZ = j;
this.e = new ChunkCoordIntPair(i, j);
// CraftBukkit
- playermanager.world.u.c(i, j);
+ playermanager.world.chunkProviderServer.getChunkAt(i, j);
}
public void a(EntityPlayer entityplayer) {
if (this.b.contains(entityplayer)) {
- throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.c + ", " + this.d);
+ throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.chunkX + ", " + this.chunkZ);
} else {
entityplayer.g.add(this.e);
- entityplayer.a.b((Packet) (new Packet50PreChunk(this.e.a, this.e.b, true)));
+ entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.e.x, this.e.z, true));
this.b.add(entityplayer);
entityplayer.f.add(this.e);
}
@@ -46,31 +46,31 @@ class PlayerInstance {
public void b(EntityPlayer entityplayer) {
if (!this.b.contains(entityplayer)) {
- (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.c + ", " + this.d)).printStackTrace();
+ (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.chunkX + ", " + this.chunkZ)).printStackTrace();
} else {
this.b.remove(entityplayer);
if (this.b.size() == 0) {
- long i = (long) this.c + 2147483647L | (long) this.d + 2147483647L << 32;
+ long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;
- PlayerManager.b(this.a).b(i);
- if (this.g > 0) {
- PlayerManager.c(this.a).remove(this);
+ PlayerManager.b(this.playerManager).b(i);
+ if (this.dirtyCount > 0) {
+ PlayerManager.c(this.playerManager).remove(this);
}
// CraftBukkit
- ((WorldServer) entityplayer.world).u.d(this.c, this.d);
+ ((WorldServer) entityplayer.world).chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
}
entityplayer.f.remove(this.e);
if (entityplayer.g.contains(this.e)) {
- entityplayer.a.b((Packet) (new Packet50PreChunk(this.c, this.d, false)));
+ entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
}
}
}
public void a(int i, int j, int k) {
- if (this.g == 0) {
- PlayerManager.c(this.a).add(this);
+ if (this.dirtyCount == 0) {
+ PlayerManager.c(this.playerManager).add(this);
this.h = this.i = i;
this.j = this.k = j;
this.l = this.m = k;
@@ -100,95 +100,95 @@ class PlayerInstance {
this.m = k;
}
- if (this.g < 10) {
+ if (this.dirtyCount < 10) {
short short1 = (short) (i << 12 | k << 8 | j);
- for (int l = 0; l < this.g; ++l) {
- if (this.f[l] == short1) {
+ for (int l = 0; l < this.dirtyCount; ++l) {
+ if (this.dirtyBlocks[l] == short1) {
return;
}
}
- this.f[this.g++] = short1;
+ this.dirtyBlocks[this.dirtyCount++] = short1;
}
}
- public void a(Packet packet) {
+ public void sendAll(Packet packet) {
for (int i = 0; i < this.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
if (entityplayer.g.contains(this.e)) {
- entityplayer.a.b(packet);
+ entityplayer.netServerHandler.sendPacket(packet);
}
}
}
public void a() {
- if (this.g != 0) {
+ if (this.dirtyCount != 0) {
int i;
int j;
int k;
- if (this.g == 1) {
- i = this.c * 16 + this.h;
+ if (this.dirtyCount == 1) {
+ i = this.chunkX * 16 + this.h;
j = this.j;
- k = this.d * 16 + this.l;
+ k = this.chunkZ * 16 + this.l;
// CraftBukkit start
- this.a((Packet) (new Packet53BlockChange(i, j, k, a.world)));
- if (Block.p[a.world.getTypeId(i, j, k)]) {
- this.a(a.world.getTileEntity(i, j, k));
+ this.sendAll(new Packet53BlockChange(i, j, k, this.playerManager.world));
+ if (Block.isTileEntity[this.playerManager.world.getTypeId(i, j, k)]) {
+ this.sendTileEntity(this.playerManager.world.getTileEntity(i, j, k));
}
// CraftBukkit end
} else {
int l;
- if (this.g == 10) {
+ if (this.dirtyCount == 10) {
this.j = this.j / 2 * 2;
this.k = (this.k / 2 + 1) * 2;
- i = this.h + this.c * 16;
+ i = this.h + this.chunkX * 16;
j = this.j;
- k = this.l + this.d * 16;
+ k = this.l + this.chunkZ * 16;
l = this.i - this.h + 1;
int i1 = this.k - this.j + 2;
int j1 = this.m - this.l + 1;
// CraftBukkit start
- this.a((Packet) (new Packet51MapChunk(i, j, k, l, i1, j1, a.world)));
- List list = a.world.d(i, j, k, i + l, j + i1, k + j1);
+ this.sendAll(new Packet51MapChunk(i, j, k, l, i1, j1, this.playerManager.world));
+ List list = this.playerManager.world.getTileEntities(i, j, k, i + l, j + i1, k + j1);
// CraftBukkit end
for (int k1 = 0; k1 < list.size(); ++k1) {
- this.a((TileEntity) list.get(k1));
+ this.sendTileEntity((TileEntity) list.get(k1));
}
} else {
// CraftBukkit
- this.a((Packet) (new Packet52MultiBlockChange(this.c, this.d, this.f, this.g, a.world)));
+ this.sendAll(new Packet52MultiBlockChange(this.chunkX, this.chunkZ, this.dirtyBlocks, this.dirtyCount, this.playerManager.world));
- for (i = 0; i < this.g; ++i) {
- j = this.c * 16 + (this.g >> 12 & 15);
- k = this.g & 255;
- l = this.d * 16 + (this.g >> 8 & 15);
+ for (i = 0; i < this.dirtyCount; ++i) {
+ j = this.chunkX * 16 + (this.dirtyCount >> 12 & 15);
+ k = this.dirtyCount & 255;
+ l = this.chunkZ * 16 + (this.dirtyCount >> 8 & 15);
// CraftBukkit start
- if (Block.p[a.world.getTypeId(j, k, l)]) {
+ if (Block.isTileEntity[this.playerManager.world.getTypeId(j, k, l)]) {
System.out.println("Sending!");
- this.a(a.world.getTileEntity(j, k, l));
+ this.sendTileEntity(this.playerManager.world.getTileEntity(j, k, l));
}
// CraftBukkit end
}
}
}
- this.g = 0;
+ this.dirtyCount = 0;
}
}
- private void a(TileEntity tileentity) {
+ private void sendTileEntity(TileEntity tileentity) {
if (tileentity != null) {
Packet packet = tileentity.e();
if (packet != null) {
- this.a(packet);
+ this.sendAll(packet);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java
index 4083dcf6..a1eda448 100644
--- a/src/main/java/net/minecraft/server/PlayerManager.java
+++ b/src/main/java/net/minecraft/server/PlayerManager.java
@@ -8,7 +8,7 @@ public class PlayerManager {
private List a = new ArrayList();
private PlayerList b = new PlayerList();
private List c = new ArrayList();
- private MinecraftServer d;
+ private MinecraftServer server;
private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
// CraftBukkit start
@@ -16,12 +16,12 @@ public class PlayerManager {
// CraftBukkit - change of method signature
public PlayerManager(MinecraftServer minecraftserver, WorldServer world) {
- this.d = minecraftserver;
this.world = world;
+ // CraftBukkit end
+ this.server = minecraftserver;
}
- // CraftBukkit end
- public void a() {
+ public void flush() {
for (int i = 0; i < this.c.size(); ++i) {
((PlayerInstance) this.c.get(i)).a();
}
@@ -41,7 +41,7 @@ public class PlayerManager {
return playerinstance;
}
- public void a(int i, int j, int k) {
+ public void flagDirty(int i, int j, int k) {
int l = i >> 4;
int i1 = k >> 4;
PlayerInstance playerinstance = this.a(l, i1, false);
@@ -51,7 +51,7 @@ public class PlayerManager {
}
}
- public void a(EntityPlayer entityplayer) {
+ public void addPlayer(EntityPlayer entityplayer) {
int i = (int) entityplayer.locX >> 4;
int j = (int) entityplayer.locZ >> 4;
@@ -89,7 +89,7 @@ public class PlayerManager {
this.a.add(entityplayer);
}
- public void b(EntityPlayer entityplayer) {
+ public void removePlayer(EntityPlayer entityplayer) {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
@@ -113,7 +113,7 @@ public class PlayerManager {
return i1 >= -10 && i1 <= 10 ? j1 >= -10 && j1 <= 10 : false;
}
- public void c(EntityPlayer entityplayer) {
+ public void movePlayer(EntityPlayer entityplayer) {
int i = (int) entityplayer.locX >> 4;
int j = (int) entityplayer.locZ >> 4;
double d0 = entityplayer.d - entityplayer.locX;
@@ -128,8 +128,8 @@ public class PlayerManager {
// Craftbukkit start
if (i1 > 10 || i1 < -10 || j1 > 10 || j1 < -10) {
- b(entityplayer);
- a(entityplayer);
+ this.removePlayer(entityplayer);
+ this.addPlayer(entityplayer);
return;
}
// Craftbukkit end
@@ -162,7 +162,7 @@ public class PlayerManager {
}
static MinecraftServer a(PlayerManager playermanager) {
- return playermanager.d;
+ return playermanager.server;
}
static PlayerList b(PlayerManager playermanager) {
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index 58092bfe..ec7da391 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -12,14 +12,14 @@ import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager {
public static Logger a = Logger.getLogger("Minecraft");
- private Properties b = new Properties();
+ private Properties properties = new Properties();
private File c;
public PropertyManager(File file1) {
this.c = file1;
if (file1.exists()) {
try {
- this.b.load(new FileInputStream(file1));
+ this.properties.load(new FileInputStream(file1));
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to load " + file1, exception);
this.a();
@@ -55,45 +55,46 @@ public class PropertyManager {
public void b() {
try {
- this.b.store(new FileOutputStream(this.c), "Minecraft server properties");
+ this.properties.store(new FileOutputStream(this.c), "Minecraft server properties");
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to save " + this.c, exception);
this.a();
}
}
- public String a(String s, String s1) {
- if (!this.b.containsKey(s)) {
- this.b.setProperty(s, getOverride(s, s1)); // CraftBukkit
+ public String getString(String s, String s1) {
+ if (!this.properties.containsKey(s)) {
+ s1 = getOverride(s, s1); // CraftBukkit
+ this.properties.setProperty(s, s1);
this.b();
}
- return getOverride(s, this.b.getProperty(s, s1)); // CraftBukkit
+ return getOverride(s, this.properties.getProperty(s, s1)); // CraftBukkit
}
- public int a(String s, int i) {
+ public int getInt(String s, int i) {
try {
- return getOverride(s, Integer.parseInt(this.a(s, "" + i))); // CraftBukkit
+ return getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
} catch (Exception exception) {
i = getOverride(s, i); // CraftBukkit
- this.b.setProperty(s, "" + i);
+ this.properties.setProperty(s, "" + i);
return i;
}
}
- public boolean a(String s, boolean flag) {
+ public boolean getBoolean(String s, boolean flag) {
try {
- return getOverride(s, Boolean.parseBoolean(this.a(s, "" + flag))); // CraftBukkit
+ return getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit
} catch (Exception exception) {
flag = getOverride(s, flag); // CraftBukkit
- this.b.setProperty(s, "" + flag);
+ this.properties.setProperty(s, "" + flag);
return flag;
}
}
public void b(String s, boolean flag) {
flag = getOverride(s, flag); // CraftBukkit
- this.b.setProperty(s, "" + flag);
+ this.properties.setProperty(s, "" + flag);
this.b();
}
}
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
index 20736dd0..4a3f77df 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
@@ -27,38 +27,38 @@ import org.bukkit.event.player.PlayerRespawnEvent;
public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft");
- public List b = new ArrayList();
- public MinecraftServer c; // CraftBukkit - private->public
+ public List players = new ArrayList();
+ public MinecraftServer server; // CraftBukkit - private->public
// public PlayerManager d; // CraftBukkit - removed!
- public int e; // CraftBukkit - private->public
- private Set f = new HashSet();
- private Set g = new HashSet();
+ public int maxPlayers; // CraftBukkit - private->public
+ private Set banByName = new HashSet();
+ private Set banByIP = new HashSet();
private Set h = new HashSet();
private Set i = new HashSet();
private File j;
private File k;
private File l;
private File m;
- public PlayerFileData n; // CraftBukkit - private->public
+ public PlayerFileData playerFileData; // CraftBukkit private->public
private boolean o;
// CraftBukkit start
- private CraftServer server;
+ private CraftServer cserver;
public ServerConfigurationManager(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this);
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
- server = minecraftserver.server;
+ cserver = minecraftserver.server;
// CraftBukkit end
- this.c = minecraftserver;
+ this.server = minecraftserver;
this.j = minecraftserver.a("banned-players.txt");
this.k = minecraftserver.a("banned-ips.txt");
this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.txt");
// this.d = new PlayerManager(minecraftserver); // CraftBukkit - removed!
- this.e = minecraftserver.d.a("max-players", 20);
- this.o = minecraftserver.d.a("white-list", false);
+ this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
+ this.o = minecraftserver.propertyManager.getBoolean("white-list", false);
this.g();
this.i();
this.k();
@@ -69,12 +69,9 @@ public class ServerConfigurationManager {
this.n();
}
- public void a(WorldServer worldserver) {
- // CraftBukkit start
- if (this.n == null) {
- this.n = worldserver.o().d();
- }
- // CraftBukkit end
+ public void setPlayerFileData(WorldServer worldserver) {
+ if (this.playerFileData != null) return; // CraftBukkit
+ this.playerFileData = worldserver.o().d();
}
public int a() {
@@ -82,46 +79,45 @@ public class ServerConfigurationManager {
}
public void a(EntityPlayer entityplayer) {
- this.b.add(entityplayer);
- this.n.b(entityplayer);
+ this.players.add(entityplayer);
+ this.playerFileData.b(entityplayer);
// CraftBukkit start
- ((WorldServer) entityplayer.world).u.c((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
+ ((WorldServer) entityplayer.world).chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
- while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
- entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
+ while (entityplayer.world.getEntities(entityplayer, entityplayer.boundingBox).size() != 0) {
+ entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
}
- entityplayer.world.a(entityplayer);
+ entityplayer.world.addEntity(entityplayer);
- PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
-
- server.getPluginManager().callEvent(playerJoinEvent);
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
+ cserver.getPluginManager().callEvent(playerJoinEvent);
String joinMessage = playerJoinEvent.getJoinMessage();
if (joinMessage != null) {
- this.c.f.a((Packet) (new Packet3Chat(joinMessage)));
+ this.server.serverConfigurationManager.sendAll(new Packet3Chat(joinMessage));
}
- ((WorldServer) entityplayer.world).manager.a(entityplayer);
+ ((WorldServer) entityplayer.world).manager.addPlayer(entityplayer);
// CraftBukkit end
}
public void b(EntityPlayer entityplayer) {
- ((WorldServer) entityplayer.world).manager.c(entityplayer); // CraftBukkit
+ ((WorldServer) entityplayer.world).manager.movePlayer(entityplayer); // CraftBukkit
}
- public String c(EntityPlayer entityplayer) { // CraftBukkit - changed return type
+ public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - changed return type
// CraftBukkit start
// Quitting must be before we do final save of data, in case plugins need to modify it
- ((WorldServer) entityplayer.world).manager.b(entityplayer);
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
- server.getPluginManager().callEvent(playerQuitEvent);
+ ((WorldServer) entityplayer.world).manager.removePlayer(entityplayer);
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
+ cserver.getPluginManager().callEvent(playerQuitEvent);
// CraftBukkit end
- this.n.a(entityplayer);
- entityplayer.world.d(entityplayer); // CraftBukkit
- this.b.remove(entityplayer);
+ this.playerFileData.a(entityplayer);
+ entityplayer.world.kill(entityplayer); // CraftBukkit
+ this.players.remove(entityplayer);
return playerQuitEvent.getQuitMessage(); // CraftBukkit
}
@@ -131,84 +127,84 @@ public class ServerConfigurationManager {
// Instead of kicking then returning, we need to store the kick reason
// in the event, check with plugins to see if it's ok, and THEN kick
// depending on the outcome. Also change any reference to this.e.c to entity.world
- EntityPlayer entity = new EntityPlayer(c, c.worlds.get(0), s, new ItemInWorldManager(c.worlds.get(0)));
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.worlds.get(0), s, new ItemInWorldManager(this.server.worlds.get(0)));
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player);
- String s2 = netloginhandler.b.b().toString();
+ String s2 = netloginhandler.networkManager.getSocketAddress().toString();
s2 = s2.substring(s2.indexOf("/") + 1);
s2 = s2.substring(0, s2.indexOf(":"));
- if (this.f.contains(s.trim().toLowerCase())) {
+ if (this.banByName.contains(s.trim().toLowerCase())) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
- } else if (!this.g(s)) {
+ } else if (!this.isWhitelisted(s)) {
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
- } else if (this.g.contains(s2)) {
+ } else if (this.banByIP.contains(s2)) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
- } else if (this.b.size() >= this.e) {
+ } else if (this.players.size() >= this.maxPlayers) {
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
} else {
event.disallow(PlayerLoginEvent.Result.ALLOWED, s2);
}
- server.getPluginManager().callEvent(event);
+ cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
- netloginhandler.a(event.getKickMessage());
+ netloginhandler.disconnect(event.getKickMessage());
return null;
}
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.name.equalsIgnoreCase(s)) {
- entityplayer.a.a("You logged in from another location");
+ entityplayer.netServerHandler.disconnect("You logged in from another location");
}
}
- return new EntityPlayer(this.c, entity.world, s, new ItemInWorldManager(entity.world));
+ return new EntityPlayer(this.server, entity.world, s, new ItemInWorldManager(entity.world));
// CraftBukkit end
}
public EntityPlayer d(EntityPlayer entityplayer) {
- // CraftBukkit start - every reference to this.c.e should be entityplayer.world
- this.c.k.a(entityplayer);
- this.c.k.b(entityplayer);
- ((WorldServer) entityplayer.world).manager.b(entityplayer);
- this.b.remove(entityplayer);
- entityplayer.world.e(entityplayer);
+ // CraftBukkit start - every reference to this.minecraftServer.worldServer should be entityplayer.world
+ this.server.tracker.trackPlayer(entityplayer);
+ this.server.tracker.untrackEntity(entityplayer);
+ ((WorldServer) entityplayer.world).manager.removePlayer(entityplayer);
+ this.players.remove(entityplayer);
+ entityplayer.world.removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.H();
- EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
+ EntityPlayer entityplayer1 = new EntityPlayer(this.server, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
entityplayer1.id = entityplayer.id;
- entityplayer1.a = entityplayer.a;
+ entityplayer1.netServerHandler = entityplayer.netServerHandler;
entityplayer1.displayName = entityplayer.displayName; // CraftBukkit
entityplayer1.compassTarget = entityplayer.compassTarget; // CraftBukkit
entityplayer1.fauxSleeping = entityplayer.fauxSleeping; // CraftBukkit
-
+
if (chunkcoordinates != null) {
- ChunkCoordinates chunkcoordinates1 = EntityHuman.a(entityplayer.world, chunkcoordinates);
+ ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(entityplayer.world, chunkcoordinates);
if (chunkcoordinates1 != null) {
- entityplayer1.c((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F), 0.0F, 0.0F);
+ entityplayer1.setPositionRotation((double) ((float) chunkcoordinates1.x + 0.5F), (double) ((float) chunkcoordinates1.y + 0.1F), (double) ((float) chunkcoordinates1.z + 0.5F), 0.0F, 0.0F);
entityplayer1.a(chunkcoordinates);
} else {
- entityplayer1.a.b((Packet) (new Packet70Bed(0)));
+ entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
}
}
-
- ((WorldServer) entityplayer.world).u.c((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
- while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
- entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
+ ((WorldServer) entityplayer.world).chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
+
+ while (entityplayer.world.getEntities(entityplayer1, entityplayer1.boundingBox).size() != 0) {
+ entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
}
// CraftBukkit start
- Player respawnPlayer = server.getPlayer(entityplayer);
+ Player respawnPlayer = cserver.getPlayer(entityplayer);
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, respawnLocation );
- server.getPluginManager().callEvent(respawnEvent);
+ cserver.getPluginManager().callEvent(respawnEvent);
entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();
entityplayer1.locX = respawnEvent.getRespawnLocation().getX();
@@ -216,77 +212,77 @@ public class ServerConfigurationManager {
entityplayer1.locZ = respawnEvent.getRespawnLocation().getZ();
entityplayer1.yaw = respawnEvent.getRespawnLocation().getYaw();
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch();
- entityplayer1.c = new ItemInWorldManager(((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle());
- entityplayer1.c.a = entityplayer1;
- ((WorldServer) entityplayer1.world).u.c((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
+ entityplayer1.itemInWorldManager = new ItemInWorldManager(((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle());
+ entityplayer1.itemInWorldManager.player = entityplayer1;
+ ((WorldServer) entityplayer1.world).chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
// CraftBukkit end
- entityplayer1.a.b((Packet) (new Packet9Respawn()));
- entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
+ entityplayer1.netServerHandler.sendPacket(new Packet9Respawn());
+ entityplayer1.netServerHandler.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
// CraftBukkit start
- entityplayer.world.a(entityplayer1);
- ((WorldServer) entityplayer1.world).manager.a(entityplayer1);
+ ((WorldServer) entityplayer1.world).manager.addPlayer(entityplayer1);
+ entityplayer.world.addEntity(entityplayer1);
// CraftBukkit end
- this.b.add(entityplayer1);
- entityplayer1.m();
+ this.players.add(entityplayer1);
+ entityplayer1.syncInventory();
entityplayer1.t();
return entityplayer1;
}
public void b() {
// CraftBukkit start
- for (WorldServer world: c.worlds) {
- world.manager.a();
+ for (WorldServer world: this.server.worlds) {
+ world.manager.flush();
}
// CraftBukkit end
}
// CraftBukkit start - changed signature
- public void a(int i, int j, int k, WorldServer world) {
- world.manager.a(i, j, k);
+ public void flagDirty(int i, int j, int k, WorldServer world) {
+ world.manager.flagDirty(i, j, k);
}
// CraftBukkit end
- public void a(Packet packet) {
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ public void sendAll(Packet packet) {
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
- entityplayer.a.b(packet);
+ entityplayer.netServerHandler.sendPacket(packet);
}
}
public String c() {
String s = "";
- for (int i = 0; i < this.b.size(); ++i) {
+ for (int i = 0; i < this.players.size(); ++i) {
if (i > 0) {
s = s + ", ";
}
- s = s + ((EntityPlayer) this.b.get(i)).name;
+ s = s + ((EntityPlayer) this.players.get(i)).name;
}
return s;
}
public void a(String s) {
- this.f.add(s.toLowerCase());
+ this.banByName.add(s.toLowerCase());
this.h();
}
public void b(String s) {
- this.f.remove(s.toLowerCase());
+ this.banByName.remove(s.toLowerCase());
this.h();
}
private void g() {
try {
- this.f.clear();
+ this.banByName.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
- this.f.add(s.trim().toLowerCase());
+ this.banByName.add(s.trim().toLowerCase());
}
bufferedreader.close();
@@ -298,7 +294,7 @@ public class ServerConfigurationManager {
private void h() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
- Iterator iterator = this.f.iterator();
+ Iterator iterator = this.banByName.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
@@ -313,23 +309,23 @@ public class ServerConfigurationManager {
}
public void c(String s) {
- this.g.add(s.toLowerCase());
+ this.banByIP.add(s.toLowerCase());
this.j();
}
public void d(String s) {
- this.g.remove(s.toLowerCase());
+ this.banByIP.remove(s.toLowerCase());
this.j();
}
private void i() {
try {
- this.g.clear();
+ this.banByIP.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
- this.g.add(s.trim().toLowerCase());
+ this.banByIP.add(s.trim().toLowerCase());
}
bufferedreader.close();
@@ -341,7 +337,7 @@ public class ServerConfigurationManager {
private void j() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
- Iterator iterator = this.g.iterator();
+ Iterator iterator = this.banByIP.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
@@ -431,18 +427,18 @@ public class ServerConfigurationManager {
}
}
- public boolean g(String s) {
+ public boolean isWhitelisted(String s) {
s = s.trim().toLowerCase();
return !this.o || this.h.contains(s) || this.i.contains(s);
}
- public boolean h(String s) {
+ public boolean isOp(String s) {
return this.h.contains(s.trim().toLowerCase());
}
public EntityPlayer i(String s) {
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.name.equalsIgnoreCase(s)) {
return entityplayer;
@@ -456,19 +452,19 @@ public class ServerConfigurationManager {
EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) {
- entityplayer.a.b((Packet) (new Packet3Chat(s1)));
+ entityplayer.netServerHandler.sendPacket(new Packet3Chat(s1));
}
}
public void a(double d0, double d1, double d2, double d3, Packet packet) {
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
double d6 = d2 - entityplayer.locZ;
if (d4 * d4 + d5 * d5 + d6 * d6 < d3 * d3) {
- entityplayer.a.b(packet);
+ entityplayer.netServerHandler.sendPacket(packet);
}
}
}
@@ -476,11 +472,11 @@ public class ServerConfigurationManager {
public void j(String s) {
Packet3Chat packet3chat = new Packet3Chat(s);
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
- if (this.h(entityplayer.name)) {
- entityplayer.a.b((Packet) packet3chat);
+ if (this.isOp(entityplayer.name)) {
+ entityplayer.netServerHandler.sendPacket(packet3chat);
}
}
}
@@ -489,16 +485,16 @@ public class ServerConfigurationManager {
EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) {
- entityplayer.a.b(packet);
+ entityplayer.netServerHandler.sendPacket(packet);
return true;
} else {
return false;
}
}
- public void d() {
- for (int i = 0; i < this.b.size(); ++i) {
- this.n.a((EntityHuman) this.b.get(i));
+ public void savePlayers() {
+ for (int i = 0; i < this.players.size(); ++i) {
+ this.playerFileData.a((EntityHuman) this.players.get(i));
}
}
diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java
index a45cb2aa..e549a7fc 100644
--- a/src/main/java/net/minecraft/server/Slot.java
+++ b/src/main/java/net/minecraft/server/Slot.java
@@ -2,15 +2,15 @@ package net.minecraft.server;
public class Slot {
- public final int d; // CraftBukkit: private -> public
- public final IInventory e; // CraftBukkit: private -> public
+ public final int index; // CraftBukkit: private -> public
+ public final IInventory inventory; // CraftBukkit: private -> public
public int a;
public int b;
public int c;
public Slot(IInventory iinventory, int i, int j, int k) {
- this.e = iinventory;
- this.d = i;
+ this.inventory = iinventory;
+ this.index = i;
this.b = j;
this.c = k;
}
@@ -19,33 +19,33 @@ public class Slot {
this.b();
}
- public boolean b(ItemStack itemstack) {
+ public boolean isAllowed(ItemStack itemstack) {
return true;
}
- public ItemStack a() {
- return this.e.c_(this.d);
+ public ItemStack getItem() {
+ return this.inventory.getItem(this.index);
}
public void c(ItemStack itemstack) {
- this.e.a(this.d, itemstack);
+ this.inventory.setItem(this.index, itemstack);
this.b();
}
public void b() {
- this.e.i();
+ this.inventory.update();
}
public int c() {
- return this.e.r_();
+ return this.inventory.getMaxStackSize();
}
public ItemStack a(int i) {
- return this.e.a(this.d, i);
+ return this.inventory.a(this.index, i);
}
public boolean a(IInventory iinventory, int i) {
- return iinventory == this.e && i == this.d;
+ return iinventory == this.inventory && i == this.index;
}
public boolean d() {
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index 71efc0ad..60bd1425 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -10,23 +10,23 @@ import jline.ConsoleReader;
public class ThreadCommandReader extends Thread {
- final MinecraftServer a;
+ final MinecraftServer server;
public ThreadCommandReader(MinecraftServer minecraftserver) {
- this.a = minecraftserver;
+ this.server = minecraftserver;
}
public void run() {
// Craftbukkit start - whole method, nuked to oblivion! :o
try {
- ConsoleReader reader = a.reader;
+ ConsoleReader reader = this.server.reader;
String line = null;
- while ((!this.a.g) && (MinecraftServer.a(this.a)) && ((line = reader.readLine(">", null)) != null)) {
- this.a.a(line, this.a);
+ while ((!this.server.isStopped) && (MinecraftServer.isRunning(this.server)) && ((line = reader.readLine(">", null)) != null)) {
+ this.server.issueCommand(line, (ICommandListener) this.server);
}
- } catch (IOException ex) {
- Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (IOException ioexception) {
+ Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
}
// Craftbukkit end
}
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
index dd6850b7..9bf70e04 100644
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -1,51 +1,56 @@
-package net.minecraft.server;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLEncoder;
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.event.player.PlayerPreLoginEvent;
-
-class ThreadLoginVerifier extends Thread {
-
- final Packet1Login a;
-
- final NetLoginHandler b;
-
- // CraftBukkit start
- CraftServer server;
-
- ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login, CraftServer server) {
- this.server = server;
- // CraftBukkit end
- this.b = netloginhandler;
- this.a = packet1login;
- }
-
- public void run() {
- try {
- String s = NetLoginHandler.a(this.b);
- URL url = new URL("http://www.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.a.b, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
- String s1 = bufferedreader.readLine();
-
- bufferedreader.close();
- if (s1.equals("YES")) {
- PlayerPreLoginEvent event = new PlayerPreLoginEvent(this.a.b, b.getSocket().getInetAddress());
- server.getPluginManager().callEvent(event);
-
- if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.b.a(event.getKickMessage());
- return;
- }
-
- NetLoginHandler.a(this.b, this.a);
- } else {
- this.b.a("Failed to verify username!");
- }
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
-}
+package net.minecraft.server;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLEncoder;
+
+// CraftBukkit start
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.event.player.PlayerPreLoginEvent;
+// CraftBukkit end
+
+class ThreadLoginVerifier extends Thread {
+
+ final Packet1Login loginPacket;
+
+ final NetLoginHandler netLoginHandler;
+
+ // CraftBukkit start
+ CraftServer server;
+
+ ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login, CraftServer server) {
+ this.server = server;
+ // CraftBukkit end
+ this.netLoginHandler = netloginhandler;
+ this.loginPacket = packet1login;
+ }
+
+ public void run() {
+ try {
+ String s = NetLoginHandler.a(this.netLoginHandler);
+ URL url = new URL("http://www.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.loginPacket.name, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
+ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
+ String s1 = bufferedreader.readLine();
+
+ bufferedreader.close();
+ if (s1.equals("YES")) {
+ // CraftBukkit start
+ PlayerPreLoginEvent event = new PlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress());
+ server.getPluginManager().callEvent(event);
+
+ if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.netLoginHandler.disconnect(event.getKickMessage());
+ return;
+ }
+ // CraftBukkit end
+
+ NetLoginHandler.a(this.netLoginHandler, this.loginPacket);
+ } else {
+ this.netLoginHandler.disconnect("Failed to verify username!");
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 275ab04c..a4095f3d 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -2,40 +2,40 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory {
- private ItemStack[] a = new ItemStack[27]; // CraftBukkit
+ private ItemStack[] items = new ItemStack[27]; // CraftBukkit
// CraftBukkit start
public ItemStack[] getContents() {
- return a;
+ return items;
}
// CraftBukkit end
public TileEntityChest() {}
- public int q_() {
+ public int getSize() {
return 27;
}
- public ItemStack c_(int i) {
- return this.a[i];
+ public ItemStack getItem(int i) {
+ return this.items[i];
}
public ItemStack a(int i, int j) {
- if (this.a[i] != null) {
+ if (this.items[i] != null) {
ItemStack itemstack;
- if (this.a[i].count <= j) {
- itemstack = this.a[i];
- this.a[i] = null;
- this.i();
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
+ this.update();
return itemstack;
} else {
- itemstack = this.a[i].a(j);
- if (this.a[i].count == 0) {
- this.a[i] = null;
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
}
- this.i();
+ this.update();
return itemstack;
}
} else {
@@ -43,16 +43,16 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- this.a[i] = itemstack;
- if (itemstack != null && itemstack.count > this.r_()) {
- itemstack.count = this.r_();
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
}
- this.i();
+ this.update();
}
- public String c() {
+ public String getName() {
return "Chest";
}
@@ -60,14 +60,14 @@ public class TileEntityChest extends TileEntity implements IInventory {
super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.l("Items");
- this.a = new ItemStack[this.q_()];
+ this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.c("Slot") & 255;
- if (j >= 0 && j < this.a.length) {
- this.a[j] = new ItemStack(nbttagcompound1);
+ if (j >= 0 && j < this.items.length) {
+ this.items[j] = new ItemStack(nbttagcompound1);
}
}
}
@@ -76,12 +76,12 @@ public class TileEntityChest extends TileEntity implements IInventory {
super.b(nbttagcompound);
NBTTagList nbttaglist = new NBTTagList();
- for (int i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i);
- this.a[i].a(nbttagcompound1);
+ this.items[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1);
}
}
@@ -89,11 +89,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
nbttagcompound.a("Items", (NBTBase) nbttaglist);
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
public boolean a_(EntityHuman entityhuman) {
- return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
+ return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index d13acca4..faa9635c 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -4,41 +4,41 @@ import java.util.Random;
public class TileEntityDispenser extends TileEntity implements IInventory {
- private ItemStack[] a = new ItemStack[9];
+ private ItemStack[] items = new ItemStack[9];
private Random b = new Random();
// CraftBukkit start
public ItemStack[] getContents() {
- return a;
+ return items;
}
// CraftBukkit end
public TileEntityDispenser() {}
- public int q_() {
+ public int getSize() {
return 9;
}
- public ItemStack c_(int i) {
- return this.a[i];
+ public ItemStack getItem(int i) {
+ return this.items[i];
}
public ItemStack a(int i, int j) {
- if (this.a[i] != null) {
+ if (this.items[i] != null) {
ItemStack itemstack;
- if (this.a[i].count <= j) {
- itemstack = this.a[i];
- this.a[i] = null;
- this.i();
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
+ this.update();
return itemstack;
} else {
- itemstack = this.a[i].a(j);
- if (this.a[i].count == 0) {
- this.a[i] = null;
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
}
- this.i();
+ this.update();
return itemstack;
}
} else {
@@ -50,8 +50,8 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
int i = -1;
int j = 1;
- for (int k = 0; k < this.a.length; ++k) {
- if (this.a[k] != null && this.b.nextInt(j) == 0) {
+ for (int k = 0; k < this.items.length; ++k) {
+ if (this.items[k] != null && this.b.nextInt(j) == 0) {
i = k;
++j;
}
@@ -64,16 +64,16 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- this.a[i] = itemstack;
- if (itemstack != null && itemstack.count > this.r_()) {
- itemstack.count = this.r_();
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
}
- this.i();
+ this.update();
}
- public String c() {
+ public String getName() {
return "Trap";
}
@@ -81,14 +81,14 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.l("Items");
- this.a = new ItemStack[this.q_()];
+ this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.c("Slot") & 255;
- if (j >= 0 && j < this.a.length) {
- this.a[j] = new ItemStack(nbttagcompound1);
+ if (j >= 0 && j < this.items.length) {
+ this.items[j] = new ItemStack(nbttagcompound1);
}
}
}
@@ -97,12 +97,12 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
super.b(nbttagcompound);
NBTTagList nbttaglist = new NBTTagList();
- for (int i = 0; i < this.a.length; ++i) {
- if (this.a[i] != null) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i);
- this.a[i].a(nbttagcompound1);
+ this.items[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1);
}
}
@@ -110,11 +110,11 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
nbttagcompound.a("Items", (NBTBase) nbttaglist);
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
public boolean a_(EntityHuman entityhuman) {
- return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
+ return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 848a74af..d0e1ff35 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -2,39 +2,39 @@ package net.minecraft.server;
public class TileEntityFurnace extends TileEntity implements IInventory {
- private ItemStack[] h = new ItemStack[3];
- public int a = 0;
+ private ItemStack[] items = new ItemStack[3];
+ public int burnTime = 0;
public int b = 0;
- public int c = 0;
+ public int cookTime = 0;
// CraftBukkit start
public ItemStack[] getContents() {
- return h;
+ return items;
}
// CraftBukkit end
public TileEntityFurnace() {}
- public int q_() {
- return this.h.length;
+ public int getSize() {
+ return this.items.length;
}
- public ItemStack c_(int i) {
- return this.h[i];
+ public ItemStack getItem(int i) {
+ return this.items[i];
}
public ItemStack a(int i, int j) {
- if (this.h[i] != null) {
+ if (this.items[i] != null) {
ItemStack itemstack;
- if (this.h[i].count <= j) {
- itemstack = this.h[i];
- this.h[i] = null;
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
return itemstack;
} else {
- itemstack = this.h[i].a(j);
- if (this.h[i].count == 0) {
- this.h[i] = null;
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
}
return itemstack;
@@ -44,14 +44,14 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
}
}
- public void a(int i, ItemStack itemstack) {
- this.h[i] = itemstack;
- if (itemstack != null && itemstack.count > this.r_()) {
- itemstack.count = this.r_();
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
}
}
- public String c() {
+ public String getName() {
return "Furnace";
}
@@ -59,34 +59,34 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.l("Items");
- this.h = new ItemStack[this.q_()];
+ this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
byte b0 = nbttagcompound1.c("Slot");
- if (b0 >= 0 && b0 < this.h.length) {
- this.h[b0] = new ItemStack(nbttagcompound1);
+ if (b0 >= 0 && b0 < this.items.length) {
+ this.items[b0] = new ItemStack(nbttagcompound1);
}
}
- this.a = nbttagcompound.d("BurnTime");
- this.c = nbttagcompound.d("CookTime");
- this.b = this.a(this.h[1]);
+ this.burnTime = nbttagcompound.d("BurnTime");
+ this.cookTime = nbttagcompound.d("CookTime");
+ this.b = this.a(this.items[1]);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.a("BurnTime", (short) this.a);
- nbttagcompound.a("CookTime", (short) this.c);
+ nbttagcompound.a("BurnTime", (short) this.burnTime);
+ nbttagcompound.a("CookTime", (short) this.cookTime);
NBTTagList nbttaglist = new NBTTagList();
- for (int i = 0; i < this.h.length; ++i) {
- if (this.h[i] != null) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i);
- this.h[i].a(nbttagcompound1);
+ this.items[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1);
}
}
@@ -94,81 +94,81 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
nbttagcompound.a("Items", (NBTBase) nbttaglist);
}
- public int r_() {
+ public int getMaxStackSize() {
return 64;
}
public boolean f() {
- return this.a > 0;
+ return this.burnTime > 0;
}
public void i_() {
- boolean flag = this.a > 0;
+ boolean flag = this.burnTime > 0;
boolean flag1 = false;
- if (this.a > 0) {
- --this.a;
+ if (this.burnTime > 0) {
+ --this.burnTime;
}
- if (!this.d.isStatic) {
- if (this.a == 0 && this.h()) {
- this.b = this.a = this.a(this.h[1]);
- if (this.a > 0) {
+ if (!this.world.isStatic) {
+ if (this.burnTime == 0 && this.h()) {
+ this.b = this.burnTime = this.a(this.items[1]);
+ if (this.burnTime > 0) {
flag1 = true;
- if (this.h[1] != null) {
- --this.h[1].count;
- if (this.h[1].count == 0) {
- this.h[1] = null;
+ if (this.items[1] != null) {
+ --this.items[1].count;
+ if (this.items[1].count == 0) {
+ this.items[1] = null;
}
}
}
}
if (this.f() && this.h()) {
- ++this.c;
- if (this.c == 200) {
- this.c = 0;
+ ++this.cookTime;
+ if (this.cookTime == 200) {
+ this.cookTime = 0;
this.g();
flag1 = true;
}
} else {
- this.c = 0;
+ this.cookTime = 0;
}
- if (flag != this.a > 0) {
+ if (flag != this.burnTime > 0) {
flag1 = true;
- BlockFurnace.a(this.a > 0, this.d, this.e, this.f, this.g);
+ BlockFurnace.a(this.burnTime > 0, this.world, this.e, this.f, this.g);
}
}
if (flag1) {
- this.i();
+ this.update();
}
}
private boolean h() {
- if (this.h[0] == null) {
+ if (this.items[0] == null) {
return false;
} else {
- ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
+ ItemStack itemstack = FurnaceRecipes.a().a(this.items[0].getItem().id);
- return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.r_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b())));
+ return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].a(itemstack) ? false : (this.items[2].count < this.getMaxStackSize() && this.items[2].count < this.items[2].b() ? true : this.items[2].count < itemstack.b())));
}
}
public void g() {
if (this.h()) {
- ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
+ ItemStack itemstack = FurnaceRecipes.a().a(this.items[0].getItem().id);
- if (this.h[2] == null) {
- this.h[2] = itemstack.j();
- } else if (this.h[2].id == itemstack.id) {
- ++this.h[2].count;
+ if (this.items[2] == null) {
+ this.items[2] = itemstack.j();
+ } else if (this.items[2].id == itemstack.id) {
+ ++this.items[2].count;
}
- --this.h[0].count;
- if (this.h[0].count <= 0) {
- this.h[0] = null;
+ --this.items[0].count;
+ if (this.items[0].count <= 0) {
+ this.items[0] = null;
}
}
}
@@ -177,13 +177,13 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (itemstack == null) {
return 0;
} else {
- int i = itemstack.a().id;
+ int i = itemstack.getItem().id;
return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : 0)));
}
}
public boolean a_(EntityHuman entityhuman) {
- return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
+ return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index c2bbdb17..5e739c3e 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -2,48 +2,48 @@ package net.minecraft.server;
public class TileEntityMobSpawner extends TileEntity {
- public int a = -1;
- public String h = "Pig"; // CraftBukkit private -> public
+ public int spawnDelay = -1;
+ public String mobName = "Pig"; // CraftBukkit private -> public
public double b;
public double c = 0.0D;
public TileEntityMobSpawner() {
- this.a = 20;
+ this.spawnDelay = 20;
}
public void a(String s) {
- this.h = s;
+ this.mobName = s;
}
public boolean a() {
- return this.d.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null;
+ return this.world.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null;
}
public void i_() {
this.c = this.b;
if (this.a()) {
- double d0 = (double) ((float) this.e + this.d.k.nextFloat());
- double d1 = (double) ((float) this.f + this.d.k.nextFloat());
- double d2 = (double) ((float) this.g + this.d.k.nextFloat());
+ double d0 = (double) ((float) this.e + this.world.random.nextFloat());
+ double d1 = (double) ((float) this.f + this.world.random.nextFloat());
+ double d2 = (double) ((float) this.g + this.world.random.nextFloat());
- this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
- this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
- for (this.b += (double) (1000.0F / ((float) this.a + 200.0F)); this.b > 360.0D; this.c -= 360.0D) {
+ for (this.b += (double) (1000.0F / ((float) this.spawnDelay + 200.0F)); this.b > 360.0D; this.c -= 360.0D) {
this.b -= 360.0D;
}
- if (this.a == -1) {
+ if (this.spawnDelay == -1) {
this.c();
}
- if (this.a > 0) {
- --this.a;
+ if (this.spawnDelay > 0) {
+ --this.spawnDelay;
} else {
byte b0 = 4;
for (int i = 0; i < b0; ++i) {
- EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.d));
+ EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.mobName, this.world));
if (entityliving == null) {
return;
@@ -51,12 +51,12 @@ public class TileEntityMobSpawner extends TileEntity {
// CraftBukkit start - The world we're spawning in accepts this creature
boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal;
- if ((isAnimal && !this.d.E) || (!isAnimal && !this.d.D)) {
+ if ((isAnimal && !this.world.allowAnimals) || (!isAnimal && !this.world.allowMonsters)) {
return;
}
// CraftBukkit end
- int j = this.d.a(entityliving.getClass(), AxisAlignedBB.b((double) this.e, (double) this.f, (double) this.g, (double) (this.e + 1), (double) (this.f + 1), (double) (this.g + 1)).b(8.0D, 4.0D, 8.0D)).size();
+ int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.e, (double) this.f, (double) this.g, (double) (this.e + 1), (double) (this.f + 1), (double) (this.g + 1)).b(8.0D, 4.0D, 8.0D)).size();
if (j >= 6) {
this.c();
@@ -64,20 +64,20 @@ public class TileEntityMobSpawner extends TileEntity {
}
if (entityliving != null) {
- double d3 = (double) this.e + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
- double d4 = (double) (this.f + this.d.k.nextInt(3) - 1);
- double d5 = (double) this.g + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
+ double d3 = (double) this.e + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
+ double d4 = (double) (this.f + this.world.random.nextInt(3) - 1);
+ double d5 = (double) this.g + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
- entityliving.c(d3, d4, d5, this.d.k.nextFloat() * 360.0F, 0.0F);
+ entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.b()) {
- this.d.a((Entity) entityliving);
+ this.world.addEntity(entityliving);
for (int k = 0; k < 20; ++k) {
- d0 = (double) this.e + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
- d1 = (double) this.f + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
- d2 = (double) this.g + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
- this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
- this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ d0 = (double) this.e + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
+ d1 = (double) this.f + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
+ d2 = (double) this.g + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
+ this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
entityliving.M();
@@ -92,18 +92,18 @@ public class TileEntityMobSpawner extends TileEntity {
}
private void c() {
- this.a = 200 + this.d.k.nextInt(600);
+ this.spawnDelay = 200 + this.world.random.nextInt(600);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.h = nbttagcompound.i("EntityId");
- this.a = nbttagcompound.d("Delay");
+ this.mobName = nbttagcompound.getString("EntityId");
+ this.spawnDelay = nbttagcompound.d("Delay");
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.a("EntityId", this.h);
- nbttagcompound.a("Delay", (short) this.a);
+ nbttagcompound.setString("EntityId", this.mobName);
+ nbttagcompound.a("Delay", (short) this.spawnDelay);
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 28f24db1..5ccebcc8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -20,12 +20,12 @@ public class World implements IBlockAccess {
public boolean a = false;
private List u = new ArrayList();
- public List b = new ArrayList();
+ public List entityList = new ArrayList();
private List v = new ArrayList();
private TreeSet w = new TreeSet();
private Set x = new HashSet();
public List c = new ArrayList();
- public List d = new ArrayList();
+ public List players = new ArrayList();
private long y = 16777215L;
public int e = 0;
protected int f = (new Random()).nextInt();
@@ -33,56 +33,56 @@ public class World implements IBlockAccess {
public boolean h = false;
private long z = System.currentTimeMillis();
protected int i = 40;
- public int j;
- public Random k = new Random();
+ public int spawnMonsters;
+ public Random random = new Random();
public boolean l = false;
- public final WorldProvider m;
+ public final WorldProvider worldProvider;
protected List n = new ArrayList();
- public IChunkProvider o; // CraftBukkit protected->public
+ public IChunkProvider chunkProvider; // CraftBukkit protected->public
protected final IDataManager p;
- public WorldData q; // CraftBukkit protected->public
- public boolean r;
+ public WorldData worldData; // CraftBukkit protected->public
+ public boolean isLoading;
private boolean A;
private ArrayList B = new ArrayList();
private int C = 0;
- public boolean D = true; // CraftBukkit private->public
- public boolean E = true; // CraftBukkit private->public
+ public boolean allowMonsters = true; // CraftBukkit private->public
+ public boolean allowAnimals = true; // CraftBukkit private->public
static int s = 0;
private Set F = new HashSet();
private int G;
private List H;
public boolean isStatic;
- public WorldChunkManager a() {
- return this.m.b;
+ public WorldChunkManager getWorldChunkManager() {
+ return this.worldProvider.b;
}
public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider) {
- this.G = this.k.nextInt(12000);
+ this.G = this.random.nextInt(12000);
this.H = new ArrayList();
this.isStatic = false;
this.p = idatamanager;
- this.q = idatamanager.c();
- this.l = this.q == null;
+ this.worldData = idatamanager.c();
+ this.l = this.worldData == null;
if (worldprovider != null) {
- this.m = worldprovider;
- } else if (this.q != null && this.q.h() == -1) {
- this.m = new WorldProviderHell();
+ this.worldProvider = worldprovider;
+ } else if (this.worldData != null && this.worldData.h() == -1) {
+ this.worldProvider = new WorldProviderHell();
} else {
- this.m = new WorldProvider();
+ this.worldProvider = new WorldProvider();
}
boolean flag = false;
- if (this.q == null) {
- this.q = new WorldData(i, s);
+ if (this.worldData == null) {
+ this.worldData = new WorldData(i, s);
flag = true;
} else {
- this.q.a(s);
+ this.worldData.a(s);
}
- this.m.a(this);
- this.o = this.b();
+ this.worldProvider.a(this);
+ this.chunkProvider = this.b();
if (flag) {
this.c();
}
@@ -91,24 +91,24 @@ public class World implements IBlockAccess {
}
protected IChunkProvider b() {
- IChunkLoader ichunkloader = this.p.a(this.m);
+ IChunkLoader ichunkloader = this.p.a(this.worldProvider);
- return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.m.c());
+ return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.c());
}
protected void c() {
- this.r = true;
+ this.isLoading = true;
int i = 0;
byte b0 = 64;
int j;
- for (j = 0; !this.m.a(i, j); j += this.k.nextInt(64) - this.k.nextInt(64)) {
- i += this.k.nextInt(64) - this.k.nextInt(64);
+ for (j = 0; !this.worldProvider.a(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
+ i += this.random.nextInt(64) - this.random.nextInt(64);
}
- this.q.a(i, b0, j);
- this.r = false;
+ this.worldData.setSpawn(i, b0, j);
+ this.isLoading = false;
}
public int a(int i, int j) {
@@ -121,8 +121,8 @@ public class World implements IBlockAccess {
return this.getTypeId(i, k, j);
}
- public void a(boolean flag, IProgressUpdate iprogressupdate) {
- if (this.o.b()) {
+ public void save(boolean flag, IProgressUpdate iprogressupdate) {
+ if (this.chunkProvider.b()) {
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
@@ -132,25 +132,25 @@ public class World implements IBlockAccess {
iprogressupdate.b("Saving chunks");
}
- this.o.a(flag, iprogressupdate);
+ this.chunkProvider.saveChunks(flag, iprogressupdate);
}
}
private void t() {
this.j();
- this.p.a(this.q, this.d);
+ this.p.a(this.worldData, this.players);
}
public int getTypeId(int i, int j, int k) {
- return i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000 ? (j < 0 ? 0 : (j >= 128 ? 0 : this.c(i >> 4, k >> 4).a(i & 15, j, k & 15))) : 0;
+ return i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000 ? (j < 0 ? 0 : (j >= 128 ? 0 : this.getChunkAt(i >> 4, k >> 4).getTypeId(i & 15, j, k & 15))) : 0;
}
public boolean isEmpty(int i, int j, int k) {
return this.getTypeId(i, j, k) == 0;
}
- public boolean f(int i, int j, int k) {
- return j >= 0 && j < 128 ? this.f(i >> 4, k >> 4) : false;
+ public boolean isLoaded(int i, int j, int k) {
+ return j >= 0 && j < 128 ? this.isChunkLoaded(i >> 4, k >> 4) : false;
}
public boolean a(int i, int j, int k, int l) {
@@ -168,7 +168,7 @@ public class World implements IBlockAccess {
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = k; l1 <= j1; ++l1) {
- if (!this.f(k1, l1)) {
+ if (!this.isChunkLoaded(k1, l1)) {
return false;
}
}
@@ -180,12 +180,12 @@ public class World implements IBlockAccess {
}
}
- private boolean f(int i, int j) {
- return this.o.a(i, j);
+ private boolean isChunkLoaded(int i, int j) {
+ return this.chunkProvider.isChunkLoaded(i, j);
}
public Chunk b(int i, int j) {
- return this.c(i >> 4, j >> 4);
+ return this.getChunkAt(i >> 4, j >> 4);
}
// CraftBukkit start
@@ -193,13 +193,13 @@ public class World implements IBlockAccess {
int lastXAccessed = Integer.MIN_VALUE;
int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object();
- public Chunk c(int i, int j) {
+ public Chunk getChunkAt(int i, int j) {
Chunk result = null;
synchronized (chunkLock) {
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
lastXAccessed = i;
lastZAccessed = j;
- lastChunkAccessed = this.o.b(i, j);
+ lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
}
result = lastChunkAccessed;
}
@@ -207,14 +207,14 @@ public class World implements IBlockAccess {
}
// CraftBukkit end
- public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
+ public boolean setRawTypeIdAndData(int i, int j, int k, int l, int i1) {
if (i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000) {
if (j < 0) {
return false;
} else if (j >= 128) {
return false;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
return chunk.a(i & 15, j, k & 15, l, i1);
}
@@ -223,14 +223,14 @@ public class World implements IBlockAccess {
}
}
- public boolean setTypeId(int i, int j, int k, int l) {
+ public boolean setRawTypeId(int i, int j, int k, int l) {
if (i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000) {
if (j < 0) {
return false;
} else if (j >= 128) {
return false;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
return chunk.a(i & 15, j, k & 15, l);
}
@@ -252,31 +252,31 @@ public class World implements IBlockAccess {
} else if (j >= 128) {
return 0;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
i &= 15;
k &= 15;
- return chunk.b(i, j, k);
+ return chunk.getData(i, j, k);
}
} else {
return 0;
}
}
- public void c(int i, int j, int k, int l) {
- if (this.d(i, j, k, l)) {
- this.f(i, j, k, this.getTypeId(i, j, k));
+ public void setData(int i, int j, int k, int l) {
+ if (this.setRawData(i, j, k, l)) {
+ this.update(i, j, k, this.getTypeId(i, j, k));
}
}
- public boolean d(int i, int j, int k, int l) {
+ public boolean setRawData(int i, int j, int k, int l) {
if (i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000) {
if (j < 0) {
return false;
} else if (j >= 128) {
return false;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
i &= 15;
k &= 15;
@@ -288,11 +288,11 @@ public class World implements IBlockAccess {
}
}
- public boolean e(int i, int j, int k, int l) {
+ public boolean setTypeId(int i, int j, int k, int l) {
// Craftbukkit start
int old = this.getTypeId(i, j, k);
- if (this.setTypeId(i, j, k, l)) {
- this.f(i, j, k, l == 0 ? old : l);
+ if (this.setRawTypeId(i, j, k, l)) {
+ this.update(i, j, k, l == 0 ? old : l);
return true;
} else {
return false;
@@ -300,11 +300,11 @@ public class World implements IBlockAccess {
// Craftbukkit end
}
- public boolean b(int i, int j, int k, int l, int i1) {
+ public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
// Craftbukkit start
int old = this.getTypeId(i, j, k);
- if (this.setTypeIdAndData(i, j, k, l, i1)) {
- this.f(i, j, k, l == 0 ? old : l);
+ if (this.setRawTypeIdAndData(i, j, k, l, i1)) {
+ this.update(i, j, k, l == 0 ? old : l);
return true;
} else {
return false;
@@ -312,15 +312,15 @@ public class World implements IBlockAccess {
// Craftbukkit end
}
- public void g(int i, int j, int k) {
+ public void notify(int i, int j, int k) {
for (int l = 0; l < this.n.size(); ++l) {
((IWorldAccess) this.n.get(l)).a(i, j, k);
}
}
- protected void f(int i, int j, int k, int l) {
- this.g(i, j, k);
- this.h(i, j, k, l);
+ protected void update(int i, int j, int k, int l) {
+ this.notify(i, j, k);
+ this.applyPhysics(i, j, k, l);
}
public void g(int i, int j, int k, int l) {
@@ -346,7 +346,7 @@ public class World implements IBlockAccess {
}
}
- public void h(int i, int j, int k, int l) {
+ public void applyPhysics(int i, int j, int k, int l) {
this.k(i - 1, j, k, l);
this.k(i + 1, j, k, l);
this.k(i, j - 1, k, l);
@@ -372,16 +372,16 @@ public class World implements IBlockAccess {
}
// CraftBukkit stop
- block.a(this, i, j, k, l);
+ block.doPhysics(this, i, j, k, l);
}
}
}
- public boolean i(int i, int j, int k) {
- return this.c(i >> 4, k >> 4).c(i & 15, j, k & 15);
+ public boolean isChunkLoaded(int i, int j, int k) {
+ return this.getChunkAt(i >> 4, k >> 4).c(i & 15, j, k & 15);
}
- public int j(int i, int j, int k) {
+ public int getLightLevel(int i, int j, int k) {
return this.a(i, j, k, true);
}
@@ -428,7 +428,7 @@ public class World implements IBlockAccess {
return l;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
i &= 15;
k &= 15;
@@ -445,10 +445,10 @@ public class World implements IBlockAccess {
return false;
} else if (j >= 128) {
return true;
- } else if (!this.f(i >> 4, k >> 4)) {
+ } else if (!this.isChunkLoaded(i >> 4, k >> 4)) {
return false;
} else {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
i &= 15;
k &= 15;
@@ -459,12 +459,12 @@ public class World implements IBlockAccess {
}
}
- public int d(int i, int j) {
+ public int getHighestBlockYAt(int i, int j) {
if (i >= -32000000 && j >= -32000000 && i < 32000000 && j <= 32000000) {
- if (!this.f(i >> 4, j >> 4)) {
+ if (!this.isChunkLoaded(i >> 4, j >> 4)) {
return 0;
} else {
- Chunk chunk = this.c(i >> 4, j >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, j >> 4);
return chunk.b(i & 15, j & 15);
}
@@ -474,8 +474,8 @@ public class World implements IBlockAccess {
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
- if (!this.m.e || enumskyblock != EnumSkyBlock.SKY) {
- if (this.f(i, j, k)) {
+ if (!this.worldProvider.e || enumskyblock != EnumSkyBlock.SKY) {
+ if (this.isLoaded(i, j, k)) {
if (enumskyblock == EnumSkyBlock.SKY) {
if (this.k(i, j, k)) {
l = 15;
@@ -500,10 +500,10 @@ public class World implements IBlockAccess {
int l = i >> 4;
int i1 = k >> 4;
- if (!this.f(l, i1)) {
+ if (!this.isChunkLoaded(l, i1)) {
return 0;
} else {
- Chunk chunk = this.c(l, i1);
+ Chunk chunk = this.getChunkAt(l, i1);
return chunk.a(enumskyblock, i & 15, j, k & 15);
}
@@ -516,8 +516,8 @@ public class World implements IBlockAccess {
if (i >= -32000000 && k >= -32000000 && i < 32000000 && k <= 32000000) {
if (j >= 0) {
if (j < 128) {
- if (this.f(i >> 4, k >> 4)) {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ if (this.isChunkLoaded(i >> 4, k >> 4)) {
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
chunk.a(enumskyblock, i & 15, j, k & 15, l);
@@ -531,7 +531,7 @@ public class World implements IBlockAccess {
}
public float l(int i, int j, int k) {
- return this.m.f[this.j(i, j, k)];
+ return this.worldProvider.f[this.getLightLevel(i, j, k)];
}
public boolean d() {
@@ -539,18 +539,18 @@ public class World implements IBlockAccess {
}
public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) {
- return this.a(vec3d, vec3d1, false);
+ return this.rayTrace(vec3d, vec3d1, false);
}
- public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1, boolean flag) {
+ public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag) {
if (!Double.isNaN(vec3d.a) && !Double.isNaN(vec3d.b) && !Double.isNaN(vec3d.c)) {
if (!Double.isNaN(vec3d1.a) && !Double.isNaN(vec3d1.b) && !Double.isNaN(vec3d1.c)) {
- int i = MathHelper.b(vec3d1.a);
- int j = MathHelper.b(vec3d1.b);
- int k = MathHelper.b(vec3d1.c);
- int l = MathHelper.b(vec3d.a);
- int i1 = MathHelper.b(vec3d.b);
- int j1 = MathHelper.b(vec3d.c);
+ int i = MathHelper.floor(vec3d1.a);
+ int j = MathHelper.floor(vec3d1.b);
+ int k = MathHelper.floor(vec3d1.c);
+ int l = MathHelper.floor(vec3d.a);
+ int i1 = MathHelper.floor(vec3d.b);
+ int j1 = MathHelper.floor(vec3d.c);
int k1 = 200;
while (k1-- >= 0) {
@@ -644,21 +644,21 @@ public class World implements IBlockAccess {
vec3d.c = d2;
}
- Vec3D vec3d2 = Vec3D.b(vec3d.a, vec3d.b, vec3d.c);
+ Vec3D vec3d2 = Vec3D.create(vec3d.a, vec3d.b, vec3d.c);
- l = (int) (vec3d2.a = (double) MathHelper.b(vec3d.a));
+ l = (int) (vec3d2.a = (double) MathHelper.floor(vec3d.a));
if (b0 == 5) {
--l;
++vec3d2.a;
}
- i1 = (int) (vec3d2.b = (double) MathHelper.b(vec3d.b));
+ i1 = (int) (vec3d2.b = (double) MathHelper.floor(vec3d.b));
if (b0 == 1) {
--i1;
++vec3d2.b;
}
- j1 = (int) (vec3d2.c = (double) MathHelper.b(vec3d.c));
+ j1 = (int) (vec3d2.c = (double) MathHelper.floor(vec3d.c));
if (b0 == 3) {
--j1;
++vec3d2.c;
@@ -686,13 +686,13 @@ public class World implements IBlockAccess {
}
}
- public void a(Entity entity, String s, float f, float f1) {
+ public void makeSound(Entity entity, String s, float f, float f1) {
for (int i = 0; i < this.n.size(); ++i) {
((IWorldAccess) this.n.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
}
}
- public void a(double d0, double d1, double d2, String s, float f, float f1) {
+ public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
for (int i = 0; i < this.n.size(); ++i) {
((IWorldAccess) this.n.get(i)).a(s, d0, d1, d2, f, f1);
}
@@ -710,9 +710,9 @@ public class World implements IBlockAccess {
}
}
- public boolean a(Entity entity) {
- int i = MathHelper.b(entity.locX / 16.0D);
- int j = MathHelper.b(entity.locZ / 16.0D);
+ public boolean addEntity(Entity entity) {
+ int i = MathHelper.floor(entity.locX / 16.0D);
+ int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = false;
if (entity instanceof EntityHuman) {
@@ -728,18 +728,18 @@ public class World implements IBlockAccess {
}
// CraftBukkit end
- if (!flag && !this.f(i, j)) {
+ if (!flag && !this.isChunkLoaded(i, j)) {
return false;
} else {
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
- this.d.add(entityhuman);
- this.q();
+ this.players.add(entityhuman);
+ this.everyoneSleeping();
}
- this.c(i, j).a(entity);
- this.b.add(entity);
+ this.getChunkAt(i, j).a(entity);
+ this.entityList.add(entity);
this.b(entity);
return true;
}
@@ -757,56 +757,56 @@ public class World implements IBlockAccess {
}
}
- public void d(Entity entity) {
+ public void kill(Entity entity) {
if (entity.passenger != null) {
- entity.passenger.b((Entity) null);
+ entity.passenger.mount((Entity) null);
}
if (entity.vehicle != null) {
- entity.b((Entity) null);
+ entity.mount((Entity) null);
}
- entity.D();
+ entity.die();
if (entity instanceof EntityHuman) {
- this.d.remove((EntityHuman) entity);
- this.q();
+ this.players.remove((EntityHuman) entity);
+ this.everyoneSleeping();
}
}
- public void e(Entity entity) {
- entity.D();
+ public void removeEntity(Entity entity) {
+ entity.die();
if (entity instanceof EntityHuman) {
- this.d.remove((EntityHuman) entity);
- this.q();
+ this.players.remove((EntityHuman) entity);
+ this.everyoneSleeping();
}
int i = entity.chunkX;
int j = entity.chunkZ;
- if (entity.bA && this.f(i, j)) {
- this.c(i, j).b(entity);
+ if (entity.bA && this.isChunkLoaded(i, j)) {
+ this.getChunkAt(i, j).b(entity);
}
- this.b.remove(entity);
+ this.entityList.remove(entity);
this.c(entity);
}
- public void a(IWorldAccess iworldaccess) {
+ public void addIWorldAccess(IWorldAccess iworldaccess) {
this.n.add(iworldaccess);
}
- public List a(Entity entity, AxisAlignedBB axisalignedbb) {
+ public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) {
this.B.clear();
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = i1; l1 < j1; ++l1) {
- if (this.f(k1, 64, l1)) {
+ if (this.isLoaded(k1, 64, l1)) {
for (int i2 = k - 1; i2 < l; ++i2) {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
@@ -839,7 +839,7 @@ public class World implements IBlockAccess {
public int a(float f) {
float f1 = this.b(f);
- float f2 = 1.0F - (MathHelper.b(f1 * 3.1415927F * 2.0F) * 2.0F + 0.5F);
+ float f2 = 1.0F - (MathHelper.cos(f1 * 3.1415927F * 2.0F) * 2.0F + 0.5F);
if (f2 < 0.0F) {
f2 = 0.0F;
@@ -853,7 +853,7 @@ public class World implements IBlockAccess {
}
public float b(float f) {
- return this.m.a(this.q.f(), f);
+ return this.worldProvider.a(this.worldData.f(), f);
}
public int e(int i, int j) {
@@ -868,7 +868,7 @@ public class World implements IBlockAccess {
i &= 15;
for (j &= 15; k > 0; --k) {
- int l = chunk.a(i, k, j);
+ int l = chunk.getTypeId(i, k, j);
if (l != 0 && (Block.byId[l].material.isSolid() || Block.byId[l].material.isLiquid())) {
return k + 1;
@@ -887,13 +887,13 @@ public class World implements IBlockAccess {
int j1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
if (j1 == nextticklistentry.d && j1 > 0) {
- Block.byId[j1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.k);
+ Block.byId[j1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
}
}
} else {
if (this.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (l > 0) {
- nextticklistentry.a((long) i1 + this.q.f());
+ nextticklistentry.a((long) i1 + this.worldData.f());
}
if (!this.x.contains(nextticklistentry)) {
@@ -904,8 +904,8 @@ public class World implements IBlockAccess {
}
}
- public void e() {
- this.b.removeAll(this.v);
+ public void cleanUp() {
+ this.entityList.removeAll(this.v);
int i;
Entity entity;
@@ -916,8 +916,8 @@ public class World implements IBlockAccess {
entity = (Entity) this.v.get(i);
j = entity.chunkX;
k = entity.chunkZ;
- if (entity.bA && this.f(j, k)) {
- this.c(j, k).b(entity);
+ if (entity.bA && this.isChunkLoaded(j, k)) {
+ this.getChunkAt(j, k).b(entity);
}
}
@@ -927,8 +927,8 @@ public class World implements IBlockAccess {
this.v.clear();
- for (i = 0; i < this.b.size(); ++i) {
- entity = (Entity) this.b.get(i);
+ for (i = 0; i < this.entityList.size(); ++i) {
+ entity = (Entity) this.entityList.get(i);
if (entity.vehicle != null) {
if (!entity.vehicle.dead && entity.vehicle.passenger == entity) {
continue;
@@ -939,17 +939,17 @@ public class World implements IBlockAccess {
}
if (!entity.dead) {
- this.f(entity);
+ this.playerJoinedWorld(entity);
}
if (entity.dead) {
j = entity.chunkX;
k = entity.chunkZ;
- if (entity.bA && this.f(j, k)) {
- this.c(j, k).b(entity);
+ if (entity.bA && this.isChunkLoaded(j, k)) {
+ this.getChunkAt(j, k).b(entity);
}
- this.b.remove(i--);
+ this.entityList.remove(i--);
this.c(entity);
}
}
@@ -961,13 +961,13 @@ public class World implements IBlockAccess {
}
}
- public void f(Entity entity) {
- this.a(entity, true);
+ public void playerJoinedWorld(Entity entity) {
+ this.entityJoinedWorld(entity, true);
}
- public void a(Entity entity, boolean flag) {
- int i = MathHelper.b(entity.locX);
- int j = MathHelper.b(entity.locZ);
+ public void entityJoinedWorld(Entity entity, boolean flag) {
+ int i = MathHelper.floor(entity.locX);
+ int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
if (!flag || this.a(i - b0, 0, j - b0, i + b0, 128, j + b0)) {
@@ -1004,18 +1004,18 @@ public class World implements IBlockAccess {
entity.yaw = entity.lastYaw;
}
- int k = MathHelper.b(entity.locX / 16.0D);
- int l = MathHelper.b(entity.locY / 16.0D);
- int i1 = MathHelper.b(entity.locZ / 16.0D);
+ int k = MathHelper.floor(entity.locX / 16.0D);
+ int l = MathHelper.floor(entity.locY / 16.0D);
+ int i1 = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.bA || entity.chunkX != k || entity.bC != l || entity.chunkZ != i1) {
- if (entity.bA && this.f(entity.chunkX, entity.chunkZ)) {
- this.c(entity.chunkX, entity.chunkZ).a(entity, entity.bC);
+ if (entity.bA && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) {
+ this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.bC);
}
- if (this.f(k, i1)) {
+ if (this.isChunkLoaded(k, i1)) {
entity.bA = true;
- this.c(k, i1).a(entity);
+ this.getChunkAt(k, i1).a(entity);
} else {
entity.bA = false;
}
@@ -1023,7 +1023,7 @@ public class World implements IBlockAccess {
if (flag && entity.bA && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
- this.f(entity.passenger);
+ this.playerJoinedWorld(entity.passenger);
} else {
entity.passenger.vehicle = null;
entity.passenger = null;
@@ -1032,7 +1032,7 @@ public class World implements IBlockAccess {
}
}
- public boolean a(AxisAlignedBB axisalignedbb) {
+ public boolean containsEntity(AxisAlignedBB axisalignedbb) {
List list = this.b((Entity) null, axisalignedbb);
for (int i = 0; i < list.size(); ++i) {
@@ -1047,12 +1047,12 @@ public class World implements IBlockAccess {
}
public boolean b(AxisAlignedBB axisalignedbb) {
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
if (axisalignedbb.a < 0.0D) {
--i;
@@ -1082,12 +1082,12 @@ public class World implements IBlockAccess {
}
public boolean c(AxisAlignedBB axisalignedbb) {
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
if (this.a(i, k, i1, j, l, j1)) {
for (int k1 = i; k1 < j; ++k1) {
@@ -1107,18 +1107,18 @@ public class World implements IBlockAccess {
}
public boolean a(AxisAlignedBB axisalignedbb, Material material, Entity entity) {
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
if (!this.a(i, k, i1, j, l, j1)) {
return false;
} else {
boolean flag = false;
- Vec3D vec3d = Vec3D.b(0.0D, 0.0D, 0.0D);
+ Vec3D vec3d = Vec3D.create(0.0D, 0.0D, 0.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
@@ -1151,12 +1151,12 @@ public class World implements IBlockAccess {
}
public boolean a(AxisAlignedBB axisalignedbb, Material material) {
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
@@ -1174,12 +1174,12 @@ public class World implements IBlockAccess {
}
public boolean b(AxisAlignedBB axisalignedbb, Material material) {
- int i = MathHelper.b(axisalignedbb.a);
- int j = MathHelper.b(axisalignedbb.d + 1.0D);
- int k = MathHelper.b(axisalignedbb.b);
- int l = MathHelper.b(axisalignedbb.e + 1.0D);
- int i1 = MathHelper.b(axisalignedbb.c);
- int j1 = MathHelper.b(axisalignedbb.f + 1.0D);
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
@@ -1206,10 +1206,10 @@ public class World implements IBlockAccess {
}
public Explosion a(Entity entity, double d0, double d1, double d2, float f) {
- return this.a(entity, d0, d1, d2, f, false);
+ return this.createExplosion(entity, d0, d1, d2, f, false);
}
- public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
+ public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f);
explosion.a = flag;
@@ -1232,7 +1232,7 @@ public class World implements IBlockAccess {
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;
- if (this.a(Vec3D.b(d3, d4, d5), vec3d) == null) {
+ if (this.a(Vec3D.create(d3, d4, d5), vec3d) == null) {
++i;
}
@@ -1245,13 +1245,13 @@ public class World implements IBlockAccess {
}
public TileEntity getTileEntity(int i, int j, int k) {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
return chunk != null ? chunk.d(i & 15, j, k & 15) : null;
}
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
if (chunk != null) {
chunk.a(i & 15, j, k & 15, tileentity);
@@ -1259,7 +1259,7 @@ public class World implements IBlockAccess {
}
public void n(int i, int j, int k) {
- Chunk chunk = this.c(i >> 4, k >> 4);
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
if (chunk != null) {
chunk.e(i & 15, j, k & 15);
@@ -1272,17 +1272,17 @@ public class World implements IBlockAccess {
return block == null ? false : block.a();
}
- public boolean f() {
+ public boolean doLighting() {
if (this.C >= 50) {
return false;
} else {
++this.C;
+ boolean flag;
+
try {
int i = 500;
- boolean flag;
-
while (this.u.size() > 0) {
--i;
if (i <= 0) {
@@ -1294,10 +1294,11 @@ public class World implements IBlockAccess {
}
flag = false;
- return flag;
} finally {
--this.C;
}
+
+ return flag;
}
}
@@ -1306,7 +1307,7 @@ public class World implements IBlockAccess {
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l, int i1, int j1, boolean flag) {
- if (!this.m.e || enumskyblock != EnumSkyBlock.SKY) {
+ if (!this.worldProvider.e || enumskyblock != EnumSkyBlock.SKY) {
++s;
if (s == 50) {
--s;
@@ -1314,7 +1315,7 @@ public class World implements IBlockAccess {
int k1 = (l + i) / 2;
int l1 = (j1 + k) / 2;
- if (!this.f(k1, 64, l1)) {
+ if (!this.isLoaded(k1, 64, l1)) {
--s;
} else if (!this.b(k1, l1).g()) {
int i2 = this.u.size();
@@ -1357,35 +1358,35 @@ public class World implements IBlockAccess {
}
}
- public void a(boolean flag, boolean flag1) {
- this.D = flag;
- this.E = flag1;
+ public void setSpawnFlags(boolean flag, boolean flag1) {
+ this.allowMonsters = flag;
+ this.allowAnimals = flag1;
}
- public void h() {
+ public void doTick() {
long i;
- if (this.s()) {
+ if (this.everyoneDeeplySleeping()) {
boolean flag = false;
- if (this.D && this.j >= 1) {
- flag = SpawnerCreature.a(this, this.d);
+ if (this.allowMonsters && this.spawnMonsters >= 1) {
+ flag = SpawnerCreature.a(this, this.players);
}
if (!flag) {
- i = this.q.f() + 24000L;
- this.q.a(i - i % 24000L);
+ i = this.worldData.f() + 24000L;
+ this.worldData.a(i - i % 24000L);
this.r();
}
}
// CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals
- if ((this.D || this.E) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0)) {
- SpawnerCreature.a(this, this.D, this.E);
+ if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().players.size() > 0)) {
+ SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals);
}
// CraftBukkit end
- this.o.a();
+ this.chunkProvider.unloadChunks();
int j = this.a(1.0F);
if (j != this.e) {
@@ -1396,12 +1397,12 @@ public class World implements IBlockAccess {
}
}
- i = this.q.f() + 1L;
+ i = this.worldData.f() + 1L;
if (i % (long) this.i == 0L) {
- this.a(false, (IProgressUpdate) null);
+ this.save(false, (IProgressUpdate) null);
}
- this.q.a(i);
+ this.worldData.a(i);
this.a(false);
this.i();
}
@@ -1414,11 +1415,11 @@ public class World implements IBlockAccess {
int k;
int l;
- for (int i1 = 0; i1 < this.d.size(); ++i1) {
- EntityHuman entityhuman = (EntityHuman) this.d.get(i1);
+ for (int i1 = 0; i1 < this.players.size(); ++i1) {
+ EntityHuman entityhuman = (EntityHuman) this.players.get(i1);
- i = MathHelper.b(entityhuman.locX / 16.0D);
- j = MathHelper.b(entityhuman.locZ / 16.0D);
+ i = MathHelper.floor(entityhuman.locX / 16.0D);
+ j = MathHelper.floor(entityhuman.locZ / 16.0D);
byte b0 = 9;
for (k = -b0; k <= b0; ++k) {
@@ -1437,9 +1438,9 @@ public class World implements IBlockAccess {
while (iterator.hasNext()) {
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
- i = chunkcoordintpair.a * 16;
- j = chunkcoordintpair.b * 16;
- Chunk chunk = this.c(chunkcoordintpair.a, chunkcoordintpair.b);
+ i = chunkcoordintpair.x * 16;
+ j = chunkcoordintpair.z * 16;
+ Chunk chunk = this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
int j1;
int k1;
int l1;
@@ -1450,15 +1451,15 @@ public class World implements IBlockAccess {
l = k & 15;
j1 = k >> 8 & 15;
k1 = k >> 16 & 127;
- l1 = chunk.a(l, k1, j1);
+ l1 = chunk.getTypeId(l, k1, j1);
l += i;
j1 += j;
- if (l1 == 0 && this.j(l, k1, j1) <= this.k.nextInt(8) && this.a(EnumSkyBlock.SKY, l, k1, j1) <= 0) {
+ if (l1 == 0 && this.getLightLevel(l, k1, j1) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, l, k1, j1) <= 0) {
EntityHuman entityhuman1 = this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, 8.0D);
if (entityhuman1 != null && entityhuman1.d((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D) > 4.0D) {
- this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.k.nextFloat() * 0.2F);
- this.G = this.k.nextInt(12000) + 6000;
+ this.makeSound((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
+ this.G = this.random.nextInt(12000) + 6000;
}
}
}
@@ -1472,7 +1473,7 @@ public class World implements IBlockAccess {
int i2 = chunk.b[j1 << 11 | k1 << 7 | l1] & 255;
if (Block.n[i2]) {
- Block.byId[i2].a(this, j1 + i, l1, k1 + j, this.k);
+ Block.byId[i2].a(this, j1 + i, l1, k1 + j, this.random);
}
}
}
@@ -1491,7 +1492,7 @@ public class World implements IBlockAccess {
for (int j = 0; j < i; ++j) {
NextTickListEntry nextticklistentry = (NextTickListEntry) this.w.first();
- if (!flag && nextticklistentry.e > this.q.f()) {
+ if (!flag && nextticklistentry.e > this.worldData.f()) {
break;
}
@@ -1503,7 +1504,7 @@ public class World implements IBlockAccess {
int k = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
if (k == nextticklistentry.d && k > 0) {
- Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.k);
+ Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
}
}
}
@@ -1514,15 +1515,15 @@ public class World implements IBlockAccess {
public List b(Entity entity, AxisAlignedBB axisalignedbb) {
this.H.clear();
- int i = MathHelper.b((axisalignedbb.a - 2.0D) / 16.0D);
- int j = MathHelper.b((axisalignedbb.d + 2.0D) / 16.0D);
- int k = MathHelper.b((axisalignedbb.c - 2.0D) / 16.0D);
- int l = MathHelper.b((axisalignedbb.f + 2.0D) / 16.0D);
+ int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
+ int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
+ int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
+ int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D);
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
- if (this.f(i1, j1)) {
- this.c(i1, j1).a(entity, axisalignedbb, this.H);
+ if (this.isChunkLoaded(i1, j1)) {
+ this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.H);
}
}
}
@@ -1531,16 +1532,16 @@ public class World implements IBlockAccess {
}
public List a(Class oclass, AxisAlignedBB axisalignedbb) {
- int i = MathHelper.b((axisalignedbb.a - 2.0D) / 16.0D);
- int j = MathHelper.b((axisalignedbb.d + 2.0D) / 16.0D);
- int k = MathHelper.b((axisalignedbb.c - 2.0D) / 16.0D);
- int l = MathHelper.b((axisalignedbb.f + 2.0D) / 16.0D);
+ int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
+ int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
+ int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
+ int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D);
ArrayList arraylist = new ArrayList();
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
- if (this.f(i1, j1)) {
- this.c(i1, j1).a(oclass, axisalignedbb, arraylist);
+ if (this.isChunkLoaded(i1, j1)) {
+ this.getChunkAt(i1, j1).a(oclass, axisalignedbb, arraylist);
}
}
}
@@ -1549,7 +1550,7 @@ public class World implements IBlockAccess {
}
public void b(int i, int j, int k, TileEntity tileentity) {
- if (this.f(i, j, k)) {
+ if (this.isLoaded(i, j, k)) {
this.b(i, k).f();
}
@@ -1561,8 +1562,8 @@ public class World implements IBlockAccess {
public int a(Class oclass) {
int i = 0;
- for (int j = 0; j < this.b.size(); ++j) {
- Entity entity = (Entity) this.b.get(j);
+ for (int j = 0; j < this.entityList.size(); ++j) {
+ Entity entity = (Entity) this.entityList.get(j);
if (oclass.isAssignableFrom(entity.getClass())) {
++i;
@@ -1585,7 +1586,7 @@ public class World implements IBlockAccess {
}
}
- this.b.add(entity);
+ this.entityList.add(entity);
// CraftBukkit end
this.b((Entity) list.get(i));
}
@@ -1606,9 +1607,9 @@ public class World implements IBlockAccess {
}
// CraftBukkit start - We dont want to allow the user to override the bounding box check
- boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
+ boolean defaultReturn = axisalignedbb != null && !this.containsEntity(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.canPlace(this, j, k, l) : true);
- if (axisalignedbb != null && !this.a(axisalignedbb)) {
+ if (axisalignedbb != null && !this.containsEntity(axisalignedbb)) {
return false;
}
@@ -1619,10 +1620,10 @@ public class World implements IBlockAccess {
// CraftBukkit end
}
- public PathEntity a(Entity entity, Entity entity1, float f) {
- int i = MathHelper.b(entity.locX);
- int j = MathHelper.b(entity.locY);
- int k = MathHelper.b(entity.locZ);
+ public PathEntity findPath(Entity entity, Entity entity1, float f) {
+ int i = MathHelper.floor(entity.locX);
+ int j = MathHelper.floor(entity.locY);
+ int k = MathHelper.floor(entity.locZ);
int l = (int) (f + 16.0F);
int i1 = i - l;
int j1 = j - l;
@@ -1636,9 +1637,9 @@ public class World implements IBlockAccess {
}
public PathEntity a(Entity entity, int i, int j, int k, float f) {
- int l = MathHelper.b(entity.locX);
- int i1 = MathHelper.b(entity.locY);
- int j1 = MathHelper.b(entity.locZ);
+ int l = MathHelper.floor(entity.locX);
+ int i1 = MathHelper.floor(entity.locY);
+ int j1 = MathHelper.floor(entity.locZ);
int k1 = (int) (f + 8.0F);
int l1 = l - k1;
int i2 = i1 - k1;
@@ -1651,28 +1652,28 @@ public class World implements IBlockAccess {
return (new Pathfinder(chunkcache)).a(entity, i, j, k, f);
}
- public boolean i(int i, int j, int k, int l) {
+ public boolean isBlockFacePowered(int i, int j, int k, int l) {
int i1 = this.getTypeId(i, j, k);
return i1 == 0 ? false : Block.byId[i1].c(this, i, j, k, l);
}
- public boolean o(int i, int j, int k) {
- return this.i(i, j - 1, k, 0) ? true : (this.i(i, j + 1, k, 1) ? true : (this.i(i, j, k - 1, 2) ? true : (this.i(i, j, k + 1, 3) ? true : (this.i(i - 1, j, k, 4) ? true : this.i(i + 1, j, k, 5)))));
+ public boolean isBlockPowered(int i, int j, int k) {
+ return this.isBlockFacePowered(i, j - 1, k, 0) ? true : (this.isBlockFacePowered(i, j + 1, k, 1) ? true : (this.isBlockFacePowered(i, j, k - 1, 2) ? true : (this.isBlockFacePowered(i, j, k + 1, 3) ? true : (this.isBlockFacePowered(i - 1, j, k, 4) ? true : this.isBlockFacePowered(i + 1, j, k, 5)))));
}
- public boolean j(int i, int j, int k, int l) {
+ public boolean isBlockFaceIndirectlyPowered(int i, int j, int k, int l) {
if (this.d(i, j, k)) {
- return this.o(i, j, k);
+ return this.isBlockPowered(i, j, k);
} else {
int i1 = this.getTypeId(i, j, k);
- return i1 == 0 ? false : Block.byId[i1].b((IBlockAccess) this, i, j, k, l);
+ return i1 == 0 ? false : Block.byId[i1].b(this, i, j, k, l);
}
}
- public boolean p(int i, int j, int k) {
- return this.j(i, j - 1, k, 0) ? true : (this.j(i, j + 1, k, 1) ? true : (this.j(i, j, k - 1, 2) ? true : (this.j(i, j, k + 1, 3) ? true : (this.j(i - 1, j, k, 4) ? true : this.j(i + 1, j, k, 5)))));
+ public boolean isBlockIndirectlyPowered(int i, int j, int k) {
+ return this.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (this.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (this.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : this.isBlockFaceIndirectlyPowered(i + 1, j, k, 5)))));
}
public EntityHuman a(Entity entity, double d0) {
@@ -1683,8 +1684,8 @@ public class World implements IBlockAccess {
double d4 = -1.0D;
EntityHuman entityhuman = null;
- for (int i = 0; i < this.d.size(); ++i) {
- EntityHuman entityhuman1 = (EntityHuman) this.d.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
double d5 = entityhuman1.d(d0, d1, d2);
if ((d3 < 0.0D || d5 < d3 * d3) && (d4 == -1.0D || d5 < d4)) {
@@ -1697,9 +1698,9 @@ public class World implements IBlockAccess {
}
public EntityHuman a(String s) {
- for (int i = 0; i < this.d.size(); ++i) {
- if (s.equals(((EntityHuman) this.d.get(i)).name)) {
- return (EntityHuman) this.d.get(i);
+ for (int i = 0; i < this.players.size(); ++i) {
+ if (s.equals(((EntityHuman) this.players.get(i)).name)) {
+ return (EntityHuman) this.players.get(i);
}
}
@@ -1748,7 +1749,7 @@ public class World implements IBlockAccess {
k4 = 16;
}
- k2 = this.c(j3, i4).a(abyte, k3, l2, j4, l3, i3, k4, k2);
+ k2 = this.getChunkAt(j3, i4).a(abyte, k3, l2, j4, l3, i3, k4, k2);
}
}
@@ -1759,20 +1760,20 @@ public class World implements IBlockAccess {
this.p.b();
}
- public void a(long i) {
- this.q.a(i);
+ public void setTime(long i) {
+ this.worldData.a(i);
}
- public long k() {
- return this.q.b();
+ public long getSeed() {
+ return this.worldData.b();
}
- public long l() {
- return this.q.f();
+ public long getTime() {
+ return this.worldData.f();
}
- public ChunkCoordinates m() {
- return new ChunkCoordinates(this.q.c(), this.q.d(), this.q.e());
+ public ChunkCoordinates getSpawn() {
+ return new ChunkCoordinates(this.worldData.c(), this.worldData.d(), this.worldData.e());
}
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
@@ -1782,7 +1783,7 @@ public class World implements IBlockAccess {
public void a(Entity entity, byte b0) {}
public IChunkProvider n() {
- return this.o;
+ return this.chunkProvider;
}
public void d(int i, int j, int k, int l, int i1) {
@@ -1798,19 +1799,18 @@ public class World implements IBlockAccess {
}
public WorldData p() {
- return this.q;
+ return this.worldData;
}
- public void q() {
- this.A = !this.d.isEmpty();
- Iterator iterator = this.d.iterator();
+ public void everyoneSleeping() {
+ this.A = !this.players.isEmpty();
+ Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
- // CraftBukkit start
- if (!entityhuman.F() && !entityhuman.fauxSleeping) {
- // CraftBukkit end
+ // CraftBukkit
+ if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) {
this.A = false;
break;
}
@@ -1822,31 +1822,31 @@ public class World implements IBlockAccess {
// Called by CraftPlayer.setPermanentSleeping()
public void checkSleepStatus() {
if (!isStatic) {
- q();
+ everyoneSleeping();
}
}
// CraftBukkit end
protected void r() {
this.A = false;
- Iterator iterator = this.d.iterator();
+ Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
- if (entityhuman.F()) {
+ if (entityhuman.isSleeping()) {
entityhuman.a(false, false, false);
}
}
}
- public boolean s() {
+ public boolean everyoneDeeplySleeping() {
if (this.A && !this.isStatic) {
- Iterator iterator = this.d.iterator();
-
+ Iterator iterator = this.players.iterator();
+
// CraftBukkit start
boolean foundActualSleepers = false;
-
+
// This allows us to assume that some people are in bed
// but not really, allowing time to pass in spite of AFKers
@@ -1858,10 +1858,10 @@ public class World implements IBlockAccess {
}
entityhuman = (EntityHuman) iterator.next();
- if (entityhuman.G()) {
+ if (entityhuman.isDeeplySleeping()) {
foundActualSleepers = true;
}
- } while (entityhuman.G() || entityhuman.fauxSleeping);
+ } while (entityhuman.isDeeplySleeping() || entityhuman.fauxSleeping);
// CraftBukkit end
return false;
diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java
index c63bb194..233a3974 100644
--- a/src/main/java/net/minecraft/server/WorldData.java
+++ b/src/main/java/net/minecraft/server/WorldData.java
@@ -13,7 +13,7 @@ public class WorldData {
private long g;
private NBTTagCompound h;
private int i;
- public String j; // CraftBukkit private->public
+ public String name; // CraftBukkit private->public
private int k;
public WorldData(NBTTagCompound nbttagcompound) {
@@ -24,9 +24,9 @@ public class WorldData {
this.e = nbttagcompound.f("Time");
this.f = nbttagcompound.f("LastPlayed");
this.g = nbttagcompound.f("SizeOnDisk");
- this.j = nbttagcompound.i("LevelName");
+ this.name = nbttagcompound.getString("LevelName");
this.k = nbttagcompound.e("version");
- if (nbttagcompound.b("Player")) {
+ if (nbttagcompound.hasKey("Player")) {
this.h = nbttagcompound.k("Player");
this.i = this.h.e("Dimension");
}
@@ -34,7 +34,7 @@ public class WorldData {
public WorldData(long i, String s) {
this.a = i;
- this.j = s;
+ this.name = s;
}
public WorldData(WorldData worlddata) {
@@ -47,7 +47,7 @@ public class WorldData {
this.g = worlddata.g;
this.h = worlddata.h;
this.i = worlddata.i;
- this.j = worlddata.j;
+ this.name = worlddata.name;
this.k = worlddata.k;
}
@@ -84,7 +84,7 @@ public class WorldData {
nbttagcompound.a("Time", this.e);
nbttagcompound.a("SizeOnDisk", this.g);
nbttagcompound.a("LastPlayed", System.currentTimeMillis());
- nbttagcompound.a("LevelName", this.j);
+ nbttagcompound.setString("LevelName", this.name);
nbttagcompound.a("version", this.k);
if (nbttagcompound1 != null) {
nbttagcompound.a("Player", nbttagcompound1);
@@ -127,14 +127,14 @@ public class WorldData {
this.g = i;
}
- public void a(int i, int j, int k) {
+ public void setSpawn(int i, int j, int k) {
this.b = i;
this.c = j;
this.d = k;
}
public void a(String s) {
- this.j = s;
+ this.name = s;
}
public int i() {
diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java
index 693b371d..5ef40e15 100644
--- a/src/main/java/net/minecraft/server/WorldGenBigTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java
@@ -121,7 +121,7 @@ public class WorldGenBigTree extends WorldGenerator {
if (l1 != 0 && l1 != 18) {
++k1;
} else {
- this.c.setTypeId(aint1[0], aint1[1], aint1[2], l);
+ this.c.setRawTypeId(aint1[0], aint1[1], aint1[2], l);
++k1;
}
}
@@ -194,10 +194,10 @@ public class WorldGenBigTree extends WorldGenerator {
int j = 0;
for (int k = aint2[b1] + b4; j != k; j += b4) {
- aint3[b1] = MathHelper.b((double) (aint[b1] + j) + 0.5D);
- aint3[b2] = MathHelper.b((double) aint[b2] + (double) j * d0 + 0.5D);
- aint3[b3] = MathHelper.b((double) aint[b3] + (double) j * d1 + 0.5D);
- this.c.setTypeId(aint3[0], aint3[1], aint3[2], i);
+ aint3[b1] = MathHelper.floor((double) (aint[b1] + j) + 0.5D);
+ aint3[b2] = MathHelper.floor((double) aint[b2] + (double) j * d0 + 0.5D);
+ aint3[b3] = MathHelper.floor((double) aint[b3] + (double) j * d1 + 0.5D);
+ this.c.setRawTypeId(aint3[0], aint3[1], aint3[2], i);
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java
index 3cccabbb..288aaefd 100644
--- a/src/main/java/net/minecraft/server/WorldGenForest.java
+++ b/src/main/java/net/minecraft/server/WorldGenForest.java
@@ -59,7 +59,7 @@ public class WorldGenForest extends WorldGenerator {
} else {
i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
- world.setTypeId(i, j - 1, k, Block.DIRT.id);
+ world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
int i2;
@@ -74,7 +74,7 @@ public class WorldGenForest extends WorldGenerator {
int l2 = k2 - k;
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
- world.setTypeIdAndData(l1, i2, k2, Block.LEAVES.id, 2);
+ world.setRawTypeIdAndData(l1, i2, k2, Block.LEAVES.id, 2);
}
}
}
@@ -83,7 +83,7 @@ public class WorldGenForest extends WorldGenerator {
for (i2 = 0; i2 < l; ++i2) {
j1 = world.getTypeId(i, j + i2, k);
if (j1 == 0 || j1 == Block.LEAVES.id) {
- world.setTypeIdAndData(i, j + i2, k, Block.LOG.id, 2);
+ world.setRawTypeIdAndData(i, j + i2, k, Block.LOG.id, 2);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
index cf03e450..972f806d 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
@@ -61,7 +61,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
} else {
l1 = world.getTypeId(i, j - 1, k);
if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
- world.setTypeId(i, j - 1, k, Block.DIRT.id);
+ world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
l2 = 0;
for (i2 = j + l; i2 >= j + i1; --i2) {
@@ -72,7 +72,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
int j3 = i3 - k;
if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.o[world.getTypeId(j2, i2, i3)]) {
- world.setTypeIdAndData(j2, i2, i3, Block.LEAVES.id, 1);
+ world.setRawTypeIdAndData(j2, i2, i3, Block.LEAVES.id, 1);
}
}
}
@@ -87,7 +87,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
for (i2 = 0; i2 < l - 1; ++i2) {
j2 = world.getTypeId(i, j + i2, k);
if (j2 == 0 || j2 == Block.LEAVES.id) {
- world.setTypeIdAndData(i, j + i2, k, Block.LOG.id, 1);
+ world.setRawTypeIdAndData(i, j + i2, k, Block.LOG.id, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index 7af3f12d..6bee4ce4 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -60,7 +60,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
} else {
l1 = world.getTypeId(i, j - 1, k);
if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
- world.setTypeId(i, j - 1, k, Block.DIRT.id);
+ world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
k2 = random.nextInt(2);
i2 = 1;
byte b0 = 0;
@@ -78,7 +78,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
int i4 = l3 - k;
if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.o[world.getTypeId(i3, j3, l3)]) {
- world.setTypeIdAndData(i3, j3, l3, Block.LEAVES.id, 1);
+ world.setRawTypeIdAndData(i3, j3, l3, Block.LEAVES.id, 1);
}
}
}
@@ -100,7 +100,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
for (j3 = 0; j3 < l - j2; ++j3) {
i3 = world.getTypeId(i, j + j3, k);
if (i3 == 0 || i3 == Block.LEAVES.id) {
- world.setTypeIdAndData(i, j + j3, k, Block.LOG.id, 1);
+ world.setRawTypeIdAndData(i, j + j3, k, Block.LOG.id, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index 93142cdb..c5baf5c2 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -59,7 +59,7 @@ public class WorldGenTrees extends WorldGenerator {
} else {
i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
- world.setTypeId(i, j - 1, k, Block.DIRT.id);
+ world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
int i2;
@@ -74,7 +74,7 @@ public class WorldGenTrees extends WorldGenerator {
int l2 = k2 - k;
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
- world.setTypeId(l1, i2, k2, Block.LEAVES.id);
+ world.setRawTypeId(l1, i2, k2, Block.LEAVES.id);
}
}
}
@@ -83,7 +83,7 @@ public class WorldGenTrees extends WorldGenerator {
for (i2 = 0; i2 < l; ++i2) {
j1 = world.getTypeId(i, j + i2, k);
if (j1 == 0 || j1 == Block.LEAVES.id) {
- world.setTypeId(i, j + i2, k, Block.LOG.id);
+ world.setRawTypeId(i, j + i2, k, Block.LOG.id);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index d96c1699..f565a9f9 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -2,23 +2,23 @@ package net.minecraft.server;
public class WorldManager implements IWorldAccess {
- private MinecraftServer a;
+ private MinecraftServer server;
public WorldServer world; // CraftBukkit
// CraftBukkit - changed signature
public WorldManager(MinecraftServer minecraftserver, WorldServer world) {
- this.a = minecraftserver;
+ this.server = minecraftserver;
this.world = world; // CraftBukkit
}
public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {}
public void a(Entity entity) {
- this.a.k.a(entity);
+ this.server.tracker.a(entity);
}
public void b(Entity entity) {
- this.a.k.b(entity);
+ this.server.tracker.untrackEntity(entity);
}
public void a(String s, double d0, double d1, double d2, float f, float f1) {}
@@ -28,13 +28,13 @@ public class WorldManager implements IWorldAccess {
public void a() {}
public void a(int i, int j, int k) {
- // CraftBukkit
- this.a.f.a(i, j, k, world);
+ // CraftBukkit -- add world argument
+ this.server.serverConfigurationManager.flagDirty(i, j, k, world);
}
public void a(String s, int i, int j, int k) {}
public void a(int i, int j, int k, TileEntity tileentity) {
- this.a.f.a(i, j, k, tileentity);
+ this.server.serverConfigurationManager.a(i, j, k, tileentity);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5172d506..805a42ea 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -12,59 +12,59 @@ import org.bukkit.craftbukkit.CraftWorld;
public class WorldServer extends World implements BlockChangeDelegate {
// CraftBukkit end
- public ChunkProviderServer u;
- public boolean v = false;
+ public ChunkProviderServer chunkProviderServer;
+ public boolean weirdIsOpCache = false;
public boolean w;
- public final MinecraftServer x; // CraftBukkit - private -> public final
+ public final MinecraftServer server; // CraftBukkit - private -> public final
private EntityList y = new EntityList();
public PlayerManager manager; // CraftBukkit
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, long j) {
super(idatamanager, s, j, WorldProvider.a(i));
- this.x = minecraftserver;
+ this.server = minecraftserver;
// CraftBukkit start
- this.server = minecraftserver.server;
+ this.cserver = minecraftserver.server;
this.world = new CraftWorld(this);
this.manager = new PlayerManager(minecraftserver, this);
}
private final CraftWorld world;
- private final CraftServer server;
+ private final CraftServer cserver;
public CraftWorld getWorld() {
return world;
}
public CraftServer getServer() {
- return server;
+ return cserver;
}
// CraftBukkit end
- public void a(Entity entity, boolean flag) {
+ public void entityJoinedWorld(Entity entity, boolean flag) {
// CraftBukkit start -- We prevent spawning in general, so this butchering is not needed
- //if (!this.x.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
- // entity.D();
+ //if (!this.server.spawnAnimals && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
+ // entity.die();
//}
// CraftBukkit end
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
- super.a(entity, flag);
+ super.entityJoinedWorld(entity, flag);
}
}
- public void b(Entity entity, boolean flag) {
- super.a(entity, flag);
+ public void vehicleEnteredWorld(Entity entity, boolean flag) {
+ super.entityJoinedWorld(entity, flag);
}
protected IChunkProvider b() {
- IChunkLoader ichunkloader = this.p.a(this.m);
+ IChunkLoader ichunkloader = this.p.a(this.worldProvider);
- this.u = new ChunkProviderServer(this, ichunkloader, this.m.c());
- return this.u;
+ this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.worldProvider.c());
+ return this.chunkProviderServer;
}
- public List d(int i, int j, int k, int l, int i1, int j1) {
+ public List getTileEntities(int i, int j, int k, int l, int i1, int j1) {
ArrayList arraylist = new ArrayList();
for (int k1 = 0; k1 < this.c.size(); ++k1) {
@@ -79,15 +79,15 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
- int l = (int) MathHelper.e((float) (i - this.q.c()));
- int i1 = (int) MathHelper.e((float) (k - this.q.e()));
+ int l = (int) MathHelper.abs((float) (i - this.worldData.c()));
+ int i1 = (int) MathHelper.abs((float) (k - this.worldData.e()));
if (l > i1) {
i1 = l;
}
// CraftBukkit -- Configurable spawn protection
- return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name);
+ return i1 > this.server.spawnProtection || this.server.serverConfigurationManager.isOp(entityhuman.name);
}
protected void b(Entity entity) {
@@ -100,18 +100,18 @@ public class WorldServer extends World implements BlockChangeDelegate {
this.y.d(entity.id);
}
- public Entity a(int i) {
+ public Entity getEntity(int i) {
return (Entity) this.y.a(i);
}
public void a(Entity entity, byte b0) {
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
- this.x.k.b(entity, packet38entitystatus);
+ this.server.tracker.b(entity, packet38entitystatus);
}
- public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
- Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
+ public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
+ Explosion explosion = super.createExplosion(entity, d0, d1, d2, f, flag);
// CraftBukkit start
if (explosion.wasCanceled) {
@@ -119,16 +119,16 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
// CraftBukkit end
- this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
+ this.server.serverConfigurationManager.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
return explosion;
}
public void d(int i, int j, int k, int l, int i1) {
super.d(i, j, k, l, i1);
- this.x.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
+ this.server.serverConfigurationManager.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
}
- public void t() {
+ public void saveLevel() {
this.p.e();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index fb854054..06df2b14 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -20,12 +20,12 @@ public class CraftChunk implements Chunk {
private WorldServer worldServer;
private int x;
private int z;
-
+
public CraftChunk(net.minecraft.server.Chunk chunk) {
this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
- worldServer = (WorldServer) getHandle().d;
- x = getHandle().j;
- z = getHandle().k;
+ worldServer = (WorldServer) getHandle().world;
+ x = getHandle().x;
+ z = getHandle().z;
}
public World getWorld() {
@@ -35,7 +35,7 @@ public class CraftChunk implements Chunk {
public net.minecraft.server.Chunk getHandle() {
net.minecraft.server.Chunk c = weakChunk.get();
if (c == null) {
- c = worldServer.c(x,z);
+ c = worldServer.getChunkAt(x,z);
weakChunk = new WeakReference<net.minecraft.server.Chunk>(c);
}
return c;
@@ -77,12 +77,12 @@ public class CraftChunk implements Chunk {
int count = 0, index = 0;
net.minecraft.server.Chunk chunk = getHandle();
for (int i = 0; i < 8; i++) {
- count += chunk.m[i].size();
+ count += chunk.entitySlices[i].size();
}
Entity[] entities = new Entity[count];
for (int i = 0; i < 8; i++) {
- for (Object obj: chunk.m[i].toArray()) {
+ for (Object obj: chunk.entitySlices[i].toArray()) {
if (!(obj instanceof net.minecraft.server.Entity)) continue;
entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity();
}
@@ -93,11 +93,11 @@ public class CraftChunk implements Chunk {
public BlockState[] getTileEntities() {
int index = 0;
net.minecraft.server.Chunk chunk = getHandle();
- BlockState[] entities = new BlockState[chunk.l.size()];
- for (Object obj : chunk.l.keySet().toArray()) {
- if (!(obj instanceof ChunkPosition)) continue;
+ BlockState[] entities = new BlockState[chunk.tileEntities.size()];
+ for (Object obj : chunk.tileEntities.keySet().toArray()) {
+ if (!(obj instanceof ChunkPosition)) continue;
ChunkPosition position = (ChunkPosition) obj;
- entities[index++] = worldServer.getWorld().getBlockAt(position.a + (chunk.j << 4), position.b, position.c + (chunk.k << 4)).getState();
+ entities[index++] = worldServer.getWorld().getBlockAt(position.x + (chunk.x << 4), position.y, position.z + (chunk.z << 4)).getState();
}
return entities;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e15a39c5..90fbb28c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -127,11 +127,11 @@ public final class CraftServer implements Server {
}
public Player[] getOnlinePlayers() {
- List<EntityPlayer> online = server.b;
+ List<EntityPlayer> online = server.players;
Player[] players = new Player[online.size()];
for (int i = 0; i < players.length; i++) {
- players[i] = online.get(i).a.getPlayer();
+ players[i] = online.get(i).netServerHandler.getPlayer();
}
return players;
@@ -167,7 +167,7 @@ public final class CraftServer implements Server {
}
public Player getPlayer(final EntityPlayer entity) {
- return entity.a.getPlayer();
+ return entity.netServerHandler.getPlayer();
}
public List<Player> matchPlayer(String partialName) {
@@ -192,7 +192,7 @@ public final class CraftServer implements Server {
}
public int getMaxPlayers() {
- return server.e;
+ return server.maxPlayers;
}
// NOTE: These are dependent on the corrisponding call in MinecraftServer
@@ -215,11 +215,11 @@ public final class CraftServer implements Server {
// NOTE: Temporary calls through to server.properies until its replaced
private String getConfigString(String variable, String defaultValue) {
- return this.console.d.a(variable, defaultValue);
+ return this.console.propertyManager.getString(variable, defaultValue);
}
private int getConfigInt(String variable, int defaultValue) {
- return this.console.d.a(variable, defaultValue);
+ return this.console.propertyManager.getInt(variable, defaultValue);
}
// End Temporary calls
@@ -243,10 +243,10 @@ public final class CraftServer implements Server {
// NOTE: Should only be called from MinecraftServer.b()
public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) {
- if ( commandMap.dispatch(sender, serverCommand.a) ) {
+ if ( commandMap.dispatch(sender, serverCommand.command) ) {
return true;
}
- return console.o.a(serverCommand);
+ return console.consoleCommandHandler.handle(serverCommand);
}
public boolean dispatchCommand(CommandSender sender, String commandLine) {
@@ -260,24 +260,24 @@ public final class CraftServer implements Server {
}
// See if the server can process this command
- return console.o.a(new ServerCommand(commandLine, new CommandListener(sender)));
+ return console.consoleCommandHandler.handle(new ServerCommand(commandLine, new CommandListener(sender)));
}
public void reload() {
PropertyManager config = new PropertyManager(console.options);
- console.d = config;
+ console.propertyManager = config;
- boolean animals = config.a("spawn-monsters", console.m);
- boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0);
+ boolean animals = config.getBoolean("spawn-monsters", console.spawnAnimals);
+ boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).spawnMonsters > 0);
- console.l = config.a("online-mode", console.l);
- console.m = config.a("spawn-animals", console.m);
- console.n = config.a("pvp", console.n);
+ console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
+ console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
+ console.pvpMode = config.getBoolean("pvp", console.pvpMode);
for (WorldServer world : console.worlds) {
- world.j = monsters ? 1 : 0;
- world.a(monsters, animals);
+ world.spawnMonsters = monsters ? 1 : 0;
+ world.setSpawnFlags(monsters, animals);
}
pluginManager.clearPlugins();
@@ -307,17 +307,17 @@ public final class CraftServer implements Server {
}
Convertable converter = new WorldLoaderServer(folder);
- if (converter.a(name)) {
+ if (converter.isConvertable(name)) {
getLogger().info("Converting world '" + name + "'");
- converter.a(name, new ConvertProgressUpdater(console));
+ converter.convert(name, new ConvertProgressUpdater(console));
}
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0, seed);
- internal.a(new WorldManager(console, internal));
- internal.j = 1;
- internal.a(true, true);
- console.f.a(internal);
+ internal.addIWorldAccess(new WorldManager(console, internal));
+ internal.spawnMonsters = 1;
+ internal.setSpawnFlags(true, true);
+ console.serverConfigurationManager.setPlayerFileData(internal);
console.worlds.add(internal);
short short1 = 196;
@@ -338,10 +338,10 @@ public final class CraftServer implements Server {
i = l;
}
- ChunkCoordinates chunkcoordinates = internal.m();
- internal.u.c(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
+ ChunkCoordinates chunkcoordinates = internal.getSpawn();
+ internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
- while (internal.f()) {
+ while (internal.doLighting()) {
;
}
}
@@ -363,7 +363,7 @@ public final class CraftServer implements Server {
}
public Logger getLogger() {
- return MinecraftServer.a;
+ return MinecraftServer.log;
}
public ConsoleReader getReader() {
@@ -381,7 +381,7 @@ public final class CraftServer implements Server {
}
public void savePlayers() {
- server.d();
+ server.savePlayers();
}
public void configureDbConfig(ServerConfig config) {
@@ -410,11 +410,11 @@ public final class CraftServer implements Server {
this.prefix = parts[parts.length-1];
}
- public void b(String msg) {
+ public void sendMessage(String msg) {
this.commandSender.sendMessage(msg);
}
- public String c() {
+ public String getName() {
return this.prefix;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b487b6d5..162a2bfb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -34,9 +34,9 @@ public class CraftWorld implements World {
public CraftWorld(WorldServer world) {
this.world = world;
this.server = world.getServer();
- this.provider = world.u;
+ this.provider = world.chunkProviderServer;
- if (world.m instanceof WorldProviderHell) {
+ if (world.worldProvider instanceof WorldProviderHell) {
environment = Environment.NETHER;
} else {
environment = Environment.NORMAL;
@@ -63,18 +63,18 @@ public class CraftWorld implements World {
}
public int getHighestBlockYAt(int x, int z) {
- return world.d(x, z);
+ return world.getHighestBlockYAt(x, z);
}
public Location getSpawnLocation() {
- ChunkCoordinates spawn = world.m();
- return new Location(this, spawn.a, spawn.b, spawn.c);
+ ChunkCoordinates spawn = world.getSpawn();
+ return new Location(this, spawn.x, spawn.y, spawn.z);
}
-
+
public boolean setSpawnLocation(int x, int y, int z) {
try {
Location previousLocation = getSpawnLocation();
- world.q.a(x, y, z);
+ world.worldData.setSpawn(x, y, z);
// Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
@@ -85,9 +85,9 @@ public class CraftWorld implements World {
return false;
}
}
-
+
public Chunk getChunkAt(int x, int z) {
- return this.provider.c(x, z).bukkitChunk;
+ return this.provider.getChunkAt(x,z).bukkitChunk;
}
public Chunk getChunkAt(Block block) {
@@ -95,11 +95,11 @@ public class CraftWorld implements World {
}
public boolean isChunkLoaded(int x, int z) {
- return provider.a( x, z );
+ return provider.isChunkLoaded( x, z );
}
public Chunk[] getLoadedChunks() {
- Object[] chunks = provider.e.values().toArray();
+ Object[] chunks = provider.chunks.values().toArray();
org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length];
for (int i = 0; i < chunks.length; i++) {
@@ -131,7 +131,7 @@ public class CraftWorld implements World {
return false;
}
- provider.d(x, z);
+ provider.queueUnload(x, z);
return true;
}
@@ -140,34 +140,34 @@ public class CraftWorld implements World {
if (safe && isChunkInUse(x, z)) {
return false;
}
-
- net.minecraft.server.Chunk chunk = provider.b(x, z);
-
+
+ net.minecraft.server.Chunk chunk = provider.getOrCreateChunk(x, z);
+
if (save) {
- chunk.e();
- provider.b(chunk);
- provider.a(chunk);
+ chunk.removeEntities();
+ provider.saveChunk(chunk);
+ provider.saveChunkNOP(chunk);
}
- preserveChunk((CraftChunk)chunk.bukkitChunk);
- provider.a.remove(x, z);
- provider.e.remove(x, z);
- provider.f.remove(chunk);
-
+ preserveChunk((CraftChunk) chunk.bukkitChunk);
+ provider.unloadQueue.remove(x, z);
+ provider.chunks.remove(x, z);
+ provider.chunkList.remove(chunk);
+
return true;
}
public boolean regenerateChunk(int x, int z) {
unloadChunk(x, z, false, false);
- provider.a.remove(x, z);
+ provider.unloadQueue.remove(x, z);
net.minecraft.server.Chunk chunk = null;
- if (provider.c == null) {
- chunk = provider.b;
+ if (provider.chunkProvider == null) {
+ chunk = provider.emptyChunk;
} else {
- chunk = provider.c.b(x, z);
+ chunk = provider.chunkProvider.getOrCreateChunk(x, z);
}
chunkLoadPostProcess(chunk, x, z);
@@ -191,9 +191,9 @@ public class CraftWorld implements World {
// The server will compress the chunk and send it to all clients
for(int xx = px; xx < (px + 16); xx++) {
- world.g(xx, 0, pz);
+ world.notify(xx, 0, pz);
}
- world.g(px, 127, pz+15);
+ world.notify(px, 127, pz+15);
return true;
}
@@ -201,10 +201,10 @@ public class CraftWorld implements World {
public boolean isChunkInUse(int x, int z) {
Player[] players = server.getOnlinePlayers();
-
+
for (Player player : players) {
Location loc = player.getLocation();
- if (loc.getWorld() != provider.g.getWorld()) {
+ if (loc.getWorld() != provider.world.getWorld()) {
continue;
}
@@ -221,14 +221,14 @@ public class CraftWorld implements World {
public boolean loadChunk(int x, int z, boolean generate) {
if (generate) {
// Use the default variant of loadChunk when generate == true.
- return provider.c(x, z) != null;
+ return provider.getChunkAt(x, z) != null;
}
- provider.a.remove(x, z);
- net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.e.get(x, z);
+ provider.unloadQueue.remove(x, z);
+ net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.chunks.get(x, z);
if (chunk == null) {
- chunk = provider.e(x, z);
+ chunk = provider.loadChunk(x, z);
chunkLoadPostProcess(chunk, x, z);
}
@@ -237,26 +237,26 @@ public class CraftWorld implements World {
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
if (chunk != null) {
- provider.e.put(x, z, chunk);
- provider.f.add(chunk);
+ provider.chunks.put(x, z, chunk);
+ provider.chunkList.add(chunk);
- chunk.c();
- chunk.d();
+ chunk.loadNOP();
+ chunk.addEntities();
- if (!chunk.n && provider.a(x + 1, z + 1) && provider.a(x, z + 1) && provider.a(x + 1, z)) {
- provider.a(provider, x, z);
+ if (!chunk.done && provider.isChunkLoaded(x + 1, z + 1) && provider.isChunkLoaded(x, z + 1) && provider.isChunkLoaded(x + 1, z)) {
+ provider.getChunkAt(provider, x, z);
}
- if (provider.a(x - 1, z) && !provider.b(x - 1, z).n && provider.a(x - 1, z + 1) && provider.a(x, z + 1) && provider.a(x - 1, z)) {
- provider.a(provider, x - 1, z);
+ if (provider.isChunkLoaded(x - 1, z) && !provider.getOrCreateChunk(x - 1, z).done && provider.isChunkLoaded(x - 1, z + 1) && provider.isChunkLoaded(x, z + 1) && provider.isChunkLoaded(x - 1, z)) {
+ provider.getChunkAt(provider, x - 1, z);
}
- if (provider.a(x, z - 1) && !provider.b(x, z - 1).n && provider.a(x + 1, z - 1) && provider.a(x, z - 1) && provider.a(x + 1, z)) {
- provider.a(provider, x, z - 1);
+ if (provider.isChunkLoaded(x, z - 1) && !provider.getOrCreateChunk(x, z - 1).done && provider.isChunkLoaded(x + 1, z - 1) && provider.isChunkLoaded(x, z - 1) && provider.isChunkLoaded(x + 1, z)) {
+ provider.getChunkAt(provider, x, z - 1);
}
- if (provider.a(x - 1, z - 1) && !provider.b(x - 1, z - 1).n && provider.a(x - 1, z - 1) && provider.a(x, z - 1) && provider.a(x - 1, z)) {
- provider.a(provider, x - 1, z - 1);
+ if (provider.isChunkLoaded(x - 1, z - 1) && !provider.getOrCreateChunk(x - 1, z - 1).done && provider.isChunkLoaded(x - 1, z - 1) && provider.isChunkLoaded(x, z - 1) && provider.isChunkLoaded(x - 1, z)) {
+ provider.getChunkAt(provider, x - 1, z - 1);
}
}
}
@@ -281,17 +281,17 @@ public class CraftWorld implements World {
item.getDurability()
);
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
- entity.c = 10;
- world.a(entity);
+ entity.pickupDelay = 10;
+ world.addEntity(entity);
//TODO this is inconsistent with how Entity.getBukkitEntity() works.
// However, this entity is not at the moment backed by a server entity class so it may be left.
return new CraftItem(world.getServer(), entity);
}
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
- double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
- double ys = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
- double zs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
+ double xs = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
+ double ys = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
+ double zs = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
loc = loc.clone();
loc.setX(loc.getX() + xs);
loc.setY(loc.getY() + ys);
@@ -301,8 +301,8 @@ public class CraftWorld implements World {
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
EntityArrow arrow = new EntityArrow(world);
- arrow.c(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
- world.a(arrow);
+ arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
+ world.addEntity(arrow);
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
return (Arrow) arrow.getBukkitEntity();
}
@@ -315,7 +315,7 @@ public class CraftWorld implements World {
loc.getZ(),
CraftMinecart.Type.Minecart.getId()
);
- world.a(minecart);
+ world.addEntity(minecart);
return (Minecart) minecart.getBukkitEntity();
}
@@ -327,7 +327,7 @@ public class CraftWorld implements World {
loc.getZ(),
CraftMinecart.Type.StorageMinecart.getId()
);
- world.a(minecart);
+ world.addEntity(minecart);
return (StorageMinecart) minecart.getBukkitEntity();
}
@@ -339,13 +339,13 @@ public class CraftWorld implements World {
loc.getZ(),
CraftMinecart.Type.PoweredMinecart.getId()
);
- world.a(minecart);
+ world.addEntity(minecart);
return (PoweredMinecart) minecart.getBukkitEntity();
}
public Boat spawnBoat(Location loc) {
EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
- world.a(boat);
+ world.addEntity(boat);
return (Boat) boat.getBukkitEntity();
}
@@ -353,9 +353,9 @@ public class CraftWorld implements World {
LivingEntity creature;
try {
EntityLiving entityCreature = (EntityLiving) EntityTypes.a(creatureType.getName(), world);
- entityCreature.a(loc.getX(), loc.getY(), loc.getZ());
+ entityCreature.setPosition(loc.getX(), loc.getY(), loc.getZ());
creature = (LivingEntity) CraftEntity.getEntity(server, entityCreature);
- world.a(entityCreature);
+ world.addEntity(entityCreature);
} catch (Exception e) {
// if we fail, for any reason, return null.
creature = null;
@@ -388,11 +388,11 @@ public class CraftWorld implements World {
}
public String getName() {
- return world.q.j;
+ return world.worldData.name;
}
public long getId() {
- return world.q.b();
+ return world.worldData.b();
}
@Override
@@ -413,16 +413,16 @@ public class CraftWorld implements World {
}
public long getFullTime() {
- return world.l();
+ return world.getTime();
}
public void setFullTime(long time) {
- world.a(time);
+ world.setTime(time);
//Forces the client to update to the new time immediately
for (Player p: getPlayers()) {
CraftPlayer cp = (CraftPlayer) p;
- cp.getHandle().a.b(new Packet4UpdateTime(time));
+ cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(time));
}
}
@@ -485,7 +485,7 @@ public class CraftWorld implements World {
public List<Entity> getEntities() {
List<Entity> list = new ArrayList<Entity>();
- for (Object o: world.b) {
+ for (Object o: world.entityList) {
if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
@@ -503,7 +503,7 @@ public class CraftWorld implements World {
public List<LivingEntity> getLivingEntities() {
List<LivingEntity> list = new ArrayList<LivingEntity>();
- for (Object o: world.b) {
+ for (Object o: world.entityList) {
if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
@@ -521,11 +521,11 @@ public class CraftWorld implements World {
public List<Player> getPlayers() {
List<Player> list = new ArrayList<Player>();
- for (Object o : world.b) {
+ for (Object o : world.entityList) {
if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
-
+
if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) {
list.add((Player)bukkitEntity);
}
@@ -537,9 +537,9 @@ public class CraftWorld implements World {
public void save() {
// Writes level.dat
- world.t();
+ world.saveLevel();
// Saves all chunks/regions
- world.o.a(true, null);
+ world.chunkProvider.saveChunks(true, null);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index cde4dc93..6891aedd 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -88,14 +88,14 @@ public class CraftBlock implements Block {
* @param data New block specific metadata
*/
public void setData(final byte data) {
- chunk.getHandle().d.c(x, y, z, data);
+ chunk.getHandle().world.setData(x, y, z, data);
}
public void setData(final byte data, boolean applyPhysics) {
if (applyPhysics) {
- chunk.getHandle().d.c(x, y, z, data);
+ chunk.getHandle().world.setData(x, y, z, data);
} else {
- chunk.getHandle().d.d(x, y, z, data);
+ chunk.getHandle().world.setRawData(x, y, z, data);
}
}
@@ -105,7 +105,7 @@ public class CraftBlock implements Block {
* @return block specific metadata
*/
public byte getData() {
- return (byte) chunk.getHandle().b(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
+ return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
}
/**
@@ -124,24 +124,24 @@ public class CraftBlock implements Block {
* @return whether the block was changed
*/
public boolean setTypeId(final int type) {
- return chunk.getHandle().d.e(x, y, z, type);
+ return chunk.getHandle().world.setRawTypeId(x, y, z, type);
}
-
+
public boolean setTypeId(final int type, final boolean applyPhysics) {
if (applyPhysics) {
return setTypeId(type);
} else {
- return chunk.getHandle().d.setTypeId(x, y, z, type);
+ return chunk.getHandle().world.setRawTypeId(x, y, z, type);
}
}
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
if (applyPhysics) {
- return chunk.getHandle().d.b(x, y, z, type, data);
+ return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data);
} else {
- boolean success = chunk.getHandle().d.setTypeIdAndData(x, y, z, type, data);
- if(success) {
- chunk.getHandle().d.g(x, y, z);
+ boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
+ if (success) {
+ chunk.getHandle().world.notify(x, y, z);
}
return success;
}
@@ -162,7 +162,7 @@ public class CraftBlock implements Block {
* @return block type-id
*/
public int getTypeId() {
- return chunk.getHandle().a(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
+ return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
}
/**
@@ -171,7 +171,7 @@ public class CraftBlock implements Block {
* @return light level
*/
public byte getLightLevel() {
- return (byte) chunk.getHandle().d.j(this.x, this.y, this.z);
+ return (byte) chunk.getHandle().world.getLightLevel(this.x, this.y, this.z);
}
/**
@@ -331,7 +331,7 @@ public class CraftBlock implements Block {
}
public Biome getBiome() {
- BiomeBase base = chunk.getHandle().d.a().a(x, z);
+ BiomeBase base = chunk.getHandle().world.getWorldChunkManager().getBiome(x, z);
if (base == BiomeBase.RAINFOREST) {
return Biome.RAINFOREST;
@@ -363,11 +363,11 @@ public class CraftBlock implements Block {
}
public boolean isBlockPowered() {
- return chunk.getHandle().d.o(x, y, z);
+ return chunk.getHandle().world.isBlockPowered(x, y, z);
}
public boolean isBlockIndirectlyPowered() {
- return chunk.getHandle().d.p(x, y, z);
+ return chunk.getHandle().world.isBlockIndirectlyPowered(x, y, z);
}
@Override
@@ -376,26 +376,26 @@ public class CraftBlock implements Block {
}
public boolean isBlockFacePowered(BlockFace face) {
- return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face));
+ return chunk.getHandle().world.isBlockFacePowered(x, y, z, blockFaceToNotch(face));
}
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
- return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face));
+ return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face));
}
-
+
public int getBlockPower(BlockFace face) {
int power = 0;
BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE;
- net.minecraft.server.World world = chunk.getHandle().d;
- if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.i(x, y - 1, z, 0)) power = wire.f(world, x, y - 1, z, power);
- if ((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.f(world, x, y + 1, z, power);
- if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.f(world, x, y, z - 1, power);
- if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.f(world, x, y, z + 1, power);
- if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.f(world, x - 1, y, z, power);
- if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.f(world, x + 1, y, z, power);
+ net.minecraft.server.World world = chunk.getHandle().world;
+ if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power);
+ if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power);
+ if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z - 1, 2)) power = wire.getPower(world, x, y, z - 1, power);
+ if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, power);
+ if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(x - 1, y, z, 4)) power = wire.getPower(world, x - 1, y, z, power);
+ if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(x + 1, y, z, 5)) power = wire.getPower(world, x + 1, y, z, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
-
+
public int getBlockPower() {
return getBlockPower(BlockFace.SELF);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index c389d3a2..5d1c963e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -32,7 +32,7 @@ public class CraftChest extends CraftBlockState implements Chest {
boolean result = super.update(force);
if (result) {
- chest.i();
+ chest.update();
}
return result;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 2acab116..9af5f12f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -18,15 +18,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
}
public CreatureType getCreatureType() {
- return CreatureType.fromName(spawner.h);
+ return CreatureType.fromName(spawner.mobName);
}
public void setCreatureType(CreatureType creatureType) {
- spawner.h = creatureType.getName();
+ spawner.mobName = creatureType.getName();
}
public String getCreatureTypeId() {
- return spawner.h;
+ return spawner.mobName;
}
public void setCreatureTypeId(String creatureType) {
@@ -35,15 +35,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
if (type == null) {
return;
}
- spawner.h = type.getName();
+ spawner.mobName = type.getName();
}
-
+
public int getDelay() {
- return spawner.a;
+ return spawner.spawnDelay;
}
public void setDelay(int delay) {
- spawner.a = delay;
+ spawner.spawnDelay = delay;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
index d2f432d8..4a6410a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
@@ -36,7 +36,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
synchronized (block) {
if (block.getType() == Material.DISPENSER) {
BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER;
- dispense.b(world.getHandle(), getX(), getY(), getZ(), new Random());
+ dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random());
return true;
} else {
return false;
@@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
boolean result = super.update(force);
if (result) {
- dispenser.i();
+ dispenser.update();
}
return result;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index feb8a848..f266ece4 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -32,25 +32,25 @@ public class CraftFurnace extends CraftBlockState implements Furnace {
boolean result = super.update(force);
if (result) {
- furnace.i();
+ furnace.update();
}
return result;
}
public short getBurnTime() {
- return (short)furnace.a;
+ return (short)furnace.burnTime;
}
public void setBurnTime(short burnTime) {
- furnace.a = burnTime;
+ furnace.burnTime = burnTime;
}
public short getCookTime() {
- return (short)furnace.c;
+ return (short)furnace.cookTime;
}
public void setCookTime(short cookTime) {
- furnace.c = cookTime;
+ furnace.cookTime = cookTime;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
index ec49c9f9..f2c1615a 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
@@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
}
public byte getNote() {
- return note.a;
+ return note.note;
}
public void setNote(byte n) {
- note.a = n;
+ note.note = n;
}
public boolean play() {
@@ -35,7 +35,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
- note.a(world.getHandle(), getX(), getY(), getZ());
+ note.play(world.getHandle(), getX(), getY(), getZ());
return true;
} else {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 5983c3dd..c3e9d238 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -17,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign {
}
public String[] getLines() {
- return sign.a;
+ return sign.lines;
}
public String getLine(int index) throws IndexOutOfBoundsException {
- return sign.a[index];
+ return sign.lines[index];
}
public void setLine(int index, String line) throws IndexOutOfBoundsException {
- sign.a[index] = line;
+ sign.lines[index] = line;
}
@Override
@@ -33,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
boolean result = super.update(force);
if (result) {
- sign.i();
+ sign.update();
}
return result;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
index 8749f131..7066de58 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
@@ -14,18 +14,18 @@ public class CraftCreature extends CraftLivingEntity implements Creature{
public void setTarget(LivingEntity target) {
EntityCreature entity = getHandle();
if (target == null) {
- entity.d = null;
+ entity.target = null;
} else if (target instanceof CraftLivingEntity) {
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
- entity.d = victim;
- entity.a = entity.world.a(entity, entity.d, 16.0F);
+ entity.target = victim;
+ entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F);
}
}
public CraftLivingEntity getTarget() {
- if (getHandle().d == null) return null;
+ if (getHandle().target == null) return null;
- return (CraftLivingEntity) getHandle().d.getBukkitEntity();
+ return (CraftLivingEntity) getHandle().target.getBukkitEntity();
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index af535ba2..c1e03dc8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -77,9 +77,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); }
else if (entity instanceof EntityMinecart) {
EntityMinecart mc = (EntityMinecart) entity;
- if (mc.d == CraftMinecart.Type.StorageMinecart.getId()) {
+ if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) {
return new CraftStorageMinecart(server, mc);
- } else if (mc.d == CraftMinecart.Type.PoweredMinecart.getId()) {
+ } else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) {
return new CraftPoweredMinecart(server, mc);
} else {
return new CraftMinecart(server, mc);
@@ -103,7 +103,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.motX = vel.getX();
entity.motY = vel.getY();
entity.motZ = vel.getZ();
- entity.aZ = true;
+ entity.velocityChanged = true;
}
public World getWorld() {
@@ -112,8 +112,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean teleport(Location location) {
entity.world = ((CraftWorld)location.getWorld()).getHandle();
- entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
- // entity.b() throws no event, and so cannot be cancelled
+ entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
+ // entity.setLocation() throws no event, and so cannot be cancelled
return true;
}
@@ -153,7 +153,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void setFireTicks(int ticks) {
entity.fireTicks = ticks;
}
-
+
public void remove() {
entity.dead = true;
}
@@ -238,11 +238,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
getHandle().passenger.setPassengerOf(null);
return true;
}
-
+
public float getFallDistance() {
return getHandle().fallDistance;
}
-
+
public void setFallDistance(float distance) {
getHandle().fallDistance = distance;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index 86bcce0e..4bb98b0a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -15,11 +15,11 @@ public class CraftItem extends CraftEntity implements Item {
}
public ItemStack getItemStack() {
- return new CraftItemStack(item.a);
+ return new CraftItemStack(item.itemStack);
}
public void setItemStack(ItemStack stack) {
- item.a = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability());
+ item.itemStack = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability());
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 812e8297..bc1c293f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -59,14 +59,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Egg throwEgg() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntityEgg egg = new EntityEgg(world, getHandle());
- world.a(egg);
+ world.addEntity(egg);
return (Egg) egg.getBukkitEntity();
}
public Snowball throwSnowball() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntitySnowball snowball = new EntitySnowball(world, getHandle());
- world.a(snowball);
+ world.addEntity(snowball);
return (Snowball) snowball.getBukkitEntity();
}
@@ -120,7 +120,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Arrow shootArrow() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntityArrow arrow = new EntityArrow(world, getHandle());
- world.a(arrow);
+ world.addEntity(arrow);
return (Arrow) arrow.getBukkitEntity();
}
@@ -167,11 +167,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public void damage(int amount) {
- entity.a((Entity)null, amount);
+ entity.damageEntity((Entity) null, amount);
}
public void damage(int amount, org.bukkit.entity.Entity source) {
- entity.a(((CraftEntity)source).getHandle(), amount);
+ entity.damageEntity(((CraftEntity) source).getHandle(), amount);
}
public Location getEyeLocation() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
index cbaa5c90..98677b48 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -39,11 +39,11 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
}
public void setDamage(int damage) {
- minecart.a = damage;
+ minecart.damage = damage;
}
public int getDamage() {
- return minecart.a;
+ return minecart.damage;
}
public double getMaxSpeed() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 225196e8..16495db3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -23,7 +23,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public boolean isOp() {
- return server.getHandle().h(getName());
+ return server.getHandle().isOp(getName());
}
public boolean isPlayer() {
@@ -31,7 +31,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public boolean isOnline() {
- for (Object obj: server.getHandle().b) {
+ for (Object obj: server.getHandle().players) {
EntityPlayer player = (EntityPlayer) obj;
if (player.name.equalsIgnoreCase(getName())) {
return true;
@@ -41,7 +41,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public InetSocketAddress getAddress() {
- SocketAddress addr = getHandle().a.b.b();
+ SocketAddress addr = getHandle().netServerHandler.networkManager.getSocketAddress();
if (addr instanceof InetSocketAddress) {
return (InetSocketAddress) addr;
} else {
@@ -76,12 +76,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void sendRawMessage(String message) {
- getHandle().a.b(new Packet3Chat(message));
+ getHandle().netServerHandler.sendPacket(new Packet3Chat(message));
}
public void sendMessage(String message) {
for (final String line: TextWrapper.wrapText(message)) {
- getHandle().a.b(new Packet3Chat(line));
+ getHandle().netServerHandler.sendPacket(new Packet3Chat(line));
}
}
@@ -121,12 +121,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void kickPlayer(String message) {
- getHandle().a.a(message == null ? "" : message);
+ getHandle().netServerHandler.disconnect(message == null ? "" : message);
}
public void setCompassTarget(Location loc) {
// Do not directly assign here, from the packethandler we'll assign it.
- getHandle().a.b((Packet) new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ getHandle().netServerHandler.sendPacket(new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
public Location getCompassTarget() {
@@ -134,7 +134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void chat(String msg) {
- getHandle().a.chat(msg);
+ getHandle().netServerHandler.chat(msg);
}
public boolean performCommand(String command) {
@@ -151,10 +151,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (oldWorld != newWorld) {
- EntityPlayer newEntity = new EntityPlayer(manager.c, newWorld, entity.name, new ItemInWorldManager(newWorld));
+ EntityPlayer newEntity = new EntityPlayer(manager.server, newWorld, entity.name, new ItemInWorldManager(newWorld));
newEntity.id = entity.id;
- newEntity.a = entity.a;
+ newEntity.netServerHandler = entity.netServerHandler;
newEntity.health = entity.health;
newEntity.fireTicks = entity.fireTicks;
newEntity.inventory = entity.inventory;
@@ -167,22 +167,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
newEntity.displayName = entity.displayName;
newEntity.compassTarget = entity.compassTarget;
newEntity.fauxSleeping = entity.fauxSleeping;
- newWorld.u.c((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
+ newWorld.chunkProviderServer.getChunkAt((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
- teleportSuccess = newEntity.a.teleport(location);
+ teleportSuccess = newEntity.netServerHandler.teleport(location);
if (teleportSuccess) {
- manager.c.k.a(entity);
- manager.c.k.b(entity);
- oldWorld.manager.b(entity);
- manager.b.remove(entity);
- oldWorld.e(entity);
+ manager.server.tracker.trackPlayer(entity);
+ manager.server.tracker.untrackEntity(entity);
+ oldWorld.manager.removePlayer(entity);
+ manager.players.remove(entity);
+ oldWorld.removeEntity(entity);
- newWorld.manager.a(newEntity);
- newWorld.a(newEntity);
- manager.b.add(newEntity);
+ newWorld.manager.addPlayer(newEntity);
+ newWorld.addEntity(newEntity);
+ manager.players.add(newEntity);
- entity.a.e = newEntity;
+ entity.netServerHandler.player = newEntity;
this.entity = newEntity;
setCompassTarget(getCompassTarget());
@@ -190,33 +190,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return teleportSuccess;
} else {
- return entity.a.teleport(location);
+ return entity.netServerHandler.teleport(location);
}
}
public void setSneaking(boolean sneak) {
- getHandle().e(sneak);
+ getHandle().setSneak(sneak);
}
public boolean isSneaking() {
- return getHandle().Z();
+ return getHandle().isSneaking();
}
public void loadData() {
- server.getHandle().n.b(getHandle());
+ server.getHandle().playerFileData.b(getHandle());
}
public void saveData() {
- server.getHandle().n.a(getHandle());
+ server.getHandle().playerFileData.a(getHandle());
}
public void updateInventory() {
- getHandle().m();
+ getHandle().syncInventory();
}
public void setSleepingIgnored(boolean isSleeping) {
getHandle().fauxSleeping = isSleeping;
- ((CraftWorld)getWorld()).getHandle().checkSleepStatus();
+ ((CraftWorld) getWorld()).getHandle().checkSleepStatus();
}
public boolean isSleepingIgnored() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
index bedfe06d..0ec31c1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
@@ -10,8 +10,7 @@ import org.bukkit.entity.PoweredMinecart;
*
* @author sk89q
*/
-public class CraftPoweredMinecart extends CraftMinecart
- implements PoweredMinecart {
+public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart {
public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) {
super(server, entity);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
index 5a0e5fa0..2fe42935 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
@@ -22,19 +22,19 @@ public class CraftSheep extends CraftAnimals implements Sheep {
}
public DyeColor getColor() {
- return DyeColor.getByData((byte) getHandle().o());
+ return DyeColor.getByData((byte) getHandle().getColor());
}
public void setColor(DyeColor color) {
- getHandle().a_(color.getData());
+ getHandle().setColor(color.getData());
}
public boolean isSheared() {
- return getHandle().j_();
+ return getHandle().isSheared();
}
public void setSheared(boolean flag) {
- getHandle().a(flag);
+ getHandle().setSheared(flag);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
index 3d3cca16..104683c8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java
@@ -25,6 +25,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
}
public void setSize(int size) {
- getHandle().e(size);
+ getHandle().setSize(size);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 2983221b..736896f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -46,14 +46,14 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class CraftEventFactory {
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
WorldServer worldServer = world.getHandle();
- int spawnSize = worldServer.x.spawnProtection;
+ int spawnSize = worldServer.server.spawnProtection;
if (spawnSize <= 0) return true;
if (player.isOp()) return true;
- ChunkCoordinates chunkcoordinates = worldServer.m();
+ ChunkCoordinates chunkcoordinates = worldServer.getSpawn();
- int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.a), Math.abs(z - chunkcoordinates.c));
+ int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
return distanceFromSpawn > spawnSize;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 1f5f9a09..eee59f98 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -19,23 +19,23 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
public int getSize() {
- return getInventory().q_();
+ return getInventory().getSize();
}
public String getName() {
- return getInventory().c();
+ return getInventory().getName();
}
- public ItemStack getItem(int index) {
- return new CraftItemStack(getInventory().c_(index));
+ public CraftItemStack getItem(int index) {
+ return new CraftItemStack(getInventory().getItem(index));
}
- public ItemStack[] getContents() {
- ItemStack[] items = new ItemStack[getSize()];
+ public CraftItemStack[] getContents() {
+ CraftItemStack[] items = new CraftItemStack[getSize()];
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
for (int i = 0; i < mcItems.length; i++ ) {
- items[i] = mcItems[i] == null ? null : new CraftItemStack(mcItems[i]);
+ items[i] = new CraftItemStack(mcItems[i]);
}
return items;
@@ -59,12 +59,12 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
public void setItem(int index, ItemStack item) {
- getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability())));
+ getInventory().setItem(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability())));
}
public boolean contains(int materialId) {
for (ItemStack item: getContents()) {
- if (item != null && item.getTypeId() == materialId) {
+ if (item.getTypeId() == materialId) {
return true;
}
}
@@ -86,15 +86,15 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
return false;
}
-
+
public boolean contains(int materialId, int amount) {
int amt = 0;
for (ItemStack item: getContents()) {
- if (item != null && item.getTypeId() == materialId) {
- amt += item.getAmount();
+ if (item.getTypeId() == materialId && item.getAmount() >= amount) {
+ return true;
}
}
- return amt >= amount;
+ return false;
}
public boolean contains(Material material, int amount) {
@@ -107,13 +107,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
int amt = 0;
for (ItemStack i: getContents()) {
- if (item.equals(i)) {
- amt += item.getAmount();
+ if (item.equals(i) && item.getAmount() >= amount) {
+ return true;
}
}
- return amt >= amount;
+ return false;
}
-
+
public HashMap<Integer, ItemStack> all(int materialId) {
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
@@ -312,7 +312,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
private int getMaxItemStack() {
- return getInventory().r_();
+ return getInventory().getMaxStackSize();
}
public void remove(int materialId) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
index 88933b4b..d721686f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
}
public CraftItemStack getItemInHand() {
- return new CraftItemStack( getInventory().b() );
+ return new CraftItemStack( getInventory().getItemInHand() );
}
public void setItemInHand(ItemStack stack) {
@@ -27,22 +27,22 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
}
public int getHeldItemSlot() {
- return getInventory().c;
+ return getInventory().itemInHandIndex;
}
- public ItemStack getHelmet() {
+ public CraftItemStack getHelmet() {
return getItem( getSize() + 3 );
}
- public ItemStack getChestplate() {
+ public CraftItemStack getChestplate() {
return getItem( getSize() + 2 );
}
- public ItemStack getLeggings() {
+ public CraftItemStack getLeggings() {
return getItem( getSize() + 1 );
}
- public ItemStack getBoots() {
+ public CraftItemStack getBoots() {
return getItem( getSize() + 0 );
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 2f242af4..078c0b04 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -121,6 +121,6 @@ public class CraftItemStack extends ItemStack {
@Override
public int getMaxStackSize() {
- return item.a().b();
+ return item.getItem().getMaxStackSize();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java
index 39d748b4..a44c1b90 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java
@@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
}
public Inventory getInventory() {
- return new CraftInventory( slot.e );
+ return new CraftInventory( slot.inventory );
}
public int getIndex() {
- return slot.d;
+ return slot.index;
}
public ItemStack getItem() {
- return new CraftItemStack( slot.a() );
+ return new CraftItemStack( slot.getItem() );
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index ad07883a..9caef416 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -20,7 +20,7 @@ import org.bukkit.craftbukkit.scheduler.CraftTask;
public class CraftScheduler implements BukkitScheduler, Runnable {
private static final Logger logger = Logger.getLogger("Minecraft");
-
+
private final CraftServer server;
private final CraftThreadManager craftThreadManager = new CraftThreadManager();
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java
index 79e7d439..fc59df77 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java
@@ -13,8 +13,8 @@ public class LongHashtable<V> extends LongHash {
put(toLong(msw, lsw), value);
if (value instanceof Chunk) {
Chunk c = (Chunk) value;
- if (msw != c.j || lsw != c.k) {
- MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
+ if (msw != c.x || lsw != c.z) {
+ MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable();
x.fillInStackTrace();
x.printStackTrace();
@@ -26,8 +26,8 @@ public class LongHashtable<V> extends LongHash {
V value = get(toLong(msw, lsw));
if (value instanceof Chunk) {
Chunk c = (Chunk) value;
- if (msw != c.j || lsw != c.k) {
- MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
+ if (msw != c.x || lsw != c.z) {
+ MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable();
x.fillInStackTrace();
x.printStackTrace();
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index d15bb782..5e555d64 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -12,6 +12,6 @@ public class ServerShutdownThread extends Thread {
@Override
public void run() {
- server.g();
+ server.stop();
}
}