Update to Minecraft 1.3 beta

This commit is contained in:
Dinnerbone 2011-02-23 02:37:56 +00:00
parent a124bfdab5
commit f759e0b60d
83 changed files with 3182 additions and 3292 deletions

View File

@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.2_01_02</version> <version>1.3</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -35,46 +35,32 @@ public class BlockButton extends Block {
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))); 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 c(World world, int i, int j, int k, int l) { public void d(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
int j1 = i1 & 8; int j1 = i1 & 8;
i1 &= 7; i1 &= 7;
if (l == 2 && world.d(i, j, k + 1)) { if (l == 2 && world.d(i, j, k + 1)) {
i1 = 4; i1 = 4;
} } else if (l == 3 && world.d(i, j, k - 1)) {
if (l == 3 && world.d(i, j, k - 1)) {
i1 = 3; i1 = 3;
} } else if (l == 4 && world.d(i + 1, j, k)) {
if (l == 4 && world.d(i + 1, j, k)) {
i1 = 2; i1 = 2;
} } else if (l == 5 && world.d(i - 1, j, k)) {
if (l == 5 && world.d(i - 1, j, k)) {
i1 = 1; i1 = 1;
} else {
i1 = this.g(world, i, j, k);
} }
world.c(i, j, k, i1 + j1); world.c(i, j, k, i1 + j1);
} }
public void e(World world, int i, int j, int k) { private int g(World world, int i, int j, int k) {
if (world.d(i - 1, j, 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)));
world.c(i, j, k, 1);
} else if (world.d(i + 1, j, k)) {
world.c(i, j, k, 2);
} else if (world.d(i, j, k - 1)) {
world.c(i, j, k, 3);
} else if (world.d(i, j, k + 1)) {
world.c(i, j, k, 4);
}
this.g(world, i, j, k);
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
if (this.g(world, i, j, k)) { if (this.h(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7; int i1 = world.getData(i, j, k) & 7;
boolean flag = false; boolean flag = false;
@ -95,15 +81,15 @@ public class BlockButton extends Block {
} }
if (flag) { if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
} }
} }
private boolean g(World world, int i, int j, int k) { private boolean h(World world, int i, int j, int k) {
if (!this.a(world, i, j, k)) { if (!this.a(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
return false; return false;
} else { } else {
@ -140,60 +126,56 @@ public class BlockButton extends Block {
} }
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) { public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.isStatic) { // CraftBukkit start - Interact Button
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_INTERACT;
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
// CraftBukkit end
int l = world.getData(i, j, k);
int i1 = l & 7;
int j1 = 8 - (l & 8);
if (j1 == 0) {
return true; return true;
} else { } else {
// CraftBukkit start - Interact Button // Craftbukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld(); int old = (j1 != 8) ? 1 : 0;
CraftServer server = ((WorldServer) world).getServer(); int current = (j1 == 8) ? 1 : 0;
Type eventType = Type.BLOCK_INTERACT; BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); server.getPluginManager().callEvent(eventRedstone);
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity(); if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true; return true;
} }
// CraftBukkit end // Craftbukkit end
int l = world.getData(i, j, k); world.c(i, j, k, i1 + j1);
int i1 = l & 7; world.b(i, j, k, i, j, k);
int j1 = 8 - (l & 8); 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);
if (j1 == 0) { if (i1 == 1) {
return true; world.h(i - 1, j, k, this.id);
} else if (i1 == 2) {
world.h(i + 1, j, k, this.id);
} else if (i1 == 3) {
world.h(i, j, k - 1, this.id);
} else if (i1 == 4) {
world.h(i, j, k + 1, this.id);
} else { } else {
// Craftbukkit start world.h(i, j - 1, k, this.id);
int old = (j1 != 8) ? 1 : 0;
int current = (j1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
server.getPluginManager().callEvent(eventRedstone);
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
return true;
}
// Craftbukkit end
world.c(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);
if (i1 == 1) {
world.h(i - 1, j, k, this.id);
} else if (i1 == 2) {
world.h(i + 1, j, k, this.id);
} else if (i1 == 3) {
world.h(i, j, k - 1, this.id);
} else if (i1 == 4) {
world.h(i, j, k + 1, this.id);
} else {
world.h(i, j - 1, k, this.id);
}
world.i(i, j, k, this.id);
return true;
} }
world.c(i, j, k, this.id, this.b());
return true;
} }
} }
@ -224,7 +206,7 @@ public class BlockButton extends Block {
return (iblockaccess.getData(i, j, k) & 8) > 0; return (iblockaccess.getData(i, j, k) & 8) > 0;
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean c(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
if ((i1 & 8) == 0) { if ((i1 & 8) == 0) {

View File

@ -55,9 +55,9 @@ public class BlockCactus extends Block {
return !super.a(world, i, j, k) ? false : this.f(world, i, j, k); return !super.a(world, i, j, k) ? false : this.f(world, i, j, k);
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) { if (!this.f(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
} }

View File

@ -53,8 +53,8 @@ public class BlockChest extends BlockContainer {
public void b(World world, int i, int j, int k) { public void b(World world, int i, int j, int k) {
TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k); TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);
for (int l = 0; l < tileentitychest.h_(); ++l) { for (int l = 0; l < tileentitychest.m_(); ++l) {
ItemStack itemstack = tileentitychest.a(l); ItemStack itemstack = tileentitychest.c_(l);
if (itemstack != null) { if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F; float f = this.a.nextFloat() * 0.8F + 0.1F;

View File

@ -101,7 +101,7 @@ public class BlockDispenser extends BlockContainer {
} }
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
ItemStack itemstack = tileentitydispenser.e(); ItemStack itemstack = tileentitydispenser.b();
double d0 = (double) i + (double) f * 0.5D + 0.5D; double d0 = (double) i + (double) f * 0.5D + 0.5D;
double d1 = (double) j + 0.5D; double d1 = (double) j + 0.5D;
double d2 = (double) k + (double) f1 * 0.5D + 0.5D; double d2 = (double) k + (double) f1 * 0.5D + 0.5D;
@ -157,12 +157,12 @@ public class BlockDispenser extends BlockContainer {
} }
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
if (l > 0 && Block.byId[l].c()) { if (l > 0 && Block.byId[l].c()) {
boolean flag = world.p(i, j, k) || world.p(i, j + 1, k); boolean flag = world.p(i, j, k) || world.p(i, j + 1, k);
if (flag) { if (flag) {
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
} }
} }

View File

@ -26,6 +26,29 @@ public class BlockDoor extends Block {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
} }
public int a(int i, int j) {
if (i != 0 && i != 1) {
int k = this.d(j);
if ((k == 0 || k == 2) ^ i <= 3) {
return this.textureId;
} else {
int l = k / 2 + (i & 1 ^ k);
l += (j & 4) / 4;
int i1 = this.textureId - (j & 8) * 2;
if ((l & 1) != 0) {
i1 = -i1;
}
return i1;
}
} else {
return this.textureId;
}
}
public boolean a() { public boolean a() {
return false; return false;
} }
@ -103,9 +126,9 @@ public class BlockDoor extends Block {
world.c(i, j, k, l ^ 4); world.c(i, j, k, l ^ 4);
world.b(i, j - 1, k, i, j, k); world.b(i, j - 1, k, i, j, k);
if (Math.random() < 0.5D) { 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.l.nextFloat() * 0.1F + 0.9F); 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);
} else { } else {
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); 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);
} }
return true; return true;
@ -131,15 +154,15 @@ public class BlockDoor extends Block {
world.c(i, j, k, l ^ 4); world.c(i, j, k, l ^ 4);
world.b(i, j - 1, k, i, j, k); world.b(i, j - 1, k, i, j, k);
if (Math.random() < 0.5D) { 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.l.nextFloat() * 0.1F + 0.9F); 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);
} else { } else {
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F); 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);
} }
} }
} }
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
if ((i1 & 8) != 0) { if ((i1 & 8) != 0) {
@ -148,7 +171,7 @@ public class BlockDoor extends Block {
} }
if (l > 0 && Block.byId[l].c()) { if (l > 0 && Block.byId[l].c()) {
this.b(world, i, j - 1, k, l); this.a(world, i, j - 1, k, l);
} }
} else { } else {
boolean flag = false; boolean flag = false;
@ -167,7 +190,9 @@ public class BlockDoor extends Block {
} }
if (flag) { if (flag) {
this.a_(world, i, j, k, i1); if (!world.isStatic) {
this.b_(world, i, j, k, i1);
}
} else if (l > 0 && Block.byId[l].c()) { } else if (l > 0 && Block.byId[l].c()) {
boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k); boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);

View File

@ -1,24 +0,0 @@
package net.minecraft.server;
import java.util.ArrayList;
public class BlockFence extends Block {
public BlockFence(int i, int j) {
super(i, j, Material.WOOD);
this.a(0, 0, 0, 1, (float) 1.5, 1); //Craftbukkit
}
//Removed by craftbukkit
// public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
// arraylist.add(AxisAlignedBB.b((double) i, (double) j, (double) k, (double) (i + 1), (double) j + 2.0D, (double) (k + 1)));
// }
public boolean a(World world, int i, int j, int k) {
return world.getTypeId(i, j - 1, k) == this.id ? false : (!world.getMaterial(i, j - 1, k).isBuildable() ? false : super.a(world, i, j, k));
}
public boolean a() {
return false;
}
}

View File

@ -54,7 +54,7 @@ public class BlockFire extends Block {
if (l < 15) { if (l < 15) {
world.c(i, j, k, l + 1); world.c(i, j, k, l + 1);
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
if (!flag && !this.g(world, i, j, k)) { if (!flag && !this.g(world, i, j, k)) {
@ -112,18 +112,16 @@ public class BlockFire extends Block {
} }
} }
} }
}
// Craftbukkit start - won't be needed next port hopefully if (l == 15) {
if(l == 15) { this.a(world, i + 1, j, k, 1, random);
this.a(world, i + 1, j, k, 1, random); this.a(world, i - 1, j, k, 1, random);
this.a(world, i - 1, j, k, 1, random); this.a(world, i, j - 1, k, 1, random);
this.a(world, i, j - 1, k, 1, random); this.a(world, i, j + 1, k, 1, random);
this.a(world, i, j + 1, k, 1, random); this.a(world, i, j, k - 1, 1, random);
this.a(world, i, j, k - 1, 1, random); this.a(world, i, j, k + 1, 1, random);
this.a(world, i, j, k + 1, 1, random); }
} }
// Craftbukkit end
} }
private void a(World world, int i, int j, int k, int l, Random random) { private void a(World world, int i, int j, int k, int l, Random random) {
@ -149,7 +147,7 @@ public class BlockFire extends Block {
} }
if (flag) { if (flag) {
Block.TNT.a(world, i, j, k, 0); Block.TNT.b(world, i, j, k, 0);
} }
} }
} }
@ -167,13 +165,13 @@ public class BlockFire extends Block {
if (!world.isEmpty(i, j, k)) { if (!world.isEmpty(i, j, k)) {
return 0; return 0;
} else { } else {
int l = this.f(world, i + 1, j, k, b0); int l = this.g(world, i + 1, j, k, b0);
l = this.f(world, i - 1, j, k, l); l = this.g(world, i - 1, j, k, l);
l = this.f(world, i, j - 1, k, l); l = this.g(world, i, j - 1, k, l);
l = this.f(world, i, j + 1, k, l); l = this.g(world, i, j + 1, k, l);
l = this.f(world, i, j, k - 1, l); l = this.g(world, i, j, k - 1, l);
l = this.f(world, i, j, k + 1, l); l = this.g(world, i, j, k + 1, l);
return l; return l;
} }
} }
@ -186,7 +184,7 @@ public class BlockFire extends Block {
return this.a[iblockaccess.getTypeId(i, j, k)] > 0; return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
} }
public int f(World world, int i, int j, int k, int l) { public int g(World world, int i, int j, int k, int l) {
int i1 = this.a[world.getTypeId(i, j, k)]; int i1 = this.a[world.getTypeId(i, j, k)];
return i1 > l ? i1 : l; return i1 > l ? i1 : l;
@ -196,18 +194,18 @@ public class BlockFire extends Block {
return world.d(i, j - 1, k) || this.g(world, i, j, k); return world.d(i, j - 1, k) || this.g(world, i, j, k);
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) { if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
} }
public void e(World world, int i, int j, int k) { public void e(World world, int i, int j, int k) {
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, 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)) { if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
world.e(i, j, k, 0); world.e(i, j, k, 0);
} else { } else {
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
} }
} }

View File

@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids {
int l = this.g(world, i, j, k); int l = this.g(world, i, j, k);
byte b0 = 1; byte b0 = 1;
if (this.material == Material.LAVA && !world.q.d) { if (this.material == Material.LAVA && !world.m.d) {
b0 = 2; b0 = 2;
} }
@ -46,11 +46,11 @@ public class BlockFlowing extends BlockFluids {
byte b1 = -100; byte b1 = -100;
this.a = 0; this.a = 0;
int j1 = this.e(world, i - 1, j, k, b1); int j1 = this.f(world, i - 1, j, k, b1);
j1 = this.e(world, i + 1, j, k, j1); j1 = this.f(world, i + 1, j, k, j1);
j1 = this.e(world, i, j, k - 1, j1); j1 = this.f(world, i, j, k - 1, j1);
j1 = this.e(world, i, j, k + 1, j1); j1 = this.f(world, i, j, k + 1, j1);
i1 = j1 + b0; i1 = j1 + b0;
if (i1 >= 8 || j1 < 0) { if (i1 >= 8 || j1 < 0) {
i1 = -1; i1 = -1;
@ -85,7 +85,7 @@ public class BlockFlowing extends BlockFluids {
world.e(i, j, k, 0); world.e(i, j, k, 0);
} else { } else {
world.c(i, j, k, i1); world.c(i, j, k, i1);
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
world.h(i, j, k, this.id); world.h(i, j, k, this.id);
} }
} else if (flag) { } else if (flag) {
@ -129,7 +129,7 @@ public class BlockFlowing extends BlockFluids {
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace); BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace);
((WorldServer) world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1); this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
} }
} }
index++; index++;
@ -138,7 +138,7 @@ public class BlockFlowing extends BlockFluids {
} }
} }
private void f(World world, int i, int j, int k, int l) { private void g(World world, int i, int j, int k, int l) {
if (this.l(world, i, j, k)) { if (this.l(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
@ -146,7 +146,7 @@ public class BlockFlowing extends BlockFluids {
if (this.material == Material.LAVA) { if (this.material == Material.LAVA) {
this.h(world, i, j, k); this.h(world, i, j, k);
} else { } else {
Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k)); Block.byId[i1].b_(world, i, j, k, world.getData(i, j, k));
} }
} }
@ -262,7 +262,7 @@ public class BlockFlowing extends BlockFluids {
} }
} }
protected int e(World world, int i, int j, int k, int l) { protected int f(World world, int i, int j, int k, int l) {
int i1 = this.g(world, i, j, k); int i1 = this.g(world, i, j, k);
if (i1 < 0) { if (i1 < 0) {
@ -289,7 +289,7 @@ public class BlockFlowing extends BlockFluids {
public void e(World world, int i, int j, int k) { public void e(World world, int i, int j, int k) {
super.e(world, i, j, k); super.e(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
} }
} }

View File

@ -38,21 +38,21 @@ public class BlockJukeBox extends Block {
} }
// CraftBukkit end // CraftBukkit end
this.f(world, i, j, k, l); this.e(world, i, j, k, l);
return true; return true;
} else { } else {
return false; return false;
} }
} }
public void f(World world, int i, int j, int k, int l) { public void e(World world, int i, int j, int k, int l) {
world.a((String) null, i, j, k); world.a((String) null, i, j, k);
world.c(i, j, k, 0); world.c(i, j, k, 0);
int i1 = Item.GOLD_RECORD.id + l - 1; int i1 = Item.GOLD_RECORD.id + l - 1;
float f = 0.7F; float f = 0.7F;
double d0 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d0 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; double d1 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
double d2 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d2 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0)); EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0));
entityitem.c = 10; entityitem.c = 10;
@ -62,7 +62,7 @@ public class BlockJukeBox extends Block {
public void a(World world, int i, int j, int k, int l, float f) { public void a(World world, int i, int j, int k, int l, float f) {
if (!world.isStatic) { if (!world.isStatic) {
if (l > 0) { if (l > 0) {
this.f(world, i, j, k, l); this.e(world, i, j, k, l);
} }
super.a(world, i, j, k, l, f); super.a(world, i, j, k, l, f);

View File

@ -12,7 +12,7 @@ import org.bukkit.event.block.LeavesDecayEvent;
public class BlockLeaves extends BlockLeavesBase { public class BlockLeaves extends BlockLeavesBase {
private int c; private int c;
int[] b; int[] a;
protected BlockLeaves(int i, int j) { protected BlockLeaves(int i, int j) {
super(i, j, Material.LEAVES, false); super(i, j, Material.LEAVES, false);
@ -52,8 +52,8 @@ public class BlockLeaves extends BlockLeavesBase {
int j1 = b1 * b1; int j1 = b1 * b1;
int k1 = b1 / 2; int k1 = b1 / 2;
if (this.b == null) { if (this.a == null) {
this.b = new int[b1 * b1 * b1]; this.a = new int[b1 * b1 * b1];
} }
int l1; int l1;
@ -68,11 +68,11 @@ public class BlockLeaves extends BlockLeavesBase {
for (j2 = -b0; j2 <= b0; ++j2) { for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2); k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) { if (k2 == Block.LOG.id) {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) { } else if (k2 == Block.LEAVES.id) {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else { } else {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1; this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
} }
} }
} }
@ -82,29 +82,29 @@ public class BlockLeaves extends BlockLeavesBase {
for (i2 = -b0; i2 <= b0; ++i2) { for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) { for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) { for (k2 = -b0; k2 <= b0; ++k2) {
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) { if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
} }
if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
} }
if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) { if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1; this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
} }
if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) { if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1; this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
} }
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) { if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1; this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
} }
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) { if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1; this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
} }
} }
} }
@ -113,7 +113,7 @@ public class BlockLeaves extends BlockLeavesBase {
} }
} }
l1 = this.b[k1 * j1 + k1 * b1 + k1]; l1 = this.a[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) { if (l1 >= 0) {
world.c(i, j, k, l & -5); world.c(i, j, k, l & -5);
} else { } else {
@ -133,7 +133,7 @@ public class BlockLeaves extends BlockLeavesBase {
if (event.isCancelled()) return; if (event.isCancelled()) return;
// CraftBukkit end // CraftBukkit end
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
@ -146,7 +146,11 @@ public class BlockLeaves extends BlockLeavesBase {
} }
public boolean a() { public boolean a() {
return !this.a; return !this.b;
}
public int a(int i, int j) {
return (j & 3) == 1 ? this.textureId + 80 : this.textureId;
} }
public void b(World world, int i, int j, int k, Entity entity) { public void b(World world, int i, int j, int k, Entity entity) {

View File

@ -28,13 +28,13 @@ public class BlockLever extends Block {
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)))); 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 c(World world, int i, int j, int k, int l) { public void d(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
int j1 = i1 & 8; int j1 = i1 & 8;
i1 &= 7; i1 &= 7;
if (l == 1 && world.d(i, j - 1, k)) { if (l == 1 && world.d(i, j - 1, k)) {
i1 = 5 + world.l.nextInt(2); i1 = 5 + world.k.nextInt(2);
} }
if (l == 2 && world.d(i, j, k + 1)) { if (l == 2 && world.d(i, j, k + 1)) {
@ -56,23 +56,7 @@ public class BlockLever extends Block {
world.c(i, j, k, i1 + j1); world.c(i, j, k, i1 + j1);
} }
public void e(World world, int i, int j, int k) { public void a(World world, int i, int j, int k, int l) {
if (world.d(i - 1, j, k)) {
world.c(i, j, k, 1);
} else if (world.d(i + 1, j, k)) {
world.c(i, j, k, 2);
} else if (world.d(i, j, k - 1)) {
world.c(i, j, k, 3);
} else if (world.d(i, j, k + 1)) {
world.c(i, j, k, 4);
} else if (world.d(i, j - 1, k)) {
world.c(i, j, k, 5 + world.l.nextInt(2));
}
this.g(world, i, j, k);
}
public void b(World world, int i, int j, int k, int l) {
if (this.g(world, i, j, k)) { if (this.g(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7; int i1 = world.getData(i, j, k) & 7;
boolean flag = false; boolean flag = false;
@ -98,7 +82,7 @@ public class BlockLever extends Block {
} }
if (flag) { if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
} }
@ -106,7 +90,7 @@ public class BlockLever extends Block {
private boolean g(World world, int i, int j, int k) { private boolean g(World world, int i, int j, int k) {
if (!this.a(world, i, j, k)) { if (!this.a(world, i, j, k)) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
return false; return false;
} else { } else {
@ -220,7 +204,7 @@ public class BlockLever extends Block {
return (iblockaccess.getData(i, j, k) & 8) > 0; return (iblockaccess.getData(i, j, k) & 8) > 0;
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean c(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
if ((i1 & 8) == 0) { if ((i1 & 8) == 0) {

View File

@ -44,7 +44,7 @@ public class BlockPressurePlate extends Block {
public void e(World world, int i, int j, int k) {} public void e(World world, int i, int j, int k) {}
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
boolean flag = false; boolean flag = false;
if (!world.d(i, j - 1, k)) { if (!world.d(i, j - 1, k)) {
@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block {
} }
if (flag) { if (flag) {
this.a_(world, i, j, k, world.getData(i, j, k)); this.b_(world, i, j, k, world.getData(i, j, k));
world.e(i, j, k, 0); world.e(i, j, k, 0);
} }
} }
@ -139,7 +139,7 @@ public class BlockPressurePlate extends Block {
} }
if (flag1) { if (flag1) {
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
} }
@ -169,7 +169,7 @@ public class BlockPressurePlate extends Block {
return iblockaccess.getData(i, j, k) > 0; return iblockaccess.getData(i, j, k) > 0;
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean c(World world, int i, int j, int k, int l) {
return world.getData(i, j, k) == 0 ? false : l == 1; return world.getData(i, j, k) == 0 ? false : l == 1;
} }

View File

@ -14,9 +14,13 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean a = false; private boolean a = false;
private static List b = new ArrayList(); private static List b = new ArrayList();
public int a(int i, int j) {
return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
}
private boolean a(World world, int i, int j, int k, boolean flag) { private boolean a(World world, int i, int j, int k, boolean flag) {
if (flag) { if (flag) {
b.add(new RedstoneUpdateInfo(i, j, k, world.e)); b.add(new RedstoneUpdateInfo(i, j, k, world.k()));
} }
int l = 0; int l = 0;
@ -84,13 +88,13 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean g(World world, int i, int j, int k) { private boolean g(World world, int i, int j, int k) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
return l == 5 && world.k(i, j - 1, k, 0) ? true : (l == 3 && world.k(i, j, k - 1, 2) ? true : (l == 4 && world.k(i, j, k + 1, 3) ? true : (l == 1 && world.k(i - 1, j, k, 4) ? true : l == 2 && world.k(i + 1, j, k, 5)))); 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))));
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
boolean flag = this.g(world, i, j, k); boolean flag = this.g(world, i, j, k);
while (b.size() > 0 && world.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L) { while (b.size() > 0 && world.k() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
b.remove(0); b.remove(0);
} }
@ -107,7 +111,7 @@ public class BlockRedstoneTorch extends BlockTorch {
if (flag) { if (flag) {
world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k)); world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
if (this.a(world, i, j, k, true)) { 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.l.nextFloat() - world.l.nextFloat()) * 0.8F); 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);
for (int l = 0; l < 5; ++l) { for (int l = 0; l < 5; ++l) {
double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D; double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
@ -123,13 +127,13 @@ public class BlockRedstoneTorch extends BlockTorch {
} }
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
super.b(world, i, j, k, l); super.a(world, i, j, k, l);
world.i(i, j, k, this.id); world.c(i, j, k, this.id, this.b());
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean c(World world, int i, int j, int k, int l) {
return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; // CraftBukkit -- cast to IBlockAccess
} }
public int a(int i, Random random) { public int a(int i, Random random) {

View File

@ -20,6 +20,10 @@ public class BlockRedstoneWire extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
} }
public int a(int i, int j) {
return this.textureId;
}
public AxisAlignedBB d(World world, int i, int j, int k) { public AxisAlignedBB d(World world, int i, int j, int k) {
return null; return null;
} }
@ -80,15 +84,15 @@ public class BlockRedstoneWire extends Block {
} }
if (j2 != l || j != i1 || k2 != j1) { if (j2 != l || j != i1 || k2 != j1) {
l1 = this.f(world, j2, j, k2, l1); l1 = this.g(world, j2, j, k2, l1);
} }
if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) { if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) {
if (j2 != l || j + 1 != i1 || k2 != j1) { if (j2 != l || j + 1 != i1 || k2 != j1) {
l1 = this.f(world, j2, j + 1, k2, l1); l1 = this.g(world, j2, j + 1, k2, l1);
} }
} else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) { } 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.g(world, j2, j - 1, k2, l1);
} }
} }
@ -109,10 +113,10 @@ public class BlockRedstoneWire extends Block {
// Craftbukkit end // Craftbukkit end
if (k1 != l1) { if (k1 != l1) {
world.i = true; world.h = true;
world.c(i, j, k, l1); world.c(i, j, k, l1);
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
world.i = false; world.h = false;
for (i2 = 0; i2 < 4; ++i2) { for (i2 = 0; i2 < 4; ++i2) {
j2 = i; j2 = i;
@ -140,7 +144,7 @@ public class BlockRedstoneWire extends Block {
} }
boolean flag1 = false; boolean flag1 = false;
int i3 = this.f(world, j2, j, k2, -1); int i3 = this.g(world, j2, j, k2, -1);
l1 = world.getData(i, j, k); l1 = world.getData(i, j, k);
if (l1 > 0) { if (l1 > 0) {
@ -151,7 +155,7 @@ public class BlockRedstoneWire extends Block {
this.a(world, j2, j, k2, i, j, k); this.a(world, j2, j, k2, i, j, k);
} }
i3 = this.f(world, j2, l2, k2, -1); i3 = this.g(world, j2, l2, k2, -1);
l1 = world.getData(i, j, k); l1 = world.getData(i, j, k);
if (l1 > 0) { if (l1 > 0) {
--l1; --l1;
@ -258,7 +262,7 @@ public class BlockRedstoneWire extends Block {
} }
} }
private int f(World world, int i, int j, int k, int l) { private int g(World world, int i, int j, int k, int l) {
if (world.getTypeId(i, j, k) != this.id) { if (world.getTypeId(i, j, k) != this.id) {
return l; return l;
} else { } else {
@ -268,19 +272,19 @@ public class BlockRedstoneWire extends Block {
} }
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
if (!world.isStatic) { if (!world.isStatic) {
int i1 = world.getData(i, j, k); int i1 = world.getData(i, j, k);
boolean flag = this.a(world, i, j, k); boolean flag = this.a(world, i, j, k);
if (!flag) { if (!flag) {
this.a_(world, i, j, k, i1); this.b_(world, i, j, k, i1);
world.e(i, j, k, 0); world.e(i, j, k, 0);
} else { } else {
this.g(world, i, j, k); this.g(world, i, j, k);
} }
super.b(world, i, j, k, l); super.a(world, i, j, k, l);
} }
} }
@ -288,8 +292,8 @@ public class BlockRedstoneWire extends Block {
return Item.REDSTONE.id; return Item.REDSTONE.id;
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean c(World world, int i, int j, int k, int l) {
return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); // CraftBukkit -- cast to IBlockAccess
} }
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) { public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {

View File

@ -20,8 +20,8 @@ public class BlockStationary extends BlockFluids {
} }
} }
public void b(World world, int i, int j, int k, int l) { public void a(World world, int i, int j, int k, int l) {
super.b(world, i, j, k, l); super.a(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
this.i(world, i, j, k); this.i(world, i, j, k);
} }
@ -30,11 +30,11 @@ public class BlockStationary extends BlockFluids {
private void i(World world, int i, int j, int k) { private void i(World world, int i, int j, int k) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
world.i = true; world.h = true;
world.setTypeIdAndData(i, j, k, this.id - 1, l); world.setTypeIdAndData(i, j, k, this.id - 1, l);
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
world.i(i, j, k, this.id - 1); world.c(i, j, k, this.id - 1, this.b());
world.i = false; world.h = false;
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {

View File

@ -39,7 +39,7 @@ public class BlockWorkbench extends Block {
} }
// CraftBukkit end // CraftBukkit end
entityhuman.a(i, j, k); entityhuman.b(i, j, k);
return true; return true;
} }
} }

View File

@ -95,7 +95,7 @@ public class Chunk {
i = l; i = l;
} }
if (!this.d.q.e) { if (!this.d.m.e) {
int j1 = 15; int j1 = 15;
int k1 = 127; int k1 = 127;
@ -122,50 +122,7 @@ public class Chunk {
this.o = true; this.o = true;
} }
public void c() { public void c() {}
byte b0 = 32;
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
int k = i << 11 | j << 7;
int l;
int i1;
for (l = 0; l < 128; ++l) {
i1 = Block.s[this.b[k + l]];
if (i1 > 0) {
this.g.a(i, l, j, i1);
}
}
l = 15;
for (i1 = b0 - 2; i1 < 128 && l > 0; this.g.a(i, i1, j, l)) {
++i1;
byte b1 = this.b[k + i1];
int j1 = Block.q[b1];
int k1 = Block.s[b1];
if (j1 == 0) {
j1 = 1;
}
l -= j1;
if (k1 > l) {
l = k1;
}
if (l < 0) {
l = 0;
}
}
}
}
this.d.a(EnumSkyBlock.BLOCK, this.j * 16, b0 - 1, this.k * 16, this.j * 16 + 16, b0 + 1, this.k * 16 + 16);
this.o = true;
}
private void c(int i, int j) { private void c(int i, int j) {
int k = this.b(i, j); int k = this.b(i, j);
@ -290,7 +247,7 @@ public class Chunk {
} }
this.e.a(i, j, k, i1); this.e.a(i, j, k, i1);
if (!this.d.q.e) { if (!this.d.m.e) {
if (Block.q[b0] != 0) { if (Block.q[b0] != 0) {
if (j >= j1) { if (j >= j1) {
this.g(i, j + 1, k); this.g(i, j + 1, k);
@ -415,15 +372,15 @@ public class Chunk {
k = this.m.length - 1; k = this.m.length - 1;
} }
entity.ag = true; entity.bA = true;
entity.chunkX = this.j; entity.chunkX = this.j;
entity.ai = k; entity.bC = k;
entity.chunkZ = this.k; entity.chunkZ = this.k;
this.m[k].add(entity); this.m[k].add(entity);
} }
public void b(Entity entity) { public void b(Entity entity) {
this.a(entity, entity.ai); this.a(entity, entity.bC);
} }
public void a(Entity entity, int i) { public void a(Entity entity, int i) {
@ -463,9 +420,9 @@ public class Chunk {
} }
public void a(TileEntity tileentity) { public void a(TileEntity tileentity) {
int i = tileentity.b - this.j * 16; int i = tileentity.e - this.j * 16;
int j = tileentity.c; int j = tileentity.f;
int k = tileentity.d - this.k * 16; int k = tileentity.g - this.k * 16;
this.a(i, j, k, tileentity); this.a(i, j, k, tileentity);
} }
@ -473,10 +430,10 @@ public class Chunk {
public void a(int i, int j, int k, TileEntity tileentity) { public void a(int i, int j, int k, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k); ChunkPosition chunkposition = new ChunkPosition(i, j, k);
tileentity.a = this.d; tileentity.d = this.d;
tileentity.b = this.j * 16 + i; tileentity.e = this.j * 16 + i;
tileentity.c = j; tileentity.f = j;
tileentity.d = this.k * 16 + k; tileentity.g = this.k * 16 + k;
if (this.a(i, j, k) != 0 && Block.byId[this.a(i, j, k)] instanceof BlockContainer) { if (this.a(i, j, k) != 0 && Block.byId[this.a(i, j, k)] instanceof BlockContainer) {
if (this.c) { if (this.c) {
if (this.l.get(chunkposition) != null) { if (this.l.get(chunkposition) != null) {
@ -577,10 +534,10 @@ public class Chunk {
return false; return false;
} else { } else {
if (flag) { if (flag) {
if (this.q && this.d.e != this.r) { if (this.q && this.d.k() != this.r) {
return true; return true;
} }
} else if (this.q && this.d.e >= this.r + 600L) { } else if (this.q && this.d.k() >= this.r + 600L) {
return true; return true;
} }
@ -634,7 +591,7 @@ public class Chunk {
} }
public Random a(long i) { public Random a(long i) {
return new Random(this.d.u + (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.d.j() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i);
} }
public boolean g() { public boolean g() {

View File

@ -1,567 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class ChunkProviderGenerate implements IChunkProvider {
private Random j;
private NoiseGeneratorOctaves k;
private NoiseGeneratorOctaves l;
private NoiseGeneratorOctaves m;
private NoiseGeneratorOctaves n;
private NoiseGeneratorOctaves o;
public NoiseGeneratorOctaves a;
public NoiseGeneratorOctaves b;
public NoiseGeneratorOctaves c;
private World p;
private double[] q;
private double[] r = new double[256];
private double[] s = new double[256];
private double[] t = new double[256];
private MapGenBase u = new MapGenCaves();
private BiomeBase[] v;
double[] d;
double[] e;
double[] f;
double[] g;
double[] h;
int[][] i = new int[32][32];
private double[] w;
public ChunkProviderGenerate(World world, long i) {
this.p = world;
this.j = new Random(i);
this.k = new NoiseGeneratorOctaves(this.j, 16);
this.l = new NoiseGeneratorOctaves(this.j, 16);
this.m = new NoiseGeneratorOctaves(this.j, 8);
this.n = new NoiseGeneratorOctaves(this.j, 4);
this.o = new NoiseGeneratorOctaves(this.j, 4);
this.a = new NoiseGeneratorOctaves(this.j, 10);
this.b = new NoiseGeneratorOctaves(this.j, 16);
this.c = new NoiseGeneratorOctaves(this.j, 8);
}
public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase, double[] adouble) {
byte b0 = 4;
byte b1 = 64;
int k = b0 + 1;
byte b2 = 17;
int l = b0 + 1;
this.q = this.a(this.q, i * b0, 0, j * b0, k, b2, l);
for (int i1 = 0; i1 < b0; ++i1) {
for (int j1 = 0; j1 < b0; ++j1) {
for (int k1 = 0; k1 < 16; ++k1) {
double d0 = 0.125D;
double d1 = this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
double d2 = this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
double d3 = this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
double d4 = this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
double d5 = (this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
double d6 = (this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
double d7 = (this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
double d8 = (this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;
for (int l1 = 0; l1 < 8; ++l1) {
double d9 = 0.25D;
double d10 = d1;
double d11 = d2;
double d12 = (d3 - d1) * d9;
double d13 = (d4 - d2) * d9;
for (int i2 = 0; i2 < 4; ++i2) {
int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
short short1 = 128;
double d14 = 0.25D;
double d15 = d10;
double d16 = (d11 - d10) * d14;
for (int k2 = 0; k2 < 4; ++k2) {
double d17 = adouble[(i1 * 4 + i2) * 16 + j1 * 4 + k2];
int l2 = 0;
if (k1 * 8 + l1 < b1) {
if (d17 < 0.5D && k1 * 8 + l1 >= b1 - 1) {
l2 = Block.ICE.id;
} else {
l2 = Block.STATIONARY_WATER.id;
}
}
if (d15 > 0.0D) {
l2 = Block.STONE.id;
}
abyte[j2] = (byte) l2;
j2 += short1;
d15 += d16;
}
d10 += d12;
d11 += d13;
}
d1 += d5;
d2 += d6;
d3 += d7;
d4 += d8;
}
}
}
}
}
public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase) {
byte b0 = 64;
double d0 = 0.03125D;
this.r = this.n.a(this.r, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0, d0, 1.0D);
this.s = this.n.a(this.s, (double) (i * 16), 109.0134D, (double) (j * 16), 16, 1, 16, d0, 1.0D, d0); // CraftBukkit -- i & j swapped.
this.t = this.o.a(this.t, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
for (int k = 0; k < 16; ++k) {
for (int l = 0; l < 16; ++l) {
BiomeBase biomebase = abiomebase[k + l * 16];
boolean flag = this.r[k + l * 16] + this.j.nextDouble() * 0.2D > 0.0D;
boolean flag1 = this.s[k + l * 16] + this.j.nextDouble() * 0.2D > 3.0D;
int i1 = (int) (this.t[k + l * 16] / 3.0D + 3.0D + this.j.nextDouble() * 0.25D);
int j1 = -1;
byte b1 = biomebase.o;
byte b2 = biomebase.p;
for (int k1 = 127; k1 >= 0; --k1) {
int l1 = (k + l * 16) * 128 + k1; // CraftBukkit (k*16+l) -> (k+l*16)
if (k1 <= 0 + this.j.nextInt(5)) {
abyte[l1] = (byte) Block.BEDROCK.id;
} else {
byte b3 = abyte[l1];
if (b3 == 0) {
j1 = -1;
} else if (b3 == Block.STONE.id) {
if (j1 == -1) {
if (i1 <= 0) {
b1 = 0;
b2 = (byte) Block.STONE.id;
} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
b1 = biomebase.o;
b2 = biomebase.p;
if (flag1) {
b1 = 0;
}
if (flag1) {
b2 = (byte) Block.GRAVEL.id;
}
if (flag) {
b1 = (byte) Block.SAND.id;
}
if (flag) {
b2 = (byte) Block.SAND.id;
}
}
if (k1 < b0 && b1 == 0) {
b1 = (byte) Block.STATIONARY_WATER.id;
}
j1 = i1;
if (k1 >= b0 - 1) {
abyte[l1] = b1;
} else {
abyte[l1] = b2;
}
} else if (j1 > 0) {
--j1;
abyte[l1] = b2;
}
}
}
}
}
}
}
public Chunk b(int i, int j) {
this.j.setSeed((long) i * 341873128712L + (long) j * 132897987541L);
byte[] abyte = new byte['\u8000'];
Chunk chunk = new Chunk(this.p, abyte, i, j);
this.v = this.p.a().a(this.v, i * 16, j * 16, 16, 16);
double[] adouble = this.p.a().a;
this.a(i, j, abyte, this.v, adouble);
this.a(i, j, abyte, this.v);
this.u.a(this, this.p, i, j, abyte);
chunk.b();
return chunk;
}
private double[] a(double[] adouble, int i, int j, int k, int l, int i1, int j1) {
if (adouble == null) {
adouble = new double[l * i1 * j1];
}
double d0 = 684.412D;
double d1 = 684.412D;
double[] adouble1 = this.p.a().a;
double[] adouble2 = this.p.a().b;
this.g = this.a.a(this.g, i, k, l, j1, 1.121D, 1.121D, 0.5D);
this.h = this.b.a(this.h, i, k, l, j1, 200.0D, 200.0D, 0.5D);
this.d = this.m.a(this.d, (double) i, (double) j, (double) k, l, i1, j1, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
this.e = this.k.a(this.e, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
this.f = this.l.a(this.f, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
int k1 = 0;
int l1 = 0;
int i2 = 16 / l;
for (int j2 = 0; j2 < l; ++j2) {
int k2 = j2 * i2 + i2 / 2;
for (int l2 = 0; l2 < j1; ++l2) {
int i3 = l2 * i2 + i2 / 2;
double d2 = adouble1[k2 * 16 + i3];
double d3 = adouble2[k2 * 16 + i3] * d2;
double d4 = 1.0D - d3;
d4 *= d4;
d4 *= d4;
d4 = 1.0D - d4;
double d5 = (this.g[l1] + 256.0D) / 512.0D;
d5 *= d4;
if (d5 > 1.0D) {
d5 = 1.0D;
}
double d6 = this.h[l1] / 8000.0D;
if (d6 < 0.0D) {
d6 = -d6 * 0.3D;
}
d6 = d6 * 3.0D - 2.0D;
if (d6 < 0.0D) {
d6 /= 2.0D;
if (d6 < -1.0D) {
d6 = -1.0D;
}
d6 /= 1.4D;
d6 /= 2.0D;
d5 = 0.0D;
} else {
if (d6 > 1.0D) {
d6 = 1.0D;
}
d6 /= 8.0D;
}
if (d5 < 0.0D) {
d5 = 0.0D;
}
d5 += 0.5D;
d6 = d6 * (double) i1 / 16.0D;
double d7 = (double) i1 / 2.0D + d6 * 4.0D;
++l1;
for (int j3 = 0; j3 < i1; ++j3) {
double d8 = 0.0D;
double d9 = ((double) j3 - d7) * 12.0D / d5;
if (d9 < 0.0D) {
d9 *= 4.0D;
}
double d10 = this.e[k1] / 512.0D;
double d11 = this.f[k1] / 512.0D;
double d12 = (this.d[k1] / 10.0D + 1.0D) / 2.0D;
if (d12 < 0.0D) {
d8 = d10;
} else if (d12 > 1.0D) {
d8 = d11;
} else {
d8 = d10 + (d11 - d10) * d12;
}
d8 -= d9;
if (j3 > i1 - 4) {
double d13 = (double) ((float) (j3 - (i1 - 4)) / 3.0F);
d8 = d8 * (1.0D - d13) + -10.0D * d13;
}
adouble[k1] = d8;
++k1;
}
}
}
return adouble;
}
public boolean a(int i, int j) {
return true;
}
public void a(IChunkProvider ichunkprovider, int i, int j) {
BlockSand.a = true;
int k = i * 16;
int l = j * 16;
BiomeBase biomebase = this.p.a().a(k + 16, l + 16);
this.j.setSeed(this.p.u);
long i1 = this.j.nextLong() / 2L * 2L + 1L;
long j1 = this.j.nextLong() / 2L * 2L + 1L;
this.j.setSeed((long) i * i1 + (long) j * j1 ^ this.p.u);
double d0 = 0.25D;
int k1;
int l1;
int i2;
if (this.j.nextInt(4) == 0) {
k1 = k + this.j.nextInt(16) + 8;
l1 = this.j.nextInt(128);
i2 = l + this.j.nextInt(16) + 8;
(new WorldGenLakes(Block.STATIONARY_WATER.id)).a(this.p, this.j, k1, l1, i2);
}
if (this.j.nextInt(8) == 0) {
k1 = k + this.j.nextInt(16) + 8;
l1 = this.j.nextInt(this.j.nextInt(120) + 8);
i2 = l + this.j.nextInt(16) + 8;
if (l1 < 64 || this.j.nextInt(10) == 0) {
(new WorldGenLakes(Block.STATIONARY_LAVA.id)).a(this.p, this.j, k1, l1, i2);
}
}
int j2;
for (k1 = 0; k1 < 8; ++k1) {
l1 = k + this.j.nextInt(16) + 8;
i2 = this.j.nextInt(128);
j2 = l + this.j.nextInt(16) + 8;
(new WorldGenDungeons()).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 10; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(128);
j2 = l + this.j.nextInt(16);
(new WorldGenClay(32)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 20; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(128);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.DIRT.id, 32)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 10; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(128);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.GRAVEL.id, 32)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 20; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(128);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.COAL_ORE.id, 16)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 20; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(64);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.IRON_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 2; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(32);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.GOLD_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 8; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(16);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.REDSTONE_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 1; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(16);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.DIAMOND_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
}
for (k1 = 0; k1 < 1; ++k1) {
l1 = k + this.j.nextInt(16);
i2 = this.j.nextInt(16) + this.j.nextInt(16);
j2 = l + this.j.nextInt(16);
(new WorldGenMinable(Block.LAPIS_ORE.id, 6)).a(this.p, this.j, l1, i2, j2);
}
d0 = 0.5D;
k1 = (int) ((this.c.a((double) k * d0, (double) l * d0) / 8.0D + this.j.nextDouble() * 4.0D + 4.0D) / 3.0D);
l1 = 0;
if (this.j.nextInt(10) == 0) {
++l1;
}
if (biomebase == BiomeBase.FOREST) {
l1 += k1 + 5;
}
if (biomebase == BiomeBase.RAINFOREST) {
l1 += k1 + 5;
}
if (biomebase == BiomeBase.SEASONAL_FOREST) {
l1 += k1 + 2;
}
if (biomebase == BiomeBase.TAIGA) {
l1 += k1 + 5;
}
if (biomebase == BiomeBase.DESERT) {
l1 -= 20;
}
if (biomebase == BiomeBase.TUNDRA) {
l1 -= 20;
}
if (biomebase == BiomeBase.PLAINS) {
l1 -= 20;
}
int k2;
for (i2 = 0; i2 < l1; ++i2) {
j2 = k + this.j.nextInt(16) + 8;
k2 = l + this.j.nextInt(16) + 8;
WorldGenerator worldgenerator = biomebase.a(this.j);
worldgenerator.a(1.0D, 1.0D, 1.0D);
worldgenerator.a(this.p, this.j, j2, this.p.d(j2, k2), k2);
}
int l2;
for (i2 = 0; i2 < 2; ++i2) {
j2 = k + this.j.nextInt(16) + 8;
k2 = this.j.nextInt(128);
l2 = l + this.j.nextInt(16) + 8;
(new WorldGenFlowers(Block.YELLOW_FLOWER.id)).a(this.p, this.j, j2, k2, l2);
}
if (this.j.nextInt(2) == 0) {
i2 = k + this.j.nextInt(16) + 8;
j2 = this.j.nextInt(128);
k2 = l + this.j.nextInt(16) + 8;
(new WorldGenFlowers(Block.RED_ROSE.id)).a(this.p, this.j, i2, j2, k2);
}
if (this.j.nextInt(4) == 0) {
i2 = k + this.j.nextInt(16) + 8;
j2 = this.j.nextInt(128);
k2 = l + this.j.nextInt(16) + 8;
(new WorldGenFlowers(Block.BROWN_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2);
}
if (this.j.nextInt(8) == 0) {
i2 = k + this.j.nextInt(16) + 8;
j2 = this.j.nextInt(128);
k2 = l + this.j.nextInt(16) + 8;
(new WorldGenFlowers(Block.RED_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2);
}
for (i2 = 0; i2 < 10; ++i2) {
j2 = k + this.j.nextInt(16) + 8;
k2 = this.j.nextInt(128);
l2 = l + this.j.nextInt(16) + 8;
(new WorldGenReed()).a(this.p, this.j, j2, k2, l2);
}
if (this.j.nextInt(32) == 0) {
i2 = k + this.j.nextInt(16) + 8;
j2 = this.j.nextInt(128);
k2 = l + this.j.nextInt(16) + 8;
(new WorldGenPumpkin()).a(this.p, this.j, i2, j2, k2);
}
i2 = 0;
if (biomebase == BiomeBase.DESERT) {
i2 += 10;
}
int i3;
for (j2 = 0; j2 < i2; ++j2) {
k2 = k + this.j.nextInt(16) + 8;
l2 = this.j.nextInt(128);
i3 = l + this.j.nextInt(16) + 8;
(new WorldGenCactus()).a(this.p, this.j, k2, l2, i3);
}
for (j2 = 0; j2 < 50; ++j2) {
k2 = k + this.j.nextInt(16) + 8;
l2 = this.j.nextInt(this.j.nextInt(120) + 8);
i3 = l + this.j.nextInt(16) + 8;
(new WorldGenLiquids(Block.WATER.id)).a(this.p, this.j, k2, l2, i3);
}
for (j2 = 0; j2 < 20; ++j2) {
k2 = k + this.j.nextInt(16) + 8;
l2 = this.j.nextInt(this.j.nextInt(this.j.nextInt(112) + 8) + 8);
i3 = l + this.j.nextInt(16) + 8;
(new WorldGenLiquids(Block.LAVA.id)).a(this.p, this.j, k2, l2, i3);
}
this.w = this.p.a().a(this.w, k + 8, l + 8, 16, 16);
for (j2 = k + 8; j2 < k + 8 + 16; ++j2) {
for (k2 = l + 8; k2 < l + 8 + 16; ++k2) {
l2 = j2 - (k + 8);
i3 = k2 - (l + 8);
int j3 = this.p.e(j2, k2);
double d1 = this.w[l2 * 16 + i3] - (double) (j3 - 64) / 64.0D * 0.3D;
if (d1 < 0.5D && j3 > 0 && j3 < 128 && this.p.isEmpty(j2, j3, k2) && this.p.getMaterial(j2, j3 - 1, k2).isSolid() && this.p.getMaterial(j2, j3 - 1, k2) != Material.ICE) {
this.p.e(j2, j3, k2, Block.SNOW.id);
}
}
}
BlockSand.a = false;
}
public boolean a(boolean flag, IProgressUpdate iprogressupdate) {
return true;
}
public boolean a() {
return false;
}
public boolean b() {
return true;
}
}

View File

@ -38,8 +38,9 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public void c(int i, int j) { public void c(int i, int j) {
int k = i * 16 + 8 - this.g.spawnX; ChunkCoordinates chunkcoordinates = this.g.l();
int l = j * 16 + 8 - this.g.spawnZ; int k = i * 16 + 8 - chunkcoordinates.a;
int l = j * 16 + 8 - chunkcoordinates.c;
short short1 = 128; short short1 = 128;
if (k < -short1 || k > short1 || l < -short1 || l > short1) { if (k < -short1 || k > short1 || l < -short1 || l > short1) {
@ -105,7 +106,7 @@ public class ChunkProviderServer implements IChunkProvider {
public Chunk b(int i, int j) { public Chunk b(int i, int j) {
Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit
return chunk == null ? (this.g.x ? this.d(i, j) : this.b) : chunk; return chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk;
} }
public Chunk e(int i, int j) { // Craftbukkit - public public Chunk e(int i, int j) { // Craftbukkit - public
@ -116,7 +117,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.d.a(this.g, i, j); Chunk chunk = this.d.a(this.g, i, j);
if (chunk != null) { if (chunk != null) {
chunk.r = this.g.e; chunk.r = this.g.k();
} }
return chunk; return chunk;
@ -140,7 +141,7 @@ public class ChunkProviderServer implements IChunkProvider {
public void b(Chunk chunk) { // Craftbukkit - public public void b(Chunk chunk) { // Craftbukkit - public
if (this.d != null) { if (this.d != null) {
try { try {
chunk.r = this.g.e; chunk.r = this.g.k();
this.d.a(this.g, chunk); this.d.a(this.g, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace(); ioexception.printStackTrace();
@ -192,7 +193,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public boolean a() { public boolean a() {
if (!this.g.C) { if (!this.g.w) {
// CraftBukkit start // CraftBukkit start
Server server = g.getServer(); Server server = g.getServer();
while (!this.a.isEmpty()) { while (!this.a.isEmpty()) {
@ -223,6 +224,6 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public boolean b() { public boolean b() {
return !this.g.C; return !this.g.w;
} }
} }

View File

@ -0,0 +1,290 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
public class ConsoleCommandHandler {
private static Logger a = Logger.getLogger("Minecraft");
private MinecraftServer b;
public ConsoleCommandHandler(MinecraftServer minecraftserver) {
this.b = minecraftserver;
}
public void a(ServerCommand servercommand) {
String s = servercommand.a;
ICommandListener icommandlistener = servercommand.b;
String s1 = icommandlistener.c();
WorldServer worldserver = b.worlds.get(0); // Craftbukkit
ServerConfigurationManager serverconfigurationmanager = this.b.f;
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
if (s.toLowerCase().startsWith("list")) {
icommandlistener.b("Connected players: " + serverconfigurationmanager.c());
} else if (s.toLowerCase().startsWith("stop")) {
this.a(s1, "Stopping the server..");
this.b.a();
} else if (s.toLowerCase().startsWith("save-all")) {
this.a(s1, "Forcing save..");
worldserver.a(true, (IProgressUpdate) null);
this.a(s1, "Save complete.");
} else if (s.toLowerCase().startsWith("save-off")) {
this.a(s1, "Disabling level saving..");
worldserver.w = true;
} else if (s.toLowerCase().startsWith("save-on")) {
this.a(s1, "Enabling level saving..");
worldserver.w = false;
} else {
String s2;
if (s.toLowerCase().startsWith("op ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.e(s2);
this.a(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.a(s1, "De-opping " + s2);
} else if (s.toLowerCase().startsWith("ban-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.c(s2);
this.a(s1, "Banning ip " + s2);
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.d(s2);
this.a(s1, "Pardoning ip " + s2);
} else {
EntityPlayer entityplayer;
if (s.toLowerCase().startsWith("ban ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.a(s2);
this.a(s1, "Banning " + s2);
entityplayer = serverconfigurationmanager.i(s2);
if (entityplayer != null) {
entityplayer.a.a("Banned by admin");
}
} else if (s.toLowerCase().startsWith("pardon ")) {
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.b(s2);
this.a(s1, "Pardoning " + s2);
} else {
int i;
if (s.toLowerCase().startsWith("kick ")) {
s2 = s.substring(s.indexOf(" ")).trim();
entityplayer = null;
for (i = 0; i < serverconfigurationmanager.b.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.b.get(i);
if (entityplayer1.name.equalsIgnoreCase(s2)) {
entityplayer = entityplayer1;
}
}
if (entityplayer != null) {
entityplayer.a.a("Kicked by admin");
this.a(s1, "Kicking " + entityplayer.name);
} else {
icommandlistener.b("Can\'t find user " + s2 + ". No kick.");
}
} else {
String[] astring;
EntityPlayer entityplayer2;
if (s.toLowerCase().startsWith("tp ")) {
astring = s.split(" ");
if (astring.length == 3) {
entityplayer = serverconfigurationmanager.i(astring[1]);
entityplayer2 = serverconfigurationmanager.i(astring[2]);
if (entityplayer == null) {
icommandlistener.b("Can\'t find user " + astring[1] + ". No tp.");
} else if (entityplayer2 == null) {
icommandlistener.b("Can\'t find user " + astring[2] + ". No tp.");
} else {
entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
}
} else {
icommandlistener.b("Syntax error, please provice a source and a target.");
}
} else {
String s3;
if (s.toLowerCase().startsWith("give ")) {
astring = s.split(" ");
if (astring.length != 3 && astring.length != 4) {
return;
}
s3 = astring[1];
entityplayer2 = serverconfigurationmanager.i(s3);
if (entityplayer2 != null) {
try {
int j = Integer.parseInt(astring[2]);
if (Item.byId[j] != null) {
this.a(s1, "Giving " + entityplayer2.name + " some " + j);
int k = 1;
if (astring.length > 3) {
k = this.a(astring[3], 1);
}
if (k < 1) {
k = 1;
}
if (k > 64) {
k = 64;
}
entityplayer2.b(new ItemStack(j, k, 0));
} else {
icommandlistener.b("There\'s no item with id " + j);
}
} catch (NumberFormatException numberformatexception) {
icommandlistener.b("There\'s no item with id " + astring[2]);
}
} else {
icommandlistener.b("Can\'t find user " + s3);
}
} else if (s.toLowerCase().startsWith("time ")) {
astring = s.split(" ");
if (astring.length != 3) {
return;
}
s3 = astring[1];
try {
i = Integer.parseInt(astring[2]);
if ("add".equalsIgnoreCase(s3)) {
worldserver.a(worldserver.k() + (long) i);
this.a(s1, "Added " + i + " to time");
} else if ("set".equalsIgnoreCase(s3)) {
worldserver.a((long) i);
this.a(s1, "Set time to " + i);
} else {
icommandlistener.b("Unknown method, use either \"add\" or \"set\"");
}
} catch (NumberFormatException numberformatexception1) {
icommandlistener.b("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)));
} else if (s.toLowerCase().startsWith("tell ")) {
astring = s.split(" ");
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "->" + astring[1] + "] " + s);
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.");
}
}
} else if (s.toLowerCase().startsWith("whitelist ")) {
this.a(s1, s, icommandlistener);
} else {
a.info("Unknown console command. Type \"help\" for help.");
}
}
}
}
}
}
} else {
this.a(icommandlistener);
}
}
private void a(String s, String s1, ICommandListener icommandlistener) {
String[] astring = s1.split(" ");
if (astring.length >= 2) {
String s2 = astring[1].toLowerCase();
if ("on".equals(s2)) {
this.a(s, "Turned on white-listing");
this.b.d.b("white-list", true);
} else if ("off".equals(s2)) {
this.a(s, "Turned off white-listing");
this.b.d.b("white-list", false);
} else if ("list".equals(s2)) {
Set set = this.b.f.e();
String s3 = "";
String s4;
for (Iterator iterator = set.iterator(); iterator.hasNext(); s3 = s3 + s4 + " ") {
s4 = (String) iterator.next();
}
icommandlistener.b("White-listed players: " + s3);
} else {
String s5;
if ("add".equals(s2) && astring.length == 3) {
s5 = astring[2].toLowerCase();
this.b.f.k(s5);
this.a(s, "Added " + s5 + " to white-list");
} else if ("remove".equals(s2) && astring.length == 3) {
s5 = astring[2].toLowerCase();
this.b.f.l(s5);
this.a(s, "Removed " + s5 + " from white-list");
} else if ("reload".equals(s2)) {
this.b.f.f();
this.a(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)");
}
private void a(String s, String s1) {
String s2 = s + ": " + s1;
this.b.f.j("\u00A77(" + s2 + ")");
a.info(s2);
}
private int a(String s, int i) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException numberformatexception) {
return i;
}
}
}

View File

@ -22,8 +22,8 @@ public abstract class Entity {
private static int entityCount = 0; private static int entityCount = 0;
public int id; public int id;
public double h; public double aB;
public boolean i; public boolean aC;
public Entity passenger; public Entity passenger;
public Entity vehicle; public Entity vehicle;
public World world; public World world;
@ -42,81 +42,81 @@ public abstract class Entity {
public float lastPitch; public float lastPitch;
public final AxisAlignedBB boundingBox; public final AxisAlignedBB boundingBox;
public boolean onGround; public boolean onGround;
public boolean B; public boolean aV;
public boolean C; public boolean aW;
public boolean D; public boolean aX;
public boolean E; public boolean aY;
public boolean F; public boolean aZ;
public boolean dead; public boolean dead;
public float height; public float height;
public float length; public float length;
public float width; public float width;
public float K; public float be;
public float L; public float bf;
protected boolean M; protected boolean bg;
protected float fallDistance; protected float fallDistance;
private int b; private int b;
public double O; public double bi;
public double P; public double bj;
public double Q; public double bk;
public float R; public float bl;
public float S; public float bm;
public boolean T; public boolean bn;
public float U; public float bo;
public boolean V; public boolean bp;
protected Random random; protected Random random;
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; public int fireTicks;
public int maxAirTicks; // Craftbukkit: Make public public int maxAirTicks; // Craftbukkit: Make public
protected boolean ab; protected boolean bv;
public int noDamageTicks; public int noDamageTicks;
public int airTicks; public int airTicks;
private boolean justCreated; private boolean justCreated;
protected boolean ae; protected boolean by;
protected DataWatcher datawatcher; protected DataWatcher datawatcher;
private double d; private double d;
private double e; private double e;
public boolean ag; public boolean bA;
public int chunkX; public int chunkX;
public int ai; public int bC;
public int chunkZ; public int chunkZ;
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.h = 1.0D; this.aB = 1.0D;
this.i = false; this.aC = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false; this.onGround = false;
this.D = false; this.aX = false;
this.E = false; this.aY = false;
this.F = true; this.aZ = true;
this.dead = false; this.dead = false;
this.height = 0.0F; this.height = 0.0F;
this.length = 0.6F; this.length = 0.6F;
this.width = 1.8F; this.width = 1.8F;
this.K = 0.0F; this.be = 0.0F;
this.L = 0.0F; this.bf = 0.0F;
this.M = true; this.bg = true;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.b = 1; this.b = 1;
this.R = 0.0F; this.bl = 0.0F;
this.S = 0.0F; this.bm = 0.0F;
this.T = false; this.bn = false;
this.U = 0.0F; this.bo = 0.0F;
this.V = false; this.bp = false;
this.random = new Random(); this.random = new Random();
this.ticksLived = 0; this.ticksLived = 0;
this.maxFireTicks = 1; this.maxFireTicks = 1;
this.fireTicks = 0; this.fireTicks = 0;
this.maxAirTicks = 300; this.maxAirTicks = 300;
this.ab = false; this.bv = false;
this.noDamageTicks = 0; this.noDamageTicks = 0;
this.airTicks = 300; this.airTicks = 300;
this.justCreated = true; this.justCreated = true;
this.ae = false; this.by = false;
this.datawatcher = new DataWatcher(); this.datawatcher = new DataWatcher();
this.ag = false; this.bA = false;
this.world = world; this.world = world;
this.a(0.0D, 0.0D, 0.0D); this.a(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0)); this.datawatcher.a(0, Byte.valueOf((byte) 0));
@ -125,7 +125,7 @@ public abstract class Entity {
protected abstract void a(); protected abstract void a();
public DataWatcher p() { public DataWatcher O() {
return this.datawatcher; return this.datawatcher;
} }
@ -137,7 +137,7 @@ public abstract class Entity {
return this.id; return this.id;
} }
public void q() { public void C() {
this.dead = true; this.dead = true;
} }
@ -146,7 +146,7 @@ public abstract class Entity {
this.width = f1; this.width = f1;
} }
protected void b(float f, float f1) { protected void c(float f, float f1) {
this.yaw = f; this.yaw = f;
this.pitch = f1; this.pitch = f1;
} }
@ -158,27 +158,27 @@ public abstract class Entity {
float f = this.length / 2.0F; float f = this.length / 2.0F;
float f1 = this.width; float f1 = this.width;
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.R, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.R + (double) f1, d2 + (double) f); this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bl, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bl + (double) f1, d2 + (double) f);
} }
public void b_() { public void f_() {
this.r(); this.H();
} }
public void r() { public void H() {
if (this.vehicle != null && this.vehicle.dead) { if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} }
++this.ticksLived; ++this.ticksLived;
this.K = this.L; this.be = this.bf;
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
this.lastPitch = this.pitch; this.lastPitch = this.pitch;
this.lastYaw = this.yaw; this.lastYaw = this.yaw;
if (this.v()) { if (this.g_()) {
if (!this.ab && !this.justCreated) { if (!this.bv && !this.justCreated) {
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) { if (f > 1.0F) {
@ -206,16 +206,16 @@ public abstract class Entity {
} }
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.ab = true; this.bv = true;
this.fireTicks = 0; this.fireTicks = 0;
} else { } else {
this.ab = false; this.bv = false;
} }
if (this.world.isStatic) { if (this.world.isStatic) {
this.fireTicks = 0; this.fireTicks = 0;
} else if (this.fireTicks > 0) { } else if (this.fireTicks > 0) {
if (this.ae) { if (this.by) {
this.fireTicks -= 4; this.fireTicks -= 4;
if (this.fireTicks < 0) { if (this.fireTicks < 0) {
this.fireTicks = 0; this.fireTicks = 0;
@ -246,12 +246,12 @@ public abstract class Entity {
} }
} }
if (this.x()) { if (this.Q()) {
this.s(); this.P();
} }
if (this.locY < -64.0D) { if (this.locY < -64.0D) {
this.t(); this.M();
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -262,8 +262,8 @@ public abstract class Entity {
this.justCreated = false; this.justCreated = false;
} }
protected void s() { protected void P() {
if (!this.ae) { if (!this.by) {
// CraftBukkit start // CraftBukkit start
// TODO: this event spams! // TODO: this event spams!
if(this instanceof EntityLiving) { if(this instanceof EntityLiving) {
@ -301,8 +301,8 @@ public abstract class Entity {
} }
} }
protected void t() { protected void M() {
this.q(); this.C();
} }
public boolean b(double d0, double d1, double d2) { public boolean b(double d0, double d1, double d2) {
@ -313,10 +313,10 @@ public abstract class Entity {
} }
public void c(double d0, double d1, double d2) { public void c(double d0, double d1, double d2) {
if (this.T) { if (this.bn) {
this.boundingBox.d(d0, d1, d2); this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.R; this.locY = this.boundingBox.b + (double) this.height - (double) this.bl;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else { } else {
double d3 = this.locX; double d3 = this.locX;
@ -325,7 +325,7 @@ public abstract class Entity {
double d6 = d1; double d6 = d1;
double d7 = d2; double d7 = d2;
AxisAlignedBB axisalignedbb = this.boundingBox.b(); AxisAlignedBB axisalignedbb = this.boundingBox.b();
boolean flag = this.onGround && this.J(); boolean flag = this.onGround && this.U();
if (flag) { if (flag) {
double d8; double d8;
@ -358,7 +358,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.F && d6 != d1) { if (!this.aZ && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -373,7 +373,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.F && d5 != d0) { if (!this.aZ && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -384,7 +384,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.F && d7 != d2) { if (!this.aZ && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -394,13 +394,13 @@ public abstract class Entity {
double d10; double d10;
int k; int k;
if (this.S > 0.0F && flag1 && this.R < 0.05F && (d5 != d0 || d7 != d2)) { if (this.bm > 0.0F && flag1 && this.bl < 0.05F && (d5 != d0 || d7 != d2)) {
d9 = d0; d9 = d0;
d10 = d1; d10 = d1;
double d11 = d2; double d11 = d2;
d0 = d5; d0 = d5;
d1 = (double) this.S; d1 = (double) this.bm;
d2 = d7; d2 = d7;
AxisAlignedBB axisalignedbb1 = this.boundingBox.b(); AxisAlignedBB axisalignedbb1 = this.boundingBox.b();
@ -412,7 +412,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.F && d6 != d1) { if (!this.aZ && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -423,7 +423,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.F && d5 != d0) { if (!this.aZ && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -434,7 +434,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.F && d7 != d2) { if (!this.aZ && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -446,17 +446,17 @@ public abstract class Entity {
d2 = d11; d2 = d11;
this.boundingBox.b(axisalignedbb1); this.boundingBox.b(axisalignedbb1);
} else { } else {
this.R = (float) ((double) this.R + 0.5D); this.bl = (float) ((double) this.bl + 0.5D);
} }
} }
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.R; this.locY = this.boundingBox.b + (double) this.height - (double) this.bl;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.B = d5 != d0 || d7 != d2; this.aV = d5 != d0 || d7 != d2;
this.C = d6 != d1; this.aW = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D; this.onGround = d6 != d1 && d6 < 0.0D;
this.D = this.B || this.C; this.aX = this.aV || this.aW;
this.a(d1, this.onGround); this.a(d1, this.onGround);
if (d5 != d0) { if (d5 != d0) {
this.motX = 0.0D; this.motX = 0.0D;
@ -477,7 +477,7 @@ public abstract class Entity {
int j1; int j1;
// Craftbukkit start // Craftbukkit start
if ((B) && (getBukkitEntity() instanceof Vehicle)) { if ((this.bg) && (getBukkitEntity() instanceof Vehicle)) {
Vehicle vehicle = (Vehicle)getBukkitEntity(); Vehicle vehicle = (Vehicle)getBukkitEntity();
org.bukkit.World wrld = ((WorldServer)world).getWorld(); 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.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ));
@ -493,17 +493,17 @@ public abstract class Entity {
} }
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block); VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block);
((WorldServer)world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);
} }
// Craftbukkit end // Craftbukkit end
if (this.M && !flag) { if (this.bg && !flag) {
this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); this.bf = (float) ((double) this.bf + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.b(this.locX); l = MathHelper.b(this.locX);
i1 = MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height); i1 = MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height);
j1 = MathHelper.b(this.locZ); j1 = MathHelper.b(this.locZ);
k = this.world.getTypeId(l, i1, j1); k = this.world.getTypeId(l, i1, j1);
if (this.L > (float) this.b && k > 0) { if (this.bf > (float) this.b && k > 0) {
++this.b; ++this.b;
StepSound stepsound = Block.byId[k].stepSound; StepSound stepsound = Block.byId[k].stepSound;
@ -539,11 +539,11 @@ public abstract class Entity {
} }
} }
this.R *= 0.4F; this.bl *= 0.4F;
boolean flag2 = this.v(); boolean flag2 = this.g_();
if (this.world.c(this.boundingBox)) { if (this.world.c(this.boundingBox)) {
this.b(1); this.a(1);
if (!flag2) { if (!flag2) {
++this.fireTicks; ++this.fireTicks;
// CraftBukkit start // CraftBukkit start
@ -586,14 +586,14 @@ public abstract class Entity {
} }
} }
public AxisAlignedBB u() { public AxisAlignedBB d() {
return null; return null;
} }
protected void b(int i) { protected void a(int i) {
if (!this.ae) { if (!this.by) {
// CraftBukkit start // CraftBukkit start
if(this instanceof EntityLiving) { if (this instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity(); org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE; DamageCause damageType = EntityDamageEvent.DamageCause.FIRE;
@ -614,12 +614,12 @@ public abstract class Entity {
protected void a(float f) {} protected void a(float f) {}
public boolean v() { public boolean g_() {
return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D), Material.WATER, this); return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D), Material.WATER, this);
} }
public boolean a(Material material) { public boolean a(Material material) {
double d0 = this.locY + (double) this.w(); double d0 = this.locY + (double) this.p();
int i = MathHelper.b(this.locX); int i = MathHelper.b(this.locX);
int j = MathHelper.d((float) MathHelper.b(d0)); int j = MathHelper.d((float) MathHelper.b(d0));
int k = MathHelper.b(this.locZ); int k = MathHelper.b(this.locZ);
@ -635,11 +635,11 @@ public abstract class Entity {
} }
} }
public float w() { public float p() {
return 0.0F; return 0.0F;
} }
public boolean x() { public boolean Q() {
return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
} }
@ -662,7 +662,7 @@ public abstract class Entity {
} }
} }
public float b(float f) { public float c(float f) {
int i = MathHelper.b(this.locX); int i = MathHelper.b(this.locX);
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D; double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int j = MathHelper.b(this.locY - (double) this.height + d0); int j = MathHelper.b(this.locY - (double) this.height + d0);
@ -677,7 +677,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2; this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f; this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1; this.lastPitch = this.pitch = f1;
this.R = 0.0F; this.bl = 0.0F;
double d3 = (double) (this.lastYaw - f); double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) { if (d3 < -180.0D) {
@ -689,19 +689,19 @@ public abstract class Entity {
} }
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
this.b(f, f1); this.c(f, f1);
} }
public void c(double d0, double d1, double d2, float f, float f1) { public void c(double d0, double d1, double d2, float f, float f1) {
this.O = this.lastX = this.locX = d0; this.bi = this.lastX = this.locX = d0;
this.P = this.lastY = this.locY = d1 + (double) this.height; this.bj = this.lastY = this.locY = d1 + (double) this.height;
this.Q = this.lastZ = this.locZ = d2; this.bk = this.lastZ = this.locZ = d2;
this.yaw = f; this.yaw = f;
this.pitch = f1; this.pitch = f1;
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
} }
public float a(Entity entity) { public float f(Entity entity) {
float f = (float) (this.locX - entity.locX); float f = (float) (this.locX - entity.locX);
float f1 = (float) (this.locY - entity.locY); float f1 = (float) (this.locY - entity.locY);
float f2 = (float) (this.locZ - entity.locZ); float f2 = (float) (this.locZ - entity.locZ);
@ -725,7 +725,7 @@ public abstract class Entity {
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5); return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
} }
public double b(Entity entity) { public double g(Entity entity) {
double d0 = this.locX - entity.locX; double d0 = this.locX - entity.locX;
double d1 = this.locY - entity.locY; double d1 = this.locY - entity.locY;
double d2 = this.locZ - entity.locZ; double d2 = this.locZ - entity.locZ;
@ -735,7 +735,7 @@ public abstract class Entity {
public void b(EntityHuman entityhuman) {} public void b(EntityHuman entityhuman) {}
public void c(Entity entity) { public void h(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) { if (entity.passenger != this && entity.vehicle != this) {
double d0 = entity.locX - this.locX; double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ; double d1 = entity.locZ - this.locZ;
@ -755,8 +755,8 @@ public abstract class Entity {
d1 *= d3; d1 *= d3;
d0 *= 0.05000000074505806D; d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D; d1 *= 0.05000000074505806D;
d0 *= (double) (1.0F - this.U); d0 *= (double) (1.0F - this.bo);
d1 *= (double) (1.0F - this.U); d1 *= (double) (1.0F - this.bo);
this.f(-d0, 0.0D, -d1); this.f(-d0, 0.0D, -d1);
entity.f(d0, 0.0D, d1); entity.f(d0, 0.0D, d1);
} }
@ -769,27 +769,27 @@ public abstract class Entity {
this.motZ += d2; this.motZ += d2;
} }
protected void y() { protected void R() {
this.E = true; this.aY = true;
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
this.y(); this.R();
return false; return false;
} }
public boolean c_() { public boolean d_() {
return false; return false;
} }
public boolean z() { public boolean e_() {
return false; return false;
} }
public void b(Entity entity, int i) {} public void c(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) { public boolean c(NBTTagCompound nbttagcompound) {
String s = this.A(); String s = this.S();
if (!this.dead && s != null) { if (!this.dead && s != null) {
nbttagcompound.a("id", s); nbttagcompound.a("id", s);
@ -808,35 +808,47 @@ public abstract class Entity {
nbttagcompound.a("Fire", (short) this.fireTicks); nbttagcompound.a("Fire", (short) this.fireTicks);
nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("Air", (short) this.airTicks);
nbttagcompound.a("OnGround", this.onGround); nbttagcompound.a("OnGround", this.onGround);
nbttagcompound.a("World", world.w); // Craftbukkit nbttagcompound.a("World", world.q.j); // CraftBukkit
this.a(nbttagcompound); this.a(nbttagcompound);
} }
public void e(NBTTagCompound nbttagcompound) { public void e(NBTTagCompound nbttagcompound) {
NBTTagList nbttaglist = nbttagcompound.k("Pos"); NBTTagList nbttaglist = nbttagcompound.l("Pos");
NBTTagList nbttaglist1 = nbttagcompound.k("Motion"); NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
NBTTagList nbttaglist2 = nbttagcompound.k("Rotation"); NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");
this.a(0.0D, 0.0D, 0.0D); this.a(0.0D, 0.0D, 0.0D);
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
this.lastX = this.O = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; if (Math.abs(this.motX) > 10.0D) {
this.lastY = this.P = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; this.motX = 0.0D;
this.lastZ = this.Q = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; }
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; if (Math.abs(this.motY) > 10.0D) {
this.fallDistance = nbttagcompound.f("FallDistance"); this.motY = 0.0D;
this.fireTicks = nbttagcompound.c("Fire"); }
this.airTicks = nbttagcompound.c("Air");
this.onGround = nbttagcompound.l("OnGround"); if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
this.lastX = this.bi = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
this.lastY = this.bj = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
this.lastZ = this.bk = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a % 6.2831855F;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a % 6.2831855F;
this.fallDistance = nbttagcompound.g("FallDistance");
this.fireTicks = nbttagcompound.d("Fire");
this.airTicks = nbttagcompound.d("Air");
this.onGround = nbttagcompound.m("OnGround");
// Craftbukkit start // Craftbukkit start
if (nbttagcompound.a("World")) { if (nbttagcompound.b("World")) {
String worldName = nbttagcompound.h("World"); String worldName = nbttagcompound.i("World");
for (WorldServer world : ((WorldServer)this.world).getServer().getServer().worlds) { for (WorldServer world : ((WorldServer)this.world).getServer().getServer().worlds) {
if (world.w.equals(worldName)) { if (world.q.j.equals(worldName)) {
this.world = world; this.world = world;
break; break;
} }
@ -848,7 +860,7 @@ public abstract class Entity {
this.b(nbttagcompound); this.b(nbttagcompound);
} }
protected final String A() { protected final String S() {
return EntityTypes.b(this); return EntityTypes.b(this);
} }
@ -884,7 +896,7 @@ public abstract class Entity {
return nbttaglist; return nbttaglist;
} }
public EntityItem a(int i, int j) { public EntityItem b(int i, int j) {
return this.a(i, j, 0.0F); return this.a(i, j, 0.0F);
} }
@ -900,13 +912,13 @@ public abstract class Entity {
return entityitem; return entityitem;
} }
public boolean B() { public boolean J() {
return !this.dead; return !this.dead;
} }
public boolean C() { public boolean D() {
int i = MathHelper.b(this.locX); int i = MathHelper.b(this.locX);
int j = MathHelper.b(this.locY + (double) this.w()); int j = MathHelper.b(this.locY + (double) this.p());
int k = MathHelper.b(this.locZ); int k = MathHelper.b(this.locZ);
return this.world.d(i, j, k); return this.world.d(i, j, k);
@ -916,19 +928,19 @@ public abstract class Entity {
return false; return false;
} }
public AxisAlignedBB d(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return null; return null;
} }
public void D() { public void x() {
if (this.vehicle.dead) { if (this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} else { } else {
this.motX = 0.0D; this.motX = 0.0D;
this.motY = 0.0D; this.motY = 0.0D;
this.motZ = 0.0D; this.motZ = 0.0D;
this.b_(); this.f_();
this.vehicle.E(); this.vehicle.h_();
this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw); this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) { for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) {
@ -974,11 +986,11 @@ public abstract class Entity {
} }
} }
public void E() { public void h_() {
this.passenger.a(this.locX, this.locY + this.k() + this.passenger.F(), this.locZ); this.passenger.a(this.locX, this.locY + this.k() + this.passenger.B(), this.locZ);
} }
public double F() { public double B() {
return (double) this.height; return (double) this.height;
} }
@ -986,7 +998,7 @@ public abstract class Entity {
return (double) this.width * 0.75D; return (double) this.width * 0.75D;
} }
public void e(Entity entity) { public void b(Entity entity) {
// CraftBukkit start // CraftBukkit start
setPassengerOf(entity); setPassengerOf(entity);
} }
@ -1001,7 +1013,7 @@ public abstract class Entity {
} }
public void setPassengerOf(Entity entity) { public void setPassengerOf(Entity entity) {
// e(null) doesn't really fly for overloaded methods, // b(null) doesn't really fly for overloaded methods,
// so this method is needed // so this method is needed
// CraftBukkit end // CraftBukkit end
@ -1050,25 +1062,25 @@ public abstract class Entity {
} }
} }
public Vec3D G() { public Vec3D N() {
return null; return null;
} }
public void H() {} public void T() {}
public ItemStack[] I() { public ItemStack[] k_() {
return null; return null;
} }
public boolean J() { public boolean U() {
return this.c(1); return this.d(1);
} }
public void b(boolean flag) { public void b(boolean flag) {
this.a(1, flag); this.a(1, flag);
} }
protected boolean c(int i) { protected boolean d(int i) {
return (this.datawatcher.a(0) & 1 << i) != 0; return (this.datawatcher.a(0) & 1 << i) != 0;
} }

View File

@ -15,11 +15,11 @@ public class EntityArrow extends Entity {
private int d = -1; private int d = -1;
private int e = -1; private int e = -1;
private int f = 0; private int f = 0;
private boolean ak = false; private boolean g = false;
public int a = 0; public int a = 0;
public EntityLiving b; public EntityLiving b;
private int al; private int h;
private int am = 0; private int i = 0;
public EntityArrow(World world) { public EntityArrow(World world) {
super(world); super(world);
@ -37,7 +37,7 @@ public class EntityArrow extends Entity {
super(world); super(world);
this.b = entityliving; this.b = entityliving;
this.a(0.5F, 0.5F); this.a(0.5F, 0.5F);
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -70,11 +70,11 @@ public class EntityArrow extends Entity {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.al = 0; this.h = 0;
} }
public void b_() { public void f_() {
super.b_(); super.f_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) { if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -86,26 +86,26 @@ public class EntityArrow extends Entity {
--this.a; --this.a;
} }
if (this.ak) { if (this.g) {
int i = this.world.getTypeId(this.c, this.d, this.e); int i = this.world.getTypeId(this.c, this.d, this.e);
if (i == this.f) { if (i == this.f) {
++this.al; ++this.h;
if (this.al == 1200) { if (this.h == 1200) {
this.q(); this.C();
} }
return; return;
} }
this.ak = false; this.g = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.al = 0; this.h = 0;
this.am = 0; this.i = 0;
} else { } else {
++this.am; ++this.i;
} }
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
@ -127,7 +127,7 @@ public class EntityArrow extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.c_() && (entity1 != this.b || this.am >= 5)) { if (entity1.d_() && (entity1 != this.b || this.i >= 5)) {
f1 = 0.3F; f1 = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -180,14 +180,14 @@ public class EntityArrow extends Entity {
if (stick) { if (stick) {
// CraftBukkit end // CraftBukkit end
this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.q(); this.C();
} else { } else {
this.motX *= -0.10000000149011612D; this.motX *= -0.10000000149011612D;
this.motY *= -0.10000000149011612D; this.motY *= -0.10000000149011612D;
this.motZ *= -0.10000000149011612D; this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F; this.yaw += 180.0F;
this.lastYaw += 180.0F; this.lastYaw += 180.0F;
this.am = 0; this.i = 0;
} }
} else { } else {
this.c = movingobjectposition.b; this.c = movingobjectposition.b;
@ -202,7 +202,7 @@ public class EntityArrow extends Entity {
this.locY -= this.motY / (double) f2 * 0.05000000074505806D; this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
this.locZ -= this.motZ / (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.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.ak = true; this.g = true;
this.a = 7; this.a = 7;
} }
} }
@ -234,7 +234,7 @@ public class EntityArrow extends Entity {
float f3 = 0.99F; float f3 = 0.99F;
f1 = 0.03F; f1 = 0.03F;
if (this.v()) { if (this.g_()) {
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
float f4 = 0.25F; float f4 = 0.25F;
@ -257,24 +257,24 @@ public class EntityArrow extends Entity {
nbttagcompound.a("zTile", (short) this.e); nbttagcompound.a("zTile", (short) this.e);
nbttagcompound.a("inTile", (byte) this.f); nbttagcompound.a("inTile", (byte) this.f);
nbttagcompound.a("shake", (byte) this.a); nbttagcompound.a("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.ak ? 1 : 0)); nbttagcompound.a("inGround", (byte) (this.g ? 1 : 0));
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.c = nbttagcompound.c("xTile"); this.c = nbttagcompound.d("xTile");
this.d = nbttagcompound.c("yTile"); this.d = nbttagcompound.d("yTile");
this.e = nbttagcompound.c("zTile"); this.e = nbttagcompound.d("zTile");
this.f = nbttagcompound.b("inTile") & 255; this.f = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.b("shake") & 255; this.a = nbttagcompound.c("shake") & 255;
this.ak = nbttagcompound.b("inGround") == 1; this.g = nbttagcompound.c("inGround") == 1;
} }
public void b(EntityHuman entityhuman) { public void b(EntityHuman entityhuman) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (this.ak && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { 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); this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.c(this, 1); entityhuman.b(this, 1);
this.q(); this.C();
} }
} }
} }

View File

@ -24,13 +24,13 @@ public class EntityBoat extends Entity {
private int d; private int d;
private double e; private double e;
private double f; private double f;
private double ak; private double g;
private double al; private double h;
private double am; private double i;
public double maxSpeed = 0.4D; // CraftBukkit public double maxSpeed = 0.4D; // CraftBukkit
// CraftBukkit start // CraftBukkit start
public void c(Entity entity) { public void h(Entity entity) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.VEHICLE_COLLISION_ENTITY; Type eventType = Type.VEHICLE_COLLISION_ENTITY;
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@ -43,7 +43,7 @@ public class EntityBoat extends Entity {
return; return;
} }
super.c(entity); super.h(entity);
} }
// CraftBukkit end // CraftBukkit end
@ -52,23 +52,23 @@ public class EntityBoat extends Entity {
this.a = 0; this.a = 0;
this.b = 0; this.b = 0;
this.c = 1; this.c = 1;
this.i = true; this.aC = true;
this.a(1.5F, 0.6F); this.a(1.5F, 0.6F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
this.M = false; this.bg = false;
} }
protected void a() {} protected void a() {}
public AxisAlignedBB d(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB u() { public AxisAlignedBB d() {
return this.boundingBox; return this.boundingBox;
} }
public boolean z() { public boolean e_() {
return true; return true;
} }
@ -114,7 +114,7 @@ public class EntityBoat extends Entity {
this.c = -this.c; this.c = -this.c;
this.b = 10; this.b = 10;
this.a += i * 10; this.a += i * 10;
this.y(); this.R();
if (this.a > 40) { if (this.a > 40) {
int j; int j;
@ -126,7 +126,7 @@ public class EntityBoat extends Entity {
this.a(Item.STICK.id, 1, 0.0F); this.a(Item.STICK.id, 1, 0.0F);
} }
this.q(); this.C();
} }
return true; return true;
@ -135,11 +135,11 @@ public class EntityBoat extends Entity {
} }
} }
public boolean c_() { public boolean d_() {
return !this.dead; return !this.dead;
} }
public void b_() { public void f_() {
// CraftBukkit start // CraftBukkit start
double prevX = this.locX; double prevX = this.locX;
double prevY = this.locY; double prevY = this.locY;
@ -148,7 +148,7 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch; float prevPitch = this.pitch;
// CraftBukkit end // CraftBukkit end
super.b_(); super.f_();
if (this.b > 0) { if (this.b > 0) {
--this.b; --this.b;
} }
@ -182,9 +182,9 @@ public class EntityBoat extends Entity {
if (this.d > 0) { if (this.d > 0) {
d3 = this.locX + (this.e - this.locX) / (double) this.d; d3 = this.locX + (this.e - this.locX) / (double) this.d;
d4 = this.locY + (this.f - this.locY) / (double) this.d; d4 = this.locY + (this.f - this.locY) / (double) this.d;
d5 = this.locZ + (this.ak - this.locZ) / (double) this.d; d5 = this.locZ + (this.g - this.locZ) / (double) this.d;
for (d6 = this.al - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) { for (d6 = this.h - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) {
; ;
} }
@ -193,10 +193,10 @@ public class EntityBoat extends Entity {
} }
this.yaw = (float) ((double) this.yaw + d6 / (double) this.d); this.yaw = (float) ((double) this.yaw + d6 / (double) this.d);
this.pitch = (float) ((double) this.pitch + (this.am - (double) this.pitch) / (double) this.d); this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
--this.d; --this.d;
this.a(d3, d4, d5); this.a(d3, d4, d5);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
d3 = this.locX + this.motX; d3 = this.locX + this.motX;
d4 = this.locY + this.motY; d4 = this.locY + this.motY;
@ -269,9 +269,9 @@ public class EntityBoat extends Entity {
} }
} }
if (this.B && d5 > 0.15D) { if (this.aV && d5 > 0.15D) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.q(); this.C();
int k; int k;
@ -317,7 +317,7 @@ public class EntityBoat extends Entity {
} }
this.yaw = (float) ((double) this.yaw + d13); this.yaw = (float) ((double) this.yaw + d13);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
@ -338,8 +338,8 @@ public class EntityBoat extends Entity {
for (int l = 0; l < list.size(); ++l) { for (int l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l); Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.z() && entity instanceof EntityBoat) { if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
entity.c((Entity) this); entity.h(this);
} }
} }
} }
@ -350,12 +350,12 @@ public class EntityBoat extends Entity {
} }
} }
public void E() { public void h_() {
if (this.passenger != null) { if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; 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; 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.F(), this.locZ + d1); this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.B(), this.locZ + d1);
} }
} }
@ -382,7 +382,7 @@ public class EntityBoat extends Entity {
} }
// CraftBukkit end // CraftBukkit end
entityhuman.e(this); entityhuman.b((Entity) this);
} }
return true; return true;

View File

@ -18,7 +18,7 @@ public class EntityCreature extends EntityLiving {
super(world); super(world);
} }
protected void d() { protected void c_() {
this.e = false; this.e = false;
float f = 16.0F; float f = 16.0F;
@ -41,7 +41,7 @@ public class EntityCreature extends EntityLiving {
if (this.d != null) { if (this.d != null) {
this.a = this.world.a(this, this.d, f); this.a = this.world.a(this, this.d, f);
} }
} else if (!this.d.B()) { } else if (!this.d.J()) {
// CraftBukkit start // CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
@ -55,9 +55,9 @@ public class EntityCreature extends EntityLiving {
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
float f1 = this.d.a((Entity) this); float f1 = this.d.f(this);
if (this.i(this.d)) { if (this.e(this.d)) {
this.a(this.d, f1); this.a(this.d, f1);
} }
} }
@ -92,8 +92,8 @@ public class EntityCreature extends EntityLiving {
} }
int l1 = MathHelper.b(this.boundingBox.b); int l1 = MathHelper.b(this.boundingBox.b);
boolean flag1 = this.v(); boolean flag1 = this.g_();
boolean flag2 = this.x(); boolean flag2 = this.Q();
this.pitch = 0.0F; this.pitch = 0.0F;
if (this.a != null && this.random.nextInt(100) != 0) { if (this.a != null && this.random.nextInt(100) != 0) {
@ -110,7 +110,7 @@ public class EntityCreature extends EntityLiving {
} }
} }
this.bA = false; this.ax = false;
if (vec3d != null) { if (vec3d != null) {
double d1 = vec3d.a - this.locX; double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ; double d2 = vec3d.c - this.locZ;
@ -118,7 +118,7 @@ public class EntityCreature extends EntityLiving {
float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; // Craftbukkit float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; // Craftbukkit
float f5 = f4 - this.yaw; float f5 = f4 - this.yaw;
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) { for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) {
; ;
} }
@ -142,12 +142,12 @@ public class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F; f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.bx = -MathHelper.a(f5) * this.by * 1.0F; this.au = -MathHelper.a(f5) * this.av * 1.0F;
this.by = MathHelper.b(f5) * this.by * 1.0F; this.av = MathHelper.b(f5) * this.av * 1.0F;
} }
if (d3 > 0.0D) { if (d3 > 0.0D) {
this.bA = true; this.ax = true;
} }
} }
@ -155,15 +155,15 @@ public class EntityCreature extends EntityLiving {
this.b(this.d, 30.0F); this.b(this.d, 30.0F);
} }
if (this.B) { if (this.aV) {
this.bA = true; this.ax = true;
} }
if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) { if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) {
this.bA = true; this.ax = true;
} }
} else { } else {
super.d(); super.c_();
this.a = null; this.a = null;
} }
} }

View File

@ -29,10 +29,10 @@ public class EntityCreeper extends EntityMonster {
super.b(nbttagcompound); super.b(nbttagcompound);
} }
public void b_() { public void f_() {
this.b = this.a; this.b = this.a;
if (this.world.isStatic) { if (this.world.isStatic) {
int i = this.K(); int i = this.r();
if (i > 0 && this.a == 0) { if (i > 0 && this.a == 0) {
this.world.a(this, "random.fuse", 1.0F, 0.5F); this.world.a(this, "random.fuse", 1.0F, 0.5F);
@ -48,7 +48,7 @@ public class EntityCreeper extends EntityMonster {
} }
} }
super.b_(); super.f_();
} }
protected String f() { protected String f() {
@ -59,18 +59,18 @@ public class EntityCreeper extends EntityMonster {
return "mob.creeperdeath"; return "mob.creeperdeath";
} }
public void f(Entity entity) { public void a(Entity entity) {
super.f(entity); super.a(entity);
if (entity instanceof EntitySkeleton) { if (entity instanceof EntitySkeleton) {
this.a(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
} }
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
int i = this.K(); int i = this.r();
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.a(-1); this.e(-1);
--this.a; --this.a;
if (this.a < 0) { if (this.a < 0) {
this.a = 0; this.a = 0;
@ -80,7 +80,7 @@ public class EntityCreeper extends EntityMonster {
this.world.a(this, "random.fuse", 1.0F, 0.5F); this.world.a(this, "random.fuse", 1.0F, 0.5F);
} }
this.a(1); this.e(1);
++this.a; ++this.a;
if (this.a >= 30) { if (this.a >= 30) {
// Craftbukkit start // Craftbukkit start
@ -90,7 +90,7 @@ public class EntityCreeper extends EntityMonster {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if(!event.isCancelled()) {
this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.q(); this.C();
} else { } else {
this.a = 0; this.a = 0;
} }
@ -105,11 +105,11 @@ public class EntityCreeper extends EntityMonster {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
private int K() { private int r() {
return this.datawatcher.a(16); return this.datawatcher.a(16);
} }
private void a(int i) { private void e(int i) {
this.datawatcher.b(16, Byte.valueOf((byte) i)); this.datawatcher.b(16, Byte.valueOf((byte) i));
} }
} }

View File

@ -22,9 +22,9 @@ public class EntityEgg extends Entity {
private int e = 0; private int e = 0;
private boolean f = false; private boolean f = false;
public int a = 0; public int a = 0;
private EntityLiving ak; private EntityLiving g;
private int al; private int h;
private int am = 0; private int i = 0;
public EntityEgg(World world) { public EntityEgg(World world) {
super(world); super(world);
@ -35,9 +35,9 @@ public class EntityEgg extends Entity {
public EntityEgg(World world, EntityLiving entityliving) { public EntityEgg(World world, EntityLiving entityliving) {
super(world); super(world);
this.ak = entityliving; this.g = entityliving;
this.a(0.25F, 0.25F); this.a(0.25F, 0.25F);
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -53,7 +53,7 @@ public class EntityEgg extends Entity {
public EntityEgg(World world, double d0, double d1, double d2) { public EntityEgg(World world, double d0, double d1, double d2) {
super(world); super(world);
this.al = 0; this.h = 0;
this.a(0.25F, 0.25F); this.a(0.25F, 0.25F);
this.a(d0, d1, d2); this.a(d0, d1, d2);
this.height = 0.0F; this.height = 0.0F;
@ -78,14 +78,14 @@ public class EntityEgg extends Entity {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.al = 0; this.h = 0;
} }
public void b_() { public void f_() {
this.O = this.locX; this.bi = this.locX;
this.P = this.locY; this.bj = this.locY;
this.Q = this.locZ; this.bk = this.locZ;
super.b_(); super.f_();
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
} }
@ -94,9 +94,9 @@ public class EntityEgg extends Entity {
int i = this.world.getTypeId(this.b, this.c, this.d); int i = this.world.getTypeId(this.b, this.c, this.d);
if (i == this.e) { if (i == this.e) {
++this.al; ++this.h;
if (this.al == 1200) { if (this.h == 1200) {
this.q(); this.C();
} }
return; return;
@ -106,10 +106,10 @@ public class EntityEgg extends Entity {
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.al = 0; this.h = 0;
this.am = 0; this.i = 0;
} else { } else {
++this.am; ++this.i;
} }
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
@ -130,7 +130,7 @@ public class EntityEgg extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) { if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -157,7 +157,7 @@ public class EntityEgg extends Entity {
boolean stick; boolean stick;
if (movingobjectposition.g instanceof EntityLiving) { if (movingobjectposition.g instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity(); org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
@ -169,13 +169,13 @@ public class EntityEgg extends Entity {
if(!event.isCancelled()) { if(!event.isCancelled()) {
// this function returns if the egg should stick or not, i.e. !bounce // this function returns if the egg should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.ak, event.getDamage()); stick = movingobjectposition.g.a(this.g, event.getDamage());
} else { } else {
// event was cancelled, get if the egg should bounce or not // event was cancelled, get if the egg should bounce or not
stick = !event.getBounce(); stick = !event.getBounce();
} }
} else { } else {
stick = movingobjectposition.g.a(this.ak, 0); stick = movingobjectposition.g.a(this.g, 0);
} }
if (stick) { if (stick) {
@ -190,10 +190,10 @@ public class EntityEgg extends Entity {
} }
MobType hatchingType = MobType.CHICKEN; MobType hatchingType = MobType.CHICKEN;
if (this.ak instanceof EntityPlayer) { if (this.g instanceof EntityPlayer) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.PLAYER_EGG_THROW; Type eventType = Type.PLAYER_EGG_THROW;
Player player = (this.ak == null) ? null : (Player) this.ak.getBukkitEntity(); Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType); PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -246,7 +246,7 @@ public class EntityEgg extends Entity {
// The world we're spawning in accepts this creature // The world we're spawning in accepts this creature
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal; boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
if ((isAnimal && this.world.L) || (!isAnimal && this.world.K)) { if ((isAnimal && this.world.E) || (!isAnimal && this.world.D)) {
entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
this.world.a(entity); this.world.a(entity);
} }
@ -258,7 +258,7 @@ public class EntityEgg extends Entity {
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
} }
this.q(); this.C();
} }
this.locX += this.motX; this.locX += this.motX;
@ -289,7 +289,7 @@ public class EntityEgg extends Entity {
float f2 = 0.99F; float f2 = 0.99F;
float f3 = 0.03F; float f3 = 0.03F;
if (this.v()) { if (this.g_()) {
for (int i1 = 0; i1 < 4; ++i1) { for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F; float f4 = 0.25F;
@ -316,19 +316,19 @@ public class EntityEgg extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.b = nbttagcompound.c("xTile"); this.b = nbttagcompound.d("xTile");
this.c = nbttagcompound.c("yTile"); this.c = nbttagcompound.d("yTile");
this.d = nbttagcompound.c("zTile"); this.d = nbttagcompound.d("zTile");
this.e = nbttagcompound.b("inTile") & 255; this.e = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.b("shake") & 255; this.a = nbttagcompound.c("shake") & 255;
this.f = nbttagcompound.b("inGround") == 1; this.f = nbttagcompound.c("inGround") == 1;
} }
public void b(EntityHuman entityhuman) { public void b(EntityHuman entityhuman) {
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { 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); this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.c(this, 1); entityhuman.b(this, 1);
this.q(); this.C();
} }
} }
} }

View File

@ -15,13 +15,13 @@ public class EntityFireball extends Entity {
private int e = -1; private int e = -1;
private int f = -1; private int f = -1;
private int ak = -1; private int g = -1;
private int al = 0; private int h = 0;
private boolean am = false; private boolean i = false;
public int a = 0; public int a = 0;
private EntityLiving an; private EntityLiving j;
private int ao; private int k;
private int ap = 0; private int l = 0;
public double b; public double b;
public double c; public double c;
public double d; public double d;
@ -35,7 +35,7 @@ public class EntityFireball extends Entity {
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(world); super(world);
this.an = entityliving; this.j = entityliving;
this.a(1.0F, 1.0F); this.a(1.0F, 1.0F);
this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
@ -51,33 +51,33 @@ public class EntityFireball extends Entity {
this.d = d2 / d3 * 0.1D; this.d = d2 / d3 * 0.1D;
} }
public void b_() { public void f_() {
super.b_(); super.f_();
this.fireTicks = 10; this.fireTicks = 10;
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
} }
if (this.am) { if (this.i) {
int i = this.world.getTypeId(this.e, this.f, this.ak); int i = this.world.getTypeId(this.e, this.f, this.g);
if (i == this.al) { if (i == this.h) {
++this.ao; ++this.k;
if (this.ao == 1200) { if (this.k == 1200) {
this.q(); this.C();
} }
return; return;
} }
this.am = false; this.i = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.ao = 0; this.k = 0;
this.ap = 0; this.l = 0;
} else { } else {
++this.ap; ++this.l;
} }
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
@ -97,7 +97,7 @@ public class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.c_() && (entity1 != this.an || this.ap >= 25)) { if (entity1.d_() && (entity1 != this.j || this.l >= 25)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -123,7 +123,7 @@ public class EntityFireball extends Entity {
boolean stick; boolean stick;
if (movingobjectposition.g instanceof EntityLiving) { if (movingobjectposition.g instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity shooter = (this.an == null) ? null : this.an.getBukkitEntity(); org.bukkit.entity.Entity shooter = (this.j == null) ? null : this.j.getBukkitEntity();
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
@ -135,27 +135,27 @@ public class EntityFireball extends Entity {
if(!event.isCancelled()) { if(!event.isCancelled()) {
// this function returns if the fireball should stick or not, i.e. !bounce // this function returns if the fireball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.an, event.getDamage()); stick = movingobjectposition.g.a(this.j, event.getDamage());
} else { } else {
// event was cancelled, get if the fireball should bounce or not // event was cancelled, get if the fireball should bounce or not
stick = !event.getBounce(); stick = !event.getBounce();
} }
} else { } else {
stick = movingobjectposition.g.a(this.an, 0); stick = movingobjectposition.g.a(this.j, 0);
} }
if (stick) { if (stick) {
// CraftBukkit end // CraftBukkit end
; ;
} }
} }
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false); ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if(!event.isCancelled()) {
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.q(); this.C();
} }
// Craftbukkit end // Craftbukkit end
} }
@ -187,7 +187,7 @@ public class EntityFireball extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F; float f2 = 0.95F;
if (this.v()) { if (this.g_()) {
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
float f3 = 0.25F; float f3 = 0.25F;
@ -210,29 +210,29 @@ public class EntityFireball extends Entity {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.e); nbttagcompound.a("xTile", (short) this.e);
nbttagcompound.a("yTile", (short) this.f); nbttagcompound.a("yTile", (short) this.f);
nbttagcompound.a("zTile", (short) this.ak); nbttagcompound.a("zTile", (short) this.g);
nbttagcompound.a("inTile", (byte) this.al); nbttagcompound.a("inTile", (byte) this.h);
nbttagcompound.a("shake", (byte) this.a); nbttagcompound.a("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.am ? 1 : 0)); nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.c("xTile"); this.e = nbttagcompound.d("xTile");
this.f = nbttagcompound.c("yTile"); this.f = nbttagcompound.d("yTile");
this.ak = nbttagcompound.c("zTile"); this.g = nbttagcompound.d("zTile");
this.al = nbttagcompound.b("inTile") & 255; this.h = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.b("shake") & 255; this.a = nbttagcompound.c("shake") & 255;
this.am = nbttagcompound.b("inGround") == 1; this.i = nbttagcompound.c("inGround") == 1;
} }
public boolean c_() { public boolean d_() {
return true; return true;
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
this.y(); this.R();
if (entity != null) { if (entity != null) {
Vec3D vec3d = entity.G(); Vec3D vec3d = entity.N();
if (vec3d != null) { if (vec3d != null) {
this.motX = vec3d.a; this.motX = vec3d.a;

View File

@ -14,20 +14,20 @@ public class EntityFish extends Entity {
private int d = -1; private int d = -1;
private int e = -1; private int e = -1;
private int f = -1; private int f = -1;
private int ak = 0; private int g = 0;
private boolean al = false; private boolean h = false;
public int a = 0; public int a = 0;
public EntityHuman b; public EntityHuman b;
private int am; private int i;
private int an = 0; private int j = 0;
private int ao = 0; private int k = 0;
public Entity c = null; public Entity c = null;
private int ap; private int l;
private double aq; private double m;
private double ar; private double n;
private double as; private double o;
private double at; private double p;
private double au; private double q;
public EntityFish(World world) { public EntityFish(World world) {
super(world); super(world);
@ -74,19 +74,19 @@ public class EntityFish extends Entity {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.am = 0; this.i = 0;
} }
public void b_() { public void f_() {
super.b_(); super.f_();
if (this.ap > 0) { if (this.l > 0) {
double d0 = this.locX + (this.aq - this.locX) / (double) this.ap; double d0 = this.locX + (this.m - this.locX) / (double) this.l;
double d1 = this.locY + (this.ar - this.locY) / (double) this.ap; double d1 = this.locY + (this.n - this.locY) / (double) this.l;
double d2 = this.locZ + (this.as - this.locZ) / (double) this.ap; double d2 = this.locZ + (this.o - this.locZ) / (double) this.l;
double d3; double d3;
for (d3 = this.at - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
; ;
} }
@ -94,18 +94,17 @@ public class EntityFish extends Entity {
d3 -= 360.0D; d3 -= 360.0D;
} }
this.yaw = (float) ((double) this.yaw + d3 / (double) this.ap); this.yaw = (float) ((double) this.yaw + d3 / (double) this.l);
this.pitch = (float) ((double) this.pitch + (this.au - (double) this.pitch) / (double) this.ap); this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l);
--this.ap; --this.l;
this.a(d0, d1, d2); this.a(d0, d1, d2);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
if (!this.world.isStatic) { if (!this.world.isStatic) {
ItemStack itemstack = this.b.P(); ItemStack itemstack = this.b.z();
// CraftBukkit - cast this.b to Entity if (this.b.dead || !this.b.J() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) {
if (this.b.dead || !this.b.B() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.b((Entity) this.b) > 1024.0D) { this.C();
this.q();
this.b.hookedFish = null; this.b.hookedFish = null;
return; return;
} }
@ -126,26 +125,26 @@ public class EntityFish extends Entity {
--this.a; --this.a;
} }
if (this.al) { if (this.h) {
int i = this.world.getTypeId(this.d, this.e, this.f); int i = this.world.getTypeId(this.d, this.e, this.f);
if (i == this.ak) { if (i == this.g) {
++this.am; ++this.i;
if (this.am == 1200) { if (this.i == 1200) {
this.q(); this.C();
} }
return; return;
} }
this.al = false; this.h = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.am = 0; this.i = 0;
this.an = 0; this.j = 0;
} else { } else {
++this.an; ++this.j;
} }
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
@ -167,7 +166,7 @@ public class EntityFish extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.c_() && (entity1 != this.b || this.an >= 5)) { if (entity1.d_() && (entity1 != this.b || this.j >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -214,15 +213,15 @@ public class EntityFish extends Entity {
stick = movingobjectposition.g.a(this.b, 0); stick = movingobjectposition.g.a(this.b, 0);
} }
if (!stick) { if (!stick) {
c = movingobjectposition.g; this.c = movingobjectposition.g;
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
this.al = true; this.h = true;
} }
} }
if (!this.al) { if (!this.h) {
this.c(this.motX, this.motY, this.motZ); this.c(this.motX, this.motY, this.motZ);
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -248,7 +247,7 @@ public class EntityFish extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.92F; float f2 = 0.92F;
if (this.onGround || this.B) { if (this.onGround || this.aV) {
f2 = 0.5F; f2 = 0.5F;
} }
@ -266,10 +265,10 @@ public class EntityFish extends Entity {
} }
if (d6 > 0.0D) { if (d6 > 0.0D) {
if (this.ao > 0) { if (this.k > 0) {
--this.ao; --this.k;
} else if (this.random.nextInt(500) == 0) { } else if (this.random.nextInt(500) == 0) {
this.ao = this.random.nextInt(30) + 10; this.k = this.random.nextInt(30) + 10;
this.motY -= 0.20000000298023224D; this.motY -= 0.20000000298023224D;
this.world.a(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); 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); float f3 = (float) MathHelper.b(this.boundingBox.b);
@ -292,7 +291,7 @@ public class EntityFish extends Entity {
} }
} }
if (this.ao > 0) { if (this.k > 0) {
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D; this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
} }
@ -315,21 +314,21 @@ public class EntityFish extends Entity {
nbttagcompound.a("xTile", (short) this.d); nbttagcompound.a("xTile", (short) this.d);
nbttagcompound.a("yTile", (short) this.e); nbttagcompound.a("yTile", (short) this.e);
nbttagcompound.a("zTile", (short) this.f); nbttagcompound.a("zTile", (short) this.f);
nbttagcompound.a("inTile", (byte) this.ak); nbttagcompound.a("inTile", (byte) this.g);
nbttagcompound.a("shake", (byte) this.a); nbttagcompound.a("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.al ? 1 : 0)); nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0));
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.c("xTile"); this.d = nbttagcompound.d("xTile");
this.e = nbttagcompound.c("yTile"); this.e = nbttagcompound.d("yTile");
this.f = nbttagcompound.c("zTile"); this.f = nbttagcompound.d("zTile");
this.ak = nbttagcompound.b("inTile") & 255; this.g = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.b("shake") & 255; this.a = nbttagcompound.c("shake") & 255;
this.al = nbttagcompound.b("inGround") == 1; this.h = nbttagcompound.c("inGround") == 1;
} }
public int d() { public int h() {
byte b0 = 0; byte b0 = 0;
if (this.c != null) { if (this.c != null) {
@ -343,7 +342,7 @@ public class EntityFish extends Entity {
this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D; this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D;
this.c.motZ += d2 * d4; this.c.motZ += d2 * d4;
b0 = 3; b0 = 3;
} else if (this.ao > 0) { } else if (this.k > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH)); 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 d5 = this.b.locX - this.locX;
double d6 = this.b.locY - this.locY; double d6 = this.b.locY - this.locY;
@ -358,11 +357,11 @@ public class EntityFish extends Entity {
b0 = 1; b0 = 1;
} }
if (this.al) { if (this.h) {
b0 = 2; b0 = 2;
} }
this.q(); this.C();
this.b.hookedFish = null; this.b.hookedFish = null;
return b0; return b0;
} }

View File

@ -18,21 +18,26 @@ public abstract class EntityHuman extends EntityLiving {
public InventoryPlayer inventory = new InventoryPlayer(this); public InventoryPlayer inventory = new InventoryPlayer(this);
public Container defaultContainer; public Container defaultContainer;
public Container activeContainer; public Container activeContainer;
public byte aq = 0; public byte l = 0;
public int ar = 0; public int m = 0;
public float as; public float n;
public float at; public float o;
public boolean au = false; public boolean p = false;
public int av = 0; public int q = 0;
public String name; public String name;
public int dimension; public int dimension;
public double ay; public double t;
public double az; public double u;
public double aA; public double v;
public double aB; public double w;
public double aC; public double x;
public double aD; public double y;
private int a = 0; private boolean sleeping;
private ChunkCoordinates b;
private int sleepTicks;
public float z;
public float A;
private int d = 0;
public EntityFish hookedFish = null; public EntityFish hookedFish = null;
public EntityHuman(World world) { public EntityHuman(World world) {
@ -40,92 +45,121 @@ public abstract class EntityHuman extends EntityLiving {
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic); this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic);
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
this.height = 1.62F; this.height = 1.62F;
this.c((double) world.spawnX + 0.5D, (double) (world.spawnY + 1), (double) world.spawnZ + 0.5D, 0.0F, 0.0F); ChunkCoordinates chunkcoordinates = world.l();
this.c((double) chunkcoordinates.a + 0.5D, (double) (chunkcoordinates.b + 1), (double) chunkcoordinates.c + 0.5D, 0.0F, 0.0F);
this.health = 20; this.health = 20;
this.aS = "humanoid"; this.P = "humanoid";
this.aR = 180.0F; this.O = 180.0F;
this.maxFireTicks = 20; this.maxFireTicks = 20;
this.texture = "/mob/char.png"; this.texture = "/mob/char.png";
} }
public void b_() { protected void a() {
super.b_(); super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
public void f_() {
if (this.E()) {
++this.sleepTicks;
if (this.sleepTicks > 100) {
this.sleepTicks = 100;
}
if (!this.l()) {
this.a(true, true);
} else if (!this.world.isStatic && this.world.c()) {
this.a(false, true);
}
} else if (this.sleepTicks > 0) {
++this.sleepTicks;
if (this.sleepTicks >= 110) {
this.sleepTicks = 0;
}
}
super.f_();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) { if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
this.L(); this.t();
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
this.ay = this.aB; this.t = this.w;
this.az = this.aC; this.u = this.x;
this.aA = this.aD; this.v = this.y;
double d0 = this.locX - this.aB; double d0 = this.locX - this.w;
double d1 = this.locY - this.aC; double d1 = this.locY - this.x;
double d2 = this.locZ - this.aD; double d2 = this.locZ - this.y;
double d3 = 10.0D; double d3 = 10.0D;
if (d0 > d3) { if (d0 > d3) {
this.ay = this.aB = this.locX; this.t = this.w = this.locX;
} }
if (d2 > d3) { if (d2 > d3) {
this.aA = this.aD = this.locZ; this.v = this.y = this.locZ;
} }
if (d1 > d3) { if (d1 > d3) {
this.az = this.aC = this.locY; this.u = this.x = this.locY;
} }
if (d0 < -d3) { if (d0 < -d3) {
this.ay = this.aB = this.locX; this.t = this.w = this.locX;
} }
if (d2 < -d3) { if (d2 < -d3) {
this.aA = this.aD = this.locZ; this.v = this.y = this.locZ;
} }
if (d1 < -d3) { if (d1 < -d3) {
this.az = this.aC = this.locY; this.u = this.x = this.locY;
} }
this.aB += d0 * 0.25D; this.w += d0 * 0.25D;
this.aD += d2 * 0.25D; this.y += d2 * 0.25D;
this.aC += d1 * 0.25D; this.x += d1 * 0.25D;
} }
protected void L() { protected boolean w() {
return this.health <= 0 || this.E();
}
protected void t() {
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
public void D() { public void x() {
super.D(); super.x();
this.as = this.at; this.n = this.o;
this.at = 0.0F; this.o = 0.0F;
} }
protected void d() { protected void c_() {
if (this.au) { if (this.p) {
++this.av; ++this.q;
if (this.av == 8) { if (this.q == 8) {
this.av = 0; this.q = 0;
this.au = false; this.p = false;
} }
} else { } else {
this.av = 0; this.q = 0;
} }
this.aY = (float) this.av / 8.0F; this.V = (float) this.q / 8.0F;
} }
public void o() { public void q() {
if (this.world.k == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) { if (this.world.j == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
this.d(1); this.b(1);
} }
this.inventory.f(); this.inventory.e();
this.as = this.at; this.n = this.o;
super.o(); super.q();
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; // CraftBukkit
if (f > 0.1F) { if (f > 0.1F) {
f = 0.1F; f = 0.1F;
@ -139,8 +173,8 @@ public abstract class EntityHuman extends EntityLiving {
f1 = 0.0F; f1 = 0.0F;
} }
this.at += (f - this.at) * 0.4F; this.o += (f - this.o) * 0.4F;
this.bh += (f1 - this.bh) * 0.8F; this.ae += (f1 - this.ae) * 0.8F;
if (this.health > 0) { if (this.health > 0) {
List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D)); List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D));
@ -149,19 +183,19 @@ public abstract class EntityHuman extends EntityLiving {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
if (!entity.dead) { if (!entity.dead) {
this.j(entity); this.i(entity);
} }
} }
} }
} }
} }
private void j(Entity entity) { private void i(Entity entity) {
entity.b(this); entity.b(this);
} }
public void f(Entity entity) { public void a(Entity entity) {
super.f(entity); super.a(entity);
this.a(0.2F, 0.2F); this.a(0.2F, 0.2F);
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
this.motY = 0.10000000149011612D; this.motY = 0.10000000149011612D;
@ -169,10 +203,10 @@ public abstract class EntityHuman extends EntityLiving {
this.a(new ItemStack(Item.APPLE, 1), true); this.a(new ItemStack(Item.APPLE, 1), true);
} }
this.inventory.h(); this.inventory.g();
if (entity != null) { if (entity != null) {
this.motX = (double) (-MathHelper.b((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F); this.motX = (double) (-MathHelper.b((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motZ = (double) (-MathHelper.a((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F); this.motZ = (double) (-MathHelper.a((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else { } else {
this.motX = this.motZ = 0.0D; this.motX = this.motZ = 0.0D;
} }
@ -180,12 +214,12 @@ public abstract class EntityHuman extends EntityLiving {
this.height = 0.1F; this.height = 0.1F;
} }
public void b(Entity entity, int i) { public void c(Entity entity, int i) {
this.ar += i; this.m += i;
} }
public void O() { public void y() {
this.a(this.inventory.b(this.inventory.c, 1), false); this.a(this.inventory.a(this.inventory.c, 1), false);
} }
public void b(ItemStack itemstack) { public void b(ItemStack itemstack) {
@ -194,7 +228,7 @@ public abstract class EntityHuman extends EntityLiving {
public void a(ItemStack itemstack, boolean flag) { public void a(ItemStack itemstack, boolean flag) {
if (itemstack != null) { if (itemstack != null) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.w(), this.locZ, itemstack); EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.p(), this.locZ, itemstack);
entityitem.c = 40; entityitem.c = 40;
float f = 0.1F; float f = 0.1F;
@ -264,43 +298,59 @@ public abstract class EntityHuman extends EntityLiving {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Inventory"); NBTTagList nbttaglist = nbttagcompound.l("Inventory");
this.inventory.b(nbttaglist); this.inventory.b(nbttaglist);
this.dimension = nbttagcompound.d("Dimension"); this.dimension = nbttagcompound.e("Dimension");
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.a(true, true);
}
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList())); nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList()));
nbttagcompound.a("Dimension", this.dimension); nbttagcompound.a("Dimension", this.dimension);
nbttagcompound.a("Sleeping", this.sleeping);
nbttagcompound.a("SleepTimer", (short) this.sleepTicks);
} }
public void a(IInventory iinventory) {} public void a(IInventory iinventory) {}
public void a(int i, int j, int k) {} public void b(int i, int j, int k) {}
public void c(Entity entity, int i) {} public void b(Entity entity, int i) {}
public float w() { public float p() {
return 0.12F; return 0.12F;
} }
protected void l_() {
this.height = 1.62F;
}
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
this.bw = 0; this.at = 0;
if (this.health <= 0) { if (this.health <= 0) {
return false; return false;
} else { } else {
if (this.E()) {
this.a(true, true);
}
if (entity instanceof EntityMonster || entity instanceof EntityArrow) { if (entity instanceof EntityMonster || entity instanceof EntityArrow) {
if (this.world.k == 0) { if (this.world.j == 0) {
i = 0; i = 0;
} }
if (this.world.k == 1) { if (this.world.j == 1) {
i = i / 3 + 1; i = i / 3 + 1;
} }
if (this.world.k == 3) { if (this.world.j == 3) {
i = i * 3 / 2; i = i * 3 / 2;
} }
} }
@ -309,14 +359,14 @@ public abstract class EntityHuman extends EntityLiving {
} }
} }
protected void e(int i) { protected void c(int i) {
int j = 25 - this.inventory.g(); int j = 25 - this.inventory.f();
int k = i * j + this.a; int k = i * j + this.d;
this.inventory.c(i); this.inventory.c(i);
i = k / 25; i = k / 25;
this.a = k % 25; this.d = k % 25;
super.e(i); super.c(i);
} }
public void a(TileEntityFurnace tileentityfurnace) {} public void a(TileEntityFurnace tileentityfurnace) {}
@ -325,43 +375,43 @@ public abstract class EntityHuman extends EntityLiving {
public void a(TileEntitySign tileentitysign) {} public void a(TileEntitySign tileentitysign) {}
public void g(Entity entity) { public void c(Entity entity) {
if (!entity.a(this)) { if (!entity.a(this)) {
ItemStack itemstack = this.P(); ItemStack itemstack = this.z();
if (itemstack != null && entity instanceof EntityLiving) { if (itemstack != null && entity instanceof EntityLiving) {
itemstack.b((EntityLiving) entity); itemstack.b((EntityLiving) entity);
if (itemstack.count <= 0) { if (itemstack.count <= 0) {
itemstack.a(this); itemstack.a(this);
this.Q(); this.A();
} }
} }
} }
} }
public ItemStack P() { public ItemStack z() {
return this.inventory.e(); return this.inventory.b();
} }
public void Q() { public void A() {
this.inventory.a(this.inventory.c, (ItemStack) null); this.inventory.a(this.inventory.c, (ItemStack) null);
} }
public double F() { public double B() {
return (double) (this.height - 0.5F); return (double) (this.height - 0.5F);
} }
public void K() { public void r() {
this.av = -1; this.q = -1;
this.au = true; this.p = true;
} }
public void h(Entity entity) { public void d(Entity entity) {
int i = this.inventory.a(entity); int i = this.inventory.a(entity);
if (i > 0) { if (i > 0) {
// CraftBukkit start // CraftBukkit start
if(entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damager = this.getBukkitEntity(); org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
@ -381,13 +431,13 @@ public abstract class EntityHuman extends EntityLiving {
} }
// CraftBukkit end // CraftBukkit end
ItemStack itemstack = this.P(); ItemStack itemstack = this.z();
if (itemstack != null && entity instanceof EntityLiving) { if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity); itemstack.a((EntityLiving) entity);
if (itemstack.count <= 0) { if (itemstack.count <= 0) {
itemstack.a(this); itemstack.a(this);
this.Q(); this.A();
} }
} }
} }
@ -395,11 +445,129 @@ public abstract class EntityHuman extends EntityLiving {
public void a(ItemStack itemstack) {} public void a(ItemStack itemstack) {}
public void q() { public void C() {
super.q(); super.C();
this.defaultContainer.a(this); this.defaultContainer.a(this);
if (this.activeContainer != null) { if (this.activeContainer != null) {
this.activeContainer.a(this); this.activeContainer.a(this);
} }
} }
public boolean D() {
return !this.sleeping && super.D();
}
public boolean a(int i, int j, int k) {
if (!this.E() && this.J()) {
if (this.world.m.c) {
return false;
} else if (this.world.c()) {
return false;
} else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) {
this.a(0.2F, 0.2F);
this.height = 0.2F;
if (this.world.f(i, j, k)) {
int l = this.world.getData(i, j, k);
int i1 = BlockBed.c(l);
float f = 0.5F;
float f1 = 0.5F;
switch (i1) {
case 0:
f1 = 0.9F;
break;
case 1:
f = 0.1F;
break;
case 2:
f1 = 0.1F;
break;
case 3:
f = 0.9F;
}
this.e(i1);
this.a((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.sleeping = true;
this.sleepTicks = 0;
this.b = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.o();
}
return true;
} else {
return false;
}
} else {
return false;
}
}
private void e(int i) {
this.z = 0.0F;
this.A = 0.0F;
switch (i) {
case 0:
this.A = -1.8F;
break;
case 1:
this.z = 1.8F;
break;
case 2:
this.A = 1.8F;
break;
case 3:
this.z = -1.8F;
}
}
public void a(boolean flag, boolean flag1) {
this.a(0.6F, 1.8F);
this.l_();
ChunkCoordinates chunkcoordinates = 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);
ChunkCoordinates chunkcoordinates1 = BlockBed.g(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0);
this.a((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + this.height + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F));
}
this.sleeping = false;
if (!this.world.isStatic && flag1) {
this.world.o();
}
if (flag) {
this.sleepTicks = 0;
} else {
this.sleepTicks = 100;
}
}
private boolean l() {
return this.world.getTypeId(this.b.a, this.b.b, this.b.c) == Block.BED.id;
}
public boolean E() {
return this.sleeping;
}
public boolean F() {
return this.sleeping && this.sleepTicks >= 100;
}
public void a(String s) {}
} }

View File

@ -25,7 +25,7 @@ public class EntityItem extends Entity {
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
this.motY = 0.20000000298023224D; this.motY = 0.20000000298023224D;
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
this.M = false; this.bg = false;
} }
public EntityItem(World world) { public EntityItem(World world) {
@ -36,8 +36,8 @@ public class EntityItem extends Entity {
protected void a() {} protected void a() {}
public void b_() { public void f_() {
super.b_(); super.f_();
if (this.c > 0) { if (this.c > 0) {
--this.c; --this.c;
} }
@ -76,11 +76,11 @@ public class EntityItem extends Entity {
++this.e; ++this.e;
++this.b; ++this.b;
if (this.b >= 6000) { if (this.b >= 6000) {
this.q(); this.C();
} }
} }
public boolean v() { public boolean g_() {
return this.world.a(this.boundingBox, Material.WATER, this); return this.world.a(this.boundingBox, Material.WATER, this);
} }
@ -162,15 +162,15 @@ public class EntityItem extends Entity {
return false; return false;
} }
protected void b(int i) { protected void a(int i) {
this.a((Entity) null, i); this.a((Entity) null, i);
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
this.y(); this.R();
this.f -= i; this.f -= i;
if (this.f <= 0) { if (this.f <= 0) {
this.q(); this.C();
} }
return false; return false;
@ -183,9 +183,9 @@ public class EntityItem extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.c("Health") & 255; this.f = nbttagcompound.d("Health") & 255;
this.b = nbttagcompound.c("Age"); this.b = nbttagcompound.d("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item"); NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item");
this.a = new ItemStack(nbttagcompound1); this.a = new ItemStack(nbttagcompound1);
} }
@ -203,7 +203,7 @@ public class EntityItem extends Entity {
if (!event.isCancelled() && entityhuman.inventory.a(this.a)) { 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); this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.c(this, i); entityhuman.c(this, i);
this.q(); this.C();
} }
} }
// CraftBukkit end // CraftBukkit end

View File

@ -1,9 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.ArrayList;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import java.util.ArrayList;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
@ -18,84 +18,84 @@ import org.bukkit.event.entity.EntityDeathEvent;
public abstract class EntityLiving extends Entity { public abstract class EntityLiving extends Entity {
public int maxNoDamageTicks = 20; public int maxNoDamageTicks = 20;
public float aG; public float D;
public float aH; public float E;
public float aI = 0.0F; public float F = 0.0F;
public float aJ = 0.0F; public float G = 0.0F;
protected float aK; protected float H;
protected float aL; protected float I;
protected float aM; protected float J;
protected float aN; protected float K;
protected boolean aO = true; protected boolean L = true;
protected String texture = "/mob/char.png"; protected String texture = "/mob/char.png";
protected boolean aQ = true; protected boolean N = true;
protected float aR = 0.0F; protected float O = 0.0F;
protected String aS = null; protected String P = null;
protected float aT = 1.0F; protected float Q = 1.0F;
protected int aU = 0; protected int R = 0;
protected float aV = 0.0F; protected float S = 0.0F;
public boolean aW = false; public boolean T = false;
public float aX; public float U;
public float aY; public float V;
public int health = 10; public int health = 10;
public int ba; public int X;
private int a; private int a;
public int hurtTicks; public int hurtTicks;
public int bc; public int Z;
public float bd = 0.0F; public float aa = 0.0F;
public int deathTicks = 0; public int deathTicks = 0;
public int attackTicks = 0; public int attackTicks = 0;
public float bg; public float ad;
public float bh; public float ae;
protected boolean bi = false; protected boolean af = false;
public int bj = -1; public int ag = -1;
public float bk = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D); public float ah = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float bl; public float ai;
public float bm; public float aj;
public float bn; public float ak;
protected int bo; protected int al;
protected double bp; protected double am;
protected double bq; protected double an;
protected double br; protected double ao;
protected double bs; protected double ap;
protected double bt; protected double aq;
float bu = 0.0F; float ar = 0.0F;
protected int lastDamage = 0; protected int lastDamage = 0;
protected int bw = 0; protected int at = 0;
protected float bx; protected float au;
protected float by; protected float av;
protected float bz; protected float aw;
protected boolean bA = false; protected boolean ax = false;
protected float bB = 0.0F; protected float ay = 0.0F;
protected float bC = 0.7F; protected float az = 0.7F;
private Entity b; private Entity b;
private int c = 0; private int c = 0;
public EntityLiving(World world) { public EntityLiving(World world) {
super(world); super(world);
this.i = true; this.aC = true;
this.aH = (float) (Math.random() + 1.0D) * 0.01F; this.E = (float) (Math.random() + 1.0D) * 0.01F;
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
this.aG = (float) Math.random() * 12398.0F; this.D = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D); this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.S = 0.5F; this.bm = 0.5F;
} }
protected void a() {} protected void a() {}
public boolean i(Entity entity) { public boolean e(Entity entity) {
return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.w(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.w(), entity.locZ)) == null; return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.p(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.p(), entity.locZ)) == null;
} }
public boolean c_() { public boolean d_() {
return !this.dead; return !this.dead;
} }
public boolean z() { public boolean e_() {
return !this.dead; return !this.dead;
} }
public float w() { public float p() {
return this.width * 0.85F; return this.width * 0.85F;
} }
@ -103,19 +103,23 @@ public abstract class EntityLiving extends Entity {
return 80; return 80;
} }
public void r() { public void G() {
this.aX = this.aY; String s = this.e();
super.r();
if (s != null) {
this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
public void H() {
this.U = this.V;
super.H();
if (this.random.nextInt(1000) < this.a++) { if (this.random.nextInt(1000) < this.a++) {
this.a = -this.c(); this.a = -this.c();
String s = this.e(); this.G();
if (s != null) {
this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
} }
if (this.B() && this.C()) { if (this.J() && this.D()) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity victim = this.getBukkitEntity(); org.bukkit.entity.Entity victim = this.getBukkitEntity();
@ -129,13 +133,13 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end // CraftBukkit end
} }
if (this.ae || this.world.isStatic) { if (this.by || this.world.isStatic) {
this.fireTicks = 0; this.fireTicks = 0;
} }
int i; int i;
if (this.B() && this.a(Material.WATER) && !this.d_()) { if (this.J() && this.a(Material.WATER) && !this.b_()) {
--this.airTicks; --this.airTicks;
if (this.airTicks == -20) { if (this.airTicks == -20) {
this.airTicks = 0; this.airTicks = 0;
@ -168,7 +172,7 @@ public abstract class EntityLiving extends Entity {
this.airTicks = this.maxAirTicks; this.airTicks = this.maxAirTicks;
} }
this.bg = this.bh; this.ad = this.ae;
if (this.attackTicks > 0) { if (this.attackTicks > 0) {
--this.attackTicks; --this.attackTicks;
} }
@ -184,8 +188,8 @@ public abstract class EntityLiving extends Entity {
if (this.health <= 0) { if (this.health <= 0) {
++this.deathTicks; ++this.deathTicks;
if (this.deathTicks > 20) { if (this.deathTicks > 20) {
this.T(); this.L();
this.q(); this.C();
for (i = 0; i < 20; ++i) { for (i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D; double d0 = this.random.nextGaussian() * 0.02D;
@ -197,13 +201,13 @@ public abstract class EntityLiving extends Entity {
} }
} }
this.aN = this.aM; this.K = this.J;
this.aJ = this.aI; this.G = this.F;
this.lastYaw = this.yaw; this.lastYaw = this.yaw;
this.lastPitch = this.pitch; this.lastPitch = this.pitch;
} }
public void R() { public void I() {
for (int i = 0; i < 20; ++i) { for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D; double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
@ -214,22 +218,22 @@ public abstract class EntityLiving extends Entity {
} }
} }
public void D() { public void x() {
super.D(); super.x();
this.aK = this.aL; this.H = this.I;
this.aL = 0.0F; this.I = 0.0F;
} }
public void b_() { public void f_() {
super.b_(); super.f_();
this.o(); this.q();
double d0 = this.locX - this.lastX; double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
float f = MathHelper.a(d0 * d0 + d1 * d1); float f = MathHelper.a(d0 * d0 + d1 * d1);
float f1 = this.aI; float f1 = this.F;
float f2 = 0.0F; float f2 = 0.0F;
this.aK = this.aL; this.H = this.I;
float f3 = 0.0F; float f3 = 0.0F;
if (f > 0.05F) { if (f > 0.05F) {
@ -238,7 +242,7 @@ public abstract class EntityLiving extends Entity {
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit
} }
if (this.aY > 0.0F) { if (this.V > 0.0F) {
f1 = this.yaw; f1 = this.yaw;
} }
@ -246,11 +250,11 @@ public abstract class EntityLiving extends Entity {
f3 = 0.0F; f3 = 0.0F;
} }
this.aL += (f3 - this.aL) * 0.3F; this.I += (f3 - this.I) * 0.3F;
float f4; float f4;
for (f4 = f1 - this.aI; f4 < -180.0F; f4 += 360.0F) { for (f4 = f1 - this.F; f4 < -180.0F; f4 += 360.0F) {
; ;
} }
@ -258,11 +262,11 @@ public abstract class EntityLiving extends Entity {
f4 -= 360.0F; f4 -= 360.0F;
} }
this.aI += f4 * 0.3F; this.F += f4 * 0.3F;
float f5; float f5;
for (f5 = this.yaw - this.aI; f5 < -180.0F; f5 += 360.0F) { for (f5 = this.yaw - this.F; f5 < -180.0F; f5 += 360.0F) {
; ;
} }
@ -280,9 +284,9 @@ public abstract class EntityLiving extends Entity {
f5 = 75.0F; f5 = 75.0F;
} }
this.aI = this.yaw - f5; this.F = this.yaw - f5;
if (f5 * f5 > 2500.0F) { if (f5 * f5 > 2500.0F) {
this.aI += f5 * 0.2F; this.F += f5 * 0.2F;
} }
if (flag) { if (flag) {
@ -297,12 +301,12 @@ public abstract class EntityLiving extends Entity {
this.lastYaw += 360.0F; this.lastYaw += 360.0F;
} }
while (this.aI - this.aJ < -180.0F) { while (this.F - this.G < -180.0F) {
this.aJ -= 360.0F; this.G -= 360.0F;
} }
while (this.aI - this.aJ >= 180.0F) { while (this.F - this.G >= 180.0F) {
this.aJ += 360.0F; this.G += 360.0F;
} }
while (this.pitch - this.lastPitch < -180.0F) { while (this.pitch - this.lastPitch < -180.0F) {
@ -313,14 +317,14 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F; this.lastPitch += 360.0F;
} }
this.aM += f2; this.J += f2;
} }
protected void a(float f, float f1) { protected void a(float f, float f1) {
super.a(f, f1); super.a(f, f1);
} }
public void d(int i) { public void b(int i) {
if (this.health > 0) { if (this.health > 0) {
this.health += i; this.health += i;
if (this.health > 20) { if (this.health > 20) {
@ -335,11 +339,11 @@ public abstract class EntityLiving extends Entity {
if (this.world.isStatic) { if (this.world.isStatic) {
return false; return false;
} else { } else {
this.bw = 0; this.at = 0;
if (this.health <= 0) { if (this.health <= 0) {
return false; return false;
} else { } else {
this.bm = 1.5F; this.aj = 1.5F;
boolean flag = true; boolean flag = true;
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
@ -347,21 +351,21 @@ public abstract class EntityLiving extends Entity {
return false; return false;
} }
this.e(i - this.lastDamage); this.c(i - this.lastDamage);
this.lastDamage = i; this.lastDamage = i;
flag = false; flag = false;
} else { } else {
this.lastDamage = i; this.lastDamage = i;
this.ba = this.health; this.X = this.health;
this.noDamageTicks = this.maxNoDamageTicks; this.noDamageTicks = this.maxNoDamageTicks;
this.e(i); this.c(i);
this.hurtTicks = this.bc = 10; this.hurtTicks = this.Z = 10;
} }
this.bd = 0.0F; this.aa = 0.0F;
if (flag) { if (flag) {
this.world.a(this, (byte) 2); this.world.a(this, (byte) 2);
this.y(); this.R();
if (entity != null) { if (entity != null) {
double d0 = entity.locX - this.locX; double d0 = entity.locX - this.locX;
@ -371,10 +375,10 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D; d0 = (Math.random() - Math.random()) * 0.01D;
} }
this.bd = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw; this.aa = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.a(entity, i, d0, d1); this.a(entity, i, d0, d1);
} else { } else {
this.bd = (float) ((int) (Math.random() * 2.0D) * 180); this.aa = (float) ((int) (Math.random() * 2.0D) * 180);
} }
} }
@ -383,7 +387,7 @@ public abstract class EntityLiving extends Entity {
this.world.a(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.a(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
this.f(entity); this.a(entity);
} else if (flag) { } else if (flag) {
this.world.a(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.a(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
@ -393,7 +397,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
protected void e(int i) { protected void c(int i) {
this.health -= i; this.health -= i;
} }
@ -428,20 +432,20 @@ public abstract class EntityLiving extends Entity {
} }
} }
public void f(Entity entity) { public void a(Entity entity) {
if (this.aU > 0 && entity != null) { if (this.R > 0 && entity != null) {
entity.b(this, this.aU); entity.c(this, this.R);
} }
this.bi = true; this.af = true;
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.g_(); this.o();
} }
this.world.a(this, (byte) 3); this.world.a(this, (byte) 3);
} }
protected void g_() { protected void o() {
// Craftbukkit start - whole method // Craftbukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
int drop = this.h(); int drop = this.h();
@ -493,10 +497,10 @@ public abstract class EntityLiving extends Entity {
} }
} }
public void c(float f, float f1) { public void b(float f, float f1) {
double d0; double d0;
if (this.v()) { if (this.g_()) {
d0 = this.locY; d0 = this.locY;
this.a(f, f1, 0.02F); this.a(f, f1, 0.02F);
this.c(this.motX, this.motY, this.motZ); this.c(this.motX, this.motY, this.motZ);
@ -504,10 +508,10 @@ public abstract class EntityLiving extends Entity {
this.motY *= 0.800000011920929D; this.motY *= 0.800000011920929D;
this.motZ *= 0.800000011920929D; this.motZ *= 0.800000011920929D;
this.motY -= 0.02D; this.motY -= 0.02D;
if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D; this.motY = 0.30000001192092896D;
} }
} else if (this.x()) { } else if (this.Q()) {
d0 = this.locY; d0 = this.locY;
this.a(f, f1, 0.02F); this.a(f, f1, 0.02F);
this.c(this.motX, this.motY, this.motZ); this.c(this.motX, this.motY, this.motZ);
@ -515,7 +519,7 @@ public abstract class EntityLiving extends Entity {
this.motY *= 0.5D; this.motY *= 0.5D;
this.motZ *= 0.5D; this.motZ *= 0.5D;
this.motY -= 0.02D; this.motY -= 0.02D;
if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D; this.motY = 0.30000001192092896D;
} }
} else { } else {
@ -551,7 +555,7 @@ public abstract class EntityLiving extends Entity {
} }
this.c(this.motX, this.motY, this.motZ); this.c(this.motX, this.motY, this.motZ);
if (this.B && this.m()) { if (this.aV && this.m()) {
this.motY = 0.2D; this.motY = 0.2D;
} }
@ -561,7 +565,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2; this.motZ *= (double) f2;
} }
this.bl = this.bm; this.ai = this.aj;
d0 = this.locX - this.lastX; d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F; float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F;
@ -570,8 +574,8 @@ public abstract class EntityLiving extends Entity {
f4 = 1.0F; f4 = 1.0F;
} }
this.bm += (f4 - this.bm) * 0.4F; this.aj += (f4 - this.aj) * 0.4F;
this.bn += this.bm; this.ak += this.aj;
} }
public boolean m() { public boolean m() {
@ -590,33 +594,33 @@ public abstract class EntityLiving extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.health = nbttagcompound.c("Health"); this.health = nbttagcompound.d("Health");
if (!nbttagcompound.a("Health")) { if (!nbttagcompound.b("Health")) {
this.health = 10; this.health = 10;
} }
this.hurtTicks = nbttagcompound.c("HurtTime"); this.hurtTicks = nbttagcompound.d("HurtTime");
this.deathTicks = nbttagcompound.c("DeathTime"); this.deathTicks = nbttagcompound.d("DeathTime");
this.attackTicks = nbttagcompound.c("AttackTime"); this.attackTicks = nbttagcompound.d("AttackTime");
} }
public boolean B() { public boolean J() {
return !this.dead && this.health > 0; return !this.dead && this.health > 0;
} }
public boolean d_() { public boolean b_() {
return false; return false;
} }
public void o() { public void q() {
if (this.bo > 0) { if (this.al > 0) {
double d0 = this.locX + (this.bp - this.locX) / (double) this.bo; double d0 = this.locX + (this.am - this.locX) / (double) this.al;
double d1 = this.locY + (this.bq - this.locY) / (double) this.bo; double d1 = this.locY + (this.an - this.locY) / (double) this.al;
double d2 = this.locZ + (this.br - this.locZ) / (double) this.bo; double d2 = this.locZ + (this.ao - this.locZ) / (double) this.al;
double d3; double d3;
for (d3 = this.bs - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { for (d3 = this.ap - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
; ;
} }
@ -624,58 +628,62 @@ public abstract class EntityLiving extends Entity {
d3 -= 360.0D; d3 -= 360.0D;
} }
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bo); this.yaw = (float) ((double) this.yaw + d3 / (double) this.al);
this.pitch = (float) ((double) this.pitch + (this.bt - (double) this.pitch) / (double) this.bo); this.pitch = (float) ((double) this.pitch + (this.aq - (double) this.pitch) / (double) this.al);
--this.bo; --this.al;
this.a(d0, d1, d2); this.a(d0, d1, d2);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} }
if (this.health <= 0) { if (this.w()) {
this.bA = false; this.ax = false;
this.bx = 0.0F; this.au = 0.0F;
this.by = 0.0F; this.av = 0.0F;
this.bz = 0.0F; this.aw = 0.0F;
} else if (!this.aW) { } else if (!this.T) {
this.d(); this.c_();
} }
boolean flag = this.v(); boolean flag = this.g_();
boolean flag1 = this.x(); boolean flag1 = this.Q();
if (this.bA) { if (this.ax) {
if (flag) { if (flag) {
this.motY += 0.03999999910593033D; this.motY += 0.03999999910593033D;
} else if (flag1) { } else if (flag1) {
this.motY += 0.03999999910593033D; this.motY += 0.03999999910593033D;
} else if (this.onGround) { } else if (this.onGround) {
this.S(); this.K();
} }
} }
this.bx *= 0.98F; this.au *= 0.98F;
this.by *= 0.98F; this.av *= 0.98F;
this.bz *= 0.9F; this.aw *= 0.9F;
this.c(this.bx, this.by); this.b(this.au, this.av);
List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
if (entity.z()) { if (entity.e_()) {
entity.c((Entity) this); entity.h(this);
} }
} }
} }
} }
protected void S() { protected boolean w() {
return this.health <= 0;
}
protected void K() {
this.motY = 0.41999998688697815D; this.motY = 0.41999998688697815D;
} }
protected void d() { protected void c_() {
++this.bw; ++this.at;
EntityHuman entityhuman = this.world.a(this, -1.0D); EntityHuman entityhuman = this.world.a(this, -1.0D);
if (entityhuman != null) { if (entityhuman != null) {
@ -685,20 +693,20 @@ public abstract class EntityLiving extends Entity {
double d3 = d0 * d0 + d1 * d1 + d2 * d2; double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 16384.0D) { if (d3 > 16384.0D) {
this.q(); this.C();
} }
if (this.bw > 600 && this.random.nextInt(800) == 0) { if (this.at > 600 && this.random.nextInt(800) == 0) {
if (d3 < 1024.0D) { if (d3 < 1024.0D) {
this.bw = 0; this.at = 0;
} else { } else {
this.q(); this.C();
} }
} }
} }
this.bx = 0.0F; this.au = 0.0F;
this.by = 0.0F; this.av = 0.0F;
float f = 8.0F; float f = 8.0F;
if (this.random.nextFloat() < 0.02F) { if (this.random.nextFloat() < 0.02F) {
@ -707,29 +715,29 @@ public abstract class EntityLiving extends Entity {
this.b = entityhuman; this.b = entityhuman;
this.c = 10 + this.random.nextInt(20); this.c = 10 + this.random.nextInt(20);
} else { } else {
this.bz = (this.random.nextFloat() - 0.5F) * 20.0F; this.aw = (this.random.nextFloat() - 0.5F) * 20.0F;
} }
} }
if (this.b != null) { if (this.b != null) {
this.b(this.b, 10.0F); this.b(this.b, 10.0F);
if (this.c-- <= 0 || this.b.dead || this.b.b((Entity) this) > (double) (f * f)) { if (this.c-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) {
this.b = null; this.b = null;
} }
} else { } else {
if (this.random.nextFloat() < 0.05F) { if (this.random.nextFloat() < 0.05F) {
this.bz = (this.random.nextFloat() - 0.5F) * 20.0F; this.aw = (this.random.nextFloat() - 0.5F) * 20.0F;
} }
this.yaw += this.bz; this.yaw += this.aw;
this.pitch = this.bB; this.pitch = this.ay;
} }
boolean flag = this.v(); boolean flag = this.g_();
boolean flag1 = this.x(); boolean flag1 = this.Q();
if (flag || flag1) { if (flag || flag1) {
this.bA = this.random.nextFloat() < 0.8F; this.ax = this.random.nextFloat() < 0.8F;
} }
} }
@ -741,9 +749,9 @@ public abstract class EntityLiving extends Entity {
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity; EntityLiving entityliving = (EntityLiving) entity;
d2 = entityliving.locY + (double) entityliving.w() - (this.locY + (double) this.w()); d2 = entityliving.locY + (double) entityliving.p() - (this.locY + (double) this.p());
} else { } else {
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.w()); d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.p());
} }
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1); double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1);
@ -776,21 +784,21 @@ public abstract class EntityLiving extends Entity {
return f + f3; return f + f3;
} }
public void T() {} public void L() {}
public boolean b() { 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.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
} }
protected void t() { protected void M() {
this.a((Entity) null, 4); this.a((Entity) null, 4);
} }
public Vec3D G() { public Vec3D N() {
return this.c(1.0F); return this.b(1.0F);
} }
public Vec3D c(float f) { public Vec3D b(float f) {
float f1; float f1;
float f2; float f2;
float f3; float f3;
@ -817,4 +825,8 @@ public abstract class EntityLiving extends Entity {
public int j() { public int j() {
return 4; return 4;
} }
public boolean E() {
return false;
}
} }

View File

@ -13,22 +13,22 @@ import org.bukkit.event.vehicle.*;
public class EntityMinecart extends Entity implements IInventory { public class EntityMinecart extends Entity implements IInventory {
private ItemStack[] al; private ItemStack[] h;
public int a; public int a;
public int b; public int b;
public int c; public int c;
private boolean am; private boolean i;
public int d; public int d;
public int e; public int e;
public double f; public double f;
public double ak; public double g;
private static final int[][][] an = 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[][][] 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 int ao; private int k;
private double ap; private double l;
private double aq; private double m;
private double ar; private double n;
private double as; private double o;
private double at; private double p;
// CraftBukkit start // CraftBukkit start
public boolean slowWhenEmpty = true; public boolean slowWhenEmpty = true;
@ -41,21 +41,21 @@ public class EntityMinecart extends Entity implements IInventory {
public double maxSpeed = 0.4D; public double maxSpeed = 0.4D;
public ItemStack[] getContents() { public ItemStack[] getContents() {
return this.al; return this.h;
} }
// CraftBukkit end // CraftBukkit end
public EntityMinecart(World world) { public EntityMinecart(World world) {
super(world); super(world);
this.al = new ItemStack[27]; //Craftbukkit this.h = new ItemStack[27]; //Craftbukkit
this.a = 0; this.a = 0;
this.b = 0; this.b = 0;
this.c = 1; this.c = 1;
this.am = false; this.i = false;
this.i = true; this.aC = true;
this.a(0.98F, 0.7F); this.a(0.98F, 0.7F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
this.M = false; this.bg = false;
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
@ -69,15 +69,15 @@ public class EntityMinecart extends Entity implements IInventory {
protected void a() {} protected void a() {}
public AxisAlignedBB d(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB u() { public AxisAlignedBB d() {
return null; return null;
} }
public boolean z() { public boolean e_() {
return true; return true;
} }
@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.c = -this.c; this.c = -this.c;
this.b = 10; this.b = 10;
this.y(); this.R();
this.a += i * 10; this.a += i * 10;
if (this.a > 40) { if (this.a > 40) {
this.a(Item.MINECART.id, 1, 0.0F); this.a(Item.MINECART.id, 1, 0.0F);
@ -126,7 +126,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.a(Block.FURNACE.id, 1, 0.0F); this.a(Block.FURNACE.id, 1, 0.0F);
} }
this.q(); this.C();
} }
return true; return true;
@ -135,13 +135,13 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
public boolean c_() { public boolean d_() {
return !this.dead; return !this.dead;
} }
public void q() { public void C() {
for (int i = 0; i < this.h_(); ++i) { for (int i = 0; i < this.m_(); ++i) {
ItemStack itemstack = this.a(i); ItemStack itemstack = this.c_(i);
if (itemstack != null) { if (itemstack != null) {
float f = this.random.nextFloat() * 0.8F + 0.1F; float f = this.random.nextFloat() * 0.8F + 0.1F;
@ -167,10 +167,10 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
super.q(); super.C();
} }
public void b_() { public void f_() {
// CraftBukkit start // CraftBukkit start
double prevX = this.locX; double prevX = this.locX;
double prevY = this.locY; double prevY = this.locY;
@ -189,13 +189,13 @@ public class EntityMinecart extends Entity implements IInventory {
double d0; double d0;
if (this.world.isStatic && this.ao > 0) { if (this.world.isStatic && this.k > 0) {
if (this.ao > 0) { if (this.k > 0) {
double d1 = this.locX + (this.ap - this.locX) / (double) this.ao; double d1 = this.locX + (this.l - this.locX) / (double) this.k;
double d2 = this.locY + (this.aq - this.locY) / (double) this.ao; double d2 = this.locY + (this.m - this.locY) / (double) this.k;
double d3 = this.locZ + (this.ar - this.locZ) / (double) this.ao; double d3 = this.locZ + (this.n - this.locZ) / (double) this.k;
for (d0 = this.as - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) { for (d0 = this.o - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) {
; ;
} }
@ -203,14 +203,14 @@ public class EntityMinecart extends Entity implements IInventory {
d0 -= 360.0D; d0 -= 360.0D;
} }
this.yaw = (float) ((double) this.yaw + d0 / (double) this.ao); this.yaw = (float) ((double) this.yaw + d0 / (double) this.k);
this.pitch = (float) ((double) this.pitch + (this.at - (double) this.pitch) / (double) this.ao); this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k);
--this.ao; --this.k;
this.a(d1, d2, d3); this.a(d1, d2, d3);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} }
} else { } else {
this.lastX = this.locX; this.lastX = this.locX;
@ -254,7 +254,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ -= d0; this.motZ -= d0;
} }
int[][] aint = an[l]; int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit.
double d5 = (double) (aint[1][0] - aint[0][0]); double d5 = (double) (aint[1][0] - aint[0][0]);
double d6 = (double) (aint[1][2] - aint[0][2]); double d6 = (double) (aint[1][2] - aint[0][2]);
double d7 = Math.sqrt(d5 * d5 + d6 * d6); double d7 = Math.sqrt(d5 * d5 + d6 * d6);
@ -333,18 +333,18 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ *= 0.996999979019165D; this.motZ *= 0.996999979019165D;
} else { } else {
if (this.d == 2) { if (this.d == 2) {
d16 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak); d16 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
if (d16 > 0.01D) { if (d16 > 0.01D) {
flag = true; flag = true;
this.f /= d16; this.f /= d16;
this.ak /= d16; this.g /= d16;
double d18 = 0.04D; double d18 = 0.04D;
this.motX *= 0.800000011920929D; this.motX *= 0.800000011920929D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.800000011920929D; this.motZ *= 0.800000011920929D;
this.motX += this.f * d18; this.motX += this.f * d18;
this.motZ += this.ak * d18; this.motZ += this.g * d18;
} else { } else {
this.motX *= 0.8999999761581421D; this.motX *= 0.8999999761581421D;
this.motY *= 0.0D; this.motY *= 0.0D;
@ -381,17 +381,17 @@ public class EntityMinecart extends Entity implements IInventory {
} }
if (this.d == 2) { if (this.d == 2) {
double d20 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak); 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) { if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
this.f /= d20; this.f /= d20;
this.ak /= d20; this.g /= d20;
if (this.f * this.motX + this.ak * this.motZ < 0.0D) { if (this.f * this.motX + this.g * this.motZ < 0.0D) {
this.f = 0.0D; this.f = 0.0D;
this.ak = 0.0D; this.g = 0.0D;
} else { } else {
this.f = this.motX; this.f = this.motX;
this.ak = this.motZ; this.g = this.motZ;
} }
} }
} }
@ -436,7 +436,7 @@ public class EntityMinecart extends Entity implements IInventory {
if (d21 * d21 + d22 * d22 > 0.0010D) { if (d21 * d21 + d22 * d22 > 0.0010D) {
this.yaw = (float) (Math.atan2(d22, d21) * 180.0D / 3.141592653589793D); this.yaw = (float) (Math.atan2(d22, d21) * 180.0D / 3.141592653589793D);
if (this.am) { if (this.i) {
this.yaw += 180.0F; this.yaw += 180.0F;
} }
} }
@ -453,10 +453,10 @@ public class EntityMinecart extends Entity implements IInventory {
if (d23 < -170.0D || d23 >= 170.0D) { if (d23 < -170.0D || d23 >= 170.0D) {
this.yaw += 180.0F; this.yaw += 180.0F;
this.am = !this.am; this.i = !this.i;
} }
this.b(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
@ -477,8 +477,8 @@ public class EntityMinecart extends Entity implements IInventory {
for (int k1 = 0; k1 < list.size(); ++k1) { for (int k1 = 0; k1 < list.size(); ++k1) {
Entity entity = (Entity) list.get(k1); Entity entity = (Entity) list.get(k1);
if (entity != this.passenger && entity.z() && entity instanceof EntityMinecart) { if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
entity.c((Entity) this); entity.h(this);
} }
} }
} }
@ -490,7 +490,7 @@ public class EntityMinecart extends Entity implements IInventory {
if (flag && this.random.nextInt(4) == 0) { if (flag && this.random.nextInt(4) == 0) {
--this.e; --this.e;
if (this.e < 0) { if (this.e < 0) {
this.f = this.ak = 0.0D; this.f = this.g = 0.0D;
} }
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D); this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
@ -515,7 +515,7 @@ public class EntityMinecart extends Entity implements IInventory {
d1 = (double) (j + 1); d1 = (double) (j + 1);
} }
int[][] aint = an[l]; int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit
double d3 = 0.0D; double d3 = 0.0D;
double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D; double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D; double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
@ -562,17 +562,17 @@ public class EntityMinecart extends Entity implements IInventory {
nbttagcompound.a("Type", this.d); nbttagcompound.a("Type", this.d);
if (this.d == 2) { if (this.d == 2) {
nbttagcompound.a("PushX", this.f); nbttagcompound.a("PushX", this.f);
nbttagcompound.a("PushZ", this.ak); nbttagcompound.a("PushZ", this.g);
nbttagcompound.a("Fuel", (short) this.e); nbttagcompound.a("Fuel", (short) this.e);
} else if (this.d == 1) { } else if (this.d == 1) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.al.length; ++i) { for (int i = 0; i < this.h.length; ++i) {
if (this.al[i] != null) { if (this.h[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.al[i].a(nbttagcompound1); this.h[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -582,28 +582,28 @@ public class EntityMinecart extends Entity implements IInventory {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.d("Type"); this.d = nbttagcompound.e("Type");
if (this.d == 2) { if (this.d == 2) {
this.f = nbttagcompound.g("PushX"); this.f = nbttagcompound.h("PushX");
this.ak = nbttagcompound.g("PushZ"); this.g = nbttagcompound.h("PushZ");
this.e = nbttagcompound.c("Fuel"); this.e = nbttagcompound.d("Fuel");
} else if (this.d == 1) { } else if (this.d == 1) {
NBTTagList nbttaglist = nbttagcompound.k("Items"); NBTTagList nbttaglist = nbttagcompound.l("Items");
this.al = new ItemStack[this.h_()]; this.h = new ItemStack[this.m_()];
for (int i = 0; i < nbttaglist.b(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.b("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.al.length) { if (j >= 0 && j < this.h.length) {
this.al[j] = new ItemStack(nbttagcompound1); this.h[j] = new ItemStack(nbttagcompound1);
} }
} }
} }
} }
public void c(Entity entity) { public void h(Entity entity) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (entity != this.passenger) { if (entity != this.passenger) {
@ -628,7 +628,7 @@ public class EntityMinecart extends Entity implements IInventory {
server.getPluginManager().callEvent(enterEvent); server.getPluginManager().callEvent(enterEvent);
if (!enterEvent.isCancelled()) { if (!enterEvent.isCancelled()) {
entity.e((Entity) this); entity.b((Entity) this);
} }
} }
} }
@ -653,8 +653,8 @@ public class EntityMinecart extends Entity implements IInventory {
d1 *= d3; d1 *= d3;
d0 *= 0.10000000149011612D; d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D; d1 *= 0.10000000149011612D;
d0 *= (double) (1.0F - this.U); d0 *= (double) (1.0F - this.bo);
d1 *= (double) (1.0F - this.U); d1 *= (double) (1.0F - this.bo);
d0 *= 0.5D; d0 *= 0.5D;
d1 *= 0.5D; d1 *= 0.5D;
if (entity instanceof EntityMinecart) { if (entity instanceof EntityMinecart) {
@ -692,26 +692,26 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
public int h_() { public int m_() {
return 27; return 27;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return this.al[i]; return this.h[i];
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.al[i] != null) { if (this.h[i] != null) {
ItemStack itemstack; ItemStack itemstack;
if (this.al[i].count <= j) { if (this.h[i].count <= j) {
itemstack = this.al[i]; itemstack = this.h[i];
this.al[i] = null; this.h[i] = null;
return itemstack; return itemstack;
} else { } else {
itemstack = this.al[i].a(j); itemstack = this.h[i].a(j);
if (this.al[i].count == 0) { if (this.h[i].count == 0) {
this.al[i] = null; this.h[i] = null;
} }
return itemstack; return itemstack;
@ -722,21 +722,21 @@ public class EntityMinecart extends Entity implements IInventory {
} }
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
this.al[i] = itemstack; this.h[i] = itemstack;
if (itemstack != null && itemstack.count > this.c()) { if (itemstack != null && itemstack.count > this.n_()) {
itemstack.count = this.c(); itemstack.count = this.n_();
} }
} }
public String b() { public String c() {
return "Minecart"; return "Minecart";
} }
public int c() { public int n_() {
return 64; return 64;
} }
public void d() {} public void h() {}
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
if (this.d == 0) { if (this.d == 0) {
@ -759,14 +759,14 @@ public class EntityMinecart extends Entity implements IInventory {
} }
// CraftBukkit end // CraftBukkit end
entityhuman.e(this); entityhuman.b((Entity) this);
} }
} else if (this.d == 1) { } else if (this.d == 1) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
entityhuman.a((IInventory) this); entityhuman.a((IInventory) this);
} }
} else if (this.d == 2) { } else if (this.d == 2) {
ItemStack itemstack = entityhuman.inventory.e(); ItemStack itemstack = entityhuman.inventory.b();
if (itemstack != null && itemstack.id == Item.COAL.id) { if (itemstack != null && itemstack.id == Item.COAL.id) {
if (--itemstack.count == 0) { if (--itemstack.count == 0) {
@ -777,13 +777,13 @@ public class EntityMinecart extends Entity implements IInventory {
} }
this.f = this.locX - entityhuman.locX; this.f = this.locX - entityhuman.locX;
this.ak = this.locZ - entityhuman.locZ; this.g = this.locZ - entityhuman.locZ;
} }
return true; return true;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.b((Entity) this) <= 64.0D; return this.dead ? false : entityhuman.g(this) <= 64.0D;
} }
} }

View File

@ -20,27 +20,27 @@ public class EntityMonster extends EntityCreature implements IMonster {
this.health = 20; this.health = 20;
} }
public void o() { public void q() {
float f = this.b(1.0F); float f = this.c(1.0F);
if (f > 0.5F) { if (f > 0.5F) {
this.bw += 2; this.at += 2;
} }
super.o(); super.q();
} }
public void b_() { public void f_() {
super.b_(); super.f_();
if (this.world.k == 0) { if (this.world.j == 0) {
this.q(); this.C();
} }
} }
protected Entity l() { protected Entity l() {
EntityHuman entityhuman = this.world.a(this, 16.0D); EntityHuman entityhuman = this.world.a(this, 16.0D);
return entityhuman != null && this.i(entityhuman) ? entityhuman : null; return entityhuman != null && this.e(entityhuman) ? entityhuman : null;
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
@ -57,9 +57,9 @@ public class EntityMonster extends EntityCreature implements IMonster {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
d = null; this.d = null;
} else { } else {
d = ((CraftEntity) event.getTarget()).getHandle(); this.d = ((CraftEntity) event.getTarget()).getHandle();
} }
} }
// CraftBukkit end // CraftBukkit end
@ -75,10 +75,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
if ((double) f < 2.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20; this.attackTicks = 20;
// CraftBukkit start // CraftBukkit start
if(entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damager = this.getBukkitEntity(); org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();

View File

@ -18,22 +18,22 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) { public EntityPigZombie(World world) {
super(world); super(world);
this.texture = "/mob/pigzombie.png"; this.texture = "/mob/pigzombie.png";
this.bC = 0.5F; this.az = 0.5F;
this.c = 5; this.c = 5;
this.ae = true; this.by = true;
} }
public void b_() { public void f_() {
this.bC = this.d != null ? 0.95F : 0.5F; this.az = this.d != null ? 0.95F : 0.5F;
if (this.b > 0 && --this.b == 0) { 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.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
} }
super.b_(); super.f_();
} }
public boolean b() { public boolean b() {
return this.world.k > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox); return this.world.j > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
@ -43,15 +43,15 @@ public class EntityPigZombie extends EntityZombie {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
this.a = nbttagcompound.c("Anger"); this.a = nbttagcompound.d("Anger");
} }
protected Entity l() { protected Entity l() {
return this.a == 0 ? null : super.l(); return this.a == 0 ? null : super.l();
} }
public void o() { public void q() {
super.o(); super.q();
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
@ -64,17 +64,17 @@ public class EntityPigZombie extends EntityZombie {
if (entity1 instanceof EntityPigZombie) { if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
entitypigzombie.g(entity); entitypigzombie.c(entity);
} }
} }
this.g(entity); this.c(entity);
} }
return super.a(entity, i); return super.a(entity, i);
} }
private void g(Entity entity) { private void c(Entity entity) {
// CraftBukkit start // CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = null; org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) { if (entity != null) {

View File

@ -21,21 +21,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double d; public double d;
public double e; public double e;
public List f = new LinkedList(); public List f = new LinkedList();
public Set ak = new HashSet(); public Set g = new HashSet();
public double al; private int bE = -99999999;
private int bD = -99999999; private int bF = 60;
private int bE = 60; private ItemStack[] bG = new ItemStack[] { null, null, null, null, null};
private ItemStack[] bF = new ItemStack[] { null, null, null, null, null}; private int bH = 0;
private int bG = 0; public boolean h;
public boolean am;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world); super(world);
int i = world.spawnX; ChunkCoordinates chunkcoordinates = world.l();
int j = world.spawnZ; int i = chunkcoordinates.a;
int k = world.spawnY; int j = chunkcoordinates.c;
int k = chunkcoordinates.b;
if (!world.q.e) { if (!world.m.e) {
i += this.random.nextInt(20) - 10; i += this.random.nextInt(20) - 10;
k = world.e(i, j); k = world.e(i, j);
j += this.random.nextInt(20) - 10; j += this.random.nextInt(20) - 10;
@ -43,7 +43,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver; this.b = minecraftserver;
this.S = 0.0F; this.bm = 0.0F;
iteminworldmanager.a = this; iteminworldmanager.a = this;
this.name = s; this.name = s;
this.c = iteminworldmanager; this.c = iteminworldmanager;
@ -54,29 +54,38 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public ItemStack[] I() { public ItemStack[] k_() {
return this.bF; return this.bG;
} }
public void b_() { protected void l_() {
--this.bE; this.height = 0.0F;
}
public float p() {
return 1.62F;
}
public void f_() {
this.c.a();
--this.bF;
this.activeContainer.a(); this.activeContainer.a();
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.a(i); ItemStack itemstack = this.b_(i);
if (itemstack != this.bF[i]) { if (itemstack != this.bG[i]) {
this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack)); this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.bF[i] = itemstack; this.bG[i] = itemstack;
} }
} }
} }
public ItemStack a(int i) { public ItemStack b_(int i) {
return i == 0 ? this.inventory.e() : this.inventory.b[i - 1]; return i == 0 ? this.inventory.b() : this.inventory.b[i - 1];
} }
public void f(Entity entity) { public void a(Entity entity) {
// Craftbukkit start // Craftbukkit start
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
@ -105,7 +114,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {
if (this.bE > 0) { if (this.bF > 0) {
return false; return false;
} else { } else {
if (!this.b.n) { if (!this.b.n) {
@ -126,59 +135,46 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void d(int i) { public void b(int i) {
super.d(i); super.b(i);
} }
public void n() { public void a(boolean flag) {
super.b_(); super.f_();
ChunkCoordIntPair chunkcoordintpair = null; if (flag && !this.f.isEmpty()) {
double d0 = 0.0D; ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0);
for (int i = 0; i < this.f.size(); ++i) { if (chunkcoordintpair != null) {
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.f.get(i); boolean flag1 = false;
double d1 = chunkcoordintpair1.a(this);
if (i == 0 || d1 < d0) { if (this.a.b() < 2) {
chunkcoordintpair = chunkcoordintpair1; flag1 = true;
d0 = chunkcoordintpair1.a(this); }
}
}
if (chunkcoordintpair != null) { if (flag1) {
boolean flag = false; this.f.remove(chunkcoordintpair);
if (d0 < 1024.0D) { // CraftBukkit start
flag = true; 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);
// CraftBukkit end
if (this.a.b() < 2) { for (int i = 0; i < list.size(); ++i) {
flag = true; this.a((TileEntity) list.get(i));
} }
if (flag) {
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);
// Craftbukkit end
for (int j = 0; j < list.size(); ++j) {
this.a((TileEntity) list.get(j));
} }
} }
} }
if (this.health != this.bD) { if (this.health != this.bE) {
this.a.b((Packet) (new Packet8UpdateHealth(this.health))); this.a.b((Packet) (new Packet8UpdateHealth(this.health)));
this.bD = this.health; this.bE = this.health;
} }
} }
private void a(TileEntity tileentity) { private void a(TileEntity tileentity) {
if (tileentity != null) { if (tileentity != null) {
Packet packet = tileentity.g(); Packet packet = tileentity.e();
if (packet != null) { if (packet != null) {
this.a.b(packet); this.a.b(packet);
@ -186,13 +182,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void o() { public void q() {
this.motX = this.motY = this.motZ = 0.0D; super.q();
this.bA = false;
super.o();
} }
public void c(Entity entity, int i) { public void b(Entity entity, int i) {
if (!entity.dead) { if (!entity.dead) {
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
this.b.k.a(entity, new Packet22Collect(entity.id, this.id)); this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
@ -203,29 +197,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
super.c(entity, i); super.b(entity, i);
this.activeContainer.a(); this.activeContainer.a();
} }
public void K() { public void r() {
if (!this.au) { if (!this.p) {
this.av = -1; this.q = -1;
this.au = true; this.p = true;
this.b.k.a(this, new Packet18ArmAnimation(this, 1)); this.b.k.a(this, new Packet18ArmAnimation(this, 1));
} }
} }
public float w() { public void s() {}
return 1.62F;
public boolean a(int i, int j, int k) {
if (super.a(i, j, k)) {
this.b.k.a(this, new Packet17(this, 0, i, j, k));
return true;
} else {
return false;
}
} }
public void e(Entity entity) { public void a(boolean flag, boolean flag1) {
if (this.E()) {
this.b.k.b(this, new Packet18ArmAnimation(this, 3));
}
super.a(flag, flag1);
this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
public void b(Entity entity) {
// CraftBukkit start // CraftBukkit start
setPassengerOf(entity); setPassengerOf(entity);
} }
public void setPassengerOf(Entity entity) { public void setPassengerOf(Entity entity) {
// e(null) doesn't really fly for overloaded methods, // b(null) doesn't really fly for overloaded methods,
// so this method is needed // so this method is needed
super.setPassengerOf(entity); super.setPassengerOf(entity);
@ -240,45 +250,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag); super.a(d0, flag);
} }
private void U() { private void V() {
this.bG = this.bG % 100 + 1; this.bH = this.bH % 100 + 1;
} }
public void a(int i, int j, int k) { public void b(int i, int j, int k) {
this.U(); this.V();
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 1, "Crafting", 9))); this.a.b((Packet) (new Packet100OpenWindow(this.bH, 1, "Crafting", 9)));
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k); this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
this.activeContainer.f = this.bG; this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
this.U(); this.V();
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 0, iinventory.b(), iinventory.h_()))); this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.m_())));
this.activeContainer = new ContainerChest(this.inventory, iinventory); this.activeContainer = new ContainerChest(this.inventory, iinventory);
this.activeContainer.f = this.bG; this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityFurnace tileentityfurnace) { public void a(TileEntityFurnace tileentityfurnace) {
this.U(); this.V();
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))); this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.m_())));
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
this.activeContainer.f = this.bG; this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityDispenser tileentitydispenser) { public void a(TileEntityDispenser tileentitydispenser) {
this.U(); this.V();
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))); this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.m_())));
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
this.activeContainer.f = this.bG; this.activeContainer.f = this.bH;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(Container container, int i, ItemStack itemstack) { public void a(Container container, int i, ItemStack itemstack) {
if (!(container.a(i) instanceof SlotResult)) { if (!(container.a(i) instanceof SlotResult)) {
if (!this.am) { if (!this.h) {
this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack))); this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack)));
} }
} }
@ -295,19 +305,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(ItemStack itemstack) {} public void a(ItemStack itemstack) {}
public void L() { public void t() {
this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f))); this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f)));
this.N(); this.v();
} }
public void M() { public void u() {
if (!this.am) { if (!this.h) {
this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i()))); this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i())));
} }
} }
public void N() { public void v() {
this.activeContainer.a((EntityHuman) this); this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
this.au = f;
this.av = f1;
this.ax = flag;
this.b(flag1);
this.pitch = f2;
this.yaw = f3;
}
} }

View File

@ -33,9 +33,9 @@ public class EntitySkeleton extends EntityMonster {
return "mob.skeletonhurt"; return "mob.skeletonhurt";
} }
public void o() { public void q() {
if (this.world.b()) { if (this.world.c()) {
float f = this.b(1.0F); 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.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -51,7 +51,7 @@ public class EntitySkeleton extends EntityMonster {
} }
} }
super.o(); super.q();
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
@ -89,7 +89,7 @@ public class EntitySkeleton extends EntityMonster {
return Item.ARROW.id; return Item.ARROW.id;
} }
protected void g_() { protected void o() {
// Craftbukkit start - whole method // Craftbukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();

View File

@ -17,9 +17,9 @@ public class EntitySnowball extends Entity {
private int e = 0; private int e = 0;
private boolean f = false; private boolean f = false;
public int a = 0; public int a = 0;
private EntityLiving ak; private EntityLiving g;
private int al; private int h;
private int am = 0; private int i = 0;
public EntitySnowball(World world) { public EntitySnowball(World world) {
super(world); super(world);
@ -30,9 +30,9 @@ public class EntitySnowball extends Entity {
public EntitySnowball(World world, EntityLiving entityliving) { public EntitySnowball(World world, EntityLiving entityliving) {
super(world); super(world);
this.ak = entityliving; this.g = entityliving;
this.a(0.25F, 0.25F); this.a(0.25F, 0.25F);
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -48,7 +48,7 @@ public class EntitySnowball extends Entity {
public EntitySnowball(World world, double d0, double d1, double d2) { public EntitySnowball(World world, double d0, double d1, double d2) {
super(world); super(world);
this.al = 0; this.h = 0;
this.a(0.25F, 0.25F); this.a(0.25F, 0.25F);
this.a(d0, d1, d2); this.a(d0, d1, d2);
this.height = 0.0F; this.height = 0.0F;
@ -73,14 +73,14 @@ public class EntitySnowball extends Entity {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.al = 0; this.h = 0;
} }
public void b_() { public void f_() {
this.O = this.locX; this.bi = this.locX;
this.P = this.locY; this.bj = this.locY;
this.Q = this.locZ; this.bk = this.locZ;
super.b_(); super.f_();
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
} }
@ -89,9 +89,9 @@ public class EntitySnowball extends Entity {
int i = this.world.getTypeId(this.b, this.c, this.d); int i = this.world.getTypeId(this.b, this.c, this.d);
if (i == this.e) { if (i == this.e) {
++this.al; ++this.h;
if (this.al == 1200) { if (this.h == 1200) {
this.q(); this.C();
} }
return; return;
@ -101,10 +101,10 @@ public class EntitySnowball extends Entity {
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.al = 0; this.h = 0;
this.am = 0; this.i = 0;
} else { } else {
++this.am; ++this.i;
} }
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
@ -125,7 +125,7 @@ public class EntitySnowball extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) { if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -152,7 +152,7 @@ public class EntitySnowball extends Entity {
boolean stick; boolean stick;
if (movingobjectposition.g instanceof EntityLiving) { if (movingobjectposition.g instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity(); org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
org.bukkit.entity.Entity projectile = this.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity();
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
@ -164,13 +164,13 @@ public class EntitySnowball extends Entity {
if(!event.isCancelled()) { if(!event.isCancelled()) {
// this function returns if the snowball should stick or not, i.e. !bounce // this function returns if the snowball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.ak, event.getDamage()); stick = movingobjectposition.g.a(this.g, event.getDamage());
} else { } else {
// event was cancelled, get if the snowball should bounce or not // event was cancelled, get if the snowball should bounce or not
stick = !event.getBounce(); stick = !event.getBounce();
} }
} else { } else {
stick = movingobjectposition.g.a(this.ak, 0); stick = movingobjectposition.g.a(this.g, 0);
} }
if (stick) { 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.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
} }
this.q(); this.C();
} }
this.locX += this.motX; this.locX += this.motX;
@ -213,7 +213,7 @@ public class EntitySnowball extends Entity {
float f2 = 0.99F; float f2 = 0.99F;
float f3 = 0.03F; float f3 = 0.03F;
if (this.v()) { if (this.g_()) {
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
float f4 = 0.25F; float f4 = 0.25F;
@ -240,19 +240,19 @@ public class EntitySnowball extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.b = nbttagcompound.c("xTile"); this.b = nbttagcompound.d("xTile");
this.c = nbttagcompound.c("yTile"); this.c = nbttagcompound.d("yTile");
this.d = nbttagcompound.c("zTile"); this.d = nbttagcompound.d("zTile");
this.e = nbttagcompound.b("inTile") & 255; this.e = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.b("shake") & 255; this.a = nbttagcompound.c("shake") & 255;
this.f = nbttagcompound.b("inGround") == 1; this.f = nbttagcompound.c("inGround") == 1;
} }
public void b(EntityHuman entityhuman) { public void b(EntityHuman entityhuman) {
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { 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); this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.c(this, 1); entityhuman.b(this, 1);
this.q(); this.C();
} }
} }
} }

View File

@ -13,7 +13,7 @@ public class EntitySpider extends EntityMonster {
super(world); super(world);
this.texture = "/mob/spider.png"; this.texture = "/mob/spider.png";
this.a(1.4F, 0.9F); this.a(1.4F, 0.9F);
this.bC = 0.8F; this.az = 0.8F;
} }
public double k() { public double k() {
@ -21,7 +21,7 @@ public class EntitySpider extends EntityMonster {
} }
protected Entity l() { protected Entity l() {
float f = this.b(1.0F); float f = this.c(1.0F);
if (f < 0.5F) { if (f < 0.5F) {
double d0 = 16.0D; double d0 = 16.0D;
@ -45,7 +45,7 @@ public class EntitySpider extends EntityMonster {
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
float f1 = this.b(1.0F); float f1 = this.c(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) { if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start // CraftBukkit start
@ -91,6 +91,6 @@ public class EntitySpider extends EntityMonster {
} }
public boolean m() { public boolean m() {
return this.B; return this.aV;
} }
} }

View File

@ -13,7 +13,7 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) { public EntityTNTPrimed(World world) {
super(world); super(world);
this.a = 0; this.a = 0;
this.i = true; this.aC = true;
this.a(0.98F, 0.98F); this.a(0.98F, 0.98F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
@ -26,7 +26,7 @@ public class EntityTNTPrimed extends Entity {
this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F); this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F);
this.motY = 0.20000000298023224D; this.motY = 0.20000000298023224D;
this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F); this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F);
this.M = false; this.bg = false;
this.a = 80; this.a = 80;
this.lastX = d0; this.lastX = d0;
this.lastY = d1; this.lastY = d1;
@ -35,11 +35,11 @@ public class EntityTNTPrimed extends Entity {
protected void a() {} protected void a() {}
public boolean c_() { public boolean d_() {
return !this.dead; return !this.dead;
} }
public void b_() { public void f_() {
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
@ -57,21 +57,23 @@ public class EntityTNTPrimed extends Entity {
if (this.a-- <= 0) { if (this.a-- <= 0) {
// Craftbukkit start // Craftbukkit start
// Need to reverse the order of the explosion and the entity death so we have a location for the event. // Need to reverse the order of the explosion and the entity death so we have a location for the event.
this.d(); this.h();
this.q(); this.C();
// Craftbukkit end // Craftbukkit end
} else { } else {
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
} }
} }
private void d() { private void h() {
float f = 4.0F;
// Craftbukkit start // Craftbukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 4.0F, false); ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
} }
// Craftbukkit end // Craftbukkit end
@ -82,6 +84,6 @@ public class EntityTNTPrimed extends Entity {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.b("Fuse"); this.a = nbttagcompound.c("Fuse");
} }
} }

View File

@ -64,12 +64,12 @@ public class EntityTrackerEntry {
int k = MathHelper.b(this.a.locZ * 32.0D); int k = MathHelper.b(this.a.locZ * 32.0D);
int l = MathHelper.d(this.a.yaw * 256.0F / 360.0F); int l = MathHelper.d(this.a.yaw * 256.0F / 360.0F);
int i1 = MathHelper.d(this.a.pitch * 256.0F / 360.0F); int i1 = MathHelper.d(this.a.pitch * 256.0F / 360.0F);
boolean flag = i != this.d || j != this.e || k != this.f;
boolean flag1 = l != this.g || i1 != this.h;
int j1 = i - this.d; int j1 = i - this.d;
int k1 = j - this.e; int k1 = j - this.e;
int l1 = k - this.f; int l1 = k - this.f;
Object object = null; Object object = null;
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8;
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) { if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) {
if (flag && flag1) { if (flag && flag1) {
@ -78,8 +78,6 @@ public class EntityTrackerEntry {
object = new Packet31RelEntityMove(this.a.id, (byte) j1, (byte) k1, (byte) l1); object = new Packet31RelEntityMove(this.a.id, (byte) j1, (byte) k1, (byte) l1);
} else if (flag1) { } else if (flag1) {
object = new Packet32EntityLook(this.a.id, (byte) l, (byte) i1); object = new Packet32EntityLook(this.a.id, (byte) l, (byte) i1);
} else {
object = new Packet30Entity(this.a.id);
} }
} else { } else {
object = new Packet34EntityTeleport(this.a.id, i, j, k, (byte) l, (byte) i1); object = new Packet34EntityTeleport(this.a.id, i, j, k, (byte) l, (byte) i1);
@ -104,22 +102,27 @@ public class EntityTrackerEntry {
this.a((Packet) object); this.a((Packet) object);
} }
DataWatcher datawatcher = this.a.p(); DataWatcher datawatcher = this.a.O();
if (datawatcher.a()) { if (datawatcher.a()) {
this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher))); this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher)));
} }
this.d = i; if (flag) {
this.e = j; this.d = i;
this.f = k; this.e = j;
this.g = l; this.f = k;
this.h = i1; }
if (flag1) {
this.g = l;
this.h = i1;
}
} }
if (this.a.E) { if (this.a.aY) {
this.b((Packet) (new Packet28EntityVelocity(this.a))); this.b((Packet) (new Packet28EntityVelocity(this.a)));
this.a.E = false; this.a.aY = false;
} }
} }
@ -163,7 +166,7 @@ public class EntityTrackerEntry {
entityplayer.a.b((Packet) (new Packet28EntityVelocity(this.a.id, this.a.motX, this.a.motY, this.a.motZ))); entityplayer.a.b((Packet) (new Packet28EntityVelocity(this.a.id, this.a.motX, this.a.motY, this.a.motZ)));
} }
ItemStack[] aitemstack = this.a.I(); ItemStack[] aitemstack = this.a.k_();
if (aitemstack != null) { if (aitemstack != null) {
for (int i = 0; i < aitemstack.length; ++i) { for (int i = 0; i < aitemstack.length; ++i) {

View File

@ -11,13 +11,13 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) { public EntityZombie(World world) {
super(world); super(world);
this.texture = "/mob/zombie.png"; this.texture = "/mob/zombie.png";
this.bC = 0.5F; this.az = 0.5F;
this.c = 5; this.c = 5;
} }
public void o() { public void q() {
if (this.world.b()) { if (this.world.c()) {
float f = this.b(1.0F); 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.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -31,7 +31,7 @@ public class EntityZombie extends EntityMonster {
} }
} }
super.o(); super.q();
} }
protected String e() { protected String e() {

View File

@ -64,7 +64,7 @@ public class Explosion {
d3 /= d6; d3 /= d6;
d4 /= d6; d4 /= d6;
d5 /= d6; d5 /= d6;
float f1 = this.f * (0.7F + this.i.l.nextFloat() * 0.6F); float f1 = this.f * (0.7F + this.i.k.nextFloat() * 0.6F);
d0 = this.b; d0 = this.b;
d1 = this.c; d1 = this.c;
@ -179,7 +179,7 @@ public class Explosion {
} }
public void b() { public void b() {
this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.l.nextFloat() - this.i.l.nextFloat()) * 0.2F) * 0.7F); 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);
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
arraylist.addAll(this.g); arraylist.addAll(this.g);
@ -217,9 +217,9 @@ public class Explosion {
int i1 = this.i.getTypeId(j, k, l); int i1 = this.i.getTypeId(j, k, l);
for (int j1 = 0; j1 < 1; ++j1) { for (int j1 = 0; j1 < 1; ++j1) {
double d0 = (double) ((float) j + this.i.l.nextFloat()); double d0 = (double) ((float) j + this.i.k.nextFloat());
double d1 = (double) ((float) k + this.i.l.nextFloat()); double d1 = (double) ((float) k + this.i.k.nextFloat());
double d2 = (double) ((float) l + this.i.l.nextFloat()); double d2 = (double) ((float) l + this.i.k.nextFloat());
double d3 = d0 - this.b; double d3 = d0 - this.b;
double d4 = d1 - this.c; double d4 = d1 - this.c;
double d5 = d2 - this.d; double d5 = d2 - this.d;
@ -230,7 +230,7 @@ public class Explosion {
d5 /= d6; d5 /= d6;
double d7 = 0.5D / (d6 / (double) this.f + 0.1D); double d7 = 0.5D / (d6 / (double) this.f + 0.1D);
d7 *= (double) (this.i.l.nextFloat() * this.i.l.nextFloat() + 0.3F); d7 *= (double) (this.i.k.nextFloat() * this.i.k.nextFloat() + 0.3F);
d3 *= d7; d3 *= d7;
d4 *= d7; d4 *= d7;
d5 *= d7; d5 *= d7;
@ -241,7 +241,7 @@ public class Explosion {
if (i1 > 0) { if (i1 > 0) {
Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit
this.i.e(j, k, l, 0); this.i.e(j, k, l, 0);
Block.byId[i1].a_(this.i, j, k, l); Block.byId[i1].c(this.i, j, k, l);
} }
} }
} }

View File

@ -2,19 +2,19 @@ package net.minecraft.server;
public interface IInventory { public interface IInventory {
int h_(); int m_();
ItemStack a(int i); ItemStack c_(int i);
ItemStack b(int i, int j); ItemStack a(int i, int j);
void a(int i, ItemStack itemstack); void a(int i, ItemStack itemstack);
String b(); String c();
int c(); int n_();
void d(); void h();
boolean a_(EntityHuman entityhuman); boolean a_(EntityHuman entityhuman);

View File

@ -12,19 +12,19 @@ public class InventoryCraftResult implements IInventory {
public InventoryCraftResult() {} public InventoryCraftResult() {}
public int h_() { public int m_() {
return this.a.length; //Craftbukkit return 1;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return this.a[i]; return this.a[i];
} }
public String b() { public String c() {
return "Result"; return "Result";
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.a[i] != null) { if (this.a[i] != null) {
ItemStack itemstack = this.a[i]; ItemStack itemstack = this.a[i];
@ -39,11 +39,11 @@ public class InventoryCraftResult implements IInventory {
this.a[i] = itemstack; this.a[i] = itemstack;
} }
public int c() { public int n_() {
return 64; return 64;
} }
public void d() {} public void h() {}
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return true; return true;

View File

@ -20,29 +20,29 @@ public class InventoryCrafting implements IInventory {
this.b = i; this.b = i;
} }
public int h_() { public int m_() {
return this.a.length; return this.a.length;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return i >= this.h_() ? null : this.a[i]; return i >= this.m_() ? null : this.a[i];
} }
public ItemStack a(int i, int j) { public ItemStack b(int i, int j) {
if (i >= 0 && i < this.b) { if (i >= 0 && i < this.b) {
int k = i + j * this.b; int k = i + j * this.b;
return this.a(k); return this.c_(k);
} else { } else {
return null; return null;
} }
} }
public String b() { public String c() {
return "Crafting"; return "Crafting";
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.a[i] != null) { if (this.a[i] != null) {
ItemStack itemstack; ItemStack itemstack;
@ -70,11 +70,11 @@ public class InventoryCrafting implements IInventory {
this.c.a((IInventory) this); this.c.a((IInventory) this);
} }
public int c() { public int n_() {
return 64; return 64;
} }
public void d() {} public void h() {}
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return true; return true;

View File

@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory {
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
ItemStack[] result = new ItemStack[h_()]; ItemStack[] result = new ItemStack[m_()];
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
result[i] = a(i); result[i] = c_(i);
} }
return result; return result;
} }
@ -22,37 +22,37 @@ public class InventoryLargeChest implements IInventory {
this.c = iinventory1; this.c = iinventory1;
} }
public int h_() { public int m_() {
return this.b.h_() + this.c.h_(); return this.b.m_() + this.c.m_();
} }
public String b() { public String c() {
return this.a; return this.a;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return i >= this.b.h_() ? this.c.a(i - this.b.h_()) : this.b.a(i); return i >= this.b.m_() ? this.c.c_(i - this.b.m_()) : this.b.c_(i);
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
return i >= this.b.h_() ? this.c.b(i - this.b.h_(), j) : this.b.b(i, j); return i >= this.b.m_() ? this.c.a(i - this.b.m_(), j) : this.b.a(i, j);
} }
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
if (i >= this.b.h_()) { if (i >= this.b.m_()) {
this.c.a(i - this.b.h_(), itemstack); this.c.a(i - this.b.m_(), itemstack);
} else { } else {
this.b.a(i, itemstack); this.b.a(i, itemstack);
} }
} }
public int c() { public int n_() {
return this.b.c(); return this.b.n_();
} }
public void d() { public void h() {
this.b.d(); this.b.h();
this.c.d(); this.c.h();
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {

View File

@ -23,7 +23,7 @@ public class InventoryPlayer implements IInventory {
this.e = entityhuman; this.e = entityhuman;
} }
public ItemStack e() { public ItemStack b() {
return this.a[this.c]; return this.a[this.c];
} }
@ -39,7 +39,7 @@ public class InventoryPlayer implements IInventory {
private int c(ItemStack itemstack) { private int c(ItemStack itemstack) {
for (int i = 0; i < this.a.length; ++i) { 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.c() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) { 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.n_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) {
return i; return i;
} }
} }
@ -79,8 +79,8 @@ public class InventoryPlayer implements IInventory {
l = this.a[k].b() - this.a[k].count; l = this.a[k].b() - this.a[k].count;
} }
if (l > this.c() - this.a[k].count) { if (l > this.n_() - this.a[k].count) {
l = this.c() - this.a[k].count; l = this.n_() - this.a[k].count;
} }
if (l == 0) { if (l == 0) {
@ -94,7 +94,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void f() { public void e() {
for (int i = 0; i < this.a.length; ++i) { for (int i = 0; i < this.a.length; ++i) {
if (this.a[i] != null && this.a[i].b > 0) { if (this.a[i] != null && this.a[i].b > 0) {
--this.a[i].b; --this.a[i].b;
@ -135,7 +135,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
ItemStack[] aitemstack = this.a; ItemStack[] aitemstack = this.a;
if (i >= this.a.length) { if (i >= this.a.length) {
@ -213,9 +213,9 @@ public class InventoryPlayer implements IInventory {
this.a = new ItemStack[36]; this.a = new ItemStack[36];
this.b = new ItemStack[4]; this.b = new ItemStack[4];
for (int i = 0; i < nbttaglist.b(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound.b("Slot") & 255; int j = nbttagcompound.c("Slot") & 255;
ItemStack itemstack = new ItemStack(nbttagcompound); ItemStack itemstack = new ItemStack(nbttagcompound);
if (itemstack.a() != null) { if (itemstack.a() != null) {
@ -230,11 +230,11 @@ public class InventoryPlayer implements IInventory {
} }
} }
public int h_() { public int m_() {
return this.a.length + this.b.length; //Craftbukkit return this.a.length + 4;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
ItemStack[] aitemstack = this.a; ItemStack[] aitemstack = this.a;
if (i >= aitemstack.length) { if (i >= aitemstack.length) {
@ -245,16 +245,16 @@ public class InventoryPlayer implements IInventory {
return aitemstack[i]; return aitemstack[i];
} }
public String b() { public String c() {
return "Inventory"; return "Inventory";
} }
public int c() { public int n_() {
return 64; return 64;
} }
public int a(Entity entity) { public int a(Entity entity) {
ItemStack itemstack = this.a(this.c); ItemStack itemstack = this.c_(this.c);
return itemstack != null ? itemstack.a(entity) : 1; return itemstack != null ? itemstack.a(entity) : 1;
} }
@ -263,13 +263,13 @@ public class InventoryPlayer implements IInventory {
if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) { if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) {
return true; return true;
} else { } else {
ItemStack itemstack = this.a(this.c); ItemStack itemstack = this.c_(this.c);
return itemstack != null ? itemstack.b(block) : false; return itemstack != null ? itemstack.b(block) : false;
} }
} }
public int g() { public int f() {
int i = 0; int i = 0;
int j = 0; int j = 0;
int k = 0; int k = 0;
@ -282,7 +282,7 @@ public class InventoryPlayer implements IInventory {
j += k1; j += k1;
k += i1; k += i1;
int l1 = ((ItemArmor) this.b[l].a()).bh; int l1 = ((ItemArmor) this.b[l].a()).bj;
i += l1; i += l1;
} }
@ -307,7 +307,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void h() { public void g() {
int i; int i;
for (i = 0; i < this.a.length; ++i) { for (i = 0; i < this.a.length; ++i) {
@ -325,7 +325,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void d() { public void h() {
this.d = true; this.d = true;
} }
@ -339,6 +339,6 @@ public class InventoryPlayer implements IInventory {
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return this.e.dead ? false : entityhuman.b((Entity) this.e) <= 64.0D; return this.e.dead ? false : entityhuman.g(this.e) <= 64.0D;
} }
} }

View File

@ -67,12 +67,12 @@ public class ItemBlock extends Item {
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself, /* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
* rather than the block touching the face we clicked on. * rather than the block touching the face we clicked on.
*/ */
int typeId = blockClicked.getTypeId(); int typeId = blockClicked.getTypeId();
org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked); org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked);
if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP)) if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP))
replacedBlock = blockClicked; replacedBlock = blockClicked;
final BlockState replacedBlockState = new CraftBlockState(replacedBlock); final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
// CraftBukkit end // CraftBukkit end
@ -95,9 +95,13 @@ public class ItemBlock extends Item {
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack); org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity(); Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity();
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ)); ChunkCoordinates chunkcoordinates = world.l();
int spawnX = chunkcoordinates.a;
int spawnZ = chunkcoordinates.c;
boolean canBuild = distanceFromSpawn > ((WorldServer) world).D.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start int distanceFromSpawn = (int) Math.max(Math.abs(i - spawnX), Math.abs(k - spawnZ));
boolean canBuild = distanceFromSpawn > ((WorldServer) world).x.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild); BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);

View File

@ -121,8 +121,8 @@ public class ItemBucket extends Item {
} }
if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) { if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) {
if (world.q.d && this.a == Block.WATER.id) { 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.l.nextFloat() - world.l.nextFloat()) * 0.8F); 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);
for (int l = 0; l < 8; ++l) { 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); world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);

View File

@ -52,14 +52,14 @@ public class ItemHoe extends Item {
world.e(i, j, k, block.id); world.e(i, j, k, block.id);
itemstack.b(1); itemstack.b(1);
if (world.l.nextInt(8) == 0 && i1 == Block.GRASS.id) { if (world.k.nextInt(8) == 0 && i1 == Block.GRASS.id) {
byte b0 = 1; byte b0 = 1;
for (int j1 = 0; j1 < b0; ++j1) { for (int j1 = 0; j1 < b0; ++j1) {
float f = 0.7F; float f = 0.7F;
float f1 = world.l.nextFloat() * f + (1.0F - f) * 0.5F; float f1 = world.k.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = 1.2F; float f2 = 1.2F;
float f3 = world.l.nextFloat() * f + (1.0F - f) * 0.5F; float f3 = world.k.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 entityitem = new EntityItem(world, (double) ((float) i + f1), (double) ((float) j + f2), (double) ((float) k + f3), new ItemStack(Item.SEEDS));
entityitem.c = 10; entityitem.c = 10;

View File

@ -9,82 +9,100 @@ public class ItemInWorldManager {
private World b; private World b;
public EntityHuman a; public EntityHuman a;
private float c; public float c = 0.0F; // CraftBukkit private -> public
public float d = 0.0F; // CraftBukkit private -> public private int d;
private int e = 0; private int e = 0;
private float f = 0.0F; private float f = 0.0F;
private int g; private int g;
private int h; private int h;
private int i; private int i;
private int j;
private boolean k;
private int l;
private int m;
private int n;
private int o;
public ItemInWorldManager(World world) { public ItemInWorldManager(World world) {
this.b = world; this.b = world;
} }
public void a(int i, int j, int k) {
int l = this.b.getTypeId(i, j, k);
if (l > 0 && this.d == 0.0F) {
Block.byId[l].b(this.b, i, j, k, this.a);
}
if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) {
this.c(i, j, k);
}
}
public void a() { public void a() {
this.d = 0.0F; ++this.j;
this.e = 0; if (this.k) {
} int i = this.j - this.o;
int j = this.b.getTypeId(this.l, this.m, this.n);
public void a(int i, int j, int k, int l) { if (j != 0) {
if (this.e > 0) { Block block = Block.byId[j];
--this.e; float f = block.a(this.a) * (float) (i + 1);
} else {
if (i == this.g && j == this.h && k == this.i) {
int i1 = this.b.getTypeId(i, j, k);
if (i1 == 0) { if (f >= 1.0F) {
return; this.k = false;
} this.d(this.l, this.m, this.n);
Block block = Block.byId[i1];
this.d += block.a(this.a);
++this.f;
if (this.d >= 1.0F) {
this.c(i, j, k);
this.d = 0.0F;
this.c = 0.0F;
this.f = 0.0F;
this.e = 5;
} }
} else { } else {
this.d = 0.0F; this.k = false;
this.c = 0.0F;
this.f = 0.0F;
this.g = i;
this.h = j;
this.i = k;
} }
} }
} }
public boolean b(int i, int j, int k) { public void a(int i, int j, int k) {
this.d = this.j;
int l = this.b.getTypeId(i, j, k);
if (l > 0) {
Block.byId[l].b(this.b, i, j, k, this.a);
}
if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) {
this.d(i, j, k);
} else {
this.g = i;
this.h = j;
this.i = k;
}
}
public void b(int i, int j, int k) {
if (i == this.g && j == this.h && k == this.i) {
int l = this.j - this.d;
int i1 = this.b.getTypeId(i, j, k);
if (i1 != 0) {
Block block = Block.byId[i1];
float f = block.a(this.a) * (float) (l + 1);
if (f >= 1.0F) {
this.d(i, j, k);
} else if (!this.k) {
this.k = true;
this.l = i;
this.m = j;
this.n = k;
this.o = this.d;
}
}
}
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)]; Block block = Block.byId[this.b.getTypeId(i, j, k)];
int l = this.b.getData(i, j, k); int l = this.b.getData(i, j, k);
boolean flag = this.b.e(i, j, k, 0); boolean flag = this.b.e(i, j, k, 0);
if (block != null && flag) { if (block != null && flag) {
block.a(this.b, i, j, k, l); block.b(this.b, i, j, k, l);
} }
return flag; return flag;
} }
public boolean c(int i, int j, int k) { public boolean d(int i, int j, int k) {
//CraftBukkit start // CraftBukkit start
if (this.a instanceof EntityPlayer){ if (this.a instanceof EntityPlayer){
CraftServer server = ((WorldServer) this.b).getServer(); CraftServer server = ((WorldServer) this.b).getServer();
org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k);
@ -97,23 +115,24 @@ public class ItemInWorldManager {
return true; return true;
} }
} }
//CraftBukkit end // CraftBukkit end
int l = this.b.getTypeId(i, j, k); int l = this.b.getTypeId(i, j, k);
int i1 = this.b.getData(i, j, k); int i1 = this.b.getData(i, j, k);
boolean flag = this.b(i, j, k); boolean flag = this.c(i, j, k);
ItemStack itemstack = this.a.P(); ItemStack itemstack = this.a.z();
if (itemstack != null) { if (itemstack != null) {
itemstack.a(l, i, j, k); itemstack.a(l, i, j, k);
if (itemstack.count == 0) { if (itemstack.count == 0) {
itemstack.a(this.a); itemstack.a(this.a);
this.a.Q(); this.a.A();
} }
} }
if (flag && this.a.b(Block.byId[l])) { if (flag && this.a.b(Block.byId[l])) {
Block.byId[l].g(this.b, i, j, k, i1); Block.byId[l].a_(this.b, i, j, k, i1);
((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
} }
return flag; return flag;

View File

@ -72,9 +72,9 @@ public final class ItemStack {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
this.id = nbttagcompound.c("id"); this.id = nbttagcompound.d("id");
this.count = nbttagcompound.b("Count"); this.count = nbttagcompound.c("Count");
this.damage = nbttagcompound.c("Damage"); this.damage = nbttagcompound.d("Damage");
} }
public int b() { public int b() {

View File

@ -24,7 +24,7 @@ import org.bukkit.event.Event;
import org.bukkit.event.world.WorldEvent; import org.bukkit.event.world.WorldEvent;
//CraftBukkit end //CraftBukkit end
public class MinecraftServer implements ICommandListener, Runnable { public class MinecraftServer implements Runnable, ICommandListener {
public static Logger a = Logger.getLogger("Minecraft"); public static Logger a = Logger.getLogger("Minecraft");
public static HashMap b = new HashMap(); public static HashMap b = new HashMap();
@ -32,13 +32,14 @@ public class MinecraftServer implements ICommandListener, Runnable {
public PropertyManager d; public PropertyManager d;
//public WorldServer e; // Craftbukkit - removed //public WorldServer e; // Craftbukkit - removed
public ServerConfigurationManager f; public ServerConfigurationManager f;
private boolean o = true; private ConsoleCommandHandler o;
private boolean p = true;
public boolean g = false; public boolean g = false;
int h = 0; int h = 0;
public String i; public String i;
public int j; public int j;
private List p = new ArrayList(); private List q = new ArrayList();
private List q = Collections.synchronizedList(new ArrayList()); private List r = Collections.synchronizedList(new ArrayList());
public EntityTracker k; public EntityTracker k;
public boolean l; public boolean l;
public boolean m; public boolean m;
@ -58,6 +59,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
} }
private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException
this.o = new ConsoleCommandHandler(this);
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this); ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
threadcommandreader.setDaemon(true); threadcommandreader.setDaemon(true);
@ -69,7 +71,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true)); System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true));
// Craftbukkit end // Craftbukkit end
a.info("Starting minecraft server version Beta 1.2_01"); a.info("Starting minecraft server version Beta 1.3");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
a.warning("**** NOT ENOUGH RAM!"); a.warning("**** NOT ENOUGH RAM!");
a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@ -111,21 +113,27 @@ public class MinecraftServer implements ICommandListener, Runnable {
this.f = new ServerConfigurationManager(this); this.f = new ServerConfigurationManager(this);
this.k = new EntityTracker(this); this.k = new EntityTracker(this);
long j = System.nanoTime();
String s1 = this.d.a("level-name", "world"); String s1 = this.d.a("level-name", "world");
a.info("Preparing level \"" + s1 + "\""); a.info("Preparing level \"" + s1 + "\"");
this.c(s1); this.a((Convertable) (new WorldLoaderServer(new File("."))), s1);
a.info("Done! For help, type \"help\" or \"?\""); a.info("Done (" + (System.nanoTime() - j) + "ns)! For help, type \"help\" or \"?\"");
return true; return true;
} }
private void c(String s) { private void a(Convertable convertable, String s) {
if (convertable.a(s)) {
a.info("Converting map!");
convertable.a(s, new ConvertProgressUpdater(this));
}
a.info("Preparing start region"); a.info("Preparing start region");
// Craftbukkit start // Craftbukkit start
WorldServer world = new WorldServer(this, new File("."), s, this.d.a("hellworld", false) ? -1 : 0); WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0);
world.a(new WorldManager(this, world)); world.a(new WorldManager(this, world));
world.k = this.d.a("spawn-monsters", true) ? 1 : 0; world.j = this.d.a("spawn-monsters", true) ? 1 : 0;
world.a(this.d.a("spawn-monsters", true), this.m); world.a(this.d.a("spawn-monsters", true), this.m);
this.f.a(world); this.f.a(world);
worlds.add(world); worlds.add(world);
@ -133,9 +141,10 @@ public class MinecraftServer implements ICommandListener, Runnable {
short short1 = 196; short short1 = 196;
long i = System.currentTimeMillis(); long i = System.currentTimeMillis();
ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // Craftbukkit
for (int j = -short1; j <= short1 && this.o; j += 16) { for (int j = -short1; j <= short1 && this.p; j += 16) {
for (int k = -short1; k <= short1 && this.o; k += 16) { for (int k = -short1; k <= short1 && this.p; k += 16) {
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
if (l < i) { if (l < i) {
@ -152,9 +161,9 @@ public class MinecraftServer implements ICommandListener, Runnable {
// Craftbukkit start // Craftbukkit start
for (WorldServer worldserver : worlds) { for (WorldServer worldserver : worlds) {
world.A.d(world.spawnX + j >> 4, world.spawnZ + k >> 4); world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
while (world.d() && this.o) { while (world.e() && this.p) {
; ;
} }
} }
@ -184,6 +193,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
// Craftbukkit start // Craftbukkit start
for (WorldServer world : worlds) { for (WorldServer world : worlds) {
world.a(true, (IProgressUpdate) null); world.a(true, (IProgressUpdate) null);
world.r();
Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() ); Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
server.getPluginManager().callEvent( worldSaved ); server.getPluginManager().callEvent( worldSaved );
@ -209,16 +219,15 @@ public class MinecraftServer implements ICommandListener, Runnable {
} }
public void a() { public void a() {
this.o = false; this.p = false;
} }
public void run() { public void run() {
try { try {
if (this.d()) { if (this.d()) {
long i = System.currentTimeMillis(); long i = System.currentTimeMillis();
long j = 0L;
while (this.o) { for (long j = 0L; this.p; Thread.sleep(1L)) {
long k = System.currentTimeMillis(); long k = System.currentTimeMillis();
long l = k - i; long l = k - i;
@ -234,16 +243,18 @@ public class MinecraftServer implements ICommandListener, Runnable {
j += l; j += l;
i = k; i = k;
if (this.worlds.size() > 0 && this.worlds.get(0).q()) { // Craftbukkit - TODO - Replace with loop?
while (j > 50L) {
j -= 50L;
this.h(); this.h();
j = 0L;
} else {
while (j > 50L) {
j -= 50L;
this.h();
}
} }
Thread.sleep(1L);
} }
} else { } else {
while (this.o) { while (this.p) {
this.b(); this.b();
try { try {
@ -253,11 +264,11 @@ public class MinecraftServer implements ICommandListener, Runnable {
} }
} }
} }
} catch (Exception exception) { } catch (Throwable throwable) {
exception.printStackTrace(); throwable.printStackTrace();
a.log(Level.SEVERE, "Unexpected exception", exception); a.log(Level.SEVERE, "Unexpected exception", throwable);
while (this.o) { while (this.p) {
this.b(); this.b();
try { try {
@ -270,6 +281,8 @@ public class MinecraftServer implements ICommandListener, Runnable {
try { try {
this.g(); this.g();
this.g = true; this.g = true;
} catch (Throwable throwable1) {
throwable1.printStackTrace();
} finally { } finally {
System.exit(0); System.exit(0);
} }
@ -305,20 +318,20 @@ public class MinecraftServer implements ICommandListener, Runnable {
if (this.h % 20 == 0) { if (this.h % 20 == 0) {
for (int i = 0; i < this.f.b.size(); ++i) { for (int i = 0; i < this.f.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i); EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i);
entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.e))); entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
} }
} }
((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h); ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h);
for (WorldServer world : worlds) { for (WorldServer world : worlds) {
world.f(); world.g();
while (world.d()) { while (world.e()) {
; ;
} }
world.c(); world.d();
} }
// Craftbukkit end // Craftbukkit end
@ -326,8 +339,8 @@ public class MinecraftServer implements ICommandListener, Runnable {
this.f.b(); this.f.b();
this.k.a(); this.k.a();
for (j = 0; j < this.p.size(); ++j) { for (j = 0; j < this.q.size(); ++j) {
((IUpdatePlayerListBox) this.p.get(j)).a(); ((IUpdatePlayerListBox) this.q.get(j)).a();
} }
try { try {
@ -338,236 +351,25 @@ public class MinecraftServer implements ICommandListener, Runnable {
} }
public void a(String s, ICommandListener icommandlistener) { public void a(String s, ICommandListener icommandlistener) {
this.q.add(new ServerCommand(s, icommandlistener)); this.r.add(new ServerCommand(s, icommandlistener));
} }
public void b() { public void b() {
while (this.q.size() > 0) { while (this.r.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.q.remove(0); ServerCommand servercommand = (ServerCommand) this.r.remove(0);
String s = servercommand.a;
ICommandListener icommandlistener = servercommand.b;
String s1 = icommandlistener.c();
// Craftbukkit start // Craftbukkit start
if (server.dispatchCommand(console, s)) { if (server.dispatchCommand(console, servercommand.a)) {
continue; continue;
} }
// Craftbukkit end // Craftbukkit end
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) { this.o.a(servercommand);
if (s.toLowerCase().startsWith("list")) {
icommandlistener.b("Connected players: " + this.f.c());
} else if (s.toLowerCase().startsWith("stop")) {
this.a(s1, "Stopping the server..");
this.o = false;
} else if (s.toLowerCase().startsWith("save-all")) {
this.a(s1, "Forcing save..");
// Craftbukkit start
for (WorldServer world : worlds) {
world.a(true, (IProgressUpdate) null);
Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
server.getPluginManager().callEvent( worldSaved );
}
this.f.d();
// Craftbukkit end
this.a(s1, "Save complete.");
} else if (s.toLowerCase().startsWith("save-off")) {
this.a(s1, "Disabling level saving..");
// Craftbukkit start
for (WorldServer world : worlds) {
world.C = true;
}
// Craftbukkit end
} else if (s.toLowerCase().startsWith("save-on")) {
this.a(s1, "Enabling level saving..");
// Craftbukkit start
for (WorldServer world : worlds) {
world.C = false;
}
// Craftbukkit end
} else {
String s2;
if (s.toLowerCase().startsWith("op ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.e(s2);
this.a(s1, "Opping " + s2);
this.f.a(s2, "\u00A7eYou are now op!");
} else if (s.toLowerCase().startsWith("deop ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.f(s2);
this.f.a(s2, "\u00A7eYou are no longer op!");
this.a(s1, "De-opping " + s2);
} else if (s.toLowerCase().startsWith("ban-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.c(s2);
this.a(s1, "Banning ip " + s2);
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.d(s2);
this.a(s1, "Pardoning ip " + s2);
} else {
EntityPlayer entityplayer;
if (s.toLowerCase().startsWith("ban ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.a(s2);
this.a(s1, "Banning " + s2);
entityplayer = this.f.h(s2);
if (entityplayer != null) {
entityplayer.a.a("Banned by admin");
}
} else if (s.toLowerCase().startsWith("pardon ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.b(s2);
this.a(s1, "Pardoning " + s2);
} else if (s.toLowerCase().startsWith("kick ")) {
s2 = s.substring(s.indexOf(" ")).trim();
entityplayer = null;
for (int i = 0; i < this.f.b.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.f.b.get(i);
if (entityplayer1.name.equalsIgnoreCase(s2)) {
entityplayer = entityplayer1;
}
}
if (entityplayer != null) {
entityplayer.a.a("Kicked by admin");
this.a(s1, "Kicking " + entityplayer.name);
} else {
icommandlistener.b("Can\'t find user " + s2 + ". No kick.");
}
} else {
String[] astring;
EntityPlayer entityplayer2;
if (s.toLowerCase().startsWith("tp ")) {
astring = s.split(" ");
if (astring.length == 3) {
entityplayer = this.f.h(astring[1]);
entityplayer2 = this.f.h(astring[2]);
if (entityplayer == null) {
icommandlistener.b("Can\'t find user " + astring[1] + ". No tp.");
} else if (entityplayer2 == null) {
icommandlistener.b("Can\'t find user " + astring[2] + ". No tp.");
} else {
entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
}
} else {
icommandlistener.b("Syntax error, please provice a source and a target.");
}
} else if (s.toLowerCase().startsWith("give ")) {
astring = s.split(" ");
if (astring.length != 3 && astring.length != 4) {
return;
}
String s3 = astring[1];
entityplayer2 = this.f.h(s3);
if (entityplayer2 != null) {
try {
int j = Integer.parseInt(astring[2]);
if (Item.byId[j] != null) {
this.a(s1, "Giving " + entityplayer2.name + " some " + j);
int k = 1;
if (astring.length > 3) {
k = this.b(astring[3], 1);
}
if (k < 1) {
k = 1;
}
if (k > 64) {
k = 64;
}
entityplayer2.b(new ItemStack(j, k, 0));
} else {
icommandlistener.b("There\'s no item with id " + j);
}
} catch (NumberFormatException numberformatexception) {
icommandlistener.b("There\'s no item with id " + astring[2]);
}
} else {
icommandlistener.b("Can\'t find user " + s3);
}
} else if (s.toLowerCase().startsWith("say ")) {
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "] " + s);
this.f.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s)));
} else if (s.toLowerCase().startsWith("tell ")) {
astring = s.split(" ");
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "->" + astring[1] + "] " + s);
s = "\u00A77" + s1 + " whispers " + s;
a.info(s);
if (!this.f.a(astring[1], (Packet) (new Packet3Chat(s)))) {
icommandlistener.b("There\'s no player by that name online.");
}
}
} else {
a.info("Unknown console command. Type \"help\" for help.");
}
}
}
}
} else {
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");
}
}
}
private void a(String s, String s1) {
String s2 = s + ": " + s1;
this.f.i("\u00A77(" + s2 + ")");
a.info(s2);
}
private int b(String s, int i) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException numberformatexception) {
return i;
} }
} }
public void a(IUpdatePlayerListBox iupdateplayerlistbox) { public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
this.p.add(iupdateplayerlistbox); this.q.add(iupdateplayerlistbox);
} }
public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[]) public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[])
@ -595,6 +397,6 @@ public class MinecraftServer implements ICommandListener, Runnable {
} }
public static boolean a(MinecraftServer minecraftserver) { public static boolean a(MinecraftServer minecraftserver) {
return minecraftserver.o; return minecraftserver.p;
} }
} }

View File

@ -57,8 +57,8 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet1Login packet1login) { public void a(Packet1Login packet1login) {
this.g = packet1login.b; this.g = packet1login.b;
if (packet1login.a != 8) { if (packet1login.a != 9) {
if (packet1login.a > 8) { if (packet1login.a > 9) {
this.a("Outdated server!"); this.a("Outdated server!");
} else { } else {
this.a("Outdated client!"); this.a("Outdated client!");
@ -80,13 +80,14 @@ public class NetLoginHandler extends NetHandler {
NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer); NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer);
// Craftbukkit start // Craftbukkit start
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.u, (byte) entityplayer.world.q.g))); ChunkCoordinates chunkcoordinates = entityplayer.world.l();
netserverhandler.b((Packet) (new Packet6SpawnPosition(entityplayer.world.spawnX, entityplayer.world.spawnY, entityplayer.world.spawnZ))); netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (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."))); this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")));
this.e.f.a(entityplayer); this.e.f.a(entityplayer);
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.e.c.a(netserverhandler); this.e.c.a(netserverhandler);
netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.e))); netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
// Craftbukkit end // Craftbukkit end
entityplayer.l(); entityplayer.l();

View File

@ -30,12 +30,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public boolean c = false; public boolean c = false;
private MinecraftServer d; private MinecraftServer d;
public EntityPlayer e; // Craftbukkit - public public EntityPlayer e; // Craftbukkit - public
private int f = 0; private int f;
private double g; private int g;
private double h; private boolean h;
private double i; private double i;
private boolean j = true; private double j;
private Map k = new HashMap(); private double k;
private boolean l = true;
private Map m = new HashMap();
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.d = minecraftserver; this.d = minecraftserver;
@ -64,9 +66,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end // CraftBukkit end
public void a() { public void a() {
this.h = false;
this.b.a(); this.b.a();
if (this.f++ % 20 == 0) { if (this.f - this.g > 20) {
this.b.a((Packet) (new Packet0KeepAlive())); this.b((Packet) (new Packet0KeepAlive()));
} }
} }
@ -80,28 +83,32 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return; return;
} }
// Send the possibly modified leave message // Send the possibly modified leave message
this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() )));
this.d.f.c(this.e);
this.b.a((Packet) (new Packet255KickDisconnect( kickEvent.getReason() ))); this.b.a((Packet) (new Packet255KickDisconnect( kickEvent.getReason() )));
// CraftBukkit end
this.b.c(); this.b.c();
this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() )));
// CraftBukkit end
this.d.f.c(this.e);
this.c = true; this.c = true;
} }
public void a(Packet27 packet27) {
this.e.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f());
}
public void a(Packet10Flying packet10flying) { public void a(Packet10Flying packet10flying) {
this.h = true;
double d0; double d0;
if (!this.j) { if (!this.l) {
d0 = packet10flying.b - this.h; d0 = packet10flying.b - this.j;
if (packet10flying.a == this.g && d0 * d0 < 0.01D && packet10flying.c == this.i) { if (packet10flying.a == this.i && d0 * d0 < 0.01D && packet10flying.c == this.k) {
this.j = true; this.l = true;
} }
} }
// CraftBukkit start // CraftBukkit start
Player player = getPlayer(); Player player = getPlayer();
Location from = new Location(player.getWorld(), g, h, i, this.e.yaw, this.e.pitch); Location from = new Location(player.getWorld(), i, j, k, this.e.yaw, this.e.pitch);
Location to = player.getLocation(); Location to = player.getLocation();
if (!from.equals(to)) { if (!from.equals(to)) {
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to); PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to);
@ -118,7 +125,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
// CraftBukkit end // CraftBukkit end
if (this.j) { if (this.l) {
double d1; double d1;
double d2; double d2;
double d3; double d3;
@ -128,7 +135,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f = this.e.yaw; float f = this.e.yaw;
float f1 = this.e.pitch; float f1 = this.e.pitch;
this.e.vehicle.E(); this.e.vehicle.h_();
d1 = this.e.locX; d1 = this.e.locX;
d2 = this.e.locY; d2 = this.e.locY;
d3 = this.e.locZ; d3 = this.e.locZ;
@ -146,7 +153,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
this.e.onGround = packet10flying.g; this.e.onGround = packet10flying.g;
this.e.n(); this.e.a(true);
this.e.c(d5, 0.0D, d4); this.e.c(d5, 0.0D, d4);
this.e.b(d1, d2, d3, f, f1); this.e.b(d1, d2, d3, f, f1);
this.e.motX = d5; this.e.motX = d5;
@ -156,21 +163,21 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
if (this.e.vehicle != null) { if (this.e.vehicle != null) {
this.e.vehicle.E(); this.e.vehicle.h_();
} }
this.d.f.b(this.e); this.d.f.b(this.e);
this.g = this.e.locX; this.i = this.e.locX;
this.h = this.e.locY; this.j = this.e.locY;
this.i = this.e.locZ; this.k = this.e.locZ;
this.e.world.f(this.e); this.e.world.f(this.e); // Craftbukkit
return; return;
} }
d0 = this.e.locY; d0 = this.e.locY;
this.g = this.e.locX; this.i = this.e.locX;
this.h = this.e.locY; this.j = this.e.locY;
this.i = this.e.locZ; this.k = this.e.locZ;
d1 = this.e.locX; d1 = this.e.locX;
d2 = this.e.locY; d2 = this.e.locY;
d3 = this.e.locZ; d3 = this.e.locZ;
@ -190,8 +197,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.a("Illegal stance"); this.a("Illegal stance");
a.warning(this.e.name + " had an illegal stance: " + d4); a.warning(this.e.name + " had an illegal stance: " + d4);
} }
this.e.al = packet10flying.d;
} }
if (packet10flying.i) { if (packet10flying.i) {
@ -199,9 +204,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f3 = packet10flying.f; f3 = packet10flying.f;
} }
this.e.n(); this.e.a(true);
this.e.R = 0.0F; this.e.bl = 0.0F;
this.e.b(this.g, this.h, this.i, f2, f3); this.e.b(this.i, this.j, this.k, f2, f3);
d4 = d1 - this.e.locX; d4 = d1 - this.e.locX;
double d6 = d2 - this.e.locY; double d6 = d2 - this.e.locY;
double d7 = d3 - this.e.locZ; double d7 = d3 - this.e.locZ;
@ -219,7 +224,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d8 = d4 * d4 + d6 * d6 + d7 * d7; double d8 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false; boolean flag1 = false;
if (d8 > 0.0625D) { if (d8 > 0.0625D && !this.e.E()) {
flag1 = true; flag1 = true;
a.warning(this.e.name + " moved wrongly!"); a.warning(this.e.name + " moved wrongly!");
System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
@ -229,8 +234,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.b(d1, d2, d3, f2, f3); this.e.b(d1, d2, d3, f2, f3);
boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit
if (flag && (flag1 || !flag2)) { if (flag && (flag1 || !flag2) && !this.e.E()) {
this.a(this.g, this.h, this.i, f2, f3); this.a(this.i, this.j, this.k, f2, f3);
return; return;
} }
@ -258,26 +263,26 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f1 = to.getPitch(); f1 = to.getPitch();
// CraftBukkit end // CraftBukkit end
this.j = false; this.l = false;
this.g = d0; this.i = d0;
this.h = d1; this.j = d1;
this.i = d2; this.k = d2;
this.e.b(d0, d1, d2, f, f1); 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.e.a.b((Packet) (new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)));
} }
public void a(Packet14BlockDig packet14blockdig) { public void a(Packet14BlockDig packet14blockdig) {
if (packet14blockdig.e == 4) { if (packet14blockdig.e == 4) {
this.e.O(); this.e.y();
} else { } else {
boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
boolean flag1 = false; boolean flag1 = false;
if (packet14blockdig.e == 0) { if (packet14blockdig.e == 0) {
flag1 = true; flag1 = true;
} }
if (packet14blockdig.e == 1) { if (packet14blockdig.e == 2) {
flag1 = true; flag1 = true;
} }
@ -294,19 +299,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (d3 > 36.0D) { if (d3 > 36.0D) {
return; return;
} }
double d4 = this.e.locY;
this.e.locY = this.e.al;
this.e.locY = d4;
} }
int l = packet14blockdig.d; ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit int l = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
if (i1 > j1) { if (l > i1) {
j1 = i1; i1 = l;
} }
// CraftBukkit start // CraftBukkit start
@ -321,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet14blockdig.e == 0) { if (packet14blockdig.e == 0) {
// CraftBukkit start // CraftBukkit start
if (j1 > this.d.spawnProtection || flag) { if (i1 > this.d.spawnProtection || flag) {
if (blockId > 0) { if (blockId > 0) {
BlockDamageEvent event; BlockDamageEvent event;
// If the amount of damage that the player is going to do to the block // If the amount of damage that the player is going to do to the block
@ -351,16 +351,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
BlockDamageEvent event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player); BlockDamageEvent event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.e.c.a(); this.e.c.b(i, j, k);
} }
// CraftBukkit end // CraftBukkit end
} else if (packet14blockdig.e == 1) { } else if (packet14blockdig.e == 1) {
// CraftBukkit start // CraftBukkit start
if (j1 > this.d.spawnProtection || flag) { if (i1 > this.d.spawnProtection || flag) {
BlockDamageEvent event; BlockDamageEvent event;
// If the amount of damage going to the block plus the current amount // If the amount of damage going to the block plus the current amount
// of damage is greater than 1, the block is going to break. // of damage is greater than 1, the block is going to break.
if (e.c.d + damage >= 1.0F) { if (e.c.c + damage >= 1.0F) {
// if we are destroying either a redstone wire with a current greater than 0 or // if we are destroying either a redstone wire with a current greater than 0 or
// a redstone torch that is on, then we should notify plugins that this block has // a redstone torch that is on, then we should notify plugins that this block has
// returned to a current value of 0 (since it will once the redstone is destroyed) // returned to a current value of 0 (since it will once the redstone is destroyed)
@ -372,37 +372,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player); event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
} }
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (event.isCancelled()) {
this.e.c.a(i, j, k, l); e.c.c = 0; // Reset the amount of damage if stopping break.
} else {
e.c.d = 0; // Reset the amount of damage if stopping break.
} }
} }
// CraftBukkit end
} else if (packet14blockdig.e == 3) { } else if (packet14blockdig.e == 3) {
double d5 = this.e.locX - ((double) i + 0.5D); double d4 = this.e.locX - ((double) i + 0.5D);
double d6 = this.e.locY - ((double) j + 0.5D); double d5 = this.e.locY - ((double) j + 0.5D);
double d7 = this.e.locZ - ((double) k + 0.5D); double d6 = this.e.locZ - ((double) k + 0.5D);
double d8 = d5 * d5 + d6 * d6 + d7 * d7; double d7 = d4 * d4 + d5 * d5 + d6 * d6;
if (d8 < 256.0D) { if (d7 < 256.0D) {
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); // Craftbukkit this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
} }
} }
// CraftBukkit start
lastX = i; lastX = i;
lastY = j; lastY = j;
lastZ = k; lastZ = k;
// CraftBukkit end
((WorldServer)this.e.world).B = false; // Craftbukkit ((WorldServer)this.e.world).v = false;
// CraftBukkit end
} }
} }
public void a(Packet15Place packet15place) { public void a(Packet15Place packet15place) {
ItemStack itemstack = this.e.inventory.e(); ItemStack itemstack = this.e.inventory.b();
boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
// CraftBukkit start // CraftBukkit start
CraftBlock blockClicked = null; CraftBlock blockClicked = null;
@ -475,8 +471,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int j = packet15place.b; int j = packet15place.b;
int k = packet15place.c; int k = packet15place.c;
int l = packet15place.d; int l = packet15place.d;
int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
if (i1 > j1) { if (i1 > j1) {
j1 = i1; j1 = i1;
@ -523,18 +520,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.inventory.a[this.e.inventory.c] = null; this.e.inventory.a[this.e.inventory.c] = null;
} }
this.e.am = true; this.e.h = true;
this.e.inventory.a[this.e.inventory.c] = ItemStack.b(this.e.inventory.a[this.e.inventory.c]); 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); Slot slot = this.e.activeContainer.a(this.e.inventory, this.e.inventory.c);
this.e.activeContainer.a(); this.e.activeContainer.a();
this.e.am = false; this.e.h = false;
if (!ItemStack.a(this.e.inventory.e(), packet15place.e) || always) { // CraftBukkit if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) { // CraftBukkit
this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.c, this.e.inventory.e()))); this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.a, this.e.inventory.b())));
} }
((WorldServer)this.e.world).B = false; // Craftbukkit ((WorldServer)this.e.world).v = false; // Craftbukkit
} }
public void a(String s, Object[] aobject) { public void a(String s, Object[] aobject) {
@ -551,6 +548,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void b(Packet packet) { public void b(Packet packet) {
this.b.a(packet); this.b.a(packet);
this.g = this.f;
} }
public void a(Packet16BlockItemSwitch packet16blockitemswitch) { public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
@ -664,7 +662,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} else { } else {
String s1; String s1;
if (this.d.f.g(this.e.name)) { if (this.d.f.h(this.e.name)) {
s1 = s.substring(1); s1 = s.substring(1);
a.info(this.e.name + " issued server command: " + s1); a.info(this.e.name + " issued server command: " + s1);
this.d.a(s1, (ICommandListener) this); this.d.a(s1, (ICommandListener) this);
@ -683,7 +681,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// CraftBukkit end // CraftBukkit end
this.e.K(); this.e.r();
} }
} }
@ -703,6 +701,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.b(true); this.e.b(true);
} else if (packet19entityaction.b == 2) { } else if (packet19entityaction.b == 2) {
this.e.b(false); this.e.b(false);
} else if (packet19entityaction.b == 3) {
this.e.a(false, true);
this.l = false;
} }
} }
@ -725,11 +726,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet7UseEntity packet7useentity) { public void a(Packet7UseEntity packet7useentity) {
Entity entity = ((WorldServer)this.e.world).a(packet7useentity.b); // Craftbukkit Entity entity = ((WorldServer)this.e.world).a(packet7useentity.b); // Craftbukkit
if (entity != null && this.e.i(entity)) { if (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) {
if (packet7useentity.c == 0) { if (packet7useentity.c == 0) {
this.e.g(entity); this.e.c(entity);
} else if (packet7useentity.c == 1) { } else if (packet7useentity.c == 1) {
this.e.h(entity); this.e.d(entity);
} }
} }
} }
@ -746,7 +747,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet101CloseWindow packet101closewindow) { public void a(Packet101CloseWindow packet101closewindow) {
this.e.N(); this.e.v();
} }
public void a(Packet102WindowClick packet102windowclick) { public void a(Packet102WindowClick packet102windowclick) {
@ -755,18 +756,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (ItemStack.a(packet102windowclick.e, itemstack)) { if (ItemStack.a(packet102windowclick.e, itemstack)) {
this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true))); this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
this.e.am = true; this.e.h = true;
this.e.activeContainer.a(); this.e.activeContainer.a();
this.e.M(); this.e.u();
this.e.am = false; this.e.h = false;
} else { } else {
this.k.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d)); 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.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)));
this.e.activeContainer.a(this.e, false); this.e.activeContainer.a(this.e, false);
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
for (int i = 0; i < this.e.activeContainer.e.size(); ++i) { for (int i = 0; i < this.e.activeContainer.e.size(); ++i) {
arraylist.add(((Slot) this.e.activeContainer.e.get(i)).c()); arraylist.add(((Slot) this.e.activeContainer.e.get(i)).b());
} }
this.e.a(this.e.activeContainer, arraylist); this.e.a(this.e.activeContainer, arraylist);
@ -775,7 +776,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet106Transaction packet106transaction) { public void a(Packet106Transaction packet106transaction) {
Short oshort = (Short) this.k.get(Integer.valueOf(this.e.activeContainer.f)); Short oshort = (Short) this.m.get(Integer.valueOf(this.e.activeContainer.f));
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.e.activeContainer.f == packet106transaction.a && !this.e.activeContainer.c(this.e)) { 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); this.e.activeContainer.a(this.e, true);
@ -828,10 +829,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end // CraftBukkit end
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
tileentitysign.e[l] = modifyEvent.getLine(l); // CraftBukkit tileentitysign.a[l] = modifyEvent.getLine(l); // CraftBukkit
} }
tileentitysign.d(); tileentitysign.h();
this.e.world.g(i, k, j); // Craftbukkit this.e.world.g(i, k, j); // Craftbukkit
} }
} }

View File

@ -29,14 +29,14 @@ class PlayerInstance {
this.d = j; this.d = j;
this.e = new ChunkCoordIntPair(i, j); this.e = new ChunkCoordIntPair(i, j);
playermanager.world.A.d(i, j); // Craftbukkit playermanager.world.u.d(i, j); // Craftbukkit
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
if (this.b.contains(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.c + ", " + this.d);
} else { } else {
entityplayer.ak.add(this.e); entityplayer.g.add(this.e);
entityplayer.a.b((Packet) (new Packet50PreChunk(this.e.a, this.e.b, true))); entityplayer.a.b((Packet) (new Packet50PreChunk(this.e.a, this.e.b, true)));
this.b.add(entityplayer); this.b.add(entityplayer);
entityplayer.f.add(this.e); entityplayer.f.add(this.e);
@ -56,11 +56,11 @@ class PlayerInstance {
PlayerManager.c(this.a).remove(this); PlayerManager.c(this.a).remove(this);
} }
((WorldServer)entityplayer.world).A.c(this.c, this.d); // Craftbukkit ((WorldServer)entityplayer.world).u.c(this.c, this.d); // Craftbukkit
} }
entityplayer.f.remove(this.e); entityplayer.f.remove(this.e);
if (entityplayer.ak.contains(this.e)) { if (entityplayer.g.contains(this.e)) {
entityplayer.a.b((Packet) (new Packet50PreChunk(this.c, this.d, false))); entityplayer.a.b((Packet) (new Packet50PreChunk(this.c, this.d, false)));
} }
} }
@ -115,7 +115,7 @@ class PlayerInstance {
for (int i = 0; i < this.b.size(); ++i) { for (int i = 0; i < this.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
if (entityplayer.ak.contains(this.e)) { if (entityplayer.g.contains(this.e)) {
entityplayer.a.b(packet); entityplayer.a.b(packet);
} }
} }
@ -178,7 +178,7 @@ class PlayerInstance {
private void a(TileEntity tileentity) { private void a(TileEntity tileentity) {
if (tileentity != null) { if (tileentity != null) {
Packet packet = tileentity.g(); Packet packet = tileentity.e();
if (packet != null) { if (packet != null) {
this.a(packet); this.a(packet);

View File

@ -9,6 +9,7 @@ public class PlayerManager {
private PlayerList b = new PlayerList(); private PlayerList b = new PlayerList();
private List c = new ArrayList(); private List c = new ArrayList();
private MinecraftServer d; private MinecraftServer d;
private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
public WorldServer world; // Craftbukkit public WorldServer world; // Craftbukkit
// Craftbukkit - change of method signature // Craftbukkit - change of method signature
@ -26,8 +27,7 @@ public class PlayerManager {
this.c.clear(); this.c.clear();
} }
// Craftbukkit - method signature changed! private PlayerInstance a(int i, int j, boolean flag) {
private PlayerInstance a(int i, int j, boolean flag, WorldServer world) {
long k = (long) i + 2147483647L | (long) j + 2147483647L << 32; long k = (long) i + 2147483647L | (long) j + 2147483647L << 32;
PlayerInstance playerinstance = (PlayerInstance) this.b.a(k); PlayerInstance playerinstance = (PlayerInstance) this.b.a(k);
@ -39,63 +39,50 @@ public class PlayerManager {
return playerinstance; return playerinstance;
} }
// Craftbukkit - method signature changed! public void a(int i, int j, int k) {
public void a(int i, int j, int k, WorldServer world) {
int l = i >> 4; int l = i >> 4;
int i1 = k >> 4; int i1 = k >> 4;
PlayerInstance playerinstance = this.a(l, i1, false, world); PlayerInstance playerinstance = this.a(l, i1, false);
if (playerinstance != null) { if (playerinstance != null) {
playerinstance.a(i & 15, j, k & 15); playerinstance.a(i & 15, j, k & 15);
} }
} }
// CraftBukkit start
private final int[][] direction = new int[][] {
{ 1, 0 },
{ 0, 1 },
{ -1, 0 },
{ 0, -1 },
};
// CraftBukkit end
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
int i = (int) entityplayer.locX >> 4; int i = (int) entityplayer.locX >> 4;
int j = (int) entityplayer.locZ >> 4; int j = (int) entityplayer.locZ >> 4;
entityplayer.d = entityplayer.locX; entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ; entityplayer.e = entityplayer.locZ;
int k = 0;
byte b0 = 10;
int l = 0;
int i1 = 0;
// CraftBukkit start this.a(i, j, true).a(entityplayer);
int facing = 0;
int size = 10;
int dx = 0;
int dz = 0;
// Origin int j1;
this.a(i, j, true, ((WorldServer)entityplayer.world)).a(entityplayer);
// All but the last leg for (j1 = 1; j1 <= b0 * 2; ++j1) {
for (int legSize = 1; legSize <= size * 2; legSize++) { for (int k1 = 0; k1 < 2; ++k1) {
for (int leg = 0; leg < 2; leg++) { int[] aint = this.e[k++ % 4];
int[] dir = direction[ facing++ % 4 ];
for (int k = 0; k < legSize; k++ ) { for (int l1 = 0; l1 < j1; ++l1) {
dx += dir[0]; l += aint[0];
dz += dir[1]; i1 += aint[1];
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit this.a(i + l, j + i1, true).a(entityplayer);
} }
} }
} }
// Final leg k %= 4;
facing %= 4;
for (int k = 0; k < size * 2; k++) { for (j1 = 0; j1 < b0 * 2; ++j1) {
dx += direction[facing][0]; l += this.e[k][0];
dz += direction[facing][1]; i1 += this.e[k][1];
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); this.a(i + l, j + i1, true).a(entityplayer);
} }
// CraftBukkit end
this.a.add(entityplayer); this.a.add(entityplayer);
} }
@ -106,7 +93,7 @@ public class PlayerManager {
for (int k = i - 10; k <= i + 10; ++k) { for (int k = i - 10; k <= i + 10; ++k) {
for (int l = j - 10; l <= j + 10; ++l) { for (int l = j - 10; l <= j + 10; ++l) {
PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world)); // Craftbukkit PlayerInstance playerinstance = this.a(k, l, false);
if (playerinstance != null) { if (playerinstance != null) {
playerinstance.b(entityplayer); playerinstance.b(entityplayer);
@ -141,11 +128,11 @@ public class PlayerManager {
for (int k1 = i - 10; k1 <= i + 10; ++k1) { for (int k1 = i - 10; k1 <= i + 10; ++k1) {
for (int l1 = j - 10; l1 <= j + 10; ++l1) { for (int l1 = j - 10; l1 <= j + 10; ++l1) {
if (!this.a(k1, l1, k, l)) { if (!this.a(k1, l1, k, l)) {
this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit this.a(k1, l1, true).a(entityplayer);
} }
if (!this.a(k1 - i1, l1 - j1, i, j)) { if (!this.a(k1 - i1, l1 - j1, i, j)) {
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world)); // Craftbukkit PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false);
if (playerinstance != null) { if (playerinstance != null) {
playerinstance.b(entityplayer); playerinstance.b(entityplayer);

View File

@ -90,4 +90,10 @@ public class PropertyManager {
return flag; return flag;
} }
} }
public void b(String s, boolean flag) {
flag = getOverride(s, flag); // CraftBukkit
this.b.setProperty(s, "" + flag);
this.b();
}
} }

View File

@ -34,10 +34,13 @@ public class ServerConfigurationManager {
private Set f = new HashSet(); private Set f = new HashSet();
private Set g = new HashSet(); private Set g = new HashSet();
private Set h = new HashSet(); private Set h = new HashSet();
private File i; private Set i = new HashSet();
private File j; private File j;
private File k; private File k;
private PlayerNBTManager l; private File l;
private File m;
private PlayerFileData n;
private boolean o;
// CraftBukkit start // CraftBukkit start
private CraftServer server; private CraftServer server;
@ -48,23 +51,27 @@ public class ServerConfigurationManager {
// CraftBukkit end // CraftBukkit end
this.c = minecraftserver; this.c = minecraftserver;
this.i = minecraftserver.a("banned-players.txt"); this.j = minecraftserver.a("banned-players.txt");
this.j = minecraftserver.a("banned-ips.txt"); this.k = minecraftserver.a("banned-ips.txt");
this.k = minecraftserver.a("ops.txt"); this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.txt");
// this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed! // this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed!
this.e = minecraftserver.d.a("max-players", 20); this.e = minecraftserver.d.a("max-players", 20);
this.e(); this.o = minecraftserver.d.a("white-list", false);
this.g(); this.g();
this.i(); this.i();
this.f(); this.k();
this.m();
this.h(); this.h();
this.j(); this.j();
this.l();
this.n();
} }
public void a(WorldServer worldserver) { public void a(WorldServer worldserver) {
// Craftbukkit start // Craftbukkit start
if (this.l == null) { if (this.n == null) {
this.l = new PlayerNBTManager(new File(worldserver.t, "players")); this.n = worldserver.m().d();
} }
// Craftbukkit end // Craftbukkit end
} }
@ -75,10 +82,10 @@ public class ServerConfigurationManager {
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
this.b.add(entityplayer); this.b.add(entityplayer);
this.l.b(entityplayer); this.n.b(entityplayer);
// Craftbukkit start // Craftbukkit start
((WorldServer)entityplayer.world).A.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); ((WorldServer)entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) { while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ); entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
@ -97,7 +104,7 @@ public class ServerConfigurationManager {
} }
public void c(EntityPlayer entityplayer) { public void c(EntityPlayer entityplayer) {
this.l.a(entityplayer); this.n.a(entityplayer);
entityplayer.world.d(entityplayer); // Craftbukkit entityplayer.world.d(entityplayer); // Craftbukkit
this.b.remove(entityplayer); this.b.remove(entityplayer);
@ -123,6 +130,8 @@ public class ServerConfigurationManager {
if (this.f.contains(s.trim().toLowerCase())) { if (this.f.contains(s.trim().toLowerCase())) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!"); event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
} else if (!this.g(s)) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are not white-listed on this server!");
} else if (this.g.contains(s2)) { } else if (this.g.contains(s2)) {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!"); event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
} else if (this.b.size() >= this.e) { } else if (this.b.size() >= this.e) {
@ -158,7 +167,7 @@ public class ServerConfigurationManager {
entityplayer1.id = entityplayer.id; entityplayer1.id = entityplayer.id;
entityplayer1.a = entityplayer.a; entityplayer1.a = entityplayer.a;
((WorldServer)entityplayer.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); ((WorldServer)entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) { while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
@ -177,7 +186,7 @@ public class ServerConfigurationManager {
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch(); entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch();
entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle()); entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle());
entityplayer1.c.a = entityplayer1; entityplayer1.c.a = entityplayer1;
((WorldServer)entityplayer1.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); ((WorldServer)entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
// CraftBukkit end // CraftBukkit end
entityplayer1.a.b((Packet) (new Packet9Respawn())); entityplayer1.a.b((Packet) (new Packet9Respawn()));
@ -186,6 +195,7 @@ public class ServerConfigurationManager {
entityplayer.world.a(entityplayer1); entityplayer.world.a(entityplayer1);
this.b.add(entityplayer1); this.b.add(entityplayer1);
entityplayer1.l(); entityplayer1.l();
entityplayer1.s();
return entityplayer1; return entityplayer1;
// Craftbukkit end // Craftbukkit end
} }
@ -200,7 +210,7 @@ public class ServerConfigurationManager {
// Craftbukkit - changed signature // Craftbukkit - changed signature
public void a(int i, int j, int k, WorldServer world) { public void a(int i, int j, int k, WorldServer world) {
world.manager.a(i, j, k, world); // Craftbukkit world.manager.a(i, j, k);
} }
public void a(Packet packet) { public void a(Packet packet) {
@ -227,18 +237,18 @@ public class ServerConfigurationManager {
public void a(String s) { public void a(String s) {
this.f.add(s.toLowerCase()); this.f.add(s.toLowerCase());
this.f(); this.h();
} }
public void b(String s) { public void b(String s) {
this.f.remove(s.toLowerCase()); this.f.remove(s.toLowerCase());
this.f(); this.h();
} }
private void e() { private void g() {
try { try {
this.f.clear(); this.f.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.i)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
String s = ""; String s = "";
while ((s = bufferedreader.readLine()) != null) { while ((s = bufferedreader.readLine()) != null) {
@ -251,9 +261,9 @@ public class ServerConfigurationManager {
} }
} }
private void f() { private void h() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.i, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
Iterator iterator = this.f.iterator(); Iterator iterator = this.f.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -270,18 +280,18 @@ public class ServerConfigurationManager {
public void c(String s) { public void c(String s) {
this.g.add(s.toLowerCase()); this.g.add(s.toLowerCase());
this.h(); this.j();
} }
public void d(String s) { public void d(String s) {
this.g.remove(s.toLowerCase()); this.g.remove(s.toLowerCase());
this.h(); this.j();
} }
private void g() { private void i() {
try { try {
this.g.clear(); this.g.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
String s = ""; String s = "";
while ((s = bufferedreader.readLine()) != null) { while ((s = bufferedreader.readLine()) != null) {
@ -294,9 +304,9 @@ public class ServerConfigurationManager {
} }
} }
private void h() { private void j() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
Iterator iterator = this.g.iterator(); Iterator iterator = this.g.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -313,18 +323,18 @@ public class ServerConfigurationManager {
public void e(String s) { public void e(String s) {
this.h.add(s.toLowerCase()); this.h.add(s.toLowerCase());
this.j(); this.l();
} }
public void f(String s) { public void f(String s) {
this.h.remove(s.toLowerCase()); this.h.remove(s.toLowerCase());
this.j(); this.l();
} }
private void i() { private void k() {
try { try {
this.h.clear(); this.h.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
String s = ""; String s = "";
while ((s = bufferedreader.readLine()) != null) { while ((s = bufferedreader.readLine()) != null) {
@ -337,9 +347,9 @@ public class ServerConfigurationManager {
} }
} }
private void j() { private void l() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
Iterator iterator = this.h.iterator(); Iterator iterator = this.h.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -354,11 +364,49 @@ public class ServerConfigurationManager {
} }
} }
private void m() {
try {
this.i.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
String s = "";
while ((s = bufferedreader.readLine()) != null) {
this.i.add(s.trim().toLowerCase());
}
bufferedreader.close();
} catch (Exception exception) {
a.warning("Failed to load white-list: " + exception);
}
}
private void n() {
try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
Iterator iterator = this.i.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
printwriter.println(s);
}
printwriter.close();
} catch (Exception exception) {
a.warning("Failed to save white-list: " + exception);
}
}
public boolean g(String s) { public boolean g(String s) {
s = s.trim().toLowerCase();
return !this.o || this.h.contains(s) || this.i.contains(s);
}
public boolean h(String s) {
return this.h.contains(s.trim().toLowerCase()); return this.h.contains(s.trim().toLowerCase());
} }
public EntityPlayer h(String s) { public EntityPlayer i(String s) {
for (int i = 0; i < this.b.size(); ++i) { for (int i = 0; i < this.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
@ -371,7 +419,7 @@ public class ServerConfigurationManager {
} }
public void a(String s, String s1) { public void a(String s, String s1) {
EntityPlayer entityplayer = this.h(s); EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) { if (entityplayer != null) {
entityplayer.a.b((Packet) (new Packet3Chat(s1))); entityplayer.a.b((Packet) (new Packet3Chat(s1)));
@ -391,20 +439,20 @@ public class ServerConfigurationManager {
} }
} }
public void i(String s) { public void j(String s) {
Packet3Chat packet3chat = new Packet3Chat(s); Packet3Chat packet3chat = new Packet3Chat(s);
for (int i = 0; i < this.b.size(); ++i) { for (int i = 0; i < this.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i); EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
if (this.g(entityplayer.name)) { if (this.h(entityplayer.name)) {
entityplayer.a.b((Packet) packet3chat); entityplayer.a.b((Packet) packet3chat);
} }
} }
} }
public boolean a(String s, Packet packet) { public boolean a(String s, Packet packet) {
EntityPlayer entityplayer = this.h(s); EntityPlayer entityplayer = this.i(s);
if (entityplayer != null) { if (entityplayer != null) {
entityplayer.a.b(packet); entityplayer.a.b(packet);
@ -416,9 +464,27 @@ public class ServerConfigurationManager {
public void d() { public void d() {
for (int i = 0; i < this.b.size(); ++i) { for (int i = 0; i < this.b.size(); ++i) {
this.l.a((EntityPlayer) this.b.get(i)); this.n.a((EntityHuman) this.b.get(i));
} }
} }
public void a(int i, int j, int k, TileEntity tileentity) {} public void a(int i, int j, int k, TileEntity tileentity) {}
}
public void k(String s) {
this.i.add(s);
this.n();
}
public void l(String s) {
this.i.remove(s);
this.n();
}
public Set e() {
return this.i;
}
public void f() {
this.m();
}
}

View File

@ -2,49 +2,49 @@ package net.minecraft.server;
public class Slot { public class Slot {
public final int a; // CraftBukkit: private -> public public final int d; // CraftBukkit: private -> public
public final IInventory b; // CraftBukkit: private -> public public final IInventory e; // CraftBukkit: private -> public
public int a;
public int b;
public int c; public int c;
public int d;
public int e;
public Slot(IInventory iinventory, int i, int j, int k) { public Slot(IInventory iinventory, int i, int j, int k) {
this.b = iinventory; this.e = iinventory;
this.a = i; this.d = i;
this.d = j; this.b = j;
this.e = k; this.c = k;
} }
public void b() { public void a() {
this.d(); this.c();
} }
public boolean a(ItemStack itemstack) { public boolean a(ItemStack itemstack) {
return true; return true;
} }
public ItemStack c() { public ItemStack b() {
return this.b.a(this.a); return this.e.c_(this.d);
} }
public void b(ItemStack itemstack) { public void b(ItemStack itemstack) {
this.b.a(this.a, itemstack); this.e.a(this.d, itemstack);
this.d(); this.c();
} }
public void d() { public void c() {
this.b.d(); this.e.h();
} }
public int a() { public int d() {
return this.b.c(); return this.e.n_();
} }
public ItemStack a(int i) { public ItemStack a(int i) {
return this.b.b(this.a, i); return this.e.a(this.d, i);
} }
public boolean a(IInventory iinventory, int i) { public boolean a(IInventory iinventory, int i) {
return iinventory == this.b && i == this.a; return iinventory == this.e && i == this.d;
} }
} }

View File

@ -2,40 +2,40 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory { public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack[] e = new ItemStack[27]; //Craftbukkit private ItemStack[] a = new ItemStack[27]; //Craftbukkit
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
return e; return a;
} }
// CraftBukkit end // CraftBukkit end
public TileEntityChest() {} public TileEntityChest() {}
public int h_() { public int m_() {
return this.e.length; // Craftbukkit return 27;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return this.e[i]; return this.a[i];
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.e[i] != null) { if (this.a[i] != null) {
ItemStack itemstack; ItemStack itemstack;
if (this.e[i].count <= j) { if (this.a[i].count <= j) {
itemstack = this.e[i]; itemstack = this.a[i];
this.e[i] = null; this.a[i] = null;
this.d(); this.h();
return itemstack; return itemstack;
} else { } else {
itemstack = this.e[i].a(j); itemstack = this.a[i].a(j);
if (this.e[i].count == 0) { if (this.a[i].count == 0) {
this.e[i] = null; this.a[i] = null;
} }
this.d(); this.h();
return itemstack; return itemstack;
} }
} else { } else {
@ -44,30 +44,30 @@ public class TileEntityChest extends TileEntity implements IInventory {
} }
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
this.e[i] = itemstack; this.a[i] = itemstack;
if (itemstack != null && itemstack.count > this.c()) { if (itemstack != null && itemstack.count > this.n_()) {
itemstack.count = this.c(); itemstack.count = this.n_();
} }
this.d(); this.h();
} }
public String b() { public String c() {
return "Chest"; return "Chest";
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Items"); NBTTagList nbttaglist = nbttagcompound.l("Items");
this.e = new ItemStack[this.h_()]; this.a = new ItemStack[this.m_()];
for (int i = 0; i < nbttaglist.b(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.b("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.e.length) { if (j >= 0 && j < this.a.length) {
this.e[j] = new ItemStack(nbttagcompound1); this.a[j] = new ItemStack(nbttagcompound1);
} }
} }
} }
@ -76,12 +76,12 @@ public class TileEntityChest extends TileEntity implements IInventory {
super.b(nbttagcompound); super.b(nbttagcompound);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.e.length; ++i) { for (int i = 0; i < this.a.length; ++i) {
if (this.e[i] != null) { if (this.a[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.e[i].a(nbttagcompound1); this.a[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -89,11 +89,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.a("Items", (NBTBase) nbttaglist);
} }
public int c() { public int n_() {
return 64; return 64;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; 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;
} }
} }

View File

@ -1,120 +1,120 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
public class TileEntityDispenser extends TileEntity implements IInventory { public class TileEntityDispenser extends TileEntity implements IInventory {
private ItemStack[] e = new ItemStack[9]; private ItemStack[] a = new ItemStack[9];
private Random f = new Random(); private Random b = new Random();
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
return e; return a;
} }
// CraftBukkit end // CraftBukkit end
public TileEntityDispenser() {} public TileEntityDispenser() {}
public int h_() { public int m_() {
return this.e.length; //Craftbukkit return 9;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return this.e[i]; return this.a[i];
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.e[i] != null) { if (this.a[i] != null) {
ItemStack itemstack; ItemStack itemstack;
if (this.e[i].count <= j) { if (this.a[i].count <= j) {
itemstack = this.e[i]; itemstack = this.a[i];
this.e[i] = null; this.a[i] = null;
this.d(); this.h();
return itemstack; return itemstack;
} else { } else {
itemstack = this.e[i].a(j); itemstack = this.a[i].a(j);
if (this.e[i].count == 0) { if (this.a[i].count == 0) {
this.e[i] = null; this.a[i] = null;
} }
this.d(); this.h();
return itemstack; return itemstack;
} }
} else { } else {
return null; return null;
} }
} }
public ItemStack e() { public ItemStack b() {
int i = -1; int i = -1;
int j = 1; int j = 1;
for (int k = 0; k < this.e.length; ++k) { for (int k = 0; k < this.a.length; ++k) {
if (this.e[k] != null && this.f.nextInt(j) == 0) { if (this.a[k] != null && this.b.nextInt(j) == 0) {
i = k; i = k;
++j; ++j;
} }
} }
if (i >= 0) { if (i >= 0) {
return this.b(i, 1); return this.a(i, 1);
} else { } else {
return null; return null;
} }
} }
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
this.e[i] = itemstack; this.a[i] = itemstack;
if (itemstack != null && itemstack.count > this.c()) { if (itemstack != null && itemstack.count > this.n_()) {
itemstack.count = this.c(); itemstack.count = this.n_();
} }
this.d(); this.h();
} }
public String b() { public String c() {
return "Trap"; return "Trap";
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Items"); NBTTagList nbttaglist = nbttagcompound.l("Items");
this.e = new ItemStack[this.h_()]; this.a = new ItemStack[this.m_()];
for (int i = 0; i < nbttaglist.b(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.b("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.e.length) { if (j >= 0 && j < this.a.length) {
this.e[j] = new ItemStack(nbttagcompound1); this.a[j] = new ItemStack(nbttagcompound1);
} }
} }
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.e.length; ++i) { for (int i = 0; i < this.a.length; ++i) {
if (this.e[i] != null) { if (this.a[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.e[i].a(nbttagcompound1); this.a[i].a(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.a("Items", (NBTBase) nbttaglist);
} }
public int c() { public int n_() {
return 64; return 64;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; 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;
} }
} }

View File

@ -3,9 +3,9 @@ package net.minecraft.server;
public class TileEntityFurnace extends TileEntity implements IInventory { public class TileEntityFurnace extends TileEntity implements IInventory {
private ItemStack[] h = new ItemStack[3]; private ItemStack[] h = new ItemStack[3];
public int e = 0; public int a = 0;
public int f = 0; public int b = 0;
public int g = 0; public int c = 0;
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
@ -15,15 +15,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
public TileEntityFurnace() {} public TileEntityFurnace() {}
public int h_() { public int m_() {
return this.h.length; return this.h.length;
} }
public ItemStack a(int i) { public ItemStack c_(int i) {
return this.h[i]; return this.h[i];
} }
public ItemStack b(int i, int j) { public ItemStack a(int i, int j) {
if (this.h[i] != null) { if (this.h[i] != null) {
ItemStack itemstack; ItemStack itemstack;
@ -46,39 +46,39 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
public void a(int i, ItemStack itemstack) { public void a(int i, ItemStack itemstack) {
this.h[i] = itemstack; this.h[i] = itemstack;
if (itemstack != null && itemstack.count > this.c()) { if (itemstack != null && itemstack.count > this.n_()) {
itemstack.count = this.c(); itemstack.count = this.n_();
} }
} }
public String b() { public String c() {
return "Furnace"; return "Furnace";
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.k("Items"); NBTTagList nbttaglist = nbttagcompound.l("Items");
this.h = new ItemStack[this.h_()]; this.h = new ItemStack[this.m_()];
for (int i = 0; i < nbttaglist.b(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
byte b0 = nbttagcompound1.b("Slot"); byte b0 = nbttagcompound1.c("Slot");
if (b0 >= 0 && b0 < this.h.length) { if (b0 >= 0 && b0 < this.h.length) {
this.h[b0] = new ItemStack(nbttagcompound1); this.h[b0] = new ItemStack(nbttagcompound1);
} }
} }
this.e = nbttagcompound.c("BurnTime"); this.a = nbttagcompound.d("BurnTime");
this.g = nbttagcompound.c("CookTime"); this.c = nbttagcompound.d("CookTime");
this.f = this.a(this.h[1]); this.b = this.a(this.h[1]);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("BurnTime", (short) this.e); nbttagcompound.a("BurnTime", (short) this.a);
nbttagcompound.a("CookTime", (short) this.g); nbttagcompound.a("CookTime", (short) this.c);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.h.length; ++i) { for (int i = 0; i < this.h.length; ++i) {
@ -94,26 +94,26 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.a("Items", (NBTBase) nbttaglist);
} }
public int c() { public int n_() {
return 64; return 64;
} }
public boolean e() { public boolean f() {
return this.e > 0; return this.a > 0;
} }
public void f() { public void i_() {
boolean flag = this.e > 0; boolean flag = this.a > 0;
boolean flag1 = false; boolean flag1 = false;
if (this.e > 0) { if (this.a > 0) {
--this.e; --this.a;
} }
if (!this.a.isStatic) { if (!this.d.isStatic) {
if (this.e == 0 && this.i()) { if (this.a == 0 && this.i()) {
this.f = this.e = this.a(this.h[1]); this.b = this.a = this.a(this.h[1]);
if (this.e > 0) { if (this.a > 0) {
flag1 = true; flag1 = true;
if (this.h[1] != null) { if (this.h[1] != null) {
--this.h[1].count; --this.h[1].count;
@ -124,25 +124,25 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
} }
} }
if (this.e() && this.i()) { if (this.f() && this.i()) {
++this.g; ++this.c;
if (this.g == 200) { if (this.c == 200) {
this.g = 0; this.c = 0;
this.h(); this.g();
flag1 = true; flag1 = true;
} }
} else { } else {
this.g = 0; this.c = 0;
} }
if (flag != this.e > 0) { if (flag != this.a > 0) {
flag1 = true; flag1 = true;
BlockFurnace.a(this.e > 0, this.a, this.b, this.c, this.d); BlockFurnace.a(this.a > 0, this.d, this.e, this.f, this.g);
} }
} }
if (flag1) { if (flag1) {
this.d(); this.h();
} }
} }
@ -152,11 +152,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
} else { } else {
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.c() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b()))); return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.n_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b())));
} }
} }
public void h() { public void g() {
if (this.i()) { if (this.i()) {
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
@ -184,6 +184,6 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
} }
public boolean a_(EntityHuman entityhuman) { public boolean a_(EntityHuman entityhuman) {
return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; 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;
} }
} }

View File

@ -2,13 +2,13 @@ package net.minecraft.server;
public class TileEntityMobSpawner extends TileEntity { public class TileEntityMobSpawner extends TileEntity {
public int e = -1; public int a = -1;
public String h = "Pig"; // CraftBukkit private -> public public String h = "Pig"; // CraftBukkit private -> public
public double f; public double b;
public double g = 0.0D; public double c = 0.0D;
public TileEntityMobSpawner() { public TileEntityMobSpawner() {
this.e = 20; this.a = 20;
} }
public void a(String s) { public void a(String s) {
@ -16,34 +16,34 @@ public class TileEntityMobSpawner extends TileEntity {
} }
public boolean a() { public boolean a() {
return this.a.a((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D, 16.0D) != null; return this.d.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null;
} }
public void f() { public void i_() {
this.g = this.f; this.c = this.b;
if (this.a()) { if (this.a()) {
double d0 = (double) ((float) this.b + this.a.l.nextFloat()); double d0 = (double) ((float) this.e + this.d.k.nextFloat());
double d1 = (double) ((float) this.c + this.a.l.nextFloat()); double d1 = (double) ((float) this.f + this.d.k.nextFloat());
double d2 = (double) ((float) this.d + this.a.l.nextFloat()); double d2 = (double) ((float) this.g + this.d.k.nextFloat());
this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
for (this.f += (double) (1000.0F / ((float) this.e + 200.0F)); this.f > 360.0D; this.g -= 360.0D) { for (this.b += (double) (1000.0F / ((float) this.a + 200.0F)); this.b > 360.0D; this.c -= 360.0D) {
this.f -= 360.0D; this.b -= 360.0D;
} }
if (this.e == -1) { if (this.a == -1) {
this.b(); this.c();
} }
if (this.e > 0) { if (this.a > 0) {
--this.e; --this.a;
} else { } else {
byte b0 = 4; byte b0 = 4;
for (int i = 0; i < b0; ++i) { for (int i = 0; i < b0; ++i) {
EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.a)); EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.d));
if (entityliving == null) { if (entityliving == null) {
return; return;
@ -51,59 +51,59 @@ public class TileEntityMobSpawner extends TileEntity {
// CraftBukkit start - The world we're spawning in accepts this creature // CraftBukkit start - The world we're spawning in accepts this creature
boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal; boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal;
if ((isAnimal && !this.a.L) || (!isAnimal && !this.a.K)) { if ((isAnimal && !this.d.E) || (!isAnimal && !this.d.D)) {
return; return;
} }
// CraftBukkit end // CraftBukkit end
int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size(); 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();
if (j >= 6) { if (j >= 6) {
this.b(); this.c();
return; return;
} }
if (entityliving != null) { if (entityliving != null) {
double d3 = (double) this.b + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D; double d3 = (double) this.e + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
double d4 = (double) (this.c + this.a.l.nextInt(3) - 1); double d4 = (double) (this.f + this.d.k.nextInt(3) - 1);
double d5 = (double) this.d + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D; double d5 = (double) this.g + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
entityliving.c(d3, d4, d5, this.a.l.nextFloat() * 360.0F, 0.0F); entityliving.c(d3, d4, d5, this.d.k.nextFloat() * 360.0F, 0.0F);
if (entityliving.b()) { if (entityliving.b()) {
this.a.a((Entity) entityliving); this.d.a((Entity) entityliving);
for (int k = 0; k < 20; ++k) { for (int k = 0; k < 20; ++k) {
d0 = (double) this.b + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; d0 = (double) this.e + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
d1 = (double) this.c + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; d1 = (double) this.f + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
d2 = (double) this.d + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D; d2 = (double) this.g + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
} }
entityliving.R(); entityliving.I();
this.b(); this.c();
} }
} }
} }
super.f(); super.i_();
} }
} }
} }
private void b() { private void c() {
this.e = 200 + this.a.l.nextInt(600); this.a = 200 + this.d.k.nextInt(600);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.h = nbttagcompound.h("EntityId"); this.h = nbttagcompound.i("EntityId");
this.e = nbttagcompound.c("Delay"); this.a = nbttagcompound.d("Delay");
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("EntityId", this.h); nbttagcompound.a("EntityId", this.h);
nbttagcompound.a("Delay", (short) this.e); nbttagcompound.a("Delay", (short) this.a);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,147 @@
package net.minecraft.server;
import java.util.List;
public class WorldData {
private long a;
private int b;
private int c;
private int d;
private long e;
private long f;
private long g;
private NBTTagCompound h;
private int i;
public String j; // CraftBukkit private->public
private int k;
public WorldData(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.f("RandomSeed");
this.b = nbttagcompound.e("SpawnX");
this.c = nbttagcompound.e("SpawnY");
this.d = nbttagcompound.e("SpawnZ");
this.e = nbttagcompound.f("Time");
this.f = nbttagcompound.f("LastPlayed");
this.g = nbttagcompound.f("SizeOnDisk");
this.j = nbttagcompound.i("LevelName");
this.k = nbttagcompound.e("version");
if (nbttagcompound.b("Player")) {
this.h = nbttagcompound.k("Player");
this.i = this.h.e("Dimension");
}
}
public WorldData(long i, String s) {
this.a = i;
this.j = s;
}
public WorldData(WorldData worlddata) {
this.a = worlddata.a;
this.b = worlddata.b;
this.c = worlddata.c;
this.d = worlddata.d;
this.e = worlddata.e;
this.f = worlddata.f;
this.g = worlddata.g;
this.h = worlddata.h;
this.i = worlddata.i;
this.j = worlddata.j;
this.k = worlddata.k;
}
public NBTTagCompound a() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.a(nbttagcompound, this.h);
return nbttagcompound;
}
public NBTTagCompound a(List list) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
EntityHuman entityhuman = null;
NBTTagCompound nbttagcompound1 = null;
if (list.size() > 0) {
entityhuman = (EntityHuman) list.get(0);
}
if (entityhuman != null) {
nbttagcompound1 = new NBTTagCompound();
entityhuman.d(nbttagcompound1);
}
this.a(nbttagcompound, nbttagcompound1);
return nbttagcompound;
}
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
nbttagcompound.a("RandomSeed", this.a);
nbttagcompound.a("SpawnX", this.b);
nbttagcompound.a("SpawnY", this.c);
nbttagcompound.a("SpawnZ", this.d);
nbttagcompound.a("Time", this.e);
nbttagcompound.a("SizeOnDisk", this.g);
nbttagcompound.a("LastPlayed", System.currentTimeMillis());
nbttagcompound.a("LevelName", this.j);
nbttagcompound.a("version", this.k);
if (nbttagcompound1 != null) {
nbttagcompound.a("Player", nbttagcompound1);
}
}
public long b() {
return this.a;
}
public int c() {
return this.b;
}
public int d() {
return this.c;
}
public int e() {
return this.d;
}
public long f() {
return this.e;
}
public long g() {
return this.g;
}
public int h() {
return this.i;
}
public void a(long i) {
this.e = i;
}
public void b(long i) {
this.g = i;
}
public void a(int i, int j, int k) {
this.b = i;
this.c = j;
this.d = k;
}
public void a(String s) {
this.j = s;
}
public int i() {
return this.k;
}
public void a(int i) {
this.k = i;
}
}

View File

@ -1,100 +1,100 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end // CraftBukkit end
public class WorldGenTrees extends WorldGenerator { public class WorldGenTrees extends WorldGenerator {
public WorldGenTrees() {} public WorldGenTrees() {}
public boolean a(World world, Random random, int i, int j, int k) { public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start // CraftBukkit start
// sk: The idea is to have (our) WorldServer implement // sk: The idea is to have (our) WorldServer implement
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // then allows plugins to catch manually-invoked generation events
return generate((BlockChangeDelegate)world, random, i, j, k); return generate((BlockChangeDelegate)world, random, i, j, k);
} }
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end // CraftBukkit end
int l = random.nextInt(3) + 4; int l = random.nextInt(3) + 4;
boolean flag = true; boolean flag = true;
if (j >= 1 && j + l + 1 <= 128) { if (j >= 1 && j + l + 1 <= 128) {
int i1; int i1;
int j1; int j1;
int k1; int k1;
int l1; int l1;
for (i1 = j; i1 <= j + 1 + l; ++i1) { for (i1 = j; i1 <= j + 1 + l; ++i1) {
byte b0 = 1; byte b0 = 1;
if (i1 == j) { if (i1 == j) {
b0 = 0; b0 = 0;
} }
if (i1 >= j + 1 + l - 2) { if (i1 >= j + 1 + l - 2) {
b0 = 2; b0 = 2;
} }
for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) { for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) { for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
if (i1 >= 0 && i1 < 128) { if (i1 >= 0 && i1 < 128) {
l1 = world.getTypeId(j1, i1, k1); l1 = world.getTypeId(j1, i1, k1);
if (l1 != 0 && l1 != Block.LEAVES.id) { if (l1 != 0 && l1 != Block.LEAVES.id) {
flag = false; flag = false;
} }
} else { } else {
flag = false; flag = false;
} }
} }
} }
} }
if (!flag) { if (!flag) {
return false; return false;
} else { } else {
i1 = world.getTypeId(i, j - 1, k); i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) { if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
world.setTypeId(i, j - 1, k, Block.DIRT.id); world.setTypeId(i, j - 1, k, Block.DIRT.id);
int i2; int i2;
for (i2 = j - 3 + l; i2 <= j + l; ++i2) { for (i2 = j - 3 + l; i2 <= j + l; ++i2) {
j1 = i2 - (j + l); j1 = i2 - (j + l);
k1 = 1 - j1 / 2; k1 = 1 - j1 / 2;
for (l1 = i - k1; l1 <= i + k1; ++l1) { for (l1 = i - k1; l1 <= i + k1; ++l1) {
int j2 = l1 - i; int j2 = l1 - i;
for (int k2 = k - k1; k2 <= k + k1; ++k2) { for (int k2 = k - k1; k2 <= k + k1; ++k2) {
int l2 = k2 - k; 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)]) { 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.setTypeId(l1, i2, k2, Block.LEAVES.id);
} }
} }
} }
} }
for (i2 = 0; i2 < l; ++i2) { for (i2 = 0; i2 < l; ++i2) {
j1 = world.getTypeId(i, j + i2, k); j1 = world.getTypeId(i, j + i2, k);
if (j1 == 0 || j1 == Block.LEAVES.id) { if (j1 == 0 || j1 == Block.LEAVES.id) {
world.setTypeId(i, j + i2, k, Block.LOG.id); world.setTypeId(i, j + i2, k, Block.LOG.id);
} }
} }
return true; return true;
} else { } else {
return false; return false;
} }
} }
} else { } else {
return false; return false;
} }
} }
} }

View File

@ -13,16 +13,16 @@ import org.bukkit.craftbukkit.CraftWorld;
public class WorldServer extends World implements BlockChangeDelegate { public class WorldServer extends World implements BlockChangeDelegate {
// CraftBukkit end // CraftBukkit end
public ChunkProviderServer A; public ChunkProviderServer u;
public boolean B = false; public boolean v = false;
public boolean C; public boolean w;
public final MinecraftServer D; // Craftbukkit public final MinecraftServer x; // Craftbukkit - private -> public final
private EntityList E = new EntityList(); private EntityList y = new EntityList();
public PlayerManager manager; // Craftbukkit public PlayerManager manager; // Craftbukkit
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) { public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) {
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i)); super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i));
this.D = minecraftserver; this.x = minecraftserver;
// CraftBukkit start // CraftBukkit start
this.server = minecraftserver.server; this.server = minecraftserver.server;
@ -42,14 +42,10 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
// CraftBukkit end // CraftBukkit end
public void f() {
super.f();
}
public void a(Entity entity, boolean flag) { public void a(Entity entity, boolean flag) {
// CraftBukkit start -- We prevent spawning in general, so this butching is not needed // CraftBukkit start -- We prevent spawning in general, so this butchering is not needed
//if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { //if (!this.x.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
// entity.q(); // entity.C();
//} //}
// CraftBukkit end // CraftBukkit end
@ -62,9 +58,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
super.a(entity, flag); super.a(entity, flag);
} }
protected IChunkProvider a(File file1) { protected IChunkProvider b() {
this.A = new ChunkProviderServer(this, this.q.a(file1), this.q.c()); IChunkLoader ichunkloader = this.p.a(this.m);
return this.A;
this.u = new ChunkProviderServer(this, ichunkloader, this.m.c());
return this.u;
} }
public List d(int i, int j, int k, int l, int i1, int j1) { public List d(int i, int j, int k, int l, int i1, int j1) {
@ -73,7 +71,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
for (int k1 = 0; k1 < this.c.size(); ++k1) { for (int k1 = 0; k1 < this.c.size(); ++k1) {
TileEntity tileentity = (TileEntity) this.c.get(k1); TileEntity tileentity = (TileEntity) this.c.get(k1);
if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) { if (tileentity.e >= i && tileentity.f >= j && tileentity.g >= k && tileentity.e < l && tileentity.f < i1 && tileentity.g < j1) {
arraylist.add(tileentity); arraylist.add(tileentity);
} }
} }
@ -82,34 +80,34 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
public boolean a(EntityHuman entityhuman, int i, int j, int k) { public boolean a(EntityHuman entityhuman, int i, int j, int k) {
int l = (int) MathHelper.e((float) (i - this.spawnX)); int l = (int) MathHelper.e((float) (i - this.q.c()));
int i1 = (int) MathHelper.e((float) (k - this.spawnZ)); int i1 = (int) MathHelper.e((float) (k - this.q.e()));
if (l > i1) { if (l > i1) {
i1 = l; i1 = l;
} }
return i1 > this.D.spawnProtection || this.D.f.g(entityhuman.name); // CraftBukkit Configurable spawn protection start return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name); // CraftBukkit Configurable spawn protection start
} }
protected void b(Entity entity) { protected void b(Entity entity) {
super.b(entity); super.b(entity);
this.E.a(entity.id, entity); this.y.a(entity.id, entity);
} }
protected void c(Entity entity) { protected void c(Entity entity) {
super.c(entity); super.c(entity);
this.E.d(entity.id); this.y.d(entity.id);
} }
public Entity a(int i) { public Entity a(int i) {
return (Entity) this.E.a(i); return (Entity) this.y.a(i);
} }
public void a(Entity entity, byte b0) { public void a(Entity entity, byte b0) {
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0); Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
this.D.k.b(entity, packet38entitystatus); this.x.k.b(entity, packet38entitystatus);
} }
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) { public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
@ -121,12 +119,16 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
// Craftbukkit end // Craftbukkit end
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g)); this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
return explosion; return explosion;
} }
public void c(int i, int j, int k, int l, int i1) { public void d(int i, int j, int k, int l, int i1) {
super.c(i, j, k, l, i1); super.d(i, j, k, l, i1);
this.D.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1)); this.x.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
}
public void r() {
this.p.e();
} }
} }

View File

@ -9,10 +9,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPlayer;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PropertyManager; import net.minecraft.server.PropertyManager;
import net.minecraft.server.ServerConfigurationManager; import net.minecraft.server.ServerConfigurationManager;
import net.minecraft.server.ServerNBTManager;
import net.minecraft.server.WorldManager; import net.minecraft.server.WorldManager;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
import org.bukkit.*; import org.bukkit.*;
@ -177,14 +179,14 @@ public final class CraftServer implements Server {
console.d = config; console.d = config;
boolean animals = config.a("spawn-monsters", console.m); boolean animals = config.a("spawn-monsters", console.m);
boolean monsters = config.a("spawn-monsters", console.worlds.get(0).k > 0); boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0);
console.l = config.a("online-mode", console.l); console.l = config.a("online-mode", console.l);
console.m = config.a("spawn-animals", console.m); console.m = config.a("spawn-animals", console.m);
console.n = config.a("pvp", console.n); console.n = config.a("pvp", console.n);
for (WorldServer world : console.worlds) { for (WorldServer world : console.worlds) {
world.k = monsters ? 1 : 0; world.j = monsters ? 1 : 0;
world.a(monsters, animals); world.a(monsters, animals);
} }
@ -210,10 +212,10 @@ public final class CraftServer implements Server {
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
} }
WorldServer internal = new WorldServer(console, new File("."), name, environment == World.Environment.NETHER ? -1 : 0); WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0);
internal.a(new WorldManager(console, internal)); internal.a(new WorldManager(console, internal));
internal.k = 1; internal.j = 1;
internal.a(true, true); internal.a(true, true);
console.f.a(internal); console.f.a(internal);
console.worlds.add(internal); console.worlds.add(internal);
@ -236,9 +238,10 @@ public final class CraftServer implements Server {
i = l; i = l;
} }
internal.A.d(internal.spawnX + j >> 4, internal.spawnZ + k >> 4); ChunkCoordinates chunkcoordinates = internal.l();
internal.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
while (internal.d()) { while (internal.e()) {
; ;
} }
} }

View File

@ -33,9 +33,9 @@ public class CraftWorld implements World {
public CraftWorld(WorldServer world) { public CraftWorld(WorldServer world) {
this.world = world; this.world = world;
this.server = world.getServer(); this.server = world.getServer();
this.provider = world.A; this.provider = world.u;
if (world.q instanceof WorldProviderHell) { if (world.m instanceof WorldProviderHell) {
environment = Environment.NETHER; environment = Environment.NETHER;
} else { } else {
environment = Environment.NORMAL; environment = Environment.NORMAL;
@ -65,7 +65,8 @@ public class CraftWorld implements World {
} }
public Location getSpawnLocation() { public Location getSpawnLocation() {
return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ); ChunkCoordinates spawn = world.l();
return new Location(this, spawn.a, world.e(spawn.a, spawn.c), spawn.c);
} }
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
@ -225,9 +226,9 @@ public class CraftWorld implements World {
} }
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
double xs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
double ys = world.l.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.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double zs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
loc = loc.clone(); loc = loc.clone();
loc.setX(loc.getX() + xs); loc.setX(loc.getX() + xs);
loc.setY(loc.getY() + ys); loc.setY(loc.getY() + ys);
@ -324,11 +325,11 @@ public class CraftWorld implements World {
} }
public String getName() { public String getName() {
return world.w; return world.q.j;
} }
public long getId() { public long getId() {
return world.u; return world.q.b();
} }
@Override @Override
@ -349,11 +350,11 @@ public class CraftWorld implements World {
} }
public long getFullTime() { public long getFullTime() {
return world.e; return world.k();
} }
public void setFullTime(long time) { public void setFullTime(long time) {
world.e = time; world.a(time);
} }
public Environment getEnvironment() { public Environment getEnvironment() {

View File

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -349,7 +348,7 @@ public class CraftBlock implements Block {
} }
public boolean isBlockFacePowered(BlockFace face) { public boolean isBlockFacePowered(BlockFace face) {
return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face)); return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face));
} }
public boolean isBlockFaceIndirectlyPowered(BlockFace face) { public boolean isBlockFaceIndirectlyPowered(BlockFace face) {

View File

@ -1,40 +1,40 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityChest; import net.minecraft.server.TileEntityChest;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Chest; import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
/** /**
* Represents a chest. * Represents a chest.
* *
* @author sk89q * @author sk89q
*/ */
public class CraftChest extends CraftBlockState implements Chest { public class CraftChest extends CraftBlockState implements Chest {
private final CraftWorld world; private final CraftWorld world;
private final TileEntityChest chest; private final TileEntityChest chest;
public CraftChest(final Block block) { public CraftChest(final Block block) {
super(block); super(block);
world = (CraftWorld)block.getWorld(); world = (CraftWorld)block.getWorld();
chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ()); chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ());
} }
public Inventory getInventory() { public Inventory getInventory() {
return new CraftInventory(chest); return new CraftInventory(chest);
} }
@Override @Override
public boolean update(boolean force) { public boolean update(boolean force) {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
chest.d(); chest.h();
} }
return result; return result;
} }
} }

View File

@ -1,84 +1,84 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityMobSpawner; import net.minecraft.server.TileEntityMobSpawner;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner; import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.MobSpawner; import org.bukkit.block.MobSpawner;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
import org.bukkit.entity.MobType; import org.bukkit.entity.MobType;
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner { public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner {
private final CraftWorld world; private final CraftWorld world;
private final TileEntityMobSpawner spawner; private final TileEntityMobSpawner spawner;
public CraftCreatureSpawner(final Block block) { public CraftCreatureSpawner(final Block block) {
super(block); super(block);
world = (CraftWorld)block.getWorld(); world = (CraftWorld)block.getWorld();
spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ()); spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ());
} }
public CreatureType getCreatureType() { public CreatureType getCreatureType() {
return CreatureType.fromName(spawner.h); return CreatureType.fromName(spawner.h);
} }
public void setCreatureType(CreatureType creatureType) { public void setCreatureType(CreatureType creatureType) {
spawner.h = creatureType.getName(); spawner.h = creatureType.getName();
} }
public String getCreatureTypeId() { public String getCreatureTypeId() {
return spawner.h; return spawner.h;
} }
public void setCreatureTypeId(String creatureType) { public void setCreatureTypeId(String creatureType) {
// Verify input // Verify input
CreatureType type = CreatureType.fromName(creatureType); CreatureType type = CreatureType.fromName(creatureType);
if (type == null) { if (type == null) {
return; return;
} }
spawner.h = type.getName(); spawner.h = type.getName();
} }
public int getDelay() { public int getDelay() {
return spawner.e; return spawner.a;
} }
public void setDelay(int delay) { public void setDelay(int delay) {
spawner.e = delay; spawner.a = delay;
} }
/** /**
* @deprecated Use getCreatureType() instead. * @deprecated Use getCreatureType() instead.
*/ */
public MobType getMobType() { public MobType getMobType() {
return MobType.fromName(spawner.h); return MobType.fromName(spawner.h);
} }
/** /**
* @deprecated Use setCreatureType() instead. * @deprecated Use setCreatureType() instead.
*/ */
public void setMobType(MobType mobType) { public void setMobType(MobType mobType) {
spawner.h = mobType.getName(); spawner.h = mobType.getName();
} }
/** /**
* @deprecated Use getCreatureTypeId() instead. * @deprecated Use getCreatureTypeId() instead.
*/ */
public String getMobTypeId() { public String getMobTypeId() {
return spawner.h; return spawner.h;
} }
/** /**
* @deprecated Use setCreatureTypeId() instead. * @deprecated Use setCreatureTypeId() instead.
*/ */
public void setMobTypeId(String mobType) { public void setMobTypeId(String mobType) {
// Verify input // Verify input
MobType type = MobType.fromName(mobType); MobType type = MobType.fromName(mobType);
if (type == null) { if (type == null) {
return; return;
} }
spawner.h = type.getName(); spawner.h = type.getName();
} }
} }

View File

@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
dispenser.d(); dispenser.h();
} }
return result; return result;

View File

@ -1,56 +1,56 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityFurnace; import net.minecraft.server.TileEntityFurnace;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Furnace; import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
/** /**
* Represents a furnace. * Represents a furnace.
* *
* @author sk89q * @author sk89q
*/ */
public class CraftFurnace extends CraftBlockState implements Furnace { public class CraftFurnace extends CraftBlockState implements Furnace {
private final CraftWorld world; private final CraftWorld world;
private final TileEntityFurnace furnace; private final TileEntityFurnace furnace;
public CraftFurnace(final Block block) { public CraftFurnace(final Block block) {
super(block); super(block);
world = (CraftWorld)block.getWorld(); world = (CraftWorld)block.getWorld();
furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ()); furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ());
} }
public Inventory getInventory() { public Inventory getInventory() {
return new CraftInventory(furnace); return new CraftInventory(furnace);
} }
@Override @Override
public boolean update(boolean force) { public boolean update(boolean force) {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
furnace.d(); furnace.h();
} }
return result; return result;
} }
public short getBurnTime() { public short getBurnTime() {
return (short)furnace.e; return (short)furnace.a;
} }
public void setBurnTime(short burnTime) { public void setBurnTime(short burnTime) {
furnace.e = burnTime; furnace.a = burnTime;
} }
public short getCookTime() { public short getCookTime() {
return (short)furnace.g; return (short)furnace.c;
} }
public void setCookTime(short cookTime) { public void setCookTime(short cookTime) {
furnace.g = cookTime; furnace.c = cookTime;
} }
} }

View File

@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
} }
public byte getNote() { public byte getNote() {
return note.e; return note.a;
} }
public void setNote(byte n) { public void setNote(byte n) {
note.e = n; note.a = n;
} }
public boolean play() { public boolean play() {

View File

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntitySign; import net.minecraft.server.TileEntitySign;
@ -18,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign {
} }
public String[] getLines() { public String[] getLines() {
return sign.e; return sign.a;
} }
public String getLine(int index) throws IndexOutOfBoundsException { public String getLine(int index) throws IndexOutOfBoundsException {
return sign.e[index]; return sign.a[index];
} }
public void setLine(int index, String line) throws IndexOutOfBoundsException { public void setLine(int index, String line) throws IndexOutOfBoundsException {
sign.e[index] = line; sign.a[index] = line;
} }
@Override @Override
@ -34,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
sign.d(); sign.h();
} }
return result; return result;

View File

@ -160,7 +160,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
newEntity.inventory.e = newEntity; newEntity.inventory.e = newEntity;
newEntity.activeContainer = entity.activeContainer; newEntity.activeContainer = entity.activeContainer;
newEntity.defaultContainer = entity.defaultContainer; newEntity.defaultContainer = entity.defaultContainer;
newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4); newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
newWorld.manager.a(newEntity); newWorld.manager.a(newEntity);

View File

@ -19,12 +19,12 @@ public class CraftSheep extends CraftAnimals implements Sheep {
public DyeColor getColor() { public DyeColor getColor() {
EntitySheep entity = (EntitySheep) getHandle(); EntitySheep entity = (EntitySheep) getHandle();
return DyeColor.getByData((byte) entity.e_()); return DyeColor.getByData((byte) entity.n());
} }
public void setColor(DyeColor color) { public void setColor(DyeColor color) {
EntitySheep entity = (EntitySheep) getHandle(); EntitySheep entity = (EntitySheep) getHandle();
entity.a(color.getData()); entity.a_(color.getData());
} }
} }

View File

@ -19,15 +19,15 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
public int getSize() { public int getSize() {
return getInventory().h_(); return getInventory().m_();
} }
public String getName() { public String getName() {
return getInventory().b(); return getInventory().c();
} }
public CraftItemStack getItem(int index) { public CraftItemStack getItem(int index) {
return new CraftItemStack(getInventory().a(index)); return new CraftItemStack(getInventory().c_(index));
} }
public CraftItemStack[] getContents() { public CraftItemStack[] getContents() {
@ -290,7 +290,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
private int getMaxItemStack() { private int getMaxItemStack() {
return getInventory().c(); return getInventory().n_();
} }
public void remove(int materialId) { public void remove(int materialId) {

View File

@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
} }
public CraftItemStack getItemInHand() { public CraftItemStack getItemInHand() {
return new CraftItemStack( getInventory().e() ); return new CraftItemStack( getInventory().b() );
} }
public void setItemInHand(ItemStack stack) { public void setItemInHand(ItemStack stack) {

View File

@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
} }
public Inventory getInventory() { public Inventory getInventory() {
return new CraftInventory( slot.b ); return new CraftInventory( slot.e );
} }
public int getIndex() { public int getIndex() {
return slot.a; return slot.d;
} }
public ItemStack getItem() { public ItemStack getItem() {
return new CraftItemStack( slot.c() ); return new CraftItemStack( slot.b() );
} }
} }