Port to new mc-dev format.
Dieser Commit ist enthalten in:
Ursprung
d0cd8c6cc7
Commit
df69047324
2
pom.xml
2
pom.xml
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.2_01</version>
|
||||
<version>1.2_01_01</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -17,8 +17,8 @@ import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
public class BlockButton extends Block {
|
||||
|
||||
protected BlockButton(int i, int j) {
|
||||
super(i, j, Material.n);
|
||||
a(true);
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
@ -34,35 +34,30 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
if (world.d(i - 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.d(i + 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.d(i, j, k - 1)) {
|
||||
return true;
|
||||
}
|
||||
return 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) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
|
||||
i1 &= 7;
|
||||
if (l == 2 && world.d(i, j, k + 1)) {
|
||||
i1 = 4;
|
||||
}
|
||||
|
||||
if (l == 3 && world.d(i, j, k - 1)) {
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
if (l == 4 && world.d(i + 1, j, k)) {
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5 && world.d(i - 1, j, k)) {
|
||||
i1 = 1;
|
||||
}
|
||||
|
||||
world.c(i, j, k, i1 + j1);
|
||||
}
|
||||
|
||||
@ -76,36 +71,41 @@ public class BlockButton extends Block {
|
||||
} else if (world.d(i, j, k + 1)) {
|
||||
world.c(i, j, k, 4);
|
||||
}
|
||||
g(world, i, j, k);
|
||||
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
if (g(world, i, j, k)) {
|
||||
int i1 = world.b(i, j, k) & 7;
|
||||
if (this.g(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.d(i - 1, j, k) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i + 1, j, k) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j, k - 1) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j, k + 1) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (!a(world, i, j, k)) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
if (!this.a(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -114,7 +114,7 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.b(i, j, k);
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) > 0;
|
||||
float f = 0.375F;
|
||||
@ -125,122 +125,113 @@ public class BlockButton extends Block {
|
||||
if (flag) {
|
||||
f3 = 0.0625F;
|
||||
}
|
||||
|
||||
if (i1 == 1) {
|
||||
a(0.0F, f, 0.5F - f2, f3, f1, 0.5F + f2);
|
||||
this.a(0.0F, f, 0.5F - f2, f3, f1, 0.5F + f2);
|
||||
} else if (i1 == 2) {
|
||||
a(1.0F - f3, f, 0.5F - f2, 1.0F, f1, 0.5F + f2);
|
||||
this.a(1.0F - f3, f, 0.5F - f2, 1.0F, f1, 0.5F + f2);
|
||||
} else if (i1 == 3) {
|
||||
a(0.5F - f2, f, 0.0F, 0.5F + f2, f1, f3);
|
||||
this.a(0.5F - f2, f, 0.0F, 0.5F + f2, f1, f3);
|
||||
} else if (i1 == 4) {
|
||||
a(0.5F - f2, f, 1.0F - f3, 0.5F + f2, f1, 1.0F);
|
||||
this.a(0.5F - f2, f, 1.0F - f3, 0.5F + f2, f1, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
a(world, i, j, k, entityplayer);
|
||||
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.a(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
// 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 = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
|
||||
if (bie.isCancelled()) {
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
// 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 (world.z) {
|
||||
return true;
|
||||
}
|
||||
int l = world.b(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
if (j1 == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Allow the lever to change the current
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, old, current);
|
||||
server.getPluginManager().callEvent(bre);
|
||||
if ((bre.getNewCurrent() > 0) == (j1 == 8)) {
|
||||
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, bi);
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, bi);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, bi);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, bi);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, bi);
|
||||
} else {
|
||||
world.h(i, j - 1, k, bi);
|
||||
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;
|
||||
} else {
|
||||
//Allow the lever to change the current
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, BlockFace.SELF, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
if ((eventRedstone.getNewCurrent() > 0) == (j1 == 8)) {
|
||||
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.i(i, j, k, bi);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
int l = world.b(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) > 0) {
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, bi);
|
||||
world.h(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, bi);
|
||||
world.h(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, bi);
|
||||
world.h(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, bi);
|
||||
world.h(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
super.b(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.b(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) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
return false;
|
||||
}
|
||||
int j1 = i1 & 7;
|
||||
} else {
|
||||
int j1 = i1 & 7;
|
||||
|
||||
if (j1 == 5 && l == 1) {
|
||||
return true;
|
||||
return j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5)));
|
||||
}
|
||||
if (j1 == 4 && l == 2) {
|
||||
return true;
|
||||
}
|
||||
if (j1 == 3 && l == 3) {
|
||||
return true;
|
||||
}
|
||||
if (j1 == 2 && l == 4) {
|
||||
return true;
|
||||
}
|
||||
return j1 == 1 && l == 5;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
@ -248,30 +239,29 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
int l = world.b(i, j, k);
|
||||
if (!world.isStatic) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) == 0) {
|
||||
return;
|
||||
}
|
||||
world.c(i, j, k, l & 7);
|
||||
world.h(i, j, k, bi);
|
||||
int i1 = l & 7;
|
||||
if ((l & 8) != 0) {
|
||||
world.c(i, j, k, l & 7);
|
||||
world.h(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, bi);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, bi);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, bi);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, bi);
|
||||
} else {
|
||||
world.h(i, j - 1, k, bi);
|
||||
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.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.b(i, j, k, i, j, k);
|
||||
}
|
||||
}
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.b(i, j, k, i, j, k);
|
||||
}
|
||||
}
|
||||
|
@ -12,22 +12,23 @@ import java.util.Random;
|
||||
public class BlockCactus extends Block {
|
||||
|
||||
protected BlockCactus(int i, int j) {
|
||||
super(i, j, Material.u);
|
||||
a(true);
|
||||
super(i, j, Material.CACTUS);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.e(i, j + 1, k)) {
|
||||
if (world.isEmpty(i, j + 1, k)) {
|
||||
int l;
|
||||
|
||||
for (l = 1; world.a(i, j - l, k) == bi; l++) {
|
||||
for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
|
||||
;
|
||||
}
|
||||
|
||||
if (l < 3) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if (i1 == 15) {
|
||||
world.e(i, j + 1, k, bi);
|
||||
world.e(i, j + 1, k, this.id);
|
||||
world.c(i, j, k, 0);
|
||||
} else {
|
||||
world.c(i, j, k, i1 + 1);
|
||||
@ -37,20 +38,13 @@ public class BlockCactus extends Block {
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
float f1 = 0.0625F;
|
||||
float f = 0.0625F;
|
||||
|
||||
return AxisAlignedBB.b((float) i + f1, j, (float) k + f1, (float) (i + 1) - f1, (float) (j + 1) - f1, (float) (k + 1) - f1);
|
||||
return AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
if (i == 1) {
|
||||
return bh - 1;
|
||||
}
|
||||
if (i == 0) {
|
||||
return bh + 1;
|
||||
} else {
|
||||
return bh;
|
||||
}
|
||||
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
@ -58,42 +52,34 @@ public class BlockCactus extends Block {
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
if (!super.a(world, i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
return 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) {
|
||||
if (!f(world, i, j, k)) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
if (!this.f(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
if (world.c(i - 1, j, k).a()) {
|
||||
if (world.getMaterial(i - 1, j, k).isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
if (world.c(i + 1, j, k).a()) {
|
||||
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
if (world.c(i, j, k - 1).a()) {
|
||||
} else if (world.getMaterial(i, j, k - 1).isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
if (world.c(i, j, k + 1).a()) {
|
||||
} else if (world.getMaterial(i, j, k + 1).isBuildable()) {
|
||||
return false;
|
||||
} else {
|
||||
int l = world.a(i, j - 1, k);
|
||||
int l = world.getTypeId(i, j - 1, k);
|
||||
|
||||
return l == Block.aV.bi || l == Block.E.bi;
|
||||
return l == Block.CACTUS.id || l == Block.SAND.id;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
|
||||
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
@ -101,16 +87,15 @@ public class BlockCactus extends Block {
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
|
||||
int damageDone = 1;
|
||||
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbbe);
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!edbbe.isCancelled()){
|
||||
entity.a(((Entity) (null)), edbbe.getDamage());
|
||||
if (!event.isCancelled()){
|
||||
entity.a((Entity) null, event.getDamage());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
entity.a(((Entity) (null)), 1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
// CraftBukkit end
|
||||
entity.a((Entity) null, 1);
|
||||
}
|
||||
}
|
||||
|
@ -14,163 +14,129 @@ import org.bukkit.event.block.BlockInteractEvent;
|
||||
|
||||
public class BlockChest extends BlockContainer {
|
||||
|
||||
private Random a;
|
||||
private Random a = new Random();
|
||||
|
||||
protected BlockChest(int i) {
|
||||
super(i, Material.c);
|
||||
a = new Random();
|
||||
bh = 26;
|
||||
super(i, Material.WOOD);
|
||||
this.textureId = 26;
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
if (i == 1) {
|
||||
return bh - 1;
|
||||
}
|
||||
if (i == 0) {
|
||||
return bh - 1;
|
||||
}
|
||||
if (i == 3) {
|
||||
return bh + 1;
|
||||
} else {
|
||||
return bh;
|
||||
}
|
||||
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId - 1 : (i == 3 ? this.textureId + 1 : this.textureId));
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
int l = 0;
|
||||
|
||||
if (world.a(i - 1, j, k) == bi) {
|
||||
l++;
|
||||
if (world.getTypeId(i - 1, j, k) == this.id) {
|
||||
++l;
|
||||
}
|
||||
if (world.a(i + 1, j, k) == bi) {
|
||||
l++;
|
||||
|
||||
if (world.getTypeId(i + 1, j, k) == this.id) {
|
||||
++l;
|
||||
}
|
||||
if (world.a(i, j, k - 1) == bi) {
|
||||
l++;
|
||||
|
||||
if (world.getTypeId(i, j, k - 1) == this.id) {
|
||||
++l;
|
||||
}
|
||||
if (world.a(i, j, k + 1) == bi) {
|
||||
l++;
|
||||
|
||||
if (world.getTypeId(i, j, k + 1) == this.id) {
|
||||
++l;
|
||||
}
|
||||
if (l > 1) {
|
||||
return false;
|
||||
}
|
||||
if (g(world, i - 1, j, k)) {
|
||||
return false;
|
||||
}
|
||||
if (g(world, i + 1, j, k)) {
|
||||
return false;
|
||||
}
|
||||
if (g(world, i, j, k - 1)) {
|
||||
return false;
|
||||
}
|
||||
return !g(world, i, j, k + 1);
|
||||
|
||||
return l > 1 ? false : (this.g(world, i - 1, j, k) ? false : (this.g(world, i + 1, j, k) ? false : (this.g(world, i, j, k - 1) ? false : !this.g(world, i, j, k + 1))));
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (world.a(i, j, k) != bi) {
|
||||
return false;
|
||||
}
|
||||
if (world.a(i - 1, j, k) == bi) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i + 1, j, k) == bi) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i, j, k - 1) == bi) {
|
||||
return true;
|
||||
}
|
||||
return world.a(i, j, k + 1) == bi;
|
||||
return world.getTypeId(i, j, k) != this.id ? false : (world.getTypeId(i - 1, j, k) == this.id ? true : (world.getTypeId(i + 1, j, k) == this.id ? true : (world.getTypeId(i, j, k - 1) == this.id ? true : world.getTypeId(i, j, k + 1) == this.id)));
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
TileEntityChest tileentitychest = (TileEntityChest) world.m(i, j, k);
|
||||
TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);
|
||||
|
||||
label0:
|
||||
for (int l = 0; l < ((IInventory) (tileentitychest)).h_(); l++) {
|
||||
ItemStack itemstack = ((IInventory) (tileentitychest)).a(l);
|
||||
for (int l = 0; l < tileentitychest.h_(); ++l) {
|
||||
ItemStack itemstack = tileentitychest.a(l);
|
||||
|
||||
if (itemstack == null) {
|
||||
continue;
|
||||
if (itemstack != null) {
|
||||
float f = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.count > 0) {
|
||||
int i1 = this.a.nextInt(21) + 10;
|
||||
|
||||
if (i1 > itemstack.count) {
|
||||
i1 = itemstack.count;
|
||||
}
|
||||
|
||||
itemstack.count -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.h()));
|
||||
float f3 = 0.05F;
|
||||
|
||||
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
|
||||
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
|
||||
world.a((Entity) entityitem);
|
||||
}
|
||||
}
|
||||
float f = a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
do {
|
||||
if (itemstack.a <= 0) {
|
||||
continue label0;
|
||||
}
|
||||
int i1 = a.nextInt(21) + 10;
|
||||
|
||||
if (i1 > itemstack.a) {
|
||||
i1 = itemstack.a;
|
||||
}
|
||||
itemstack.a -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (float) i + f, (float) j + f1, (float) k + f2, new ItemStack(itemstack.c, i1, itemstack.h()));
|
||||
float f3 = 0.05F;
|
||||
|
||||
entityitem.s = (float) a.nextGaussian() * f3;
|
||||
entityitem.t = (float) a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.u = (float) a.nextGaussian() * f3;
|
||||
world.a(((Entity) (entityitem)));
|
||||
} while (true);
|
||||
}
|
||||
|
||||
super.b(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
Object obj = (((TileEntityChest) world.m(i, j, k)));
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
Object object = (TileEntityChest) world.getTileEntity(i, j, k);
|
||||
|
||||
if (world.d(i, j + 1, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i - 1, j, k) == bi && world.d(i - 1, j + 1, k)) {
|
||||
} else if (world.getTypeId(i - 1, j, k) == this.id && world.d(i - 1, j + 1, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i + 1, j, k) == bi && world.d(i + 1, j + 1, k)) {
|
||||
} else if (world.getTypeId(i + 1, j, k) == this.id && world.d(i + 1, j + 1, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i, j, k - 1) == bi && world.d(i, j + 1, k - 1)) {
|
||||
} else if (world.getTypeId(i, j, k - 1) == this.id && world.d(i, j + 1, k - 1)) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i, j, k + 1) == bi && world.d(i, j + 1, k + 1)) {
|
||||
return true;
|
||||
}
|
||||
if (world.a(i - 1, j, k) == bi) {
|
||||
obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.m(i - 1, j, k))), ((IInventory) (obj)))));
|
||||
}
|
||||
if (world.a(i + 1, j, k) == bi) {
|
||||
obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.m(i + 1, j, k))))));
|
||||
}
|
||||
if (world.a(i, j, k - 1) == bi) {
|
||||
obj = ((new InventoryLargeChest("Large chest", ((IInventory) ((TileEntityChest) world.m(i, j, k - 1))), ((IInventory) (obj)))));
|
||||
}
|
||||
if (world.a(i, j, k + 1) == bi) {
|
||||
obj = ((new InventoryLargeChest("Large chest", ((IInventory) (obj)), ((IInventory) ((TileEntityChest) world.m(i, j, k + 1))))));
|
||||
}
|
||||
if (world.z) {
|
||||
} else if (world.getTypeId(i, j, k + 1) == this.id && world.d(i, j + 1, k + 1)) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Chest
|
||||
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 = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
if (world.getTypeId(i - 1, j, k) == this.id) {
|
||||
object = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(i - 1, j, k), (IInventory) object);
|
||||
}
|
||||
|
||||
if (bie.isCancelled()) return true;
|
||||
// CraftBukkit end
|
||||
if (world.getTypeId(i + 1, j, k) == this.id) {
|
||||
object = new InventoryLargeChest("Large chest", (IInventory) object, (TileEntityChest) world.getTileEntity(i + 1, j, k));
|
||||
}
|
||||
|
||||
entityplayer.a(((IInventory) (obj)));
|
||||
return true;
|
||||
if (world.getTypeId(i, j, k - 1) == this.id) {
|
||||
object = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(i, j, k - 1), (IInventory) object);
|
||||
}
|
||||
|
||||
if (world.getTypeId(i, j, k + 1) == this.id) {
|
||||
object = new InventoryLargeChest("Large chest", (IInventory) object, (TileEntityChest) world.getTileEntity(i, j, k + 1));
|
||||
}
|
||||
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Chest
|
||||
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
|
||||
|
||||
entityhuman.a((IInventory) object);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected TileEntity a_() {
|
||||
return ((TileEntity) (new TileEntityChest()));
|
||||
return new TileEntityChest();
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,15 @@ public class BlockDoor extends Block {
|
||||
|
||||
protected BlockDoor(int i, Material material) {
|
||||
super(i, material);
|
||||
bh = 97;
|
||||
if (material == Material.e) {
|
||||
bh++;
|
||||
this.textureId = 97;
|
||||
if (material == Material.ORE) {
|
||||
++this.textureId;
|
||||
}
|
||||
|
||||
float f = 0.5F;
|
||||
float f1 = 1.0F;
|
||||
|
||||
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 boolean a() {
|
||||
@ -31,170 +32,165 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
a(((IBlockAccess) (world)), i, j, k);
|
||||
this.a((IBlockAccess) world, i, j, k);
|
||||
return super.d(world, i, j, k);
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
c(d(iblockaccess.b(i, j, k)));
|
||||
this.c(this.d(iblockaccess.getData(i, j, k)));
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
float f = 0.1875F;
|
||||
|
||||
a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
if (i == 0) {
|
||||
a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
a(world, i, j, k, entityplayer);
|
||||
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.a(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
if (bt == Material.e) {
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (this.material == Material.ORE) {
|
||||
return true;
|
||||
}
|
||||
int l = world.b(i, j, k);
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
if (world.a(i, j - 1, k) == bi) {
|
||||
a(world, i, j - 1, k, entityplayer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// CraftBukkit start - Interact Door
|
||||
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 = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
|
||||
// CraftBukkit the client updates the doors before the server does it's thing.
|
||||
// Forcibly send correct data.
|
||||
if (bie.isCancelled()) {
|
||||
((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
|
||||
((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j + 1, k, (WorldServer) world));
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.a(i, j + 1, k) == bi) {
|
||||
world.c(i, j + 1, k, (l ^ 4) + 8);
|
||||
}
|
||||
world.c(i, j, k, l ^ 4);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
if (Math.random() < 0.5D) {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
if (world.getTypeId(i, j - 1, k) == this.id) {
|
||||
this.a(world, i, j - 1, k, entityhuman);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Door
|
||||
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);
|
||||
|
||||
// CraftBukkit the client updates the doors before the server does it's thing.
|
||||
// Forcibly send correct data.
|
||||
if (event.isCancelled()) {
|
||||
((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
|
||||
((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j + 1, k, (WorldServer) world));
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(i, j + 1, k) == this.id) {
|
||||
world.c(i, j + 1, k, (l ^ 4) + 8);
|
||||
}
|
||||
|
||||
world.c(i, j, k, l ^ 4);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
if (Math.random() < 0.5D) {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, boolean flag) {
|
||||
int l = world.b(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
if (world.a(i, j - 1, k) == bi) {
|
||||
a(world, i, j - 1, k, flag);
|
||||
if (world.getTypeId(i, j - 1, k) == this.id) {
|
||||
this.a(world, i, j - 1, k, flag);
|
||||
}
|
||||
return;
|
||||
}
|
||||
boolean flag1 = (world.b(i, j, k) & 4) > 0;
|
||||
|
||||
if (flag1 == flag) {
|
||||
return;
|
||||
}
|
||||
if (world.a(i, j + 1, k) == bi) {
|
||||
world.c(i, j + 1, k, (l ^ 4) + 8);
|
||||
}
|
||||
world.c(i, j, k, l ^ 4);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
if (Math.random() < 0.5D) {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
boolean flag1 = (world.getData(i, j, k) & 4) > 0;
|
||||
|
||||
if (flag1 != flag) {
|
||||
if (world.getTypeId(i, j + 1, k) == this.id) {
|
||||
world.c(i, j + 1, k, (l ^ 4) + 8);
|
||||
}
|
||||
|
||||
world.c(i, j, k, l ^ 4);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
if (Math.random() < 0.5D) {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) != 0) {
|
||||
if (world.a(i, j - 1, k) != bi) {
|
||||
if (world.getTypeId(i, j - 1, k) != this.id) {
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
if (l > 0 && Block.m[l].c()) {
|
||||
b(world, i, j - 1, k, l);
|
||||
|
||||
if (l > 0 && Block.byId[l].c()) {
|
||||
this.b(world, i, j - 1, k, l);
|
||||
}
|
||||
} else {
|
||||
boolean flag = false;
|
||||
|
||||
if (world.a(i, j + 1, k) != bi) {
|
||||
if (world.getTypeId(i, j + 1, k) != this.id) {
|
||||
world.e(i, j, k, 0);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j - 1, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
flag = true;
|
||||
if (world.a(i, j + 1, k) == bi) {
|
||||
if (world.getTypeId(i, j + 1, k) == this.id) {
|
||||
world.e(i, j + 1, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
a_(world, i, j, k, i1);
|
||||
} else if (l > 0 && Block.m[l].c()) {
|
||||
this.a_(world, i, j, k, i1);
|
||||
} else if (l > 0 && Block.byId[l].c()) {
|
||||
boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);
|
||||
|
||||
a(world, i, j, k, flag1);
|
||||
this.a(world, i, j, k, flag1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
if ((i & 8) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (bt == Material.e) {
|
||||
return Item.az.ba;
|
||||
} else {
|
||||
return Item.at.ba;
|
||||
}
|
||||
return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id);
|
||||
}
|
||||
|
||||
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
|
||||
a(((IBlockAccess) (world)), i, j, k);
|
||||
this.a((IBlockAccess) world, i, j, k);
|
||||
return super.a(world, i, j, k, vec3d, vec3d1);
|
||||
}
|
||||
|
||||
public int d(int i) {
|
||||
if ((i & 4) == 0) {
|
||||
return i - 1 & 3;
|
||||
} else {
|
||||
return i & 3;
|
||||
}
|
||||
return (i & 4) == 0 ? i - 1 & 3 : i & 3;
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
if (j >= 127) {
|
||||
return false;
|
||||
} else {
|
||||
return world.d(i, j - 1, k) && super.a(world, i, j, k) && super.a(world, i, j + 1, k);
|
||||
}
|
||||
return j >= 127 ? false : world.d(i, j - 1, k) && super.a(world, i, j, k) && super.a(world, i, j + 1, k);
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,35 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import java.util.Random;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockFire extends Block {
|
||||
|
||||
private int a[];
|
||||
private int b[];
|
||||
private int[] a = new int[256];
|
||||
private int[] b = new int[256];
|
||||
|
||||
protected BlockFire(int i, int j) {
|
||||
super(i, j, Material.l);
|
||||
a = new int[256];
|
||||
b = new int[256];
|
||||
a(Block.x.bi, 5, 20);
|
||||
a(Block.J.bi, 5, 5);
|
||||
a(Block.K.bi, 30, 60);
|
||||
a(Block.an.bi, 30, 20);
|
||||
a(Block.am.bi, 15, 100);
|
||||
a(Block.ab.bi, 30, 60);
|
||||
a(true);
|
||||
super(i, j, Material.FIRE);
|
||||
this.a(Block.WOOD.id, 5, 20);
|
||||
this.a(Block.LOG.id, 5, 5);
|
||||
this.a(Block.LEAVES.id, 30, 60);
|
||||
this.a(Block.BOOKSHELF.id, 30, 20);
|
||||
this.a(Block.TNT.id, 15, 100);
|
||||
this.a(Block.WOOL.id, 30, 60);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
private void a(int i, int j, int k) {
|
||||
a[i] = j;
|
||||
b[i] = k;
|
||||
this.a[i] = j;
|
||||
this.b[i] = k;
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
@ -50,62 +49,66 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = world.a(i, j - 1, k) == Block.bb.bi;
|
||||
int l = world.b(i, j, k);
|
||||
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l < 15) {
|
||||
world.c(i, j, k, l + 1);
|
||||
world.i(i, j, k, bi);
|
||||
world.i(i, j, k, this.id);
|
||||
}
|
||||
if (!flag && !g(world, i, j, k)) {
|
||||
|
||||
if (!flag && !this.g(world, i, j, k)) {
|
||||
if (!world.d(i, j - 1, k) || l > 3) {
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!flag && !b(((IBlockAccess) (world)), i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
} else if (!flag && !this.b((IBlockAccess)world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) { // CraftBukkit - Cast to IBlockAccess
|
||||
world.e(i, j, k, 0);
|
||||
return;
|
||||
}
|
||||
if (l % 2 == 0 && l > 2) {
|
||||
a(world, i + 1, j, k, 300, random);
|
||||
a(world, i - 1, j, k, 300, random);
|
||||
a(world, i, j - 1, k, 250, random);
|
||||
a(world, i, j + 1, k, 250, random);
|
||||
a(world, i, j, k - 1, 300, random);
|
||||
a(world, i, j, k + 1, 300, random);
|
||||
for (int i1 = i - 1; i1 <= i + 1; i1++) {
|
||||
for (int j1 = k - 1; j1 <= k + 1; j1++) {
|
||||
for (int k1 = j - 1; k1 <= j + 4; k1++) {
|
||||
if (i1 == i && k1 == j && j1 == k) {
|
||||
continue;
|
||||
}
|
||||
int l1 = 100;
|
||||
} else {
|
||||
if (l % 2 == 0 && l > 2) {
|
||||
this.a(world, i + 1, j, k, 300, random);
|
||||
this.a(world, i - 1, j, k, 300, random);
|
||||
this.a(world, i, j - 1, k, 250, random);
|
||||
this.a(world, i, j + 1, k, 250, random);
|
||||
this.a(world, i, j, k - 1, 300, random);
|
||||
this.a(world, i, j, k + 1, 300, random);
|
||||
|
||||
if (k1 > j + 1) {
|
||||
l1 += (k1 - (j + 1)) * 100;
|
||||
}
|
||||
int i2 = h(world, i1, k1, j1);
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
// CraftBukkit start: Call to stop spread of fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i1, k1, j1));
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||
Player thePlayer = null;
|
||||
|
||||
if (theBlock.getTypeId() != Block.ar.bi){
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||
Player thePlayer = null;
|
||||
// CraftBukkit
|
||||
|
||||
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
||||
for (int j1 = k - 1; j1 <= k + 1; ++j1) {
|
||||
for (int k1 = j - 1; k1 <= j + 4; ++k1) {
|
||||
if (i1 != i || k1 != j || j1 != k) {
|
||||
int l1 = 100;
|
||||
|
||||
if (k1 > j + 1) {
|
||||
l1 += (k1 - (j + 1)) * 100;
|
||||
}
|
||||
|
||||
int i2 = this.h(world, i1, k1, j1);
|
||||
|
||||
if (i2 > 0 && random.nextInt(l1) <= i2) {
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i1, k1, j1));
|
||||
|
||||
if (theBlock.getTypeId() != Block.FIRE.id){
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.e(i1, k1, j1, this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (i2 > 0 && random.nextInt(l1) <= i2) {
|
||||
world.e(i1, k1, j1, bi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,74 +116,43 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
private void a(World world, int i, int j, int k, int l, Random random) {
|
||||
int i1 = b[world.a(i, j, k)];
|
||||
int i1 = this.b[world.getTypeId(i, j, k)];
|
||||
|
||||
if (random.nextInt(l) < i1) {
|
||||
boolean flag = world.a(i, j, k) == Block.am.bi;
|
||||
// CraftBukkit start: BlockBurnEvent
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
|
||||
BlockBurnEvent burnEvent = new BlockBurnEvent(theBlock);
|
||||
server.getPluginManager().callEvent(burnEvent);
|
||||
if(!burnEvent.isCancelled()) {
|
||||
if (random.nextInt(2) == 0) {
|
||||
// CraftBukkit start: Call to stop very slow spread of fire.
|
||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SLOW_SPREAD;
|
||||
Player thePlayer = null;
|
||||
|
||||
if (theBlock.getTypeId() != Block.ar.bi){
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.e(i, j, k, bi);
|
||||
} else {
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
if (flag) {
|
||||
Block.am.a(world, i, j, k, 0);
|
||||
}
|
||||
if (random.nextInt(2) == 0) {
|
||||
world.e(i, j, k, this.id);
|
||||
} else {
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
Block.TNT.a(world, i, j, k, 0);
|
||||
}
|
||||
// CraftBukkit end: BlockBurnEvent
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (b(((IBlockAccess) (world)), i + 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (b(((IBlockAccess) (world)), i - 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (b(((IBlockAccess) (world)), i, j - 1, k)) {
|
||||
return true;
|
||||
}
|
||||
if (b(((IBlockAccess) (world)), i, j + 1, k)) {
|
||||
return true;
|
||||
}
|
||||
if (b(((IBlockAccess) (world)), i, j, k - 1)) {
|
||||
return true;
|
||||
}
|
||||
return b(((IBlockAccess) (world)), i, j, k + 1);
|
||||
// CraftBukkit start -- fix cast to IBlockAccess
|
||||
private boolean g(World world1, int i, int j, int k) {
|
||||
IBlockAccess world = (IBlockAccess) world1;
|
||||
// CraftBukkit end
|
||||
return this.b(world, i + 1, j, k) ? true : (this.b(world, i - 1, j, k) ? true : (this.b(world, i, j - 1, k) ? true : (this.b(world, i, j + 1, k) ? true : (this.b(world, i, j, k - 1) ? true : this.b(world, i, j, k + 1)))));
|
||||
}
|
||||
|
||||
private int h(World world, int i, int j, int k) {
|
||||
int l = 0;
|
||||
byte b0 = 0;
|
||||
|
||||
if (!world.e(i, j, k)) {
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return 0;
|
||||
} else {
|
||||
l = f(world, i + 1, j, k, l);
|
||||
l = f(world, i - 1, j, k, l);
|
||||
l = f(world, i, j - 1, k, l);
|
||||
l = f(world, i, j + 1, k, l);
|
||||
l = f(world, i, j, k - 1, l);
|
||||
l = f(world, i, j, k + 1, l);
|
||||
int l = this.f(world, i + 1, j, k, b0);
|
||||
|
||||
l = this.f(world, i - 1, j, k, l);
|
||||
l = this.f(world, i, j - 1, k, l);
|
||||
l = this.f(world, i, j + 1, k, l);
|
||||
l = this.f(world, i, j, k - 1, l);
|
||||
l = this.f(world, i, j, k + 1, l);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
@ -190,43 +162,32 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return a[iblockaccess.a(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) {
|
||||
int i1 = a[world.a(i, j, k)];
|
||||
int i1 = this.a[world.getTypeId(i, j, k)];
|
||||
|
||||
if (i1 > l) {
|
||||
return i1;
|
||||
} else {
|
||||
return l;
|
||||
}
|
||||
return i1 > l ? i1 : l;
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
return world.d(i, j - 1, k) || 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) {
|
||||
if (!world.d(i, j - 1, k) && !g(world, i, j, k)) {
|
||||
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
//TODO this section deals with lighting a block on fire too
|
||||
if (world.a(i, j - 1, k) == Block.ap.bi && Block.be.b_(world, i, j, k)) {
|
||||
return;
|
||||
}
|
||||
if (!world.d(i, j - 1, k) && !g(world, i, j, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
return;
|
||||
} else {
|
||||
world.i(i, j, k, bi);
|
||||
return;
|
||||
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) {
|
||||
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
world.i(i, j, k, this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,121 +11,125 @@ import org.bukkit.event.block.BlockFromToEvent;
|
||||
|
||||
public class BlockFlowing extends BlockFluids {
|
||||
|
||||
int a;
|
||||
boolean b[];
|
||||
int c[];
|
||||
int a = 0;
|
||||
boolean[] b = new boolean[4];
|
||||
int[] c = new int[4];
|
||||
|
||||
protected BlockFlowing(int i1, Material material) {
|
||||
super(i1, material);
|
||||
a = 0;
|
||||
b = new boolean[4];
|
||||
c = new int[4];
|
||||
protected BlockFlowing(int i, Material material) {
|
||||
super(i, material);
|
||||
}
|
||||
|
||||
private void i(World world, int i1, int j1, int k1) {
|
||||
int l1 = world.b(i1, j1, k1);
|
||||
private void i(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.a(i1, j1, k1, bi + 1, l1);
|
||||
world.b(i1, j1, k1, i1, j1, k1);
|
||||
world.g(i1, j1, k1);
|
||||
world.setTypeIdAndData(i, j, k, this.id + 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.g(i, j, k);
|
||||
}
|
||||
|
||||
public void a(World world, int i1, int j1, int k1, Random random) {
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
// CraftBukkit start
|
||||
// skedit: Moved up to make sure that it is accurate
|
||||
CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i1, j1, k1);
|
||||
CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
int l1 = g(world, i1, j1, k1);
|
||||
byte byte0 = 1;
|
||||
|
||||
if (bt == Material.g && !world.q.d) {
|
||||
byte0 = 2;
|
||||
int l = this.g(world, i, j, k);
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.material == Material.LAVA && !world.q.d) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
boolean flag = true;
|
||||
int i1;
|
||||
|
||||
if (l1 > 0) {
|
||||
int i2 = -100;
|
||||
if (l > 0) {
|
||||
byte b1 = -100;
|
||||
|
||||
a = 0;
|
||||
i2 = e(world, i1 - 1, j1, k1, i2);
|
||||
i2 = e(world, i1 + 1, j1, k1, i2);
|
||||
i2 = e(world, i1, j1, k1 - 1, i2);
|
||||
i2 = e(world, i1, j1, k1 + 1, i2);
|
||||
int j2 = i2 + byte0;
|
||||
this.a = 0;
|
||||
int j1 = this.e(world, i - 1, j, k, b1);
|
||||
|
||||
if (j2 >= 8 || i2 < 0) {
|
||||
j2 = -1;
|
||||
j1 = this.e(world, i + 1, j, k, j1);
|
||||
j1 = this.e(world, i, j, k - 1, j1);
|
||||
j1 = this.e(world, i, j, k + 1, j1);
|
||||
i1 = j1 + b0;
|
||||
if (i1 >= 8 || j1 < 0) {
|
||||
i1 = -1;
|
||||
}
|
||||
if (g(world, i1, j1 + 1, k1) >= 0) {
|
||||
int l2 = g(world, i1, j1 + 1, k1);
|
||||
|
||||
if (l2 >= 8) {
|
||||
j2 = l2;
|
||||
if (this.g(world, i, j + 1, k) >= 0) {
|
||||
int k1 = this.g(world, i, j + 1, k);
|
||||
|
||||
if (k1 >= 8) {
|
||||
i1 = k1;
|
||||
} else {
|
||||
j2 = l2 + 8;
|
||||
i1 = k1 + 8;
|
||||
}
|
||||
}
|
||||
if (a >= 2 && bt == Material.f) {
|
||||
if (world.d(i1, j1 - 1, k1)) {
|
||||
j2 = 0;
|
||||
} else if (world.c(i1, j1 - 1, k1) == bt && world.b(i1, j1, k1) == 0) {
|
||||
j2 = 0;
|
||||
|
||||
if (this.a >= 2 && this.material == Material.WATER) {
|
||||
if (world.d(i, j - 1, k)) {
|
||||
i1 = 0;
|
||||
} else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j, k) == 0) {
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (bt == Material.g && l1 < 8 && j2 < 8 && j2 > l1 && random.nextInt(4) != 0) {
|
||||
j2 = l1;
|
||||
|
||||
if (this.material == Material.LAVA && l < 8 && i1 < 8 && i1 > l && random.nextInt(4) != 0) {
|
||||
i1 = l;
|
||||
flag = false;
|
||||
}
|
||||
if (j2 != l1) {
|
||||
l1 = j2;
|
||||
if (l1 < 0) {
|
||||
world.e(i1, j1, k1, 0);
|
||||
|
||||
if (i1 != l) {
|
||||
l = i1;
|
||||
if (i1 < 0) {
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
world.c(i1, j1, k1, l1);
|
||||
world.i(i1, j1, k1, bi);
|
||||
world.h(i1, j1, k1, bi);
|
||||
world.c(i, j, k, i1);
|
||||
world.i(i, j, k, this.id);
|
||||
world.h(i, j, k, this.id);
|
||||
}
|
||||
} else if (flag) {
|
||||
i(world, i1, j1, k1);
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
} else {
|
||||
i(world, i1, j1, k1);
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
|
||||
if (l(world, i1, j1 - 1, k1)) {
|
||||
|
||||
if (this.l(world, i, j - 1, k)) {
|
||||
// CraftBukkit start
|
||||
// Craftbucket send "down" to the server
|
||||
BlockFromToEvent blockFlow = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(blockFlow);
|
||||
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!blockFlow.isCancelled()) {
|
||||
if (l1 >= 8) {
|
||||
world.b(i1, j1 - 1, k1, bi, l1);
|
||||
if (!event.isCancelled()) {
|
||||
if (l >= 8) {
|
||||
world.b(i, j - 1, k, this.id, l);
|
||||
} else {
|
||||
world.b(i1, j1 - 1, k1, bi, l1 + 8);
|
||||
world.b(i, j - 1, k, this.id, l + 8);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (l1 >= 0 && (l1 == 0 || k(world, i1, j1 - 1, k1))) {
|
||||
boolean aflag[] = j(world, i1, j1, k1);
|
||||
int k2 = l1 + byte0;
|
||||
// CraftBukkit end
|
||||
} else if (l >= 0 && (l == 0 || this.k(world, i, j - 1, k))) {
|
||||
boolean[] aboolean = this.j(world, i, j, k);
|
||||
|
||||
if (l1 >= 8) {
|
||||
k2 = 1;
|
||||
i1 = l + b0;
|
||||
if (l >= 8) {
|
||||
i1 = 1;
|
||||
}
|
||||
if (k2 >= 8) {
|
||||
|
||||
if (i1 >= 8) {
|
||||
return;
|
||||
}
|
||||
|
||||
// CraftBukkit start - all four cardinal directions. Do not change the order!
|
||||
BlockFace[] faces = new BlockFace[]{ BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
|
||||
int index = 0;
|
||||
for (BlockFace currentFace: faces) {
|
||||
if (aflag[index]) {
|
||||
if (aboolean[index]) {
|
||||
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
f(world, i1 + currentFace.getModX(), j1, k1 + currentFace.getModZ(), k2);
|
||||
f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
@ -134,153 +138,158 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
private void f(World world, int i1, int j1, int k1, int l1) {
|
||||
if (l(world, i1, j1, k1)) {
|
||||
int i2 = world.a(i1, j1, k1);
|
||||
private void f(World world, int i, int j, int k, int l) {
|
||||
if (this.l(world, i, j, k)) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i2 > 0) {
|
||||
if (bt == Material.g) {
|
||||
h(world, i1, j1, k1);
|
||||
if (i1 > 0) {
|
||||
if (this.material == Material.LAVA) {
|
||||
this.h(world, i, j, k);
|
||||
} else {
|
||||
Block.m[i2].a_(world, i1, j1, k1, world.b(i1, j1, k1));
|
||||
Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k));
|
||||
}
|
||||
}
|
||||
world.b(i1, j1, k1, bi, l1);
|
||||
|
||||
world.b(i, j, k, this.id, l);
|
||||
}
|
||||
}
|
||||
|
||||
private int b(World world, int i1, int j1, int k1, int l1, int i2) {
|
||||
int j2 = 1000;
|
||||
private int b(World world, int i, int j, int k, int l, int i1) {
|
||||
int j1 = 1000;
|
||||
|
||||
for (int k2 = 0; k2 < 4; k2++) {
|
||||
if (k2 == 0 && i2 == 1 || k2 == 1 && i2 == 0 || k2 == 2 && i2 == 3 || k2 == 3 && i2 == 2) {
|
||||
continue;
|
||||
}
|
||||
int l2 = i1;
|
||||
int i3 = j1;
|
||||
int j3 = k1;
|
||||
for (int k1 = 0; k1 < 4; ++k1) {
|
||||
if ((k1 != 0 || i1 != 1) && (k1 != 1 || i1 != 0) && (k1 != 2 || i1 != 3) && (k1 != 3 || i1 != 2)) {
|
||||
int l1 = i;
|
||||
int i2 = k;
|
||||
|
||||
if (k2 == 0) {
|
||||
l2--;
|
||||
}
|
||||
if (k2 == 1) {
|
||||
l2++;
|
||||
}
|
||||
if (k2 == 2) {
|
||||
j3--;
|
||||
}
|
||||
if (k2 == 3) {
|
||||
j3++;
|
||||
}
|
||||
if (k(world, l2, i3, j3) || world.c(l2, i3, j3) == bt && world.b(l2, i3, j3) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!k(world, l2, i3 - 1, j3)) {
|
||||
return l1;
|
||||
}
|
||||
if (l1 >= 4) {
|
||||
continue;
|
||||
}
|
||||
int k3 = b(world, l2, i3, j3, l1 + 1, k2);
|
||||
if (k1 == 0) {
|
||||
l1 = i - 1;
|
||||
}
|
||||
|
||||
if (k3 < j2) {
|
||||
j2 = k3;
|
||||
if (k1 == 1) {
|
||||
++l1;
|
||||
}
|
||||
|
||||
if (k1 == 2) {
|
||||
i2 = k - 1;
|
||||
}
|
||||
|
||||
if (k1 == 3) {
|
||||
++i2;
|
||||
}
|
||||
|
||||
if (!this.k(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
|
||||
if (!this.k(world, l1, j - 1, i2)) {
|
||||
return l;
|
||||
}
|
||||
|
||||
if (l < 4) {
|
||||
int j2 = this.b(world, l1, j, i2, l + 1, k1);
|
||||
|
||||
if (j2 < j1) {
|
||||
j1 = j2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return j2;
|
||||
return j1;
|
||||
}
|
||||
|
||||
private boolean[] j(World world, int i1, int j1, int k1) {
|
||||
for (int l1 = 0; l1 < 4; l1++) {
|
||||
c[l1] = 1000;
|
||||
int j2 = i1;
|
||||
int i3 = j1;
|
||||
int j3 = k1;
|
||||
private boolean[] j(World world, int i, int j, int k) {
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
if (l1 == 0) {
|
||||
j2--;
|
||||
for (l = 0; l < 4; ++l) {
|
||||
this.c[l] = 1000;
|
||||
i1 = i;
|
||||
int j1 = k;
|
||||
|
||||
if (l == 0) {
|
||||
i1 = i - 1;
|
||||
}
|
||||
if (l1 == 1) {
|
||||
j2++;
|
||||
|
||||
if (l == 1) {
|
||||
++i1;
|
||||
}
|
||||
if (l1 == 2) {
|
||||
j3--;
|
||||
|
||||
if (l == 2) {
|
||||
j1 = k - 1;
|
||||
}
|
||||
if (l1 == 3) {
|
||||
j3++;
|
||||
|
||||
if (l == 3) {
|
||||
++j1;
|
||||
}
|
||||
if (k(world, j2, i3, j3) || world.c(j2, i3, j3) == bt && world.b(j2, i3, j3) == 0) {
|
||||
continue;
|
||||
|
||||
if (!this.k(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
|
||||
if (!this.k(world, i1, j - 1, j1)) {
|
||||
this.c[l] = 0;
|
||||
} else {
|
||||
this.c[l] = this.b(world, i1, j, j1, 1, l);
|
||||
}
|
||||
}
|
||||
if (!k(world, j2, i3 - 1, j3)) {
|
||||
c[l1] = 0;
|
||||
}
|
||||
|
||||
l = this.c[0];
|
||||
|
||||
for (i1 = 1; i1 < 4; ++i1) {
|
||||
if (this.c[i1] < l) {
|
||||
l = this.c[i1];
|
||||
}
|
||||
}
|
||||
|
||||
for (i1 = 0; i1 < 4; ++i1) {
|
||||
this.b[i1] = this.c[i1] == l;
|
||||
}
|
||||
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private boolean k(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
|
||||
if (l == 0) {
|
||||
return false;
|
||||
} else {
|
||||
c[l1] = b(world, j2, i3, j3, 1, l1);
|
||||
Material material = Block.byId[l].material;
|
||||
|
||||
return material.isBuildable();
|
||||
}
|
||||
}
|
||||
|
||||
int i2 = c[0];
|
||||
|
||||
for (int k2 = 1; k2 < 4; k2++) {
|
||||
if (c[k2] < i2) {
|
||||
i2 = c[k2];
|
||||
}
|
||||
}
|
||||
|
||||
for (int l2 = 0; l2 < 4; l2++) {
|
||||
b[l2] = c[l2] == i2;
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
private boolean k(World world, int i1, int j1, int k1) {
|
||||
int l1 = world.a(i1, j1, k1);
|
||||
|
||||
if (l1 == Block.aE.bi || l1 == Block.aL.bi || l1 == Block.aD.bi || l1 == Block.aF.bi || l1 == Block.aX.bi) {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if (l1 == 0) {
|
||||
return false;
|
||||
}
|
||||
Material material = Block.m[l1].bt;
|
||||
|
||||
return material.a();
|
||||
}
|
||||
|
||||
protected int e(World world, int i1, int j1, int k1, int l1) {
|
||||
int i2 = g(world, i1, j1, k1);
|
||||
protected int e(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.g(world, i, j, k);
|
||||
|
||||
if (i2 < 0) {
|
||||
return l1;
|
||||
}
|
||||
if (i2 == 0) {
|
||||
a++;
|
||||
}
|
||||
if (i2 >= 8) {
|
||||
i2 = 0;
|
||||
}
|
||||
return l1 >= 0 && i2 >= l1 ? l1 : i2;
|
||||
}
|
||||
|
||||
private boolean l(World world, int i1, int j1, int k1) {
|
||||
Material material = world.c(i1, j1, k1);
|
||||
|
||||
if (material == bt) {
|
||||
return false;
|
||||
}
|
||||
if (material == Material.g) {
|
||||
return false;
|
||||
if (i1 < 0) {
|
||||
return l;
|
||||
} else {
|
||||
return !k(world, i1, j1, k1);
|
||||
if (i1 == 0) {
|
||||
++this.a;
|
||||
}
|
||||
|
||||
if (i1 >= 8) {
|
||||
i1 = 0;
|
||||
}
|
||||
|
||||
return l >= 0 && i1 >= l ? l : i1;
|
||||
}
|
||||
}
|
||||
|
||||
public void e(World world, int i1, int j1, int k1) {
|
||||
super.e(world, i1, j1, k1);
|
||||
if (world.a(i1, j1, k1) == bi) {
|
||||
world.i(i1, j1, k1, bi);
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
Material material = world.getMaterial(i, j, k);
|
||||
|
||||
return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k));
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
super.e(world, i, j, k);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
world.i(i, j, k, this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,58 +17,52 @@ public class BlockFurnace extends BlockContainer {
|
||||
private final boolean a;
|
||||
|
||||
protected BlockFurnace(int i, boolean flag) {
|
||||
super(i, Material.d);
|
||||
a = flag;
|
||||
bh = 45;
|
||||
super(i, Material.STONE);
|
||||
this.a = flag;
|
||||
this.textureId = 45;
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Block.aB.bi;
|
||||
return Block.FURNACE.id;
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
super.e(world, i, j, k);
|
||||
g(world, i, j, k);
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
int l = world.a(i, j, k - 1);
|
||||
int i1 = world.a(i, j, k + 1);
|
||||
int j1 = world.a(i - 1, j, k);
|
||||
int k1 = world.a(i + 1, j, k);
|
||||
byte byte0 = 3;
|
||||
int l = world.getTypeId(i, j, k - 1);
|
||||
int i1 = world.getTypeId(i, j, k + 1);
|
||||
int j1 = world.getTypeId(i - 1, j, k);
|
||||
int k1 = world.getTypeId(i + 1, j, k);
|
||||
byte b0 = 3;
|
||||
|
||||
if (Block.o[l] && !Block.o[i1]) {
|
||||
byte0 = 3;
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
if (Block.o[i1] && !Block.o[l]) {
|
||||
byte0 = 2;
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
if (Block.o[j1] && !Block.o[k1]) {
|
||||
byte0 = 5;
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
if (Block.o[k1] && !Block.o[j1]) {
|
||||
byte0 = 4;
|
||||
b0 = 4;
|
||||
}
|
||||
world.c(i, j, k, ((int) (byte0)));
|
||||
|
||||
world.c(i, j, k, b0);
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
if (i == 1) {
|
||||
return bh + 17;
|
||||
}
|
||||
if (i == 0) {
|
||||
return bh + 17;
|
||||
}
|
||||
if (i == 3) {
|
||||
return bh - 1;
|
||||
} else {
|
||||
return bh;
|
||||
}
|
||||
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId - 1 : this.textureId));
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
if (world.z) {
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Furnace
|
||||
@ -76,52 +70,56 @@ public class BlockFurnace extends BlockContainer {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
LivingEntity who = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
|
||||
|
||||
if (bie.isCancelled()) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.m(i, j, k);
|
||||
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k);
|
||||
|
||||
entityplayer.a(tileentityfurnace);
|
||||
entityhuman.a(tileentityfurnace);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(boolean flag, World world, int i, int j, int k) {
|
||||
int l = world.b(i, j, k);
|
||||
TileEntity tileentity = world.m(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
|
||||
if (flag) {
|
||||
world.e(i, j, k, Block.aC.bi);
|
||||
world.e(i, j, k, Block.BURNING_FURNACE.id);
|
||||
} else {
|
||||
world.e(i, j, k, Block.aB.bi);
|
||||
world.e(i, j, k, Block.FURNACE.id);
|
||||
}
|
||||
|
||||
world.c(i, j, k, l);
|
||||
world.a(i, j, k, tileentity);
|
||||
world.setTileEntity(i, j, k, tileentity);
|
||||
}
|
||||
|
||||
protected TileEntity a_() {
|
||||
return ((TileEntity) (new TileEntityFurnace()));
|
||||
return new TileEntityFurnace();
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
int l = MathHelper.b((double) ((entityliving.v * 4F) / 360F) + 0.5D) & 3;
|
||||
int l = MathHelper.b((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0) {
|
||||
world.c(i, j, k, 2);
|
||||
}
|
||||
|
||||
if (l == 1) {
|
||||
world.c(i, j, k, 5);
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
world.c(i, j, k, 3);
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
world.c(i, j, k, 4);
|
||||
}
|
||||
|
@ -13,15 +13,15 @@ import org.bukkit.event.block.BlockInteractEvent;
|
||||
public class BlockJukeBox extends Block {
|
||||
|
||||
protected BlockJukeBox(int i, int j) {
|
||||
super(i, j, Material.c);
|
||||
super(i, j, Material.WOOD);
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
return bh + (i != 1 ? 0 : 1);
|
||||
return this.textureId + (i == 1 ? 1 : 0);
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
int l = world.b(i, j, k);
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
// CraftBukkit start - Interact Jukebox
|
||||
@ -29,17 +29,17 @@ public class BlockJukeBox extends Block {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
LivingEntity who = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
|
||||
|
||||
if (bie.isCancelled()) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
f(world, i, j, k, l);
|
||||
this.f(world, i, j, k, l);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -47,26 +47,26 @@ public class BlockJukeBox extends Block {
|
||||
}
|
||||
|
||||
public void f(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);
|
||||
int i1 = (Item.aY.ba + l) - 1;
|
||||
float f1 = 0.7F;
|
||||
double d = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
|
||||
double d1 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.20000000000000001D + 0.59999999999999998D;
|
||||
double d2 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) i + d, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0));
|
||||
int i1 = Item.GOLD_RECORD.id + l - 1;
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
|
||||
double d2 = (double) (world.l.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.c = 10;
|
||||
world.a(((Entity) (entityitem)));
|
||||
world.a((Entity) entityitem);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, float f1) {
|
||||
if (world.z) {
|
||||
return;
|
||||
public void a(World world, int i, int j, int k, int l, float f) {
|
||||
if (!world.isStatic) {
|
||||
if (l > 0) {
|
||||
this.f(world, i, j, k, l);
|
||||
}
|
||||
|
||||
super.a(world, i, j, k, l, f);
|
||||
}
|
||||
if (l > 0) {
|
||||
f(world, i, j, k, l);
|
||||
}
|
||||
super.a(world, i, j, k, l, f1);
|
||||
}
|
||||
}
|
||||
|
@ -12,28 +12,28 @@ import org.bukkit.event.block.LeavesDecayEvent;
|
||||
public class BlockLeaves extends BlockLeavesBase {
|
||||
|
||||
private int c;
|
||||
int b[];
|
||||
int[] b;
|
||||
|
||||
protected BlockLeaves(int i, int j) {
|
||||
super(i, j, Material.h, false);
|
||||
c = j;
|
||||
a(true);
|
||||
super(i, j, Material.LEAVES, false);
|
||||
this.c = j;
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
int l = 1;
|
||||
int i1 = l + 1;
|
||||
byte b0 = 1;
|
||||
int l = b0 + 1;
|
||||
|
||||
if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
for (int j1 = -l; j1 <= l; j1++) {
|
||||
for (int k1 = -l; k1 <= l; k1++) {
|
||||
for (int l1 = -l; l1 <= l; l1++) {
|
||||
int i2 = world.a(i + j1, j + k1, k + l1);
|
||||
if (world.a(i - l, j - l, k - l, i + l, j + l, k + l)) {
|
||||
for (int i1 = -b0; i1 <= b0; ++i1) {
|
||||
for (int j1 = -b0; j1 <= b0; ++j1) {
|
||||
for (int k1 = -b0; k1 <= b0; ++k1) {
|
||||
int l1 = world.getTypeId(i + i1, j + j1, k + k1);
|
||||
|
||||
if (i2 == Block.K.bi) {
|
||||
int j2 = world.b(i + j1, j + k1, k + l1);
|
||||
if (l1 == Block.LEAVES.id) {
|
||||
int i2 = world.getData(i + i1, j + j1, k + k1);
|
||||
|
||||
world.d(i + j1, j + k1, k + l1, j2 | 4);
|
||||
world.d(i + i1, j + j1, k + k1, i2 | 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,77 +42,84 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
int l = world.b(i, j, k);
|
||||
if (!world.isStatic) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 4) != 0) {
|
||||
byte byte0 = 4;
|
||||
int i1 = byte0 + 1;
|
||||
byte byte1 = 32;
|
||||
int j1 = byte1 * byte1;
|
||||
int k1 = byte1 / 2;
|
||||
if ((l & 4) != 0) {
|
||||
byte b0 = 4;
|
||||
int i1 = b0 + 1;
|
||||
byte b1 = 32;
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (b == null) {
|
||||
b = new int[byte1 * byte1 * byte1];
|
||||
}
|
||||
if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
for (int l1 = -byte0; l1 <= byte0; l1++) {
|
||||
for (int k2 = -byte0; k2 <= byte0; k2++) {
|
||||
for (int i3 = -byte0; i3 <= byte0; i3++) {
|
||||
int k3 = world.a(i + l1, j + k2, k + i3);
|
||||
if (this.b == null) {
|
||||
this.b = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
if (k3 == Block.J.bi) {
|
||||
b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = 0;
|
||||
continue;
|
||||
int l1;
|
||||
|
||||
if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
|
||||
for (l1 = -b0; l1 <= b0; ++l1) {
|
||||
for (i2 = -b0; i2 <= b0; ++i2) {
|
||||
for (j2 = -b0; j2 <= b0; ++j2) {
|
||||
k2 = world.getTypeId(i + l1, j + i2, k + j2);
|
||||
if (k2 == Block.LOG.id) {
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
} else if (k2 == Block.LEAVES.id) {
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
} else {
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
if (k3 == Block.K.bi) {
|
||||
b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -2;
|
||||
} else {
|
||||
b[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (l1 = 1; l1 <= 4; ++l1) {
|
||||
for (i2 = -b0; i2 <= b0; ++i2) {
|
||||
for (j2 = -b0; j2 <= b0; ++j2) {
|
||||
for (k2 = -b0; k2 <= b0; ++k2) {
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
|
||||
if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i2 = 1; i2 <= 4; i2++) {
|
||||
for (int l2 = -byte0; l2 <= byte0; l2++) {
|
||||
for (int j3 = -byte0; j3 <= byte0; j3++) {
|
||||
for (int l3 = -byte0; l3 <= byte0; l3++) {
|
||||
if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] != i2 - 1) {
|
||||
continue;
|
||||
}
|
||||
if (b[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) {
|
||||
b[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2;
|
||||
}
|
||||
if (b[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) {
|
||||
b[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2;
|
||||
}
|
||||
if (b[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] == -2) {
|
||||
b[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] = i2;
|
||||
}
|
||||
if (b[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] == -2) {
|
||||
b[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] = i2;
|
||||
}
|
||||
if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] == -2) {
|
||||
b[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] = i2;
|
||||
}
|
||||
if (b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] == -2) {
|
||||
b[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] = i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l1 = this.b[k1 * j1 + k1 * b1 + k1];
|
||||
if (l1 >= 0) {
|
||||
world.c(i, j, k, l & -5);
|
||||
} else {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
}
|
||||
int j2 = b[k1 * j1 + k1 * byte1 + k1];
|
||||
|
||||
if (j2 >= 0) {
|
||||
world.c(i, j, k, l & -5);
|
||||
} else {
|
||||
g(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,20 +133,20 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return random.nextInt(16) != 0 ? 0 : 1;
|
||||
return random.nextInt(16) == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Block.y.bi;
|
||||
return Block.SAPLING.id;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return !a;
|
||||
return !this.a;
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
public class BlockLever extends Block {
|
||||
|
||||
protected BlockLever(int i, int j) {
|
||||
super(i, j, Material.n);
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
@ -27,41 +27,34 @@ public class BlockLever extends Block {
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
if (world.d(i - 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.d(i + 1, j, k)) {
|
||||
return true;
|
||||
}
|
||||
if (world.d(i, j, k - 1)) {
|
||||
return true;
|
||||
}
|
||||
if (world.d(i, j, k + 1)) {
|
||||
return true;
|
||||
}
|
||||
return 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) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
|
||||
i1 &= 7;
|
||||
if (l == 1 && world.d(i, j - 1, k)) {
|
||||
i1 = 5 + world.l.nextInt(2);
|
||||
}
|
||||
|
||||
if (l == 2 && world.d(i, j, k + 1)) {
|
||||
i1 = 4;
|
||||
}
|
||||
|
||||
if (l == 3 && world.d(i, j, k - 1)) {
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
if (l == 4 && world.d(i + 1, j, k)) {
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5 && world.d(i - 1, j, k)) {
|
||||
i1 = 1;
|
||||
}
|
||||
|
||||
world.c(i, j, k, i1 + j1);
|
||||
}
|
||||
|
||||
@ -77,39 +70,45 @@ public class BlockLever extends Block {
|
||||
} else if (world.d(i, j - 1, k)) {
|
||||
world.c(i, j, k, 5 + world.l.nextInt(2));
|
||||
}
|
||||
g(world, i, j, k);
|
||||
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
if (g(world, i, j, k)) {
|
||||
int i1 = world.b(i, j, k) & 7;
|
||||
if (this.g(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.d(i - 1, j, k) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i + 1, j, k) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j, k - 1) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j, k + 1) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.d(i, j - 1, k) && i1 == 5) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (!a(world, i, j, k)) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
if (!this.a(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -118,129 +117,119 @@ public class BlockLever extends Block {
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.b(i, j, k) & 7;
|
||||
int l = iblockaccess.getData(i, j, k) & 7;
|
||||
float f = 0.1875F;
|
||||
|
||||
if (l == 1) {
|
||||
a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
|
||||
this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
|
||||
} else if (l == 2) {
|
||||
a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
|
||||
this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
|
||||
} else if (l == 3) {
|
||||
a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
|
||||
this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
|
||||
} else if (l == 4) {
|
||||
a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
|
||||
this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
|
||||
} else {
|
||||
float f1 = 0.25F;
|
||||
|
||||
a(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1);
|
||||
f = 0.25F;
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
a(world, i, j, k, entityplayer);
|
||||
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.a(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
if (world.z) {
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start - Interact Lever
|
||||
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();
|
||||
|
||||
// CraftBukkit start - Interact Lever
|
||||
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 = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
// CraftBukkit the client updates the doors before the server does it's thing.
|
||||
// Forcibly send correct data.
|
||||
if (bie.isCancelled()) {
|
||||
((EntityPlayerMP) entityplayer).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
int l = world.b(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
// CraftBukkit start
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, old, current);
|
||||
server.getPluginManager().callEvent(bre);
|
||||
// CraftBukkit end
|
||||
|
||||
if ((bre.getNewCurrent() > 0) == (j1 == 8)) {
|
||||
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, j1 <= 0 ? 0.5F : 0.6F);
|
||||
world.h(i, j, k, bi);
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, bi);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, bi);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, bi);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, bi);
|
||||
} else {
|
||||
world.h(i, j - 1, k, bi);
|
||||
// CraftBukkit the client updates the doors before the server does it's thing.
|
||||
// Forcibly send correct data.
|
||||
if (event.isCancelled()) {
|
||||
((EntityPlayer) entityhuman).a.b(new Packet53BlockChange(i, j, k, (WorldServer) world));
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
// CraftBukkit start
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, BlockFace.SELF, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if ((eventRedstone.getNewCurrent() > 0) == (j1 == 8)) {
|
||||
// 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, j1 > 0 ? 0.6F : 0.5F);
|
||||
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);
|
||||
}
|
||||
} // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
int l = world.b(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) > 0) {
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, bi);
|
||||
world.h(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, bi);
|
||||
world.h(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, bi);
|
||||
world.h(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, bi);
|
||||
world.h(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
super.b(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.b(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) {
|
||||
int i1 = world.b(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
return false;
|
||||
}
|
||||
int j1 = i1 & 7;
|
||||
} else {
|
||||
int j1 = i1 & 7;
|
||||
|
||||
if (j1 == 5 && l == 1) {
|
||||
return true;
|
||||
return j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5)));
|
||||
}
|
||||
if (j1 == 4 && l == 2) {
|
||||
return true;
|
||||
}
|
||||
if (j1 == 3 && l == 3) {
|
||||
return true;
|
||||
}
|
||||
if (j1 == 2 && l == 4) {
|
||||
return true;
|
||||
}
|
||||
return j1 == 1 && l == 5;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
|
@ -20,12 +20,12 @@ public class BlockPressurePlate extends Block {
|
||||
private EnumMobType a;
|
||||
|
||||
protected BlockPressurePlate(int i, int j, EnumMobType enummobtype) {
|
||||
super(i, j, Material.d);
|
||||
a = enummobtype;
|
||||
a(true);
|
||||
super(i, j, Material.STONE);
|
||||
this.a = enummobtype;
|
||||
this.a(true);
|
||||
float f = 0.0625F;
|
||||
|
||||
a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
}
|
||||
|
||||
public int b() {
|
||||
@ -52,129 +52,118 @@ public class BlockPressurePlate extends Block {
|
||||
if (!world.d(i, j - 1, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
a_(world, i, j, k, world.b(i, j, k));
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
if (world.b(i, j, k) == 0) {
|
||||
return;
|
||||
} else {
|
||||
g(world, i, j, k);
|
||||
return;
|
||||
if (!world.isStatic) {
|
||||
if (world.getData(i, j, k) != 0) {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
if (world.b(i, j, k) == 1) {
|
||||
return;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Pressure Plate
|
||||
if (entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.entity.LivingEntity who = (entity == null)?null:(LivingEntity) entity.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
if (!world.isStatic) {
|
||||
if (world.getData(i, j, k) != 1) {
|
||||
|
||||
if (bie.isCancelled()) {
|
||||
return;
|
||||
// CraftBukkit start - Interact Pressure Plate
|
||||
if (entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.entity.LivingEntity who = (entity == null) ? null : (LivingEntity) entity.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
// CraftBukkit end
|
||||
|
||||
g(world, i, j, k);
|
||||
return;
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
boolean flag = world.b(i, j, k) == 1;
|
||||
boolean flag = world.getData(i, j, k) == 1;
|
||||
boolean flag1 = false;
|
||||
float f = 0.125F;
|
||||
List list = null;
|
||||
|
||||
if (a == EnumMobType.a) {
|
||||
list = world.b(((Entity) (null)), AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f));
|
||||
if (this.a == EnumMobType.EVERYTHING) {
|
||||
list = world.b((Entity) null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
if (a == EnumMobType.b) {
|
||||
list = world.a(net.minecraft.server.EntityLiving.class, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f));
|
||||
|
||||
if (this.a == EnumMobType.MOBS) {
|
||||
list = world.a(EntityLiving.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
if (a == EnumMobType.c) {
|
||||
list = world.a(net.minecraft.server.EntityPlayer.class, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f));
|
||||
|
||||
if (this.a == EnumMobType.PLAYERS) {
|
||||
list = world.a(EntityHuman.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
// Craftbukkit start
|
||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, flag ? 15 : 0, flag1 ? 15 : 0);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(bre);
|
||||
flag1 = bre.getNewCurrent() > 0;
|
||||
// Craftbukkit end
|
||||
|
||||
if (flag1 && !flag) {
|
||||
world.c(i, j, k, 1);
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j, k, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
}
|
||||
|
||||
if (!flag1 && flag) {
|
||||
world.c(i, j, k, 0);
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j, k, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.i(i, j, k, bi);
|
||||
world.i(i, j, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
int l = world.b(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j, k, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
super.b(world, i, j, k);
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
boolean flag = iblockaccess.b(i, j, k) == 1;
|
||||
boolean flag = iblockaccess.getData(i, j, k) == 1;
|
||||
float f = 0.0625F;
|
||||
|
||||
if (flag) {
|
||||
a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
} else {
|
||||
a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
|
||||
this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return iblockaccess.b(i, j, k) > 0;
|
||||
return iblockaccess.getData(i, j, k) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
if (world.b(i, j, k) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return l == 1;
|
||||
}
|
||||
return world.getData(i, j, k) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
|
@ -1,26 +1,35 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
private boolean a;
|
||||
private boolean a = false;
|
||||
private static List b = new ArrayList();
|
||||
|
||||
private boolean a(World world, int i, int j, int k, boolean flag) {
|
||||
if (flag) {
|
||||
b.add(((new RedstoneUpdateInfo(i, j, k, world.e))));
|
||||
b.add(new RedstoneUpdateInfo(i, j, k, world.e));
|
||||
}
|
||||
|
||||
int l = 0;
|
||||
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
for (int i1 = 0; i1 < b.size(); ++i1) {
|
||||
RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) b.get(i1);
|
||||
|
||||
if (redstoneupdateinfo.a == i && redstoneupdateinfo.b == j && redstoneupdateinfo.c == k && ++l >= 8) {
|
||||
return true;
|
||||
if (redstoneupdateinfo.a == i && redstoneupdateinfo.b == j && redstoneupdateinfo.c == k) {
|
||||
++l;
|
||||
if (l >= 8) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,9 +38,8 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
protected BlockRedstoneTorch(int i, int j, boolean flag) {
|
||||
super(i, j);
|
||||
a = false;
|
||||
a = flag;
|
||||
a(true);
|
||||
this.a = flag;
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public int b() {
|
||||
@ -39,119 +47,94 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
if (world.b(i, j, k) == 0) {
|
||||
if (world.getData(i, j, k) == 0) {
|
||||
super.e(world, i, j, k);
|
||||
}
|
||||
if (a) {
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j + 1, k, bi);
|
||||
world.h(i - 1, j, k, bi);
|
||||
world.h(i + 1, j, k, bi);
|
||||
world.h(i, j, k - 1, bi);
|
||||
world.h(i, j, k + 1, bi);
|
||||
|
||||
if (this.a) {
|
||||
world.h(i, j - 1, k, this.id);
|
||||
world.h(i, j + 1, k, this.id);
|
||||
world.h(i - 1, j, k, this.id);
|
||||
world.h(i + 1, j, k, this.id);
|
||||
world.h(i, j, k - 1, this.id);
|
||||
world.h(i, j, k + 1, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
if (a) {
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j + 1, k, bi);
|
||||
world.h(i - 1, j, k, bi);
|
||||
world.h(i + 1, j, k, bi);
|
||||
world.h(i, j, k - 1, bi);
|
||||
world.h(i, j, k + 1, bi);
|
||||
if (this.a) {
|
||||
world.h(i, j - 1, k, this.id);
|
||||
world.h(i, j + 1, k, this.id);
|
||||
world.h(i - 1, j, k, this.id);
|
||||
world.h(i + 1, j, k, this.id);
|
||||
world.h(i, j, k - 1, this.id);
|
||||
world.h(i, j, k + 1, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (!a) {
|
||||
if (!this.a) {
|
||||
return false;
|
||||
}
|
||||
int i1 = iblockaccess.b(i, j, k);
|
||||
} else {
|
||||
int i1 = iblockaccess.getData(i, j, k);
|
||||
|
||||
if (i1 == 5 && l == 1) {
|
||||
return false;
|
||||
return i1 == 5 && l == 1 ? false : (i1 == 3 && l == 3 ? false : (i1 == 4 && l == 2 ? false : (i1 == 1 && l == 5 ? false : i1 != 2 || l != 4)));
|
||||
}
|
||||
if (i1 == 3 && l == 3) {
|
||||
return false;
|
||||
}
|
||||
if (i1 == 4 && l == 2) {
|
||||
return false;
|
||||
}
|
||||
if (i1 == 1 && l == 5) {
|
||||
return false;
|
||||
}
|
||||
return i1 != 2 || l != 4;
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
int l = world.b(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l == 5 && world.k(i, j - 1, k, 0)) {
|
||||
return true;
|
||||
}
|
||||
if (l == 3 && world.k(i, j, k - 1, 2)) {
|
||||
return true;
|
||||
}
|
||||
if (l == 4 && world.k(i, j, k + 1, 3)) {
|
||||
return true;
|
||||
}
|
||||
if (l == 1 && world.k(i - 1, j, k, 4)) {
|
||||
return true;
|
||||
}
|
||||
return l == 2 && world.k(i + 1, j, k, 5);
|
||||
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))));
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = g(world, i, j, k);
|
||||
boolean flag = this.g(world, i, j, k);
|
||||
|
||||
for (; b.size() > 0 && world.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L; b.remove(0)) {
|
||||
;
|
||||
while (b.size() > 0 && world.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
|
||||
b.remove(0);
|
||||
}
|
||||
|
||||
|
||||
// Craftbukkit start
|
||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, flag ? 15 : 0, flag ? 0 : 15);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(bre);
|
||||
if ((bre.getNewCurrent() != 0) == flag) {
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, BlockFace.SELF, flag ? 15 : 0, flag ? 0 : 15);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
if ((event.getNewCurrent() != 0) == flag) {
|
||||
return;
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
if (a) {
|
||||
if (this.a) {
|
||||
if (flag) {
|
||||
world.b(i, j, k, Block.aP.bi, world.b(i, j, k));
|
||||
if (a(world, i, j, k, true)) {
|
||||
world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F);
|
||||
for (int l = 0; l < 5; l++) {
|
||||
double d1 = (double) i + random.nextDouble() * 0.59999999999999998D + 0.20000000000000001D;
|
||||
double d2 = (double) j + random.nextDouble() * 0.59999999999999998D + 0.20000000000000001D;
|
||||
double d3 = (double) k + random.nextDouble() * 0.59999999999999998D + 0.20000000000000001D;
|
||||
world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
||||
if (this.a(world, i, j, k, true)) {
|
||||
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F);
|
||||
|
||||
world.a("smoke", d1, d2, d3, 0.0D, 0.0D, 0.0D);
|
||||
for (int l = 0; l < 5; ++l) {
|
||||
double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
|
||||
double d1 = (double) j + random.nextDouble() * 0.6D + 0.2D;
|
||||
double d2 = (double) k + random.nextDouble() * 0.6D + 0.2D;
|
||||
|
||||
world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!flag && !a(world, i, j, k, false)) {
|
||||
world.b(i, j, k, Block.aQ.bi, world.b(i, j, k));
|
||||
} else if (!flag && !this.a(world, i, j, k, false)) {
|
||||
world.b(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
super.b(world, i, j, k, l);
|
||||
world.i(i, j, k, bi);
|
||||
world.i(i, j, k, this.id);
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
if (l == 0) {
|
||||
return b(((IBlockAccess) (world)), i, j, k, l);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false;
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Block.aQ.bi;
|
||||
return Block.REDSTONE_TORCH_ON.id;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
|
@ -2,24 +2,23 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
private boolean a;
|
||||
private Set b;
|
||||
private boolean a = true;
|
||||
private Set b = new HashSet();
|
||||
|
||||
public BlockRedstoneWire(int i, int j) {
|
||||
super(i, j, Material.n);
|
||||
a = true;
|
||||
b = ((Set) (new HashSet()));
|
||||
a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
@ -35,60 +34,67 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
a(world, i, j, k, i, j, k);
|
||||
ArrayList arraylist = new ArrayList(((java.util.Collection) (b)));
|
||||
this.a(world, i, j, k, i, j, k);
|
||||
ArrayList arraylist = new ArrayList(this.b);
|
||||
|
||||
b.clear();
|
||||
for (int l = 0; l < ((List) (arraylist)).size(); l++) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(l);
|
||||
this.b.clear();
|
||||
|
||||
world.h(chunkposition.a, chunkposition.b, chunkposition.c, bi);
|
||||
for (int l = 0; l < arraylist.size(); ++l) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
|
||||
|
||||
world.h(chunkposition.a, chunkposition.b, chunkposition.c, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(World world, int i, int j, int k, int l, int i1, int j1) {
|
||||
int k1 = world.b(i, j, k);
|
||||
int k1 = world.getData(i, j, k);
|
||||
int l1 = 0;
|
||||
|
||||
a = false;
|
||||
this.a = false;
|
||||
boolean flag = world.p(i, j, k);
|
||||
|
||||
a = true;
|
||||
this.a = true;
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
|
||||
if (flag) {
|
||||
l1 = 15;
|
||||
} else {
|
||||
for (int i2 = 0; i2 < 4; i2++) {
|
||||
int k2 = i;
|
||||
int i3 = k;
|
||||
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
j2 = i;
|
||||
k2 = k;
|
||||
if (i2 == 0) {
|
||||
k2--;
|
||||
j2 = i - 1;
|
||||
}
|
||||
|
||||
if (i2 == 1) {
|
||||
k2++;
|
||||
++j2;
|
||||
}
|
||||
|
||||
if (i2 == 2) {
|
||||
i3--;
|
||||
k2 = k - 1;
|
||||
}
|
||||
|
||||
if (i2 == 3) {
|
||||
i3++;
|
||||
++k2;
|
||||
}
|
||||
if (k2 != l || j != i1 || i3 != j1) {
|
||||
l1 = f(world, k2, j, i3, l1);
|
||||
|
||||
if (j2 != l || j != i1 || k2 != j1) {
|
||||
l1 = this.f(world, j2, j, k2, l1);
|
||||
}
|
||||
if (world.d(k2, j, i3) && !world.d(i, j + 1, k)) {
|
||||
if (k2 != l || j + 1 != i1 || i3 != j1) {
|
||||
l1 = f(world, k2, j + 1, i3, l1);
|
||||
|
||||
if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) {
|
||||
if (j2 != l || j + 1 != i1 || k2 != j1) {
|
||||
l1 = this.f(world, j2, j + 1, k2, l1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!world.d(k2, j, i3) && (k2 != l || j - 1 != i1 || i3 != j1)) {
|
||||
l1 = f(world, k2, j - 1, i3, l1);
|
||||
} else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
|
||||
l1 = this.f(world, j2, j - 1, k2, l1);
|
||||
}
|
||||
}
|
||||
|
||||
if (l1 > 0) {
|
||||
l1--;
|
||||
--l1;
|
||||
} else {
|
||||
l1 = 0;
|
||||
}
|
||||
@ -97,250 +103,238 @@ public class BlockRedstoneWire extends Block {
|
||||
// Craftbukkit start
|
||||
if (k1 != l1) {
|
||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, k1, l1);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(bre);
|
||||
l1 = bre.getNewCurrent();
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, BlockFace.SELF, k1, l1);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
l1 = event.getNewCurrent();
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
|
||||
if (k1 != l1) {
|
||||
world.i = true;
|
||||
world.c(i, j, k, l1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.i = false;
|
||||
for (int j2 = 0; j2 < 4; j2++) {
|
||||
int l2 = i;
|
||||
int j3 = k;
|
||||
int k3 = j - 1;
|
||||
|
||||
if (j2 == 0) {
|
||||
l2--;
|
||||
}
|
||||
if (j2 == 1) {
|
||||
l2++;
|
||||
}
|
||||
if (j2 == 2) {
|
||||
j3--;
|
||||
}
|
||||
if (j2 == 3) {
|
||||
j3++;
|
||||
}
|
||||
if (world.d(l2, j, j3)) {
|
||||
k3 += 2;
|
||||
}
|
||||
int l3 = 0;
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
j2 = i;
|
||||
k2 = k;
|
||||
int l2 = j - 1;
|
||||
|
||||
l3 = f(world, l2, j, j3, -1);
|
||||
l1 = world.b(i, j, k);
|
||||
if (i2 == 0) {
|
||||
j2 = i - 1;
|
||||
}
|
||||
|
||||
if (i2 == 1) {
|
||||
++j2;
|
||||
}
|
||||
|
||||
if (i2 == 2) {
|
||||
k2 = k - 1;
|
||||
}
|
||||
|
||||
if (i2 == 3) {
|
||||
++k2;
|
||||
}
|
||||
|
||||
if (world.d(j2, j, k2)) {
|
||||
l2 += 2;
|
||||
}
|
||||
|
||||
boolean flag1 = false;
|
||||
int i3 = this.f(world, j2, j, k2, -1);
|
||||
|
||||
l1 = world.getData(i, j, k);
|
||||
if (l1 > 0) {
|
||||
l1--;
|
||||
--l1;
|
||||
}
|
||||
if (l3 >= 0 && l3 != l1) {
|
||||
a(world, l2, j, j3, i, j, k);
|
||||
|
||||
if (i3 >= 0 && i3 != l1) {
|
||||
this.a(world, j2, j, k2, i, j, k);
|
||||
}
|
||||
l3 = f(world, l2, k3, j3, -1);
|
||||
l1 = world.b(i, j, k);
|
||||
|
||||
i3 = this.f(world, j2, l2, k2, -1);
|
||||
l1 = world.getData(i, j, k);
|
||||
if (l1 > 0) {
|
||||
l1--;
|
||||
--l1;
|
||||
}
|
||||
if (l3 >= 0 && l3 != l1) {
|
||||
a(world, l2, k3, j3, i, j, k);
|
||||
|
||||
if (i3 >= 0 && i3 != l1) {
|
||||
this.a(world, j2, l2, k2, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
if (k1 == 0 || l1 == 0) {
|
||||
b.add(((new ChunkPosition(i, j, k))));
|
||||
b.add(((new ChunkPosition(i - 1, j, k))));
|
||||
b.add(((new ChunkPosition(i + 1, j, k))));
|
||||
b.add(((new ChunkPosition(i, j - 1, k))));
|
||||
b.add(((new ChunkPosition(i, j + 1, k))));
|
||||
b.add(((new ChunkPosition(i, j, k - 1))));
|
||||
b.add(((new ChunkPosition(i, j, k + 1))));
|
||||
this.b.add(new ChunkPosition(i, j, k));
|
||||
this.b.add(new ChunkPosition(i - 1, j, k));
|
||||
this.b.add(new ChunkPosition(i + 1, j, k));
|
||||
this.b.add(new ChunkPosition(i, j - 1, k));
|
||||
this.b.add(new ChunkPosition(i, j + 1, k));
|
||||
this.b.add(new ChunkPosition(i, j, k - 1));
|
||||
this.b.add(new ChunkPosition(i, j, k + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void h(World world, int i, int j, int k) {
|
||||
if (world.a(i, j, k) != bi) {
|
||||
return;
|
||||
} else {
|
||||
world.h(i, j, k, bi);
|
||||
world.h(i - 1, j, k, bi);
|
||||
world.h(i + 1, j, k, bi);
|
||||
world.h(i, j, k - 1, bi);
|
||||
world.h(i, j, k + 1, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
world.h(i, j + 1, k, bi);
|
||||
return;
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
world.h(i, j, k, this.id);
|
||||
world.h(i - 1, j, k, this.id);
|
||||
world.h(i + 1, j, k, this.id);
|
||||
world.h(i, j, k - 1, this.id);
|
||||
world.h(i, j, k + 1, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
world.h(i, j + 1, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
super.e(world, i, j, k);
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
g(world, i, j, k);
|
||||
world.h(i, j + 1, k, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
h(world, i - 1, j, k);
|
||||
h(world, i + 1, j, k);
|
||||
h(world, i, j, k - 1);
|
||||
h(world, i, j, k + 1);
|
||||
if (world.d(i - 1, j, k)) {
|
||||
h(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
h(world, i - 1, j - 1, k);
|
||||
}
|
||||
if (world.d(i + 1, j, k)) {
|
||||
h(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
h(world, i + 1, j - 1, k);
|
||||
}
|
||||
if (world.d(i, j, k - 1)) {
|
||||
h(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
h(world, i, j - 1, k - 1);
|
||||
}
|
||||
if (world.d(i, j, k + 1)) {
|
||||
h(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
h(world, i, j - 1, k + 1);
|
||||
if (!world.isStatic) {
|
||||
this.g(world, i, j, k);
|
||||
world.h(i, j + 1, k, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
this.h(world, i - 1, j, k);
|
||||
this.h(world, i + 1, j, k);
|
||||
this.h(world, i, j, k - 1);
|
||||
this.h(world, i, j, k + 1);
|
||||
if (world.d(i - 1, j, k)) {
|
||||
this.h(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i - 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.d(i + 1, j, k)) {
|
||||
this.h(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i + 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.d(i, j, k - 1)) {
|
||||
this.h(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k - 1);
|
||||
}
|
||||
|
||||
if (world.d(i, j, k + 1)) {
|
||||
this.h(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k) {
|
||||
super.b(world, i, j, k);
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
world.h(i, j + 1, k, bi);
|
||||
world.h(i, j - 1, k, bi);
|
||||
g(world, i, j, k);
|
||||
h(world, i - 1, j, k);
|
||||
h(world, i + 1, j, k);
|
||||
h(world, i, j, k - 1);
|
||||
h(world, i, j, k + 1);
|
||||
if (world.d(i - 1, j, k)) {
|
||||
h(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
h(world, i - 1, j - 1, k);
|
||||
}
|
||||
if (world.d(i + 1, j, k)) {
|
||||
h(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
h(world, i + 1, j - 1, k);
|
||||
}
|
||||
if (world.d(i, j, k - 1)) {
|
||||
h(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
h(world, i, j - 1, k - 1);
|
||||
}
|
||||
if (world.d(i, j, k + 1)) {
|
||||
h(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
h(world, i, j - 1, k + 1);
|
||||
if (!world.isStatic) {
|
||||
world.h(i, j + 1, k, this.id);
|
||||
world.h(i, j - 1, k, this.id);
|
||||
this.g(world, i, j, k);
|
||||
this.h(world, i - 1, j, k);
|
||||
this.h(world, i + 1, j, k);
|
||||
this.h(world, i, j, k - 1);
|
||||
this.h(world, i, j, k + 1);
|
||||
if (world.d(i - 1, j, k)) {
|
||||
this.h(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i - 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.d(i + 1, j, k)) {
|
||||
this.h(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i + 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.d(i, j, k - 1)) {
|
||||
this.h(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k - 1);
|
||||
}
|
||||
|
||||
if (world.d(i, j, k + 1)) {
|
||||
this.h(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int f(World world, int i, int j, int k, int l) {
|
||||
if (world.a(i, j, k) != bi) {
|
||||
if (world.getTypeId(i, j, k) != this.id) {
|
||||
return l;
|
||||
}
|
||||
int i1 = world.b(i, j, k);
|
||||
|
||||
if (i1 > l) {
|
||||
return i1;
|
||||
} else {
|
||||
return l;
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
return i1 > l ? i1 : l;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
if (world.z) {
|
||||
return;
|
||||
}
|
||||
int i1 = world.b(i, j, k);
|
||||
boolean flag = a(world, i, j, k);
|
||||
if (!world.isStatic) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag = this.a(world, i, j, k);
|
||||
|
||||
if (!flag) {
|
||||
a_(world, i, j, k, i1);
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
g(world, i, j, k);
|
||||
if (!flag) {
|
||||
this.a_(world, i, j, k, i1);
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
super.b(world, i, j, k, l);
|
||||
}
|
||||
super.b(world, i, j, k, l);
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Item.aA.ba;
|
||||
return Item.REDSTONE.id;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
if (!a) {
|
||||
return false;
|
||||
} else {
|
||||
return b(((IBlockAccess) (world)), i, j, k, l);
|
||||
}
|
||||
return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l);
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (!a) {
|
||||
if (!this.a) {
|
||||
return false;
|
||||
}
|
||||
if (iblockaccess.b(i, j, k) == 0) {
|
||||
} else if (iblockaccess.getData(i, j, k) == 0) {
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
} else if (l == 1) {
|
||||
return true;
|
||||
}
|
||||
boolean flag = b(iblockaccess, i - 1, j, k) || !iblockaccess.d(i - 1, j, k) && b(iblockaccess, i - 1, j - 1, k);
|
||||
boolean flag1 = b(iblockaccess, i + 1, j, k) || !iblockaccess.d(i + 1, j, k) && b(iblockaccess, i + 1, j - 1, k);
|
||||
boolean flag2 = b(iblockaccess, i, j, k - 1) || !iblockaccess.d(i, j, k - 1) && b(iblockaccess, i, j - 1, k - 1);
|
||||
boolean flag3 = b(iblockaccess, i, j, k + 1) || !iblockaccess.d(i, j, k + 1) && b(iblockaccess, i, j - 1, k + 1);
|
||||
} else {
|
||||
boolean flag = b(iblockaccess, i - 1, j, k) || !iblockaccess.d(i - 1, j, k) && b(iblockaccess, i - 1, j - 1, k);
|
||||
boolean flag1 = b(iblockaccess, i + 1, j, k) || !iblockaccess.d(i + 1, j, k) && b(iblockaccess, i + 1, j - 1, k);
|
||||
boolean flag2 = b(iblockaccess, i, j, k - 1) || !iblockaccess.d(i, j, k - 1) && b(iblockaccess, i, j - 1, k - 1);
|
||||
boolean flag3 = b(iblockaccess, i, j, k + 1) || !iblockaccess.d(i, j, k + 1) && b(iblockaccess, i, j - 1, k + 1);
|
||||
|
||||
if (!iblockaccess.d(i, j + 1, k)) {
|
||||
if (iblockaccess.d(i - 1, j, k) && b(iblockaccess, i - 1, j + 1, k)) {
|
||||
flag = true;
|
||||
}
|
||||
if (iblockaccess.d(i + 1, j, k) && b(iblockaccess, i + 1, j + 1, k)) {
|
||||
flag1 = true;
|
||||
}
|
||||
if (iblockaccess.d(i, j, k - 1) && b(iblockaccess, i, j + 1, k - 1)) {
|
||||
flag2 = true;
|
||||
}
|
||||
if (iblockaccess.d(i, j, k + 1) && b(iblockaccess, i, j + 1, k + 1)) {
|
||||
flag3 = true;
|
||||
if (!iblockaccess.d(i, j + 1, k)) {
|
||||
if (iblockaccess.d(i - 1, j, k) && b(iblockaccess, i - 1, j + 1, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.d(i + 1, j, k) && b(iblockaccess, i + 1, j + 1, k)) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.d(i, j, k - 1) && b(iblockaccess, i, j + 1, k - 1)) {
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.d(i, j, k + 1) && b(iblockaccess, i, j + 1, k + 1)) {
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5 ? true : (l == 2 && flag2 && !flag && !flag1 ? true : (l == 3 && flag3 && !flag && !flag1 ? true : (l == 4 && flag && !flag2 && !flag3 ? true : l == 5 && flag1 && !flag2 && !flag3)));
|
||||
}
|
||||
if (!flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5) {
|
||||
return true;
|
||||
}
|
||||
if (l == 2 && flag2 && !flag && !flag1) {
|
||||
return true;
|
||||
}
|
||||
if (l == 3 && flag3 && !flag && !flag1) {
|
||||
return true;
|
||||
}
|
||||
if (l == 4 && flag && !flag2 && !flag3) {
|
||||
return true;
|
||||
}
|
||||
return l == 5 && flag1 && !flag2 && !flag3;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return a;
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public static boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.a(i, j, k);
|
||||
int l = iblockaccess.getTypeId(i, j, k);
|
||||
|
||||
if (l == Block.av.bi) {
|
||||
return true;
|
||||
}
|
||||
if (l == 0) {
|
||||
return false;
|
||||
}
|
||||
return Block.m[l].c();
|
||||
return l == Block.REDSTONE_WIRE.id ? true : (l == 0 ? false : Block.byId[l].c());
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +1,66 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import java.util.Random;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockStationary extends BlockFluids {
|
||||
|
||||
protected BlockStationary(int k, Material material) {
|
||||
super(k, material);
|
||||
a(false);
|
||||
if (material == Material.g) {
|
||||
a(true);
|
||||
protected BlockStationary(int i, Material material) {
|
||||
super(i, material);
|
||||
this.a(false);
|
||||
if (material == Material.LAVA) {
|
||||
this.a(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int k, int l, int i1, int j1) {
|
||||
super.b(world, k, l, i1, j1);
|
||||
if (world.a(k, l, i1) == bi) {
|
||||
i(world, k, l, i1);
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
super.b(world, i, j, k, l);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private void i(World world, int k, int l, int i1) {
|
||||
int j1 = world.b(k, l, i1);
|
||||
private void i(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.i = true;
|
||||
world.a(k, l, i1, bi - 1, j1);
|
||||
world.b(k, l, i1, k, l, i1);
|
||||
world.i(k, l, i1, bi - 1);
|
||||
world.setTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.i(i, j, k, this.id - 1);
|
||||
world.i = false;
|
||||
}
|
||||
|
||||
public void a(World world, int k, int l, int i1, Random random) {
|
||||
if (bt == Material.g) {
|
||||
int j1 = random.nextInt(3);
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (this.material == Material.LAVA) {
|
||||
int l = random.nextInt(3);
|
||||
|
||||
for (int k1 = 0; k1 < j1; k1++) {
|
||||
// CraftBukkit start: prevent lava putting something on fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
Player thePlayer = null;
|
||||
// CraftBukkit end
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
i += random.nextInt(3) - 1;
|
||||
++j;
|
||||
k += random.nextInt(3) - 1;
|
||||
l++;
|
||||
i1 += random.nextInt(3) - 1;
|
||||
int l1 = world.a(k, l, i1);
|
||||
int j1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (l1 == 0) {
|
||||
// this checks if an adjacent block is flammable before lighting this block.
|
||||
// perhaps we can reduce spam by checking this earlier.
|
||||
if (j(world, k - 1, l, i1) || j(world, k + 1, l, i1) || j(world, k, l, i1 - 1) || j(world, k, l, i1 + 1) || j(world, k, l - 1, i1) || j(world, k, l + 1, i1)) {
|
||||
if (j1 == 0) {
|
||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||
// CraftBukkit start: prevent lava putting something on fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(k, l, i1);
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
Player thePlayer = null;
|
||||
|
||||
if (theBlock.getTypeId() != Block.ar.bi){
|
||||
|
||||
if (theBlock.getTypeId() != Block.FIRE.id){
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
@ -66,19 +68,18 @@ public class BlockStationary extends BlockFluids {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.e(k, l, i1, Block.ar.bi);
|
||||
|
||||
world.e(i, j, k, Block.FIRE.id);
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (Block.m[l1].bt.c()) {
|
||||
} else if (Block.byId[j1].material.isSolid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean j(World world, int k, int l, int i1) {
|
||||
return world.c(k, l, i1).e();
|
||||
private boolean j(World world, int i, int j, int k) {
|
||||
return world.getMaterial(i, j, k).isBurnable();
|
||||
}
|
||||
}
|
||||
|
@ -12,26 +12,16 @@ import org.bukkit.event.block.BlockInteractEvent;
|
||||
public class BlockWorkbench extends Block {
|
||||
|
||||
protected BlockWorkbench(int i) {
|
||||
super(i, Material.c);
|
||||
bh = 59;
|
||||
super(i, Material.WOOD);
|
||||
this.textureId = 59;
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
if (i == 1) {
|
||||
return bh - 16;
|
||||
}
|
||||
if (i == 0) {
|
||||
return Block.x.a(0);
|
||||
}
|
||||
if (i == 2 || i == 4) {
|
||||
return bh + 1;
|
||||
} else {
|
||||
return bh;
|
||||
}
|
||||
return i == 1 ? this.textureId - 16 : (i == 0 ? Block.WOOD.a(0) : (i != 2 && i != 4 ? this.textureId : this.textureId + 1));
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityPlayer entityplayer) {
|
||||
if (world.z) {
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Interact Workbench
|
||||
@ -39,17 +29,17 @@ public class BlockWorkbench extends Block {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
LivingEntity who = (entityplayer == null)?null:(LivingEntity)entityplayer.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(bie);
|
||||
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
|
||||
|
||||
if (bie.isCancelled()) {
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityplayer.a(i, j, k);
|
||||
entityhuman.a(i, j, k);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
@ -13,57 +18,55 @@ import org.bukkit.event.world.ChunkLoadEvent;
|
||||
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
private Set a;
|
||||
private Set a = new HashSet();
|
||||
private Chunk b;
|
||||
private IChunkProvider c;
|
||||
private IChunkLoader d;
|
||||
private Map e;
|
||||
private List f;
|
||||
private Map e = new HashMap();
|
||||
private List f = new ArrayList();
|
||||
private WorldServer g;
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
a = ((Set) (new HashSet()));
|
||||
e = ((Map) (new HashMap()));
|
||||
f = ((List) (new ArrayList()));
|
||||
b = ((Chunk) (new EmptyChunk(((World) (worldserver)), new byte[32768], 0, 0)));
|
||||
g = worldserver;
|
||||
d = ichunkloader;
|
||||
c = ichunkprovider;
|
||||
this.b = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0);
|
||||
this.g = worldserver;
|
||||
this.d = ichunkloader;
|
||||
this.c = ichunkprovider;
|
||||
}
|
||||
|
||||
public boolean a(int i, int j) {
|
||||
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
|
||||
|
||||
return e.containsKey(((chunkcoordinates)));
|
||||
return this.e.containsKey(chunkcoordinates);
|
||||
}
|
||||
|
||||
public void c(int i, int j) {
|
||||
int k = (i * 16 + 8) - g.m;
|
||||
int l = (j * 16 + 8) - g.o;
|
||||
char c1 = '\200';
|
||||
int k = i * 16 + 8 - this.g.spawnX;
|
||||
int l = j * 16 + 8 - this.g.spawnZ;
|
||||
short short1 = 128;
|
||||
|
||||
if (k < -c1 || k > c1 || l < -c1 || l > c1) {
|
||||
a.add(((new ChunkCoordinates(i, j))));
|
||||
if (k < -short1 || k > short1 || l < -short1 || l > short1) {
|
||||
this.a.add(new ChunkCoordinates(i, j));
|
||||
}
|
||||
}
|
||||
|
||||
public Chunk d(int i, int j) {
|
||||
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
|
||||
|
||||
a.remove(((new ChunkCoordinates(i, j))));
|
||||
Chunk chunk = (Chunk) e.get(((chunkcoordinates)));
|
||||
this.a.remove(new ChunkCoordinates(i, j));
|
||||
Chunk chunk = (Chunk) this.e.get(chunkcoordinates);
|
||||
|
||||
if (chunk == null) {
|
||||
chunk = e(i, j);
|
||||
chunk = this.e(i, j);
|
||||
if (chunk == null) {
|
||||
if (c == null) {
|
||||
chunk = b;
|
||||
if (this.c == null) {
|
||||
chunk = this.b;
|
||||
} else {
|
||||
chunk = c.b(i, j);
|
||||
chunk = this.c.b(i, j);
|
||||
}
|
||||
}
|
||||
e.put(((chunkcoordinates)), ((chunk)));
|
||||
f.add(((chunk)));
|
||||
|
||||
this.e.put(chunkcoordinates, chunk);
|
||||
this.f.add(chunk);
|
||||
if (chunk != null) {
|
||||
chunk.c();
|
||||
chunk.d();
|
||||
@ -83,84 +86,80 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (!chunk.n && a(i + 1, j + 1) && a(i, j + 1) && a(i + 1, j)) {
|
||||
a(((IChunkProvider) (this)), i, j);
|
||||
if (!chunk.n && this.a(i + 1, j + 1) && this.a(i, j + 1) && this.a(i + 1, j)) {
|
||||
this.a(this, i, j);
|
||||
}
|
||||
if (a(i - 1, j) && !b(i - 1, j).n && a(i - 1, j + 1) && a(i, j + 1) && a(i - 1, j)) {
|
||||
a(((IChunkProvider) (this)), i - 1, j);
|
||||
|
||||
if (this.a(i - 1, j) && !this.b(i - 1, j).n && this.a(i - 1, j + 1) && this.a(i, j + 1) && this.a(i - 1, j)) {
|
||||
this.a(this, i - 1, j);
|
||||
}
|
||||
if (a(i, j - 1) && !b(i, j - 1).n && a(i + 1, j - 1) && a(i, j - 1) && a(i + 1, j)) {
|
||||
a(((IChunkProvider) (this)), i, j - 1);
|
||||
|
||||
if (this.a(i, j - 1) && !this.b(i, j - 1).n && this.a(i + 1, j - 1) && this.a(i, j - 1) && this.a(i + 1, j)) {
|
||||
this.a(this, i, j - 1);
|
||||
}
|
||||
if (a(i - 1, j - 1) && !b(i - 1, j - 1).n && a(i - 1, j - 1) && a(i, j - 1) && a(i - 1, j)) {
|
||||
a(((IChunkProvider) (this)), i - 1, j - 1);
|
||||
|
||||
if (this.a(i - 1, j - 1) && !this.b(i - 1, j - 1).n && this.a(i - 1, j - 1) && this.a(i, j - 1) && this.a(i - 1, j)) {
|
||||
this.a(this, i - 1, j - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk b(int i, int j) {
|
||||
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(i, j);
|
||||
Chunk chunk = (Chunk) e.get(((chunkcoordinates)));
|
||||
Chunk chunk = (Chunk) this.e.get(chunkcoordinates);
|
||||
|
||||
if (chunk == null) {
|
||||
if (g.x) {
|
||||
return d(i, j);
|
||||
} else {
|
||||
return b;
|
||||
}
|
||||
} else {
|
||||
return chunk;
|
||||
}
|
||||
return chunk == null ? (this.g.x ? this.d(i, j) : this.b) : chunk;
|
||||
}
|
||||
|
||||
private Chunk e(int i, int j) {
|
||||
if (d == null) {
|
||||
if (this.d == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
Chunk chunk = d.a(((World) (g)), i, j);
|
||||
} else {
|
||||
try {
|
||||
Chunk chunk = this.d.a(this.g, i, j);
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.r = g.e;
|
||||
if (chunk != null) {
|
||||
chunk.r = this.g.e;
|
||||
}
|
||||
|
||||
return chunk;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return chunk;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void a(Chunk chunk) {
|
||||
if (d == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
d.b(((World) (g)), chunk);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
if (this.d != null) {
|
||||
try {
|
||||
this.d.b(this.g, chunk);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(Chunk chunk) {
|
||||
if (d == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
chunk.r = g.e;
|
||||
d.a(((World) (g)), chunk);
|
||||
} catch (Throwable ioexception) { // CraftBukkit -- downcast to work
|
||||
ioexception.printStackTrace();
|
||||
if (this.d != null) {
|
||||
try {
|
||||
chunk.r = this.g.e;
|
||||
this.d.a(this.g, chunk);
|
||||
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
ioexception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IChunkProvider ichunkprovider, int i, int j) {
|
||||
Chunk chunk = b(i, j);
|
||||
Chunk chunk = this.b(i, j);
|
||||
|
||||
if (!chunk.n) {
|
||||
chunk.n = true;
|
||||
if (c != null) {
|
||||
c.a(ichunkprovider, i, j);
|
||||
if (this.c != null) {
|
||||
this.c.a(ichunkprovider, i, j);
|
||||
chunk.f();
|
||||
}
|
||||
}
|
||||
@ -169,55 +168,59 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public boolean a(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
int i = 0;
|
||||
|
||||
for (int j = 0; j < f.size(); j++) {
|
||||
Chunk chunk = (Chunk) f.get(j);
|
||||
for (int j = 0; j < this.f.size(); ++j) {
|
||||
Chunk chunk = (Chunk) this.f.get(j);
|
||||
|
||||
if (flag && !chunk.p) {
|
||||
a(chunk);
|
||||
this.a(chunk);
|
||||
}
|
||||
if (!chunk.a(flag)) {
|
||||
continue;
|
||||
}
|
||||
b(chunk);
|
||||
chunk.o = false;
|
||||
if (++i == 24 && !flag) {
|
||||
return false;
|
||||
|
||||
if (chunk.a(flag)) {
|
||||
this.b(chunk);
|
||||
chunk.o = false;
|
||||
++i;
|
||||
if (i == 24 && !flag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (d == null) {
|
||||
if (this.d == null) {
|
||||
return true;
|
||||
}
|
||||
d.b();
|
||||
|
||||
this.d.b();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
if (!g.C) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
if (!a.isEmpty()) {
|
||||
ChunkCoordinates chunkcoordinates = (ChunkCoordinates) a.iterator().next();
|
||||
Chunk chunk = b(chunkcoordinates.a, chunkcoordinates.b);
|
||||
if (!this.g.C) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
if (!this.a.isEmpty()) {
|
||||
ChunkCoordinates chunkcoordinates = (ChunkCoordinates) this.a.iterator().next();
|
||||
Chunk chunk = this.b(chunkcoordinates.a, chunkcoordinates.b);
|
||||
|
||||
chunk.e();
|
||||
b(chunk);
|
||||
a(chunk);
|
||||
a.remove(((chunkcoordinates)));
|
||||
e.remove(((chunkcoordinates)));
|
||||
f.remove(((chunk)));
|
||||
this.b(chunk);
|
||||
this.a(chunk);
|
||||
this.a.remove(chunkcoordinates);
|
||||
this.e.remove(chunkcoordinates);
|
||||
this.f.remove(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
if (d != null) {
|
||||
d.a();
|
||||
if (this.d != null) {
|
||||
this.d.a();
|
||||
}
|
||||
}
|
||||
return c.a();
|
||||
|
||||
return this.c.a();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return !g.C;
|
||||
return !this.g.C;
|
||||
}
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -5,22 +5,19 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftAnimals;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityAnimals extends EntityCreature implements IAnimals {
|
||||
public abstract class EntityAnimal extends EntityCreature implements IAnimal {
|
||||
|
||||
public EntityAnimals(World world) {
|
||||
public EntityAnimal(World world) {
|
||||
super(world);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftAnimals(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float a(int i, int j, int k) {
|
||||
if (l.a(i, j - 1, k) == Block.u.bi) {
|
||||
return 10F;
|
||||
} else {
|
||||
return l.l(i, j, k) - 0.5F;
|
||||
}
|
||||
return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id ? 10.0F : this.world.l(i, j, k) - 0.5F;
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -32,11 +29,11 @@ public abstract class EntityAnimals extends EntityCreature implements IAnimals {
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
int i = MathHelper.b(p);
|
||||
int j = MathHelper.b(z.b);
|
||||
int k = MathHelper.b(r);
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.b(this.boundingBox.b);
|
||||
int k = MathHelper.b(this.locZ);
|
||||
|
||||
return l.a(i, j - 1, k) == Block.u.bi && l.j(i, j, k) > 8 && super.b();
|
||||
return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id && this.world.j(i, j, k) > 8 && super.b();
|
||||
}
|
||||
|
||||
public int c() {
|
@ -10,278 +10,280 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
|
||||
public class EntityArrow extends Entity {
|
||||
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private boolean ak;
|
||||
public int a;
|
||||
private int c = -1;
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
private int f = 0;
|
||||
private boolean ak = false;
|
||||
public int a = 0;
|
||||
public EntityLiving b;
|
||||
private int al;
|
||||
private int am;
|
||||
|
||||
private int am = 0;
|
||||
|
||||
public EntityArrow(World world) {
|
||||
super(world);
|
||||
c = -1;
|
||||
d = -1;
|
||||
e = -1;
|
||||
f = 0;
|
||||
ak = false;
|
||||
a = 0;
|
||||
am = 0;
|
||||
a(0.5F, 0.5F);
|
||||
|
||||
this.a(0.5F, 0.5F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftArrow(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityArrow(World world, double d1, double d2, double d3) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
a(d1, d2, d3);
|
||||
H = 0.0F;
|
||||
public EntityArrow(World world, double d0, double d1, double d2) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
this.a(0.5F, 0.5F);
|
||||
this.a(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public EntityArrow(World world, EntityLiving entityliving) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
b = entityliving;
|
||||
c(entityliving.p, entityliving.q + (double) entityliving.w(), entityliving.r, entityliving.v, entityliving.w);
|
||||
p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F;
|
||||
q -= 0.10000000149011612D;
|
||||
r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F;
|
||||
a(p, q, r);
|
||||
H = 0.0F;
|
||||
s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F);
|
||||
u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F);
|
||||
t = -MathHelper.a((w / 180F) * 3.141593F);
|
||||
a(s, t, u, 1.5F, 1.0F);
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
this.b = entityliving;
|
||||
this.a(0.5F, 0.5F);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F));
|
||||
this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F));
|
||||
this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F));
|
||||
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void a(double d1, double d2, double d3, float f1, float f2) {
|
||||
float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d1 /= f3;
|
||||
d2 /= f3;
|
||||
d3 /= f3;
|
||||
d1 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d2 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d3 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d1 *= f1;
|
||||
d2 *= f1;
|
||||
d3 *= f1;
|
||||
s = d1;
|
||||
t = d2;
|
||||
u = d3;
|
||||
float f4 = MathHelper.a(d1 * d1 + d3 * d3);
|
||||
d0 /= (double) f2;
|
||||
d1 /= (double) f2;
|
||||
d2 /= (double) f2;
|
||||
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d0 *= (double) f;
|
||||
d1 *= (double) f;
|
||||
d2 *= (double) f;
|
||||
this.motX = d0;
|
||||
this.motY = d1;
|
||||
this.motZ = d2;
|
||||
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
|
||||
|
||||
x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D);
|
||||
y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D);
|
||||
al = 0;
|
||||
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.al = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (y == 0.0F && x == 0.0F) {
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
|
||||
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
x = v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
y = w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D);
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
|
||||
}
|
||||
if (a > 0) {
|
||||
a--;
|
||||
}
|
||||
if (ak) {
|
||||
int i = l.a(c, d, e);
|
||||
|
||||
if (i != f) {
|
||||
ak = false;
|
||||
s *= W.nextFloat() * 0.2F;
|
||||
t *= W.nextFloat() * 0.2F;
|
||||
u *= W.nextFloat() * 0.2F;
|
||||
al = 0;
|
||||
am = 0;
|
||||
} else {
|
||||
al++;
|
||||
if (al == 1200) {
|
||||
q();
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (this.ak) {
|
||||
int i = this.world.getTypeId(this.c, this.d, this.e);
|
||||
|
||||
if (i == this.f) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
am++;
|
||||
}
|
||||
Vec3D vec3d = Vec3D.b(p, q, r);
|
||||
Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
MovingObjectPosition movingobjectposition = l.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(p, q, r);
|
||||
vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
this.ak = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.al = 0;
|
||||
this.am = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
Entity entity = null;
|
||||
List list = l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
|
||||
double d1 = 0.0D;
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
Entity entity = null;
|
||||
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
|
||||
float f1;
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (!entity1.c_() || entity1 == b && am < 5) {
|
||||
continue;
|
||||
}
|
||||
float f5 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.z.b(f5, f5, f5);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
if (entity1.c_() && (entity1 != this.b || this.am >= 5)) {
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
if (movingobjectposition1 == null) {
|
||||
continue;
|
||||
}
|
||||
double d2 = vec3d.a(movingobjectposition1.f);
|
||||
if (movingobjectposition1 != null) {
|
||||
double d1 = vec3d.a(movingobjectposition1.f);
|
||||
|
||||
if (d2 < d1 || d1 == 0.0D) {
|
||||
entity = entity1;
|
||||
d1 = d2;
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
float f2;
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
boolean bounce;
|
||||
boolean stick;
|
||||
if (entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
|
||||
//TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
||||
// or leave as DamageCause.ENTITY_ATTACK
|
||||
org.bukkit.entity.Entity shooter = (b == null)?null:b.getBukkitEntity();
|
||||
org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
// TODO deal with arrows being fired from a non-entity
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 4;
|
||||
|
||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(edbpe);
|
||||
if(!edbpe.isCancelled()) {
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the arrow should stick in or not, i.e. !bounce
|
||||
bounce = !movingobjectposition.g.a(((Entity) (b)), edbpe.getDamage());
|
||||
stick = movingobjectposition.g.a(this.b, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the arrow should bounce or not
|
||||
bounce = edbpe.getBounce();
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
bounce = !movingobjectposition.g.a(((Entity) (b)), 4);
|
||||
stick = movingobjectposition.g.a(this.b, 4);
|
||||
}
|
||||
if (!bounce) {
|
||||
// CraftBukkit end
|
||||
l.a(((Entity) (this)), "random.drr", 1.0F, 1.2F / (W.nextFloat() * 0.2F + 0.9F));
|
||||
q();
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
this.q();
|
||||
} else {
|
||||
s *= -0.10000000149011612D;
|
||||
t *= -0.10000000149011612D;
|
||||
u *= -0.10000000149011612D;
|
||||
v += 180F;
|
||||
x += 180F;
|
||||
am = 0;
|
||||
this.motX *= -0.10000000149011612D;
|
||||
this.motY *= -0.10000000149011612D;
|
||||
this.motZ *= -0.10000000149011612D;
|
||||
this.yaw += 180.0F;
|
||||
this.lastYaw += 180.0F;
|
||||
this.am = 0;
|
||||
}
|
||||
} else {
|
||||
c = movingobjectposition.b;
|
||||
d = movingobjectposition.c;
|
||||
e = movingobjectposition.d;
|
||||
f = l.a(c, d, e);
|
||||
s = (float) (movingobjectposition.f.a - p);
|
||||
t = (float) (movingobjectposition.f.b - q);
|
||||
u = (float) (movingobjectposition.f.c - r);
|
||||
float f2 = MathHelper.a(s * s + t * t + u * u);
|
||||
|
||||
p -= (s / (double) f2) * 0.05000000074505806D;
|
||||
q -= (t / (double) f2) * 0.05000000074505806D;
|
||||
r -= (u / (double) f2) * 0.05000000074505806D;
|
||||
l.a(((Entity) (this)), "random.drr", 1.0F, 1.2F / (W.nextFloat() * 0.2F + 0.9F));
|
||||
ak = true;
|
||||
a = 7;
|
||||
this.c = movingobjectposition.b;
|
||||
this.d = movingobjectposition.c;
|
||||
this.e = movingobjectposition.d;
|
||||
this.f = this.world.getTypeId(this.c, this.d, this.e);
|
||||
this.motX = (double) ((float) (movingobjectposition.f.a - this.locX));
|
||||
this.motY = (double) ((float) (movingobjectposition.f.b - this.locY));
|
||||
this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ));
|
||||
f2 = MathHelper.a(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
|
||||
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
|
||||
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
|
||||
this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
this.ak = true;
|
||||
this.a = 7;
|
||||
}
|
||||
}
|
||||
p += s;
|
||||
q += t;
|
||||
r += u;
|
||||
float f3 = MathHelper.a(s * s + u * u);
|
||||
|
||||
v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
for (w = (float) ((Math.atan2(t, f3) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) {
|
||||
;
|
||||
}
|
||||
for (; w - y >= 180F; y += 360F) {
|
||||
;
|
||||
}
|
||||
for (; v - x < -180F; x -= 360F) {
|
||||
;
|
||||
}
|
||||
for (; v - x >= 180F; x += 360F) {
|
||||
;
|
||||
}
|
||||
w = y + (w - y) * 0.2F;
|
||||
v = x + (v - x) * 0.2F;
|
||||
float f4 = 0.99F;
|
||||
float f6 = 0.03F;
|
||||
this.locX += this.motX;
|
||||
this.locY += this.motY;
|
||||
this.locZ += this.motZ;
|
||||
f2 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
|
||||
if (v()) {
|
||||
for (int k = 0; k < 4; k++) {
|
||||
float f7 = 0.25F;
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f2) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
l.a("bubble", p - s * (double) f7, q - t * (double) f7, r - u * (double) f7, s, t, u);
|
||||
while (this.pitch - this.lastPitch >= 180.0F) {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.yaw - this.lastYaw < -180.0F) {
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.yaw - this.lastYaw >= 180.0F) {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
|
||||
f1 = 0.03F;
|
||||
if (this.v()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
f4 = 0.8F;
|
||||
f3 = 0.8F;
|
||||
}
|
||||
s *= f4;
|
||||
t *= f4;
|
||||
u *= f4;
|
||||
t -= f6;
|
||||
a(p, q, r);
|
||||
|
||||
this.motX *= (double) f3;
|
||||
this.motY *= (double) f3;
|
||||
this.motZ *= (double) f3;
|
||||
this.motY -= (double) f1;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("xTile", (short) c);
|
||||
nbttagcompound.a("yTile", (short) d);
|
||||
nbttagcompound.a("zTile", (short) e);
|
||||
nbttagcompound.a("inTile", (byte) f);
|
||||
nbttagcompound.a("shake", (byte) a);
|
||||
nbttagcompound.a("inGround", (byte) (ak ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.c);
|
||||
nbttagcompound.a("yTile", (short) this.d);
|
||||
nbttagcompound.a("zTile", (short) this.e);
|
||||
nbttagcompound.a("inTile", (byte) this.f);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.ak ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
c = ((int) (nbttagcompound.c("xTile")));
|
||||
d = ((int) (nbttagcompound.c("yTile")));
|
||||
e = ((int) (nbttagcompound.c("zTile")));
|
||||
f = nbttagcompound.b("inTile") & 0xff;
|
||||
a = nbttagcompound.b("shake") & 0xff;
|
||||
ak = nbttagcompound.b("inGround") == 1;
|
||||
this.c = nbttagcompound.c("xTile");
|
||||
this.d = nbttagcompound.c("yTile");
|
||||
this.e = nbttagcompound.c("zTile");
|
||||
this.f = nbttagcompound.b("inTile") & 255;
|
||||
this.a = nbttagcompound.b("shake") & 255;
|
||||
this.ak = nbttagcompound.b("inGround") == 1;
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (l.z) {
|
||||
return;
|
||||
}
|
||||
if (ak && b == entityplayer && a <= 0 && entityplayer.an.a(new ItemStack(Item.j, 1))) {
|
||||
l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityplayer.c(((Entity) (this)), 1);
|
||||
q();
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.ak && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
@ -19,7 +18,7 @@ import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
|
||||
public class EntityBoat extends Entity {
|
||||
|
||||
public int a;
|
||||
public int b;
|
||||
@ -31,59 +30,6 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
|
||||
private double al;
|
||||
private double am;
|
||||
|
||||
// CraftBukkit start
|
||||
/**@deprecated*/
|
||||
private CraftBoat boat;
|
||||
/**@deprecated*/
|
||||
public CraftEntity getCraftEntity() {
|
||||
return boat;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public EntityBoat(World world) {
|
||||
super(world);
|
||||
a = 0;
|
||||
b = 0;
|
||||
c = 1;
|
||||
i = true;
|
||||
a(1.5F, 0.6F);
|
||||
H = J / 2.0F;
|
||||
M = false;
|
||||
|
||||
handleCreation(world); // CraftBukkit
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftBoat(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public AxisAlignedBB d(Entity entity) {
|
||||
return entity.z;
|
||||
}
|
||||
|
||||
public AxisAlignedBB u() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public EntityBoat(World world, double d1, double d2, double d3) {
|
||||
this(world);
|
||||
a(d1, d2 + (double) H, d3);
|
||||
s = 0.0D;
|
||||
t = 0.0D;
|
||||
u = 0.0D;
|
||||
m = d1;
|
||||
n = d2;
|
||||
o = d3;
|
||||
|
||||
handleCreation(world); // CraftBukkit
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private void handleCreation(World world) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
@ -92,261 +38,17 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
|
||||
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
|
||||
server.getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public double k() {
|
||||
return (double) J * 0.0D - 0.30000001192092896D;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
// CraftBukkit start
|
||||
Type eventType = Type.VEHICLE_DAMAGE;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity attacker = (entity == null)?null:entity.getBukkitEntity();
|
||||
int damage = i;
|
||||
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, attacker, damage);
|
||||
((WorldServer) l).getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.l.z || G) {
|
||||
return true;
|
||||
}
|
||||
c = -c;
|
||||
b = 10;
|
||||
a += i * 10;
|
||||
y();
|
||||
if (a > 40) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
a(Block.x.bi, 1, 0.0F);
|
||||
}
|
||||
|
||||
for (int l = 0; l < 2; l++) {
|
||||
a(Item.B.ba, 1, 0.0F);
|
||||
}
|
||||
|
||||
q();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
return !G;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
// CraftBukkit start
|
||||
double prevX = p;
|
||||
double prevY = q;
|
||||
double prevZ = r;
|
||||
float prevYaw = v;
|
||||
float prevPitch = w;
|
||||
// CraftBukkit end
|
||||
|
||||
super.b_();
|
||||
if (b > 0) {
|
||||
b--;
|
||||
}
|
||||
if (a > 0) {
|
||||
a--;
|
||||
}
|
||||
m = p;
|
||||
n = q;
|
||||
o = r;
|
||||
int i = 5;
|
||||
double d1 = 0.0D;
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
double d2 = (z.b + ((z.e - z.b) * (double) (j + 0)) / (double) i) - 0.125D;
|
||||
double d3 = (z.b + ((z.e - z.b) * (double) (j + 1)) / (double) i) - 0.125D;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.b(z.a, d2, z.c, z.d, d3, z.f);
|
||||
|
||||
if (this.l.b(axisalignedbb, Material.f)) {
|
||||
d1 += 1.0D / (double) i;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.l.z) {
|
||||
if (d > 0) {
|
||||
double d4 = p + (e - p) / (double) d;
|
||||
double d7 = q + (f - q) / (double) d;
|
||||
double d10 = r + (ak - r) / (double) d;
|
||||
double d13;
|
||||
|
||||
for (d13 = al - (double) v; d13 < -180D; d13 += 360D) {
|
||||
;
|
||||
}
|
||||
for (; d13 >= 180D; d13 -= 360D) {
|
||||
;
|
||||
}
|
||||
v += ((float) (d13 / (double) d));
|
||||
w += ((float) ((am - (double) w) / (double) d));
|
||||
d--;
|
||||
a(d4, d7, d10);
|
||||
b(v, w);
|
||||
} else {
|
||||
double d5 = p + s;
|
||||
double d8 = q + t;
|
||||
double d11 = r + u;
|
||||
|
||||
a(d5, d8, d11);
|
||||
if (A) {
|
||||
s *= 0.5D;
|
||||
t *= 0.5D;
|
||||
u *= 0.5D;
|
||||
}
|
||||
s *= 0.99000000953674316D;
|
||||
t *= 0.94999998807907104D;
|
||||
u *= 0.99000000953674316D;
|
||||
}
|
||||
return;
|
||||
}
|
||||
double d6 = d1 * 2D - 1.0D;
|
||||
|
||||
t += 0.039999999105930328D * d6;
|
||||
if (this.j != null) {
|
||||
s += this.j.s * 0.20000000000000001D;
|
||||
u += this.j.u * 0.20000000000000001D;
|
||||
}
|
||||
double d9 = 0.40000000000000002D;
|
||||
|
||||
if (s < -d9) {
|
||||
s = -d9;
|
||||
}
|
||||
if (s > d9) {
|
||||
s = d9;
|
||||
}
|
||||
if (u < -d9) {
|
||||
u = -d9;
|
||||
}
|
||||
if (u > d9) {
|
||||
u = d9;
|
||||
}
|
||||
if (A) {
|
||||
s *= 0.5D;
|
||||
t *= 0.5D;
|
||||
u *= 0.5D;
|
||||
}
|
||||
c(s, t, u);
|
||||
double d12 = Math.sqrt(s * s + u * u);
|
||||
|
||||
if (d12 > 0.14999999999999999D) {
|
||||
double d14 = Math.cos(((double) v * 3.1415926535897931D) / 180D);
|
||||
double d16 = Math.sin(((double) v * 3.1415926535897931D) / 180D);
|
||||
|
||||
for (int l = 0; (double) l < 1.0D + d12 * 60D; l++) {
|
||||
double d18 = W.nextFloat() * 2.0F - 1.0F;
|
||||
double d19 = (double) (W.nextInt(2) * 2 - 1) * 0.69999999999999996D;
|
||||
|
||||
if (W.nextBoolean()) {
|
||||
double d20 = (p - d14 * d18 * 0.80000000000000004D) + d16 * d19;
|
||||
double d22 = r - d16 * d18 * 0.80000000000000004D - d14 * d19;
|
||||
|
||||
this.l.a("splash", d20, q - 0.125D, d22, s, t, u);
|
||||
} else {
|
||||
double d21 = p + d14 + d16 * d18 * 0.69999999999999996D;
|
||||
double d23 = (r + d16) - d14 * d18 * 0.69999999999999996D;
|
||||
|
||||
this.l.a("splash", d21, q - 0.125D, d23, s, t, u);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (B && d12 > 0.14999999999999999D) {
|
||||
if (!this.l.z) {
|
||||
q();
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
a(Block.x.bi, 1, 0.0F);
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < 2; j1++) {
|
||||
a(Item.B.ba, 1, 0.0F);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s *= 0.99000000953674316D;
|
||||
t *= 0.94999998807907104D;
|
||||
u *= 0.99000000953674316D;
|
||||
}
|
||||
w = 0.0F;
|
||||
double d15 = v;
|
||||
double d17 = m - p;
|
||||
double d24 = o - r;
|
||||
|
||||
if (d17 * d17 + d24 * d24 > 0.001D) {
|
||||
d15 = (float) ((Math.atan2(d24, d17) * 180D) / 3.1415926535897931D);
|
||||
}
|
||||
double d25;
|
||||
|
||||
for (d25 = d15 - (double) v; d25 >= 180D; d25 -= 360D) {
|
||||
;
|
||||
}
|
||||
for (; d25 < -180D; d25 += 360D) {
|
||||
;
|
||||
}
|
||||
if (d25 > 20D) {
|
||||
d25 = 20D;
|
||||
}
|
||||
if (d25 < -20D) {
|
||||
d25 = -20D;
|
||||
}
|
||||
v += ((float) (d25));
|
||||
b(v, w);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer)l).getServer();
|
||||
CraftWorld world = ((WorldServer)l).getWorld();
|
||||
Type eventType = Type.VEHICLE_MOVE;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(world, p, q, r, v, w);
|
||||
|
||||
VehicleMoveEvent event = new VehicleMoveEvent(eventType, vehicle, from, to);
|
||||
server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
List list = this.l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int k1 = 0; k1 < list.size(); k1++) {
|
||||
Entity entity = (Entity) list.get(k1);
|
||||
|
||||
if (entity != this.j && entity.z() && (entity instanceof EntityBoat)) {
|
||||
entity.c(((Entity) (this)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.j != null && this.j.G) {
|
||||
this.j = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void E() {
|
||||
if (j == null) {
|
||||
return;
|
||||
} else {
|
||||
double d1 = Math.cos(((double) v * 3.1415926535897931D) / 180D) * 0.40000000000000002D;
|
||||
double d2 = Math.sin(((double) v * 3.1415926535897931D) / 180D) * 0.40000000000000002D;
|
||||
|
||||
j.a(p + d1, q + k() + j.F(), r + d2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public void c(Entity entity) {
|
||||
CraftServer server = ((WorldServer)l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity hitEntity = (entity == null)?null:entity.getBukkitEntity();
|
||||
|
||||
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
|
||||
server.getPluginManager().callEvent(collsionEvent);
|
||||
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||
|
||||
if (collsionEvent.isCancelled()) {
|
||||
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,31 +56,344 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {}
|
||||
public EntityBoat(World world) {
|
||||
super(world);
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
this.c = 1;
|
||||
this.i = true;
|
||||
this.a(1.5F, 0.6F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.M = false;
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {}
|
||||
// CraftBukkit start
|
||||
handleCreation(world);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftBoat(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
if (j != null && (j instanceof EntityPlayer) && j != entityplayer) {
|
||||
return true;
|
||||
}
|
||||
if (!l.z) {
|
||||
protected void a() {}
|
||||
|
||||
public AxisAlignedBB d(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
|
||||
public AxisAlignedBB u() {
|
||||
return this.boundingBox;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public EntityBoat(World world, double d0, double d1, double d2) {
|
||||
this(world);
|
||||
this.a(d0, d1 + (double) this.height, d2);
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
|
||||
handleCreation(world); // CraftBukkit
|
||||
}
|
||||
|
||||
public double k() {
|
||||
return (double) this.width * 0.0D - 0.30000001192092896D;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (!this.world.isStatic && !this.dead) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer)l).getServer();
|
||||
Type eventType = Type.VEHICLE_ENTER;
|
||||
Type eventType = Type.VEHICLE_DAMAGE;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity player = entityplayer.getBukkitEntity();
|
||||
|
||||
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity();
|
||||
int damage = i;
|
||||
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, attacker, damage);
|
||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityplayer.e(((Entity) (this)));
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.a += i * 10;
|
||||
this.y();
|
||||
if (this.a > 40) {
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 3; ++j) {
|
||||
this.a(Block.WOOD.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
this.a(Item.STICK.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
this.q();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
double prevZ = this.locZ;
|
||||
float prevYaw = this.yaw;
|
||||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
super.b_();
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
}
|
||||
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
byte b0 = 5;
|
||||
double d0 = 0.0D;
|
||||
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
double d1 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 0) / (double) b0 - 0.125D;
|
||||
double d2 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 1) / (double) b0 - 0.125D;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.b(this.boundingBox.a, d1, this.boundingBox.c, this.boundingBox.d, d2, this.boundingBox.f);
|
||||
|
||||
if (this.world.b(axisalignedbb, Material.WATER)) {
|
||||
d0 += 1.0D / (double) b0;
|
||||
}
|
||||
}
|
||||
|
||||
double d3;
|
||||
double d4;
|
||||
double d5;
|
||||
double d6;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
if (this.d > 0) {
|
||||
d3 = this.locX + (this.e - this.locX) / (double) this.d;
|
||||
d4 = this.locY + (this.f - this.locY) / (double) this.d;
|
||||
d5 = this.locZ + (this.ak - this.locZ) / (double) this.d;
|
||||
|
||||
for (d6 = this.al - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d6 >= 180.0D) {
|
||||
d6 -= 360.0D;
|
||||
}
|
||||
|
||||
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.d;
|
||||
this.a(d3, d4, d5);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
d3 = this.locX + this.motX;
|
||||
d4 = this.locY + this.motY;
|
||||
d5 = this.locZ + this.motZ;
|
||||
this.a(d3, d4, d5);
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
}
|
||||
|
||||
this.motX *= 0.9900000095367432D;
|
||||
this.motY *= 0.949999988079071D;
|
||||
this.motZ *= 0.9900000095367432D;
|
||||
}
|
||||
} else {
|
||||
d3 = d0 * 2.0D - 1.0D;
|
||||
this.motY += 0.03999999910593033D * d3;
|
||||
if (this.passenger != null) {
|
||||
this.motX += this.passenger.motX * 0.2D;
|
||||
this.motZ += this.passenger.motZ * 0.2D;
|
||||
}
|
||||
|
||||
d4 = 0.4D;
|
||||
if (this.motX < -d4) {
|
||||
this.motX = -d4;
|
||||
}
|
||||
|
||||
if (this.motX > d4) {
|
||||
this.motX = d4;
|
||||
}
|
||||
|
||||
if (this.motZ < -d4) {
|
||||
this.motZ = -d4;
|
||||
}
|
||||
|
||||
if (this.motZ > d4) {
|
||||
this.motZ = d4;
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
}
|
||||
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
d5 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
double d7;
|
||||
|
||||
if (d5 > 0.15D) {
|
||||
d6 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
|
||||
d7 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
|
||||
|
||||
for (int j = 0; (double) j < 1.0D + d5 * 60.0D; ++j) {
|
||||
double d8 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
|
||||
double d9 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
|
||||
double d10;
|
||||
double d11;
|
||||
|
||||
if (this.random.nextBoolean()) {
|
||||
d10 = this.locX - d6 * d8 * 0.8D + d7 * d9;
|
||||
d11 = this.locZ - d7 * d8 * 0.8D - d6 * d9;
|
||||
this.world.a("splash", d10, this.locY - 0.125D, d11, this.motX, this.motY, this.motZ);
|
||||
} else {
|
||||
d10 = this.locX + d6 + d7 * d8 * 0.7D;
|
||||
d11 = this.locZ + d7 - d6 * d8 * 0.7D;
|
||||
this.world.a("splash", d10, this.locY - 0.125D, d11, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.B && d5 > 0.15D) {
|
||||
if (!this.world.isStatic) {
|
||||
this.q();
|
||||
|
||||
int k;
|
||||
|
||||
for (k = 0; k < 3; ++k) {
|
||||
this.a(Block.WOOD.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
for (k = 0; k < 2; ++k) {
|
||||
this.a(Item.STICK.id, 1, 0.0F);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.motX *= 0.9900000095367432D;
|
||||
this.motY *= 0.949999988079071D;
|
||||
this.motZ *= 0.9900000095367432D;
|
||||
}
|
||||
|
||||
this.pitch = 0.0F;
|
||||
d6 = (double) this.yaw;
|
||||
d7 = this.lastX - this.locX;
|
||||
double d12 = this.lastZ - this.locZ;
|
||||
|
||||
if (d7 * d7 + d12 * d12 > 0.0010D) {
|
||||
d6 = (double) ((float) (Math.atan2(d12, d7) * 180.0D / 3.141592653589793D));
|
||||
}
|
||||
|
||||
double d13;
|
||||
|
||||
for (d13 = d6 - (double) this.yaw; d13 >= 180.0D; d13 -= 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d13 < -180.0D) {
|
||||
d13 += 360.0D;
|
||||
}
|
||||
|
||||
if (d13 > 20.0D) {
|
||||
d13 = 20.0D;
|
||||
}
|
||||
|
||||
if (d13 < -20.0D) {
|
||||
d13 = -20.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d13);
|
||||
this.b(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
||||
Type eventType = Type.VEHICLE_MOVE;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
|
||||
VehicleMoveEvent event = new VehicleMoveEvent(eventType, vehicle, from, to);
|
||||
server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int l = 0; l < list.size(); ++l) {
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (entity != this.passenger && entity.z() && entity instanceof EntityBoat) {
|
||||
entity.c((Entity) this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.passenger != null && this.passenger.dead) {
|
||||
this.passenger = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void E() {
|
||||
if (this.passenger != null) {
|
||||
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
|
||||
this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.F(), this.locZ + d1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
|
||||
return true;
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.VEHICLE_ENTER;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity player = entityhuman.getBukkitEntity();
|
||||
|
||||
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityhuman.e(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,65 +1,64 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftChicken;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityChicken extends EntityAnimals {
|
||||
public class EntityChicken extends EntityAnimal {
|
||||
|
||||
public boolean a;
|
||||
public float b;
|
||||
public float c;
|
||||
public boolean a = false;
|
||||
public float b = 0.0F;
|
||||
public float c = 0.0F;
|
||||
public float f;
|
||||
public float ak;
|
||||
public float al;
|
||||
public float al = 1.0F;
|
||||
public int am;
|
||||
|
||||
public EntityChicken(World world) {
|
||||
super(world);
|
||||
a = false;
|
||||
b = 0.0F;
|
||||
c = 0.0F;
|
||||
al = 1.0F;
|
||||
aP = "/mob/chicken.png";
|
||||
a(0.3F, 0.4F);
|
||||
aZ = 4;
|
||||
am = W.nextInt(6000) + 6000;
|
||||
this.texture = "/mob/chicken.png";
|
||||
this.a(0.3F, 0.4F);
|
||||
this.health = 4;
|
||||
this.am = this.random.nextInt(6000) + 6000;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftChicken(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void o() {
|
||||
super.o();
|
||||
ak = b;
|
||||
f = c;
|
||||
c += ((float) ((double) (A ? -1 : 4) * 0.29999999999999999D));
|
||||
if (c < 0.0F) {
|
||||
c = 0.0F;
|
||||
this.ak = this.b;
|
||||
this.f = this.c;
|
||||
this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
|
||||
if (this.c < 0.0F) {
|
||||
this.c = 0.0F;
|
||||
}
|
||||
if (c > 1.0F) {
|
||||
c = 1.0F;
|
||||
|
||||
if (this.c > 1.0F) {
|
||||
this.c = 1.0F;
|
||||
}
|
||||
if (!A && al < 1.0F) {
|
||||
al = 1.0F;
|
||||
|
||||
if (!this.onGround && this.al < 1.0F) {
|
||||
this.al = 1.0F;
|
||||
}
|
||||
al *= 0.90000000000000002D;
|
||||
if (!A && t < 0.0D) {
|
||||
t *= 0.59999999999999998D;
|
||||
|
||||
this.al = (float) ((double) this.al * 0.9D);
|
||||
if (!this.onGround && this.motY < 0.0D) {
|
||||
this.motY *= 0.6D;
|
||||
}
|
||||
b += al * 2.0F;
|
||||
if (!l.z && --am <= 0) {
|
||||
l.a(((Entity) (this)), "mob.chickenplop", 1.0F, (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
|
||||
a(Item.aN.ba, 1);
|
||||
am = W.nextInt(6000) + 6000;
|
||||
|
||||
this.b += this.al * 2.0F;
|
||||
if (!this.world.isStatic && --this.am <= 0) {
|
||||
this.world.a(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
this.a(Item.EGG.id, 1);
|
||||
this.am = this.random.nextInt(6000) + 6000;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(float f1) {}
|
||||
protected void a(float f) {}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
@ -82,6 +81,6 @@ public class EntityChicken extends EntityAnimals {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.J.ba;
|
||||
return Item.FEATHER.id;
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,15 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftCow;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityCow extends EntityAnimals {
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(World world) {
|
||||
super(world);
|
||||
aP = "/mob/cow.png";
|
||||
a(0.9F, 1.3F);
|
||||
this.texture = "/mob/cow.png";
|
||||
this.a(0.9F, 1.3F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftCow(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -42,14 +43,14 @@ public class EntityCow extends EntityAnimals {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.aD.ba;
|
||||
return Item.LEATHER.id;
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
ItemStack itemstack = entityplayer.an.e();
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.e();
|
||||
|
||||
if (itemstack != null && itemstack.c == Item.au.ba) {
|
||||
entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE));
|
||||
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
|
||||
entityhuman.inventory.a(entityhuman.inventory.c, new ItemStack(Item.MILK_BUCKET));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1,11 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftMonster;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
@ -14,155 +15,159 @@ public class EntityCreature extends EntityLiving {
|
||||
|
||||
private PathEntity a;
|
||||
protected Entity d;
|
||||
protected boolean e;
|
||||
protected boolean e = false;
|
||||
|
||||
public EntityCreature(World world) {
|
||||
super(world);
|
||||
e = false;
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftCreature(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
e = false;
|
||||
float f = 16F;
|
||||
this.e = false;
|
||||
float f = 16.0F;
|
||||
|
||||
if (d == null) {
|
||||
if (this.d == null) {
|
||||
// CraftBukkit start
|
||||
Entity target = l();
|
||||
if(target != null) {
|
||||
Entity target = this.l();
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
d = null;
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (d != null) {
|
||||
a = l.a(((Entity) (this)), d, f);
|
||||
if (this.d != null) {
|
||||
this.a = this.world.a(this, this.d, f);
|
||||
}
|
||||
} else if (!d.B()) {
|
||||
} else if (!this.d.B()) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
d = null;
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
float f1 = d.a(((Entity) (this)));
|
||||
float f1 = this.d.a((Entity) this);
|
||||
|
||||
if (i(d)) {
|
||||
a(d, f1);
|
||||
if (this.i(this.d)) {
|
||||
this.a(this.d, f1);
|
||||
}
|
||||
}
|
||||
if (!e && d != null && (a == null || W.nextInt(20) == 0)) {
|
||||
a = l.a(((Entity) (this)), d, f);
|
||||
} else if (a == null && W.nextInt(80) == 0 || W.nextInt(80) == 0) {
|
||||
|
||||
if (!this.e && this.d != null && (this.a == null || this.random.nextInt(20) == 0)) {
|
||||
this.a = this.world.a(this, this.d, f);
|
||||
} else if (this.a == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0) {
|
||||
boolean flag = false;
|
||||
int i = -1;
|
||||
int j = -1;
|
||||
int k = -1;
|
||||
int i1 = -1;
|
||||
float f2 = -99999F;
|
||||
float f2 = -99999.0F;
|
||||
|
||||
for (int j1 = 0; j1 < 10; j1++) {
|
||||
int k1 = MathHelper.b((p + (double) W.nextInt(13)) - 6D);
|
||||
int l1 = MathHelper.b((q + (double) W.nextInt(7)) - 3D);
|
||||
int i2 = MathHelper.b((r + (double) W.nextInt(13)) - 6D);
|
||||
float f3 = a(k1, l1, i2);
|
||||
for (int l = 0; l < 10; ++l) {
|
||||
int i1 = MathHelper.b(this.locX + (double) this.random.nextInt(13) - 6.0D);
|
||||
int j1 = MathHelper.b(this.locY + (double) this.random.nextInt(7) - 3.0D);
|
||||
int k1 = MathHelper.b(this.locZ + (double) this.random.nextInt(13) - 6.0D);
|
||||
float f3 = this.a(i1, j1, k1);
|
||||
|
||||
if (f3 > f2) {
|
||||
f2 = f3;
|
||||
j = k1;
|
||||
k = l1;
|
||||
i1 = i2;
|
||||
i = i1;
|
||||
j = j1;
|
||||
k = k1;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
a = l.a(((Entity) (this)), j, k, i1, 10F);
|
||||
this.a = this.world.a(this, i, j, k, 10.0F);
|
||||
}
|
||||
}
|
||||
int i = MathHelper.b(z.b);
|
||||
boolean flag1 = v();
|
||||
boolean flag2 = x();
|
||||
|
||||
w = 0.0F;
|
||||
if (a == null || W.nextInt(100) == 0) {
|
||||
int l1 = MathHelper.b(this.boundingBox.b);
|
||||
boolean flag1 = this.v();
|
||||
boolean flag2 = this.x();
|
||||
|
||||
this.pitch = 0.0F;
|
||||
if (this.a != null && this.random.nextInt(100) != 0) {
|
||||
Vec3D vec3d = this.a.a(this);
|
||||
double d0 = (double) (this.length * 2.0F);
|
||||
|
||||
while (vec3d != null && vec3d.d(this.locX, vec3d.b, this.locZ) < d0 * d0) {
|
||||
this.a.a();
|
||||
if (this.a.b()) {
|
||||
vec3d = null;
|
||||
this.a = null;
|
||||
} else {
|
||||
vec3d = this.a.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
this.bA = false;
|
||||
if (vec3d != null) {
|
||||
double d1 = vec3d.a - this.locX;
|
||||
double d2 = vec3d.c - this.locZ;
|
||||
double d3 = vec3d.b - (double) l1;
|
||||
float f4 = (float) (Math.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
float f5 = f4 - this.yaw;
|
||||
|
||||
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while (f5 >= 180.0F) {
|
||||
f5 -= 360.0F;
|
||||
}
|
||||
|
||||
if (f5 > 30.0F) {
|
||||
f5 = 30.0F;
|
||||
}
|
||||
|
||||
if (f5 < -30.0F) {
|
||||
f5 = -30.0F;
|
||||
}
|
||||
|
||||
this.yaw += f5;
|
||||
if (this.e && this.d != null) {
|
||||
double d4 = this.d.locX - this.locX;
|
||||
double d5 = this.d.locZ - this.locZ;
|
||||
float f6 = this.yaw;
|
||||
|
||||
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
f5 = (f6 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
|
||||
this.bx = -MathHelper.a(f5) * this.by * 1.0F;
|
||||
this.by = MathHelper.b(f5) * this.by * 1.0F;
|
||||
}
|
||||
|
||||
if (d3 > 0.0D) {
|
||||
this.bA = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.d != null) {
|
||||
this.b(this.d, 30.0F);
|
||||
}
|
||||
|
||||
if (this.B) {
|
||||
this.bA = true;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) {
|
||||
this.bA = true;
|
||||
}
|
||||
} else {
|
||||
super.d();
|
||||
a = null;
|
||||
return;
|
||||
}
|
||||
Vec3D vec3d = a.a(((Entity) (this)));
|
||||
|
||||
for (double d1 = I * 2.0F; vec3d != null && vec3d.d(p, vec3d.b, r) < d1 * d1;) {
|
||||
a.a();
|
||||
if (a.b()) {
|
||||
vec3d = null;
|
||||
a = null;
|
||||
} else {
|
||||
vec3d = a.a(((Entity) (this)));
|
||||
}
|
||||
}
|
||||
|
||||
bA = false;
|
||||
if (vec3d != null) {
|
||||
double d2 = vec3d.a - p;
|
||||
double d3 = vec3d.c - r;
|
||||
double d4 = vec3d.b - (double) i;
|
||||
float f4 = (float) ((Math.atan2(d3, d2) * 180D) / 3.1415927410125732D) - 90F;
|
||||
float f5 = f4 - v;
|
||||
|
||||
by = bC;
|
||||
for (; f5 < -180F; f5 += 360F) {
|
||||
;
|
||||
}
|
||||
for (; f5 >= 180F; f5 -= 360F) {
|
||||
;
|
||||
}
|
||||
if (f5 > 30F) {
|
||||
f5 = 30F;
|
||||
}
|
||||
if (f5 < -30F) {
|
||||
f5 = -30F;
|
||||
}
|
||||
v += f5;
|
||||
if (e && d != null) {
|
||||
double d5 = d.p - p;
|
||||
double d6 = d.r - r;
|
||||
float f7 = v;
|
||||
|
||||
v = (float) ((Math.atan2(d6, d5) * 180D) / 3.1415927410125732D) - 90F;
|
||||
float f6 = (((f7 - v) + 90F) * 3.141593F) / 180F;
|
||||
|
||||
bx = -MathHelper.a(f6) * by * 1.0F;
|
||||
by = MathHelper.b(f6) * by * 1.0F;
|
||||
}
|
||||
if (d4 > 0.0D) {
|
||||
bA = true;
|
||||
}
|
||||
}
|
||||
if (d != null) {
|
||||
b(d, 30F);
|
||||
}
|
||||
if (B) {
|
||||
bA = true;
|
||||
}
|
||||
if (W.nextFloat() < 0.8F && (flag1 || flag2)) {
|
||||
bA = true;
|
||||
this.a = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,10 +182,10 @@ public class EntityCreature extends EntityLiving {
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
int i = MathHelper.b(p);
|
||||
int j = MathHelper.b(z.b);
|
||||
int k = MathHelper.b(r);
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.b(this.boundingBox.b);
|
||||
int k = MathHelper.b(this.locZ);
|
||||
|
||||
return super.b() && a(i, j, k) >= 0.0F;
|
||||
return super.b() && this.a(i, j, k) >= 0.0F;
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,29 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftCreeper;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityCreeper extends EntityMobs {
|
||||
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public EntityCreeper(World world) {
|
||||
super(world);
|
||||
aP = "/mob/creeper.png";
|
||||
this.texture = "/mob/creeper.png";
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftCreeper(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
super.a();
|
||||
af.a(16, ((Byte.valueOf((byte) -1))));
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) -1));
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -35,21 +35,24 @@ public class EntityCreeper extends EntityMobs {
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
b = a;
|
||||
if (l.z) {
|
||||
int i = K();
|
||||
this.b = this.a;
|
||||
if (this.world.isStatic) {
|
||||
int i = this.K();
|
||||
|
||||
if (i > 0 && a == 0) {
|
||||
l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F);
|
||||
if (i > 0 && this.a == 0) {
|
||||
this.world.a(this, "random.fuse", 1.0F, 0.5F);
|
||||
}
|
||||
a += i;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
|
||||
this.a += i;
|
||||
if (this.a < 0) {
|
||||
this.a = 0;
|
||||
}
|
||||
if (a >= 30) {
|
||||
a = 30;
|
||||
|
||||
if (this.a >= 30) {
|
||||
this.a = 30;
|
||||
}
|
||||
}
|
||||
|
||||
super.b_();
|
||||
}
|
||||
|
||||
@ -64,42 +67,44 @@ public class EntityCreeper extends EntityMobs {
|
||||
public void f(Entity entity) {
|
||||
super.f(entity);
|
||||
if (entity instanceof EntitySkeleton) {
|
||||
a(Item.aY.ba + W.nextInt(2), 1);
|
||||
this.a(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f1) {
|
||||
int i = K();
|
||||
protected void a(Entity entity, float f) {
|
||||
int i = this.K();
|
||||
|
||||
if (i <= 0 && f1 < 3F || i > 0 && f1 < 7F) {
|
||||
if (a == 0) {
|
||||
l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F);
|
||||
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
|
||||
this.a(-1);
|
||||
--this.a;
|
||||
if (this.a < 0) {
|
||||
this.a = 0;
|
||||
}
|
||||
a(1);
|
||||
a++;
|
||||
if (a >= 30) {
|
||||
l.a(((Entity) (this)), p, q, r, 3F);
|
||||
q();
|
||||
}
|
||||
e = true;
|
||||
} else {
|
||||
a(-1);
|
||||
a--;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
if (this.a == 0) {
|
||||
this.world.a(this, "random.fuse", 1.0F, 0.5F);
|
||||
}
|
||||
|
||||
this.a(1);
|
||||
++this.a;
|
||||
if (this.a >= 30) {
|
||||
this.world.a(this, this.locX, this.locY, this.locZ, 3.0F);
|
||||
this.q();
|
||||
}
|
||||
|
||||
this.e = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.K.ba;
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
private int K() {
|
||||
return ((int) (af.a(16)));
|
||||
return this.datawatcher.a(16);
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
af.b(16, ((Byte.valueOf((byte) i))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) i));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.Egg;
|
||||
@ -18,28 +17,22 @@ import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
|
||||
public class EntityEgg extends Entity {
|
||||
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private boolean f;
|
||||
public int a;
|
||||
private int b = -1;
|
||||
private int c = -1;
|
||||
private int d = -1;
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
private EntityLiving ak;
|
||||
private int al;
|
||||
private int am;
|
||||
private int am = 0;
|
||||
|
||||
public EntityEgg(World world) {
|
||||
super(world);
|
||||
b = -1;
|
||||
c = -1;
|
||||
d = -1;
|
||||
e = 0;
|
||||
f = false;
|
||||
a = 0;
|
||||
am = 0;
|
||||
a(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftEgg(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -47,117 +40,117 @@ public class EntityEgg extends Entity {
|
||||
protected void a() {}
|
||||
|
||||
public EntityEgg(World world, EntityLiving entityliving) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
ak = entityliving;
|
||||
c(entityliving.p, entityliving.q + (double) entityliving.w(), entityliving.r, entityliving.v, entityliving.w);
|
||||
p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F;
|
||||
q -= 0.10000000149011612D;
|
||||
r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F;
|
||||
a(p, q, r);
|
||||
H = 0.0F;
|
||||
float f1 = 0.4F;
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
t = -MathHelper.a((w / 180F) * 3.141593F) * f1;
|
||||
a(s, t, u, 1.5F, 1.0F);
|
||||
this.ak = entityliving;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
float f = 0.4F;
|
||||
|
||||
this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public EntityEgg(World world, double d1, double d2, double d3) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
al = 0;
|
||||
a(d1, d2, d3);
|
||||
H = 0.0F;
|
||||
public EntityEgg(World world, double d0, double d1, double d2) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
this.al = 0;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.a(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public void a(double d1, double d2, double d3, float f1, float f2) {
|
||||
float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d1 /= f3;
|
||||
d2 /= f3;
|
||||
d3 /= f3;
|
||||
d1 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d2 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d3 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d1 *= f1;
|
||||
d2 *= f1;
|
||||
d3 *= f1;
|
||||
s = d1;
|
||||
t = d2;
|
||||
u = d3;
|
||||
float f4 = MathHelper.a(d1 * d1 + d3 * d3);
|
||||
d0 /= (double) f2;
|
||||
d1 /= (double) f2;
|
||||
d2 /= (double) f2;
|
||||
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d0 *= (double) f;
|
||||
d1 *= (double) f;
|
||||
d2 *= (double) f;
|
||||
this.motX = d0;
|
||||
this.motY = d1;
|
||||
this.motZ = d2;
|
||||
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
|
||||
|
||||
x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D);
|
||||
y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D);
|
||||
al = 0;
|
||||
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.al = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
O = p;
|
||||
P = q;
|
||||
Q = r;
|
||||
this.O = this.locX;
|
||||
this.P = this.locY;
|
||||
this.Q = this.locZ;
|
||||
super.b_();
|
||||
if (a > 0) {
|
||||
a--;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
if (f) {
|
||||
int i = this.l.a(b, c, d);
|
||||
|
||||
if (i != e) {
|
||||
f = false;
|
||||
s *= W.nextFloat() * 0.2F;
|
||||
t *= W.nextFloat() * 0.2F;
|
||||
u *= W.nextFloat() * 0.2F;
|
||||
al = 0;
|
||||
am = 0;
|
||||
} else {
|
||||
al++;
|
||||
if (al == 1200) {
|
||||
q();
|
||||
if (this.f) {
|
||||
int i = this.world.getTypeId(this.b, this.c, this.d);
|
||||
|
||||
if (i == this.e) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
am++;
|
||||
}
|
||||
Vec3D vec3d = Vec3D.b(p, q, r);
|
||||
Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
MovingObjectPosition movingobjectposition = this.l.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(p, q, r);
|
||||
vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
this.f = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.al = 0;
|
||||
this.am = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
if (!this.l.z) {
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
Entity entity = null;
|
||||
List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
|
||||
double d1 = 0.0D;
|
||||
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
|
||||
for (int l = 0; l < list.size(); l++) {
|
||||
Entity entity1 = (Entity) list.get(l);
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (!entity1.c_() || entity1 == ak && am < 5) {
|
||||
continue;
|
||||
}
|
||||
float f4 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.z.b(f4, f4, f4);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
if (movingobjectposition1 == null) {
|
||||
continue;
|
||||
}
|
||||
double d2 = vec3d.a(movingobjectposition1.f);
|
||||
if (movingobjectposition1 != null) {
|
||||
double d1 = vec3d.a(movingobjectposition1.f);
|
||||
|
||||
if (d2 < d1 || d1 == 0.0D) {
|
||||
entity = entity1;
|
||||
d1 = d2;
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,54 +158,53 @@ public class EntityEgg extends Entity {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
}
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
// CraftBukkit start
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
boolean bounce;
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
org.bukkit.entity.Entity shooter = (ak == null)?null:ak.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(edbpe);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if(!edbpe.isCancelled()) {
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the egg should stick or not, i.e. !bounce
|
||||
bounce = !movingobjectposition.g.a(((Entity) (ak)), edbpe.getDamage());
|
||||
stick = movingobjectposition.g.a(this.ak, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the egg should bounce or not
|
||||
bounce = edbpe.getBounce();
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
bounce = !movingobjectposition.g.a(((Entity) (ak)), 0);
|
||||
stick = movingobjectposition.g.a(this.ak, 0);
|
||||
}
|
||||
if (!bounce) {
|
||||
// CraftBukkit end
|
||||
;
|
||||
|
||||
if (stick) {
|
||||
; // Original code does nothing *yet*
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
boolean hatching = !this.l.z && W.nextInt(8) == 0;
|
||||
byte numHatching = (hatching && W.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
|
||||
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0;
|
||||
byte numHatching = (this.random.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
|
||||
if (!hatching) {
|
||||
numHatching = 0;
|
||||
}
|
||||
MobType hatchingType = MobType.CHICKEN;
|
||||
|
||||
if (ak instanceof EntityPlayerMP) {
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
if (this.ak instanceof EntityPlayer) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.PLAYER_EGG_THROW;
|
||||
Player player = (ak == null)?null:(Player) ak.getBukkitEntity();
|
||||
Player player = (this.ak == null) ? null : (Player) this.ak.getBukkitEntity();
|
||||
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(
|
||||
eventType, player, (Egg)this.bukkitEntity, hatching,
|
||||
numHatching, hatchingType);
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType);
|
||||
server.getPluginManager().callEvent(event);
|
||||
hatching = event.isHatching();
|
||||
numHatching = event.getNumHatches();
|
||||
@ -224,116 +216,124 @@ public class EntityEgg extends Entity {
|
||||
Entity entity = null;
|
||||
switch (hatchingType) {
|
||||
case CHICKEN:
|
||||
entity = new EntityChicken(this.l);
|
||||
entity = new EntityChicken(this.world);
|
||||
break;
|
||||
case COW:
|
||||
entity = new EntityCow(this.l);
|
||||
entity = new EntityCow(this.world);
|
||||
break;
|
||||
case CREEPER:
|
||||
entity = new EntityCreeper(this.l);
|
||||
entity = new EntityCreeper(this.world);
|
||||
break;
|
||||
case GHAST:
|
||||
entity = new EntityGhast(this.l);
|
||||
entity = new EntityGhast(this.world);
|
||||
break;
|
||||
case PIG:
|
||||
entity = new EntityPig(this.l);
|
||||
entity = new EntityPig(this.world);
|
||||
break;
|
||||
case PIG_ZOMBIE:
|
||||
entity = new EntityPigZombie(this.l);
|
||||
entity = new EntityPigZombie(this.world);
|
||||
break;
|
||||
case SHEEP:
|
||||
entity = new EntitySheep(this.l);
|
||||
entity = new EntitySheep(this.world);
|
||||
break;
|
||||
case SKELETON:
|
||||
entity = new EntitySkeleton(this.l);
|
||||
entity = new EntitySkeleton(this.world);
|
||||
break;
|
||||
case SPIDER:
|
||||
entity = new EntitySpider(this.l);
|
||||
entity = new EntitySpider(this.world);
|
||||
break;
|
||||
case ZOMBIE:
|
||||
entity = new EntityZombie(this.l);
|
||||
entity = new EntityZombie(this.world);
|
||||
break;
|
||||
case SQUID:
|
||||
entity = new EntitySquid(this.l);
|
||||
entity = new EntitySquid(this.world);
|
||||
break;
|
||||
default:
|
||||
entity = new EntityChicken(this.l);
|
||||
entity = new EntityChicken(this.world);
|
||||
break;
|
||||
}
|
||||
entity.c(p, q, r, v, 0.0F);
|
||||
this.l.a(entity);
|
||||
|
||||
entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
||||
this.world.a(entity);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (int j = 0; j < 8; j++) {
|
||||
this.l.a("snowballpoof", p, q, r, 0.0D, 0.0D, 0.0D);
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
q();
|
||||
this.q();
|
||||
}
|
||||
p += s;
|
||||
q += t;
|
||||
r += u;
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
|
||||
v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) {
|
||||
this.locX += this.motX;
|
||||
this.locY += this.motY;
|
||||
this.locZ += this.motZ;
|
||||
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
for (; w - y >= 180F; y += 360F) {
|
||||
;
|
||||
|
||||
while (this.pitch - this.lastPitch >= 180.0F) {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
for (; v - x < -180F; x -= 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw < -180.0F) {
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
for (; v - x >= 180F; x += 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw >= 180.0F) {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
w = y + (w - y) * 0.2F;
|
||||
v = x + (v - x) * 0.2F;
|
||||
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.99F;
|
||||
float f5 = 0.03F;
|
||||
float f3 = 0.03F;
|
||||
|
||||
if (v()) {
|
||||
for (int i1 = 0; i1 < 4; i1++) {
|
||||
float f3 = 0.25F;
|
||||
if (this.v()) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
this.l.a("bubble", p - s * (double) f3, q - t * (double) f3, r - u * (double) f3, s, t, u);
|
||||
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
}
|
||||
s *= f2;
|
||||
t *= f2;
|
||||
u *= f2;
|
||||
t -= f5;
|
||||
a(p, q, r);
|
||||
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
this.motY -= (double) f3;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("xTile", (short) b);
|
||||
nbttagcompound.a("yTile", (short) c);
|
||||
nbttagcompound.a("zTile", (short) d);
|
||||
nbttagcompound.a("inTile", (byte) e);
|
||||
nbttagcompound.a("shake", (byte) a);
|
||||
nbttagcompound.a("inGround", (byte) (f ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.b);
|
||||
nbttagcompound.a("yTile", (short) this.c);
|
||||
nbttagcompound.a("zTile", (short) this.d);
|
||||
nbttagcompound.a("inTile", (byte) this.e);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
b = ((int) (nbttagcompound.c("xTile")));
|
||||
c = ((int) (nbttagcompound.c("yTile")));
|
||||
d = ((int) (nbttagcompound.c("zTile")));
|
||||
e = nbttagcompound.b("inTile") & 0xff;
|
||||
a = nbttagcompound.b("shake") & 0xff;
|
||||
f = nbttagcompound.b("inGround") == 1;
|
||||
this.b = nbttagcompound.c("xTile");
|
||||
this.c = nbttagcompound.c("yTile");
|
||||
this.d = nbttagcompound.c("zTile");
|
||||
this.e = nbttagcompound.b("inTile") & 255;
|
||||
this.a = nbttagcompound.b("shake") & 255;
|
||||
this.f = nbttagcompound.b("inGround") == 1;
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (f && ak == entityplayer && a <= 0 && entityplayer.an.a(new ItemStack(Item.j, 1))) {
|
||||
l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityplayer.c(((Entity) (this)), 1);
|
||||
q();
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,81 +8,81 @@ import org.bukkit.craftbukkit.entity.CraftFallingSand;
|
||||
public class EntityFallingSand extends Entity {
|
||||
|
||||
public int a;
|
||||
public int b;
|
||||
public int b = 0;
|
||||
|
||||
public EntityFallingSand(World world) {
|
||||
super(world);
|
||||
b = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftFallingSand(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityFallingSand(World world, double d, double d1, double d2, int i) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
a = i;
|
||||
public EntityFallingSand(World world, double d0, double d1, double d2, int i) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
this.a = i;
|
||||
this.i = true;
|
||||
a(0.98F, 0.98F);
|
||||
H = J / 2.0F;
|
||||
a(d, d1, d2);
|
||||
s = 0.0D;
|
||||
t = 0.0D;
|
||||
u = 0.0D;
|
||||
M = false;
|
||||
m = d;
|
||||
n = d1;
|
||||
o = d2;
|
||||
this.a(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.a(d0, d1, d2);
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.M = false;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public boolean c_() {
|
||||
return !G;
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
if (a == 0) {
|
||||
q();
|
||||
return;
|
||||
}
|
||||
m = p;
|
||||
n = q;
|
||||
o = r;
|
||||
b++;
|
||||
t -= 0.039999999105930328D;
|
||||
c(s, t, u);
|
||||
s *= 0.98000001907348633D;
|
||||
t *= 0.98000001907348633D;
|
||||
u *= 0.98000001907348633D;
|
||||
int i = MathHelper.b(p);
|
||||
int j = MathHelper.b(q);
|
||||
int k = MathHelper.b(r);
|
||||
if (this.a == 0) {
|
||||
this.q();
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
++this.b;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.b(this.locY);
|
||||
int k = MathHelper.b(this.locZ);
|
||||
|
||||
if (l.a(i, j, k) == a) {
|
||||
l.e(i, j, k, 0);
|
||||
}
|
||||
if (A) {
|
||||
s *= 0.69999998807907104D;
|
||||
u *= 0.69999998807907104D;
|
||||
t *= -0.5D;
|
||||
q();
|
||||
if ((!l.a(a, i, j, k, true) || !l.e(i, j, k, a)) && !l.z) {
|
||||
a(a, 1);
|
||||
if (this.world.getTypeId(i, j, k) == this.a) {
|
||||
this.world.e(i, j, k, 0);
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
this.q();
|
||||
if ((!this.world.a(this.a, i, j, k, true) || !this.world.e(i, j, k, this.a)) && !this.world.isStatic) {
|
||||
this.a(this.a, 1);
|
||||
}
|
||||
} else if (this.b > 100 && !this.world.isStatic) {
|
||||
this.a(this.a, 1);
|
||||
this.q();
|
||||
}
|
||||
} else if (b > 100 && !l.z) {
|
||||
a(a, 1);
|
||||
q();
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Tile", (byte) a);
|
||||
nbttagcompound.a("Tile", (byte) this.a);
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
a = nbttagcompound.b("Tile") & 0xff;
|
||||
this.a = nbttagcompound.b("Tile") & 255;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftFireball;
|
||||
@ -11,215 +10,218 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
|
||||
public class EntityFireball extends Entity {
|
||||
|
||||
private int e;
|
||||
private int f;
|
||||
private int ak;
|
||||
private int al;
|
||||
private boolean am;
|
||||
public int a;
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int ak = -1;
|
||||
private int al = 0;
|
||||
private boolean am = false;
|
||||
public int a = 0;
|
||||
private EntityLiving an;
|
||||
private int ao;
|
||||
private int ap;
|
||||
private int ap = 0;
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
|
||||
public EntityFireball(World world) {
|
||||
super(world);
|
||||
e = -1;
|
||||
f = -1;
|
||||
ak = -1;
|
||||
al = 0;
|
||||
am = false;
|
||||
a = 0;
|
||||
ap = 0;
|
||||
a(1.0F, 1.0F);
|
||||
|
||||
this.a(1.0F, 1.0F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftFireball(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d1, double d2, double d3) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
an = entityliving;
|
||||
c(entityliving.p, entityliving.q, entityliving.r, entityliving.v, entityliving.w);
|
||||
a(p, q, r);
|
||||
H = 0.0F;
|
||||
s = t = u = 0.0D;
|
||||
d1 += W.nextGaussian() * 0.40000000000000002D;
|
||||
d2 += W.nextGaussian() * 0.40000000000000002D;
|
||||
d3 += W.nextGaussian() * 0.40000000000000002D;
|
||||
double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
b = (d1 / d4) * 0.10000000000000001D;
|
||||
c = (d2 / d4) * 0.10000000000000001D;
|
||||
d = (d3 / d4) * 0.10000000000000001D;
|
||||
this.an = entityliving;
|
||||
this.a(1.0F, 1.0F);
|
||||
this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
this.motX = this.motY = this.motZ = 0.0D;
|
||||
d0 += this.random.nextGaussian() * 0.4D;
|
||||
d1 += this.random.nextGaussian() * 0.4D;
|
||||
d2 += this.random.nextGaussian() * 0.4D;
|
||||
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
this.b = d0 / d3 * 0.1D;
|
||||
this.c = d1 / d3 * 0.1D;
|
||||
this.d = d2 / d3 * 0.1D;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
Z = 10;
|
||||
if (a > 0) {
|
||||
a--;
|
||||
this.fireTicks = 10;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
if (am) {
|
||||
int i = l.a(e, f, ak);
|
||||
|
||||
if (i != al) {
|
||||
am = false;
|
||||
s *= W.nextFloat() * 0.2F;
|
||||
t *= W.nextFloat() * 0.2F;
|
||||
u *= W.nextFloat() * 0.2F;
|
||||
ao = 0;
|
||||
ap = 0;
|
||||
} else {
|
||||
ao++;
|
||||
if (ao == 1200) {
|
||||
q();
|
||||
if (this.am) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.ak);
|
||||
|
||||
if (i == this.al) {
|
||||
++this.ao;
|
||||
if (this.ao == 1200) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ap++;
|
||||
}
|
||||
Vec3D vec3d = Vec3D.b(p, q, r);
|
||||
Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
MovingObjectPosition movingobjectposition = l.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(p, q, r);
|
||||
vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
this.am = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.ao = 0;
|
||||
this.ap = 0;
|
||||
} else {
|
||||
++this.ap;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
Entity entity = null;
|
||||
List list = l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
|
||||
double d1 = 0.0D;
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
Entity entity = null;
|
||||
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (!entity1.c_() || entity1 == an && ap < 25) {
|
||||
continue;
|
||||
}
|
||||
float f3 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.z.b(f3, f3, f3);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
if (entity1.c_() && (entity1 != this.an || this.ap >= 25)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
if (movingobjectposition1 == null) {
|
||||
continue;
|
||||
}
|
||||
double d2 = vec3d.a(movingobjectposition1.f);
|
||||
if (movingobjectposition1 != null) {
|
||||
double d1 = vec3d.a(movingobjectposition1.f);
|
||||
|
||||
if (d2 < d1 || d1 == 0.0D) {
|
||||
entity = entity1;
|
||||
d1 = d2;
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
// CraftBukkit start
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
boolean bounce;
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
org.bukkit.entity.Entity shooter = (an == null)?null:an.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.an == null) ? null : this.an.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(edbpe);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if(!edbpe.isCancelled()) {
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the fireball should stick or not, i.e. !bounce
|
||||
bounce = !movingobjectposition.g.a(((Entity) (an)), edbpe.getDamage());
|
||||
stick = movingobjectposition.g.a(this.an, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the fireball should bounce or not
|
||||
bounce = edbpe.getBounce();
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
bounce = !movingobjectposition.g.a(((Entity) (an)), 0);
|
||||
stick = movingobjectposition.g.a(this.an, 0);
|
||||
}
|
||||
if (!bounce) {
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
;
|
||||
}
|
||||
}
|
||||
l.a(((Entity) (null)), p, q, r, 1.0F, true);
|
||||
q();
|
||||
}
|
||||
p += s;
|
||||
q += t;
|
||||
r += u;
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
// CraftBukkit end
|
||||
|
||||
v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) {
|
||||
this.world.a((Entity) null, this.locX, this.locY, this.locZ, 1.0F, true);
|
||||
this.q();
|
||||
}
|
||||
|
||||
this.locX += this.motX;
|
||||
this.locY += this.motY;
|
||||
this.locZ += this.motZ;
|
||||
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
for (; w - y >= 180F; y += 360F) {
|
||||
;
|
||||
|
||||
while (this.pitch - this.lastPitch >= 180.0F) {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
for (; v - x < -180F; x -= 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw < -180.0F) {
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
for (; v - x >= 180F; x += 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw >= 180.0F) {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
w = y + (w - y) * 0.2F;
|
||||
v = x + (v - x) * 0.2F;
|
||||
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.95F;
|
||||
|
||||
if (v()) {
|
||||
for (int k = 0; k < 4; k++) {
|
||||
float f4 = 0.25F;
|
||||
if (this.v()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
float f3 = 0.25F;
|
||||
|
||||
l.a("bubble", p - s * (double) f4, q - t * (double) f4, r - u * (double) f4, s, t, u);
|
||||
this.world.a("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
}
|
||||
s += b;
|
||||
t += c;
|
||||
u += d;
|
||||
s *= f2;
|
||||
t *= f2;
|
||||
u *= f2;
|
||||
l.a("smoke", p, q + 0.5D, r, 0.0D, 0.0D, 0.0D);
|
||||
a(p, q, r);
|
||||
|
||||
this.motX += this.b;
|
||||
this.motY += this.c;
|
||||
this.motZ += this.d;
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("xTile", (short) e);
|
||||
nbttagcompound.a("yTile", (short) f);
|
||||
nbttagcompound.a("zTile", (short) ak);
|
||||
nbttagcompound.a("inTile", (byte) al);
|
||||
nbttagcompound.a("shake", (byte) a);
|
||||
nbttagcompound.a("inGround", (byte) (am ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.e);
|
||||
nbttagcompound.a("yTile", (short) this.f);
|
||||
nbttagcompound.a("zTile", (short) this.ak);
|
||||
nbttagcompound.a("inTile", (byte) this.al);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.am ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
e = ((int) (nbttagcompound.c("xTile")));
|
||||
f = ((int) (nbttagcompound.c("yTile")));
|
||||
ak = ((int) (nbttagcompound.c("zTile")));
|
||||
al = nbttagcompound.b("inTile") & 0xff;
|
||||
a = nbttagcompound.b("shake") & 0xff;
|
||||
am = nbttagcompound.b("inGround") == 1;
|
||||
this.e = nbttagcompound.c("xTile");
|
||||
this.f = nbttagcompound.c("yTile");
|
||||
this.ak = nbttagcompound.c("zTile");
|
||||
this.al = nbttagcompound.b("inTile") & 255;
|
||||
this.a = nbttagcompound.b("shake") & 255;
|
||||
this.am = nbttagcompound.b("inGround") == 1;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
@ -227,18 +229,19 @@ public class EntityFireball extends Entity {
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
y();
|
||||
this.y();
|
||||
if (entity != null) {
|
||||
Vec3D vec3d = entity.G();
|
||||
|
||||
if (vec3d != null) {
|
||||
s = vec3d.a;
|
||||
t = vec3d.b;
|
||||
u = vec3d.c;
|
||||
b = s * 0.10000000000000001D;
|
||||
c = t * 0.10000000000000001D;
|
||||
d = u * 0.10000000000000001D;
|
||||
this.motX = vec3d.a;
|
||||
this.motY = vec3d.b;
|
||||
this.motZ = vec3d.c;
|
||||
this.b = this.motX * 0.1D;
|
||||
this.c = this.motY * 0.1D;
|
||||
this.d = this.motZ * 0.1D;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftFish;
|
||||
@ -13,17 +12,17 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class EntityFish extends Entity {
|
||||
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private int ak;
|
||||
private boolean al;
|
||||
public int a;
|
||||
public EntityPlayer b;
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int ak = 0;
|
||||
private boolean al = false;
|
||||
public int a = 0;
|
||||
public EntityHuman b;
|
||||
private int am;
|
||||
private int an;
|
||||
private int ao;
|
||||
public Entity c;
|
||||
private int an = 0;
|
||||
private int ao = 0;
|
||||
public Entity c = null;
|
||||
private int ap;
|
||||
private double aq;
|
||||
private double ar;
|
||||
@ -33,332 +32,345 @@ public class EntityFish extends Entity {
|
||||
|
||||
public EntityFish(World world) {
|
||||
super(world);
|
||||
d = -1;
|
||||
e = -1;
|
||||
f = -1;
|
||||
ak = 0;
|
||||
al = false;
|
||||
a = 0;
|
||||
an = 0;
|
||||
ao = 0;
|
||||
c = null;
|
||||
a(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
|
||||
//CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftFish(server, this);
|
||||
//CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public EntityFish(World world, EntityPlayer entityplayer) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
b = entityplayer;
|
||||
b.aE = this;
|
||||
c(entityplayer.p, (entityplayer.q + 1.6200000000000001D) - (double) entityplayer.H, entityplayer.r, entityplayer.v, entityplayer.w);
|
||||
p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F;
|
||||
q -= 0.10000000149011612D;
|
||||
r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F;
|
||||
a(p, q, r);
|
||||
H = 0.0F;
|
||||
float f1 = 0.4F;
|
||||
public EntityFish(World world, EntityHuman entityhuman) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
t = -MathHelper.a((w / 180F) * 3.141593F) * f1;
|
||||
a(s, t, u, 1.5F, 1.0F);
|
||||
this.b = entityhuman;
|
||||
this.b.hookedFish = this;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.c(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
float f = 0.4F;
|
||||
|
||||
this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public void a(double d1, double d2, double d3, float f1, float f2) {
|
||||
float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d1 /= f3;
|
||||
d2 /= f3;
|
||||
d3 /= f3;
|
||||
d1 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d2 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d3 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d1 *= f1;
|
||||
d2 *= f1;
|
||||
d3 *= f1;
|
||||
s = d1;
|
||||
t = d2;
|
||||
u = d3;
|
||||
float f4 = MathHelper.a(d1 * d1 + d3 * d3);
|
||||
d0 /= (double) f2;
|
||||
d1 /= (double) f2;
|
||||
d2 /= (double) f2;
|
||||
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d0 *= (double) f;
|
||||
d1 *= (double) f;
|
||||
d2 *= (double) f;
|
||||
this.motX = d0;
|
||||
this.motY = d1;
|
||||
this.motZ = d2;
|
||||
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
|
||||
|
||||
x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D);
|
||||
y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D);
|
||||
am = 0;
|
||||
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.am = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (ap > 0) {
|
||||
double d1 = p + (aq - p) / (double) ap;
|
||||
double d2 = q + (ar - q) / (double) ap;
|
||||
double d3 = r + (as - r) / (double) ap;
|
||||
double d4;
|
||||
if (this.ap > 0) {
|
||||
double d0 = this.locX + (this.aq - this.locX) / (double) this.ap;
|
||||
double d1 = this.locY + (this.ar - this.locY) / (double) this.ap;
|
||||
double d2 = this.locZ + (this.as - this.locZ) / (double) this.ap;
|
||||
|
||||
for (d4 = at - (double) v; d4 < -180D; d4 += 360D) {
|
||||
double d3;
|
||||
|
||||
for (d3 = this.at - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
for (; d4 >= 180D; d4 -= 360D) {
|
||||
;
|
||||
}
|
||||
v += ((float) (d4 / (double) ap));
|
||||
w += ((float) ((au - (double) w) / (double) ap));
|
||||
ap--;
|
||||
a(d1, d2, d3);
|
||||
b(v, w);
|
||||
return;
|
||||
}
|
||||
if (!this.l.z) {
|
||||
ItemStack itemstack = b.P();
|
||||
|
||||
if (b.G || !b.B() || itemstack == null || itemstack.a() != Item.aP || b(((Entity) (b))) > 1024D) {
|
||||
q();
|
||||
b.aE = null;
|
||||
return;
|
||||
while (d3 >= 180.0D) {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
if (c != null) {
|
||||
if (c.G) {
|
||||
c = null;
|
||||
} else {
|
||||
p = c.p;
|
||||
q = c.z.b + (double) c.J * 0.80000000000000004D;
|
||||
r = c.r;
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.ap);
|
||||
this.pitch = (float) ((double) this.pitch + (this.au - (double) this.pitch) / (double) this.ap);
|
||||
--this.ap;
|
||||
this.a(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
ItemStack itemstack = this.b.P();
|
||||
|
||||
// CraftBukkit - cast this.b to Entity
|
||||
if (this.b.dead || !this.b.B() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.b((Entity) this.b) > 1024.0D) {
|
||||
this.q();
|
||||
this.b.hookedFish = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a > 0) {
|
||||
a--;
|
||||
}
|
||||
if (al) {
|
||||
int i = this.l.a(d, e, f);
|
||||
|
||||
if (i != ak) {
|
||||
al = false;
|
||||
s *= W.nextFloat() * 0.2F;
|
||||
t *= W.nextFloat() * 0.2F;
|
||||
u *= W.nextFloat() * 0.2F;
|
||||
am = 0;
|
||||
an = 0;
|
||||
} else {
|
||||
am++;
|
||||
if (am == 1200) {
|
||||
q();
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
an++;
|
||||
}
|
||||
Vec3D vec3d = Vec3D.b(p, q, r);
|
||||
Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
MovingObjectPosition movingobjectposition = this.l.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(p, q, r);
|
||||
vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
Entity entity = null;
|
||||
List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
|
||||
double d5 = 0.0D;
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (!entity1.c_() || entity1 == b && an < 5) {
|
||||
continue;
|
||||
}
|
||||
float f3 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.z.b(f3, f3, f3);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
if (movingobjectposition1 == null) {
|
||||
continue;
|
||||
}
|
||||
double d6 = vec3d.a(movingobjectposition1.f);
|
||||
|
||||
if (d6 < d5 || d5 == 0.0D) {
|
||||
entity = entity1;
|
||||
d5 = d6;
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
||||
boolean bounce;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
org.bukkit.entity.Entity shooter = (b == null)?null:b.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(edbpe);
|
||||
|
||||
if(!edbpe.isCancelled()) {
|
||||
// this function returns if the fish should stick or not, i.e. !bounce
|
||||
bounce = !movingobjectposition.g.a(((Entity) (b)), edbpe.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the fish should bounce or not
|
||||
bounce = edbpe.getBounce();
|
||||
if (this.c != null) {
|
||||
if (!this.c.dead) {
|
||||
this.locX = this.c.locX;
|
||||
this.locY = this.c.boundingBox.b + (double) this.c.width * 0.8D;
|
||||
this.locZ = this.c.locZ;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
bounce = !movingobjectposition.g.a(((Entity) (b)), 0);
|
||||
|
||||
this.c = null;
|
||||
}
|
||||
if (!bounce) {
|
||||
// CraftBukkit end
|
||||
c = movingobjectposition.g;
|
||||
}
|
||||
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (this.al) {
|
||||
int i = this.world.getTypeId(this.d, this.e, this.f);
|
||||
|
||||
if (i == this.ak) {
|
||||
++this.am;
|
||||
if (this.am == 1200) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.al = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.am = 0;
|
||||
this.an = 0;
|
||||
} else {
|
||||
al = true;
|
||||
++this.an;
|
||||
}
|
||||
}
|
||||
if (al) {
|
||||
return;
|
||||
}
|
||||
c(s, t, u);
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
|
||||
v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) {
|
||||
;
|
||||
}
|
||||
for (; w - y >= 180F; y += 360F) {
|
||||
;
|
||||
}
|
||||
for (; v - x < -180F; x -= 360F) {
|
||||
;
|
||||
}
|
||||
for (; v - x >= 180F; x += 360F) {
|
||||
;
|
||||
}
|
||||
w = y + (w - y) * 0.2F;
|
||||
v = x + (v - x) * 0.2F;
|
||||
float f2 = 0.92F;
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
if (A || B) {
|
||||
f2 = 0.5F;
|
||||
}
|
||||
int k = 5;
|
||||
double d8 = 0.0D;
|
||||
|
||||
for (int l = 0; l < k; l++) {
|
||||
double d9 = ((z.b + ((z.e - z.b) * (double) (l + 0)) / (double) k) - 0.125D) + 0.125D;
|
||||
double d10 = ((z.b + ((z.e - z.b) * (double) (l + 1)) / (double) k) - 0.125D) + 0.125D;
|
||||
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(z.a, d9, z.c, z.d, d10, z.f);
|
||||
|
||||
if (this.l.b(axisalignedbb1, Material.f)) {
|
||||
d8 += 1.0D / (double) k;
|
||||
vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
}
|
||||
|
||||
if (d8 > 0.0D) {
|
||||
if (ao > 0) {
|
||||
ao--;
|
||||
} else if (W.nextInt(500) == 0) {
|
||||
ao = W.nextInt(30) + 10;
|
||||
t -= 0.20000000298023224D;
|
||||
this.l.a(((Entity) (this)), "random.splash", 0.25F, 1.0F + (W.nextFloat() - W.nextFloat()) * 0.4F);
|
||||
float f4 = MathHelper.b(z.b);
|
||||
Entity entity = null;
|
||||
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
|
||||
double d4 = 0.0D;
|
||||
|
||||
for (int i1 = 0; (float) i1 < 1.0F + I * 20F; i1++) {
|
||||
float f5 = (W.nextFloat() * 2.0F - 1.0F) * I;
|
||||
float f7 = (W.nextFloat() * 2.0F - 1.0F) * I;
|
||||
double d5;
|
||||
|
||||
this.l.a("bubble", p + (double) f5, f4 + 1.0F, r + (double) f7, s, t - (double) (W.nextFloat() * 0.2F), u);
|
||||
}
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
for (int j1 = 0; (float) j1 < 1.0F + I * 20F; j1++) {
|
||||
float f6 = (W.nextFloat() * 2.0F - 1.0F) * I;
|
||||
float f8 = (W.nextFloat() * 2.0F - 1.0F) * I;
|
||||
if (entity1.c_() && (entity1 != this.b || this.an >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
this.l.a("splash", p + (double) f6, f4 + 1.0F, r + (double) f8, s, t, u);
|
||||
if (movingobjectposition1 != null) {
|
||||
d5 = vec3d.a(movingobjectposition1.f);
|
||||
if (d5 < d4 || d4 == 0.0D) {
|
||||
entity = entity1;
|
||||
d4 = d5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ao > 0) {
|
||||
t -= (double) (W.nextFloat() * W.nextFloat() * W.nextFloat()) * 0.20000000000000001D;
|
||||
}
|
||||
double d7 = d8 * 2D - 1.0D;
|
||||
|
||||
t += 0.039999999105930328D * d7;
|
||||
if (d8 > 0.0D) {
|
||||
f2 = (float) ((double) f2 * 0.90000000000000002D);
|
||||
t *= 0.80000000000000004D;
|
||||
if (entity != null) {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the fish should stick or not, i.e. !bounce
|
||||
stick = movingobjectposition.g.a(this.b, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the fish should bounce or not
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.g.a(this.b, 0);
|
||||
}
|
||||
if (!stick) {
|
||||
c = movingobjectposition.g;
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
this.al = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.al) {
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while (this.pitch - this.lastPitch >= 180.0F) {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.yaw - this.lastYaw < -180.0F) {
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.yaw - this.lastYaw >= 180.0F) {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.92F;
|
||||
|
||||
if (this.onGround || this.B) {
|
||||
f2 = 0.5F;
|
||||
}
|
||||
|
||||
byte b0 = 5;
|
||||
double d6 = 0.0D;
|
||||
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D;
|
||||
double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D;
|
||||
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f);
|
||||
|
||||
if (this.world.b(axisalignedbb1, Material.WATER)) {
|
||||
d6 += 1.0D / (double) b0;
|
||||
}
|
||||
}
|
||||
|
||||
if (d6 > 0.0D) {
|
||||
if (this.ao > 0) {
|
||||
--this.ao;
|
||||
} else if (this.random.nextInt(500) == 0) {
|
||||
this.ao = this.random.nextInt(30) + 10;
|
||||
this.motY -= 0.20000000298023224D;
|
||||
this.world.a(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
float f3 = (float) MathHelper.b(this.boundingBox.b);
|
||||
|
||||
int l;
|
||||
float f4;
|
||||
float f5;
|
||||
|
||||
for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) {
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
|
||||
this.world.a("bubble", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
|
||||
}
|
||||
|
||||
for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) {
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
|
||||
this.world.a("splash", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ao > 0) {
|
||||
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
|
||||
}
|
||||
|
||||
d5 = d6 * 2.0D - 1.0D;
|
||||
this.motY += 0.03999999910593033D * d5;
|
||||
if (d6 > 0.0D) {
|
||||
f2 = (float) ((double) f2 * 0.9D);
|
||||
this.motY *= 0.8D;
|
||||
}
|
||||
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
}
|
||||
s *= f2;
|
||||
t *= f2;
|
||||
u *= f2;
|
||||
a(p, q, r);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("xTile", (short) d);
|
||||
nbttagcompound.a("yTile", (short) e);
|
||||
nbttagcompound.a("zTile", (short) f);
|
||||
nbttagcompound.a("inTile", (byte) ak);
|
||||
nbttagcompound.a("shake", (byte) a);
|
||||
nbttagcompound.a("inGround", (byte) (al ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.d);
|
||||
nbttagcompound.a("yTile", (short) this.e);
|
||||
nbttagcompound.a("zTile", (short) this.f);
|
||||
nbttagcompound.a("inTile", (byte) this.ak);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.al ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
d = ((int) (nbttagcompound.c("xTile")));
|
||||
e = ((int) (nbttagcompound.c("yTile")));
|
||||
f = ((int) (nbttagcompound.c("zTile")));
|
||||
ak = nbttagcompound.b("inTile") & 0xff;
|
||||
a = nbttagcompound.b("shake") & 0xff;
|
||||
al = nbttagcompound.b("inGround") == 1;
|
||||
this.d = nbttagcompound.c("xTile");
|
||||
this.e = nbttagcompound.c("yTile");
|
||||
this.f = nbttagcompound.c("zTile");
|
||||
this.ak = nbttagcompound.b("inTile") & 255;
|
||||
this.a = nbttagcompound.b("shake") & 255;
|
||||
this.al = nbttagcompound.b("inGround") == 1;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
byte byte0 = 0;
|
||||
byte b0 = 0;
|
||||
|
||||
if (c != null) {
|
||||
double d1 = b.p - p;
|
||||
double d2 = b.q - q;
|
||||
double d3 = b.r - r;
|
||||
double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
double d5 = 0.10000000000000001D;
|
||||
if (this.c != null) {
|
||||
double d0 = this.b.locX - this.locX;
|
||||
double d1 = this.b.locY - this.locY;
|
||||
double d2 = this.b.locZ - this.locZ;
|
||||
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
double d4 = 0.1D;
|
||||
|
||||
c.s += d1 * d5;
|
||||
c.t += d2 * d5 + (double) MathHelper.a(d4) * 0.080000000000000002D;
|
||||
c.u += d3 * d5;
|
||||
byte0 = 3;
|
||||
} else if (ao > 0) {
|
||||
EntityItem entityitem = new EntityItem(l, p, q, r, new ItemStack(Item.aS));
|
||||
double d6 = b.p - p;
|
||||
double d7 = b.q - q;
|
||||
double d8 = b.r - r;
|
||||
double d9 = MathHelper.a(d6 * d6 + d7 * d7 + d8 * d8);
|
||||
double d10 = 0.10000000000000001D;
|
||||
this.c.motX += d0 * d4;
|
||||
this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D;
|
||||
this.c.motZ += d2 * d4;
|
||||
b0 = 3;
|
||||
} else if (this.ao > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||
double d5 = this.b.locX - this.locX;
|
||||
double d6 = this.b.locY - this.locY;
|
||||
double d7 = this.b.locZ - this.locZ;
|
||||
double d8 = (double) MathHelper.a(d5 * d5 + d6 * d6 + d7 * d7);
|
||||
double d9 = 0.1D;
|
||||
|
||||
entityitem.s = d6 * d10;
|
||||
entityitem.t = d7 * d10 + (double) MathHelper.a(d9) * 0.080000000000000002D;
|
||||
entityitem.u = d8 * d10;
|
||||
l.a(((Entity) (entityitem)));
|
||||
byte0 = 1;
|
||||
entityitem.motX = d5 * d9;
|
||||
entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D;
|
||||
entityitem.motZ = d7 * d9;
|
||||
this.world.a((Entity) entityitem);
|
||||
b0 = 1;
|
||||
}
|
||||
if (al) {
|
||||
byte0 = 2;
|
||||
|
||||
if (this.al) {
|
||||
b0 = 2;
|
||||
}
|
||||
q();
|
||||
b.aE = null;
|
||||
return ((int) (byte0));
|
||||
|
||||
this.q();
|
||||
this.b.hookedFish = null;
|
||||
return b0;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,9 @@ public class EntityFlying extends EntityLiving {
|
||||
|
||||
public EntityFlying(World world) {
|
||||
super(world);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftFlying(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -18,56 +19,60 @@ public class EntityFlying extends EntityLiving {
|
||||
protected void a(float f) {}
|
||||
|
||||
public void c(float f, float f1) {
|
||||
if (v()) {
|
||||
a(f, f1, 0.02F);
|
||||
c(s, t, u);
|
||||
s *= 0.80000001192092896D;
|
||||
t *= 0.80000001192092896D;
|
||||
u *= 0.80000001192092896D;
|
||||
} else if (x()) {
|
||||
a(f, f1, 0.02F);
|
||||
c(s, t, u);
|
||||
s *= 0.5D;
|
||||
t *= 0.5D;
|
||||
u *= 0.5D;
|
||||
if (this.v()) {
|
||||
this.a(f, f1, 0.02F);
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.800000011920929D;
|
||||
this.motY *= 0.800000011920929D;
|
||||
this.motZ *= 0.800000011920929D;
|
||||
} else if (this.x()) {
|
||||
this.a(f, f1, 0.02F);
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
} else {
|
||||
float f2 = 0.91F;
|
||||
|
||||
if (A) {
|
||||
f2 = 0.5460001F;
|
||||
int i = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r));
|
||||
if (this.onGround) {
|
||||
f2 = 0.54600006F;
|
||||
int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
|
||||
|
||||
if (i > 0) {
|
||||
f2 = Block.m[i].bu * 0.91F;
|
||||
f2 = Block.byId[i].frictionFactor * 0.91F;
|
||||
}
|
||||
}
|
||||
float f3 = 0.1627714F / (f2 * f2 * f2);
|
||||
|
||||
a(f, f1, A ? 0.1F * f3 : 0.02F);
|
||||
float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||
|
||||
this.a(f, f1, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
f2 = 0.91F;
|
||||
if (A) {
|
||||
f2 = 0.5460001F;
|
||||
int j = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r));
|
||||
if (this.onGround) {
|
||||
f2 = 0.54600006F;
|
||||
int j = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
|
||||
|
||||
if (j > 0) {
|
||||
f2 = Block.m[j].bu * 0.91F;
|
||||
f2 = Block.byId[j].frictionFactor * 0.91F;
|
||||
}
|
||||
}
|
||||
c(s, t, u);
|
||||
s *= f2;
|
||||
t *= f2;
|
||||
u *= f2;
|
||||
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
}
|
||||
bl = bm;
|
||||
double d = p - m;
|
||||
double d1 = r - o;
|
||||
float f4 = MathHelper.a(d * d + d1 * d1) * 4F;
|
||||
|
||||
this.bl = this.bm;
|
||||
double d0 = this.locX - this.lastX;
|
||||
double d1 = this.locZ - this.lastZ;
|
||||
float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F;
|
||||
|
||||
if (f4 > 1.0F) {
|
||||
f4 = 1.0F;
|
||||
}
|
||||
bm += (f4 - bm) * 0.4F;
|
||||
bn += bm;
|
||||
|
||||
this.bm += (f4 - this.bm) * 0.4F;
|
||||
this.bn += this.bm;
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
|
@ -1,122 +1,122 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftGhast;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityGhast extends EntityFlying implements IMobs {
|
||||
public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
public int a;
|
||||
public int a = 0;
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
private Entity ak;
|
||||
private int al;
|
||||
public int e;
|
||||
public int f;
|
||||
private Entity ak = null;
|
||||
private int al = 0;
|
||||
public int e = 0;
|
||||
public int f = 0;
|
||||
|
||||
public EntityGhast(World world) {
|
||||
super(world);
|
||||
a = 0;
|
||||
ak = null;
|
||||
al = 0;
|
||||
e = 0;
|
||||
f = 0;
|
||||
aP = "/mob/ghast.png";
|
||||
a(4F, 4F);
|
||||
ae = true;
|
||||
this.texture = "/mob/ghast.png";
|
||||
this.a(4.0F, 4.0F);
|
||||
this.ae = true;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftGhast(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
if (l.k == 0) {
|
||||
q();
|
||||
if (this.world.k == 0) {
|
||||
this.q();
|
||||
}
|
||||
e = f;
|
||||
double d1 = b - p;
|
||||
double d2 = c - q;
|
||||
double d3 = d - r;
|
||||
double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
|
||||
if (d4 < 1.0D || d4 > 60D) {
|
||||
b = p + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
|
||||
c = q + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
|
||||
d = r + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
|
||||
this.e = this.f;
|
||||
double d0 = this.b - this.locX;
|
||||
double d1 = this.c - this.locY;
|
||||
double d2 = this.d - this.locZ;
|
||||
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
if (d3 < 1.0D || d3 > 60.0D) {
|
||||
this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.c = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.d = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
if (a-- <= 0) {
|
||||
a += W.nextInt(5) + 2;
|
||||
if (a(b, c, d, d4)) {
|
||||
s += (d1 / d4) * 0.10000000000000001D;
|
||||
t += (d2 / d4) * 0.10000000000000001D;
|
||||
u += (d3 / d4) * 0.10000000000000001D;
|
||||
|
||||
if (this.a-- <= 0) {
|
||||
this.a += this.random.nextInt(5) + 2;
|
||||
if (this.a(this.b, this.c, this.d, d3)) {
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
} else {
|
||||
b = p;
|
||||
c = q;
|
||||
d = r;
|
||||
this.b = this.locX;
|
||||
this.c = this.locY;
|
||||
this.d = this.locZ;
|
||||
}
|
||||
}
|
||||
if (ak != null && ak.G) {
|
||||
ak = null;
|
||||
|
||||
if (this.ak != null && this.ak.dead) {
|
||||
this.ak = null;
|
||||
}
|
||||
if (ak == null || al-- <= 0) {
|
||||
ak = ((Entity) (l.a(((Entity) (this)), 100D)));
|
||||
if (ak != null) {
|
||||
al = 20;
|
||||
|
||||
if (this.ak == null || this.al-- <= 0) {
|
||||
this.ak = this.world.a(this, 100.0D);
|
||||
if (this.ak != null) {
|
||||
this.al = 20;
|
||||
}
|
||||
}
|
||||
double d5 = 64D;
|
||||
|
||||
if (ak != null && ak.b(((Entity) (this))) < d5 * d5) {
|
||||
double d6 = ak.p - p;
|
||||
double d7 = (ak.z.b + (double) (ak.J / 2.0F)) - (q + (double) (J / 2.0F));
|
||||
double d8 = ak.r - r;
|
||||
double d4 = 64.0D;
|
||||
|
||||
aI = v = (-(float) Math.atan2(d6, d8) * 180F) / 3.141593F;
|
||||
if (i(ak)) {
|
||||
if (f == 10) {
|
||||
l.a(((Entity) (this)), "mob.ghast.charge", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
|
||||
if (this.ak != null && this.ak.b((Entity) this) < d4 * d4) {
|
||||
double d5 = this.ak.locX - this.locX;
|
||||
double d6 = this.ak.boundingBox.b + (double) (this.ak.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
|
||||
double d7 = this.ak.locZ - this.locZ;
|
||||
|
||||
this.aI = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.i(this.ak)) {
|
||||
if (this.f == 10) {
|
||||
this.world.a(this, "mob.ghast.charge", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
f++;
|
||||
if (f == 20) {
|
||||
l.a(((Entity) (this)), "mob.ghast.fireball", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
|
||||
EntityFireball entityfireball = new EntityFireball(l, ((EntityLiving) (this)), d6, d7, d8);
|
||||
double d9 = 4D;
|
||||
Vec3D vec3d = c(1.0F);
|
||||
|
||||
entityfireball.p = p + vec3d.a * d9;
|
||||
entityfireball.q = q + (double) (J / 2.0F) + 0.5D;
|
||||
entityfireball.r = r + vec3d.c * d9;
|
||||
l.a(((Entity) (entityfireball)));
|
||||
f = -40;
|
||||
++this.f;
|
||||
if (this.f == 20) {
|
||||
this.world.a(this, "mob.ghast.fireball", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
|
||||
double d8 = 4.0D;
|
||||
Vec3D vec3d = this.c(1.0F);
|
||||
|
||||
entityfireball.locX = this.locX + vec3d.a * d8;
|
||||
entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D;
|
||||
entityfireball.locZ = this.locZ + vec3d.c * d8;
|
||||
this.world.a((Entity) entityfireball);
|
||||
this.f = -40;
|
||||
}
|
||||
} else if (f > 0) {
|
||||
f--;
|
||||
} else if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
} else {
|
||||
aI = v = (-(float) Math.atan2(s, u) * 180F) / 3.141593F;
|
||||
if (f > 0) {
|
||||
f--;
|
||||
this.aI = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
}
|
||||
aP = f <= 10 ? "/mob/ghast.png" : "/mob/ghast_fire.png";
|
||||
|
||||
this.texture = this.f > 10 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
|
||||
}
|
||||
|
||||
private boolean a(double d1, double d2, double d3, double d4) {
|
||||
double d5 = (b - p) / d4;
|
||||
double d6 = (c - q) / d4;
|
||||
double d7 = (d - r) / d4;
|
||||
AxisAlignedBB axisalignedbb = z.b();
|
||||
private boolean a(double d0, double d1, double d2, double d3) {
|
||||
double d4 = (this.b - this.locX) / d3;
|
||||
double d5 = (this.c - this.locY) / d3;
|
||||
double d6 = (this.d - this.locZ) / d3;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.b();
|
||||
|
||||
for (int k = 1; (double) k < d4; k++) {
|
||||
axisalignedbb.d(d5, d6, d7);
|
||||
if (l.a(((Entity) (this)), axisalignedbb).size() > 0) {
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
axisalignedbb.d(d4, d5, d6);
|
||||
if (this.world.a((Entity) this, axisalignedbb).size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -137,15 +137,15 @@ public class EntityGhast extends EntityFlying implements IMobs {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.K.ba;
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
protected float i() {
|
||||
return 10F;
|
||||
return 10.0F;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return W.nextInt(20) == 0 && super.b() && l.k > 0;
|
||||
return this.random.nextInt(20) == 0 && super.b() && this.world.k > 0;
|
||||
}
|
||||
|
||||
public int j() {
|
||||
|
28
src/main/java/net/minecraft/server/EntityGiantZombie.java
Normale Datei
28
src/main/java/net/minecraft/server/EntityGiantZombie.java
Normale Datei
@ -0,0 +1,28 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftGiant;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntityGiantZombie extends EntityMonster {
|
||||
|
||||
public EntityGiantZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/zombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.c = 50;
|
||||
this.health *= 10;
|
||||
this.height *= 6.0F;
|
||||
this.a(this.length * 6.0F, this.width * 6.0F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftGiant(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float a(int i, int j, int k) {
|
||||
return this.world.l(i, j, k) - 0.5F;
|
||||
}
|
||||
}
|
391
src/main/java/net/minecraft/server/EntityHuman.java
Normale Datei
391
src/main/java/net/minecraft/server/EntityHuman.java
Normale Datei
@ -0,0 +1,391 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public InventoryPlayer inventory = new InventoryPlayer(this);
|
||||
public Container defaultContainer;
|
||||
public Container activeContainer;
|
||||
public byte aq = 0;
|
||||
public int ar = 0;
|
||||
public float as;
|
||||
public float at;
|
||||
public boolean au = false;
|
||||
public int av = 0;
|
||||
public String name;
|
||||
public int dimension;
|
||||
public double ay;
|
||||
public double az;
|
||||
public double aA;
|
||||
public double aB;
|
||||
public double aC;
|
||||
public double aD;
|
||||
private int a = 0;
|
||||
public EntityFish hookedFish = null;
|
||||
|
||||
public EntityHuman(World world) {
|
||||
super(world);
|
||||
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic);
|
||||
this.activeContainer = this.defaultContainer;
|
||||
this.height = 1.62F;
|
||||
this.c((double) world.spawnX + 0.5D, (double) (world.spawnY + 1), (double) world.spawnZ + 0.5D, 0.0F, 0.0F);
|
||||
this.health = 20;
|
||||
this.aS = "humanoid";
|
||||
this.aR = 180.0F;
|
||||
this.maxFireTicks = 20;
|
||||
this.texture = "/mob/char.png";
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftHumanEntity(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
|
||||
this.L();
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
this.ay = this.aB;
|
||||
this.az = this.aC;
|
||||
this.aA = this.aD;
|
||||
double d0 = this.locX - this.aB;
|
||||
double d1 = this.locY - this.aC;
|
||||
double d2 = this.locZ - this.aD;
|
||||
double d3 = 10.0D;
|
||||
|
||||
if (d0 > d3) {
|
||||
this.ay = this.aB = this.locX;
|
||||
}
|
||||
|
||||
if (d2 > d3) {
|
||||
this.aA = this.aD = this.locZ;
|
||||
}
|
||||
|
||||
if (d1 > d3) {
|
||||
this.az = this.aC = this.locY;
|
||||
}
|
||||
|
||||
if (d0 < -d3) {
|
||||
this.ay = this.aB = this.locX;
|
||||
}
|
||||
|
||||
if (d2 < -d3) {
|
||||
this.aA = this.aD = this.locZ;
|
||||
}
|
||||
|
||||
if (d1 < -d3) {
|
||||
this.az = this.aC = this.locY;
|
||||
}
|
||||
|
||||
this.aB += d0 * 0.25D;
|
||||
this.aD += d2 * 0.25D;
|
||||
this.aC += d1 * 0.25D;
|
||||
}
|
||||
|
||||
protected void L() {
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
public void D() {
|
||||
super.D();
|
||||
this.as = this.at;
|
||||
this.at = 0.0F;
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
if (this.au) {
|
||||
++this.av;
|
||||
if (this.av == 8) {
|
||||
this.av = 0;
|
||||
this.au = false;
|
||||
}
|
||||
} else {
|
||||
this.av = 0;
|
||||
}
|
||||
|
||||
this.aY = (float) this.av / 8.0F;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (this.world.k == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
|
||||
this.d(1);
|
||||
}
|
||||
|
||||
this.inventory.f();
|
||||
this.as = this.at;
|
||||
super.o();
|
||||
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
float f1 = (float) Math.atan(-this.motY * 0.20000000298023224D) * 15.0F;
|
||||
|
||||
if (f > 0.1F) {
|
||||
f = 0.1F;
|
||||
}
|
||||
|
||||
if (!this.onGround || this.health <= 0) {
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
if (this.onGround || this.health <= 0) {
|
||||
f1 = 0.0F;
|
||||
}
|
||||
|
||||
this.at += (f - this.at) * 0.4F;
|
||||
this.bh += (f1 - this.bh) * 0.8F;
|
||||
if (this.health > 0) {
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D));
|
||||
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (!entity.dead) {
|
||||
this.j(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void j(Entity entity) {
|
||||
entity.b(this);
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
super.f(entity);
|
||||
this.a(0.2F, 0.2F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.motY = 0.10000000149011612D;
|
||||
if (this.name.equals("Notch")) {
|
||||
this.a(new ItemStack(Item.APPLE, 1), true);
|
||||
}
|
||||
|
||||
this.inventory.h();
|
||||
if (entity != null) {
|
||||
this.motX = (double) (-MathHelper.b((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
|
||||
this.motZ = (double) (-MathHelper.a((this.bd + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
|
||||
} else {
|
||||
this.motX = this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
this.height = 0.1F;
|
||||
}
|
||||
|
||||
public void b(Entity entity, int i) {
|
||||
this.ar += i;
|
||||
}
|
||||
|
||||
public void O() {
|
||||
this.a(this.inventory.b(this.inventory.c, 1), false);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
this.a(itemstack, false);
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, boolean flag) {
|
||||
if (itemstack != null) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.w(), this.locZ, itemstack);
|
||||
|
||||
entityitem.c = 40;
|
||||
float f = 0.1F;
|
||||
float f1;
|
||||
|
||||
if (flag) {
|
||||
f1 = this.random.nextFloat() * 0.5F;
|
||||
float f2 = this.random.nextFloat() * 3.1415927F * 2.0F;
|
||||
|
||||
entityitem.motX = (double) (-MathHelper.a(f2) * f1);
|
||||
entityitem.motZ = (double) (MathHelper.b(f2) * f1);
|
||||
entityitem.motY = 0.20000000298023224D;
|
||||
} else {
|
||||
f = 0.3F;
|
||||
entityitem.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
entityitem.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
entityitem.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f + 0.1F);
|
||||
f = 0.02F;
|
||||
f1 = this.random.nextFloat() * 3.1415927F * 2.0F;
|
||||
f *= this.random.nextFloat();
|
||||
entityitem.motX += Math.cos((double) f1) * (double) f;
|
||||
entityitem.motY += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
|
||||
entityitem.motZ += Math.sin((double) f1) * (double) f;
|
||||
}
|
||||
|
||||
this.a(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(EntityItem entityitem) {
|
||||
this.world.a((Entity) entityitem);
|
||||
}
|
||||
|
||||
public float a(Block block) {
|
||||
float f = this.inventory.a(block);
|
||||
|
||||
if (this.a(Material.WATER)) {
|
||||
f /= 5.0F;
|
||||
}
|
||||
|
||||
if (!this.onGround) {
|
||||
f /= 5.0F;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
return this.inventory.b(block);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Inventory");
|
||||
|
||||
this.inventory.b(nbttaglist);
|
||||
this.dimension = nbttagcompound.d("Dimension");
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList()));
|
||||
nbttagcompound.a("Dimension", this.dimension);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {}
|
||||
|
||||
public void a(int i, int j, int k) {}
|
||||
|
||||
public void c(Entity entity, int i) {}
|
||||
|
||||
public float w() {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
this.bw = 0;
|
||||
if (this.health <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (entity instanceof EntityMonster || entity instanceof EntityArrow) {
|
||||
if (this.world.k == 0) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (this.world.k == 1) {
|
||||
i = i / 3 + 1;
|
||||
}
|
||||
|
||||
if (this.world.k == 3) {
|
||||
i = i * 3 / 2;
|
||||
}
|
||||
}
|
||||
|
||||
return i == 0 ? false : super.a(entity, i);
|
||||
}
|
||||
}
|
||||
|
||||
protected void e(int i) {
|
||||
int j = 25 - this.inventory.g();
|
||||
int k = i * j + this.a;
|
||||
|
||||
this.inventory.c(i);
|
||||
i = k / 25;
|
||||
this.a = k % 25;
|
||||
super.e(i);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {}
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {}
|
||||
|
||||
public void a(TileEntitySign tileentitysign) {}
|
||||
|
||||
public void g(Entity entity) {
|
||||
if (!entity.a(this)) {
|
||||
ItemStack itemstack = this.P();
|
||||
|
||||
if (itemstack != null && entity instanceof EntityLiving) {
|
||||
itemstack.b((EntityLiving) entity);
|
||||
if (itemstack.count <= 0) {
|
||||
itemstack.a(this);
|
||||
this.Q();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack P() {
|
||||
return this.inventory.e();
|
||||
}
|
||||
|
||||
public void Q() {
|
||||
this.inventory.a(this.inventory.c, (ItemStack) null);
|
||||
}
|
||||
|
||||
public double F() {
|
||||
return (double) (this.height - 0.5F);
|
||||
}
|
||||
|
||||
public void K() {
|
||||
this.av = -1;
|
||||
this.au = true;
|
||||
}
|
||||
|
||||
public void h(Entity entity) {
|
||||
int i = this.inventory.a(entity);
|
||||
|
||||
if (i > 0) {
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damageDone = i;
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()){
|
||||
return;
|
||||
}
|
||||
|
||||
entity.a(this, event.getDamage());
|
||||
} else {
|
||||
entity.a(this, i);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
ItemStack itemstack = this.P();
|
||||
|
||||
if (itemstack != null && entity instanceof EntityLiving) {
|
||||
itemstack.a((EntityLiving) entity);
|
||||
if (itemstack.count <= 0) {
|
||||
itemstack.a(this);
|
||||
this.Q();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void q() {
|
||||
super.q();
|
||||
this.defaultContainer.a(this);
|
||||
if (this.activeContainer != null) {
|
||||
this.activeContainer.a(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||
@ -11,34 +9,31 @@ public class EntityItem extends Entity {
|
||||
|
||||
public ItemStack a;
|
||||
private int e;
|
||||
public int b;
|
||||
public int b = 0;
|
||||
public int c;
|
||||
private int f;
|
||||
public float d;
|
||||
private int f = 5;
|
||||
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
|
||||
|
||||
public EntityItem(World world, double d1, double d2, double d3, ItemStack itemstack) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
a(d1, d2, d3);
|
||||
a = itemstack;
|
||||
v = (float) (Math.random() * 360D);
|
||||
s = (float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D);
|
||||
t = 0.20000000298023224D;
|
||||
u = (float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D);
|
||||
M = false;
|
||||
|
||||
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
|
||||
super(world);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.a(d0, d1, d2);
|
||||
this.a = itemstack;
|
||||
this.yaw = (float) (Math.random() * 360.0D);
|
||||
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
this.M = false;
|
||||
}
|
||||
|
||||
public EntityItem(World world) {
|
||||
super(world);
|
||||
b = 0;
|
||||
f = 5;
|
||||
d = (float) (Math.random() * 3.1415926535897931D * 2D);
|
||||
a(0.25F, 0.25F);
|
||||
H = J / 2.0F;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.height = this.width / 2.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftItem(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -47,152 +42,167 @@ public class EntityItem extends Entity {
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (c > 0) {
|
||||
c--;
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
m = p;
|
||||
n = q;
|
||||
o = r;
|
||||
t -= 0.039999999105930328D;
|
||||
if (l.c(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) == Material.g) {
|
||||
t = 0.20000000298023224D;
|
||||
s = (W.nextFloat() - W.nextFloat()) * 0.2F;
|
||||
u = (W.nextFloat() - W.nextFloat()) * 0.2F;
|
||||
l.a(((Entity) (this)), "random.fizz", 0.4F, 2.0F + W.nextFloat() * 0.4F);
|
||||
}
|
||||
g(p, q, r);
|
||||
c(s, t, u);
|
||||
float f1 = 0.98F;
|
||||
|
||||
if (A) {
|
||||
f1 = 0.5880001F;
|
||||
int i = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r));
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
if (this.world.getMaterial(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) == Material.LAVA) {
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.world.a(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
|
||||
this.g(this.locX, this.locY, this.locZ);
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
float f = 0.98F;
|
||||
|
||||
if (this.onGround) {
|
||||
f = 0.58800006F;
|
||||
int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ));
|
||||
|
||||
if (i > 0) {
|
||||
f1 = Block.m[i].bu * 0.98F;
|
||||
f = Block.byId[i].frictionFactor * 0.98F;
|
||||
}
|
||||
}
|
||||
s *= f1;
|
||||
t *= 0.98000001907348633D;
|
||||
u *= f1;
|
||||
if (A) {
|
||||
t *= -0.5D;
|
||||
|
||||
this.motX *= (double) f;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= (double) f;
|
||||
if (this.onGround) {
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
e++;
|
||||
b++;
|
||||
if (b >= 6000) {
|
||||
q();
|
||||
|
||||
++this.e;
|
||||
++this.b;
|
||||
if (this.b >= 6000) {
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean v() {
|
||||
return l.a(z, Material.f, ((Entity) (this)));
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
}
|
||||
|
||||
private boolean g(double d1, double d2, double d3) {
|
||||
int i = MathHelper.b(d1);
|
||||
int j = MathHelper.b(d2);
|
||||
int k = MathHelper.b(d3);
|
||||
double d4 = d1 - (double) i;
|
||||
double d5 = d2 - (double) j;
|
||||
double d6 = d3 - (double) k;
|
||||
private boolean g(double d0, double d1, double d2) {
|
||||
int i = MathHelper.b(d0);
|
||||
int j = MathHelper.b(d1);
|
||||
int k = MathHelper.b(d2);
|
||||
double d3 = d0 - (double) i;
|
||||
double d4 = d1 - (double) j;
|
||||
double d5 = d2 - (double) k;
|
||||
|
||||
if (Block.o[l.a(i, j, k)]) {
|
||||
boolean flag = !Block.o[l.a(i - 1, j, k)];
|
||||
boolean flag1 = !Block.o[l.a(i + 1, j, k)];
|
||||
boolean flag2 = !Block.o[l.a(i, j - 1, k)];
|
||||
boolean flag3 = !Block.o[l.a(i, j + 1, k)];
|
||||
boolean flag4 = !Block.o[l.a(i, j, k - 1)];
|
||||
boolean flag5 = !Block.o[l.a(i, j, k + 1)];
|
||||
byte byte0 = -1;
|
||||
double d7 = 9999D;
|
||||
if (Block.o[this.world.getTypeId(i, j, k)]) {
|
||||
boolean flag = !Block.o[this.world.getTypeId(i - 1, j, k)];
|
||||
boolean flag1 = !Block.o[this.world.getTypeId(i + 1, j, k)];
|
||||
boolean flag2 = !Block.o[this.world.getTypeId(i, j - 1, k)];
|
||||
boolean flag3 = !Block.o[this.world.getTypeId(i, j + 1, k)];
|
||||
boolean flag4 = !Block.o[this.world.getTypeId(i, j, k - 1)];
|
||||
boolean flag5 = !Block.o[this.world.getTypeId(i, j, k + 1)];
|
||||
byte b0 = -1;
|
||||
double d6 = 9999.0D;
|
||||
|
||||
if (flag && d4 < d7) {
|
||||
d7 = d4;
|
||||
byte0 = 0;
|
||||
if (flag && d3 < d6) {
|
||||
d6 = d3;
|
||||
b0 = 0;
|
||||
}
|
||||
if (flag1 && 1.0D - d4 < d7) {
|
||||
d7 = 1.0D - d4;
|
||||
byte0 = 1;
|
||||
}
|
||||
if (flag2 && d5 < d7) {
|
||||
d7 = d5;
|
||||
byte0 = 2;
|
||||
}
|
||||
if (flag3 && 1.0D - d5 < d7) {
|
||||
d7 = 1.0D - d5;
|
||||
byte0 = 3;
|
||||
}
|
||||
if (flag4 && d6 < d7) {
|
||||
d7 = d6;
|
||||
byte0 = 4;
|
||||
}
|
||||
if (flag5 && 1.0D - d6 < d7) {
|
||||
double d8 = 1.0D - d6;
|
||||
|
||||
byte0 = 5;
|
||||
if (flag1 && 1.0D - d3 < d6) {
|
||||
d6 = 1.0D - d3;
|
||||
b0 = 1;
|
||||
}
|
||||
float f1 = W.nextFloat() * 0.2F + 0.1F;
|
||||
|
||||
if (byte0 == 0) {
|
||||
s = -f1;
|
||||
if (flag2 && d4 < d6) {
|
||||
d6 = d4;
|
||||
b0 = 2;
|
||||
}
|
||||
if (byte0 == 1) {
|
||||
s = f1;
|
||||
|
||||
if (flag3 && 1.0D - d4 < d6) {
|
||||
d6 = 1.0D - d4;
|
||||
b0 = 3;
|
||||
}
|
||||
if (byte0 == 2) {
|
||||
t = -f1;
|
||||
|
||||
if (flag4 && d5 < d6) {
|
||||
d6 = d5;
|
||||
b0 = 4;
|
||||
}
|
||||
if (byte0 == 3) {
|
||||
t = f1;
|
||||
|
||||
if (flag5 && 1.0D - d5 < d6) {
|
||||
d6 = 1.0D - d5;
|
||||
b0 = 5;
|
||||
}
|
||||
if (byte0 == 4) {
|
||||
u = -f1;
|
||||
|
||||
float f = this.random.nextFloat() * 0.2F + 0.1F;
|
||||
|
||||
if (b0 == 0) {
|
||||
this.motX = (double) (-f);
|
||||
}
|
||||
if (byte0 == 5) {
|
||||
u = f1;
|
||||
|
||||
if (b0 == 1) {
|
||||
this.motX = (double) f;
|
||||
}
|
||||
|
||||
if (b0 == 2) {
|
||||
this.motY = (double) (-f);
|
||||
}
|
||||
|
||||
if (b0 == 3) {
|
||||
this.motY = (double) f;
|
||||
}
|
||||
|
||||
if (b0 == 4) {
|
||||
this.motZ = (double) (-f);
|
||||
}
|
||||
|
||||
if (b0 == 5) {
|
||||
this.motZ = (double) f;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b(int i) {
|
||||
a(((Entity) (null)), i);
|
||||
this.a((Entity) null, i);
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
y();
|
||||
f -= i;
|
||||
if (f <= 0) {
|
||||
q();
|
||||
this.y();
|
||||
this.f -= i;
|
||||
if (this.f <= 0) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Health", (short) f);
|
||||
nbttagcompound.a("Age", (short) b);
|
||||
nbttagcompound.a("Item", a.a(new NBTTagCompound()));
|
||||
nbttagcompound.a("Health", (short) ((byte) this.f));
|
||||
nbttagcompound.a("Age", (short) this.b);
|
||||
nbttagcompound.a("Item", this.a.a(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
f = nbttagcompound.c("Health") & 0xff;
|
||||
b = ((int) (nbttagcompound.c("Age")));
|
||||
this.f = nbttagcompound.c("Health") & 255;
|
||||
this.b = nbttagcompound.c("Age");
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item");
|
||||
|
||||
a = new ItemStack(nbttagcompound1);
|
||||
this.a = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (l.z) {
|
||||
return;
|
||||
}
|
||||
int i = a.a;
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
int i = this.a.count;
|
||||
|
||||
if (c == 0 && entityplayer.an.a(a)) {
|
||||
l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityplayer.c(((Entity) (this)), i);
|
||||
q();
|
||||
if (this.c == 0 && entityhuman.inventory.a(this.a)) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, i);
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EntityList {
|
||||
|
||||
private static Map a = new HashMap();
|
||||
private static Map b = new HashMap();
|
||||
private static Map c = new HashMap();
|
||||
private static Map d = new HashMap();
|
||||
|
||||
public EntityList() {}
|
||||
|
||||
private static void a(Class class1, String s, int i) {
|
||||
a.put(((s)), ((class1)));
|
||||
b.put(((class1)), ((s)));
|
||||
c.put(((Integer.valueOf(i))), ((class1)));
|
||||
d.put(((class1)), ((Integer.valueOf(i))));
|
||||
}
|
||||
|
||||
public static Entity a(String s, World world) {
|
||||
Entity entity = null;
|
||||
|
||||
try {
|
||||
Class class1 = (Class) a.get(((s)));
|
||||
|
||||
if (class1 != null) {
|
||||
entity = (Entity) class1.getConstructor(new Class[] {
|
||||
net.minecraft.server.World.class
|
||||
}).newInstance(new Object[] {
|
||||
world
|
||||
});
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Entity a(NBTTagCompound nbttagcompound, World world) {
|
||||
Entity entity = null;
|
||||
|
||||
try {
|
||||
Class class1 = (Class) a.get(((nbttagcompound.h("id"))));
|
||||
|
||||
if (class1 != null) {
|
||||
entity = (Entity) class1.getConstructor(new Class[] {
|
||||
net.minecraft.server.World.class
|
||||
}).newInstance(new Object[] {
|
||||
world
|
||||
});
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
if (entity != null) {
|
||||
entity.e(nbttagcompound);
|
||||
} else {
|
||||
System.out.println((new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.h("id")).toString());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static int a(Entity entity) {
|
||||
return ((Integer) d.get(((((entity)).getClass())))).intValue();
|
||||
}
|
||||
|
||||
public static String b(Entity entity) {
|
||||
return (String) b.get(((((entity)).getClass())));
|
||||
}
|
||||
|
||||
static {
|
||||
a(net.minecraft.server.EntityArrow.class, "Arrow", 10);
|
||||
a(net.minecraft.server.EntitySnowball.class, "Snowball", 11);
|
||||
a(net.minecraft.server.EntityItem.class, "Item", 1);
|
||||
a(net.minecraft.server.EntityPainting.class, "Painting", 9);
|
||||
a(net.minecraft.server.EntityLiving.class, "Mob", 48);
|
||||
a(net.minecraft.server.EntityMobs.class, "Monster", 49);
|
||||
a(net.minecraft.server.EntityCreeper.class, "Creeper", 50);
|
||||
a(net.minecraft.server.EntitySkeleton.class, "Skeleton", 51);
|
||||
a(net.minecraft.server.EntitySpider.class, "Spider", 52);
|
||||
a(net.minecraft.server.EntityZombieSimple.class, "Giant", 53);
|
||||
a(net.minecraft.server.EntityZombie.class, "Zombie", 54);
|
||||
a(net.minecraft.server.EntitySlime.class, "Slime", 55);
|
||||
a(net.minecraft.server.EntityGhast.class, "Ghast", 56);
|
||||
a(net.minecraft.server.EntityPigZombie.class, "PigZombie", 57);
|
||||
a(net.minecraft.server.EntityPig.class, "Pig", 90);
|
||||
a(net.minecraft.server.EntitySheep.class, "Sheep", 91);
|
||||
a(net.minecraft.server.EntityCow.class, "Cow", 92);
|
||||
a(net.minecraft.server.EntityChicken.class, "Chicken", 93);
|
||||
a(net.minecraft.server.EntitySquid.class, "Squid", 94);
|
||||
a(net.minecraft.server.EntityTNTPrimed.class, "PrimedTnt", 20);
|
||||
a(net.minecraft.server.EntityFallingSand.class, "FallingSand", 21);
|
||||
a(net.minecraft.server.EntityMinecart.class, "Minecart", 40);
|
||||
a(net.minecraft.server.EntityBoat.class, "Boat", 41);
|
||||
}
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,135 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftMonster;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityMobs extends EntityCreature implements IMobs {
|
||||
|
||||
protected int c;
|
||||
|
||||
public EntityMobs(World world) {
|
||||
super(world);
|
||||
c = 2;
|
||||
aZ = 20;
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftMonster(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void o() {
|
||||
float f = b(1.0F);
|
||||
|
||||
if (f > 0.5F) {
|
||||
bw += 2;
|
||||
}
|
||||
super.o();
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (l.k == 0) {
|
||||
q();
|
||||
}
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
EntityPlayer entityplayer = l.a(((Entity) (this)), 16D);
|
||||
|
||||
if (entityplayer != null && i(((Entity) (entityplayer)))) {
|
||||
return ((Entity) (entityplayer));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (super.a(entity, i)) {
|
||||
if (j == entity || k == entity) {
|
||||
return true;
|
||||
}
|
||||
if (entity != this) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if(entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
if ((double) f < 2.5D && entity.z.e > z.b && entity.z.b < z.e) {
|
||||
bf = 20;
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damageDone = c;
|
||||
|
||||
EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbee);
|
||||
|
||||
if (!edbee.isCancelled()){
|
||||
entity.a(((Entity) (this)), edbee.getDamage());
|
||||
}
|
||||
} else {
|
||||
entity.a(((Entity) (this)), c);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
protected float a(int i, int j, int k) {
|
||||
return 0.5F - l.l(i, j, k);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
int i = MathHelper.b(p);
|
||||
int j = MathHelper.b(z.b);
|
||||
int k = MathHelper.b(r);
|
||||
|
||||
if (l.a(EnumSkyBlock.a, i, j, k) > W.nextInt(32)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = l.j(i, j, k);
|
||||
|
||||
return i1 <= W.nextInt(8) && super.b();
|
||||
}
|
||||
}
|
||||
}
|
132
src/main/java/net/minecraft/server/EntityMonster.java
Normale Datei
132
src/main/java/net/minecraft/server/EntityMonster.java
Normale Datei
@ -0,0 +1,132 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftMonster;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityMonster extends EntityCreature implements IMonster {
|
||||
|
||||
protected int c = 2;
|
||||
|
||||
public EntityMonster(World world) {
|
||||
super(world);
|
||||
this.health = 20;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftMonster(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void o() {
|
||||
float f = this.b(1.0F);
|
||||
|
||||
if (f > 0.5F) {
|
||||
this.bw += 2;
|
||||
}
|
||||
|
||||
super.o();
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (this.world.k == 0) {
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
EntityHuman entityhuman = this.world.a(this, 16.0D);
|
||||
|
||||
return entityhuman != null && this.i(entityhuman) ? entityhuman : null;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (super.a(entity, i)) {
|
||||
if (this.passenger != entity && this.vehicle != entity) {
|
||||
if (entity != this) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
if ((double) f < 2.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
||||
this.attackTicks = 20;
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damageDone = this.c;
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()){
|
||||
entity.a(this, event.getDamage());
|
||||
}
|
||||
} else {
|
||||
entity.a(this, this.c);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
protected float a(int i, int j, int k) {
|
||||
return 0.5F - this.world.l(i, j, k);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.b(this.boundingBox.b);
|
||||
int k = MathHelper.b(this.locZ);
|
||||
|
||||
if (this.world.a(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
|
||||
return false;
|
||||
} else {
|
||||
int l = this.world.j(i, j, k);
|
||||
|
||||
return l <= this.random.nextInt(8) && super.b();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -18,158 +19,175 @@ public class EntityPainting extends Entity {
|
||||
|
||||
public EntityPainting(World world) {
|
||||
super(world);
|
||||
f = 0;
|
||||
a = 0;
|
||||
H = 0.0F;
|
||||
a(0.5F, 0.5F);
|
||||
this.f = 0;
|
||||
this.a = 0;
|
||||
this.height = 0.0F;
|
||||
this.a(0.5F, 0.5F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftPainting(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityPainting(World world, int i, int j, int k, int l) {
|
||||
this(world);
|
||||
b = i;
|
||||
c = j;
|
||||
d = k;
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
this.d = k;
|
||||
ArrayList arraylist = new ArrayList();
|
||||
EnumArt aenumart[] = EnumArt.values();
|
||||
EnumArt[] aenumart = EnumArt.values();
|
||||
int i1 = aenumart.length;
|
||||
|
||||
for (int j1 = 0; j1 < i1; j1++) {
|
||||
for (int j1 = 0; j1 < i1; ++j1) {
|
||||
EnumArt enumart = aenumart[j1];
|
||||
|
||||
e = enumart;
|
||||
a(l);
|
||||
if (d()) {
|
||||
((List) (arraylist)).add(((enumart)));
|
||||
this.e = enumart;
|
||||
this.a(l);
|
||||
if (this.d()) {
|
||||
arraylist.add(enumart);
|
||||
}
|
||||
}
|
||||
|
||||
if (((List) (arraylist)).size() > 0) {
|
||||
e = (EnumArt) ((List) (arraylist)).get(W.nextInt(((List) (arraylist)).size()));
|
||||
if (arraylist.size() > 0) {
|
||||
this.e = (EnumArt) arraylist.get(this.random.nextInt(arraylist.size()));
|
||||
}
|
||||
a(l);
|
||||
|
||||
this.a(l);
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void a(int i) {
|
||||
a = i;
|
||||
x = v = i * 90;
|
||||
float f1 = e.A;
|
||||
float f2 = e.B;
|
||||
float f3 = e.A;
|
||||
this.a = i;
|
||||
this.lastYaw = this.yaw = (float) (i * 90);
|
||||
float f = (float) this.e.A;
|
||||
float f1 = (float) this.e.B;
|
||||
float f2 = (float) this.e.A;
|
||||
|
||||
if (i == 0 || i == 2) {
|
||||
f3 = 0.5F;
|
||||
if (i != 0 && i != 2) {
|
||||
f = 0.5F;
|
||||
} else {
|
||||
f1 = 0.5F;
|
||||
f2 = 0.5F;
|
||||
}
|
||||
f1 /= 32F;
|
||||
f2 /= 32F;
|
||||
f3 /= 32F;
|
||||
float f4 = (float) b + 0.5F;
|
||||
float f5 = (float) c + 0.5F;
|
||||
float f6 = (float) d + 0.5F;
|
||||
float f7 = 0.5625F;
|
||||
|
||||
f /= 32.0F;
|
||||
f1 /= 32.0F;
|
||||
f2 /= 32.0F;
|
||||
float f3 = (float) this.b + 0.5F;
|
||||
float f4 = (float) this.c + 0.5F;
|
||||
float f5 = (float) this.d + 0.5F;
|
||||
float f6 = 0.5625F;
|
||||
|
||||
if (i == 0) {
|
||||
f6 -= f7;
|
||||
f5 -= f6;
|
||||
}
|
||||
if (i == 1) {
|
||||
f4 -= f7;
|
||||
}
|
||||
if (i == 2) {
|
||||
f6 += f7;
|
||||
}
|
||||
if (i == 3) {
|
||||
f4 += f7;
|
||||
}
|
||||
if (i == 0) {
|
||||
f4 -= d(e.A);
|
||||
}
|
||||
if (i == 1) {
|
||||
f6 += d(e.A);
|
||||
}
|
||||
if (i == 2) {
|
||||
f4 += d(e.A);
|
||||
}
|
||||
if (i == 3) {
|
||||
f6 -= d(e.A);
|
||||
}
|
||||
f5 += d(e.B);
|
||||
a((double)f4, (double)f5, (double)f6); // CraftBukkit -- forcecast all arguments to double
|
||||
float f8 = -0.00625F;
|
||||
|
||||
z.c(f4 - f1 - f8, f5 - f2 - f8, f6 - f3 - f8, f4 + f1 + f8, f5 + f2 + f8, f6 + f3 + f8);
|
||||
if (i == 1) {
|
||||
f3 -= f6;
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
f5 += f6;
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
f3 += f6;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
f3 -= this.d(this.e.A);
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
f5 += this.d(this.e.A);
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
f3 += this.d(this.e.A);
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
f5 -= this.d(this.e.A);
|
||||
}
|
||||
|
||||
f4 += this.d(this.e.B);
|
||||
this.a((double) f3, (double) f4, (double) f5);
|
||||
float f7 = -0.00625F;
|
||||
|
||||
this.boundingBox.c((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
|
||||
}
|
||||
|
||||
private float d(int i) {
|
||||
if (i == 32) {
|
||||
return 0.5F;
|
||||
}
|
||||
return i != 64 ? 0.0F : 0.5F;
|
||||
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
if (f++ == 100 && !l.z) {
|
||||
f = 0;
|
||||
if (!d()) {
|
||||
q();
|
||||
l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq)))));
|
||||
if (this.f++ == 100 && !this.world.isStatic) {
|
||||
this.f = 0;
|
||||
if (!this.d()) {
|
||||
this.q();
|
||||
this.world.a((Entity) (new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
if (this.l.a(((Entity) (this)), z).size() > 0) {
|
||||
if (this.world.a((Entity) this, this.boundingBox).size() > 0) {
|
||||
return false;
|
||||
}
|
||||
int i = e.A / 16;
|
||||
int j = e.B / 16;
|
||||
int k = b;
|
||||
int l = c;
|
||||
int i1 = d;
|
||||
} else {
|
||||
int i = this.e.A / 16;
|
||||
int j = this.e.B / 16;
|
||||
int k = this.b;
|
||||
int l = this.c;
|
||||
int i1 = this.d;
|
||||
|
||||
if (a == 0) {
|
||||
k = MathHelper.b(p - (double) ((float) e.A / 32F));
|
||||
}
|
||||
if (a == 1) {
|
||||
i1 = MathHelper.b(r - (double) ((float) e.A / 32F));
|
||||
}
|
||||
if (a == 2) {
|
||||
k = MathHelper.b(p - (double) ((float) e.A / 32F));
|
||||
}
|
||||
if (a == 3) {
|
||||
i1 = MathHelper.b(r - (double) ((float) e.A / 32F));
|
||||
}
|
||||
l = MathHelper.b(q - (double) ((float) e.B / 32F));
|
||||
for (int j1 = 0; j1 < i; j1++) {
|
||||
for (int k1 = 0; k1 < j; k1++) {
|
||||
Material material;
|
||||
if (this.a == 0) {
|
||||
k = MathHelper.b(this.locX - (double) ((float) this.e.A / 32.0F));
|
||||
}
|
||||
|
||||
if (a == 0 || a == 2) {
|
||||
material = this.l.c(k + j1, l + k1, d);
|
||||
} else {
|
||||
material = this.l.c(b, l + k1, i1 + j1);
|
||||
if (this.a == 1) {
|
||||
i1 = MathHelper.b(this.locZ - (double) ((float) this.e.A / 32.0F));
|
||||
}
|
||||
|
||||
if (this.a == 2) {
|
||||
k = MathHelper.b(this.locX - (double) ((float) this.e.A / 32.0F));
|
||||
}
|
||||
|
||||
if (this.a == 3) {
|
||||
i1 = MathHelper.b(this.locZ - (double) ((float) this.e.A / 32.0F));
|
||||
}
|
||||
|
||||
l = MathHelper.b(this.locY - (double) ((float) this.e.B / 32.0F));
|
||||
|
||||
int j1;
|
||||
|
||||
for (int k1 = 0; k1 < i; ++k1) {
|
||||
for (j1 = 0; j1 < j; ++j1) {
|
||||
Material material;
|
||||
|
||||
if (this.a != 0 && this.a != 2) {
|
||||
material = this.world.getMaterial(this.b, l + j1, i1 + k1);
|
||||
} else {
|
||||
material = this.world.getMaterial(k + k1, l + j1, this.d);
|
||||
}
|
||||
|
||||
if (!material.isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!material.a()) {
|
||||
}
|
||||
|
||||
List list = this.world.b((Entity) this, this.boundingBox);
|
||||
|
||||
for (j1 = 0; j1 < list.size(); ++j1) {
|
||||
if (list.get(j1) instanceof EntityPainting) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
List list = this.l.b(((Entity) (this)), z);
|
||||
|
||||
for (int l1 = 0; l1 < list.size(); l1++) {
|
||||
if (list.get(l1) instanceof EntityPainting) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
@ -177,42 +195,44 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (!G && !l.z) {
|
||||
q();
|
||||
y();
|
||||
l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq)))));
|
||||
if (!this.dead && !this.world.isStatic) {
|
||||
this.q();
|
||||
this.y();
|
||||
this.world.a((Entity) (new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Dir", (byte) a);
|
||||
nbttagcompound.a("Motive", e.z);
|
||||
nbttagcompound.a("TileX", b);
|
||||
nbttagcompound.a("TileY", c);
|
||||
nbttagcompound.a("TileZ", d);
|
||||
nbttagcompound.a("Dir", (byte) this.a);
|
||||
nbttagcompound.a("Motive", this.e.z);
|
||||
nbttagcompound.a("TileX", this.b);
|
||||
nbttagcompound.a("TileY", this.c);
|
||||
nbttagcompound.a("TileZ", this.d);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
a = ((int) (nbttagcompound.b("Dir")));
|
||||
b = nbttagcompound.d("TileX");
|
||||
c = nbttagcompound.d("TileY");
|
||||
d = nbttagcompound.d("TileZ");
|
||||
this.a = nbttagcompound.b("Dir");
|
||||
this.b = nbttagcompound.d("TileX");
|
||||
this.c = nbttagcompound.d("TileY");
|
||||
this.d = nbttagcompound.d("TileZ");
|
||||
String s = nbttagcompound.h("Motive");
|
||||
EnumArt aenumart[] = EnumArt.values();
|
||||
EnumArt[] aenumart = EnumArt.values();
|
||||
int i = aenumart.length;
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EnumArt enumart = aenumart[j];
|
||||
|
||||
if (enumart.z.equals(((s)))) {
|
||||
e = enumart;
|
||||
if (enumart.z.equals(s)) {
|
||||
this.e = enumart;
|
||||
}
|
||||
}
|
||||
|
||||
if (e == null) {
|
||||
e = EnumArt.a;
|
||||
if (this.e == null) {
|
||||
this.e = EnumArt.KEBAB;
|
||||
}
|
||||
a(a);
|
||||
|
||||
this.a(this.a);
|
||||
}
|
||||
}
|
||||
|
@ -5,30 +5,31 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftPig;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityPig extends EntityAnimals {
|
||||
public class EntityPig extends EntityAnimal {
|
||||
|
||||
public EntityPig(World world) {
|
||||
super(world);
|
||||
aP = "/mob/pig.png";
|
||||
a(0.9F, 0.9F);
|
||||
this.texture = "/mob/pig.png";
|
||||
this.a(0.9F, 0.9F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftPig(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
af.a(16, ((Byte.valueOf((byte) 0))));
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Saddle", K());
|
||||
nbttagcompound.a("Saddle", this.K());
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
a(nbttagcompound.l("Saddle"));
|
||||
this.a(nbttagcompound.l("Saddle"));
|
||||
}
|
||||
|
||||
protected String e() {
|
||||
@ -43,9 +44,9 @@ public class EntityPig extends EntityAnimals {
|
||||
return "mob.pigdeath";
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
if (K() && !l.z && (j == null || j == entityplayer)) {
|
||||
entityplayer.e(((Entity) (this)));
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
if (this.K() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
|
||||
entityhuman.e(this);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -53,18 +54,18 @@ public class EntityPig extends EntityAnimals {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.ao.ba;
|
||||
return Item.PORK.id;
|
||||
}
|
||||
|
||||
public boolean K() {
|
||||
return (af.a(16) & 1) != 0;
|
||||
return (this.datawatcher.a(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
if (flag) {
|
||||
af.b(16, ((Byte.valueOf((byte) 1))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) 1));
|
||||
} else {
|
||||
af.b(16, ((Byte.valueOf((byte) 0))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -13,52 +12,48 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
|
||||
public class EntityPigZombie extends EntityZombie {
|
||||
|
||||
private int a;
|
||||
private int b;
|
||||
private static final ItemStack f;
|
||||
private int a = 0;
|
||||
private int b = 0;
|
||||
private static final ItemStack f = new ItemStack(Item.GOLD_SWORD, 1);
|
||||
|
||||
public EntityPigZombie(World world) {
|
||||
super(world);
|
||||
a = 0;
|
||||
b = 0;
|
||||
aP = "/mob/pigzombie.png";
|
||||
bC = 0.5F;
|
||||
c = 5;
|
||||
ae = true;
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.c = 5;
|
||||
this.ae = true;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftPigZombie(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
bC = d == null ? 0.5F : 0.95F;
|
||||
if (b > 0 && --b == 0) {
|
||||
l.a(((Entity) (this)), "mob.zombiepig.zpigangry", i() * 2.0F, ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
this.bC = this.d != null ? 0.95F : 0.5F;
|
||||
if (this.b > 0 && --this.b == 0) {
|
||||
this.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
}
|
||||
|
||||
super.b_();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return l.k > 0 && l.a(z) && l.a(((Entity) (this)), z).size() == 0 && !l.b(z);
|
||||
return this.world.k > 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) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Anger", (short) a);
|
||||
nbttagcompound.a("Anger", (short) this.a);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
a = ((int) (nbttagcompound.c("Anger")));
|
||||
this.a = nbttagcompound.c("Anger");
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
if (a == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return super.l();
|
||||
}
|
||||
return this.a == 0 ? null : super.l();
|
||||
}
|
||||
|
||||
public void o() {
|
||||
@ -66,10 +61,10 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
List list = l.b(((Entity) (this)), z.b(32D, 32D, 32D));
|
||||
if (entity instanceof EntityHuman) {
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D));
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1 instanceof EntityPigZombie) {
|
||||
@ -79,27 +74,28 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
}
|
||||
|
||||
g(entity);
|
||||
this.g(entity);
|
||||
}
|
||||
|
||||
return super.a(entity, i);
|
||||
}
|
||||
|
||||
private void g(Entity entity) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
d = null;
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
a = 400 + W.nextInt(400);
|
||||
b = W.nextInt(40);
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.a = 400 + this.random.nextInt(400);
|
||||
this.b = this.random.nextInt(40);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -118,10 +114,6 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.ap.ba;
|
||||
}
|
||||
|
||||
static {
|
||||
f = new ItemStack(Item.E, 1);
|
||||
return Item.GRILLED_PORK.id;
|
||||
}
|
||||
}
|
||||
|
@ -1,383 +1,288 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityPlayer extends EntityLiving {
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public InventoryPlayer an;
|
||||
public CraftingInventoryCB ao;
|
||||
public CraftingInventoryCB ap;
|
||||
public byte aq;
|
||||
public int ar;
|
||||
public float as;
|
||||
public float at;
|
||||
public boolean au;
|
||||
public int av;
|
||||
public String aw;
|
||||
public int ax;
|
||||
public double ay;
|
||||
public double az;
|
||||
public double aA;
|
||||
public double aB;
|
||||
public double aC;
|
||||
public double aD;
|
||||
private int a;
|
||||
public EntityFish aE;
|
||||
public NetServerHandler a;
|
||||
public MinecraftServer b;
|
||||
public ItemInWorldManager c;
|
||||
public double d;
|
||||
public double e;
|
||||
public List f = new LinkedList();
|
||||
public Set ak = new HashSet();
|
||||
public double al;
|
||||
private int bD = -99999999;
|
||||
private int bE = 60;
|
||||
private ItemStack[] bF = new ItemStack[] { null, null, null, null, null};
|
||||
private int bG = 0;
|
||||
public boolean am;
|
||||
|
||||
public EntityPlayer(World world) {
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
an = new InventoryPlayer(this);
|
||||
aq = 0;
|
||||
ar = 0;
|
||||
au = false;
|
||||
av = 0;
|
||||
a = 0;
|
||||
aE = null;
|
||||
ao = ((CraftingInventoryCB) (new CraftingInventoryPlayerCB(an, !world.z)));
|
||||
ap = ao;
|
||||
H = 1.62F;
|
||||
c((double) world.m + 0.5D, world.n + 1, (double) world.o + 0.5D, 0.0F, 0.0F);
|
||||
aZ = 20;
|
||||
aS = "humanoid";
|
||||
aR = 180F;
|
||||
Y = 20;
|
||||
aP = "/mob/char.png";
|
||||
int i = world.spawnX;
|
||||
int j = world.spawnZ;
|
||||
int k = world.spawnY;
|
||||
|
||||
if (!world.q.e) {
|
||||
i += this.random.nextInt(20) - 10;
|
||||
k = world.e(i, j);
|
||||
j += this.random.nextInt(20) - 10;
|
||||
}
|
||||
|
||||
this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
|
||||
this.b = minecraftserver;
|
||||
this.S = 0.0F;
|
||||
iteminworldmanager.a = this;
|
||||
this.name = s;
|
||||
this.c = iteminworldmanager;
|
||||
this.height = 0.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftHumanEntity(server, this);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftPlayer(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void l() {
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public ItemStack[] I() {
|
||||
return this.bF;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (!l.z && ap != null && !ap.b(this)) {
|
||||
L();
|
||||
ap = ao;
|
||||
}
|
||||
ay = aB;
|
||||
az = aC;
|
||||
aA = aD;
|
||||
double d1 = p - aB;
|
||||
double d2 = q - aC;
|
||||
double d3 = r - aD;
|
||||
double d4 = 10D;
|
||||
--this.bE;
|
||||
this.activeContainer.a();
|
||||
|
||||
if (d1 > d4) {
|
||||
ay = aB = p;
|
||||
}
|
||||
if (d3 > d4) {
|
||||
aA = aD = r;
|
||||
}
|
||||
if (d2 > d4) {
|
||||
az = aC = q;
|
||||
}
|
||||
if (d1 < -d4) {
|
||||
ay = aB = p;
|
||||
}
|
||||
if (d3 < -d4) {
|
||||
aA = aD = r;
|
||||
}
|
||||
if (d2 < -d4) {
|
||||
az = aC = q;
|
||||
}
|
||||
aB += d1 * 0.25D;
|
||||
aD += d3 * 0.25D;
|
||||
aC += d2 * 0.25D;
|
||||
}
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
ItemStack itemstack = this.a(i);
|
||||
|
||||
protected void L() {
|
||||
ap = ao;
|
||||
}
|
||||
|
||||
public void D() {
|
||||
super.D();
|
||||
as = at;
|
||||
at = 0.0F;
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
if (au) {
|
||||
av++;
|
||||
if (av == 8) {
|
||||
av = 0;
|
||||
au = false;
|
||||
}
|
||||
} else {
|
||||
av = 0;
|
||||
}
|
||||
aY = (float) av / 8F;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (l.k == 0 && aZ < 20 && (X % 20) * 12 == 0) {
|
||||
d(1);
|
||||
}
|
||||
an.f();
|
||||
as = at;
|
||||
super.o();
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
float f2 = (float) Math.atan(-t * 0.20000000298023224D) * 15F;
|
||||
|
||||
if (f1 > 0.1F) {
|
||||
f1 = 0.1F;
|
||||
}
|
||||
if (!A || aZ <= 0) {
|
||||
f1 = 0.0F;
|
||||
}
|
||||
if (A || aZ <= 0) {
|
||||
f2 = 0.0F;
|
||||
}
|
||||
at += (f1 - at) * 0.4F;
|
||||
bh += (f2 - bh) * 0.8F;
|
||||
if (aZ > 0) {
|
||||
List list = l.b(((Entity) (this)), z.b(1.0D, 0.0D, 1.0D));
|
||||
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (!entity.G) {
|
||||
j(entity);
|
||||
}
|
||||
}
|
||||
if (itemstack != this.bF[i]) {
|
||||
this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.bF[i] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void j(Entity entity) {
|
||||
entity.b(this);
|
||||
public ItemStack a(int i) {
|
||||
return i == 0 ? this.inventory.e() : this.inventory.b[i - 1];
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
super.f(entity);
|
||||
a(0.2F, 0.2F);
|
||||
a(p, q, r);
|
||||
t = 0.10000000149011612D;
|
||||
if (aw.equals("Notch")) {
|
||||
a(new ItemStack(Item.h, 1), true);
|
||||
}
|
||||
an.h();
|
||||
if (entity != null) {
|
||||
s = -MathHelper.b(((bd + v) * 3.141593F) / 180F) * 0.1F;
|
||||
u = -MathHelper.a(((bd + v) * 3.141593F) / 180F) * 0.1F;
|
||||
} else {
|
||||
s = u = 0.0D;
|
||||
}
|
||||
H = 0.1F;
|
||||
}
|
||||
|
||||
public void b(Entity entity, int i) {
|
||||
ar += i;
|
||||
}
|
||||
|
||||
public void O() {
|
||||
a(an.b(an.c, 1), false);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
a(itemstack, false);
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, boolean flag) {
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
EntityItem entityitem = new EntityItem(l, p, (q - 0.30000001192092896D) + (double) w(), r, itemstack);
|
||||
|
||||
entityitem.c = 40;
|
||||
float f1 = 0.1F;
|
||||
|
||||
if (flag) {
|
||||
float f3 = W.nextFloat() * 0.5F;
|
||||
float f5 = W.nextFloat() * 3.141593F * 2.0F;
|
||||
|
||||
entityitem.s = -MathHelper.a(f5) * f3;
|
||||
entityitem.u = MathHelper.b(f5) * f3;
|
||||
entityitem.t = 0.20000000298023224D;
|
||||
} else {
|
||||
float f2 = 0.3F;
|
||||
|
||||
entityitem.s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f2;
|
||||
entityitem.u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f2;
|
||||
entityitem.t = -MathHelper.a((w / 180F) * 3.141593F) * f2 + 0.1F;
|
||||
f2 = 0.02F;
|
||||
float f4 = W.nextFloat() * 3.141593F * 2.0F;
|
||||
|
||||
f2 *= W.nextFloat();
|
||||
entityitem.s += Math.cos(f4) * (double) f2;
|
||||
entityitem.t += (W.nextFloat() - W.nextFloat()) * 0.1F;
|
||||
entityitem.u += Math.sin(f4) * (double) f2;
|
||||
}
|
||||
a(entityitem);
|
||||
}
|
||||
|
||||
protected void a(EntityItem entityitem) {
|
||||
l.a(((Entity) (entityitem)));
|
||||
}
|
||||
|
||||
public float a(Block block) {
|
||||
float f1 = an.a(block);
|
||||
|
||||
if (a(Material.f)) {
|
||||
f1 /= 5F;
|
||||
}
|
||||
if (!A) {
|
||||
f1 /= 5F;
|
||||
}
|
||||
return f1;
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
return an.b(block);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Inventory");
|
||||
|
||||
an.b(nbttaglist);
|
||||
ax = nbttagcompound.d("Dimension");
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Inventory", ((NBTBase) (an.a(new NBTTagList()))));
|
||||
nbttagcompound.a("Dimension", ax);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {}
|
||||
|
||||
public void a(int i, int k, int l) {}
|
||||
|
||||
public void c(Entity entity, int i) {}
|
||||
|
||||
public float w() {
|
||||
return 0.12F;
|
||||
this.inventory.h();
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
bw = 0;
|
||||
if (aZ <= 0) {
|
||||
return false;
|
||||
}
|
||||
if ((entity instanceof EntityMobs) || (entity instanceof EntityArrow)) {
|
||||
if (l.k == 0) {
|
||||
i = 0;
|
||||
}
|
||||
if (l.k == 1) {
|
||||
i = i / 3 + 1;
|
||||
}
|
||||
if (l.k == 3) {
|
||||
i = (i * 3) / 2;
|
||||
}
|
||||
}
|
||||
if (i == 0) {
|
||||
if (this.bE > 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (!this.b.n) {
|
||||
if (entity instanceof EntityHuman) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityArrow) {
|
||||
EntityArrow entityarrow = (EntityArrow) entity;
|
||||
|
||||
if (entityarrow.b instanceof EntityHuman) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.a(entity, i);
|
||||
}
|
||||
}
|
||||
|
||||
protected void e(int i) {
|
||||
int k = 25 - an.g();
|
||||
int l = i * k + a;
|
||||
|
||||
an.c(i);
|
||||
i = l / 25;
|
||||
a = l % 25;
|
||||
super.e(i);
|
||||
public void d(int i) {
|
||||
super.d(i);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {}
|
||||
public void n() {
|
||||
super.b_();
|
||||
ChunkCoordIntPair chunkcoordintpair = null;
|
||||
double d0 = 0.0D;
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {}
|
||||
for (int i = 0; i < this.f.size(); ++i) {
|
||||
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.f.get(i);
|
||||
double d1 = chunkcoordintpair1.a(this);
|
||||
|
||||
public void a(TileEntitySign tileentitysign) {}
|
||||
|
||||
public void g(Entity entity) {
|
||||
if (entity.a(this)) {
|
||||
return;
|
||||
if (i == 0 || d1 < d0) {
|
||||
chunkcoordintpair = chunkcoordintpair1;
|
||||
d0 = chunkcoordintpair1.a(this);
|
||||
}
|
||||
}
|
||||
ItemStack itemstack = P();
|
||||
|
||||
if (itemstack != null && (entity instanceof EntityLiving)) {
|
||||
itemstack.b((EntityLiving) entity);
|
||||
if (itemstack.a <= 0) {
|
||||
itemstack.a(this);
|
||||
Q();
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag = false;
|
||||
|
||||
if (d0 < 1024.0D) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (this.a.b() < 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.f.remove(chunkcoordintpair);
|
||||
this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.b.e)));
|
||||
List list = this.b.e.d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16);
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
this.a((TileEntity) list.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.health != this.bD) {
|
||||
this.a.b((Packet) (new Packet8UpdateHealth(this.health)));
|
||||
this.bD = this.health;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.g();
|
||||
|
||||
if (packet != null) {
|
||||
this.a.b(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack P() {
|
||||
return an.e();
|
||||
public void o() {
|
||||
this.motX = this.motY = this.motZ = 0.0D;
|
||||
this.bA = false;
|
||||
super.o();
|
||||
}
|
||||
|
||||
public void Q() {
|
||||
an.a(an.c, ((ItemStack) (null)));
|
||||
}
|
||||
public void c(Entity entity, int i) {
|
||||
if (!entity.dead) {
|
||||
if (entity instanceof EntityItem) {
|
||||
this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
|
||||
}
|
||||
|
||||
public double F() {
|
||||
return (double) (H - 0.5F);
|
||||
if (entity instanceof EntityArrow) {
|
||||
this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
|
||||
}
|
||||
}
|
||||
|
||||
super.c(entity, i);
|
||||
this.activeContainer.a();
|
||||
}
|
||||
|
||||
public void K() {
|
||||
av = -1;
|
||||
au = true;
|
||||
if (!this.au) {
|
||||
this.av = -1;
|
||||
this.au = true;
|
||||
this.b.k.a(this, new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void h(Entity entity) {
|
||||
int i = an.a(entity);
|
||||
public float w() {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damageDone = i;
|
||||
|
||||
EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbee);
|
||||
public void e(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
}
|
||||
|
||||
if (!edbee.isCancelled()){
|
||||
entity.a(((Entity) this), edbee.getDamage());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
entity.a(((Entity) (this)), i);
|
||||
}
|
||||
// CraftBukkit end
|
||||
ItemStack itemstack = P();
|
||||
public void setPassengerOf(Entity entity) {
|
||||
// e(null) doesn't really fly for overloaded methods,
|
||||
// so this method is needed
|
||||
|
||||
if (itemstack != null && (entity instanceof EntityLiving)) {
|
||||
itemstack.a((EntityLiving) entity);
|
||||
if (itemstack.a <= 0) {
|
||||
itemstack.a(this);
|
||||
Q();
|
||||
}
|
||||
super.setPassengerOf(entity);
|
||||
// CraftBukkit end
|
||||
this.a.b((Packet) (new Packet39AttachEntity(this, this.vehicle)));
|
||||
this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
protected void a(double d0, boolean flag) {}
|
||||
|
||||
public void b(double d0, boolean flag) {
|
||||
super.a(d0, flag);
|
||||
}
|
||||
|
||||
private void U() {
|
||||
this.bG = this.bG % 100 + 1;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 1, "Crafting", 9)));
|
||||
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 0, iinventory.b(), iinventory.h_())));
|
||||
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 2, tileentityfurnace.b(), tileentityfurnace.h_())));
|
||||
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 3, tileentitydispenser.b(), tileentitydispenser.h_())));
|
||||
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(Container container, int i, ItemStack itemstack) {
|
||||
if (!(container.a(i) instanceof SlotResult)) {
|
||||
if (!this.am) {
|
||||
this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Container container, List list) {
|
||||
this.a.b((Packet) (new Packet104WindowItems(container.f, list)));
|
||||
this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i())));
|
||||
}
|
||||
|
||||
public void a(Container container, int i, int j) {
|
||||
this.a.b((Packet) (new Packet105CraftProgressBar(container.f, i, j)));
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void q() {
|
||||
super.q();
|
||||
ao.a(this);
|
||||
if (ap != null) {
|
||||
ap.a(this);
|
||||
public void L() {
|
||||
this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f)));
|
||||
this.N();
|
||||
}
|
||||
|
||||
public void M() {
|
||||
if (!this.am) {
|
||||
this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i())));
|
||||
}
|
||||
}
|
||||
|
||||
public void N() {
|
||||
this.activeContainer.a((EntityHuman) this);
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
}
|
||||
|
@ -1,292 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
||||
|
||||
public NetServerHandler a;
|
||||
public MinecraftServer b;
|
||||
public ItemInWorldManager c;
|
||||
public double d;
|
||||
public double e;
|
||||
public List f;
|
||||
public Set ak;
|
||||
public double al;
|
||||
private int bD;
|
||||
private int bE;
|
||||
private ItemStack bF[] = {
|
||||
null, null, null, null, null
|
||||
};
|
||||
private int bG;
|
||||
public boolean am;
|
||||
|
||||
public EntityPlayerMP(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
f = ((List) (new LinkedList()));
|
||||
ak = ((Set) (new HashSet()));
|
||||
bD = 0xfa0a1f01;
|
||||
bE = 60;
|
||||
bG = 0;
|
||||
int i = world.m;
|
||||
int j = world.o;
|
||||
int k = world.n;
|
||||
|
||||
if (!world.q.e) {
|
||||
i += W.nextInt(20) - 10;
|
||||
k = world.e(i, j);
|
||||
j += W.nextInt(20) - 10;
|
||||
}
|
||||
c((double) i + 0.5D, k, (double) j + 0.5D, 0.0F, 0.0F);
|
||||
b = minecraftserver;
|
||||
S = 0.0F;
|
||||
iteminworldmanager.a = ((EntityPlayer) (this));
|
||||
aw = s;
|
||||
c = iteminworldmanager;
|
||||
H = 0.0F;
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftPlayer(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void l() {
|
||||
ap.a(((ICrafting) (this)));
|
||||
}
|
||||
|
||||
public ItemStack[] I() {
|
||||
return bF;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
bE--;
|
||||
ap.a();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ItemStack itemstack = a(i);
|
||||
|
||||
if (itemstack != bF[i]) {
|
||||
b.k.a(((Entity) (this)), ((Packet) (new Packet5PlayerInventory(g, i, itemstack))));
|
||||
bF[i] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
if (i == 0) {
|
||||
return an.e();
|
||||
} else {
|
||||
return an.b[i - 1];
|
||||
}
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
an.h();
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (bE > 0) {
|
||||
return false;
|
||||
}
|
||||
if (!b.n) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof EntityArrow) {
|
||||
EntityArrow entityarrow = (EntityArrow) entity;
|
||||
|
||||
if (entityarrow.b instanceof EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.a(entity, i);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
super.d(i);
|
||||
}
|
||||
|
||||
public void n() {
|
||||
super.b_();
|
||||
ChunkCoordIntPair chunkcoordintpair = null;
|
||||
double d1 = 0.0D;
|
||||
|
||||
for (int i = 0; i < f.size(); i++) {
|
||||
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) f.get(i);
|
||||
double d2 = chunkcoordintpair1.a(((Entity) (this)));
|
||||
|
||||
if (i == 0 || d2 < d1) {
|
||||
chunkcoordintpair = chunkcoordintpair1;
|
||||
d1 = chunkcoordintpair1.a(((Entity) (this)));
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag = false;
|
||||
|
||||
if (d1 < 1024D) {
|
||||
flag = true;
|
||||
}
|
||||
if (a.b() < 2) {
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
f.remove(((chunkcoordintpair)));
|
||||
a.b(((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, ((World) (b.e))))));
|
||||
List list = b.e.d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16);
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
a((TileEntity) list.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aZ != bD) {
|
||||
a.b(((Packet) (new Packet8(aZ))));
|
||||
bD = aZ;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.g();
|
||||
|
||||
if (packet != null) {
|
||||
a.b(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void o() {
|
||||
s = t = u = 0.0D;
|
||||
bA = false;
|
||||
super.o();
|
||||
}
|
||||
|
||||
public void c(Entity entity, int i) {
|
||||
if (!entity.G) {
|
||||
if (entity instanceof EntityItem) {
|
||||
b.k.a(entity, ((Packet) (new Packet22Collect(entity.g, g))));
|
||||
}
|
||||
if (entity instanceof EntityArrow) {
|
||||
b.k.a(entity, ((Packet) (new Packet22Collect(entity.g, g))));
|
||||
}
|
||||
}
|
||||
super.c(entity, i);
|
||||
ap.a();
|
||||
}
|
||||
|
||||
public void K() {
|
||||
if (!au) {
|
||||
av = -1;
|
||||
au = true;
|
||||
b.k.a(((Entity) (this)), ((Packet) (new Packet18ArmAnimation(((Entity) (this)), 1))));
|
||||
}
|
||||
}
|
||||
|
||||
public float w() {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
public void e(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
}
|
||||
|
||||
public void setPassengerOf(Entity entity) {
|
||||
// e(null) doesn't really fly for overloaded methods,
|
||||
// so this method is needed
|
||||
|
||||
// CraftBukkit end
|
||||
super.setPassengerOf(entity);
|
||||
a.b(((Packet) (new Packet39(((Entity) (this)), k))));
|
||||
a.a(p, q, r, v, w);
|
||||
}
|
||||
|
||||
protected void a(double d1, boolean flag) {}
|
||||
|
||||
public void b(double d1, boolean flag) {
|
||||
super.a(d1, flag);
|
||||
}
|
||||
|
||||
private void U() {
|
||||
bG = bG % 100 + 1;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
U();
|
||||
a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9))));
|
||||
ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k)));
|
||||
ap.f = bG;
|
||||
ap.a(((ICrafting) (this)));
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
U();
|
||||
a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_()))));
|
||||
ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory)));
|
||||
ap.f = bG;
|
||||
ap.a(((ICrafting) (this)));
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {
|
||||
U();
|
||||
a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))));
|
||||
ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace)));
|
||||
ap.f = bG;
|
||||
ap.a(((ICrafting) (this)));
|
||||
}
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {
|
||||
U();
|
||||
a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))));
|
||||
ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser)));
|
||||
ap.f = bG;
|
||||
ap.a(((ICrafting) (this)));
|
||||
}
|
||||
|
||||
public void a(CraftingInventoryCB craftinginventorycb, int i, ItemStack itemstack) {
|
||||
if (craftinginventorycb.a(i) instanceof SlotCrafting) {
|
||||
return;
|
||||
}
|
||||
if (am) {
|
||||
return;
|
||||
} else {
|
||||
a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(CraftingInventoryCB craftinginventorycb, List list) {
|
||||
a.b(((Packet) (new Packet104(craftinginventorycb.f, list))));
|
||||
a.b(((Packet) (new Packet103(-1, -1, an.i()))));
|
||||
}
|
||||
|
||||
public void a(CraftingInventoryCB craftinginventorycb, int i, int j) {
|
||||
a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j))));
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void L() {
|
||||
a.b(((Packet) (new Packet101(ap.f))));
|
||||
N();
|
||||
}
|
||||
|
||||
public void M() {
|
||||
if (am) {
|
||||
return;
|
||||
} else {
|
||||
a.b(((Packet) (new Packet103(-1, -1, an.i()))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void N() {
|
||||
ap.a(((EntityPlayer) (this)));
|
||||
ap = ao;
|
||||
}
|
||||
}
|
@ -7,85 +7,53 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftSheep;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySheep extends EntityAnimals {
|
||||
public class EntitySheep extends EntityAnimal {
|
||||
|
||||
public static final float a[][] = {
|
||||
{
|
||||
1.0F, 1.0F, 1.0F
|
||||
}, {
|
||||
0.95F, 0.7F, 0.2F
|
||||
}, {
|
||||
0.9F, 0.5F, 0.85F
|
||||
}, {
|
||||
0.6F, 0.7F, 0.95F
|
||||
}, {
|
||||
0.9F, 0.9F, 0.2F
|
||||
}, {
|
||||
0.5F, 0.8F, 0.1F
|
||||
}, {
|
||||
0.95F, 0.7F, 0.8F
|
||||
}, {
|
||||
0.3F, 0.3F, 0.3F
|
||||
}, {
|
||||
0.6F, 0.6F, 0.6F
|
||||
}, {
|
||||
0.3F, 0.6F, 0.7F
|
||||
}, {
|
||||
0.7F, 0.4F, 0.9F
|
||||
}, {
|
||||
0.2F, 0.4F, 0.8F
|
||||
}, {
|
||||
0.5F, 0.4F, 0.3F
|
||||
}, {
|
||||
0.4F, 0.5F, 0.2F
|
||||
}, {
|
||||
0.8F, 0.3F, 0.3F
|
||||
}, {
|
||||
0.1F, 0.1F, 0.1F
|
||||
}
|
||||
};
|
||||
public static final float[][] a = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}};
|
||||
|
||||
public EntitySheep(World world) {
|
||||
super(world);
|
||||
aP = "/mob/sheep.png";
|
||||
a(0.9F, 1.3F);
|
||||
this.texture = "/mob/sheep.png";
|
||||
this.a(0.9F, 1.3F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSheep(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
super.a();
|
||||
af.a(16, ((new Byte((byte) 0))));
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (!l.z && !f_() && (entity instanceof EntityLiving)) {
|
||||
a(true);
|
||||
int j = 1 + W.nextInt(3);
|
||||
if (!this.world.isStatic && !this.f_() && entity instanceof EntityLiving) {
|
||||
this.a(true);
|
||||
int j = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int k = 0; k < j; k++) {
|
||||
EntityItem entityitem = a(new ItemStack(Block.ab.bi, 1, e_()), 1.0F);
|
||||
for (int k = 0; k < j; ++k) {
|
||||
EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.e_()), 1.0F);
|
||||
|
||||
entityitem.t += W.nextFloat() * 0.05F;
|
||||
entityitem.s += (W.nextFloat() - W.nextFloat()) * 0.1F;
|
||||
entityitem.u += (W.nextFloat() - W.nextFloat()) * 0.1F;
|
||||
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
|
||||
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
|
||||
entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
|
||||
}
|
||||
}
|
||||
|
||||
return super.a(entity, i);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Sheared", f_());
|
||||
nbttagcompound.a("Color", (byte) e_());
|
||||
nbttagcompound.a("Sheared", this.f_());
|
||||
nbttagcompound.a("Color", (byte) this.e_());
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
a(nbttagcompound.l("Sheared"));
|
||||
a(((int) (nbttagcompound.b("Color"))));
|
||||
this.a(nbttagcompound.l("Sheared"));
|
||||
this.a(nbttagcompound.b("Color"));
|
||||
}
|
||||
|
||||
protected String e() {
|
||||
@ -101,38 +69,32 @@ public class EntitySheep extends EntityAnimals {
|
||||
}
|
||||
|
||||
public int e_() {
|
||||
return af.a(16) & 0xf;
|
||||
return this.datawatcher.a(16) & 15;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
byte byte0 = af.a(16);
|
||||
byte b0 = this.datawatcher.a(16);
|
||||
|
||||
af.b(16, ((Byte.valueOf((byte) (byte0 & 0xf0 | i & 0xf)))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & 240 | i & 15)));
|
||||
}
|
||||
|
||||
public boolean f_() {
|
||||
return (af.a(16) & 0x10) != 0;
|
||||
return (this.datawatcher.a(16) & 16) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
byte byte0 = af.a(16);
|
||||
byte b0 = this.datawatcher.a(16);
|
||||
|
||||
if (flag) {
|
||||
af.b(16, ((Byte.valueOf((byte) (byte0 | 0x10)))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 16)));
|
||||
} else {
|
||||
af.b(16, ((Byte.valueOf((byte) (byte0 & 0xffffffef)))));
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -17)));
|
||||
}
|
||||
}
|
||||
|
||||
public static int a(Random random) {
|
||||
int i = random.nextInt(100);
|
||||
|
||||
if (i < 5) {
|
||||
return 15;
|
||||
}
|
||||
if (i < 10) {
|
||||
return 7;
|
||||
}
|
||||
return i >= 15 ? 0 : 8;
|
||||
return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : 0));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftSkeleton;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -9,15 +7,16 @@ import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySkeleton extends EntityMobs {
|
||||
public class EntitySkeleton extends EntityMonster {
|
||||
|
||||
private static final ItemStack a;
|
||||
private static final ItemStack a = new ItemStack(Item.BOW, 1);
|
||||
|
||||
public EntitySkeleton(World world) {
|
||||
super(world);
|
||||
aP = "/mob/skeleton.png";
|
||||
this.texture = "/mob/skeleton.png";
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSkeleton(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -35,44 +34,46 @@ public class EntitySkeleton extends EntityMobs {
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (l.b()) {
|
||||
float f1 = b(1.0F);
|
||||
if (this.world.b()) {
|
||||
float f = this.b(1.0F);
|
||||
|
||||
if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 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
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.ENTITY_COMBUST;
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
EntityCombustEvent event = new EntityCombustEvent(eventType, entity);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
Z = 300;
|
||||
this.fireTicks = 300;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.o();
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f1) {
|
||||
if (f1 < 10F) {
|
||||
double d = entity.p - p;
|
||||
double d1 = entity.r - r;
|
||||
protected void a(Entity entity, float f) {
|
||||
if (f < 10.0F) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
|
||||
if (bf == 0) {
|
||||
EntityArrow entityarrow = new EntityArrow(l, ((EntityLiving) (this)));
|
||||
if (this.attackTicks == 0) {
|
||||
EntityArrow entityarrow = new EntityArrow(this.world, this);
|
||||
|
||||
entityarrow.q += 1.3999999761581421D;
|
||||
double d2 = entity.q - 0.20000000298023224D - entityarrow.q;
|
||||
float f2 = MathHelper.a(d * d + d1 * d1) * 0.2F;
|
||||
++entityarrow.locY;
|
||||
double d2 = entity.locY - 0.20000000298023224D - entityarrow.locY;
|
||||
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
|
||||
|
||||
l.a(((Entity) (this)), "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F));
|
||||
l.a(((Entity) (entityarrow)));
|
||||
entityarrow.a(d, d2 + (double) f2, d1, 0.6F, 12F);
|
||||
bf = 30;
|
||||
this.world.a(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
|
||||
this.world.a((Entity) entityarrow);
|
||||
entityarrow.a(d0, d2 + (double) f1, d1, 0.6F, 12.0F);
|
||||
this.attackTicks = 30;
|
||||
}
|
||||
v = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F;
|
||||
e = true;
|
||||
|
||||
this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
this.e = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,23 +86,22 @@ public class EntitySkeleton extends EntityMobs {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.j.ba;
|
||||
return Item.ARROW.id;
|
||||
}
|
||||
|
||||
protected void g_() {
|
||||
int i = W.nextInt(3);
|
||||
int i = this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
a(Item.j.ba, 1);
|
||||
int j;
|
||||
|
||||
for (j = 0; j < i; ++j) {
|
||||
this.a(Item.ARROW.id, 1);
|
||||
}
|
||||
|
||||
i = W.nextInt(3);
|
||||
for (int k = 0; k < i; k++) {
|
||||
a(Item.aV.ba, 1);
|
||||
}
|
||||
}
|
||||
i = this.random.nextInt(3);
|
||||
|
||||
static {
|
||||
a = new ItemStack(Item.i, 1);
|
||||
for (j = 0; j < i; ++j) {
|
||||
this.a(Item.BONE.id, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,118 +1,122 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftSlime;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntitySlime extends EntityLiving implements IMobs {
|
||||
public class EntitySlime extends EntityLiving implements IMonster {
|
||||
|
||||
public float a;
|
||||
public float b;
|
||||
private int d;
|
||||
public int c;
|
||||
private int d = 0;
|
||||
public int c = 1;
|
||||
|
||||
public EntitySlime(World world) {
|
||||
super(world);
|
||||
d = 0;
|
||||
c = 1;
|
||||
aP = "/mob/slime.png";
|
||||
c = 1 << W.nextInt(3);
|
||||
H = 0.0F;
|
||||
d = W.nextInt(20) + 10;
|
||||
a(c);
|
||||
this.texture = "/mob/slime.png";
|
||||
this.c = 1 << this.random.nextInt(3);
|
||||
this.height = 0.0F;
|
||||
this.d = this.random.nextInt(20) + 10;
|
||||
this.a(this.c);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSlime(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void a(int j) {
|
||||
c = j;
|
||||
a(0.6F * (float) j, 0.6F * (float) j);
|
||||
aZ = j * j;
|
||||
a(p, q, r);
|
||||
public void a(int i) {
|
||||
this.c = i;
|
||||
this.a(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.health = i * i;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Size", c - 1);
|
||||
nbttagcompound.a("Size", this.c - 1);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
c = nbttagcompound.d("Size") + 1;
|
||||
this.c = nbttagcompound.d("Size") + 1;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
b = a;
|
||||
boolean flag = A;
|
||||
this.b = this.a;
|
||||
boolean flag = this.onGround;
|
||||
|
||||
super.b_();
|
||||
if (A && !flag) {
|
||||
for (int j = 0; j < c * 8; j++) {
|
||||
float f1 = W.nextFloat() * 3.141593F * 2.0F;
|
||||
float f2 = W.nextFloat() * 0.5F + 0.5F;
|
||||
float f3 = MathHelper.a(f1) * (float) c * 0.5F * f2;
|
||||
float f4 = MathHelper.b(f1) * (float) c * 0.5F * f2;
|
||||
if (this.onGround && !flag) {
|
||||
for (int i = 0; i < this.c * 8; ++i) {
|
||||
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
|
||||
float f1 = this.random.nextFloat() * 0.5F + 0.5F;
|
||||
float f2 = MathHelper.a(f) * (float) this.c * 0.5F * f1;
|
||||
float f3 = MathHelper.b(f) * (float) this.c * 0.5F * f1;
|
||||
|
||||
l.a("slime", p + (double) f3, z.b, r + (double) f4, 0.0D, 0.0D, 0.0D);
|
||||
this.world.a("slime", this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (c > 2) {
|
||||
l.a(((Entity) (this)), "mob.slime", i(), ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
if (this.c > 2) {
|
||||
this.world.a(this, "mob.slime", this.i(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
}
|
||||
a = -0.5F;
|
||||
|
||||
this.a = -0.5F;
|
||||
}
|
||||
a = a * 0.6F;
|
||||
|
||||
this.a *= 0.6F;
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
EntityPlayer entityplayer = l.a(((Entity) (this)), 16D);
|
||||
EntityHuman entityhuman = this.world.a(this, 16.0D);
|
||||
|
||||
if (entityplayer != null) {
|
||||
b(((Entity) (entityplayer)), 10F);
|
||||
if (entityhuman != null) {
|
||||
this.b(entityhuman, 10.0F);
|
||||
}
|
||||
if (A && d-- <= 0) {
|
||||
d = W.nextInt(20) + 10;
|
||||
if (entityplayer != null) {
|
||||
d /= 3;
|
||||
|
||||
if (this.onGround && this.d-- <= 0) {
|
||||
this.d = this.random.nextInt(20) + 10;
|
||||
if (entityhuman != null) {
|
||||
this.d /= 3;
|
||||
}
|
||||
bA = true;
|
||||
if (c > 1) {
|
||||
l.a(((Entity) (this)), "mob.slime", i(), ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
|
||||
this.bA = true;
|
||||
if (this.c > 1) {
|
||||
this.world.a(this, "mob.slime", this.i(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
}
|
||||
a = 1.0F;
|
||||
bx = 1.0F - W.nextFloat() * 2.0F;
|
||||
by = 1 * c;
|
||||
|
||||
this.a = 1.0F;
|
||||
this.bx = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.by = (float) (1 * this.c);
|
||||
} else {
|
||||
bA = false;
|
||||
if (A) {
|
||||
bx = by = 0.0F;
|
||||
this.bA = false;
|
||||
if (this.onGround) {
|
||||
this.bx = this.by = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void q() {
|
||||
if (c > 1 && aZ == 0) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float f1 = (((float) (j % 2) - 0.5F) * (float) c) / 4F;
|
||||
float f2 = (((float) (j / 2) - 0.5F) * (float) c) / 4F;
|
||||
EntitySlime entityslime = new EntitySlime(l);
|
||||
if (this.c > 1 && this.health == 0) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
float f = ((float) (i % 2) - 0.5F) * (float) this.c / 4.0F;
|
||||
float f1 = ((float) (i / 2) - 0.5F) * (float) this.c / 4.0F;
|
||||
EntitySlime entityslime = new EntitySlime(this.world);
|
||||
|
||||
entityslime.a(c / 2);
|
||||
entityslime.c(p + (double) f1, q + 0.5D, r + (double) f2, W.nextFloat() * 360F, 0.0F);
|
||||
l.a(((Entity) (entityslime)));
|
||||
entityslime.a(this.c / 2);
|
||||
entityslime.c(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.world.a((Entity) entityslime);
|
||||
}
|
||||
}
|
||||
|
||||
super.q();
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (c > 1 && i(((Entity) (entityplayer))) && (double) a(((Entity) (entityplayer))) < 0.59999999999999998D * (double) c && entityplayer.a(((Entity) (this)), c)) {
|
||||
l.a(((Entity) (this)), "mob.slimeattack", 1.0F, (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
|
||||
public void b(EntityHuman entityhuman) {
|
||||
// CraftBukkit - add cast to Entity VVVVVVVV
|
||||
if (this.c > 1 && this.i(entityhuman) && (double) this.a((Entity) entityhuman) < 0.6D * (double) this.c && entityhuman.a(this, this.c)) {
|
||||
this.world.a(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,17 +129,13 @@ public class EntitySlime extends EntityLiving implements IMobs {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
if (c == 1) {
|
||||
return Item.aK.ba;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return this.c == 1 ? Item.SLIME_BALL.id : 0;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
Chunk chunk = l.b(MathHelper.b(p), MathHelper.b(r));
|
||||
Chunk chunk = this.world.b(MathHelper.b(this.locX), MathHelper.b(this.locZ));
|
||||
|
||||
return (c == 1 || l.k > 0) && W.nextInt(10) == 0 && chunk.a(0x3ad8025fL).nextInt(10) == 0 && q < 16D;
|
||||
return (this.c == 1 || this.world.k > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 16.0D;
|
||||
}
|
||||
|
||||
protected float i() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -13,28 +12,22 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class EntitySnowball extends Entity {
|
||||
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private boolean f;
|
||||
public int a;
|
||||
private int b = -1;
|
||||
private int c = -1;
|
||||
private int d = -1;
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
private EntityLiving ak;
|
||||
private int al;
|
||||
private int am;
|
||||
private int am = 0;
|
||||
|
||||
public EntitySnowball(World world) {
|
||||
super(world);
|
||||
b = -1;
|
||||
c = -1;
|
||||
d = -1;
|
||||
e = 0;
|
||||
f = false;
|
||||
a = 0;
|
||||
am = 0;
|
||||
a(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSnowball(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -42,117 +35,117 @@ public class EntitySnowball extends Entity {
|
||||
protected void a() {}
|
||||
|
||||
public EntitySnowball(World world, EntityLiving entityliving) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
ak = entityliving;
|
||||
c(entityliving.p, entityliving.q + (double) entityliving.w(), entityliving.r, entityliving.v, entityliving.w);
|
||||
p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F;
|
||||
q -= 0.10000000149011612D;
|
||||
r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F;
|
||||
a(p, q, r);
|
||||
H = 0.0F;
|
||||
float f1 = 0.4F;
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1;
|
||||
t = -MathHelper.a((w / 180F) * 3.141593F) * f1;
|
||||
a(s, t, u, 1.5F, 1.0F);
|
||||
this.ak = entityliving;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
float f = 0.4F;
|
||||
|
||||
this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f);
|
||||
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public EntitySnowball(World world, double d1, double d2, double d3) {
|
||||
// CraftBukkit start
|
||||
this(world);
|
||||
// CraftBukkit end
|
||||
|
||||
al = 0;
|
||||
a(d1, d2, d3);
|
||||
H = 0.0F;
|
||||
public EntitySnowball(World world, double d0, double d1, double d2) {
|
||||
this(world); // CraftBukkit super->this so we assign the entity
|
||||
|
||||
this.al = 0;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.a(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public void a(double d1, double d2, double d3, float f1, float f2) {
|
||||
float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d1 /= f3;
|
||||
d2 /= f3;
|
||||
d3 /= f3;
|
||||
d1 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d2 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d3 += W.nextGaussian() * 0.0074999998323619366D * (double) f2;
|
||||
d1 *= f1;
|
||||
d2 *= f1;
|
||||
d3 *= f1;
|
||||
s = d1;
|
||||
t = d2;
|
||||
u = d3;
|
||||
float f4 = MathHelper.a(d1 * d1 + d3 * d3);
|
||||
d0 /= (double) f2;
|
||||
d1 /= (double) f2;
|
||||
d2 /= (double) f2;
|
||||
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
|
||||
d0 *= (double) f;
|
||||
d1 *= (double) f;
|
||||
d2 *= (double) f;
|
||||
this.motX = d0;
|
||||
this.motY = d1;
|
||||
this.motZ = d2;
|
||||
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
|
||||
|
||||
x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D);
|
||||
y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D);
|
||||
al = 0;
|
||||
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.al = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
O = p;
|
||||
P = q;
|
||||
Q = r;
|
||||
this.O = this.locX;
|
||||
this.P = this.locY;
|
||||
this.Q = this.locZ;
|
||||
super.b_();
|
||||
if (a > 0) {
|
||||
a--;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
if (f) {
|
||||
int i = this.l.a(b, c, d);
|
||||
|
||||
if (i != e) {
|
||||
f = false;
|
||||
s *= W.nextFloat() * 0.2F;
|
||||
t *= W.nextFloat() * 0.2F;
|
||||
u *= W.nextFloat() * 0.2F;
|
||||
al = 0;
|
||||
am = 0;
|
||||
} else {
|
||||
al++;
|
||||
if (al == 1200) {
|
||||
q();
|
||||
if (this.f) {
|
||||
int i = this.world.getTypeId(this.b, this.c, this.d);
|
||||
|
||||
if (i == this.e) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
am++;
|
||||
}
|
||||
Vec3D vec3d = Vec3D.b(p, q, r);
|
||||
Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
MovingObjectPosition movingobjectposition = this.l.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(p, q, r);
|
||||
vec3d1 = Vec3D.b(p + s, q + t, r + u);
|
||||
this.f = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.al = 0;
|
||||
this.am = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
|
||||
}
|
||||
if (!this.l.z) {
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
Entity entity = null;
|
||||
List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
|
||||
double d1 = 0.0D;
|
||||
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
|
||||
for (int k = 0; k < list.size(); k++) {
|
||||
Entity entity1 = (Entity) list.get(k);
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (!entity1.c_() || entity1 == ak && am < 5) {
|
||||
continue;
|
||||
}
|
||||
float f4 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.z.b(f4, f4, f4);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
if (movingobjectposition1 == null) {
|
||||
continue;
|
||||
}
|
||||
double d2 = vec3d.a(movingobjectposition1.f);
|
||||
if (movingobjectposition1 != null) {
|
||||
double d1 = vec3d.a(movingobjectposition1.f);
|
||||
|
||||
if (d2 < d1 || d1 == 0.0D) {
|
||||
entity = entity1;
|
||||
d1 = d2;
|
||||
if (d1 < d0 || d0 == 0.0D) {
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,105 +153,114 @@ public class EntitySnowball extends Entity {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
}
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
// CraftBukkit start
|
||||
if (movingobjectposition.g != null) {
|
||||
// CraftBukkit start
|
||||
boolean bounce;
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
org.bukkit.entity.Entity shooter = (ak == null)?null:ak.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(edbpe);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if(!edbpe.isCancelled()) {
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the snowball should stick or not, i.e. !bounce
|
||||
bounce = !movingobjectposition.g.a(((Entity) (ak)), edbpe.getDamage());
|
||||
stick = movingobjectposition.g.a(this.ak, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the snowball should bounce or not
|
||||
bounce = edbpe.getBounce();
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
bounce = !movingobjectposition.g.a(((Entity) (ak)), 0);
|
||||
stick = movingobjectposition.g.a(this.ak, 0);
|
||||
}
|
||||
if (!bounce) {
|
||||
// CraftBukkit end
|
||||
if (stick) {
|
||||
;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 8; j++) {
|
||||
this.l.a("snowballpoof", p, q, r, 0.0D, 0.0D, 0.0D);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
q();
|
||||
}
|
||||
p += s;
|
||||
q += t;
|
||||
r += u;
|
||||
float f1 = MathHelper.a(s * s + u * u);
|
||||
for (int k = 0; k < 8; ++k) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
|
||||
for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) {
|
||||
this.q();
|
||||
}
|
||||
|
||||
this.locX += this.motX;
|
||||
this.locY += this.motY;
|
||||
this.locZ += this.motZ;
|
||||
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
for (; w - y >= 180F; y += 360F) {
|
||||
;
|
||||
|
||||
while (this.pitch - this.lastPitch >= 180.0F) {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
for (; v - x < -180F; x -= 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw < -180.0F) {
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
for (; v - x >= 180F; x += 360F) {
|
||||
;
|
||||
|
||||
while (this.yaw - this.lastYaw >= 180.0F) {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
w = y + (w - y) * 0.2F;
|
||||
v = x + (v - x) * 0.2F;
|
||||
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.99F;
|
||||
float f5 = 0.03F;
|
||||
float f3 = 0.03F;
|
||||
|
||||
if (v()) {
|
||||
for (int l = 0; l < 4; l++) {
|
||||
float f3 = 0.25F;
|
||||
if (this.v()) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
this.l.a("bubble", p - s * (double) f3, q - t * (double) f3, r - u * (double) f3, s, t, u);
|
||||
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
}
|
||||
s *= f2;
|
||||
t *= f2;
|
||||
u *= f2;
|
||||
t -= f5;
|
||||
a(p, q, r);
|
||||
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
this.motY -= (double) f3;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("xTile", (short) b);
|
||||
nbttagcompound.a("yTile", (short) c);
|
||||
nbttagcompound.a("zTile", (short) d);
|
||||
nbttagcompound.a("inTile", (byte) e);
|
||||
nbttagcompound.a("shake", (byte) a);
|
||||
nbttagcompound.a("inGround", (byte) (f ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.b);
|
||||
nbttagcompound.a("yTile", (short) this.c);
|
||||
nbttagcompound.a("zTile", (short) this.d);
|
||||
nbttagcompound.a("inTile", (byte) this.e);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
b = ((int) (nbttagcompound.c("xTile")));
|
||||
c = ((int) (nbttagcompound.c("yTile")));
|
||||
d = ((int) (nbttagcompound.c("zTile")));
|
||||
e = nbttagcompound.b("inTile") & 0xff;
|
||||
a = nbttagcompound.b("shake") & 0xff;
|
||||
f = nbttagcompound.b("inGround") == 1;
|
||||
this.b = nbttagcompound.c("xTile");
|
||||
this.c = nbttagcompound.c("yTile");
|
||||
this.d = nbttagcompound.c("zTile");
|
||||
this.e = nbttagcompound.b("inTile") & 255;
|
||||
this.a = nbttagcompound.b("shake") & 255;
|
||||
this.f = nbttagcompound.b("inGround") == 1;
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (f && ak == entityplayer && a <= 0 && entityplayer.an.a(new ItemStack(Item.j, 1))) {
|
||||
l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityplayer.c(((Entity) (this)), 1);
|
||||
q();
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
@ -10,30 +8,31 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntitySpider extends EntityMobs {
|
||||
public class EntitySpider extends EntityMonster {
|
||||
|
||||
public EntitySpider(World world) {
|
||||
super(world);
|
||||
aP = "/mob/spider.png";
|
||||
a(1.4F, 0.9F);
|
||||
bC = 0.8F;
|
||||
this.texture = "/mob/spider.png";
|
||||
this.a(1.4F, 0.9F);
|
||||
this.bC = 0.8F;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSpider(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public double k() {
|
||||
return (double) J * 0.75D - 0.5D;
|
||||
return (double) this.width * 0.75D - 0.5D;
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
float f1 = b(1.0F);
|
||||
float f = this.b(1.0F);
|
||||
|
||||
if (f1 < 0.5F) {
|
||||
double d = 16D;
|
||||
if (f < 0.5F) {
|
||||
double d0 = 16.0D;
|
||||
|
||||
return ((Entity) (l.a(((Entity) (this)), d)));
|
||||
return this.world.a(this, d0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -51,16 +50,16 @@ public class EntitySpider extends EntityMobs {
|
||||
return "mob.spiderdeath";
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f1) {
|
||||
float f2 = b(1.0F);
|
||||
protected void a(Entity entity, float f) {
|
||||
float f1 = this.b(1.0F);
|
||||
|
||||
if (f2 > 0.5F && W.nextInt(100) == 0) {
|
||||
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.d = null;
|
||||
} else {
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
@ -68,19 +67,20 @@ public class EntitySpider extends EntityMobs {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
if (f1 > 2.0F && f1 < 6F && W.nextInt(10) == 0) {
|
||||
if (A) {
|
||||
double d = entity.p - p;
|
||||
double d1 = entity.r - r;
|
||||
float f3 = MathHelper.a(d * d + d1 * d1);
|
||||
|
||||
s = (d / (double) f3) * 0.5D * 0.80000001192092896D + s * 0.20000000298023224D;
|
||||
u = (d1 / (double) f3) * 0.5D * 0.80000001192092896D + u * 0.20000000298023224D;
|
||||
t = 0.40000000596046448D;
|
||||
}
|
||||
} else {
|
||||
super.a(entity, f1);
|
||||
if (f > 2.0F && f < 6.0F && this.random.nextInt(10) == 0) {
|
||||
if (this.onGround) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1);
|
||||
|
||||
this.motX = d0 / (double) f2 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
|
||||
this.motZ = d1 / (double) f2 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
|
||||
this.motY = 0.4000000059604645D;
|
||||
}
|
||||
} else {
|
||||
super.a(entity, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,10 +93,10 @@ public class EntitySpider extends EntityMobs {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.I.ba;
|
||||
return Item.STRING.id;
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
return B;
|
||||
return this.B;
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,35 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftSquid;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntitySquid extends EntityWaterMob {
|
||||
public class EntitySquid extends EntityWaterAnimal {
|
||||
|
||||
public float a;
|
||||
public float b;
|
||||
public float c;
|
||||
public float f;
|
||||
public float ak;
|
||||
public float al;
|
||||
public float am;
|
||||
public float an;
|
||||
private float ao;
|
||||
private float ap;
|
||||
private float aq;
|
||||
private float ar;
|
||||
private float as;
|
||||
private float at;
|
||||
public float a = 0.0F;
|
||||
public float b = 0.0F;
|
||||
public float c = 0.0F;
|
||||
public float f = 0.0F;
|
||||
public float ak = 0.0F;
|
||||
public float al = 0.0F;
|
||||
public float am = 0.0F;
|
||||
public float an = 0.0F;
|
||||
private float ao = 0.0F;
|
||||
private float ap = 0.0F;
|
||||
private float aq = 0.0F;
|
||||
private float ar = 0.0F;
|
||||
private float as = 0.0F;
|
||||
private float at = 0.0F;
|
||||
|
||||
public EntitySquid(World world) {
|
||||
super(world);
|
||||
a = 0.0F;
|
||||
b = 0.0F;
|
||||
c = 0.0F;
|
||||
f = 0.0F;
|
||||
ak = 0.0F;
|
||||
al = 0.0F;
|
||||
am = 0.0F;
|
||||
an = 0.0F;
|
||||
ao = 0.0F;
|
||||
ap = 0.0F;
|
||||
aq = 0.0F;
|
||||
ar = 0.0F;
|
||||
as = 0.0F;
|
||||
at = 0.0F;
|
||||
aP = "/mob/squid.png";
|
||||
a(0.95F, 0.95F);
|
||||
ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F;
|
||||
this.texture = "/mob/squid.png";
|
||||
this.a(0.95F, 0.95F);
|
||||
this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftSquid(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -78,18 +63,18 @@ public class EntitySquid extends EntityWaterMob {
|
||||
}
|
||||
|
||||
protected void g_() {
|
||||
int j = W.nextInt(3) + 1;
|
||||
int i = this.random.nextInt(3) + 1;
|
||||
|
||||
for (int k = 0; k < j; k++) {
|
||||
a(new ItemStack(Item.aU, 1, 0), 0.0F);
|
||||
for (int j = 0; j < i; ++j) {
|
||||
this.a(new ItemStack(Item.INK_SACK, 1, 0), 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
ItemStack itemstack = entityplayer.an.e();
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.e();
|
||||
|
||||
if (itemstack != null && itemstack.c == Item.au.ba) {
|
||||
entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE));
|
||||
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
|
||||
entityhuman.inventory.a(entityhuman.inventory.c, new ItemStack(Item.MILK_BUCKET));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -97,72 +82,76 @@ public class EntitySquid extends EntityWaterMob {
|
||||
}
|
||||
|
||||
public boolean v() {
|
||||
return l.a(z.b(0.0D, -0.60000002384185791D, 0.0D), Material.f, ((Entity) (this)));
|
||||
return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
|
||||
}
|
||||
|
||||
public void o() {
|
||||
super.o();
|
||||
b = a;
|
||||
f = c;
|
||||
al = ak;
|
||||
an = am;
|
||||
ak += ap;
|
||||
if (ak > 6.283185F) {
|
||||
ak -= 6.283185F;
|
||||
if (W.nextInt(10) == 0) {
|
||||
ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F;
|
||||
this.b = this.a;
|
||||
this.f = this.c;
|
||||
this.al = this.ak;
|
||||
this.an = this.am;
|
||||
this.ak += this.ap;
|
||||
if (this.ak > 6.2831855F) {
|
||||
this.ak -= 6.2831855F;
|
||||
if (this.random.nextInt(10) == 0) {
|
||||
this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
}
|
||||
if (v()) {
|
||||
if (ak < 3.141593F) {
|
||||
float f1 = ak / 3.141593F;
|
||||
|
||||
am = MathHelper.a(f1 * f1 * 3.141593F) * 3.141593F * 0.25F;
|
||||
if ((double) f1 > 0.75D) {
|
||||
ao = 1.0F;
|
||||
aq = 1.0F;
|
||||
if (this.v()) {
|
||||
float f;
|
||||
|
||||
if (this.ak < 3.1415927F) {
|
||||
f = this.ak / 3.1415927F;
|
||||
this.am = MathHelper.a(f * f * 3.1415927F) * 3.1415927F * 0.25F;
|
||||
if ((double) f > 0.75D) {
|
||||
this.ao = 1.0F;
|
||||
this.aq = 1.0F;
|
||||
} else {
|
||||
aq = aq * 0.8F;
|
||||
this.aq *= 0.8F;
|
||||
}
|
||||
} else {
|
||||
am = 0.0F;
|
||||
ao = ao * 0.9F;
|
||||
aq = aq * 0.99F;
|
||||
this.am = 0.0F;
|
||||
this.ao *= 0.9F;
|
||||
this.aq *= 0.99F;
|
||||
}
|
||||
if (!aW) {
|
||||
s = ar * ao;
|
||||
t = as * ao;
|
||||
u = at * ao;
|
||||
}
|
||||
float f2 = MathHelper.a(s * s + u * u);
|
||||
|
||||
aI += ((-(float) Math.atan2(s, u) * 180F) / 3.141593F - aI) * 0.1F;
|
||||
v = aI;
|
||||
c = c + 3.141593F * aq * 1.5F;
|
||||
a += ((-(float) Math.atan2(f2, t) * 180F) / 3.141593F - a) * 0.1F;
|
||||
} else {
|
||||
am = MathHelper.e(MathHelper.a(ak)) * 3.141593F * 0.25F;
|
||||
if (!aW) {
|
||||
s = 0.0D;
|
||||
t -= 0.080000000000000002D;
|
||||
t *= 0.98000001907348633D;
|
||||
u = 0.0D;
|
||||
if (!this.aW) {
|
||||
this.motX = (double) (this.ar * this.ao);
|
||||
this.motY = (double) (this.as * this.ao);
|
||||
this.motZ = (double) (this.at * this.ao);
|
||||
}
|
||||
a += ((float) ((double) (-90F - a) * 0.02D));
|
||||
|
||||
f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
this.aI += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aI) * 0.1F;
|
||||
this.yaw = this.aI;
|
||||
this.c += 3.1415927F * this.aq * 1.5F;
|
||||
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
|
||||
} else {
|
||||
this.am = MathHelper.e(MathHelper.a(this.ak)) * 3.1415927F * 0.25F;
|
||||
if (!this.aW) {
|
||||
this.motX = 0.0D;
|
||||
this.motY -= 0.08D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(float f1, float f2) {
|
||||
c(s, t, u);
|
||||
public void c(float f, float f1) {
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
if (W.nextInt(50) == 0 || !ab || ar == 0.0F && as == 0.0F && at == 0.0F) {
|
||||
float f1 = W.nextFloat() * 3.141593F * 2.0F;
|
||||
if (this.random.nextInt(50) == 0 || !this.ab || this.ar == 0.0F && this.as == 0.0F && this.at == 0.0F) {
|
||||
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
|
||||
|
||||
ar = MathHelper.b(f1) * 0.2F;
|
||||
as = -0.1F + W.nextFloat() * 0.2F;
|
||||
at = MathHelper.a(f1) * 0.2F;
|
||||
this.ar = MathHelper.b(f) * 0.2F;
|
||||
this.as = -0.1F + this.random.nextFloat() * 0.2F;
|
||||
this.at = MathHelper.a(f) * 0.2F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,70 +11,72 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
a = 0;
|
||||
i = true;
|
||||
a(0.98F, 0.98F);
|
||||
H = J / 2.0F;
|
||||
this.a = 0;
|
||||
this.i = true;
|
||||
this.a(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftTNTPrimed(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityTNTPrimed(World world, double d1, double d2, double d3) {
|
||||
public EntityTNTPrimed(World world, double d0, double d1, double d2) {
|
||||
this(world);
|
||||
a(d1, d2, d3);
|
||||
float f = (float) (Math.random() * 3.1415927410125732D * 2D);
|
||||
this.a(d0, d1, d2);
|
||||
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
|
||||
|
||||
s = -MathHelper.a((f * 3.141593F) / 180F) * 0.02F;
|
||||
t = 0.20000000298023224D;
|
||||
u = -MathHelper.b((f * 3.141593F) / 180F) * 0.02F;
|
||||
M = false;
|
||||
a = 80;
|
||||
m = d1;
|
||||
n = d2;
|
||||
o = d3;
|
||||
this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.M = false;
|
||||
this.a = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public boolean c_() {
|
||||
return !G;
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
m = p;
|
||||
n = q;
|
||||
o = r;
|
||||
t -= 0.039999999105930328D;
|
||||
c(s, t, u);
|
||||
s *= 0.98000001907348633D;
|
||||
t *= 0.98000001907348633D;
|
||||
u *= 0.98000001907348633D;
|
||||
if (A) {
|
||||
s *= 0.69999998807907104D;
|
||||
u *= 0.69999998807907104D;
|
||||
t *= -0.5D;
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
if (a-- <= 0) {
|
||||
q();
|
||||
d();
|
||||
|
||||
if (this.a-- <= 0) {
|
||||
this.q();
|
||||
this.d();
|
||||
} else {
|
||||
l.a("smoke", p, q + 0.5D, r, 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() {
|
||||
float f = 4F;
|
||||
float f = 4.0F;
|
||||
|
||||
l.a(((Entity) (null)), p, q, r, f);
|
||||
this.world.a((Entity) null, this.locX, this.locY, this.locZ, f);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Fuse", (byte) a);
|
||||
nbttagcompound.a("Fuse", (byte) this.a);
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
a = ((int) (nbttagcompound.b("Fuse")));
|
||||
this.a = nbttagcompound.b("Fuse");
|
||||
}
|
||||
}
|
||||
|
@ -1,155 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class EntityTracker {
|
||||
|
||||
private Set a;
|
||||
private MCHashTable b;
|
||||
private MinecraftServer c;
|
||||
private int d;
|
||||
|
||||
public EntityTracker(MinecraftServer minecraftserver) {
|
||||
a = ((Set) (new HashSet()));
|
||||
b = new MCHashTable();
|
||||
c = minecraftserver;
|
||||
d = minecraftserver.f.a();
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
if (entity instanceof EntityPlayerMP) {
|
||||
a(entity, 512, 2);
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) entity;
|
||||
Iterator iterator = a.iterator();
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
break;
|
||||
}
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
|
||||
if (entitytrackerentry.a != entityplayermp) {
|
||||
entitytrackerentry.b(entityplayermp);
|
||||
}
|
||||
} while (true);
|
||||
} else if (entity instanceof EntityFish) {
|
||||
a(entity, 64, 5, true);
|
||||
} else if (entity instanceof EntityArrow) {
|
||||
a(entity, 64, 5, true);
|
||||
} else if (entity instanceof EntitySnowball) {
|
||||
a(entity, 64, 5, true);
|
||||
} else if (entity instanceof EntityEgg) {
|
||||
a(entity, 64, 5, true);
|
||||
} else if (entity instanceof EntityItem) {
|
||||
a(entity, 64, 20, true);
|
||||
} else if (entity instanceof EntityMinecart) {
|
||||
a(entity, 160, 5, true);
|
||||
} else if (entity instanceof EntityBoat) {
|
||||
a(entity, 160, 5, true);
|
||||
} else if (entity instanceof EntitySquid) {
|
||||
a(entity, 160, 3, true);
|
||||
} else if (entity instanceof IAnimals) {
|
||||
a(entity, 160, 3);
|
||||
} else if (entity instanceof EntityTNTPrimed) {
|
||||
a(entity, 160, 10, true);
|
||||
} else if (entity instanceof EntityFallingSand) {
|
||||
a(entity, 160, 20, true);
|
||||
} else if (entity instanceof EntityPainting) {
|
||||
a(entity, 160, 0x7fffffff, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i, int j) {
|
||||
a(entity, i, j, false);
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i, int j, boolean flag) {
|
||||
if (i > d) {
|
||||
i = d;
|
||||
}
|
||||
if (b.b(entity.g)) {
|
||||
throw new IllegalStateException("Entity is already tracked!");
|
||||
} else {
|
||||
EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
|
||||
|
||||
a.add(((entitytrackerentry)));
|
||||
b.a(entity.g, ((entitytrackerentry)));
|
||||
entitytrackerentry.b(c.e.d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
if (entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) entity;
|
||||
EntityTrackerEntry entitytrackerentry1;
|
||||
|
||||
for (Iterator iterator = a.iterator(); iterator.hasNext(); entitytrackerentry1.a(entityplayermp)) {
|
||||
entitytrackerentry1 = (EntityTrackerEntry) iterator.next();
|
||||
}
|
||||
}
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.d(entity.g);
|
||||
|
||||
if (entitytrackerentry != null) {
|
||||
a.remove(((entitytrackerentry)));
|
||||
entitytrackerentry.a();
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = a.iterator();
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
break;
|
||||
}
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
|
||||
entitytrackerentry.a(c.e.d);
|
||||
if (entitytrackerentry.m && (entitytrackerentry.a instanceof EntityPlayerMP)) {
|
||||
((List) (arraylist)).add((((EntityPlayerMP) entitytrackerentry.a)));
|
||||
}
|
||||
} while (true);
|
||||
label0:
|
||||
for (int i = 0; i < ((List) (arraylist)).size(); i++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) ((List) (arraylist)).get(i);
|
||||
Iterator iterator1 = a.iterator();
|
||||
|
||||
do {
|
||||
if (!iterator1.hasNext()) {
|
||||
continue label0;
|
||||
}
|
||||
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
|
||||
|
||||
if (entitytrackerentry1.a != entityplayermp) {
|
||||
entitytrackerentry1.b(entityplayermp);
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Entity entity, Packet packet) {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.a(entity.g);
|
||||
|
||||
if (entitytrackerentry != null) {
|
||||
entitytrackerentry.a(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Entity entity, Packet packet) {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.a(entity.g);
|
||||
|
||||
if (entitytrackerentry != null) {
|
||||
entitytrackerentry.b(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(EntityPlayerMP entityplayermp) {
|
||||
EntityTrackerEntry entitytrackerentry;
|
||||
|
||||
for (Iterator iterator = a.iterator(); iterator.hasNext(); entitytrackerentry.c(entityplayermp)) {
|
||||
entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,252 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class EntityTrackerEntry {
|
||||
|
||||
public Entity a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public int f;
|
||||
public int g;
|
||||
public int h;
|
||||
public double i;
|
||||
public double j;
|
||||
public double k;
|
||||
public int l;
|
||||
private double o;
|
||||
private double p;
|
||||
private double q;
|
||||
private boolean r;
|
||||
private boolean s;
|
||||
public boolean m;
|
||||
public Set n;
|
||||
|
||||
public EntityTrackerEntry(Entity entity, int i1, int j1, boolean flag) {
|
||||
l = 0;
|
||||
r = false;
|
||||
m = false;
|
||||
n = ((Set) (new HashSet()));
|
||||
a = entity;
|
||||
b = i1;
|
||||
c = j1;
|
||||
s = flag;
|
||||
d = MathHelper.b(entity.p * 32D);
|
||||
e = MathHelper.b(entity.q * 32D);
|
||||
f = MathHelper.b(entity.r * 32D);
|
||||
g = MathHelper.d((entity.v * 256F) / 360F);
|
||||
h = MathHelper.d((entity.w * 256F) / 360F);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EntityTrackerEntry) {
|
||||
return ((EntityTrackerEntry) obj).a.g == a.g;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return a.g;
|
||||
}
|
||||
|
||||
public void a(List list) {
|
||||
m = false;
|
||||
if (!r || a.d(o, p, q) > 16D) {
|
||||
o = a.p;
|
||||
p = a.q;
|
||||
q = a.r;
|
||||
r = true;
|
||||
m = true;
|
||||
b(list);
|
||||
}
|
||||
if (++l % c == 0) {
|
||||
int i1 = MathHelper.b(a.p * 32D);
|
||||
int j1 = MathHelper.b(a.q * 32D);
|
||||
int k1 = MathHelper.b(a.r * 32D);
|
||||
int l1 = MathHelper.d((a.v * 256F) / 360F);
|
||||
int i2 = MathHelper.d((a.w * 256F) / 360F);
|
||||
boolean flag = i1 != d || j1 != e || k1 != f;
|
||||
boolean flag1 = l1 != g || i2 != h;
|
||||
int j2 = i1 - d;
|
||||
int k2 = j1 - e;
|
||||
int l2 = k1 - f;
|
||||
Object obj = null;
|
||||
|
||||
if (j2 < -128 || j2 >= 128 || k2 < -128 || k2 >= 128 || l2 < -128 || l2 >= 128) {
|
||||
obj = ((new Packet34EntityTeleport(a.g, i1, j1, k1, (byte) l1, (byte) i2)));
|
||||
} else if (flag && flag1) {
|
||||
obj = ((new Packet33RelEntityMoveLook(a.g, (byte) j2, (byte) k2, (byte) l2, (byte) l1, (byte) i2)));
|
||||
} else if (flag) {
|
||||
obj = ((new Packet31RelEntityMove(a.g, (byte) j2, (byte) k2, (byte) l2)));
|
||||
} else if (flag1) {
|
||||
obj = ((new Packet32EntityLook(a.g, (byte) l1, (byte) i2)));
|
||||
} else {
|
||||
obj = ((new Packet30Entity(a.g)));
|
||||
}
|
||||
if (s) {
|
||||
double d1 = a.s - i;
|
||||
double d2 = a.t - j;
|
||||
double d3 = a.u - k;
|
||||
double d4 = 0.02D;
|
||||
double d5 = d1 * d1 + d2 * d2 + d3 * d3;
|
||||
|
||||
if (d5 > d4 * d4 || d5 > 0.0D && a.s == 0.0D && a.t == 0.0D && a.u == 0.0D) {
|
||||
i = a.s;
|
||||
j = a.t;
|
||||
k = a.u;
|
||||
a(((Packet) (new Packet28(a.g, i, j, k))));
|
||||
}
|
||||
}
|
||||
if (obj != null) {
|
||||
a(((Packet) (obj)));
|
||||
}
|
||||
DataWatcher datawatcher = a.p();
|
||||
|
||||
if (datawatcher.a()) {
|
||||
b(((Packet) (new Packet40(a.g, datawatcher))));
|
||||
}
|
||||
d = i1;
|
||||
e = j1;
|
||||
f = k1;
|
||||
g = l1;
|
||||
h = i2;
|
||||
}
|
||||
if (a.E) {
|
||||
b(((Packet) (new Packet28(a))));
|
||||
a.E = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
EntityPlayerMP entityplayermp;
|
||||
|
||||
for (Iterator iterator = n.iterator(); iterator.hasNext(); entityplayermp.a.b(packet)) {
|
||||
entityplayermp = (EntityPlayerMP) iterator.next();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Packet packet) {
|
||||
a(packet);
|
||||
if (a instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) a).a.b(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
a(((Packet) (new Packet29DestroyEntity(a.g))));
|
||||
}
|
||||
|
||||
public void a(EntityPlayerMP entityplayermp) {
|
||||
if (n.contains(((entityplayermp)))) {
|
||||
n.remove(((entityplayermp)));
|
||||
}
|
||||
}
|
||||
|
||||
public void b(EntityPlayerMP entityplayermp) {
|
||||
if (entityplayermp == a) {
|
||||
return;
|
||||
}
|
||||
double d1 = entityplayermp.p - (double) (d / 32);
|
||||
double d2 = entityplayermp.r - (double) (f / 32);
|
||||
|
||||
if (d1 >= (double) (-b) && d1 <= (double) b && d2 >= (double) (-b) && d2 <= (double) b) {
|
||||
if (!n.contains(((entityplayermp)))) {
|
||||
n.add(((entityplayermp)));
|
||||
entityplayermp.a.b(b());
|
||||
if (s) {
|
||||
entityplayermp.a.b(((Packet) (new Packet28(a.g, a.s, a.t, a.u))));
|
||||
}
|
||||
ItemStack aitemstack[] = a.I();
|
||||
|
||||
if (aitemstack != null) {
|
||||
for (int i1 = 0; i1 < aitemstack.length; i1++) {
|
||||
entityplayermp.a.b(((Packet) (new Packet5PlayerInventory(a.g, i1, aitemstack[i1]))));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (n.contains(((entityplayermp)))) {
|
||||
n.remove(((entityplayermp)));
|
||||
entityplayermp.a.b(((Packet) (new Packet29DestroyEntity(a.g))));
|
||||
}
|
||||
}
|
||||
|
||||
public void b(List list) {
|
||||
for (int i1 = 0; i1 < list.size(); i1++) {
|
||||
b((EntityPlayerMP) list.get(i1));
|
||||
}
|
||||
}
|
||||
|
||||
private Packet b() {
|
||||
if (a instanceof EntityItem) {
|
||||
EntityItem entityitem = (EntityItem) a;
|
||||
Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem);
|
||||
|
||||
entityitem.p = (double) packet21pickupspawn.b / 32D;
|
||||
entityitem.q = (double) packet21pickupspawn.c / 32D;
|
||||
entityitem.r = (double) packet21pickupspawn.d / 32D;
|
||||
return ((Packet) (packet21pickupspawn));
|
||||
}
|
||||
if (a instanceof EntityPlayerMP) {
|
||||
return ((Packet) (new Packet20NamedEntitySpawn((EntityPlayer) a)));
|
||||
}
|
||||
if (a instanceof EntityMinecart) {
|
||||
EntityMinecart entityminecart = (EntityMinecart) a;
|
||||
|
||||
if (entityminecart.d == 0) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 10)));
|
||||
}
|
||||
if (entityminecart.d == 1) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 11)));
|
||||
}
|
||||
if (entityminecart.d == 2) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 12)));
|
||||
}
|
||||
}
|
||||
if (a instanceof EntityBoat) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 1)));
|
||||
}
|
||||
if (a instanceof IAnimals) {
|
||||
return ((Packet) (new Packet24MobSpawn((EntityLiving) a)));
|
||||
}
|
||||
if (a instanceof EntityFish) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 90)));
|
||||
}
|
||||
if (a instanceof EntityArrow) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 60)));
|
||||
}
|
||||
if (a instanceof EntitySnowball) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 61)));
|
||||
}
|
||||
if (a instanceof EntityEgg) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 62)));
|
||||
}
|
||||
if (a instanceof EntityTNTPrimed) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 50)));
|
||||
}
|
||||
if (a instanceof EntityFallingSand) {
|
||||
EntityFallingSand entityfallingsand = (EntityFallingSand) a;
|
||||
|
||||
if (entityfallingsand.a == Block.E.bi) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 70)));
|
||||
}
|
||||
if (entityfallingsand.a == Block.F.bi) {
|
||||
return ((Packet) (new Packet23VehicleSpawn(a, 71)));
|
||||
}
|
||||
}
|
||||
if (a instanceof EntityPainting) {
|
||||
return ((Packet) (new Packet25((EntityPainting) a)));
|
||||
} else {
|
||||
throw new IllegalArgumentException((new StringBuilder()).append("Don't know how to add ").append(((((a)).getClass()))).append("!").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void c(EntityPlayerMP entityplayermp) {
|
||||
if (n.contains(((entityplayermp)))) {
|
||||
n.remove(((entityplayermp)));
|
||||
entityplayermp.a.b(((Packet) (new Packet29DestroyEntity(a.g))));
|
||||
}
|
||||
}
|
||||
}
|
@ -5,12 +5,13 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftWaterMob;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntityWaterMob extends EntityCreature implements IAnimals {
|
||||
public class EntityWaterAnimal extends EntityCreature implements IAnimal {
|
||||
|
||||
public EntityWaterMob(World world) {
|
||||
public EntityWaterAnimal(World world) {
|
||||
super(world);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftWaterMob(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -28,7 +29,7 @@ public class EntityWaterMob extends EntityCreature implements IAnimals {
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return l.a(z);
|
||||
return this.world.a(this.boundingBox);
|
||||
}
|
||||
|
||||
public int c() {
|
@ -7,34 +7,36 @@ import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityZombie extends EntityMobs {
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
public EntityZombie(World world) {
|
||||
super(world);
|
||||
aP = "/mob/zombie.png";
|
||||
bC = 0.5F;
|
||||
c = 5;
|
||||
this.texture = "/mob/zombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.c = 5;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftZombie(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (l.b()) {
|
||||
float f1 = b(1.0F);
|
||||
if (this.world.b()) {
|
||||
float f = this.b(1.0F);
|
||||
|
||||
if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 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
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
Z = 300;
|
||||
this.fireTicks = 300;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.o();
|
||||
}
|
||||
|
||||
@ -51,6 +53,6 @@ public class EntityZombie extends EntityMobs {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.J.ba;
|
||||
return Item.FEATHER.id;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftGiant;
|
||||
// CraftBukkit stop
|
||||
|
||||
public class EntityZombieSimple extends EntityMobs {
|
||||
|
||||
public EntityZombieSimple(World world) {
|
||||
super(world);
|
||||
aP = "/mob/zombie.png";
|
||||
bC = 0.5F;
|
||||
c = 50;
|
||||
aZ *= 10;
|
||||
H *= 6F;
|
||||
a(I * 6F, J * 6F);
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
this.bukkitEntity = new CraftGiant(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float a(int i, int j, int k) {
|
||||
return l.l(i, j, k) - 0.5F;
|
||||
}
|
||||
}
|
@ -1,127 +1,127 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Explosion {
|
||||
|
||||
public boolean a;
|
||||
private Random h;
|
||||
public boolean a = false;
|
||||
private Random h = new Random();
|
||||
private World i;
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
public Entity e;
|
||||
public float f;
|
||||
public Set g;
|
||||
|
||||
public Explosion(World world, Entity entity, double d1, double d2, double d3, float f1) {
|
||||
a = false;
|
||||
h = new Random();
|
||||
g = ((Set) (new HashSet()));
|
||||
i = world;
|
||||
e = entity;
|
||||
f = f1;
|
||||
b = d1;
|
||||
c = d2;
|
||||
d = d3;
|
||||
public Set g = new HashSet();
|
||||
|
||||
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
|
||||
this.i = world;
|
||||
this.e = entity;
|
||||
this.f = f;
|
||||
this.b = d0;
|
||||
this.c = d1;
|
||||
this.d = d2;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
float f1 = f;
|
||||
int j = 16;
|
||||
float f = this.f;
|
||||
byte b0 = 16;
|
||||
|
||||
for (int k = 0; k < j; k++) {
|
||||
for (int i1 = 0; i1 < j; i1++) {
|
||||
label0:
|
||||
for (int k1 = 0; k1 < j; k1++) {
|
||||
if (k != 0 && k != j - 1 && i1 != 0 && i1 != j - 1 && k1 != 0 && k1 != j - 1) {
|
||||
continue;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
double d0;
|
||||
double d1;
|
||||
double d2;
|
||||
|
||||
for (i = 0; i < b0; ++i) {
|
||||
for (j = 0; j < b0; ++j) {
|
||||
for (k = 0; k < b0; ++k) {
|
||||
if (i == 0 || i == b0 - 1 || j == 0 || j == b0 - 1 || k == 0 || k == b0 - 1) {
|
||||
double d3 = (double) ((float) i / ((float) b0 - 1.0F) * 2.0F - 1.0F);
|
||||
double d4 = (double) ((float) j / ((float) b0 - 1.0F) * 2.0F - 1.0F);
|
||||
double d5 = (double) ((float) k / ((float) b0 - 1.0F) * 2.0F - 1.0F);
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
float f1 = this.f * (0.7F + this.i.l.nextFloat() * 0.6F);
|
||||
|
||||
d0 = this.b;
|
||||
d1 = this.c;
|
||||
d2 = this.d;
|
||||
|
||||
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) {
|
||||
int l = MathHelper.b(d0);
|
||||
int i1 = MathHelper.b(d1);
|
||||
int j1 = MathHelper.b(d2);
|
||||
int k1 = this.i.getTypeId(l, i1, j1);
|
||||
|
||||
if (k1 > 0) {
|
||||
f1 -= (Block.byId[k1].a(this.e) + 0.3F) * f2;
|
||||
}
|
||||
|
||||
if (f1 > 0.0F) {
|
||||
this.g.add(new ChunkPosition(l, i1, j1));
|
||||
}
|
||||
|
||||
d0 += d3 * (double) f2;
|
||||
d1 += d4 * (double) f2;
|
||||
d2 += d5 * (double) f2;
|
||||
}
|
||||
}
|
||||
double d1 = ((float) k / ((float) j - 1.0F)) * 2.0F - 1.0F;
|
||||
double d2 = ((float) i1 / ((float) j - 1.0F)) * 2.0F - 1.0F;
|
||||
double d3 = ((float) k1 / ((float) j - 1.0F)) * 2.0F - 1.0F;
|
||||
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
|
||||
d1 /= d4;
|
||||
d2 /= d4;
|
||||
d3 /= d4;
|
||||
float f2 = f * (0.7F + i.l.nextFloat() * 0.6F);
|
||||
double d5 = b;
|
||||
double d7 = c;
|
||||
double d9 = d;
|
||||
float f3 = 0.3F;
|
||||
|
||||
do {
|
||||
if (f2 <= 0.0F) {
|
||||
continue label0;
|
||||
}
|
||||
int j2 = MathHelper.b(d5);
|
||||
int k2 = MathHelper.b(d7);
|
||||
int l2 = MathHelper.b(d9);
|
||||
int i3 = i.a(j2, k2, l2);
|
||||
|
||||
if (i3 > 0) {
|
||||
f2 -= (Block.m[i3].a(e) + 0.3F) * f3;
|
||||
}
|
||||
if (f2 > 0.0F) {
|
||||
g.add(((new ChunkPosition(j2, k2, l2))));
|
||||
}
|
||||
d5 += d1 * (double) f3;
|
||||
d7 += d2 * (double) f3;
|
||||
d9 += d3 * (double) f3;
|
||||
f2 -= f3 * 0.75F;
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f *= 2.0F;
|
||||
int l = MathHelper.b(b - (double) f - 1.0D);
|
||||
int j1 = MathHelper.b(b + (double) f + 1.0D);
|
||||
int l1 = MathHelper.b(c - (double) f - 1.0D);
|
||||
int j3 = MathHelper.b(c + (double) f + 1.0D);
|
||||
int k3 = MathHelper.b(d - (double) f - 1.0D);
|
||||
int l3 = MathHelper.b(d + (double) f + 1.0D);
|
||||
List list = i.b(e, AxisAlignedBB.b(l, l1, k3, j1, j3, l3));
|
||||
Vec3D vec3d = Vec3D.b(b, c, d);
|
||||
this.f *= 2.0F;
|
||||
i = MathHelper.b(this.b - (double) this.f - 1.0D);
|
||||
j = MathHelper.b(this.b + (double) this.f + 1.0D);
|
||||
k = MathHelper.b(this.c - (double) this.f - 1.0D);
|
||||
int l1 = MathHelper.b(this.c + (double) this.f + 1.0D);
|
||||
int i2 = MathHelper.b(this.d - (double) this.f - 1.0D);
|
||||
int j2 = MathHelper.b(this.d + (double) this.f + 1.0D);
|
||||
List list = this.i.b(this.e, AxisAlignedBB.b((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
|
||||
Vec3D vec3d = Vec3D.b(this.b, this.c, this.d);
|
||||
|
||||
for (int i4 = 0; i4 < list.size(); i4++) {
|
||||
Entity entity = (Entity) list.get(i4);
|
||||
double d11 = entity.e(b, c, d) / (double) f;
|
||||
for (int k2 = 0; k2 < list.size(); ++k2) {
|
||||
Entity entity = (Entity) list.get(k2);
|
||||
double d7 = entity.e(this.b, this.c, this.d) / (double) this.f;
|
||||
|
||||
if (d11 <= 1.0D) {
|
||||
double d6 = entity.p - b;
|
||||
double d8 = entity.q - c;
|
||||
double d10 = entity.r - d;
|
||||
double d12 = MathHelper.a(d6 * d6 + d8 * d8 + d10 * d10);
|
||||
if (d7 <= 1.0D) {
|
||||
d0 = entity.locX - this.b;
|
||||
d1 = entity.locY - this.c;
|
||||
d2 = entity.locZ - this.d;
|
||||
double d8 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d6 /= d12;
|
||||
d8 /= d12;
|
||||
d10 /= d12;
|
||||
double d13 = i.a(vec3d, entity.z);
|
||||
double d14 = (1.0D - d11) * d13;
|
||||
d0 /= d8;
|
||||
d1 /= d8;
|
||||
d2 /= d8;
|
||||
double d9 = (double) this.i.a(vec3d, entity.boundingBox);
|
||||
double d10 = (1.0D - d7) * d9;
|
||||
|
||||
// CraftBukkit start - explosion damage hook
|
||||
CraftServer server = ((WorldServer) i).getServer();
|
||||
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) this.i).getServer();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType;
|
||||
int damageDone = (int) (((d14 * d14 + d14) / 2D) * 8D * (double) f + 1.0D);
|
||||
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.f + 1.0D);
|
||||
|
||||
if(damagee == null){
|
||||
// nothing was hurt
|
||||
@ -129,62 +129,61 @@ public class Explosion {
|
||||
// TODO: get the x/y/z of the tnt block?
|
||||
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
|
||||
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbbe);
|
||||
if (!edbbe.isCancelled()) {
|
||||
entity.a(e, edbbe.getDamage());
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
entity.a(this.e, event.getDamage());
|
||||
}
|
||||
} else {
|
||||
org.bukkit.entity.Entity damager = e.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damager = this.e.getBukkitEntity();
|
||||
damageType = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
|
||||
|
||||
EntityDamageByEntityEvent edbbe = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbbe);
|
||||
|
||||
if (!edbbe.isCancelled()) {
|
||||
entity.a(e, edbbe.getDamage());
|
||||
double d15 = d14;
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
entity.s += d6 * d15;
|
||||
entity.t += d8 * d15;
|
||||
entity.u += d10 * d15;
|
||||
if (!event.isCancelled()) {
|
||||
entity.a(this.e, event.getDamage());
|
||||
|
||||
entity.motX += d0 * d10;
|
||||
entity.motY += d1 * d10;
|
||||
entity.motZ += d2 * d10;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
f = f1;
|
||||
this.f = f;
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
((List) (arraylist)).addAll(((java.util.Collection) (g)));
|
||||
if (a) {
|
||||
for (int j4 = ((List) (arraylist)).size() - 1; j4 >= 0; j4--) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j4);
|
||||
int i2 = chunkposition.a;
|
||||
int k4 = chunkposition.b;
|
||||
int l4 = chunkposition.c;
|
||||
int i5 = i.a(i2, k4, l4);
|
||||
int j5 = i.a(i2, k4 - 1, l4);
|
||||
arraylist.addAll(this.g);
|
||||
if (this.a) {
|
||||
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l2);
|
||||
int i3 = chunkposition.a;
|
||||
int j3 = chunkposition.b;
|
||||
int k3 = chunkposition.c;
|
||||
int l3 = this.i.getTypeId(i3, j3, k3);
|
||||
int i4 = this.i.getTypeId(i3, j3 - 1, k3);
|
||||
|
||||
if (i5 == 0 && Block.o[j5] && h.nextInt(3) == 0) {
|
||||
i.e(i2, k4, l4, Block.ar.bi);
|
||||
if (l3 == 0 && Block.o[i4] && this.h.nextInt(3) == 0) {
|
||||
this.i.e(i3, j3, k3, Block.FIRE.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
i.a(b, c, d, "random.explode", 4F, (1.0F + (i.l.nextFloat() - i.l.nextFloat()) * 0.2F) * 0.7F);
|
||||
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);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
((List) (arraylist)).addAll(((java.util.Collection) (g)));
|
||||
arraylist.addAll(this.g);
|
||||
|
||||
// CraftBukkit start
|
||||
Server server = ((WorldServer) i).getServer();
|
||||
CraftWorld world = ((WorldServer) i).getWorld();
|
||||
org.bukkit.entity.Entity splode = (e == null) ? null : e.getBukkitEntity();
|
||||
Location location = new Location(world, b, c, d);
|
||||
Server server = ((WorldServer) this.i).getServer();
|
||||
CraftWorld world = ((WorldServer) this.i).getWorld();
|
||||
org.bukkit.entity.Entity splode = (this.e == null) ? null : this.e.getBukkitEntity();
|
||||
Location location = new Location(world, this.b, this.c, this.d);
|
||||
|
||||
List<org.bukkit.block.Block> blocklist = new ArrayList<org.bukkit.block.Block>();
|
||||
for (int j = arraylist.size() - 1; j >= 0; j--) {
|
||||
@ -194,48 +193,49 @@ public class Explosion {
|
||||
blocklist.add(blox);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
org.bukkit.event.Event.Type eventType = EntityExplodeEvent.Type.ENTITY_EXPLODE;
|
||||
EntityExplodeEvent eee = new EntityExplodeEvent(eventType, splode, location, blocklist);
|
||||
server.getPluginManager().callEvent(eee);
|
||||
|
||||
if (eee.isCancelled()) {
|
||||
EntityExplodeEvent event = new EntityExplodeEvent(eventType, splode, location, blocklist);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j);
|
||||
int k = chunkposition.a;
|
||||
int l = chunkposition.b;
|
||||
int i1 = chunkposition.c;
|
||||
int j1 = i.a(k, l, i1);
|
||||
|
||||
for (int k1 = 0; k1 < 1; k1++) {
|
||||
double d1 = (float) k + i.l.nextFloat();
|
||||
double d2 = (float) l + i.l.nextFloat();
|
||||
double d3 = (float) i1 + i.l.nextFloat();
|
||||
double d4 = d1 - b;
|
||||
double d5 = d2 - c;
|
||||
double d6 = d3 - d;
|
||||
double d7 = MathHelper.a(d4 * d4 + d5 * d5 + d6 * d6);
|
||||
for (int i = arraylist.size() - 1; i >= 0; --i) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(i);
|
||||
int j = chunkposition.a;
|
||||
int k = chunkposition.b;
|
||||
int l = chunkposition.c;
|
||||
int i1 = this.i.getTypeId(j, k, l);
|
||||
|
||||
d4 /= d7;
|
||||
d5 /= d7;
|
||||
d6 /= d7;
|
||||
double d8 = 0.5D / (d7 / (double) f + 0.10000000000000001D);
|
||||
for (int j1 = 0; j1 < 1; ++j1) {
|
||||
double d0 = (double) ((float) j + this.i.l.nextFloat());
|
||||
double d1 = (double) ((float) k + this.i.l.nextFloat());
|
||||
double d2 = (double) ((float) l + this.i.l.nextFloat());
|
||||
double d3 = d0 - this.b;
|
||||
double d4 = d1 - this.c;
|
||||
double d5 = d2 - this.d;
|
||||
double d6 = (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
d8 *= i.l.nextFloat() * i.l.nextFloat() + 0.3F;
|
||||
d4 *= d8;
|
||||
d5 *= d8;
|
||||
d6 *= d8;
|
||||
i.a("explode", (d1 + b * 1.0D) / 2D, (d2 + c * 1.0D) / 2D, (d3 + d * 1.0D) / 2D, d4, d5, d6);
|
||||
i.a("smoke", d1, d2, d3, d4, d5, d6);
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
double d7 = 0.5D / (d6 / (double) this.f + 0.1D);
|
||||
|
||||
d7 *= (double) (this.i.l.nextFloat() * this.i.l.nextFloat() + 0.3F);
|
||||
d3 *= d7;
|
||||
d4 *= d7;
|
||||
d5 *= d7;
|
||||
this.i.a("explode", (d0 + this.b * 1.0D) / 2.0D, (d1 + this.c * 1.0D) / 2.0D, (d2 + this.d * 1.0D) / 2.0D, d3, d4, d5);
|
||||
this.i.a("smoke", d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
|
||||
if (j1 > 0) {
|
||||
Block.m[j1].a(i, k, l, i1, i.b(k, l, i1), 0.3F);
|
||||
i.e(k, l, i1, 0);
|
||||
Block.m[j1].a_(i, k, l, i1);
|
||||
if (i1 > 0) {
|
||||
Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), 0.3F);
|
||||
this.i.e(j, k, l, 0);
|
||||
Block.byId[i1].a_(this.i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public interface IInventory {
|
||||
|
||||
public abstract int h_();
|
||||
|
||||
public abstract ItemStack a(int i);
|
||||
|
||||
public abstract ItemStack b(int i, int j);
|
||||
|
||||
public abstract void a(int i, ItemStack itemstack);
|
||||
|
||||
public abstract String b();
|
||||
|
||||
public abstract int c();
|
||||
|
||||
public abstract void d();
|
||||
|
||||
public abstract boolean a_(EntityPlayer entityplayer);
|
||||
|
||||
public abstract ItemStack[] getContents(); // CraftBukkit
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
public interface IInventory {
|
||||
|
||||
int h_();
|
||||
|
||||
ItemStack a(int i);
|
||||
|
||||
ItemStack b(int i, int j);
|
||||
|
||||
void a(int i, ItemStack itemstack);
|
||||
|
||||
String b();
|
||||
|
||||
int c();
|
||||
|
||||
void d();
|
||||
|
||||
boolean a_(EntityHuman entityhuman);
|
||||
|
||||
public abstract ItemStack[] getContents(); // CraftBukkit
|
||||
}
|
||||
|
@ -1,53 +1,51 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryCraftResult implements IInventory {
|
||||
|
||||
private ItemStack a[];
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryCraftResult() {
|
||||
a = new ItemStack[1];
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return a[i];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Result";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (a[i] != null) {
|
||||
ItemStack itemstack = a[i];
|
||||
|
||||
a[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
a[i] = itemstack;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryCraftResult implements IInventory {
|
||||
|
||||
private ItemStack[] a = new ItemStack[1];
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryCraftResult() {}
|
||||
|
||||
public int h_() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.a[i];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Result";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
ItemStack itemstack = this.a[i];
|
||||
|
||||
this.a[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.a[i] = itemstack;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,84 +1,82 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryCrafting implements IInventory {
|
||||
|
||||
private ItemStack a[];
|
||||
private int b;
|
||||
private CraftingInventoryCB c;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryCrafting(CraftingInventoryCB craftinginventorycb, int i, int j) {
|
||||
int k = i * j;
|
||||
|
||||
a = new ItemStack[k];
|
||||
c = craftinginventorycb;
|
||||
b = i;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return a.length;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
if (i >= h_()) {
|
||||
return null;
|
||||
} else {
|
||||
return a[i];
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
if (i < 0 || i >= b) {
|
||||
return null;
|
||||
} else {
|
||||
int k = i + j * b;
|
||||
|
||||
return a(k);
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Crafting";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (a[i] != null) {
|
||||
if (a[i].a <= j) {
|
||||
ItemStack itemstack = a[i];
|
||||
|
||||
a[i] = null;
|
||||
c.a(((IInventory) (this)));
|
||||
return itemstack;
|
||||
}
|
||||
ItemStack itemstack1 = a[i].a(j);
|
||||
|
||||
if (a[i].a == 0) {
|
||||
a[i] = null;
|
||||
}
|
||||
c.a(((IInventory) (this)));
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
a[i] = itemstack;
|
||||
c.a(((IInventory) (this)));
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryCrafting implements IInventory {
|
||||
|
||||
private ItemStack[] a;
|
||||
private int b;
|
||||
private Container c;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryCrafting(Container container, int i, int j) {
|
||||
int k = i * j;
|
||||
|
||||
this.a = new ItemStack[k];
|
||||
this.c = container;
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return this.a.length;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return i >= this.h_() ? null : this.a[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
if (i >= 0 && i < this.b) {
|
||||
int k = i + j * this.b;
|
||||
|
||||
return this.a(k);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Crafting";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.a[i].count <= j) {
|
||||
itemstack = this.a[i];
|
||||
this.a[i] = null;
|
||||
this.c.a((IInventory) this);
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.a[i].a(j);
|
||||
if (this.a[i].count == 0) {
|
||||
this.a[i] = null;
|
||||
}
|
||||
|
||||
this.c.a((IInventory) this);
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.a[i] = itemstack;
|
||||
this.c.a((IInventory) this);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +1,61 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryLargeChest implements IInventory {
|
||||
|
||||
private String a;
|
||||
private IInventory b;
|
||||
private IInventory c;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[h_()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = a(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryLargeChest(String s, IInventory iinventory, IInventory iinventory1) {
|
||||
a = s;
|
||||
b = iinventory;
|
||||
c = iinventory1;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return b.h_() + c.h_();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
if (i >= b.h_()) {
|
||||
return c.a(i - b.h_());
|
||||
} else {
|
||||
return b.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (i >= b.h_()) {
|
||||
return c.b(i - b.h_(), j);
|
||||
} else {
|
||||
return b.b(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
if (i >= b.h_()) {
|
||||
c.a(i - b.h_(), itemstack);
|
||||
} else {
|
||||
b.a(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return b.c();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
b.d();
|
||||
c.d();
|
||||
}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
return b.a_(entityplayer) && c.a_(entityplayer);
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryLargeChest implements IInventory {
|
||||
|
||||
private String a;
|
||||
private IInventory b;
|
||||
private IInventory c;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[h_()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = a(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryLargeChest(String s, IInventory iinventory, IInventory iinventory1) {
|
||||
this.a = s;
|
||||
this.b = iinventory;
|
||||
this.c = iinventory1;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return this.b.h_() + this.c.h_();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return i >= this.b.h_() ? this.c.a(i - this.b.h_()) : this.b.a(i);
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
return i >= this.b.h_() ? this.c.b(i - this.b.h_(), j) : this.b.b(i, j);
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
if (i >= this.b.h_()) {
|
||||
this.c.a(i - this.b.h_(), itemstack);
|
||||
} else {
|
||||
this.b.a(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b.c();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.b.d();
|
||||
this.c.d();
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.b.a_(entityhuman) && this.c.a_(entityhuman);
|
||||
}
|
||||
}
|
||||
|
@ -1,342 +1,344 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryPlayer implements IInventory {
|
||||
|
||||
public ItemStack a[];
|
||||
public ItemStack b[];
|
||||
public int c;
|
||||
private EntityPlayer e;
|
||||
private ItemStack f;
|
||||
public boolean d;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public ItemStack[] getArmorContents() {
|
||||
return b;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryPlayer(EntityPlayer entityplayer) {
|
||||
a = new ItemStack[36];
|
||||
b = new ItemStack[4];
|
||||
c = 0;
|
||||
d = false;
|
||||
e = entityplayer;
|
||||
}
|
||||
|
||||
public ItemStack e() {
|
||||
return a[c];
|
||||
}
|
||||
|
||||
private int d(int k) {
|
||||
for (int l = 0; l < a.length; l++) {
|
||||
if (a[l] != null && a[l].c == k) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int c(ItemStack itemstack) {
|
||||
for (int k = 0; k < a.length; k++) {
|
||||
if (a[k] != null && a[k].c == itemstack.c && a[k].c() && a[k].a < a[k].b() && a[k].a < c() && (!a[k].e() || a[k].h() == itemstack.h())) {
|
||||
return k;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int j() {
|
||||
for (int k = 0; k < a.length; k++) {
|
||||
if (a[k] == null) {
|
||||
return k;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int d(ItemStack itemstack) {
|
||||
int k = itemstack.c;
|
||||
int l = itemstack.a;
|
||||
int i1 = c(itemstack);
|
||||
|
||||
if (i1 < 0) {
|
||||
i1 = j();
|
||||
}
|
||||
if (i1 < 0) {
|
||||
return l;
|
||||
}
|
||||
if (a[i1] == null) {
|
||||
a[i1] = new ItemStack(k, 0, itemstack.h());
|
||||
}
|
||||
int j1 = l;
|
||||
|
||||
if (j1 > a[i1].b() - a[i1].a) {
|
||||
j1 = a[i1].b() - a[i1].a;
|
||||
}
|
||||
if (j1 > c() - a[i1].a) {
|
||||
j1 = c() - a[i1].a;
|
||||
}
|
||||
if (j1 == 0) {
|
||||
return l;
|
||||
} else {
|
||||
l -= j1;
|
||||
a[i1].a += j1;
|
||||
a[i1].b = 5;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public void f() {
|
||||
for (int k = 0; k < a.length; k++) {
|
||||
if (a[k] != null && a[k].b > 0) {
|
||||
a[k].b--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(int k) {
|
||||
int l = d(k);
|
||||
|
||||
if (l < 0) {
|
||||
return false;
|
||||
}
|
||||
if (--a[l].a <= 0) {
|
||||
a[l] = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
if (!itemstack.f()) {
|
||||
itemstack.a = d(itemstack);
|
||||
if (itemstack.a == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int k = j();
|
||||
|
||||
if (k >= 0) {
|
||||
a[k] = itemstack;
|
||||
a[k].b = 5;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack b(int k, int l) {
|
||||
ItemStack aitemstack[] = a;
|
||||
|
||||
if (k >= a.length) {
|
||||
aitemstack = b;
|
||||
k -= a.length;
|
||||
}
|
||||
if (aitemstack[k] != null) {
|
||||
if (aitemstack[k].a <= l) {
|
||||
ItemStack itemstack = aitemstack[k];
|
||||
|
||||
aitemstack[k] = null;
|
||||
return itemstack;
|
||||
}
|
||||
ItemStack itemstack1 = aitemstack[k].a(l);
|
||||
|
||||
if (aitemstack[k].a == 0) {
|
||||
aitemstack[k] = null;
|
||||
}
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int k, ItemStack itemstack) {
|
||||
ItemStack aitemstack[] = a;
|
||||
|
||||
if (k >= aitemstack.length) {
|
||||
k -= aitemstack.length;
|
||||
aitemstack = b;
|
||||
}
|
||||
aitemstack[k] = itemstack;
|
||||
}
|
||||
|
||||
public float a(Block block) {
|
||||
float f1 = 1.0F;
|
||||
|
||||
if (a[c] != null) {
|
||||
f1 *= a[c].a(block);
|
||||
}
|
||||
return f1;
|
||||
}
|
||||
|
||||
public NBTTagList a(NBTTagList nbttaglist) {
|
||||
for (int k = 0; k < a.length; k++) {
|
||||
if (a[k] != null) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
nbttagcompound.a("Slot", (byte) k);
|
||||
a[k].a(nbttagcompound);
|
||||
nbttaglist.a(((NBTBase) (nbttagcompound)));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < b.length; l++) {
|
||||
if (b[l] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) (l + 100));
|
||||
b[l].a(nbttagcompound1);
|
||||
nbttaglist.a(((NBTBase) (nbttagcompound1)));
|
||||
}
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
public void b(NBTTagList nbttaglist) {
|
||||
a = new ItemStack[36];
|
||||
b = new ItemStack[4];
|
||||
for (int k = 0; k < nbttaglist.b(); k++) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(k);
|
||||
int l = nbttagcompound.b("Slot") & 0xff;
|
||||
ItemStack itemstack = new ItemStack(nbttagcompound);
|
||||
|
||||
if (itemstack.a() == null) {
|
||||
continue;
|
||||
}
|
||||
if (l >= 0 && l < a.length) {
|
||||
a[l] = itemstack;
|
||||
}
|
||||
if (l >= 100 && l < b.length + 100) {
|
||||
b[l - 100] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return a.length + 4;
|
||||
}
|
||||
|
||||
public ItemStack a(int k) {
|
||||
ItemStack aitemstack[] = a;
|
||||
|
||||
if (k >= aitemstack.length) {
|
||||
k -= aitemstack.length;
|
||||
aitemstack = b;
|
||||
}
|
||||
return aitemstack[k];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Inventory";
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public int a(Entity entity) {
|
||||
ItemStack itemstack = a(c);
|
||||
|
||||
if (itemstack != null) {
|
||||
return itemstack.a(entity);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
if (block.bt != Material.d && block.bt != Material.e && block.bt != Material.t && block.bt != Material.s) {
|
||||
return true;
|
||||
}
|
||||
ItemStack itemstack = a(c);
|
||||
|
||||
if (itemstack != null) {
|
||||
return itemstack.b(block);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int g() {
|
||||
int k = 0;
|
||||
int l = 0;
|
||||
int i1 = 0;
|
||||
|
||||
for (int j1 = 0; j1 < b.length; j1++) {
|
||||
if (b[j1] != null && (b[j1].a() instanceof ItemArmor)) {
|
||||
int k1 = b[j1].i();
|
||||
int l1 = b[j1].g();
|
||||
int i2 = k1 - l1;
|
||||
|
||||
l += i2;
|
||||
i1 += k1;
|
||||
int j2 = ((ItemArmor) b[j1].a()).bh;
|
||||
|
||||
k += j2;
|
||||
}
|
||||
}
|
||||
|
||||
if (i1 == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return ((k - 1) * l) / i1 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void c(int k) {
|
||||
for (int l = 0; l < b.length; l++) {
|
||||
if (b[l] == null || !(b[l].a() instanceof ItemArmor)) {
|
||||
continue;
|
||||
}
|
||||
b[l].b(k);
|
||||
if (b[l].a == 0) {
|
||||
b[l].a(e);
|
||||
b[l] = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void h() {
|
||||
for (int k = 0; k < a.length; k++) {
|
||||
if (a[k] != null) {
|
||||
e.a(a[k], true);
|
||||
a[k] = null;
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < b.length; l++) {
|
||||
if (b[l] != null) {
|
||||
e.a(b[l], true);
|
||||
b[l] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
d = true;
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
f = itemstack;
|
||||
e.a(itemstack);
|
||||
}
|
||||
|
||||
public ItemStack i() {
|
||||
return f;
|
||||
}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
if (e.G) {
|
||||
return false;
|
||||
}
|
||||
return entityplayer.b(((Entity) (e))) <= 64D;
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
public class InventoryPlayer implements IInventory {
|
||||
|
||||
public ItemStack[] a = new ItemStack[36];
|
||||
public ItemStack[] b = new ItemStack[4];
|
||||
public int c = 0;
|
||||
private EntityHuman e;
|
||||
private ItemStack f;
|
||||
public boolean d = false;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public ItemStack[] getArmorContents() {
|
||||
return b;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public InventoryPlayer(EntityHuman entityhuman) {
|
||||
this.e = entityhuman;
|
||||
}
|
||||
|
||||
public ItemStack e() {
|
||||
return this.a[this.c];
|
||||
}
|
||||
|
||||
private int d(int i) {
|
||||
for (int j = 0; j < this.a.length; ++j) {
|
||||
if (this.a[j] != null && this.a[j].id == i) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int c(ItemStack itemstack) {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.c() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int j() {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] == null) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int d(ItemStack itemstack) {
|
||||
int i = itemstack.id;
|
||||
int j = itemstack.count;
|
||||
int k = this.c(itemstack);
|
||||
|
||||
if (k < 0) {
|
||||
k = this.j();
|
||||
}
|
||||
|
||||
if (k < 0) {
|
||||
return j;
|
||||
} else {
|
||||
if (this.a[k] == null) {
|
||||
this.a[k] = new ItemStack(i, 0, itemstack.h());
|
||||
}
|
||||
|
||||
int l = j;
|
||||
|
||||
if (j > 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) {
|
||||
l = this.c() - this.a[k].count;
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
return j;
|
||||
} else {
|
||||
j -= l;
|
||||
this.a[k].count += l;
|
||||
this.a[k].b = 5;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void f() {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null && this.a[i].b > 0) {
|
||||
--this.a[i].b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(int i) {
|
||||
int j = this.d(i);
|
||||
|
||||
if (j < 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (--this.a[j].count <= 0) {
|
||||
this.a[j] = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
if (!itemstack.f()) {
|
||||
itemstack.count = this.d(itemstack);
|
||||
if (itemstack.count == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int i = this.j();
|
||||
|
||||
if (i >= 0) {
|
||||
this.a[i] = itemstack;
|
||||
this.a[i].b = 5;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
ItemStack[] aitemstack = this.a;
|
||||
|
||||
if (i >= this.a.length) {
|
||||
aitemstack = this.b;
|
||||
i -= this.a.length;
|
||||
}
|
||||
|
||||
if (aitemstack[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (aitemstack[i].count <= j) {
|
||||
itemstack = aitemstack[i];
|
||||
aitemstack[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = aitemstack[i].a(j);
|
||||
if (aitemstack[i].count == 0) {
|
||||
aitemstack[i] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
ItemStack[] aitemstack = this.a;
|
||||
|
||||
if (i >= aitemstack.length) {
|
||||
i -= aitemstack.length;
|
||||
aitemstack = this.b;
|
||||
}
|
||||
|
||||
aitemstack[i] = itemstack;
|
||||
}
|
||||
|
||||
public float a(Block block) {
|
||||
float f = 1.0F;
|
||||
|
||||
if (this.a[this.c] != null) {
|
||||
f *= this.a[this.c].a(block);
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public NBTTagList a(NBTTagList nbttaglist) {
|
||||
int i;
|
||||
NBTTagCompound nbttagcompound;
|
||||
|
||||
for (i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.a("Slot", (byte) i);
|
||||
this.a[i].a(nbttagcompound);
|
||||
nbttaglist.a((NBTBase) nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < this.b.length; ++i) {
|
||||
if (this.b[i] != null) {
|
||||
nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.a("Slot", (byte) (i + 100));
|
||||
this.b[i].a(nbttagcompound);
|
||||
nbttaglist.a((NBTBase) nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
public void b(NBTTagList nbttaglist) {
|
||||
this.a = new ItemStack[36];
|
||||
this.b = new ItemStack[4];
|
||||
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound.b("Slot") & 255;
|
||||
ItemStack itemstack = new ItemStack(nbttagcompound);
|
||||
|
||||
if (itemstack.a() != null) {
|
||||
if (j >= 0 && j < this.a.length) {
|
||||
this.a[j] = itemstack;
|
||||
}
|
||||
|
||||
if (j >= 100 && j < this.b.length + 100) {
|
||||
this.b[j - 100] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return this.a.length + 4;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
ItemStack[] aitemstack = this.a;
|
||||
|
||||
if (i >= aitemstack.length) {
|
||||
i -= aitemstack.length;
|
||||
aitemstack = this.b;
|
||||
}
|
||||
|
||||
return aitemstack[i];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Inventory";
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public int a(Entity entity) {
|
||||
ItemStack itemstack = this.a(this.c);
|
||||
|
||||
return itemstack != null ? itemstack.a(entity) : 1;
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = this.a(this.c);
|
||||
|
||||
return itemstack != null ? itemstack.b(block) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public int g() {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
for (int l = 0; l < this.b.length; ++l) {
|
||||
if (this.b[l] != null && this.b[l].a() instanceof ItemArmor) {
|
||||
int i1 = this.b[l].i();
|
||||
int j1 = this.b[l].g();
|
||||
int k1 = i1 - j1;
|
||||
|
||||
j += k1;
|
||||
k += i1;
|
||||
int l1 = ((ItemArmor) this.b[l].a()).bh;
|
||||
|
||||
i += l1;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return (i - 1) * j / k + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
for (int j = 0; j < this.b.length; ++j) {
|
||||
if (this.b[j] != null && this.b[j].a() instanceof ItemArmor) {
|
||||
this.b[j].b(i);
|
||||
if (this.b[j].count == 0) {
|
||||
this.b[j].a(this.e);
|
||||
this.b[j] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
this.e.a(this.a[i], true);
|
||||
this.a[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < this.b.length; ++i) {
|
||||
if (this.b[i] != null) {
|
||||
this.e.a(this.b[i], true);
|
||||
this.b[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.d = true;
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
this.f = itemstack;
|
||||
this.e.a(itemstack);
|
||||
}
|
||||
|
||||
public ItemStack i() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.e.dead ? false : entityhuman.b((Entity) this.e) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ public class ItemBlock extends Item {
|
||||
|
||||
public ItemBlock(int i) {
|
||||
super(i);
|
||||
a = i + 256;
|
||||
b(Block.m[i + 256].a(2));
|
||||
this.a = i + 256;
|
||||
this.b(Block.byId[i + 256].a(2));
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit start
|
||||
// Bail if we have nothing of the item in hand
|
||||
if (itemstack.a == 0) {
|
||||
if (itemstack.count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -33,95 +33,102 @@ public class ItemBlock extends Item {
|
||||
BlockFace faceClicked = CraftBlock.notchToBlockFace(l);
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.a(i, j, k) == Block.aS.bi) {
|
||||
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
||||
l = 0;
|
||||
} else {
|
||||
if (l == 0) {
|
||||
j--;
|
||||
--j;
|
||||
}
|
||||
|
||||
if (l == 1) {
|
||||
j++;
|
||||
++j;
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
k--;
|
||||
--k;
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
k++;
|
||||
++k;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
i--;
|
||||
--i;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack.a == 0) {
|
||||
if (itemstack.count == 0) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
/* 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.
|
||||
*/
|
||||
org.bukkit.block.Block replacedBlock = (blockClicked.getTypeId() == Block.SNOW.id || blockClicked.getTypeId() == Block.STEP.id) ? blockClicked:blockClicked.getFace(faceClicked);
|
||||
final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
|
||||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit start
|
||||
/* 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.
|
||||
*/
|
||||
org.bukkit.block.Block replacedBlock = (blockClicked.getTypeId() == 78 || blockClicked.getTypeId() == 44) ? blockClicked:blockClicked.getFace(faceClicked);
|
||||
final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
|
||||
if (world.a(this.a, i, j, k, false)) {
|
||||
Block block = Block.byId[this.a];
|
||||
|
||||
if (world.a(a, i, j, k, false)) {
|
||||
Block block = Block.m[a];
|
||||
// CraftBukkit start - This executes the placement of the block
|
||||
/*
|
||||
* This replaces world.b(IIIII), we're doing this because we need to
|
||||
* hook between the 'placement' and the informing to 'world' so we can
|
||||
* sanely undo this.
|
||||
*
|
||||
* Whenever the call to 'world.b' changes we need to figure out again what to
|
||||
* replace this with.
|
||||
*/
|
||||
if (world.setTypeIdAndData(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block
|
||||
org.bukkit.Server server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_PLACED;
|
||||
org.bukkit.block.Block placedBlock = blockClicked.getFace(faceClicked) ;
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
// This executes the placement of the block
|
||||
/*
|
||||
* This replaces world.b(IIIII), we're doing this because we need to
|
||||
* hook between the 'placement' and the informing to 'world' so we can
|
||||
* sanely undo this.
|
||||
*
|
||||
* Whenever the call to 'world.b' changes we need to figure out again what to
|
||||
* replace this with.
|
||||
*/
|
||||
if (world.a(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block
|
||||
org.bukkit.Server server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_PLACED;
|
||||
org.bukkit.block.Block placedBlock = blockClicked.getFace(faceClicked) ;
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
Player thePlayer = (entityplayer ==null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ));
|
||||
|
||||
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.m), Math.abs(k - world.o));
|
||||
// CraftBukkit hardcoded Spawn distance for now
|
||||
// TODO make spawn size configurable
|
||||
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();
|
||||
|
||||
// CraftBukkit hardcoded Spawn distance for now
|
||||
// TODO make spawn size configurable
|
||||
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();
|
||||
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
BlockPlaceEvent bpe = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
|
||||
server.getPluginManager().callEvent(bpe);
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
// CraftBukkit Undo!
|
||||
|
||||
if (bpe.isCancelled() || !bpe.canBuild()) {
|
||||
// CraftBukkit Undo!
|
||||
if (this.a == block.ICE.id) {
|
||||
// Ice will explode if we set straight to 0
|
||||
world.setTypeId(i, j, k, 20);
|
||||
} else if ((this.a == Block.STEP.id) && (world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (world.getTypeId(i, j, k) == 0)) {
|
||||
// Half steps automatically set the block below to a double
|
||||
world.setTypeId(i, j - 1, k, 44);
|
||||
}
|
||||
|
||||
if (this.a == 79) {
|
||||
// Ice will explode if we set straight to 0
|
||||
world.b(i, j, k, 20);
|
||||
} else if ((this.a == 44) && (world.a(i, j - 1, k) == 43) && (world.a(i, j, k) == 0)) {
|
||||
// Half steps automatically set the block below to a double
|
||||
world.b(i, j - 1, k, 44);
|
||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getData().getData());
|
||||
} else {
|
||||
world.f(i, j, k, a); // <-- world.b does this on success (tell the world)
|
||||
|
||||
Block.byId[this.a].c(world, i, j, k, l);
|
||||
Block.byId[this.a].a(world, i, j, k, (EntityLiving) entityhuman);
|
||||
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.c(), (block.stepSound.a() + 1.0F) / 2.0F, block.stepSound.b() * 0.8F);
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
world.a(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getData().getData());
|
||||
} else {
|
||||
world.f(i, j, k, a); // <-- world.b does this on success (tell the world)
|
||||
|
||||
Block.m[a].c(world, i, j, k, l);
|
||||
Block.m[a].a(world, i, j, k, ((EntityLiving) (entityplayer)));
|
||||
world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.br.c(), (block.br.a() + 1.0F) / 2.0F, block.br.b() * 0.8F);
|
||||
itemstack.a--;
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
return true;
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return Block.m[a].e();
|
||||
return Block.byId[this.a].e();
|
||||
}
|
||||
}
|
||||
|
@ -15,59 +15,61 @@ public class ItemBoat extends Item {
|
||||
|
||||
public ItemBoat(int i) {
|
||||
super(i);
|
||||
bb = 1;
|
||||
this.maxStackSize = 1;
|
||||
}
|
||||
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
||||
float f = 1.0F;
|
||||
float f1 = entityplayer.y + (entityplayer.w - entityplayer.y) * f;
|
||||
float f2 = entityplayer.x + (entityplayer.v - entityplayer.x) * f;
|
||||
double d = entityplayer.m + (entityplayer.p - entityplayer.m) * (double) f;
|
||||
double d1 = (entityplayer.n + (entityplayer.q - entityplayer.n) * (double) f + 1.6200000000000001D) - (double) entityplayer.H;
|
||||
double d2 = entityplayer.o + (entityplayer.r - entityplayer.o) * (double) f;
|
||||
Vec3D vec3d = Vec3D.b(d, d1, d2);
|
||||
float f3 = MathHelper.b(-f2 * 0.01745329F - 3.141593F);
|
||||
float f4 = MathHelper.a(-f2 * 0.01745329F - 3.141593F);
|
||||
float f5 = -MathHelper.b(-f1 * 0.01745329F);
|
||||
float f6 = MathHelper.a(-f1 * 0.01745329F);
|
||||
float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
|
||||
float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
|
||||
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
|
||||
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
|
||||
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
|
||||
Vec3D vec3d = Vec3D.b(d0, d1, d2);
|
||||
float f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f5 = -MathHelper.b(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.a(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f6;
|
||||
float f9 = f3 * f5;
|
||||
double d3 = 5D;
|
||||
Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f8 * d3, (double) f9 * d3);
|
||||
float f8 = f3 * f5;
|
||||
double d3 = 5.0D;
|
||||
Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
MovingObjectPosition movingobjectposition = world.a(vec3d, vec3d1, true);
|
||||
|
||||
if (movingobjectposition == null) {
|
||||
return itemstack;
|
||||
}
|
||||
if (movingobjectposition.a == EnumMovingObjectType.a) {
|
||||
int i = movingobjectposition.b;
|
||||
int j = movingobjectposition.c;
|
||||
int k = movingobjectposition.d;
|
||||
} else {
|
||||
if (movingobjectposition.a == EnumMovingObjectType.TILE) {
|
||||
int i = movingobjectposition.b;
|
||||
int j = movingobjectposition.c;
|
||||
int k = movingobjectposition.d;
|
||||
|
||||
if (!world.z) {
|
||||
// CraftBukkit start - Boat placement
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(movingobjectposition.e);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start - Boat placement
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return itemstack;
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(movingobjectposition.e);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.a((Entity) (new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.5F), (double) ((float) k + 0.5F))));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.a(((Entity) (new EntityBoat(world, (float) i + 0.5F, (float) j + 1.5F, (float) k + 0.5F))));
|
||||
--itemstack.count;
|
||||
}
|
||||
itemstack.a--;
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
@ -20,123 +18,137 @@ public class ItemBucket extends Item {
|
||||
|
||||
public ItemBucket(int i, int j) {
|
||||
super(i);
|
||||
bb = 1;
|
||||
bc = 64;
|
||||
a = j;
|
||||
this.maxStackSize = 1;
|
||||
this.durability = 64;
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
||||
float f = 1.0F;
|
||||
float f1 = entityplayer.y + (entityplayer.w - entityplayer.y) * f;
|
||||
float f2 = entityplayer.x + (entityplayer.v - entityplayer.x) * f;
|
||||
double d = entityplayer.m + (entityplayer.p - entityplayer.m) * (double) f;
|
||||
double d1 = (entityplayer.n + (entityplayer.q - entityplayer.n) * (double) f + 1.6200000000000001D) - (double) entityplayer.H;
|
||||
double d2 = entityplayer.o + (entityplayer.r - entityplayer.o) * (double) f;
|
||||
Vec3D vec3d = Vec3D.b(d, d1, d2);
|
||||
float f3 = MathHelper.b(-f2 * 0.01745329F - 3.141593F);
|
||||
float f4 = MathHelper.a(-f2 * 0.01745329F - 3.141593F);
|
||||
float f5 = -MathHelper.b(-f1 * 0.01745329F);
|
||||
float f6 = MathHelper.a(-f1 * 0.01745329F);
|
||||
float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
|
||||
float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
|
||||
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
|
||||
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
|
||||
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
|
||||
Vec3D vec3d = Vec3D.b(d0, d1, d2);
|
||||
float f3 = MathHelper.b(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f4 = MathHelper.a(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f5 = -MathHelper.b(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.a(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f6;
|
||||
float f9 = f3 * f5;
|
||||
double d3 = 5D;
|
||||
Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f8 * d3, (double) f9 * d3);
|
||||
MovingObjectPosition movingobjectposition = world.a(vec3d, vec3d1, a == 0);
|
||||
float f8 = f3 * f5;
|
||||
double d3 = 5.0D;
|
||||
Vec3D vec3d1 = vec3d.c((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
MovingObjectPosition movingobjectposition = world.a(vec3d, vec3d1, this.a == 0);
|
||||
|
||||
if (movingobjectposition == null) {
|
||||
return itemstack;
|
||||
}
|
||||
if (movingobjectposition.a == EnumMovingObjectType.a) {
|
||||
int i = movingobjectposition.b;
|
||||
int j = movingobjectposition.c;
|
||||
int k = movingobjectposition.d;
|
||||
} else {
|
||||
if (movingobjectposition.a == EnumMovingObjectType.TILE) {
|
||||
int i = movingobjectposition.b;
|
||||
int j = movingobjectposition.c;
|
||||
int k = movingobjectposition.d;
|
||||
|
||||
if (!world.a(entityplayer, i, j, k)) {
|
||||
return itemstack;
|
||||
}
|
||||
if (!world.a(entityhuman, i, j, k)) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
// CraftBukkit start - Click == placed when handling an empty bucket!
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(movingobjectposition.e);
|
||||
// CraftBukkit end
|
||||
// CraftBukkit start - Click == placed when handling an empty bucket!
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
if (a == 0) {
|
||||
if (world.c(i, j, k) == Material.f && world.b(i, j, k) == 0) {
|
||||
// CraftBukkit start
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(movingobjectposition.e);
|
||||
// CraftBukkit end
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.e(i, j, k, 0);
|
||||
return new ItemStack(Item.av);
|
||||
}
|
||||
if (world.c(i, j, k) == Material.g && world.b(i, j, k) == 0) {
|
||||
// CraftBukkit start
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
if (this.a == 0) {
|
||||
if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0) {
|
||||
// CraftBukkit start
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.e(i, j, k, 0);
|
||||
return new ItemStack(Item.aw);
|
||||
}
|
||||
} else {
|
||||
if (a < 0) {
|
||||
return new ItemStack(Item.au);
|
||||
}
|
||||
if (movingobjectposition.e == 0) {
|
||||
j--;
|
||||
}
|
||||
if (movingobjectposition.e == 1) {
|
||||
j++;
|
||||
}
|
||||
if (movingobjectposition.e == 2) {
|
||||
k--;
|
||||
}
|
||||
if (movingobjectposition.e == 3) {
|
||||
k++;
|
||||
}
|
||||
if (movingobjectposition.e == 4) {
|
||||
i--;
|
||||
}
|
||||
if (movingobjectposition.e == 5) {
|
||||
i++;
|
||||
}
|
||||
if (world.e(i, j, k) || !world.c(i, j, k).a()) {
|
||||
if (world.q.d && a == Block.A.bi) {
|
||||
world.a(d + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.l.nextFloat() - world.l.nextFloat()) * 0.8F);
|
||||
for (int l = 0; l < 8; l++) {
|
||||
world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start - bucket empty.
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.b(i, j, k, a, 0);
|
||||
|
||||
world.e(i, j, k, 0);
|
||||
return new ItemStack(Item.WATER_BUCKET);
|
||||
}
|
||||
|
||||
if (world.getMaterial(i, j, k) == Material.LAVA && world.getData(i, j, k) == 0) {
|
||||
// CraftBukkit start
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.e(i, j, k, 0);
|
||||
return new ItemStack(Item.LAVA_BUCKET);
|
||||
}
|
||||
} else {
|
||||
if (this.a < 0) {
|
||||
return new ItemStack(Item.BUCKET);
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 0) {
|
||||
--j;
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 1) {
|
||||
++j;
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 2) {
|
||||
--k;
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 3) {
|
||||
++k;
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 4) {
|
||||
--i;
|
||||
}
|
||||
|
||||
if (movingobjectposition.e == 5) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) {
|
||||
if (world.q.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);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start - bucket empty.
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.b(i, j, k, this.a, 0);
|
||||
}
|
||||
|
||||
return new ItemStack(Item.BUCKET);
|
||||
}
|
||||
return new ItemStack(Item.au);
|
||||
}
|
||||
} else if (this.a == 0 && movingobjectposition.g instanceof EntityCow) {
|
||||
return new ItemStack(Item.MILK_BUCKET);
|
||||
}
|
||||
} else if (a == 0 && (movingobjectposition.g instanceof EntityCow)) {
|
||||
return new ItemStack(Item.aE);
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -19,59 +17,64 @@ public class ItemFlintAndSteel extends Item {
|
||||
|
||||
public ItemFlintAndSteel(int i) {
|
||||
super(i);
|
||||
bb = 1;
|
||||
bc = 64;
|
||||
this.maxStackSize = 1;
|
||||
this.durability = 64;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit - store the clicked block
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit start - store the clicked block
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
if (l == 0) {
|
||||
j--;
|
||||
--j;
|
||||
}
|
||||
|
||||
if (l == 1) {
|
||||
j++;
|
||||
++j;
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
k--;
|
||||
--k;
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
k++;
|
||||
++k;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
i--;
|
||||
--i;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
int i1 = world.a(i, j, k);
|
||||
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == 0) {
|
||||
// CraftBukkit start - Flint and steel
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player thePlayer = (Player) entityplayer.getBukkitEntity();
|
||||
Player thePlayer = (Player) entityhuman.getBukkitEntity();
|
||||
CraftItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(l);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, thePlayer, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
boolean preventLighter = pie.isCancelled();
|
||||
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, thePlayer, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
boolean preventLighter = event.isCancelled();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL;
|
||||
BlockIgniteEvent bie = new BlockIgniteEvent(blockClicked, igniteCause, thePlayer);
|
||||
craftServer.getPluginManager().callEvent(bie);
|
||||
boolean preventFire = bie.isCancelled();
|
||||
|
||||
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, igniteCause, thePlayer);
|
||||
craftServer.getPluginManager().callEvent(eventIgnite);
|
||||
boolean preventFire = eventIgnite.isCancelled();
|
||||
|
||||
if (preventLighter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (preventFire) {
|
||||
itemstack.b(1);
|
||||
return false;
|
||||
@ -79,8 +82,9 @@ public class ItemFlintAndSteel extends Item {
|
||||
// CraftBukkit end
|
||||
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
|
||||
world.e(i, j, k, Block.ar.bi);
|
||||
world.e(i, j, k, Block.FIRE.id);
|
||||
}
|
||||
|
||||
itemstack.b(1);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -17,58 +15,60 @@ public class ItemHoe extends Item {
|
||||
|
||||
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
|
||||
super(i);
|
||||
bb = 1;
|
||||
bc = enumtoolmaterial.a();
|
||||
this.maxStackSize = 1;
|
||||
this.durability = enumtoolmaterial.a();
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
int i1 = world.a(i, j, k);
|
||||
Material material = world.c(i, j + 1, k);
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
Material material = world.getMaterial(i, j + 1, k);
|
||||
|
||||
if (!material.a() && i1 == Block.u.bi || i1 == Block.v.bi) {
|
||||
// CraftBukkit start - Hoes
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if ((material.isBuildable() || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
|
||||
return false;
|
||||
} else {
|
||||
Block block = Block.SOIL;
|
||||
|
||||
Block block = Block.aA;
|
||||
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.c(), (block.stepSound.a() + 1.0F) / 2.0F, block.stepSound.b() * 0.8F);
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start - Hoes
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.e(i, j, k, block.id);
|
||||
itemstack.b(1);
|
||||
if (world.l.nextInt(8) == 0 && i1 == Block.GRASS.id) {
|
||||
byte b0 = 1;
|
||||
|
||||
for (int j1 = 0; j1 < b0; ++j1) {
|
||||
float f = 0.7F;
|
||||
float f1 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
float f2 = 1.2F;
|
||||
float f3 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f1), (double) ((float) j + f2), (double) ((float) k + f3), new ItemStack(Item.SEEDS));
|
||||
|
||||
entityitem.c = 10;
|
||||
world.a((Entity) entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
world.a((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, block.br.c(), (block.br.a() + 1.0F) / 2.0F, block.br.b() * 0.8F);
|
||||
if (world.z) {
|
||||
return true;
|
||||
}
|
||||
world.e(i, j, k, block.bi);
|
||||
itemstack.b(1);
|
||||
if (world.l.nextInt(8) == 0 && i1 == Block.u.bi) {
|
||||
int j1 = 1;
|
||||
|
||||
for (int k1 = 0; k1 < j1; k1++) {
|
||||
float f = 0.7F;
|
||||
float f1 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
float f2 = 1.2F;
|
||||
float f3 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
EntityItem entityitem = new EntityItem(world, (float) i + f1, (float) j + f2, (float) k + f3, new ItemStack(Item.Q));
|
||||
|
||||
entityitem.c = 10;
|
||||
world.a(((Entity) (entityitem)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,125 +3,121 @@ package net.minecraft.server;
|
||||
public class ItemInWorldManager {
|
||||
|
||||
private World b;
|
||||
public EntityPlayer a;
|
||||
public EntityHuman a;
|
||||
private float c;
|
||||
public float d; // CraftBukkit private -> public
|
||||
private int e;
|
||||
private float f;
|
||||
public float d = 0.0F; // CraftBukkit private -> public
|
||||
private int e = 0;
|
||||
private float f = 0.0F;
|
||||
private int g;
|
||||
private int h;
|
||||
private int i;
|
||||
|
||||
public ItemInWorldManager(World world) {
|
||||
d = 0.0F;
|
||||
e = 0;
|
||||
f = 0.0F;
|
||||
b = world;
|
||||
this.b = world;
|
||||
}
|
||||
|
||||
public void a(int j, int k, int l) {
|
||||
int i1 = b.a(j, k, l);
|
||||
public void a(int i, int j, int k) {
|
||||
int l = this.b.getTypeId(i, j, k);
|
||||
|
||||
if (i1 > 0 && d == 0.0F) {
|
||||
Block.m[i1].b(b, j, k, l, a);
|
||||
if (l > 0 && this.d == 0.0F) {
|
||||
Block.byId[l].b(this.b, i, j, k, this.a);
|
||||
}
|
||||
if (i1 > 0 && Block.m[i1].a(a) >= 1.0F) {
|
||||
c(j, k, l);
|
||||
|
||||
if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) {
|
||||
this.c(i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
d = 0.0F;
|
||||
e = 0;
|
||||
this.d = 0.0F;
|
||||
this.e = 0;
|
||||
}
|
||||
|
||||
public void a(int j, int k, int l, int i1) {
|
||||
if (e > 0) {
|
||||
e--;
|
||||
return;
|
||||
}
|
||||
if (j == g && k == h && l == i) {
|
||||
int j1 = b.a(j, k, l);
|
||||
|
||||
if (j1 == 0) {
|
||||
return;
|
||||
}
|
||||
Block block = Block.m[j1];
|
||||
|
||||
d += block.a(a);
|
||||
f++;
|
||||
if (d >= 1.0F) {
|
||||
c(j, k, l);
|
||||
d = 0.0F;
|
||||
c = 0.0F;
|
||||
f = 0.0F;
|
||||
e = 5;
|
||||
}
|
||||
public void a(int i, int j, int k, int l) {
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
} else {
|
||||
d = 0.0F;
|
||||
c = 0.0F;
|
||||
f = 0.0F;
|
||||
g = j;
|
||||
h = k;
|
||||
i = l;
|
||||
if (i == this.g && j == this.h && k == this.i) {
|
||||
int i1 = this.b.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 {
|
||||
this.d = 0.0F;
|
||||
this.c = 0.0F;
|
||||
this.f = 0.0F;
|
||||
this.g = i;
|
||||
this.h = j;
|
||||
this.i = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(int j, int k, int l) {
|
||||
Block block = Block.m[b.a(j, k, l)];
|
||||
int i1 = b.b(j, k, l);
|
||||
boolean flag = b.e(j, k, l, 0);
|
||||
public boolean b(int i, int j, int k) {
|
||||
Block block = Block.byId[this.b.getTypeId(i, j, k)];
|
||||
int l = this.b.getData(i, j, k);
|
||||
boolean flag = this.b.e(i, j, k, 0);
|
||||
|
||||
if (block != null && flag) {
|
||||
block.a(b, j, k, l, i1);
|
||||
block.a(this.b, i, j, k, l);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean c(int j, int k, int l) {
|
||||
int i1 = b.a(j, k, l);
|
||||
int j1 = b.b(j, k, l);
|
||||
boolean flag = b(j, k, l);
|
||||
ItemStack itemstack = a.P();
|
||||
public boolean c(int i, int j, int k) {
|
||||
int l = this.b.getTypeId(i, j, k);
|
||||
int i1 = this.b.getData(i, j, k);
|
||||
boolean flag = this.b(i, j, k);
|
||||
ItemStack itemstack = this.a.P();
|
||||
|
||||
if (itemstack != null) {
|
||||
itemstack.a(i1, j, k, l);
|
||||
if (itemstack.a == 0) {
|
||||
itemstack.a(a);
|
||||
a.Q();
|
||||
itemstack.a(l, i, j, k);
|
||||
if (itemstack.count == 0) {
|
||||
itemstack.a(this.a);
|
||||
this.a.Q();
|
||||
}
|
||||
}
|
||||
if (flag && a.b(Block.m[i1])) {
|
||||
Block.m[i1].g(b, j, k, l, j1);
|
||||
|
||||
if (flag && this.a.b(Block.byId[l])) {
|
||||
Block.byId[l].g(this.b, i, j, k, i1);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer, World world, ItemStack itemstack) {
|
||||
int j = itemstack.a;
|
||||
ItemStack itemstack1 = itemstack.a(world, entityplayer);
|
||||
public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) {
|
||||
int i = itemstack.count;
|
||||
ItemStack itemstack1 = itemstack.a(world, entityhuman);
|
||||
|
||||
if (itemstack1 != itemstack || itemstack1 != null && itemstack1.a != j) {
|
||||
entityplayer.an.a[entityplayer.an.c] = itemstack1;
|
||||
if (itemstack1.a == 0) {
|
||||
entityplayer.an.a[entityplayer.an.c] = null;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) {
|
||||
return false;
|
||||
} else {
|
||||
entityhuman.inventory.a[entityhuman.inventory.c] = itemstack1;
|
||||
if (itemstack1.count == 0) {
|
||||
entityhuman.inventory.a[entityhuman.inventory.c] = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer, World world, ItemStack itemstack, int j, int k, int l, int i1) {
|
||||
int j1 = world.a(j, k, l);
|
||||
public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (j1 > 0 && Block.m[j1].a(world, j, k, l, entityplayer)) {
|
||||
return true;
|
||||
}
|
||||
if (itemstack == null) {
|
||||
return false;
|
||||
} else {
|
||||
return itemstack.a(entityplayer, world, j, k, l, i1);
|
||||
}
|
||||
return i1 > 0 && Block.byId[i1].a(world, i, j, k, entityhuman) ? true : (itemstack == null ? false : itemstack.a(entityhuman, world, i, j, k, l));
|
||||
}
|
||||
}
|
||||
|
@ -17,36 +17,38 @@ public class ItemMinecart extends Item {
|
||||
|
||||
public ItemMinecart(int i, int j) {
|
||||
super(i);
|
||||
bb = 1;
|
||||
a = j;
|
||||
this.maxStackSize = 1;
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
int i1 = world.a(i, j, k);
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == Block.aG.bi) {
|
||||
// CraftBukkit start - Minecarts
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (i1 == Block.RAILS.id) {
|
||||
if (!world.isStatic) {
|
||||
|
||||
if (!world.z) {
|
||||
world.a(((Entity) (new EntityMinecart(world, (float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, a))));
|
||||
// CraftBukkit start - Minecarts
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.a((Entity) (new EntityMinecart(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a)));
|
||||
}
|
||||
itemstack.a--;
|
||||
|
||||
--itemstack.count;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -18,51 +18,60 @@ public class ItemRedstone extends Item {
|
||||
super(i);
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit - store the clicked block
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit start - store the clicked block
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
if (l == 0) {
|
||||
j--;
|
||||
}
|
||||
if (l == 1) {
|
||||
j++;
|
||||
}
|
||||
if (l == 2) {
|
||||
k--;
|
||||
}
|
||||
if (l == 3) {
|
||||
k++;
|
||||
}
|
||||
if (l == 4) {
|
||||
i--;
|
||||
}
|
||||
if (l == 5) {
|
||||
i++;
|
||||
}
|
||||
if (!world.e(i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
if (Block.av.a(world, i, j, k)) {
|
||||
// CraftBukkit start - Redstone
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
// CraftBukkit end
|
||||
|
||||
itemstack.a--;
|
||||
world.e(i, j, k, Block.av.bi);
|
||||
if (l == 0) {
|
||||
--j;
|
||||
}
|
||||
|
||||
if (l == 1) {
|
||||
++j;
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
--k;
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
++k;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
--i;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
if (Block.REDSTONE_WIRE.a(world, i, j, k)) {
|
||||
// CraftBukkit start - Redstone
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
--itemstack.count;
|
||||
world.e(i, j, k, Block.REDSTONE_WIRE.id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -18,39 +18,40 @@ public class ItemSeeds extends Item {
|
||||
|
||||
public ItemSeeds(int i, int j) {
|
||||
super(i);
|
||||
a = j;
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
if (l != 1) {
|
||||
return false;
|
||||
}
|
||||
int i1 = world.a(i, j, k);
|
||||
} else {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == Block.aA.bi && world.e(i, j + 1, k)) {
|
||||
// CraftBukkit start - Seeds
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) {
|
||||
// CraftBukkit start - Seeds
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.e(i, j + 1, k, this.a);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.e(i, j + 1, k, a);
|
||||
itemstack.a--;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,68 +15,75 @@ public class ItemSign extends Item {
|
||||
|
||||
public ItemSign(int i) {
|
||||
super(i);
|
||||
bc = 64;
|
||||
bb = 1;
|
||||
this.durability = 64;
|
||||
this.maxStackSize = 1;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
if (l == 0) {
|
||||
return false;
|
||||
}
|
||||
if (!world.c(i, j, k).a()) {
|
||||
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// CraftBukkit - store the clicked block
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
if (l == 1) {
|
||||
j++;
|
||||
}
|
||||
if (l == 2) {
|
||||
k--;
|
||||
}
|
||||
if (l == 3) {
|
||||
k++;
|
||||
}
|
||||
if (l == 4) {
|
||||
i--;
|
||||
}
|
||||
if (l == 5) {
|
||||
i++;
|
||||
}
|
||||
if (!Block.aD.a(world, i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
// Signs
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityplayer == null)?null:(Player)entityplayer.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent pie = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(pie);
|
||||
|
||||
if (pie.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (l == 1) {
|
||||
world.b(i, j, k, Block.aD.bi, MathHelper.b((double) (((entityplayer.v + 180F) * 16F) / 360F) + 0.5D) & 0xf);
|
||||
} else {
|
||||
world.b(i, j, k, Block.aI.bi, l);
|
||||
}
|
||||
itemstack.a--;
|
||||
TileEntitySign tileentitysign = (TileEntitySign) world.m(i, j, k);
|
||||
// CraftBukkit start - store the clicked block
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
//CraftBukkit end
|
||||
|
||||
if (tileentitysign != null) {
|
||||
entityplayer.a(tileentitysign);
|
||||
if (l == 1) {
|
||||
++j;
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
--k;
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
++k;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
--i;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!Block.SIGN_POST.a(world, i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
// Signs
|
||||
Type eventType = Type.PLAYER_ITEM;
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
BlockFace blockface = CraftBlock.notchToBlockFace(1);
|
||||
|
||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockface);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (l == 1) {
|
||||
world.b(i, j, k, Block.SIGN_POST.id, MathHelper.b((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15);
|
||||
} else {
|
||||
world.b(i, j, k, Block.WALL_SIGN.id, l);
|
||||
}
|
||||
|
||||
--itemstack.count;
|
||||
TileEntitySign tileentitysign = (TileEntitySign) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentitysign != null) {
|
||||
entityhuman.a(tileentitysign);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,183 +2,170 @@ package net.minecraft.server;
|
||||
|
||||
public final class ItemStack {
|
||||
|
||||
public int a;
|
||||
public int count;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d; // Craftbukkit - make public
|
||||
public int id;
|
||||
public int damage; // Craftbukkit - make public
|
||||
|
||||
public ItemStack(Block block) {
|
||||
this(block, 1);
|
||||
}
|
||||
|
||||
public ItemStack(Block block, int k) {
|
||||
this(block.bi, k, 0);
|
||||
public ItemStack(Block block, int i) {
|
||||
this(block.id, i, 0);
|
||||
}
|
||||
|
||||
public ItemStack(Block block, int k, int l) {
|
||||
this(block.bi, k, l);
|
||||
public ItemStack(Block block, int i, int j) {
|
||||
this(block.id, i, j);
|
||||
}
|
||||
|
||||
public ItemStack(Item item) {
|
||||
this(item.ba, 1, 0);
|
||||
this(item.id, 1, 0);
|
||||
}
|
||||
|
||||
public ItemStack(Item item, int k) {
|
||||
this(item.ba, k, 0);
|
||||
public ItemStack(Item item, int i) {
|
||||
this(item.id, i, 0);
|
||||
}
|
||||
|
||||
public ItemStack(Item item, int k, int l) {
|
||||
this(item.ba, k, l);
|
||||
public ItemStack(Item item, int i, int j) {
|
||||
this(item.id, i, j);
|
||||
}
|
||||
|
||||
public ItemStack(int k, int l, int i1) {
|
||||
a = 0;
|
||||
c = k;
|
||||
a = l;
|
||||
d = i1;
|
||||
public ItemStack(int i, int j, int k) {
|
||||
this.count = 0;
|
||||
this.id = i;
|
||||
this.count = j;
|
||||
this.damage = k;
|
||||
}
|
||||
|
||||
public ItemStack(NBTTagCompound nbttagcompound) {
|
||||
a = 0;
|
||||
b(nbttagcompound);
|
||||
this.count = 0;
|
||||
this.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public ItemStack a(int k) {
|
||||
a -= k;
|
||||
return new ItemStack(c, k, d);
|
||||
public ItemStack a(int i) {
|
||||
this.count -= i;
|
||||
return new ItemStack(this.id, i, this.damage);
|
||||
}
|
||||
|
||||
public Item a() {
|
||||
return Item.c[c];
|
||||
return Item.byId[this.id];
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer, World world, int k, int l, int i1, int j1) {
|
||||
return a().a(this, entityplayer, world, k, l, i1, j1);
|
||||
public boolean a(EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
return this.a().a(this, entityhuman, world, i, j, k, l);
|
||||
}
|
||||
|
||||
public float a(Block block) {
|
||||
return a().a(this, block);
|
||||
return this.a().a(this, block);
|
||||
}
|
||||
|
||||
public ItemStack a(World world, EntityPlayer entityplayer) {
|
||||
return a().a(this, world, entityplayer);
|
||||
public ItemStack a(World world, EntityHuman entityhuman) {
|
||||
return this.a().a(this, world, entityhuman);
|
||||
}
|
||||
|
||||
public NBTTagCompound a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("id", (short) c);
|
||||
nbttagcompound.a("Count", (byte) a);
|
||||
nbttagcompound.a("Damage", (short) d);
|
||||
nbttagcompound.a("id", (short) this.id);
|
||||
nbttagcompound.a("Count", (byte) this.count);
|
||||
nbttagcompound.a("Damage", (short) this.damage);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
c = ((int) (nbttagcompound.c("id")));
|
||||
a = ((int) (nbttagcompound.b("Count")));
|
||||
d = ((int) (nbttagcompound.c("Damage")));
|
||||
this.id = nbttagcompound.c("id");
|
||||
this.count = nbttagcompound.b("Count");
|
||||
this.damage = nbttagcompound.c("Damage");
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return a().b();
|
||||
return this.a().b();
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return b() > 1 && (!d() || !f());
|
||||
return this.b() > 1 && (!this.d() || !this.f());
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return Item.c[c].d() > 0;
|
||||
return Item.byId[this.id].d() > 0;
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
return Item.c[c].c();
|
||||
return Item.byId[this.id].c();
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
return d() && d > 0;
|
||||
return this.d() && this.damage > 0;
|
||||
}
|
||||
|
||||
public int g() {
|
||||
return d;
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int h() {
|
||||
return d;
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
return Item.c[c].d();
|
||||
return Item.byId[this.id].d();
|
||||
}
|
||||
|
||||
public void b(int k) {
|
||||
if (!d()) {
|
||||
return;
|
||||
}
|
||||
d += k;
|
||||
if (d > i()) {
|
||||
a--;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
public void b(int i) {
|
||||
if (this.d()) {
|
||||
this.damage += i;
|
||||
if (this.damage > this.i()) {
|
||||
--this.count;
|
||||
if (this.count < 0) {
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
this.damage = 0;
|
||||
}
|
||||
d = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(EntityLiving entityliving) {
|
||||
Item.c[c].a(this, entityliving);
|
||||
Item.byId[this.id].a(this, entityliving);
|
||||
}
|
||||
|
||||
public void a(int k, int l, int i1, int j1) {
|
||||
Item.c[c].a(this, k, l, i1, j1);
|
||||
public void a(int i, int j, int k, int l) {
|
||||
Item.byId[this.id].a(this, i, j, k, l);
|
||||
}
|
||||
|
||||
public int a(Entity entity) {
|
||||
return Item.c[c].a(entity);
|
||||
return Item.byId[this.id].a(entity);
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
return Item.c[c].a(block);
|
||||
return Item.byId[this.id].a(block);
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {}
|
||||
public void a(EntityHuman entityhuman) {}
|
||||
|
||||
public void b(EntityLiving entityliving) {
|
||||
Item.c[c].b(this, entityliving);
|
||||
Item.byId[this.id].b(this, entityliving);
|
||||
}
|
||||
|
||||
public ItemStack j() {
|
||||
return new ItemStack(c, a, d);
|
||||
return new ItemStack(this.id, this.count, this.damage);
|
||||
}
|
||||
|
||||
public static boolean a(ItemStack itemstack, ItemStack itemstack1) {
|
||||
if (itemstack == null && itemstack1 == null) {
|
||||
return true;
|
||||
}
|
||||
if (itemstack == null || itemstack1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
return itemstack.c(itemstack1);
|
||||
}
|
||||
return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.c(itemstack1) : false);
|
||||
}
|
||||
|
||||
private boolean c(ItemStack itemstack) {
|
||||
if (a != itemstack.a) {
|
||||
return false;
|
||||
}
|
||||
if (c != itemstack.c) {
|
||||
return false;
|
||||
}
|
||||
return d == itemstack.d;
|
||||
return this.count != itemstack.count ? false : (this.id != itemstack.id ? false : this.damage == itemstack.damage);
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
return c == itemstack.c && d == itemstack.d;
|
||||
return this.id == itemstack.id && this.damage == itemstack.damage;
|
||||
}
|
||||
|
||||
public static ItemStack b(ItemStack itemstack) {
|
||||
return itemstack != null ? itemstack.j() : null;
|
||||
return itemstack == null ? null : itemstack.j();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return (new StringBuilder()).append(a).append("x").append(Item.c[c].a()).append("@").append(d).toString();
|
||||
return this.count + "x" + Item.byId[this.id].a() + "@" + this.damage;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,14 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -27,184 +26,187 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
public PropertyManager d;
|
||||
public WorldServer e;
|
||||
public ServerConfigurationManager f;
|
||||
private boolean o;
|
||||
public boolean g;
|
||||
int h;
|
||||
private boolean o = true;
|
||||
public boolean g = false;
|
||||
int h = 0;
|
||||
public String i;
|
||||
public int j;
|
||||
private List p;
|
||||
private List q;
|
||||
private List p = new ArrayList();
|
||||
private List q = Collections.synchronizedList(new ArrayList());
|
||||
public EntityTracker k;
|
||||
public boolean l;
|
||||
public boolean m;
|
||||
public boolean n;
|
||||
|
||||
public CraftServer server; // CraftBukkit
|
||||
public OptionSet options; // CraftBukkit
|
||||
|
||||
// CraftBukkit: Added arg "OptionSet options"
|
||||
public MinecraftServer(final OptionSet options) {
|
||||
o = true;
|
||||
g = false;
|
||||
h = 0;
|
||||
p = ((List) (new ArrayList()));
|
||||
q = Collections.synchronizedList(((List) (new ArrayList())));
|
||||
public MinecraftServer() {
|
||||
new ThreadSleepForever(this);
|
||||
|
||||
this.options = options; // CraftBukkit
|
||||
// CraftBukkit start
|
||||
this.options = options;
|
||||
}
|
||||
public CraftServer server;
|
||||
public OptionSet options;
|
||||
|
||||
// CraftBukkit: added throws UnknownHostException
|
||||
private boolean d() throws UnknownHostException {
|
||||
// CraftBukkit end -- added throws UnknownHostException
|
||||
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
|
||||
|
||||
((Thread) (threadcommandreader)).setDaemon(true);
|
||||
((Thread) (threadcommandreader)).start();
|
||||
threadcommandreader.setDaemon(true);
|
||||
threadcommandreader.start();
|
||||
ConsoleLogManager.a();
|
||||
a.info("Starting minecraft server version Beta 1.2_01");
|
||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
|
||||
a.warning("**** NOT ENOUGH RAM!");
|
||||
a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
a.info("Loading properties");
|
||||
d = new PropertyManager(options);
|
||||
String s = d.a("server-ip", "");
|
||||
|
||||
l = d.a("online-mode", true);
|
||||
m = d.a("spawn-animals", true);
|
||||
n = d.a("pvp", true);
|
||||
a.info("Loading properties");
|
||||
this.d = new PropertyManager(new File("server.properties"));
|
||||
String s = this.d.a("server-ip", "");
|
||||
|
||||
this.l = this.d.a("online-mode", true);
|
||||
this.m = this.d.a("spawn-animals", true);
|
||||
this.n = this.d.a("pvp", true);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
if (s.length() > 0) {
|
||||
inetaddress = InetAddress.getByName(s);
|
||||
}
|
||||
int i1 = d.a("server-port", 25565);
|
||||
|
||||
a.info((new StringBuilder()).append("Starting Minecraft server on ").append(s.length() != 0 ? s : "*").append(":").append(i1).toString());
|
||||
int i = this.d.a("server-port", 25565);
|
||||
|
||||
a.info("Starting Minecraft server on " + (s.length() == 0 ? "*" : s) + ":" + i);
|
||||
|
||||
try {
|
||||
c = new NetworkListenThread(this, inetaddress, i1);
|
||||
this.c = new NetworkListenThread(this, inetaddress, i);
|
||||
// CraftBukkit: Be more generic; IOException -> Throwable
|
||||
} catch (Throwable ioexception) {
|
||||
a.warning("**** FAILED TO BIND TO PORT!");
|
||||
a.log(Level.WARNING, (new StringBuilder()).append("The exception was: ").append(ioexception.toString()).toString());
|
||||
a.log(Level.WARNING, "The exception was: " + ioexception.toString());
|
||||
a.warning("Perhaps a server is already running on that port?");
|
||||
return false;
|
||||
}
|
||||
if (!l) {
|
||||
|
||||
if (!this.l) {
|
||||
a.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
a.warning("The server will make no attempt to authenticate usernames. Beware.");
|
||||
a.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
|
||||
}
|
||||
f = new ServerConfigurationManager(this);
|
||||
k = new EntityTracker(this);
|
||||
String s1 = d.a("level-name", "world");
|
||||
|
||||
a.info((new StringBuilder()).append("Preparing level \"").append(s1).append("\"").toString());
|
||||
c(s1);
|
||||
this.f = new ServerConfigurationManager(this);
|
||||
this.k = new EntityTracker(this);
|
||||
String s1 = this.d.a("level-name", "world");
|
||||
|
||||
a.info("Preparing level \"" + s1 + "\"");
|
||||
this.c(s1);
|
||||
a.info("Done! For help, type \"help\" or \"?\"");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void c(String s) {
|
||||
a.info("Preparing start region");
|
||||
e = new WorldServer(this, new File("."), s, d.a("hellworld", false) ? -1 : 0);
|
||||
e.a(((IWorldAccess) (new WorldManager(this))));
|
||||
e.k = d.a("spawn-monsters", true) ? 1 : 0;
|
||||
e.a(d.a("spawn-monsters", true), m);
|
||||
f.a(e);
|
||||
char c1 = '\304';
|
||||
long l1 = System.currentTimeMillis();
|
||||
this.e = new WorldServer(this, new File("."), s, this.d.a("hellworld", false) ? -1 : 0);
|
||||
this.e.a(new WorldManager(this));
|
||||
this.e.k = this.d.a("spawn-monsters", true) ? 1 : 0;
|
||||
this.e.a(this.d.a("spawn-monsters", true), this.m);
|
||||
this.f.a(this.e);
|
||||
short short1 = 196;
|
||||
long i = System.currentTimeMillis();
|
||||
|
||||
for (int i1 = -c1; i1 <= c1 && o; i1 += 16) {
|
||||
for (int j1 = -c1; j1 <= c1 && o; j1 += 16) {
|
||||
long l2 = System.currentTimeMillis();
|
||||
for (int j = -short1; j <= short1 && this.o; j += 16) {
|
||||
for (int k = -short1; k <= short1 && this.o; k += 16) {
|
||||
long l = System.currentTimeMillis();
|
||||
|
||||
if (l2 < l1) {
|
||||
l1 = l2;
|
||||
if (l < i) {
|
||||
i = l;
|
||||
}
|
||||
if (l2 > l1 + 1000L) {
|
||||
int k1 = (c1 * 2 + 1) * (c1 * 2 + 1);
|
||||
int i2 = (i1 + c1) * (c1 * 2 + 1) + (j1 + 1);
|
||||
|
||||
a("Preparing spawn area", (i2 * 100) / k1);
|
||||
l1 = l2;
|
||||
if (l > i + 1000L) {
|
||||
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
|
||||
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
|
||||
|
||||
this.a("Preparing spawn area", j1 * 100 / i1);
|
||||
i = l;
|
||||
}
|
||||
e.A.d(e.m + i1 >> 4, e.o + j1 >> 4);
|
||||
while (e.d() && o) {
|
||||
|
||||
this.e.A.d(this.e.spawnX + j >> 4, this.e.spawnZ + k >> 4);
|
||||
|
||||
while (this.e.d() && this.o) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e();
|
||||
this.e();
|
||||
}
|
||||
|
||||
private void a(String s, int i1) {
|
||||
i = s;
|
||||
j = i1;
|
||||
System.out.println((new StringBuilder()).append(s).append(": ").append(i1).append("%").toString());
|
||||
private void a(String s, int i) {
|
||||
this.i = s;
|
||||
this.j = i;
|
||||
a.info(s + ": " + i + "%");
|
||||
}
|
||||
|
||||
private void e() {
|
||||
i = null;
|
||||
j = 0;
|
||||
this.i = null;
|
||||
this.j = 0;
|
||||
|
||||
server.loadPlugins(); // CraftBukkit
|
||||
}
|
||||
|
||||
private void f() {
|
||||
a.info("Saving chunks");
|
||||
e.a(true, ((IProgressUpdate) (null)));
|
||||
this.e.a(true, (IProgressUpdate) null);
|
||||
}
|
||||
|
||||
private void g() {
|
||||
a.info("Stopping server");
|
||||
if(server != null) {
|
||||
server.disablePlugins();
|
||||
if (this.f != null) {
|
||||
this.f.d();
|
||||
}
|
||||
|
||||
if (f != null) {
|
||||
f.d();
|
||||
}
|
||||
if (e != null) {
|
||||
f();
|
||||
if (this.e != null) {
|
||||
this.f();
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
o = false;
|
||||
this.o = false;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
if (d()) {
|
||||
long l1 = System.currentTimeMillis();
|
||||
long l2 = 0L;
|
||||
if (this.d()) {
|
||||
long i = System.currentTimeMillis();
|
||||
long j = 0L;
|
||||
|
||||
while (o) {
|
||||
long l3 = System.currentTimeMillis();
|
||||
long l4 = l3 - l1;
|
||||
while (this.o) {
|
||||
long k = System.currentTimeMillis();
|
||||
long l = k - i;
|
||||
|
||||
if (l4 > 2000L) {
|
||||
a.warning("Can't keep up! Did the system time change, or is the server overloaded?");
|
||||
l4 = 2000L;
|
||||
if (l > 2000L) {
|
||||
a.warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
|
||||
l = 2000L;
|
||||
}
|
||||
if (l4 < 0L) {
|
||||
|
||||
if (l < 0L) {
|
||||
a.warning("Time ran backwards! Did the system time change?");
|
||||
l4 = 0L;
|
||||
l = 0L;
|
||||
}
|
||||
l2 += l4;
|
||||
l1 = l3;
|
||||
while (l2 > 50L) {
|
||||
l2 -= 50L;
|
||||
h();
|
||||
|
||||
j += l;
|
||||
i = k;
|
||||
|
||||
while (j > 50L) {
|
||||
j -= 50L;
|
||||
this.h();
|
||||
}
|
||||
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
} else {
|
||||
while (o) {
|
||||
b();
|
||||
while (this.o) {
|
||||
this.b();
|
||||
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
} catch (InterruptedException interruptedexception) {
|
||||
@ -214,9 +216,11 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
a.log(Level.SEVERE, "Unexpected exception", ((Throwable) (exception)));
|
||||
while (o) {
|
||||
b();
|
||||
a.log(Level.SEVERE, "Unexpected exception", exception);
|
||||
|
||||
while (this.o) {
|
||||
this.b();
|
||||
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
} catch (InterruptedException interruptedexception1) {
|
||||
@ -225,8 +229,8 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
g();
|
||||
g = true;
|
||||
this.g();
|
||||
this.g = true;
|
||||
} finally {
|
||||
System.exit(0);
|
||||
}
|
||||
@ -235,62 +239,217 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
|
||||
private void h() {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = b.keySet().iterator();
|
||||
|
||||
for (Iterator iterator = b.keySet().iterator(); iterator.hasNext();) {
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
int k1 = ((Integer) b.get(((s)))).intValue();
|
||||
int i = ((Integer) b.get(s)).intValue();
|
||||
|
||||
if (k1 > 0) {
|
||||
b.put(((s)), ((Integer.valueOf(k1 - 1))));
|
||||
if (i > 0) {
|
||||
b.put(s, Integer.valueOf(i - 1));
|
||||
} else {
|
||||
((List) (arraylist)).add(((s)));
|
||||
arraylist.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < ((List) (arraylist)).size(); i1++) {
|
||||
b.remove(((List) (arraylist)).get(i1));
|
||||
int j;
|
||||
|
||||
for (j = 0; j < arraylist.size(); ++j) {
|
||||
b.remove(arraylist.get(j));
|
||||
}
|
||||
|
||||
AxisAlignedBB.a();
|
||||
Vec3D.a();
|
||||
h++;
|
||||
if (h % 20 == 0) {
|
||||
f.a(((Packet) (new Packet4UpdateTime(e.e))));
|
||||
++this.h;
|
||||
if (this.h % 20 == 0) {
|
||||
this.f.a((Packet) (new Packet4UpdateTime(this.e.e)));
|
||||
}
|
||||
e.f();
|
||||
while (e.d()) {
|
||||
|
||||
this.e.f();
|
||||
|
||||
while (this.e.d()) {
|
||||
;
|
||||
}
|
||||
e.c();
|
||||
c.a();
|
||||
f.b();
|
||||
k.a();
|
||||
for (int j1 = 0; j1 < p.size(); j1++) {
|
||||
((IUpdatePlayerListBox) p.get(j1)).a();
|
||||
|
||||
this.e.c();
|
||||
this.c.a();
|
||||
this.f.b();
|
||||
this.k.a();
|
||||
|
||||
for (j = 0; j < this.p.size(); ++j) {
|
||||
((IUpdatePlayerListBox) this.p.get(j)).a();
|
||||
}
|
||||
|
||||
try {
|
||||
b();
|
||||
this.b();
|
||||
} catch (Exception exception) {
|
||||
a.log(Level.WARNING, "Unexpected exception while parsing console command", ((Throwable) (exception)));
|
||||
a.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String s, ICommandListener icommandlistener) {
|
||||
q.add(((new ServerCommand(s, icommandlistener))));
|
||||
this.q.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void b() {
|
||||
do {
|
||||
if (q.size() <= 0) {
|
||||
break;
|
||||
}
|
||||
ServerCommand servercommand = (ServerCommand) q.remove(0);
|
||||
while (this.q.size() > 0) {
|
||||
ServerCommand servercommand = (ServerCommand) this.q.remove(0);
|
||||
String s = servercommand.a;
|
||||
ICommandListener icommandlistener = servercommand.b;
|
||||
String s1 = icommandlistener.c();
|
||||
|
||||
if (s.toLowerCase().startsWith("#help") || s.toLowerCase().startsWith("#?")) {
|
||||
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
||||
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..");
|
||||
this.e.a(true, (IProgressUpdate) null);
|
||||
this.a(s1, "Save complete.");
|
||||
} else if (s.toLowerCase().startsWith("save-off")) {
|
||||
this.a(s1, "Disabling level saving..");
|
||||
this.e.C = true;
|
||||
} else if (s.toLowerCase().startsWith("save-on")) {
|
||||
this.a(s1, "Enabling level saving..");
|
||||
this.e.C = false;
|
||||
} 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, "§eYou are now op!");
|
||||
} else if (s.toLowerCase().startsWith("deop ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.f(s2);
|
||||
this.f.a(s2, "§eYou 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("§d[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 = "§7" + 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:");
|
||||
@ -311,181 +470,39 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
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");
|
||||
} else if (s.toLowerCase().startsWith("#list")) {
|
||||
icommandlistener.b((new StringBuilder()).append("Connected players: ").append(f.c()).toString());
|
||||
} else if (s.toLowerCase().startsWith("#stop")) {
|
||||
a(s1, "Stopping the server..");
|
||||
o = false;
|
||||
} else if (s.toLowerCase().startsWith("#save-all")) {
|
||||
a(s1, "Forcing save..");
|
||||
e.a(true, ((IProgressUpdate) (null)));
|
||||
a(s1, "Save complete.");
|
||||
} else if (s.toLowerCase().startsWith("#save-off")) {
|
||||
a(s1, "Disabling level saving..");
|
||||
e.C = true;
|
||||
} else if (s.toLowerCase().startsWith("#save-on")) {
|
||||
a(s1, "Enabling level saving..");
|
||||
e.C = false;
|
||||
} else if (s.toLowerCase().startsWith("#op ")) {
|
||||
String s2 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.e(s2);
|
||||
a(s1, (new StringBuilder()).append("Opping ").append(s2).toString());
|
||||
f.a(s2, "\247eYou are now op!");
|
||||
} else if (s.toLowerCase().startsWith("#deop ")) {
|
||||
String s3 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.f(s3);
|
||||
f.a(s3, "\247eYou are no longer op!");
|
||||
a(s1, (new StringBuilder()).append("De-opping ").append(s3).toString());
|
||||
} else if (s.toLowerCase().startsWith("#ban-ip ")) {
|
||||
String s4 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.c(s4);
|
||||
a(s1, (new StringBuilder()).append("Banning ip ").append(s4).toString());
|
||||
} else if (s.toLowerCase().startsWith("#pardon-ip ")) {
|
||||
String s5 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.d(s5);
|
||||
a(s1, (new StringBuilder()).append("Pardoning ip ").append(s5).toString());
|
||||
} else if (s.toLowerCase().startsWith("#ban ")) {
|
||||
String s6 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.a(s6);
|
||||
a(s1, (new StringBuilder()).append("Banning ").append(s6).toString());
|
||||
EntityPlayerMP entityplayermp = f.h(s6);
|
||||
|
||||
if (entityplayermp != null) {
|
||||
entityplayermp.a.a("Banned by admin");
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("#pardon ")) {
|
||||
String s7 = s.substring(s.indexOf(" ")).trim();
|
||||
|
||||
f.b(s7);
|
||||
a(s1, (new StringBuilder()).append("Pardoning ").append(s7).toString());
|
||||
} else if (s.toLowerCase().startsWith("#kick ")) {
|
||||
String s8 = s.substring(s.indexOf(" ")).trim();
|
||||
EntityPlayerMP entityplayermp1 = null;
|
||||
|
||||
for (int i1 = 0; i1 < f.b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp5 = (EntityPlayerMP) f.b.get(i1);
|
||||
|
||||
if (entityplayermp5.aw.equalsIgnoreCase(s8)) {
|
||||
entityplayermp1 = entityplayermp5;
|
||||
}
|
||||
}
|
||||
|
||||
if (entityplayermp1 != null) {
|
||||
entityplayermp1.a.a("Kicked by admin");
|
||||
a(s1, (new StringBuilder()).append("Kicking ").append(entityplayermp1.aw).toString());
|
||||
} else {
|
||||
icommandlistener.b((new StringBuilder()).append("Can't find user ").append(s8).append(". No kick.").toString());
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("#tp ")) {
|
||||
String as[] = s.split(" ");
|
||||
|
||||
if (as.length == 3) {
|
||||
EntityPlayerMP entityplayermp2 = f.h(as[1]);
|
||||
EntityPlayerMP entityplayermp3 = f.h(as[2]);
|
||||
|
||||
if (entityplayermp2 == null) {
|
||||
icommandlistener.b((new StringBuilder()).append("Can't find user ").append(as[1]).append(". No tp.").toString());
|
||||
} else if (entityplayermp3 == null) {
|
||||
icommandlistener.b((new StringBuilder()).append("Can't find user ").append(as[2]).append(". No tp.").toString());
|
||||
} else {
|
||||
entityplayermp2.a.a(entityplayermp3.p, entityplayermp3.q, entityplayermp3.r, entityplayermp3.v, entityplayermp3.w);
|
||||
a(s1, (new StringBuilder()).append("Teleporting ").append(as[1]).append(" to ").append(as[2]).append(".").toString());
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("Syntax error, please provice a source and a target.");
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("#give ")) {
|
||||
String as1[] = s.split(" ");
|
||||
|
||||
if (as1.length != 3 && as1.length != 4) {
|
||||
return;
|
||||
}
|
||||
String s9 = as1[1];
|
||||
EntityPlayerMP entityplayermp4 = f.h(s9);
|
||||
|
||||
if (entityplayermp4 != null) {
|
||||
try {
|
||||
int j1 = Integer.parseInt(as1[2]);
|
||||
|
||||
if (Item.c[j1] != null) {
|
||||
a(s1, (new StringBuilder()).append("Giving ").append(entityplayermp4.aw).append(" some ").append(j1).toString());
|
||||
int k1 = 1;
|
||||
|
||||
if (as1.length > 3) {
|
||||
k1 = b(as1[3], 1);
|
||||
}
|
||||
if (k1 < 1) {
|
||||
k1 = 1;
|
||||
}
|
||||
if (k1 > 64) {
|
||||
k1 = 64;
|
||||
}
|
||||
entityplayermp4.b(new ItemStack(j1, k1, 0));
|
||||
} else {
|
||||
icommandlistener.b((new StringBuilder()).append("There's no item with id ").append(j1).toString());
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
icommandlistener.b((new StringBuilder()).append("There's no item with id ").append(as1[2]).toString());
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b((new StringBuilder()).append("Can't find user ").append(s9).toString());
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("#say ")) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info((new StringBuilder()).append("[").append(s1).append("] ").append(s).toString());
|
||||
f.a(((Packet) (new Packet3Chat((new StringBuilder()).append("\247d[Server] ").append(s).toString()))));
|
||||
} else if (s.toLowerCase().startsWith("#tell ")) {
|
||||
String as2[] = s.split(" ");
|
||||
|
||||
if (as2.length >= 3) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info((new StringBuilder()).append("[").append(s1).append("->").append(as2[1]).append("] ").append(s).toString());
|
||||
s = (new StringBuilder()).append("\2477").append(s1).append(" whispers ").append(s).toString();
|
||||
a.info(s);
|
||||
if (!f.a(as2[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.");
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String s, String s1) {
|
||||
String s2 = (new StringBuilder()).append(s).append(": ").append(s1).toString();
|
||||
String s2 = s + ": " + s1;
|
||||
|
||||
f.i((new StringBuilder()).append("\2477(").append(s2).append(")").toString());
|
||||
this.f.i("§7(" + s2 + ")");
|
||||
a.info(s2);
|
||||
}
|
||||
|
||||
private int b(String s, int i1) {
|
||||
private int b(String s, int i) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return i1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
|
||||
p.add(((iupdateplayerlistbox)));
|
||||
this.p.add(iupdateplayerlistbox);
|
||||
}
|
||||
|
||||
// Craftbukkit start - replaces main(String args[])
|
||||
public static void main(final OptionSet options) {
|
||||
try {
|
||||
MinecraftServer minecraftserver = new MinecraftServer();
|
||||
|
||||
// CraftBukkit - remove gui
|
||||
MinecraftServer minecraftserver = new MinecraftServer(options);
|
||||
|
||||
(new ThreadServerApplication("Server thread", minecraftserver)).start();
|
||||
} catch (Exception exception) {
|
||||
a.log(Level.SEVERE, "Failed to start the minecraft server", ((Throwable) (exception)));
|
||||
a.log(Level.SEVERE, "Failed to start the minecraft server", exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,6 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -10,26 +12,25 @@ import joptsimple.OptionSet; // CraftBukkit
|
||||
public class PropertyManager {
|
||||
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
private Properties b;
|
||||
private Properties b = new Properties();
|
||||
private File c;
|
||||
|
||||
public PropertyManager(File file) {
|
||||
b = new Properties();
|
||||
c = file;
|
||||
if (file.exists()) {
|
||||
public PropertyManager(File file1) {
|
||||
this.c = file1;
|
||||
if (file1.exists()) {
|
||||
try {
|
||||
b.load(((java.io.InputStream) (new FileInputStream(file))));
|
||||
this.b.load(new FileInputStream(file1));
|
||||
} catch (Exception exception) {
|
||||
a.log(Level.WARNING, (new StringBuilder()).append("Failed to load ").append(((file))).toString(), ((Throwable) (exception)));
|
||||
a();
|
||||
a.log(Level.WARNING, "Failed to load " + file1, exception);
|
||||
this.a();
|
||||
}
|
||||
} else {
|
||||
a.log(Level.WARNING, (new StringBuilder()).append(((file))).append(" does not exist").toString());
|
||||
a();
|
||||
a.log(Level.WARNING, file1 + " does not exist");
|
||||
this.a();
|
||||
}
|
||||
}
|
||||
|
||||
// Craftbukkit start
|
||||
// CraftBukkit start
|
||||
private OptionSet options = null;
|
||||
|
||||
public PropertyManager(final OptionSet options) {
|
||||
@ -45,45 +46,48 @@ public class PropertyManager {
|
||||
|
||||
return value;
|
||||
}
|
||||
// Craftbukkit end
|
||||
// CraftBukkit end
|
||||
|
||||
public void a() {
|
||||
a.log(Level.INFO, "Generating new properties file");
|
||||
b();
|
||||
this.b();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
try {
|
||||
b.store(((java.io.OutputStream) (new FileOutputStream(c))), "Minecraft server properties");
|
||||
this.b.store(new FileOutputStream(this.c), "Minecraft server properties");
|
||||
} catch (Exception exception) {
|
||||
a.log(Level.WARNING, (new StringBuilder()).append("Failed to save ").append(((c))).toString(), ((Throwable) (exception)));
|
||||
a();
|
||||
a.log(Level.WARNING, "Failed to save " + this.c, exception);
|
||||
this.a();
|
||||
}
|
||||
}
|
||||
|
||||
public String a(String s, String s1) {
|
||||
if (!b.containsKey(((s)))) {
|
||||
b.setProperty(s, getOverride(s, s1)); // Craftbukkit
|
||||
b();
|
||||
if (!this.b.containsKey(s)) {
|
||||
this.b.setProperty(s, getOverride(s, s1)); // CraftBukkit
|
||||
this.b();
|
||||
}
|
||||
return getOverride(s, b.getProperty(s, s1)); // Craftbukkit
|
||||
|
||||
return getOverride(s, this.b.getProperty(s, s1)); // CraftBukkit
|
||||
}
|
||||
|
||||
public int a(String s, int i) {
|
||||
try {
|
||||
return getOverride(s, Integer.parseInt(a(s, String.valueOf(i)))); // Craftbukkit
|
||||
return getOverride(s, Integer.parseInt(this.a(s, "" + i))); // CraftBukkit
|
||||
} catch (Exception exception) {
|
||||
b.setProperty(s, getOverride(s, i).toString()); // Craftbukkit
|
||||
i = getOverride(s, i); // CraftBukkit
|
||||
this.b.setProperty(s, "" + i);
|
||||
return i;
|
||||
}
|
||||
return getOverride(s, i); // Craftbukkit
|
||||
}
|
||||
|
||||
public boolean a(String s, boolean flag) {
|
||||
try {
|
||||
return getOverride(s, Boolean.parseBoolean(a(s, String.valueOf(flag)))); // Craftbukkit
|
||||
return getOverride(s, Boolean.parseBoolean(this.a(s, "" + flag))); // CraftBukkit
|
||||
} catch (Exception exception) {
|
||||
b.setProperty(s, getOverride(s, flag).toString()); // Craftbukkit
|
||||
flag = getOverride(s, flag); // CraftBukkit
|
||||
this.b.setProperty(s, "" + flag);
|
||||
return flag;
|
||||
}
|
||||
return getOverride(s, flag); // Craftbukkit
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,15 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -16,100 +24,89 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
public class ServerConfigurationManager {
|
||||
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
public List b;
|
||||
public List b = new ArrayList();
|
||||
private MinecraftServer c;
|
||||
private PlayerManager d;
|
||||
private int e;
|
||||
private Set f;
|
||||
private Set g;
|
||||
private Set h;
|
||||
private Set f = new HashSet();
|
||||
private Set g = new HashSet();
|
||||
private Set h = new HashSet();
|
||||
private File i;
|
||||
private File j;
|
||||
private File k;
|
||||
private PlayerNBTManager l;
|
||||
|
||||
private CraftServer server; // CraftBukkit
|
||||
|
||||
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
||||
// CraftBukkit 2 lines!
|
||||
minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||
server = minecraftserver.server;
|
||||
|
||||
b = ((List) (new ArrayList()));
|
||||
f = ((Set) (new HashSet()));
|
||||
g = ((Set) (new HashSet()));
|
||||
h = ((Set) (new HashSet()));
|
||||
c = minecraftserver;
|
||||
i = minecraftserver.a("banned-players.txt");
|
||||
j = minecraftserver.a("banned-ips.txt");
|
||||
k = minecraftserver.a("ops.txt");
|
||||
d = new PlayerManager(minecraftserver);
|
||||
e = minecraftserver.d.a("max-players", 20);
|
||||
e();
|
||||
g();
|
||||
i();
|
||||
f();
|
||||
h();
|
||||
j();
|
||||
this.c = minecraftserver;
|
||||
this.i = minecraftserver.a("banned-players.txt");
|
||||
this.j = minecraftserver.a("banned-ips.txt");
|
||||
this.k = minecraftserver.a("ops.txt");
|
||||
this.d = new PlayerManager(minecraftserver);
|
||||
this.e = minecraftserver.d.a("max-players", 20);
|
||||
this.e();
|
||||
this.g();
|
||||
this.i();
|
||||
this.f();
|
||||
this.h();
|
||||
this.j();
|
||||
}
|
||||
|
||||
public void a(WorldServer worldserver) {
|
||||
l = new PlayerNBTManager(new File(worldserver.t, "players"));
|
||||
this.l = new PlayerNBTManager(new File(worldserver.t, "players"));
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return d.b();
|
||||
return this.d.b();
|
||||
}
|
||||
|
||||
public void a(EntityPlayerMP entityplayermp) {
|
||||
b.add(((entityplayermp)));
|
||||
l.b(entityplayermp);
|
||||
c.e.A.d((int) entityplayermp.p >> 4, (int) entityplayermp.r >> 4);
|
||||
for (; c.e.a(((Entity) (entityplayermp)), entityplayermp.z).size() != 0; entityplayermp.a(entityplayermp.p, entityplayermp.q + 1.0D, entityplayermp.r)) {
|
||||
;
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
this.b.add(entityplayer);
|
||||
this.l.b(entityplayer);
|
||||
this.c.e.A.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
|
||||
while (this.c.e.a(entityplayer, entityplayer.boundingBox).size() != 0) {
|
||||
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
|
||||
}
|
||||
c.e.a(((Entity) (entityplayermp)));
|
||||
d.a(entityplayermp);
|
||||
|
||||
// CraftBukkit
|
||||
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayermp)));
|
||||
this.c.e.a(entityplayer);
|
||||
this.d.a(entityplayer);
|
||||
}
|
||||
|
||||
public void b(EntityPlayerMP entityplayermp) {
|
||||
d.c(entityplayermp);
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
this.d.c(entityplayer);
|
||||
}
|
||||
|
||||
public void c(EntityPlayerMP entityplayermp) {
|
||||
l.a(entityplayermp);
|
||||
c.e.d(((Entity) (entityplayermp)));
|
||||
b.remove(((entityplayermp)));
|
||||
d.b(entityplayermp);
|
||||
public void c(EntityPlayer entityplayer) {
|
||||
this.l.a(entityplayer);
|
||||
this.c.e.d(entityplayer);
|
||||
this.b.remove(entityplayer);
|
||||
this.d.b(entityplayer);
|
||||
|
||||
// CraftBukkit
|
||||
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayermp)));
|
||||
// CraftBukkit start
|
||||
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayer))); // CraftBukkit
|
||||
}
|
||||
private CraftServer server;
|
||||
// CraftBukkit end
|
||||
|
||||
public EntityPlayerMP a(NetLoginHandler netloginhandler, String s, String s1) {
|
||||
public EntityPlayer a(NetLoginHandler netloginhandler, String s, String s1) {
|
||||
// CraftBukkit start - note: this entire method needs to be changed
|
||||
// Instead of kicking then returning, we need to store the kick reason
|
||||
// in the event, check with plugins to see if it's ok, and THEN kick
|
||||
// depending on the outcome.
|
||||
EntityPlayerMP entity = new EntityPlayerMP(c, ((World) (c.e)), s, new ItemInWorldManager(((World) (c.e))));
|
||||
Player player = (entity == null)?null:(Player)entity.getBukkitEntity();
|
||||
EntityPlayer entity = new EntityPlayer(c, ((World) (c.e)), s, new ItemInWorldManager(((World) (c.e))));
|
||||
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
PlayerLoginEvent event = new PlayerLoginEvent(Type.PLAYER_LOGIN, player);
|
||||
// CraftBukkit end
|
||||
|
||||
String s2 = ((netloginhandler.b.b())).toString();
|
||||
String s2 = netloginhandler.b.b().toString();
|
||||
|
||||
s2 = s2.substring(s2.indexOf("/") + 1);
|
||||
s2 = s2.substring(0, s2.indexOf(":"));
|
||||
|
||||
// CraftBukkit start
|
||||
if (f.contains(s.trim().toLowerCase())) {
|
||||
if (this.f.contains(s.trim().toLowerCase())) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
|
||||
} else if (g.contains(s2)) {
|
||||
} else if (this.g.contains(s2)) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
|
||||
} else if (b.size() >= e) {
|
||||
} else if (this.b.size() >= this.e) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
|
||||
}
|
||||
|
||||
@ -118,201 +115,213 @@ public class ServerConfigurationManager {
|
||||
netloginhandler.a(event.getKickMessage());
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
|
||||
|
||||
if (entityplayermp.aw.equalsIgnoreCase(s)) {
|
||||
entityplayermp.a.a("You logged in from another location");
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (entityplayer.name.equalsIgnoreCase(s)) {
|
||||
entityplayer.a.a("You logged in from another location");
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit
|
||||
return entity;
|
||||
return new EntityPlayer(this.c, this.c.e, s, new ItemInWorldManager(this.c.e));
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityPlayerMP d(EntityPlayerMP entityplayermp) {
|
||||
c.k.a(entityplayermp);
|
||||
c.k.b(((Entity) (entityplayermp)));
|
||||
d.b(entityplayermp);
|
||||
b.remove(((entityplayermp)));
|
||||
c.e.e(((Entity) (entityplayermp)));
|
||||
EntityPlayerMP entityplayermp1 = new EntityPlayerMP(c, ((World) (c.e)), entityplayermp.aw, new ItemInWorldManager(((World) (c.e))));
|
||||
public EntityPlayer d(EntityPlayer entityplayer) {
|
||||
this.c.k.a(entityplayer);
|
||||
this.c.k.b(entityplayer);
|
||||
this.d.b(entityplayer);
|
||||
this.b.remove(entityplayer);
|
||||
this.c.e.e(entityplayer);
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.c, this.c.e, entityplayer.name, new ItemInWorldManager(this.c.e));
|
||||
|
||||
entityplayermp1.g = entityplayermp.g;
|
||||
entityplayermp1.a = entityplayermp.a;
|
||||
c.e.A.d((int) entityplayermp1.p >> 4, (int) entityplayermp1.r >> 4);
|
||||
for (; c.e.a(((Entity) (entityplayermp1)), entityplayermp1.z).size() != 0; entityplayermp1.a(entityplayermp1.p, entityplayermp1.q + 1.0D, entityplayermp1.r)) {
|
||||
;
|
||||
entityplayer1.id = entityplayer.id;
|
||||
entityplayer1.a = entityplayer.a;
|
||||
this.c.e.A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
|
||||
while (this.c.e.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
||||
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
||||
}
|
||||
entityplayermp1.a.b(((Packet) (new Packet9())));
|
||||
entityplayermp1.a.a(entityplayermp1.p, entityplayermp1.q, entityplayermp1.r, entityplayermp1.v, entityplayermp1.w);
|
||||
d.a(entityplayermp1);
|
||||
c.e.a(((Entity) (entityplayermp1)));
|
||||
b.add(((entityplayermp1)));
|
||||
entityplayermp1.l();
|
||||
return entityplayermp1;
|
||||
|
||||
entityplayer1.a.b((Packet) (new Packet9Respawn()));
|
||||
entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
|
||||
this.d.a(entityplayer1);
|
||||
this.c.e.a(entityplayer1);
|
||||
this.b.add(entityplayer1);
|
||||
entityplayer1.l();
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
d.a();
|
||||
this.d.a();
|
||||
}
|
||||
|
||||
public void a(int i1, int j1, int k1) {
|
||||
d.a(i1, j1, k1);
|
||||
public void a(int i, int j, int k) {
|
||||
this.d.a(i, j, k);
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
entityplayermp.a.b(packet);
|
||||
entityplayer.a.b(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public String c() {
|
||||
String s = "";
|
||||
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
if (i1 > 0) {
|
||||
s = (new StringBuilder()).append(s).append(", ").toString();
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
if (i > 0) {
|
||||
s = s + ", ";
|
||||
}
|
||||
s = (new StringBuilder()).append(s).append(((EntityPlayerMP) b.get(i1)).aw).toString();
|
||||
|
||||
s = s + ((EntityPlayer) this.b.get(i)).name;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
f.add(((s.toLowerCase())));
|
||||
f();
|
||||
this.f.add(s.toLowerCase());
|
||||
this.f();
|
||||
}
|
||||
|
||||
public void b(String s) {
|
||||
f.remove(((s.toLowerCase())));
|
||||
f();
|
||||
this.f.remove(s.toLowerCase());
|
||||
this.f();
|
||||
}
|
||||
|
||||
private void e() {
|
||||
try {
|
||||
f.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(i))));
|
||||
this.f.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.i));
|
||||
String s = "";
|
||||
|
||||
for (String s = ""; (s = bufferedreader.readLine()) != null;) {
|
||||
f.add(((s.trim().toLowerCase())));
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
this.f.add(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
bufferedreader.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to load ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to load ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void f() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(i, false))));
|
||||
String s;
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.i, false));
|
||||
Iterator iterator = this.f.iterator();
|
||||
|
||||
for (Iterator iterator = f.iterator(); iterator.hasNext(); printwriter.println(s)) {
|
||||
s = (String) iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
|
||||
printwriter.println(s);
|
||||
}
|
||||
|
||||
printwriter.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to save ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to save ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(String s) {
|
||||
g.add(((s.toLowerCase())));
|
||||
h();
|
||||
this.g.add(s.toLowerCase());
|
||||
this.h();
|
||||
}
|
||||
|
||||
public void d(String s) {
|
||||
g.remove(((s.toLowerCase())));
|
||||
h();
|
||||
this.g.remove(s.toLowerCase());
|
||||
this.h();
|
||||
}
|
||||
|
||||
private void g() {
|
||||
try {
|
||||
g.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(j))));
|
||||
this.g.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
|
||||
String s = "";
|
||||
|
||||
for (String s = ""; (s = bufferedreader.readLine()) != null;) {
|
||||
g.add(((s.trim().toLowerCase())));
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
this.g.add(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
bufferedreader.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to load ip ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void h() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(j, false))));
|
||||
String s;
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
|
||||
Iterator iterator = this.g.iterator();
|
||||
|
||||
for (Iterator iterator = g.iterator(); iterator.hasNext(); printwriter.println(s)) {
|
||||
s = (String) iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
|
||||
printwriter.println(s);
|
||||
}
|
||||
|
||||
printwriter.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to save ip ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(String s) {
|
||||
h.add(((s.toLowerCase())));
|
||||
j();
|
||||
this.h.add(s.toLowerCase());
|
||||
this.j();
|
||||
}
|
||||
|
||||
public void f(String s) {
|
||||
h.remove(((s.toLowerCase())));
|
||||
j();
|
||||
this.h.remove(s.toLowerCase());
|
||||
this.j();
|
||||
}
|
||||
|
||||
private void i() {
|
||||
try {
|
||||
h.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new FileReader(k))));
|
||||
this.h.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
|
||||
String s = "";
|
||||
|
||||
for (String s = ""; (s = bufferedreader.readLine()) != null;) {
|
||||
h.add(((s.trim().toLowerCase())));
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
this.h.add(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
bufferedreader.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to load ip ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to load ip ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void j() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(((java.io.Writer) (new FileWriter(k, false))));
|
||||
String s;
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
|
||||
Iterator iterator = this.h.iterator();
|
||||
|
||||
for (Iterator iterator = h.iterator(); iterator.hasNext(); printwriter.println(s)) {
|
||||
s = (String) iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
|
||||
printwriter.println(s);
|
||||
}
|
||||
|
||||
printwriter.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning((new StringBuilder()).append("Failed to save ip ban list: ").append(((exception))).toString());
|
||||
a.warning("Failed to save ip ban list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean g(String s) {
|
||||
return h.contains(((s.trim().toLowerCase())));
|
||||
return this.h.contains(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
public EntityPlayerMP h(String s) {
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
|
||||
public EntityPlayer h(String s) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (entityplayermp.aw.equalsIgnoreCase(s)) {
|
||||
return entityplayermp;
|
||||
if (entityplayer.name.equalsIgnoreCase(s)) {
|
||||
return entityplayer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,22 +329,22 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void a(String s, String s1) {
|
||||
EntityPlayerMP entityplayermp = h(s);
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
|
||||
if (entityplayermp != null) {
|
||||
entityplayermp.a.b(((Packet) (new Packet3Chat(s1))));
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b((Packet) (new Packet3Chat(s1)));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(double d1, double d2, double d3, double d4, Packet packet) {
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
|
||||
double d5 = d1 - entityplayermp.p;
|
||||
double d6 = d2 - entityplayermp.q;
|
||||
double d7 = d3 - entityplayermp.r;
|
||||
public void a(double d0, double d1, double d2, double d3, Packet packet) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
double d4 = d0 - entityplayer.locX;
|
||||
double d5 = d1 - entityplayer.locY;
|
||||
double d6 = d2 - entityplayer.locZ;
|
||||
|
||||
if (d5 * d5 + d6 * d6 + d7 * d7 < d4 * d4) {
|
||||
entityplayermp.a.b(packet);
|
||||
if (d4 * d4 + d5 * d5 + d6 * d6 < d3 * d3) {
|
||||
entityplayer.a.b(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -343,20 +352,20 @@ public class ServerConfigurationManager {
|
||||
public void i(String s) {
|
||||
Packet3Chat packet3chat = new Packet3Chat(s);
|
||||
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) b.get(i1);
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (g(entityplayermp.aw)) {
|
||||
entityplayermp.a.b(((Packet) (packet3chat)));
|
||||
if (this.g(entityplayer.name)) {
|
||||
entityplayer.a.b((Packet) packet3chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(String s, Packet packet) {
|
||||
EntityPlayerMP entityplayermp = h(s);
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
|
||||
if (entityplayermp != null) {
|
||||
entityplayermp.a.b(packet);
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b(packet);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -364,10 +373,10 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void d() {
|
||||
for (int i1 = 0; i1 < b.size(); i1++) {
|
||||
l.a((EntityPlayerMP) b.get(i1));
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
this.l.a((EntityPlayer) this.b.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i1, int j1, int k1, TileEntity tileentity) {}
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ public class Slot {
|
||||
public int e;
|
||||
|
||||
public Slot(IInventory iinventory, int i, int j, int k) {
|
||||
b = iinventory;
|
||||
a = i;
|
||||
d = j;
|
||||
e = k;
|
||||
this.b = iinventory;
|
||||
this.a = i;
|
||||
this.d = j;
|
||||
this.e = k;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
d();
|
||||
this.d();
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
@ -24,27 +24,27 @@ public class Slot {
|
||||
}
|
||||
|
||||
public ItemStack c() {
|
||||
return b.a(a);
|
||||
return this.b.a(this.a);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
b.a(a, itemstack);
|
||||
d();
|
||||
this.b.a(this.a, itemstack);
|
||||
this.d();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
b.d();
|
||||
this.b.d();
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return b.c();
|
||||
return this.b.c();
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return b.b(a, i);
|
||||
return this.b.b(this.a, i);
|
||||
}
|
||||
|
||||
public boolean a(IInventory iinventory, int i) {
|
||||
return iinventory == b && i == a;
|
||||
return iinventory == this.b && i == this.a;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class ThreadCommandReader extends Thread {
|
||||
|
||||
final MinecraftServer a; /* synthetic field */
|
||||
|
||||
public ThreadCommandReader(MinecraftServer minecraftserver) {
|
||||
super();
|
||||
a = minecraftserver;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
BufferedReader bufferedreader = new BufferedReader(((java.io.Reader) (new InputStreamReader(System.in))));
|
||||
String s = null;
|
||||
|
||||
try {
|
||||
while (!a.g && MinecraftServer.a(a) && (s = bufferedreader.readLine()) != null) {
|
||||
a.a("#" + s, ((ICommandListener) (a)));
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
ioexception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack e[];
|
||||
private ItemStack[] e = new ItemStack[36];
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
@ -10,45 +10,46 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityChest() {
|
||||
e = new ItemStack[36];
|
||||
}
|
||||
public TileEntityChest() {}
|
||||
|
||||
public int h_() {
|
||||
return 27;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return e[i];
|
||||
return this.e[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (e[i] != null) {
|
||||
if (e[i].a <= j) {
|
||||
ItemStack itemstack = e[i];
|
||||
if (this.e[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
e[i] = null;
|
||||
d();
|
||||
if (this.e[i].count <= j) {
|
||||
itemstack = this.e[i];
|
||||
this.e[i] = null;
|
||||
this.d();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.e[i].a(j);
|
||||
if (this.e[i].count == 0) {
|
||||
this.e[i] = null;
|
||||
}
|
||||
|
||||
this.d();
|
||||
return itemstack;
|
||||
}
|
||||
ItemStack itemstack1 = e[i].a(j);
|
||||
|
||||
if (e[i].a == 0) {
|
||||
e[i] = null;
|
||||
}
|
||||
d();
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
e[i] = itemstack;
|
||||
if (itemstack != null && itemstack.a > c()) {
|
||||
itemstack.a = c();
|
||||
this.e[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
}
|
||||
d();
|
||||
|
||||
this.d();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
@ -59,13 +60,14 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
|
||||
e = new ItemStack[h_()];
|
||||
for (int i = 0; i < nbttaglist.b(); i++) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.b("Slot") & 0xff;
|
||||
this.e = new ItemStack[this.h_()];
|
||||
|
||||
if (j >= 0 && j < e.length) {
|
||||
e[j] = new ItemStack(nbttagcompound1);
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.b("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.e.length) {
|
||||
this.e[j] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,27 +76,24 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < e.length; i++) {
|
||||
if (e[i] != null) {
|
||||
for (int i = 0; i < this.e.length; ++i) {
|
||||
if (this.e[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
e[i].a(nbttagcompound1);
|
||||
nbttaglist.a(((NBTBase) (nbttagcompound1)));
|
||||
this.e[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
if (a.m(b, c, d) != this) {
|
||||
return false;
|
||||
}
|
||||
return entityplayer.d((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D) <= 64D;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package net.minecraft.server;
|
||||
|
||||
public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack h[];
|
||||
public int e;
|
||||
public int f;
|
||||
public int g;
|
||||
private ItemStack[] h = new ItemStack[3];
|
||||
public int e = 0;
|
||||
public int f = 0;
|
||||
public int g = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
@ -13,44 +13,41 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityFurnace() {
|
||||
h = new ItemStack[3];
|
||||
e = 0;
|
||||
f = 0;
|
||||
g = 0;
|
||||
}
|
||||
public TileEntityFurnace() {}
|
||||
|
||||
public int h_() {
|
||||
return h.length;
|
||||
return this.h.length;
|
||||
}
|
||||
|
||||
public ItemStack a(int j) {
|
||||
return h[j];
|
||||
public ItemStack a(int i) {
|
||||
return this.h[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int j, int k) {
|
||||
if (h[j] != null) {
|
||||
if (h[j].a <= k) {
|
||||
ItemStack itemstack = h[j];
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.h[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.h[i].count <= j) {
|
||||
itemstack = this.h[i];
|
||||
this.h[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.h[i].a(j);
|
||||
if (this.h[i].count == 0) {
|
||||
this.h[i] = null;
|
||||
}
|
||||
|
||||
h[j] = null;
|
||||
return itemstack;
|
||||
}
|
||||
ItemStack itemstack1 = h[j].a(k);
|
||||
|
||||
if (h[j].a == 0) {
|
||||
h[j] = null;
|
||||
}
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int j, ItemStack itemstack) {
|
||||
h[j] = itemstack;
|
||||
if (itemstack != null && itemstack.a > c()) {
|
||||
itemstack.a = c();
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.h[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,38 +59,39 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
|
||||
h = new ItemStack[h_()];
|
||||
for (int j = 0; j < nbttaglist.b(); j++) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(j);
|
||||
byte byte0 = nbttagcompound1.b("Slot");
|
||||
this.h = new ItemStack[this.h_()];
|
||||
|
||||
if (byte0 >= 0 && byte0 < h.length) {
|
||||
h[byte0] = new ItemStack(nbttagcompound1);
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
byte b0 = nbttagcompound1.b("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.h.length) {
|
||||
this.h[b0] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
e = ((int) (nbttagcompound.c("BurnTime")));
|
||||
g = ((int) (nbttagcompound.c("CookTime")));
|
||||
f = a(h[1]);
|
||||
this.e = nbttagcompound.c("BurnTime");
|
||||
this.g = nbttagcompound.c("CookTime");
|
||||
this.f = this.a(this.h[1]);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("BurnTime", (short) e);
|
||||
nbttagcompound.a("CookTime", (short) g);
|
||||
nbttagcompound.a("BurnTime", (short) this.e);
|
||||
nbttagcompound.a("CookTime", (short) this.g);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int j = 0; j < h.length; j++) {
|
||||
if (h[j] != null) {
|
||||
for (int i = 0; i < this.h.length; ++i) {
|
||||
if (this.h[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) j);
|
||||
h[j].a(nbttagcompound1);
|
||||
nbttaglist.a(((NBTBase) (nbttagcompound1)));
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.h[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.a("Items", ((NBTBase) (nbttaglist)));
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
@ -101,109 +99,91 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
return e > 0;
|
||||
return this.e > 0;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
boolean flag = e > 0;
|
||||
boolean flag = this.e > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (e > 0) {
|
||||
e--;
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
}
|
||||
if (!a.z) {
|
||||
if (e == 0 && i()) {
|
||||
f = e = a(h[1]);
|
||||
if (e > 0) {
|
||||
|
||||
if (!this.a.isStatic) {
|
||||
if (this.e == 0 && this.i()) {
|
||||
this.f = this.e = this.a(this.h[1]);
|
||||
if (this.e > 0) {
|
||||
flag1 = true;
|
||||
if (h[1] != null) {
|
||||
h[1].a--;
|
||||
if (h[1].a == 0) {
|
||||
h[1] = null;
|
||||
if (this.h[1] != null) {
|
||||
--this.h[1].count;
|
||||
if (this.h[1].count == 0) {
|
||||
this.h[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e() && i()) {
|
||||
g++;
|
||||
if (g == 200) {
|
||||
g = 0;
|
||||
h();
|
||||
|
||||
if (this.e() && this.i()) {
|
||||
++this.g;
|
||||
if (this.g == 200) {
|
||||
this.g = 0;
|
||||
this.h();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
g = 0;
|
||||
this.g = 0;
|
||||
}
|
||||
if (flag != (e > 0)) {
|
||||
|
||||
if (flag != this.e > 0) {
|
||||
flag1 = true;
|
||||
BlockFurnace.a(e > 0, a, b, c, d);
|
||||
BlockFurnace.a(this.e > 0, this.a, this.b, this.c, this.d);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
d();
|
||||
this.d();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean i() {
|
||||
if (h[0] == null) {
|
||||
if (this.h[0] == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba);
|
||||
} else {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
|
||||
|
||||
if (itemstack == null) {
|
||||
return false;
|
||||
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())));
|
||||
}
|
||||
if (h[2] == null) {
|
||||
return true;
|
||||
}
|
||||
if (!h[2].a(itemstack)) {
|
||||
return false;
|
||||
}
|
||||
if (h[2].a < c() && h[2].a < h[2].b()) {
|
||||
return true;
|
||||
}
|
||||
return h[2].a < itemstack.b();
|
||||
}
|
||||
|
||||
public void h() {
|
||||
if (!i()) {
|
||||
return;
|
||||
}
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba);
|
||||
if (this.i()) {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
|
||||
|
||||
if (h[2] == null) {
|
||||
h[2] = itemstack.j();
|
||||
} else if (h[2].c == itemstack.c) {
|
||||
h[2].a++;
|
||||
}
|
||||
h[0].a--;
|
||||
if (h[0].a <= 0) {
|
||||
h[0] = null;
|
||||
if (this.h[2] == null) {
|
||||
this.h[2] = itemstack.j();
|
||||
} else if (this.h[2].id == itemstack.id) {
|
||||
++this.h[2].count;
|
||||
}
|
||||
|
||||
--this.h[0].count;
|
||||
if (this.h[0].count <= 0) {
|
||||
this.h[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int a(ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
return 0;
|
||||
}
|
||||
int j = itemstack.a().ba;
|
||||
} else {
|
||||
int i = itemstack.a().id;
|
||||
|
||||
if (j < 256 && Block.m[j].bt == Material.c) {
|
||||
return 300;
|
||||
return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : 0)));
|
||||
}
|
||||
if (j == Item.B.ba) {
|
||||
return 100;
|
||||
}
|
||||
if (j == Item.k.ba) {
|
||||
return 1600;
|
||||
}
|
||||
return j != Item.aw.ba ? 0 : 20000;
|
||||
}
|
||||
|
||||
public boolean a_(EntityPlayer entityplayer) {
|
||||
if (a.m(b, c, d) != this) {
|
||||
return false;
|
||||
}
|
||||
return entityplayer.d((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D) <= 64D;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,108 +1,102 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityMobSpawner extends TileEntity {
|
||||
|
||||
public int e;
|
||||
public String h; // CraftBukkit -> public
|
||||
public int e = -1;
|
||||
public String h = "Pig"; // CraftBukkit private -> public
|
||||
public double f;
|
||||
public double g;
|
||||
public double g = 0.0D;
|
||||
|
||||
public TileEntityMobSpawner() {
|
||||
e = -1;
|
||||
g = 0.0D;
|
||||
h = "Pig";
|
||||
e = 20;
|
||||
this.e = 20;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
h = s;
|
||||
this.h = s;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return a.a((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D, 16D) != null;
|
||||
return this.a.a((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D, 16.0D) != null;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
g = f;
|
||||
if (!a()) {
|
||||
return;
|
||||
}
|
||||
double d = (float) b + a.l.nextFloat();
|
||||
double d2 = (float) c + a.l.nextFloat();
|
||||
double d4 = (float) this.d + a.l.nextFloat();
|
||||
this.g = this.f;
|
||||
if (this.a()) {
|
||||
double d0 = (double) ((float) this.b + this.a.l.nextFloat());
|
||||
double d1 = (double) ((float) this.c + this.a.l.nextFloat());
|
||||
double d2 = (double) ((float) this.d + this.a.l.nextFloat());
|
||||
|
||||
a.a("smoke", d, d2, d4, 0.0D, 0.0D, 0.0D);
|
||||
a.a("flame", d, d2, d4, 0.0D, 0.0D, 0.0D);
|
||||
for (f += 1000F / ((float) e + 200F); f > 360D;) {
|
||||
f -= 360D;
|
||||
g -= 360D;
|
||||
}
|
||||
this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
if (e == -1) {
|
||||
b();
|
||||
}
|
||||
if (e > 0) {
|
||||
e--;
|
||||
return;
|
||||
}
|
||||
byte byte0 = 4;
|
||||
|
||||
for (int i = 0; i < byte0; i++) {
|
||||
EntityLiving entityliving = (EntityLiving) EntityList.a(h, a);
|
||||
|
||||
if (entityliving == null) {
|
||||
return;
|
||||
}
|
||||
int j = a.a(((entityliving)).getClass(), AxisAlignedBB.b(b, c, this.d, b + 1, c + 1, this.d + 1).b(8D, 4D, 8D)).size();
|
||||
|
||||
if (j >= 6) {
|
||||
b();
|
||||
return;
|
||||
}
|
||||
if (entityliving == null) {
|
||||
continue;
|
||||
}
|
||||
double d6 = (double) b + (a.l.nextDouble() - a.l.nextDouble()) * 4D;
|
||||
double d7 = (c + a.l.nextInt(3)) - 1;
|
||||
double d8 = (double) this.d + (a.l.nextDouble() - a.l.nextDouble()) * 4D;
|
||||
|
||||
entityliving.c(d6, d7, d8, a.l.nextFloat() * 360F, 0.0F);
|
||||
if (!entityliving.b()) {
|
||||
continue;
|
||||
}
|
||||
a.a(((Entity) (entityliving)));
|
||||
for (int k = 0; k < 20; k++) {
|
||||
double d1 = (double) b + 0.5D + ((double) a.l.nextFloat() - 0.5D) * 2D;
|
||||
double d3 = (double) c + 0.5D + ((double) a.l.nextFloat() - 0.5D) * 2D;
|
||||
double d5 = (double) this.d + 0.5D + ((double) a.l.nextFloat() - 0.5D) * 2D;
|
||||
|
||||
a.a("smoke", d1, d3, d5, 0.0D, 0.0D, 0.0D);
|
||||
a.a("flame", d1, d3, d5, 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) {
|
||||
this.f -= 360.0D;
|
||||
}
|
||||
|
||||
entityliving.R();
|
||||
b();
|
||||
}
|
||||
if (this.e == -1) {
|
||||
this.b();
|
||||
}
|
||||
|
||||
super.f();
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
} else {
|
||||
byte b0 = 4;
|
||||
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.a));
|
||||
|
||||
if (entityliving == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if (j >= 6) {
|
||||
this.b();
|
||||
return;
|
||||
}
|
||||
|
||||
if (entityliving != null) {
|
||||
double d3 = (double) this.b + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D;
|
||||
double d4 = (double) (this.c + this.a.l.nextInt(3) - 1);
|
||||
double d5 = (double) this.d + (this.a.l.nextDouble() - this.a.l.nextDouble()) * 4.0D;
|
||||
|
||||
entityliving.c(d3, d4, d5, this.a.l.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving.b()) {
|
||||
this.a.a((Entity) entityliving);
|
||||
|
||||
for (int k = 0; k < 20; ++k) {
|
||||
d0 = (double) this.b + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D;
|
||||
d1 = (double) this.c + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D;
|
||||
d2 = (double) this.d + 0.5D + ((double) this.a.l.nextFloat() - 0.5D) * 2.0D;
|
||||
this.a.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.a.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
entityliving.R();
|
||||
this.b();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.f();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b() {
|
||||
e = 200 + a.l.nextInt(600);
|
||||
this.e = 200 + this.a.l.nextInt(600);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
h = nbttagcompound.h("EntityId");
|
||||
e = ((short) (nbttagcompound.c("Delay")));
|
||||
this.h = nbttagcompound.h("EntityId");
|
||||
this.e = nbttagcompound.c("Delay");
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("EntityId", h);
|
||||
nbttagcompound.a("Delay", (short) e);
|
||||
nbttagcompound.a("EntityId", this.h);
|
||||
nbttagcompound.a("Delay", (short) this.e);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -15,99 +17,20 @@ import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
public class WorldServer extends World {
|
||||
|
||||
public ChunkProviderServer A;
|
||||
public boolean B;
|
||||
public boolean B = false;
|
||||
public boolean C;
|
||||
private MinecraftServer D;
|
||||
private MCHashTable E;
|
||||
private EntityList E = new EntityList();
|
||||
|
||||
public WorldServer(MinecraftServer minecraftserver, File file, String s, int i) {
|
||||
super(file, s, (new Random()).nextLong(), WorldProvider.a(i));
|
||||
B = false;
|
||||
E = new MCHashTable();
|
||||
D = minecraftserver;
|
||||
world = new CraftWorld(this); // CraftBukkit
|
||||
server = minecraftserver.server; // CraftBukkit
|
||||
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) {
|
||||
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i));
|
||||
this.D = minecraftserver;
|
||||
|
||||
// CraftBukkit start
|
||||
world = new CraftWorld(this);
|
||||
server = minecraftserver.server;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
super.f();
|
||||
}
|
||||
|
||||
public void a(Entity entity, boolean flag) {
|
||||
if (!D.m && ((entity instanceof EntityAnimals) || (entity instanceof EntityWaterMob))) {
|
||||
entity.q();
|
||||
}
|
||||
if (entity.j == null || !(entity.j instanceof EntityPlayer)) {
|
||||
super.a(entity, flag);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Entity entity, boolean flag) {
|
||||
super.a(entity, flag);
|
||||
}
|
||||
|
||||
protected IChunkProvider a(File file) {
|
||||
A = new ChunkProviderServer(this, q.a(file), q.c());
|
||||
return ((IChunkProvider) (A));
|
||||
}
|
||||
|
||||
public List d(int i, int j, int k, int l, int i1, int j1) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
for (int k1 = 0; k1 < c.size(); k1++) {
|
||||
TileEntity tileentity = (TileEntity) c.get(k1);
|
||||
|
||||
if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) {
|
||||
((List) (arraylist)).add(((tileentity)));
|
||||
}
|
||||
}
|
||||
|
||||
return ((List) (arraylist));
|
||||
}
|
||||
|
||||
public boolean a(EntityPlayer entityplayer, int i, int j, int k) {
|
||||
int l = (int) MathHelper.e(i - m);
|
||||
int i1 = (int) MathHelper.e(k - o);
|
||||
|
||||
if (l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
return i1 > 16 || D.f.g(entityplayer.aw);
|
||||
}
|
||||
|
||||
protected void b(Entity entity) {
|
||||
super.b(entity);
|
||||
E.a(entity.g, ((entity)));
|
||||
}
|
||||
|
||||
protected void c(Entity entity) {
|
||||
super.c(entity);
|
||||
E.d(entity.g);
|
||||
}
|
||||
|
||||
public Entity a(int i) {
|
||||
return (Entity) E.a(i);
|
||||
}
|
||||
|
||||
public void a(Entity entity, byte byte0) {
|
||||
Packet38 packet38 = new Packet38(entity.g, byte0);
|
||||
|
||||
D.k.b(entity, ((Packet) (packet38)));
|
||||
}
|
||||
|
||||
public Explosion a(Entity entity, double d1, double d2, double d3, float f1, boolean flag) {
|
||||
Explosion explosion = super.a(entity, d1, d2, d3, f1, flag);
|
||||
|
||||
D.f.a(d1, d2, d3, 64D, ((Packet) (new Packet60(d1, d2, d3, f1, explosion.g))));
|
||||
return explosion;
|
||||
}
|
||||
|
||||
public void c(int i, int j, int k, int l, int i1) {
|
||||
super.c(i, j, k, l, i1);
|
||||
D.f.a(i, j, k, 64D, ((Packet) (new Packet54(i, j, k, l, i1))));
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private final CraftWorld world;
|
||||
private final CraftServer server;
|
||||
|
||||
@ -119,23 +42,23 @@ public class WorldServer extends World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean b(int i1, int j1, int k1, int l1) {
|
||||
boolean result = super.b(i1, j1, k1, l1);
|
||||
if ((result) && (world != null)) world.updateBlock(i1, j1, k1);
|
||||
public boolean setTypeId(int i, int j, int k, int l) {
|
||||
boolean result = super.setTypeId(i, j, k, l);
|
||||
if ((result) && (world != null)) world.updateBlock(i, j, k);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(int i1, int j1, int k1, int l1, int i2) {
|
||||
boolean result = super.a(i1, j1, k1, l1, i2);
|
||||
if ((result) && (world != null)) world.updateBlock(i1, j1, k1);
|
||||
public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
|
||||
boolean result = super.setTypeIdAndData(i, j, k, l, i1);
|
||||
if ((result) && (world != null)) world.updateBlock(i, j, k);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(int i1, int j1, int k1, TileEntity tileentity) {
|
||||
super.a(i1, j1, k1, tileentity);
|
||||
if (world != null) world.updateBlock(i1, j1, k1);
|
||||
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
|
||||
super.setTileEntity(i, j, k, tileentity);
|
||||
if (world != null) world.updateBlock(i, j, k);
|
||||
}
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
@ -147,72 +70,142 @@ public class WorldServer extends World {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void f() {
|
||||
super.f();
|
||||
}
|
||||
|
||||
public void a(Entity entity, boolean flag) {
|
||||
if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
entity.q();
|
||||
}
|
||||
|
||||
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
|
||||
super.a(entity, flag);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Entity entity, boolean flag) {
|
||||
super.a(entity, flag);
|
||||
}
|
||||
|
||||
protected IChunkProvider a(File file1) {
|
||||
this.A = new ChunkProviderServer(this, this.q.a(file1), this.q.c());
|
||||
return this.A;
|
||||
}
|
||||
|
||||
public List d(int i, int j, int k, int l, int i1, int j1) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
for (int k1 = 0; k1 < this.c.size(); ++k1) {
|
||||
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) {
|
||||
arraylist.add(tileentity);
|
||||
}
|
||||
}
|
||||
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
|
||||
int l = (int) MathHelper.e((float) (i - this.spawnX));
|
||||
int i1 = (int) MathHelper.e((float) (k - this.spawnZ));
|
||||
|
||||
if (l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
|
||||
return i1 > 16 || this.D.f.g(entityhuman.name);
|
||||
}
|
||||
|
||||
protected void b(Entity entity) {
|
||||
super.b(entity);
|
||||
this.E.a(entity.id, entity);
|
||||
}
|
||||
|
||||
protected void c(Entity entity) {
|
||||
super.c(entity);
|
||||
this.E.d(entity.id);
|
||||
}
|
||||
|
||||
public Entity a(int i) {
|
||||
return (Entity) this.E.a(i);
|
||||
}
|
||||
|
||||
public void a(Entity entity, byte b0) {
|
||||
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
|
||||
|
||||
this.D.k.b(entity, packet38entitystatus);
|
||||
}
|
||||
|
||||
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
||||
Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
|
||||
|
||||
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
||||
return explosion;
|
||||
}
|
||||
|
||||
public void c(int i, int j, int k, int l, int i1) {
|
||||
super.c(i, j, k, l, i1);
|
||||
this.D.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
// XXX: done because it calls private k()
|
||||
@Override
|
||||
public void h(int i1, int j1, int k1, int l1) {
|
||||
l(i1 - 1, j1, k1, l1);
|
||||
l(i1 + 1, j1, k1, l1);
|
||||
l(i1, j1 - 1, k1, l1);
|
||||
l(i1, j1 + 1, k1, l1);
|
||||
l(i1, j1, k1 - 1, l1);
|
||||
l(i1, j1, k1 + 1, l1);
|
||||
public void h(int i, int j, int k, int l) {
|
||||
this.l(i - 1, j, k, l);
|
||||
this.l(i + 1, j, k, l);
|
||||
this.l(i, j - 1, k, l);
|
||||
this.l(i, j + 1, k, l);
|
||||
this.l(i, j, k - 1, l);
|
||||
this.l(i, j, k + 1, l);
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
private void l(int i1, int j1, int k1, int l1) {
|
||||
if (i || z) {
|
||||
return;
|
||||
}
|
||||
Block block = Block.m[a(i1, j1, k1)];
|
||||
private void l(int i, int j, int k, int l) {
|
||||
if (!this.i && !this.isStatic) {
|
||||
Block block = Block.byId[this.getTypeId(i, j, k)];
|
||||
|
||||
if (block != null) {
|
||||
// CraftBukkit start
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i1, j1, k1), l1);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
if (block != null) {
|
||||
// CraftBukkit start
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit stop
|
||||
// CraftBukkit stop
|
||||
|
||||
block.b(this, i1, j1, k1, l1);
|
||||
block.b(this, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
@Override
|
||||
public boolean a(int i1, int j1, int k1, int l1, boolean flag) {
|
||||
int i2 = a(j1, k1, l1);
|
||||
Block block = Block.m[i2];
|
||||
Block block1 = Block.m[i1];
|
||||
AxisAlignedBB axisalignedbb = block1.d(this, j1, k1, l1);
|
||||
public boolean a(int i, int j, int k, int l, boolean flag) {
|
||||
int i1 = this.getTypeId(j, k, l);
|
||||
Block block = Block.byId[i1];
|
||||
Block block1 = Block.byId[i];
|
||||
AxisAlignedBB axisalignedbb = block1.d(this, j, k, l);
|
||||
|
||||
if (flag) {
|
||||
axisalignedbb = null;
|
||||
}
|
||||
if (axisalignedbb != null && !a(axisalignedbb)) {
|
||||
|
||||
// Craftbukkit start - We dont want to allow the user to override the bounding box check
|
||||
boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
|
||||
|
||||
if (!defaultReturn) {
|
||||
return false;
|
||||
}
|
||||
// Craftbukkit start - We dont want to allow the user to override the bounding box check
|
||||
boolean defaultReturn;
|
||||
|
||||
if (block == Block.A || block == Block.B || block == Block.C || block == Block.D || block == Block.ar || block == Block.aS) {
|
||||
defaultReturn = true;
|
||||
} else {
|
||||
defaultReturn = (i1 > 0) && (block == null) && (block1.a(this, j1, k1, l1));
|
||||
}
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, getWorld().getBlockAt(j, k, l), i1, defaultReturn);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
// Craftbukkit - If flag is true, it's natural, not user placement. Don't hook.
|
||||
if (!flag) {
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, getWorld().getBlockAt(j1, k1, l1), i1, defaultReturn);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
return event.isBuildable();
|
||||
} else {
|
||||
return defaultReturn;
|
||||
}
|
||||
return event.isBuildable();
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.server.EntityPlayerMP;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PropertyManager;
|
||||
import net.minecraft.server.ServerConfigurationManager;
|
||||
@ -70,7 +70,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
public Player[] getOnlinePlayers() {
|
||||
List<EntityPlayerMP> online = server.b;
|
||||
List<EntityPlayer> online = server.b;
|
||||
Player[] players = new Player[online.size()];
|
||||
|
||||
for (int i = 0; i < players.length; i++) {
|
||||
@ -109,7 +109,7 @@ public final class CraftServer implements Server {
|
||||
return players.length;
|
||||
}
|
||||
|
||||
public Player getPlayer(final EntityPlayerMP entity) {
|
||||
public Player getPlayer(final EntityPlayer entity) {
|
||||
return entity.a.getPlayer();
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class CraftWorld implements World {
|
||||
CraftBlock block = blockCache.get(loc);
|
||||
|
||||
if (block == null) {
|
||||
block = new CraftBlock(this, x, y, z, world.a(x, y, z), (byte)world.b(x, y, z));
|
||||
block = new CraftBlock(this, x, y, z, world.getTypeId(x, y, z), (byte)world.getData(x, y, z));
|
||||
blockCache.put(loc, block);
|
||||
} else {
|
||||
block.update();
|
||||
@ -47,7 +47,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public int getBlockTypeIdAt(int x, int y, int z) {
|
||||
return world.a(x, y, z);
|
||||
return world.getTypeId(x, y, z);
|
||||
}
|
||||
|
||||
public int getHighestBlockYAt(int x, int z) {
|
||||
@ -55,7 +55,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public Location getSpawnLocation() {
|
||||
return new Location(this, world.m, world.e(world.m, world.o), world.o);
|
||||
return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ);
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
@ -86,8 +86,8 @@ public class CraftWorld implements World {
|
||||
public Block updateBlock(int x, int y, int z) {
|
||||
BlockCoordinate loc = new BlockCoordinate(x, y, z);
|
||||
CraftBlock block = (CraftBlock)blockCache.get(loc);
|
||||
final int type = world.a(x, y, z);
|
||||
final byte data = (byte)world.b(x, y, z);
|
||||
final int type = world.getTypeId(x, y, z);
|
||||
final byte data = (byte)world.getData(x, y, z);
|
||||
|
||||
if (block == null) {
|
||||
block = new CraftBlock(this, x, y, z, type, data);
|
||||
@ -202,31 +202,8 @@ public class CraftWorld implements World {
|
||||
return treeGen.a(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
}
|
||||
|
||||
/**@deprecated*/
|
||||
public CraftEntity toCraftEntity(net.minecraft.server.Entity entity) {
|
||||
if (entity instanceof CraftMappable) {
|
||||
return ((CraftMappable)entity).getCraftEntity();
|
||||
} else if (entity instanceof EntityItem) {
|
||||
return new CraftItemDrop(world.getServer(), (EntityItem)entity);
|
||||
} else if (entity instanceof EntityArrow) {
|
||||
return new CraftArrow(world.getServer(), (EntityArrow)entity);
|
||||
} else if (entity instanceof EntityEgg) {
|
||||
return new CraftEgg(world.getServer(), (EntityEgg)entity);
|
||||
} else if (entity instanceof EntityPlayerMP) {
|
||||
return new CraftPlayer(world.getServer(), (EntityPlayerMP)entity);
|
||||
} else if (entity instanceof EntitySnowball) {
|
||||
return new CraftSnowball(world.getServer(), (EntitySnowball)entity);
|
||||
} else if (entity instanceof EntityPlayer) {
|
||||
return new CraftHumanEntity(world.getServer(), (EntityPlayer)entity);
|
||||
} else if (entity instanceof EntityLiving) {
|
||||
return new CraftLivingEntity(world.getServer(), (EntityLiving)entity);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity getTileEntityAt(final int x, final int y, final int z) {
|
||||
return world.m(x, y, z);
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -5,7 +5,8 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.Location;
|
||||
import net.minecraft.server.MobSpawnerBase;
|
||||
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
@ -306,31 +307,31 @@ public class CraftBlock implements Block {
|
||||
|
||||
public Biome getBiome() {
|
||||
// TODO: This may not be 100% accurate; investigate into getting per-block instead of per-chunk
|
||||
MobSpawnerBase base = world.getHandle().a().a(chunk.getX(), chunk.getZ());
|
||||
BiomeBase base = world.getHandle().a().a(chunk.getX(), chunk.getZ());
|
||||
|
||||
if (base == MobSpawnerBase.a) {
|
||||
if (base == BiomeBase.RAINFOREST) {
|
||||
return Biome.RAINFOREST;
|
||||
} else if (base == MobSpawnerBase.b) {
|
||||
} else if (base == BiomeBase.SWAMPLAND) {
|
||||
return Biome.SWAMPLAND;
|
||||
} else if (base == MobSpawnerBase.c) {
|
||||
} else if (base == BiomeBase.SEASONAL_FOREST) {
|
||||
return Biome.SEASONAL_FOREST;
|
||||
} else if (base == MobSpawnerBase.d) {
|
||||
} else if (base == BiomeBase.FOREST) {
|
||||
return Biome.FOREST;
|
||||
} else if (base == MobSpawnerBase.e) {
|
||||
} else if (base == BiomeBase.SAVANNA) {
|
||||
return Biome.SAVANNA;
|
||||
} else if (base == MobSpawnerBase.f) {
|
||||
} else if (base == BiomeBase.SHRUBLAND) {
|
||||
return Biome.SHRUBLAND;
|
||||
} else if (base == MobSpawnerBase.g) {
|
||||
} else if (base == BiomeBase.TAIGA) {
|
||||
return Biome.TAIGA;
|
||||
} else if (base == MobSpawnerBase.h) {
|
||||
} else if (base == BiomeBase.DESERT) {
|
||||
return Biome.DESERT;
|
||||
} else if (base == MobSpawnerBase.i) {
|
||||
} else if (base == BiomeBase.PLAINS) {
|
||||
return Biome.PLAINS;
|
||||
} else if (base == MobSpawnerBase.j) {
|
||||
} else if (base == BiomeBase.ICE_DESERT) {
|
||||
return Biome.ICE_DESERT;
|
||||
} else if (base == MobSpawnerBase.k) {
|
||||
} else if (base == BiomeBase.TUNDRA) {
|
||||
return Biome.TUNDRA;
|
||||
} else if (base == MobSpawnerBase.l) {
|
||||
} else if (base == BiomeBase.HELL) {
|
||||
return Biome.HELL;
|
||||
}
|
||||
|
||||
@ -346,8 +347,8 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public void update() {
|
||||
type = world.getHandle().a(x, y, z);
|
||||
data = (byte)world.getHandle().b(x, y, z);
|
||||
type = world.getHandle().getTypeId(x, y, z);
|
||||
data = (byte)world.getHandle().getData(x, y, z);
|
||||
light = (byte)world.getHandle().j(x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityAnimals;
|
||||
import net.minecraft.server.EntityAnimal;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Animals;
|
||||
|
||||
public class CraftAnimals extends CraftCreature implements Animals{
|
||||
|
||||
public CraftAnimals(CraftServer server, EntityAnimals entity) {
|
||||
public CraftAnimals(CraftServer server, EntityAnimal entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
|
@ -17,21 +17,21 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return new Location(getWorld(), entity.p, entity.q, entity.r, entity.v, entity.w);
|
||||
return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
|
||||
}
|
||||
|
||||
public Vector getVelocity() {
|
||||
return new Vector(entity.s, entity.t, entity.u);
|
||||
return new Vector(entity.motX, entity.motY, entity.motZ);
|
||||
}
|
||||
|
||||
public void setVelocity(Vector vel) {
|
||||
entity.s = vel.getX();
|
||||
entity.t = vel.getY();
|
||||
entity.u = vel.getZ();
|
||||
entity.motX = vel.getX();
|
||||
entity.motY = vel.getY();
|
||||
entity.motZ = vel.getZ();
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return ((WorldServer)entity.l).getWorld();
|
||||
return ((WorldServer)entity.world).getWorld();
|
||||
}
|
||||
|
||||
public void teleportTo(Location location) {
|
||||
@ -43,7 +43,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entity.g;
|
||||
return entity.id;
|
||||
}
|
||||
|
||||
public Entity getHandle() {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityZombieSimple;
|
||||
import net.minecraft.server.EntityGiantZombie;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Giant;
|
||||
|
||||
public class CraftGiant extends CraftMonster implements Giant {
|
||||
|
||||
public CraftGiant(CraftServer server, EntityZombieSimple entity) {
|
||||
public CraftGiant(CraftServer server, EntityGiantZombie entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@ -10,28 +10,28 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
private EntityPlayer entity;
|
||||
private EntityHuman entity;
|
||||
private CraftInventoryPlayer inventory;
|
||||
|
||||
public CraftHumanEntity(final CraftServer server, final EntityPlayer entity) {
|
||||
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
|
||||
super(server, entity);
|
||||
this.entity = entity;
|
||||
this.inventory = new CraftInventoryPlayer( entity.an );
|
||||
this.inventory = new CraftInventoryPlayer( entity.inventory );
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return entity.aw;
|
||||
return entity.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getHandle() {
|
||||
public EntityHuman getHandle() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setHandle(final EntityPlayer entity) {
|
||||
super.setHandle((EntityPlayer)entity);
|
||||
public void setHandle(final EntityHuman entity) {
|
||||
super.setHandle((EntityHuman)entity);
|
||||
this.entity = entity;
|
||||
this.inventory = new CraftInventoryPlayer( entity.an );
|
||||
this.inventory = new CraftInventoryPlayer( entity.inventory );
|
||||
}
|
||||
|
||||
public CraftInventoryPlayer getInventory() {
|
||||
|
@ -24,7 +24,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
public int getHealth() {
|
||||
return entity.aZ;
|
||||
return entity.health;
|
||||
}
|
||||
|
||||
public void setHealth(int health) {
|
||||
@ -32,7 +32,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
throw new IllegalArgumentException("Health must be between 0 and 200");
|
||||
}
|
||||
|
||||
entity.aZ = health;
|
||||
entity.health = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,11 +72,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
public boolean isInsideVehicle() {
|
||||
return entity.k != null;
|
||||
return entity.vehicle != null;
|
||||
}
|
||||
|
||||
public boolean leaveVehicle() {
|
||||
if (entity.k == null) {
|
||||
if (entity.vehicle == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -85,13 +85,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
public Vehicle getVehicle() {
|
||||
if (entity.k == null) {
|
||||
if (entity.vehicle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity vehicle = (entity.k.getBukkitEntity());
|
||||
org.bukkit.entity.Entity vehicle = (entity.vehicle.getBukkitEntity());
|
||||
if (vehicle instanceof Vehicle) {
|
||||
return (Vehicle)vehicle;
|
||||
return (Vehicle) vehicle;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityMobs;
|
||||
import net.minecraft.server.EntityMonster;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Monster;
|
||||
|
||||
public class CraftMonster extends CraftCreature implements Monster {
|
||||
|
||||
public CraftMonster(CraftServer server, EntityMobs entity) {
|
||||
public CraftMonster(CraftServer server, EntityMonster entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityPlayerMP;
|
||||
import net.minecraft.server.Packet;
|
||||
import net.minecraft.server.Packet3Chat;
|
||||
import net.minecraft.server.Packet6SpawnPosition;
|
||||
@ -12,10 +12,10 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private EntityPlayerMP entity;
|
||||
private EntityPlayer entity;
|
||||
private String name;
|
||||
|
||||
public CraftPlayer(CraftServer server, EntityPlayerMP entity) {
|
||||
public CraftPlayer(CraftServer server, EntityPlayer entity) {
|
||||
super(server, entity);
|
||||
this.name = getName();
|
||||
this.entity = entity;
|
||||
@ -31,8 +31,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
public boolean isOnline() {
|
||||
for (Object obj: server.getHandle().b) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) obj;
|
||||
if (player.aw.equalsIgnoreCase(getName())) {
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
if (player.name.equalsIgnoreCase(getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -49,12 +49,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayerMP getHandle() {
|
||||
public EntityPlayer getHandle() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setHandle(final EntityPlayerMP entity) {
|
||||
super.setHandle((EntityPlayer) entity);
|
||||
public void setHandle(final EntityPlayer entity) {
|
||||
super.setHandle((EntityHuman) entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||
}
|
||||
|
||||
public Entity getPassenger() {
|
||||
return isEmpty()?null:(getHandle().j.getBukkitEntity());
|
||||
return isEmpty() ? null : (getHandle().passenger.getBukkitEntity());
|
||||
}
|
||||
|
||||
public boolean setPassenger(Entity passenger) {
|
||||
@ -28,15 +28,15 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getHandle().j == null;
|
||||
return getHandle().passenger == null;
|
||||
}
|
||||
|
||||
public boolean eject() {
|
||||
if (getHandle().j == null) {
|
||||
if (getHandle().passenger == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getHandle().j.setPassengerOf(null);
|
||||
getHandle().passenger.setPassengerOf(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWaterMob;
|
||||
import net.minecraft.server.EntityWaterAnimal;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.WaterMob;
|
||||
|
||||
public class CraftWaterMob extends CraftCreature implements WaterMob {
|
||||
|
||||
public CraftWaterMob(CraftServer server, EntityWaterMob entity) {
|
||||
public CraftWaterMob(CraftServer server, EntityWaterAnimal entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ public class CraftItemStack extends ItemStack {
|
||||
|
||||
public CraftItemStack(net.minecraft.server.ItemStack item) {
|
||||
super(
|
||||
item != null ? item.c : 0,
|
||||
item != null ? item.a : 0,
|
||||
(byte)(item != null ? item.d : 0)
|
||||
item != null ? item.id: 0,
|
||||
item != null ? item.count : 0,
|
||||
(byte)(item != null ? item.damage : 0)
|
||||
);
|
||||
this.item = item;
|
||||
}
|
||||
@ -55,14 +55,14 @@ public class CraftItemStack extends ItemStack {
|
||||
|
||||
@Override
|
||||
public Material getType() {
|
||||
super.setTypeId(item != null ? item.c : 0); // sync, needed?
|
||||
super.setTypeId(item != null ? item.id : 0); // sync, needed?
|
||||
return super.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeId() {
|
||||
super.setTypeId(item != null ? item.c : 0); // sync, needed?
|
||||
return item != null ? item.c : 0;
|
||||
super.setTypeId(item != null ? item.id : 0); // sync, needed?
|
||||
return item != null ? item.id : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,16 +76,16 @@ public class CraftItemStack extends ItemStack {
|
||||
item = new net.minecraft.server.ItemStack(type, 1, 0);
|
||||
super.setAmount(1);
|
||||
} else {
|
||||
item.c = type;
|
||||
super.setTypeId(item.c);
|
||||
item.id = type;
|
||||
super.setTypeId(item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
super.setAmount(item != null ? item.a : 0); // sync, needed?
|
||||
return (item != null ? item.a : 0);
|
||||
super.setAmount(item != null ? item.count : 0); // sync, needed?
|
||||
return (item != null ? item.count : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,7 +96,7 @@ public class CraftItemStack extends ItemStack {
|
||||
item = null;
|
||||
} else {
|
||||
super.setAmount(amount);
|
||||
item.a = amount;
|
||||
item.count = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,15 +105,15 @@ public class CraftItemStack extends ItemStack {
|
||||
// Ignore damage if item is null
|
||||
if (item != null) {
|
||||
super.setDamage(damage);
|
||||
item.d = damage;
|
||||
item.damage = damage;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getDamage() {
|
||||
if (item != null) {
|
||||
super.setDamage((byte) item.d); // sync, needed?
|
||||
return (byte) item.d;
|
||||
super.setDamage((byte) item.damage); // sync, needed?
|
||||
return (byte) item.damage;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren