Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Update to Minecraft 1.3 beta
Dieser Commit ist enthalten in:
Ursprung
a124bfdab5
Commit
f759e0b60d
2
pom.xml
2
pom.xml
@ -38,7 +38,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.2_01_02</version>
|
||||
<version>1.3</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -35,46 +35,32 @@ public class BlockButton extends Block {
|
||||
return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : world.d(i, j, k + 1)));
|
||||
}
|
||||
|
||||
public void c(World world, int i, int j, int k, int l) {
|
||||
public void d(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
int 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)) {
|
||||
} else if (l == 3 && world.d(i, j, k - 1)) {
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
if (l == 4 && world.d(i + 1, j, k)) {
|
||||
} else if (l == 4 && world.d(i + 1, j, k)) {
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5 && world.d(i - 1, j, k)) {
|
||||
} else if (l == 5 && world.d(i - 1, j, k)) {
|
||||
i1 = 1;
|
||||
} else {
|
||||
i1 = this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
world.c(i, j, k, i1 + j1);
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
if (world.d(i - 1, j, k)) {
|
||||
world.c(i, j, k, 1);
|
||||
} else if (world.d(i + 1, j, k)) {
|
||||
world.c(i, j, k, 2);
|
||||
} else if (world.d(i, j, k - 1)) {
|
||||
world.c(i, j, k, 3);
|
||||
} else if (world.d(i, j, k + 1)) {
|
||||
world.c(i, j, k, 4);
|
||||
}
|
||||
|
||||
this.g(world, i, j, k);
|
||||
private int g(World world, int i, int j, int k) {
|
||||
return world.d(i - 1, j, k) ? 1 : (world.d(i + 1, j, k) ? 2 : (world.d(i, j, k - 1) ? 3 : (world.d(i, j, k + 1) ? 4 : 1)));
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
if (this.g(world, i, j, k)) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (this.h(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
@ -95,15 +81,15 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
private boolean h(World world, int i, int j, int k) {
|
||||
if (!this.a(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -140,60 +126,56 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
// CraftBukkit start - Interact Button
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Type eventType = Type.BLOCK_INTERACT;
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
|
||||
|
||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
if (j1 == 0) {
|
||||
return true;
|
||||
} 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 (event.isCancelled()) {
|
||||
// Craftbukkit start
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
// Craftbukkit end
|
||||
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
if (j1 == 0) {
|
||||
return true;
|
||||
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 {
|
||||
// Craftbukkit start
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
return true;
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
world.c(i, j, k, i1 + j1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
world.h(i, j, k, this.id);
|
||||
if (i1 == 1) {
|
||||
world.h(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
world.h(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
world.h(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
world.h(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.h(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
world.i(i, j, k, this.id);
|
||||
return true;
|
||||
world.h(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +206,7 @@ public class BlockButton extends Block {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
|
@ -55,9 +55,9 @@ public class BlockCactus extends Block {
|
||||
return !super.a(world, i, j, k) ? false : this.f(world, i, j, k);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (!this.f(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ public class BlockChest extends BlockContainer {
|
||||
public void b(World world, int i, int j, int k) {
|
||||
TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);
|
||||
|
||||
for (int l = 0; l < tileentitychest.h_(); ++l) {
|
||||
ItemStack itemstack = tileentitychest.a(l);
|
||||
for (int l = 0; l < tileentitychest.m_(); ++l) {
|
||||
ItemStack itemstack = tileentitychest.c_(l);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
|
@ -101,7 +101,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||
ItemStack itemstack = tileentitydispenser.e();
|
||||
ItemStack itemstack = tileentitydispenser.b();
|
||||
double d0 = (double) i + (double) f * 0.5D + 0.5D;
|
||||
double d1 = (double) j + 0.5D;
|
||||
double d2 = (double) k + (double) f1 * 0.5D + 0.5D;
|
||||
@ -157,12 +157,12 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (l > 0 && Block.byId[l].c()) {
|
||||
boolean flag = world.p(i, j, k) || world.p(i, j + 1, k);
|
||||
|
||||
if (flag) {
|
||||
world.i(i, j, k, this.id);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,29 @@ public class BlockDoor extends Block {
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
if (i != 0 && i != 1) {
|
||||
int k = this.d(j);
|
||||
|
||||
if ((k == 0 || k == 2) ^ i <= 3) {
|
||||
return this.textureId;
|
||||
} else {
|
||||
int l = k / 2 + (i & 1 ^ k);
|
||||
|
||||
l += (j & 4) / 4;
|
||||
int i1 = this.textureId - (j & 8) * 2;
|
||||
|
||||
if ((l & 1) != 0) {
|
||||
i1 = -i1;
|
||||
}
|
||||
|
||||
return i1;
|
||||
}
|
||||
} else {
|
||||
return this.textureId;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
@ -103,9 +126,9 @@ public class BlockDoor extends Block {
|
||||
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);
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -131,15 +154,15 @@ public class BlockDoor extends Block {
|
||||
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);
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
|
||||
} else {
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.l.nextFloat() * 0.1F + 0.9F);
|
||||
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) != 0) {
|
||||
@ -148,7 +171,7 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
if (l > 0 && Block.byId[l].c()) {
|
||||
this.b(world, i, j - 1, k, l);
|
||||
this.a(world, i, j - 1, k, l);
|
||||
}
|
||||
} else {
|
||||
boolean flag = false;
|
||||
@ -167,7 +190,9 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.a_(world, i, j, k, i1);
|
||||
if (!world.isStatic) {
|
||||
this.b_(world, i, j, k, i1);
|
||||
}
|
||||
} else if (l > 0 && Block.byId[l].c()) {
|
||||
boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockFence extends Block {
|
||||
|
||||
public BlockFence(int i, int j) {
|
||||
super(i, j, Material.WOOD);
|
||||
this.a(0, 0, 0, 1, (float) 1.5, 1); //Craftbukkit
|
||||
}
|
||||
|
||||
//Removed by craftbukkit
|
||||
// public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
|
||||
// arraylist.add(AxisAlignedBB.b((double) i, (double) j, (double) k, (double) (i + 1), (double) j + 2.0D, (double) (k + 1)));
|
||||
// }
|
||||
|
||||
public boolean a(World world, int i, int j, int k) {
|
||||
return world.getTypeId(i, j - 1, k) == this.id ? false : (!world.getMaterial(i, j - 1, k).isBuildable() ? false : super.a(world, i, j, k));
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ public class BlockFire extends Block {
|
||||
|
||||
if (l < 15) {
|
||||
world.c(i, j, k, l + 1);
|
||||
world.i(i, j, k, this.id);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
|
||||
if (!flag && !this.g(world, i, j, k)) {
|
||||
@ -112,18 +112,16 @@ public class BlockFire extends Block {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Craftbukkit start - won't be needed next port hopefully
|
||||
if(l == 15) {
|
||||
this.a(world, i + 1, j, k, 1, random);
|
||||
this.a(world, i - 1, j, k, 1, random);
|
||||
this.a(world, i, j - 1, k, 1, random);
|
||||
this.a(world, i, j + 1, k, 1, random);
|
||||
this.a(world, i, j, k - 1, 1, random);
|
||||
this.a(world, i, j, k + 1, 1, random);
|
||||
if (l == 15) {
|
||||
this.a(world, i + 1, j, k, 1, random);
|
||||
this.a(world, i - 1, j, k, 1, random);
|
||||
this.a(world, i, j - 1, k, 1, random);
|
||||
this.a(world, i, j + 1, k, 1, random);
|
||||
this.a(world, i, j, k - 1, 1, random);
|
||||
this.a(world, i, j, k + 1, 1, random);
|
||||
}
|
||||
}
|
||||
// Craftbukkit end
|
||||
}
|
||||
|
||||
private void a(World world, int i, int j, int k, int l, Random random) {
|
||||
@ -149,7 +147,7 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
Block.TNT.a(world, i, j, k, 0);
|
||||
Block.TNT.b(world, i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,13 +165,13 @@ public class BlockFire extends Block {
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return 0;
|
||||
} else {
|
||||
int l = this.f(world, i + 1, j, k, b0);
|
||||
int l = this.g(world, i + 1, j, k, b0);
|
||||
|
||||
l = this.f(world, i - 1, j, k, l);
|
||||
l = this.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);
|
||||
l = this.g(world, i - 1, j, k, l);
|
||||
l = this.g(world, i, j - 1, k, l);
|
||||
l = this.g(world, i, j + 1, k, l);
|
||||
l = this.g(world, i, j, k - 1, l);
|
||||
l = this.g(world, i, j, k + 1, l);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
@ -186,7 +184,7 @@ public class BlockFire extends Block {
|
||||
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
|
||||
}
|
||||
|
||||
public int f(World world, int i, int j, int k, int l) {
|
||||
public int g(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.a[world.getTypeId(i, j, k)];
|
||||
|
||||
return i1 > l ? i1 : l;
|
||||
@ -196,18 +194,18 @@ public class BlockFire extends Block {
|
||||
return world.d(i, j - 1, k) || this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) {
|
||||
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.a_(world, i, j, k)) {
|
||||
if (!world.d(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
world.i(i, j, k, this.id);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
int l = this.g(world, i, j, k);
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.material == Material.LAVA && !world.q.d) {
|
||||
if (this.material == Material.LAVA && !world.m.d) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
@ -46,11 +46,11 @@ public class BlockFlowing extends BlockFluids {
|
||||
byte b1 = -100;
|
||||
|
||||
this.a = 0;
|
||||
int j1 = this.e(world, i - 1, j, k, b1);
|
||||
int j1 = this.f(world, i - 1, j, k, b1);
|
||||
|
||||
j1 = this.e(world, i + 1, j, k, j1);
|
||||
j1 = this.e(world, i, j, k - 1, j1);
|
||||
j1 = this.e(world, i, j, k + 1, j1);
|
||||
j1 = this.f(world, i + 1, j, k, j1);
|
||||
j1 = this.f(world, i, j, k - 1, j1);
|
||||
j1 = this.f(world, i, j, k + 1, j1);
|
||||
i1 = j1 + b0;
|
||||
if (i1 >= 8 || j1 < 0) {
|
||||
i1 = -1;
|
||||
@ -85,7 +85,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
world.e(i, j, k, 0);
|
||||
} else {
|
||||
world.c(i, j, k, i1);
|
||||
world.i(i, j, k, this.id);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
world.h(i, j, k, this.id);
|
||||
}
|
||||
} else if (flag) {
|
||||
@ -129,7 +129,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
f(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
|
||||
this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
@ -138,7 +138,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
private void f(World world, int i, int j, int k, int l) {
|
||||
private void g(World world, int i, int j, int k, int l) {
|
||||
if (this.l(world, i, j, k)) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
@ -146,7 +146,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
if (this.material == Material.LAVA) {
|
||||
this.h(world, i, j, k);
|
||||
} else {
|
||||
Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k));
|
||||
Block.byId[i1].b_(world, i, j, k, world.getData(i, j, k));
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
protected int e(World world, int i, int j, int k, int l) {
|
||||
protected int f(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.g(world, i, j, k);
|
||||
|
||||
if (i1 < 0) {
|
||||
@ -289,7 +289,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
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);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,21 +38,21 @@ public class BlockJukeBox extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.f(world, i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void f(World world, int i, int j, int k, int l) {
|
||||
public void e(World world, int i, int j, int k, int l) {
|
||||
world.a((String) null, i, j, k);
|
||||
world.c(i, j, k, 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;
|
||||
double d0 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
|
||||
double d2 = (double) (world.k.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0));
|
||||
|
||||
entityitem.c = 10;
|
||||
@ -62,7 +62,7 @@ public class BlockJukeBox extends Block {
|
||||
public void a(World world, int i, int j, int k, int l, float f) {
|
||||
if (!world.isStatic) {
|
||||
if (l > 0) {
|
||||
this.f(world, i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
}
|
||||
|
||||
super.a(world, i, j, k, l, f);
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.event.block.LeavesDecayEvent;
|
||||
public class BlockLeaves extends BlockLeavesBase {
|
||||
|
||||
private int c;
|
||||
int[] b;
|
||||
int[] a;
|
||||
|
||||
protected BlockLeaves(int i, int j) {
|
||||
super(i, j, Material.LEAVES, false);
|
||||
@ -52,8 +52,8 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (this.b == null) {
|
||||
this.b = new int[b1 * b1 * b1];
|
||||
if (this.a == null) {
|
||||
this.a = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
int l1;
|
||||
@ -68,11 +68,11 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
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;
|
||||
this.a[(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;
|
||||
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
} else {
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,29 +82,29 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
for (i2 = -b0; i2 <= b0; ++i2) {
|
||||
for (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.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
|
||||
if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
}
|
||||
}
|
||||
|
||||
l1 = this.b[k1 * j1 + k1 * b1 + k1];
|
||||
l1 = this.a[k1 * j1 + k1 * b1 + k1];
|
||||
if (l1 >= 0) {
|
||||
world.c(i, j, k, l & -5);
|
||||
} else {
|
||||
@ -133,7 +133,7 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
|
||||
@ -146,7 +146,11 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return !this.a;
|
||||
return !this.b;
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return (j & 3) == 1 ? this.textureId + 80 : this.textureId;
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
|
@ -28,13 +28,13 @@ public class BlockLever extends Block {
|
||||
return world.d(i - 1, j, k) ? true : (world.d(i + 1, j, k) ? true : (world.d(i, j, k - 1) ? true : (world.d(i, j, k + 1) ? true : world.d(i, j - 1, k))));
|
||||
}
|
||||
|
||||
public void c(World world, int i, int j, int k, int l) {
|
||||
public void d(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
|
||||
i1 &= 7;
|
||||
if (l == 1 && world.d(i, j - 1, k)) {
|
||||
i1 = 5 + world.l.nextInt(2);
|
||||
i1 = 5 + world.k.nextInt(2);
|
||||
}
|
||||
|
||||
if (l == 2 && world.d(i, j, k + 1)) {
|
||||
@ -56,23 +56,7 @@ public class BlockLever extends Block {
|
||||
world.c(i, j, k, i1 + j1);
|
||||
}
|
||||
|
||||
public void e(World world, int i, int j, int k) {
|
||||
if (world.d(i - 1, j, k)) {
|
||||
world.c(i, j, k, 1);
|
||||
} else if (world.d(i + 1, j, k)) {
|
||||
world.c(i, j, k, 2);
|
||||
} else if (world.d(i, j, k - 1)) {
|
||||
world.c(i, j, k, 3);
|
||||
} else if (world.d(i, j, k + 1)) {
|
||||
world.c(i, j, k, 4);
|
||||
} else if (world.d(i, j - 1, k)) {
|
||||
world.c(i, j, k, 5 + world.l.nextInt(2));
|
||||
}
|
||||
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (this.g(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
@ -98,7 +82,7 @@ public class BlockLever extends Block {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
@ -106,7 +90,7 @@ public class BlockLever extends Block {
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (!this.a(world, i, j, k)) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -220,7 +204,7 @@ public class BlockLever extends Block {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
|
@ -44,7 +44,7 @@ public class BlockPressurePlate extends Block {
|
||||
|
||||
public void e(World world, int i, int j, int k) {}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.d(i, j - 1, k)) {
|
||||
@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.a_(world, i, j, k, world.getData(i, j, k));
|
||||
this.b_(world, i, j, k, world.getData(i, j, k));
|
||||
world.e(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.i(i, j, k, this.id);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public class BlockPressurePlate extends Block {
|
||||
return iblockaccess.getData(i, j, k) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return world.getData(i, j, k) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,13 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
private boolean a = false;
|
||||
private static List b = new ArrayList();
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
|
||||
}
|
||||
|
||||
private boolean a(World world, int i, int j, int k, boolean flag) {
|
||||
if (flag) {
|
||||
b.add(new RedstoneUpdateInfo(i, j, k, world.e));
|
||||
b.add(new RedstoneUpdateInfo(i, j, k, world.k()));
|
||||
}
|
||||
|
||||
int l = 0;
|
||||
@ -84,13 +88,13 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
return l == 5 && world.k(i, j - 1, k, 0) ? true : (l == 3 && world.k(i, j, k - 1, 2) ? true : (l == 4 && world.k(i, j, k + 1, 3) ? true : (l == 1 && world.k(i - 1, j, k, 4) ? true : l == 2 && world.k(i + 1, j, k, 5))));
|
||||
return l == 5 && world.j(i, j - 1, k, 0) ? true : (l == 3 && world.j(i, j, k - 1, 2) ? true : (l == 4 && world.j(i, j, k + 1, 3) ? true : (l == 1 && world.j(i - 1, j, k, 4) ? true : l == 2 && world.j(i + 1, j, k, 5))));
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = this.g(world, i, j, k);
|
||||
|
||||
while (b.size() > 0 && world.e - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
|
||||
while (b.size() > 0 && world.k() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
|
||||
b.remove(0);
|
||||
}
|
||||
|
||||
@ -107,7 +111,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
if (flag) {
|
||||
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((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 5; ++l) {
|
||||
double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
|
||||
@ -123,13 +127,13 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
super.b(world, i, j, k, l);
|
||||
world.i(i, j, k, this.id);
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
super.a(world, i, j, k, l);
|
||||
world.c(i, j, k, this.id, this.b());
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false;
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; // CraftBukkit -- cast to IBlockAccess
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
|
@ -20,6 +20,10 @@ public class BlockRedstoneWire extends Block {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return this.textureId;
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
@ -80,15 +84,15 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
|
||||
if (j2 != l || j != i1 || k2 != j1) {
|
||||
l1 = this.f(world, j2, j, k2, l1);
|
||||
l1 = this.g(world, j2, j, k2, l1);
|
||||
}
|
||||
|
||||
if (world.d(j2, j, k2) && !world.d(i, j + 1, k)) {
|
||||
if (j2 != l || j + 1 != i1 || k2 != j1) {
|
||||
l1 = this.f(world, j2, j + 1, k2, l1);
|
||||
l1 = this.g(world, j2, j + 1, k2, l1);
|
||||
}
|
||||
} else if (!world.d(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
|
||||
l1 = this.f(world, j2, j - 1, k2, l1);
|
||||
l1 = this.g(world, j2, j - 1, k2, l1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,10 +113,10 @@ public class BlockRedstoneWire extends Block {
|
||||
// Craftbukkit end
|
||||
|
||||
if (k1 != l1) {
|
||||
world.i = true;
|
||||
world.h = true;
|
||||
world.c(i, j, k, l1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.i = false;
|
||||
world.h = false;
|
||||
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
j2 = i;
|
||||
@ -140,7 +144,7 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
|
||||
boolean flag1 = false;
|
||||
int i3 = this.f(world, j2, j, k2, -1);
|
||||
int i3 = this.g(world, j2, j, k2, -1);
|
||||
|
||||
l1 = world.getData(i, j, k);
|
||||
if (l1 > 0) {
|
||||
@ -151,7 +155,7 @@ public class BlockRedstoneWire extends Block {
|
||||
this.a(world, j2, j, k2, i, j, k);
|
||||
}
|
||||
|
||||
i3 = this.f(world, j2, l2, k2, -1);
|
||||
i3 = this.g(world, j2, l2, k2, -1);
|
||||
l1 = world.getData(i, j, k);
|
||||
if (l1 > 0) {
|
||||
--l1;
|
||||
@ -258,7 +262,7 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private int f(World world, int i, int j, int k, int l) {
|
||||
private int g(World world, int i, int j, int k, int l) {
|
||||
if (world.getTypeId(i, j, k) != this.id) {
|
||||
return l;
|
||||
} else {
|
||||
@ -268,19 +272,19 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag = this.a(world, i, j, k);
|
||||
|
||||
if (!flag) {
|
||||
this.a_(world, i, j, k, i1);
|
||||
this.b_(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.a(world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,8 +292,8 @@ public class BlockRedstoneWire extends Block {
|
||||
return Item.REDSTONE.id;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l);
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); // CraftBukkit -- cast to IBlockAccess
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
|
@ -20,8 +20,8 @@ public class BlockStationary extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
super.b(world, i, j, k, l);
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
super.a(world, i, j, k, l);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
@ -30,11 +30,11 @@ public class BlockStationary extends BlockFluids {
|
||||
private void i(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.i = true;
|
||||
world.h = true;
|
||||
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;
|
||||
world.c(i, j, k, this.id - 1, this.b());
|
||||
world.h = false;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
|
@ -39,7 +39,7 @@ public class BlockWorkbench extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityhuman.a(i, j, k);
|
||||
entityhuman.b(i, j, k);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class Chunk {
|
||||
i = l;
|
||||
}
|
||||
|
||||
if (!this.d.q.e) {
|
||||
if (!this.d.m.e) {
|
||||
int j1 = 15;
|
||||
int k1 = 127;
|
||||
|
||||
@ -122,50 +122,7 @@ public class Chunk {
|
||||
this.o = true;
|
||||
}
|
||||
|
||||
public void c() {
|
||||
byte b0 = 32;
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
int k = i << 11 | j << 7;
|
||||
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
for (l = 0; l < 128; ++l) {
|
||||
i1 = Block.s[this.b[k + l]];
|
||||
if (i1 > 0) {
|
||||
this.g.a(i, l, j, i1);
|
||||
}
|
||||
}
|
||||
|
||||
l = 15;
|
||||
|
||||
for (i1 = b0 - 2; i1 < 128 && l > 0; this.g.a(i, i1, j, l)) {
|
||||
++i1;
|
||||
byte b1 = this.b[k + i1];
|
||||
int j1 = Block.q[b1];
|
||||
int k1 = Block.s[b1];
|
||||
|
||||
if (j1 == 0) {
|
||||
j1 = 1;
|
||||
}
|
||||
|
||||
l -= j1;
|
||||
if (k1 > l) {
|
||||
l = k1;
|
||||
}
|
||||
|
||||
if (l < 0) {
|
||||
l = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.d.a(EnumSkyBlock.BLOCK, this.j * 16, b0 - 1, this.k * 16, this.j * 16 + 16, b0 + 1, this.k * 16 + 16);
|
||||
this.o = true;
|
||||
}
|
||||
public void c() {}
|
||||
|
||||
private void c(int i, int j) {
|
||||
int k = this.b(i, j);
|
||||
@ -290,7 +247,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
this.e.a(i, j, k, i1);
|
||||
if (!this.d.q.e) {
|
||||
if (!this.d.m.e) {
|
||||
if (Block.q[b0] != 0) {
|
||||
if (j >= j1) {
|
||||
this.g(i, j + 1, k);
|
||||
@ -415,15 +372,15 @@ public class Chunk {
|
||||
k = this.m.length - 1;
|
||||
}
|
||||
|
||||
entity.ag = true;
|
||||
entity.bA = true;
|
||||
entity.chunkX = this.j;
|
||||
entity.ai = k;
|
||||
entity.bC = k;
|
||||
entity.chunkZ = this.k;
|
||||
this.m[k].add(entity);
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
this.a(entity, entity.ai);
|
||||
this.a(entity, entity.bC);
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i) {
|
||||
@ -463,9 +420,9 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public void a(TileEntity tileentity) {
|
||||
int i = tileentity.b - this.j * 16;
|
||||
int j = tileentity.c;
|
||||
int k = tileentity.d - this.k * 16;
|
||||
int i = tileentity.e - this.j * 16;
|
||||
int j = tileentity.f;
|
||||
int k = tileentity.g - this.k * 16;
|
||||
|
||||
this.a(i, j, k, tileentity);
|
||||
}
|
||||
@ -473,10 +430,10 @@ public class Chunk {
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
|
||||
tileentity.a = this.d;
|
||||
tileentity.b = this.j * 16 + i;
|
||||
tileentity.c = j;
|
||||
tileentity.d = this.k * 16 + k;
|
||||
tileentity.d = this.d;
|
||||
tileentity.e = this.j * 16 + i;
|
||||
tileentity.f = j;
|
||||
tileentity.g = this.k * 16 + k;
|
||||
if (this.a(i, j, k) != 0 && Block.byId[this.a(i, j, k)] instanceof BlockContainer) {
|
||||
if (this.c) {
|
||||
if (this.l.get(chunkposition) != null) {
|
||||
@ -577,10 +534,10 @@ public class Chunk {
|
||||
return false;
|
||||
} else {
|
||||
if (flag) {
|
||||
if (this.q && this.d.e != this.r) {
|
||||
if (this.q && this.d.k() != this.r) {
|
||||
return true;
|
||||
}
|
||||
} else if (this.q && this.d.e >= this.r + 600L) {
|
||||
} else if (this.q && this.d.k() >= this.r + 600L) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -634,7 +591,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public Random a(long i) {
|
||||
return new Random(this.d.u + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i);
|
||||
return new Random(this.d.j() + (long) (this.j * this.j * 4987142) + (long) (this.j * 5947611) + (long) (this.k * this.k) * 4392871L + (long) (this.k * 389711) ^ i);
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
|
@ -1,567 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ChunkProviderGenerate implements IChunkProvider {
|
||||
|
||||
private Random j;
|
||||
private NoiseGeneratorOctaves k;
|
||||
private NoiseGeneratorOctaves l;
|
||||
private NoiseGeneratorOctaves m;
|
||||
private NoiseGeneratorOctaves n;
|
||||
private NoiseGeneratorOctaves o;
|
||||
public NoiseGeneratorOctaves a;
|
||||
public NoiseGeneratorOctaves b;
|
||||
public NoiseGeneratorOctaves c;
|
||||
private World p;
|
||||
private double[] q;
|
||||
private double[] r = new double[256];
|
||||
private double[] s = new double[256];
|
||||
private double[] t = new double[256];
|
||||
private MapGenBase u = new MapGenCaves();
|
||||
private BiomeBase[] v;
|
||||
double[] d;
|
||||
double[] e;
|
||||
double[] f;
|
||||
double[] g;
|
||||
double[] h;
|
||||
int[][] i = new int[32][32];
|
||||
private double[] w;
|
||||
|
||||
public ChunkProviderGenerate(World world, long i) {
|
||||
this.p = world;
|
||||
this.j = new Random(i);
|
||||
this.k = new NoiseGeneratorOctaves(this.j, 16);
|
||||
this.l = new NoiseGeneratorOctaves(this.j, 16);
|
||||
this.m = new NoiseGeneratorOctaves(this.j, 8);
|
||||
this.n = new NoiseGeneratorOctaves(this.j, 4);
|
||||
this.o = new NoiseGeneratorOctaves(this.j, 4);
|
||||
this.a = new NoiseGeneratorOctaves(this.j, 10);
|
||||
this.b = new NoiseGeneratorOctaves(this.j, 16);
|
||||
this.c = new NoiseGeneratorOctaves(this.j, 8);
|
||||
}
|
||||
|
||||
public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase, double[] adouble) {
|
||||
byte b0 = 4;
|
||||
byte b1 = 64;
|
||||
int k = b0 + 1;
|
||||
byte b2 = 17;
|
||||
int l = b0 + 1;
|
||||
|
||||
this.q = this.a(this.q, i * b0, 0, j * b0, k, b2, l);
|
||||
|
||||
for (int i1 = 0; i1 < b0; ++i1) {
|
||||
for (int j1 = 0; j1 < b0; ++j1) {
|
||||
for (int k1 = 0; k1 < 16; ++k1) {
|
||||
double d0 = 0.125D;
|
||||
double d1 = this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
|
||||
double d2 = this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
|
||||
double d3 = this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
|
||||
double d4 = this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
|
||||
double d5 = (this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
|
||||
double d6 = (this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
|
||||
double d7 = (this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
|
||||
double d8 = (this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;
|
||||
|
||||
for (int l1 = 0; l1 < 8; ++l1) {
|
||||
double d9 = 0.25D;
|
||||
double d10 = d1;
|
||||
double d11 = d2;
|
||||
double d12 = (d3 - d1) * d9;
|
||||
double d13 = (d4 - d2) * d9;
|
||||
|
||||
for (int i2 = 0; i2 < 4; ++i2) {
|
||||
int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
|
||||
short short1 = 128;
|
||||
double d14 = 0.25D;
|
||||
double d15 = d10;
|
||||
double d16 = (d11 - d10) * d14;
|
||||
|
||||
for (int k2 = 0; k2 < 4; ++k2) {
|
||||
double d17 = adouble[(i1 * 4 + i2) * 16 + j1 * 4 + k2];
|
||||
int l2 = 0;
|
||||
|
||||
if (k1 * 8 + l1 < b1) {
|
||||
if (d17 < 0.5D && k1 * 8 + l1 >= b1 - 1) {
|
||||
l2 = Block.ICE.id;
|
||||
} else {
|
||||
l2 = Block.STATIONARY_WATER.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (d15 > 0.0D) {
|
||||
l2 = Block.STONE.id;
|
||||
}
|
||||
|
||||
abyte[j2] = (byte) l2;
|
||||
j2 += short1;
|
||||
d15 += d16;
|
||||
}
|
||||
|
||||
d10 += d12;
|
||||
d11 += d13;
|
||||
}
|
||||
|
||||
d1 += d5;
|
||||
d2 += d6;
|
||||
d3 += d7;
|
||||
d4 += d8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase) {
|
||||
byte b0 = 64;
|
||||
double d0 = 0.03125D;
|
||||
|
||||
this.r = this.n.a(this.r, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0, d0, 1.0D);
|
||||
this.s = this.n.a(this.s, (double) (i * 16), 109.0134D, (double) (j * 16), 16, 1, 16, d0, 1.0D, d0); // CraftBukkit -- i & j swapped.
|
||||
this.t = this.o.a(this.t, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
|
||||
|
||||
for (int k = 0; k < 16; ++k) {
|
||||
for (int l = 0; l < 16; ++l) {
|
||||
BiomeBase biomebase = abiomebase[k + l * 16];
|
||||
boolean flag = this.r[k + l * 16] + this.j.nextDouble() * 0.2D > 0.0D;
|
||||
boolean flag1 = this.s[k + l * 16] + this.j.nextDouble() * 0.2D > 3.0D;
|
||||
int i1 = (int) (this.t[k + l * 16] / 3.0D + 3.0D + this.j.nextDouble() * 0.25D);
|
||||
int j1 = -1;
|
||||
byte b1 = biomebase.o;
|
||||
byte b2 = biomebase.p;
|
||||
|
||||
for (int k1 = 127; k1 >= 0; --k1) {
|
||||
int l1 = (k + l * 16) * 128 + k1; // CraftBukkit (k*16+l) -> (k+l*16)
|
||||
|
||||
if (k1 <= 0 + this.j.nextInt(5)) {
|
||||
abyte[l1] = (byte) Block.BEDROCK.id;
|
||||
} else {
|
||||
byte b3 = abyte[l1];
|
||||
|
||||
if (b3 == 0) {
|
||||
j1 = -1;
|
||||
} else if (b3 == Block.STONE.id) {
|
||||
if (j1 == -1) {
|
||||
if (i1 <= 0) {
|
||||
b1 = 0;
|
||||
b2 = (byte) Block.STONE.id;
|
||||
} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
|
||||
b1 = biomebase.o;
|
||||
b2 = biomebase.p;
|
||||
if (flag1) {
|
||||
b1 = 0;
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
b2 = (byte) Block.GRAVEL.id;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
b1 = (byte) Block.SAND.id;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
b2 = (byte) Block.SAND.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (k1 < b0 && b1 == 0) {
|
||||
b1 = (byte) Block.STATIONARY_WATER.id;
|
||||
}
|
||||
|
||||
j1 = i1;
|
||||
if (k1 >= b0 - 1) {
|
||||
abyte[l1] = b1;
|
||||
} else {
|
||||
abyte[l1] = b2;
|
||||
}
|
||||
} else if (j1 > 0) {
|
||||
--j1;
|
||||
abyte[l1] = b2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Chunk b(int i, int j) {
|
||||
this.j.setSeed((long) i * 341873128712L + (long) j * 132897987541L);
|
||||
byte[] abyte = new byte['\u8000'];
|
||||
Chunk chunk = new Chunk(this.p, abyte, i, j);
|
||||
|
||||
this.v = this.p.a().a(this.v, i * 16, j * 16, 16, 16);
|
||||
double[] adouble = this.p.a().a;
|
||||
|
||||
this.a(i, j, abyte, this.v, adouble);
|
||||
this.a(i, j, abyte, this.v);
|
||||
this.u.a(this, this.p, i, j, abyte);
|
||||
chunk.b();
|
||||
return chunk;
|
||||
}
|
||||
|
||||
private double[] a(double[] adouble, int i, int j, int k, int l, int i1, int j1) {
|
||||
if (adouble == null) {
|
||||
adouble = new double[l * i1 * j1];
|
||||
}
|
||||
|
||||
double d0 = 684.412D;
|
||||
double d1 = 684.412D;
|
||||
double[] adouble1 = this.p.a().a;
|
||||
double[] adouble2 = this.p.a().b;
|
||||
|
||||
this.g = this.a.a(this.g, i, k, l, j1, 1.121D, 1.121D, 0.5D);
|
||||
this.h = this.b.a(this.h, i, k, l, j1, 200.0D, 200.0D, 0.5D);
|
||||
this.d = this.m.a(this.d, (double) i, (double) j, (double) k, l, i1, j1, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
|
||||
this.e = this.k.a(this.e, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
|
||||
this.f = this.l.a(this.f, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
|
||||
int k1 = 0;
|
||||
int l1 = 0;
|
||||
int i2 = 16 / l;
|
||||
|
||||
for (int j2 = 0; j2 < l; ++j2) {
|
||||
int k2 = j2 * i2 + i2 / 2;
|
||||
|
||||
for (int l2 = 0; l2 < j1; ++l2) {
|
||||
int i3 = l2 * i2 + i2 / 2;
|
||||
double d2 = adouble1[k2 * 16 + i3];
|
||||
double d3 = adouble2[k2 * 16 + i3] * d2;
|
||||
double d4 = 1.0D - d3;
|
||||
|
||||
d4 *= d4;
|
||||
d4 *= d4;
|
||||
d4 = 1.0D - d4;
|
||||
double d5 = (this.g[l1] + 256.0D) / 512.0D;
|
||||
|
||||
d5 *= d4;
|
||||
if (d5 > 1.0D) {
|
||||
d5 = 1.0D;
|
||||
}
|
||||
|
||||
double d6 = this.h[l1] / 8000.0D;
|
||||
|
||||
if (d6 < 0.0D) {
|
||||
d6 = -d6 * 0.3D;
|
||||
}
|
||||
|
||||
d6 = d6 * 3.0D - 2.0D;
|
||||
if (d6 < 0.0D) {
|
||||
d6 /= 2.0D;
|
||||
if (d6 < -1.0D) {
|
||||
d6 = -1.0D;
|
||||
}
|
||||
|
||||
d6 /= 1.4D;
|
||||
d6 /= 2.0D;
|
||||
d5 = 0.0D;
|
||||
} else {
|
||||
if (d6 > 1.0D) {
|
||||
d6 = 1.0D;
|
||||
}
|
||||
|
||||
d6 /= 8.0D;
|
||||
}
|
||||
|
||||
if (d5 < 0.0D) {
|
||||
d5 = 0.0D;
|
||||
}
|
||||
|
||||
d5 += 0.5D;
|
||||
d6 = d6 * (double) i1 / 16.0D;
|
||||
double d7 = (double) i1 / 2.0D + d6 * 4.0D;
|
||||
|
||||
++l1;
|
||||
|
||||
for (int j3 = 0; j3 < i1; ++j3) {
|
||||
double d8 = 0.0D;
|
||||
double d9 = ((double) j3 - d7) * 12.0D / d5;
|
||||
|
||||
if (d9 < 0.0D) {
|
||||
d9 *= 4.0D;
|
||||
}
|
||||
|
||||
double d10 = this.e[k1] / 512.0D;
|
||||
double d11 = this.f[k1] / 512.0D;
|
||||
double d12 = (this.d[k1] / 10.0D + 1.0D) / 2.0D;
|
||||
|
||||
if (d12 < 0.0D) {
|
||||
d8 = d10;
|
||||
} else if (d12 > 1.0D) {
|
||||
d8 = d11;
|
||||
} else {
|
||||
d8 = d10 + (d11 - d10) * d12;
|
||||
}
|
||||
|
||||
d8 -= d9;
|
||||
if (j3 > i1 - 4) {
|
||||
double d13 = (double) ((float) (j3 - (i1 - 4)) / 3.0F);
|
||||
|
||||
d8 = d8 * (1.0D - d13) + -10.0D * d13;
|
||||
}
|
||||
|
||||
adouble[k1] = d8;
|
||||
++k1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return adouble;
|
||||
}
|
||||
|
||||
public boolean a(int i, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(IChunkProvider ichunkprovider, int i, int j) {
|
||||
BlockSand.a = true;
|
||||
int k = i * 16;
|
||||
int l = j * 16;
|
||||
BiomeBase biomebase = this.p.a().a(k + 16, l + 16);
|
||||
|
||||
this.j.setSeed(this.p.u);
|
||||
long i1 = this.j.nextLong() / 2L * 2L + 1L;
|
||||
long j1 = this.j.nextLong() / 2L * 2L + 1L;
|
||||
|
||||
this.j.setSeed((long) i * i1 + (long) j * j1 ^ this.p.u);
|
||||
double d0 = 0.25D;
|
||||
int k1;
|
||||
int l1;
|
||||
int i2;
|
||||
|
||||
if (this.j.nextInt(4) == 0) {
|
||||
k1 = k + this.j.nextInt(16) + 8;
|
||||
l1 = this.j.nextInt(128);
|
||||
i2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenLakes(Block.STATIONARY_WATER.id)).a(this.p, this.j, k1, l1, i2);
|
||||
}
|
||||
|
||||
if (this.j.nextInt(8) == 0) {
|
||||
k1 = k + this.j.nextInt(16) + 8;
|
||||
l1 = this.j.nextInt(this.j.nextInt(120) + 8);
|
||||
i2 = l + this.j.nextInt(16) + 8;
|
||||
if (l1 < 64 || this.j.nextInt(10) == 0) {
|
||||
(new WorldGenLakes(Block.STATIONARY_LAVA.id)).a(this.p, this.j, k1, l1, i2);
|
||||
}
|
||||
}
|
||||
|
||||
int j2;
|
||||
|
||||
for (k1 = 0; k1 < 8; ++k1) {
|
||||
l1 = k + this.j.nextInt(16) + 8;
|
||||
i2 = this.j.nextInt(128);
|
||||
j2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenDungeons()).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 10; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(128);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenClay(32)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 20; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(128);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.DIRT.id, 32)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 10; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(128);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.GRAVEL.id, 32)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 20; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(128);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.COAL_ORE.id, 16)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 20; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(64);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.IRON_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 2; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(32);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.GOLD_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 8; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(16);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.REDSTONE_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 1; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(16);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.DIAMOND_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < 1; ++k1) {
|
||||
l1 = k + this.j.nextInt(16);
|
||||
i2 = this.j.nextInt(16) + this.j.nextInt(16);
|
||||
j2 = l + this.j.nextInt(16);
|
||||
(new WorldGenMinable(Block.LAPIS_ORE.id, 6)).a(this.p, this.j, l1, i2, j2);
|
||||
}
|
||||
|
||||
d0 = 0.5D;
|
||||
k1 = (int) ((this.c.a((double) k * d0, (double) l * d0) / 8.0D + this.j.nextDouble() * 4.0D + 4.0D) / 3.0D);
|
||||
l1 = 0;
|
||||
if (this.j.nextInt(10) == 0) {
|
||||
++l1;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.FOREST) {
|
||||
l1 += k1 + 5;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.RAINFOREST) {
|
||||
l1 += k1 + 5;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.SEASONAL_FOREST) {
|
||||
l1 += k1 + 2;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.TAIGA) {
|
||||
l1 += k1 + 5;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.DESERT) {
|
||||
l1 -= 20;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.TUNDRA) {
|
||||
l1 -= 20;
|
||||
}
|
||||
|
||||
if (biomebase == BiomeBase.PLAINS) {
|
||||
l1 -= 20;
|
||||
}
|
||||
|
||||
int k2;
|
||||
|
||||
for (i2 = 0; i2 < l1; ++i2) {
|
||||
j2 = k + this.j.nextInt(16) + 8;
|
||||
k2 = l + this.j.nextInt(16) + 8;
|
||||
WorldGenerator worldgenerator = biomebase.a(this.j);
|
||||
|
||||
worldgenerator.a(1.0D, 1.0D, 1.0D);
|
||||
worldgenerator.a(this.p, this.j, j2, this.p.d(j2, k2), k2);
|
||||
}
|
||||
|
||||
int l2;
|
||||
|
||||
for (i2 = 0; i2 < 2; ++i2) {
|
||||
j2 = k + this.j.nextInt(16) + 8;
|
||||
k2 = this.j.nextInt(128);
|
||||
l2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenFlowers(Block.YELLOW_FLOWER.id)).a(this.p, this.j, j2, k2, l2);
|
||||
}
|
||||
|
||||
if (this.j.nextInt(2) == 0) {
|
||||
i2 = k + this.j.nextInt(16) + 8;
|
||||
j2 = this.j.nextInt(128);
|
||||
k2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenFlowers(Block.RED_ROSE.id)).a(this.p, this.j, i2, j2, k2);
|
||||
}
|
||||
|
||||
if (this.j.nextInt(4) == 0) {
|
||||
i2 = k + this.j.nextInt(16) + 8;
|
||||
j2 = this.j.nextInt(128);
|
||||
k2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenFlowers(Block.BROWN_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2);
|
||||
}
|
||||
|
||||
if (this.j.nextInt(8) == 0) {
|
||||
i2 = k + this.j.nextInt(16) + 8;
|
||||
j2 = this.j.nextInt(128);
|
||||
k2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenFlowers(Block.RED_MUSHROOM.id)).a(this.p, this.j, i2, j2, k2);
|
||||
}
|
||||
|
||||
for (i2 = 0; i2 < 10; ++i2) {
|
||||
j2 = k + this.j.nextInt(16) + 8;
|
||||
k2 = this.j.nextInt(128);
|
||||
l2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenReed()).a(this.p, this.j, j2, k2, l2);
|
||||
}
|
||||
|
||||
if (this.j.nextInt(32) == 0) {
|
||||
i2 = k + this.j.nextInt(16) + 8;
|
||||
j2 = this.j.nextInt(128);
|
||||
k2 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenPumpkin()).a(this.p, this.j, i2, j2, k2);
|
||||
}
|
||||
|
||||
i2 = 0;
|
||||
if (biomebase == BiomeBase.DESERT) {
|
||||
i2 += 10;
|
||||
}
|
||||
|
||||
int i3;
|
||||
|
||||
for (j2 = 0; j2 < i2; ++j2) {
|
||||
k2 = k + this.j.nextInt(16) + 8;
|
||||
l2 = this.j.nextInt(128);
|
||||
i3 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenCactus()).a(this.p, this.j, k2, l2, i3);
|
||||
}
|
||||
|
||||
for (j2 = 0; j2 < 50; ++j2) {
|
||||
k2 = k + this.j.nextInt(16) + 8;
|
||||
l2 = this.j.nextInt(this.j.nextInt(120) + 8);
|
||||
i3 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenLiquids(Block.WATER.id)).a(this.p, this.j, k2, l2, i3);
|
||||
}
|
||||
|
||||
for (j2 = 0; j2 < 20; ++j2) {
|
||||
k2 = k + this.j.nextInt(16) + 8;
|
||||
l2 = this.j.nextInt(this.j.nextInt(this.j.nextInt(112) + 8) + 8);
|
||||
i3 = l + this.j.nextInt(16) + 8;
|
||||
(new WorldGenLiquids(Block.LAVA.id)).a(this.p, this.j, k2, l2, i3);
|
||||
}
|
||||
|
||||
this.w = this.p.a().a(this.w, k + 8, l + 8, 16, 16);
|
||||
|
||||
for (j2 = k + 8; j2 < k + 8 + 16; ++j2) {
|
||||
for (k2 = l + 8; k2 < l + 8 + 16; ++k2) {
|
||||
l2 = j2 - (k + 8);
|
||||
i3 = k2 - (l + 8);
|
||||
int j3 = this.p.e(j2, k2);
|
||||
double d1 = this.w[l2 * 16 + i3] - (double) (j3 - 64) / 64.0D * 0.3D;
|
||||
|
||||
if (d1 < 0.5D && j3 > 0 && j3 < 128 && this.p.isEmpty(j2, j3, k2) && this.p.getMaterial(j2, j3 - 1, k2).isSolid() && this.p.getMaterial(j2, j3 - 1, k2) != Material.ICE) {
|
||||
this.p.e(j2, j3, k2, Block.SNOW.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlockSand.a = false;
|
||||
}
|
||||
|
||||
public boolean a(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -38,8 +38,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public void c(int i, int j) {
|
||||
int k = i * 16 + 8 - this.g.spawnX;
|
||||
int l = j * 16 + 8 - this.g.spawnZ;
|
||||
ChunkCoordinates chunkcoordinates = this.g.l();
|
||||
int k = i * 16 + 8 - chunkcoordinates.a;
|
||||
int l = j * 16 + 8 - chunkcoordinates.c;
|
||||
short short1 = 128;
|
||||
|
||||
if (k < -short1 || k > short1 || l < -short1 || l > short1) {
|
||||
@ -105,7 +106,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public Chunk b(int i, int j) {
|
||||
Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit
|
||||
|
||||
return chunk == null ? (this.g.x ? this.d(i, j) : this.b) : chunk;
|
||||
return chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk;
|
||||
}
|
||||
|
||||
public Chunk e(int i, int j) { // Craftbukkit - public
|
||||
@ -116,7 +117,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
Chunk chunk = this.d.a(this.g, i, j);
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.r = this.g.e;
|
||||
chunk.r = this.g.k();
|
||||
}
|
||||
|
||||
return chunk;
|
||||
@ -140,7 +141,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public void b(Chunk chunk) { // Craftbukkit - public
|
||||
if (this.d != null) {
|
||||
try {
|
||||
chunk.r = this.g.e;
|
||||
chunk.r = this.g.k();
|
||||
this.d.a(this.g, chunk);
|
||||
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
ioexception.printStackTrace();
|
||||
@ -192,7 +193,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
if (!this.g.C) {
|
||||
if (!this.g.w) {
|
||||
// CraftBukkit start
|
||||
Server server = g.getServer();
|
||||
while (!this.a.isEmpty()) {
|
||||
@ -223,6 +224,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return !this.g.C;
|
||||
return !this.g.w;
|
||||
}
|
||||
}
|
||||
|
290
src/main/java/net/minecraft/server/ConsoleCommandHandler.java
Normale Datei
290
src/main/java/net/minecraft/server/ConsoleCommandHandler.java
Normale Datei
@ -0,0 +1,290 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ConsoleCommandHandler {
|
||||
|
||||
private static Logger a = Logger.getLogger("Minecraft");
|
||||
private MinecraftServer b;
|
||||
|
||||
public ConsoleCommandHandler(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
}
|
||||
|
||||
public void a(ServerCommand servercommand) {
|
||||
String s = servercommand.a;
|
||||
ICommandListener icommandlistener = servercommand.b;
|
||||
String s1 = icommandlistener.c();
|
||||
WorldServer worldserver = b.worlds.get(0); // Craftbukkit
|
||||
ServerConfigurationManager serverconfigurationmanager = this.b.f;
|
||||
|
||||
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
||||
if (s.toLowerCase().startsWith("list")) {
|
||||
icommandlistener.b("Connected players: " + serverconfigurationmanager.c());
|
||||
} else if (s.toLowerCase().startsWith("stop")) {
|
||||
this.a(s1, "Stopping the server..");
|
||||
this.b.a();
|
||||
} else if (s.toLowerCase().startsWith("save-all")) {
|
||||
this.a(s1, "Forcing save..");
|
||||
worldserver.a(true, (IProgressUpdate) null);
|
||||
this.a(s1, "Save complete.");
|
||||
} else if (s.toLowerCase().startsWith("save-off")) {
|
||||
this.a(s1, "Disabling level saving..");
|
||||
worldserver.w = true;
|
||||
} else if (s.toLowerCase().startsWith("save-on")) {
|
||||
this.a(s1, "Enabling level saving..");
|
||||
worldserver.w = false;
|
||||
} else {
|
||||
String s2;
|
||||
|
||||
if (s.toLowerCase().startsWith("op ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.e(s2);
|
||||
this.a(s1, "Opping " + s2);
|
||||
serverconfigurationmanager.a(s2, "\u00A7eYou are now op!");
|
||||
} else if (s.toLowerCase().startsWith("deop ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.f(s2);
|
||||
serverconfigurationmanager.a(s2, "\u00A7eYou are no longer op!");
|
||||
this.a(s1, "De-opping " + s2);
|
||||
} else if (s.toLowerCase().startsWith("ban-ip ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.c(s2);
|
||||
this.a(s1, "Banning ip " + s2);
|
||||
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.d(s2);
|
||||
this.a(s1, "Pardoning ip " + s2);
|
||||
} else {
|
||||
EntityPlayer entityplayer;
|
||||
|
||||
if (s.toLowerCase().startsWith("ban ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.a(s2);
|
||||
this.a(s1, "Banning " + s2);
|
||||
entityplayer = serverconfigurationmanager.i(s2);
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.a("Banned by admin");
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("pardon ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
serverconfigurationmanager.b(s2);
|
||||
this.a(s1, "Pardoning " + s2);
|
||||
} else {
|
||||
int i;
|
||||
|
||||
if (s.toLowerCase().startsWith("kick ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
entityplayer = null;
|
||||
|
||||
for (i = 0; i < serverconfigurationmanager.b.size(); ++i) {
|
||||
EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.b.get(i);
|
||||
|
||||
if (entityplayer1.name.equalsIgnoreCase(s2)) {
|
||||
entityplayer = entityplayer1;
|
||||
}
|
||||
}
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.a("Kicked by admin");
|
||||
this.a(s1, "Kicking " + entityplayer.name);
|
||||
} else {
|
||||
icommandlistener.b("Can\'t find user " + s2 + ". No kick.");
|
||||
}
|
||||
} else {
|
||||
String[] astring;
|
||||
EntityPlayer entityplayer2;
|
||||
|
||||
if (s.toLowerCase().startsWith("tp ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length == 3) {
|
||||
entityplayer = serverconfigurationmanager.i(astring[1]);
|
||||
entityplayer2 = serverconfigurationmanager.i(astring[2]);
|
||||
if (entityplayer == null) {
|
||||
icommandlistener.b("Can\'t find user " + astring[1] + ". No tp.");
|
||||
} else if (entityplayer2 == null) {
|
||||
icommandlistener.b("Can\'t find user " + astring[2] + ". No tp.");
|
||||
} else {
|
||||
entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
|
||||
this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("Syntax error, please provice a source and a target.");
|
||||
}
|
||||
} else {
|
||||
String s3;
|
||||
|
||||
if (s.toLowerCase().startsWith("give ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length != 3 && astring.length != 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
s3 = astring[1];
|
||||
entityplayer2 = serverconfigurationmanager.i(s3);
|
||||
if (entityplayer2 != null) {
|
||||
try {
|
||||
int j = Integer.parseInt(astring[2]);
|
||||
|
||||
if (Item.byId[j] != null) {
|
||||
this.a(s1, "Giving " + entityplayer2.name + " some " + j);
|
||||
int k = 1;
|
||||
|
||||
if (astring.length > 3) {
|
||||
k = this.a(astring[3], 1);
|
||||
}
|
||||
|
||||
if (k < 1) {
|
||||
k = 1;
|
||||
}
|
||||
|
||||
if (k > 64) {
|
||||
k = 64;
|
||||
}
|
||||
|
||||
entityplayer2.b(new ItemStack(j, k, 0));
|
||||
} else {
|
||||
icommandlistener.b("There\'s no item with id " + j);
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
icommandlistener.b("There\'s no item with id " + astring[2]);
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("Can\'t find user " + s3);
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("time ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length != 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
s3 = astring[1];
|
||||
|
||||
try {
|
||||
i = Integer.parseInt(astring[2]);
|
||||
if ("add".equalsIgnoreCase(s3)) {
|
||||
worldserver.a(worldserver.k() + (long) i);
|
||||
this.a(s1, "Added " + i + " to time");
|
||||
} else if ("set".equalsIgnoreCase(s3)) {
|
||||
worldserver.a((long) i);
|
||||
this.a(s1, "Set time to " + i);
|
||||
} else {
|
||||
icommandlistener.b("Unknown method, use either \"add\" or \"set\"");
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception1) {
|
||||
icommandlistener.b("Unable to convert time value, " + astring[2]);
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("say ")) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info("[" + s1 + "] " + s);
|
||||
serverconfigurationmanager.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s)));
|
||||
} else if (s.toLowerCase().startsWith("tell ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length >= 3) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info("[" + s1 + "->" + astring[1] + "] " + s);
|
||||
s = "\u00A77" + s1 + " whispers " + s;
|
||||
a.info(s);
|
||||
if (!serverconfigurationmanager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
|
||||
icommandlistener.b("There\'s no player by that name online.");
|
||||
}
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("whitelist ")) {
|
||||
this.a(s1, s, icommandlistener);
|
||||
} else {
|
||||
a.info("Unknown console command. Type \"help\" for help.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.a(icommandlistener);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String s, String s1, ICommandListener icommandlistener) {
|
||||
String[] astring = s1.split(" ");
|
||||
|
||||
if (astring.length >= 2) {
|
||||
String s2 = astring[1].toLowerCase();
|
||||
|
||||
if ("on".equals(s2)) {
|
||||
this.a(s, "Turned on white-listing");
|
||||
this.b.d.b("white-list", true);
|
||||
} else if ("off".equals(s2)) {
|
||||
this.a(s, "Turned off white-listing");
|
||||
this.b.d.b("white-list", false);
|
||||
} else if ("list".equals(s2)) {
|
||||
Set set = this.b.f.e();
|
||||
String s3 = "";
|
||||
|
||||
String s4;
|
||||
|
||||
for (Iterator iterator = set.iterator(); iterator.hasNext(); s3 = s3 + s4 + " ") {
|
||||
s4 = (String) iterator.next();
|
||||
}
|
||||
|
||||
icommandlistener.b("White-listed players: " + s3);
|
||||
} else {
|
||||
String s5;
|
||||
|
||||
if ("add".equals(s2) && astring.length == 3) {
|
||||
s5 = astring[2].toLowerCase();
|
||||
this.b.f.k(s5);
|
||||
this.a(s, "Added " + s5 + " to white-list");
|
||||
} else if ("remove".equals(s2) && astring.length == 3) {
|
||||
s5 = astring[2].toLowerCase();
|
||||
this.b.f.l(s5);
|
||||
this.a(s, "Removed " + s5 + " from white-list");
|
||||
} else if ("reload".equals(s2)) {
|
||||
this.b.f.f();
|
||||
this.a(s, "Reloaded white-list from file");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(ICommandListener icommandlistener) {
|
||||
icommandlistener.b("To run the server without a gui, start it like this:");
|
||||
icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
|
||||
icommandlistener.b("Console commands:");
|
||||
icommandlistener.b(" help or ? shows this message");
|
||||
icommandlistener.b(" kick <player> removes a player from the server");
|
||||
icommandlistener.b(" ban <player> bans a player from the server");
|
||||
icommandlistener.b(" pardon <player> pardons a banned player so that they can connect again");
|
||||
icommandlistener.b(" ban-ip <ip> bans an IP address from the server");
|
||||
icommandlistener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
|
||||
icommandlistener.b(" op <player> turns a player into an op");
|
||||
icommandlistener.b(" deop <player> removes op status from a player");
|
||||
icommandlistener.b(" tp <player1> <player2> moves one player to the same location as another player");
|
||||
icommandlistener.b(" give <player> <id> [num] gives a player a resource");
|
||||
icommandlistener.b(" tell <player> <message> sends a private message to a player");
|
||||
icommandlistener.b(" stop gracefully stops the server");
|
||||
icommandlistener.b(" save-all forces a server-wide level save");
|
||||
icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)");
|
||||
icommandlistener.b(" save-on re-enables terrain saving");
|
||||
icommandlistener.b(" list lists all currently connected players");
|
||||
icommandlistener.b(" say <message> broadcasts a message to all players");
|
||||
icommandlistener.b(" time <add|set> <amount> adds to or sets the world time (0-24000)");
|
||||
}
|
||||
|
||||
private void a(String s, String s1) {
|
||||
String s2 = s + ": " + s1;
|
||||
|
||||
this.b.f.j("\u00A77(" + s2 + ")");
|
||||
a.info(s2);
|
||||
}
|
||||
|
||||
private int a(String s, int i) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,8 +22,8 @@ public abstract class Entity {
|
||||
|
||||
private static int entityCount = 0;
|
||||
public int id;
|
||||
public double h;
|
||||
public boolean i;
|
||||
public double aB;
|
||||
public boolean aC;
|
||||
public Entity passenger;
|
||||
public Entity vehicle;
|
||||
public World world;
|
||||
@ -42,81 +42,81 @@ public abstract class Entity {
|
||||
public float lastPitch;
|
||||
public final AxisAlignedBB boundingBox;
|
||||
public boolean onGround;
|
||||
public boolean B;
|
||||
public boolean C;
|
||||
public boolean D;
|
||||
public boolean E;
|
||||
public boolean F;
|
||||
public boolean aV;
|
||||
public boolean aW;
|
||||
public boolean aX;
|
||||
public boolean aY;
|
||||
public boolean aZ;
|
||||
public boolean dead;
|
||||
public float height;
|
||||
public float length;
|
||||
public float width;
|
||||
public float K;
|
||||
public float L;
|
||||
protected boolean M;
|
||||
public float be;
|
||||
public float bf;
|
||||
protected boolean bg;
|
||||
protected float fallDistance;
|
||||
private int b;
|
||||
public double O;
|
||||
public double P;
|
||||
public double Q;
|
||||
public float R;
|
||||
public float S;
|
||||
public boolean T;
|
||||
public float U;
|
||||
public boolean V;
|
||||
public double bi;
|
||||
public double bj;
|
||||
public double bk;
|
||||
public float bl;
|
||||
public float bm;
|
||||
public boolean bn;
|
||||
public float bo;
|
||||
public boolean bp;
|
||||
protected Random random;
|
||||
public int ticksLived;
|
||||
public int maxFireTicks;
|
||||
public int fireTicks;
|
||||
public int maxAirTicks; // Craftbukkit: Make public
|
||||
protected boolean ab;
|
||||
protected boolean bv;
|
||||
public int noDamageTicks;
|
||||
public int airTicks;
|
||||
private boolean justCreated;
|
||||
protected boolean ae;
|
||||
protected boolean by;
|
||||
protected DataWatcher datawatcher;
|
||||
private double d;
|
||||
private double e;
|
||||
public boolean ag;
|
||||
public boolean bA;
|
||||
public int chunkX;
|
||||
public int ai;
|
||||
public int bC;
|
||||
public int chunkZ;
|
||||
|
||||
public Entity(World world) {
|
||||
this.id = entityCount++;
|
||||
this.h = 1.0D;
|
||||
this.i = false;
|
||||
this.aB = 1.0D;
|
||||
this.aC = false;
|
||||
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
this.onGround = false;
|
||||
this.D = false;
|
||||
this.E = false;
|
||||
this.F = true;
|
||||
this.aX = false;
|
||||
this.aY = false;
|
||||
this.aZ = true;
|
||||
this.dead = false;
|
||||
this.height = 0.0F;
|
||||
this.length = 0.6F;
|
||||
this.width = 1.8F;
|
||||
this.K = 0.0F;
|
||||
this.L = 0.0F;
|
||||
this.M = true;
|
||||
this.be = 0.0F;
|
||||
this.bf = 0.0F;
|
||||
this.bg = true;
|
||||
this.fallDistance = 0.0F;
|
||||
this.b = 1;
|
||||
this.R = 0.0F;
|
||||
this.S = 0.0F;
|
||||
this.T = false;
|
||||
this.U = 0.0F;
|
||||
this.V = false;
|
||||
this.bl = 0.0F;
|
||||
this.bm = 0.0F;
|
||||
this.bn = false;
|
||||
this.bo = 0.0F;
|
||||
this.bp = false;
|
||||
this.random = new Random();
|
||||
this.ticksLived = 0;
|
||||
this.maxFireTicks = 1;
|
||||
this.fireTicks = 0;
|
||||
this.maxAirTicks = 300;
|
||||
this.ab = false;
|
||||
this.bv = false;
|
||||
this.noDamageTicks = 0;
|
||||
this.airTicks = 300;
|
||||
this.justCreated = true;
|
||||
this.ae = false;
|
||||
this.by = false;
|
||||
this.datawatcher = new DataWatcher();
|
||||
this.ag = false;
|
||||
this.bA = false;
|
||||
this.world = world;
|
||||
this.a(0.0D, 0.0D, 0.0D);
|
||||
this.datawatcher.a(0, Byte.valueOf((byte) 0));
|
||||
@ -125,7 +125,7 @@ public abstract class Entity {
|
||||
|
||||
protected abstract void a();
|
||||
|
||||
public DataWatcher p() {
|
||||
public DataWatcher O() {
|
||||
return this.datawatcher;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public abstract class Entity {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void q() {
|
||||
public void C() {
|
||||
this.dead = true;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public abstract class Entity {
|
||||
this.width = f1;
|
||||
}
|
||||
|
||||
protected void b(float f, float f1) {
|
||||
protected void c(float f, float f1) {
|
||||
this.yaw = f;
|
||||
this.pitch = f1;
|
||||
}
|
||||
@ -158,27 +158,27 @@ public abstract class Entity {
|
||||
float f = this.length / 2.0F;
|
||||
float f1 = this.width;
|
||||
|
||||
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.R, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.R + (double) f1, d2 + (double) f);
|
||||
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bl, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bl + (double) f1, d2 + (double) f);
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
this.r();
|
||||
public void f_() {
|
||||
this.H();
|
||||
}
|
||||
|
||||
public void r() {
|
||||
public void H() {
|
||||
if (this.vehicle != null && this.vehicle.dead) {
|
||||
this.vehicle = null;
|
||||
}
|
||||
|
||||
++this.ticksLived;
|
||||
this.K = this.L;
|
||||
this.be = this.bf;
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.lastPitch = this.pitch;
|
||||
this.lastYaw = this.yaw;
|
||||
if (this.v()) {
|
||||
if (!this.ab && !this.justCreated) {
|
||||
if (this.g_()) {
|
||||
if (!this.bv && !this.justCreated) {
|
||||
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
|
||||
|
||||
if (f > 1.0F) {
|
||||
@ -206,16 +206,16 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
this.ab = true;
|
||||
this.bv = true;
|
||||
this.fireTicks = 0;
|
||||
} else {
|
||||
this.ab = false;
|
||||
this.bv = false;
|
||||
}
|
||||
|
||||
if (this.world.isStatic) {
|
||||
this.fireTicks = 0;
|
||||
} else if (this.fireTicks > 0) {
|
||||
if (this.ae) {
|
||||
if (this.by) {
|
||||
this.fireTicks -= 4;
|
||||
if (this.fireTicks < 0) {
|
||||
this.fireTicks = 0;
|
||||
@ -246,12 +246,12 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.x()) {
|
||||
this.s();
|
||||
if (this.Q()) {
|
||||
this.P();
|
||||
}
|
||||
|
||||
if (this.locY < -64.0D) {
|
||||
this.t();
|
||||
this.M();
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
@ -262,8 +262,8 @@ public abstract class Entity {
|
||||
this.justCreated = false;
|
||||
}
|
||||
|
||||
protected void s() {
|
||||
if (!this.ae) {
|
||||
protected void P() {
|
||||
if (!this.by) {
|
||||
// CraftBukkit start
|
||||
// TODO: this event spams!
|
||||
if(this instanceof EntityLiving) {
|
||||
@ -301,8 +301,8 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void t() {
|
||||
this.q();
|
||||
protected void M() {
|
||||
this.C();
|
||||
}
|
||||
|
||||
public boolean b(double d0, double d1, double d2) {
|
||||
@ -313,10 +313,10 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void c(double d0, double d1, double d2) {
|
||||
if (this.T) {
|
||||
if (this.bn) {
|
||||
this.boundingBox.d(d0, d1, d2);
|
||||
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.R;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.bl;
|
||||
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
||||
} else {
|
||||
double d3 = this.locX;
|
||||
@ -325,7 +325,7 @@ public abstract class Entity {
|
||||
double d6 = d1;
|
||||
double d7 = d2;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.b();
|
||||
boolean flag = this.onGround && this.J();
|
||||
boolean flag = this.onGround && this.U();
|
||||
|
||||
if (flag) {
|
||||
double d8;
|
||||
@ -358,7 +358,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.F && d6 != d1) {
|
||||
if (!this.aZ && d6 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -373,7 +373,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.F && d5 != d0) {
|
||||
if (!this.aZ && d5 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -384,7 +384,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.F && d7 != d2) {
|
||||
if (!this.aZ && d7 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -394,13 +394,13 @@ public abstract class Entity {
|
||||
double d10;
|
||||
int k;
|
||||
|
||||
if (this.S > 0.0F && flag1 && this.R < 0.05F && (d5 != d0 || d7 != d2)) {
|
||||
if (this.bm > 0.0F && flag1 && this.bl < 0.05F && (d5 != d0 || d7 != d2)) {
|
||||
d9 = d0;
|
||||
d10 = d1;
|
||||
double d11 = d2;
|
||||
|
||||
d0 = d5;
|
||||
d1 = (double) this.S;
|
||||
d1 = (double) this.bm;
|
||||
d2 = d7;
|
||||
AxisAlignedBB axisalignedbb1 = this.boundingBox.b();
|
||||
|
||||
@ -412,7 +412,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.F && d6 != d1) {
|
||||
if (!this.aZ && d6 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -423,7 +423,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.F && d5 != d0) {
|
||||
if (!this.aZ && d5 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -434,7 +434,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.F && d7 != d2) {
|
||||
if (!this.aZ && d7 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -446,17 +446,17 @@ public abstract class Entity {
|
||||
d2 = d11;
|
||||
this.boundingBox.b(axisalignedbb1);
|
||||
} else {
|
||||
this.R = (float) ((double) this.R + 0.5D);
|
||||
this.bl = (float) ((double) this.bl + 0.5D);
|
||||
}
|
||||
}
|
||||
|
||||
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.R;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.bl;
|
||||
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
||||
this.B = d5 != d0 || d7 != d2;
|
||||
this.C = d6 != d1;
|
||||
this.aV = d5 != d0 || d7 != d2;
|
||||
this.aW = d6 != d1;
|
||||
this.onGround = d6 != d1 && d6 < 0.0D;
|
||||
this.D = this.B || this.C;
|
||||
this.aX = this.aV || this.aW;
|
||||
this.a(d1, this.onGround);
|
||||
if (d5 != d0) {
|
||||
this.motX = 0.0D;
|
||||
@ -477,7 +477,7 @@ public abstract class Entity {
|
||||
int j1;
|
||||
|
||||
// Craftbukkit start
|
||||
if ((B) && (getBukkitEntity() instanceof Vehicle)) {
|
||||
if ((this.bg) && (getBukkitEntity() instanceof Vehicle)) {
|
||||
Vehicle vehicle = (Vehicle)getBukkitEntity();
|
||||
org.bukkit.World wrld = ((WorldServer)world).getWorld();
|
||||
org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ));
|
||||
@ -493,17 +493,17 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block);
|
||||
((WorldServer)world).getServer().getPluginManager().callEvent(event);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
if (this.M && !flag) {
|
||||
this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
|
||||
if (this.bg && !flag) {
|
||||
this.bf = (float) ((double) this.bf + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
|
||||
l = MathHelper.b(this.locX);
|
||||
i1 = MathHelper.b(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
j1 = MathHelper.b(this.locZ);
|
||||
k = this.world.getTypeId(l, i1, j1);
|
||||
if (this.L > (float) this.b && k > 0) {
|
||||
if (this.bf > (float) this.b && k > 0) {
|
||||
++this.b;
|
||||
StepSound stepsound = Block.byId[k].stepSound;
|
||||
|
||||
@ -539,11 +539,11 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
this.R *= 0.4F;
|
||||
boolean flag2 = this.v();
|
||||
this.bl *= 0.4F;
|
||||
boolean flag2 = this.g_();
|
||||
|
||||
if (this.world.c(this.boundingBox)) {
|
||||
this.b(1);
|
||||
this.a(1);
|
||||
if (!flag2) {
|
||||
++this.fireTicks;
|
||||
// CraftBukkit start
|
||||
@ -586,14 +586,14 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB u() {
|
||||
public AxisAlignedBB d() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void b(int i) {
|
||||
if (!this.ae) {
|
||||
protected void a(int i) {
|
||||
if (!this.by) {
|
||||
// CraftBukkit start
|
||||
if(this instanceof EntityLiving) {
|
||||
if (this instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE;
|
||||
@ -614,12 +614,12 @@ public abstract class Entity {
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
public boolean v() {
|
||||
public boolean g_() {
|
||||
return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D), Material.WATER, this);
|
||||
}
|
||||
|
||||
public boolean a(Material material) {
|
||||
double d0 = this.locY + (double) this.w();
|
||||
double d0 = this.locY + (double) this.p();
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.d((float) MathHelper.b(d0));
|
||||
int k = MathHelper.b(this.locZ);
|
||||
@ -635,11 +635,11 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public float w() {
|
||||
public float p() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public boolean x() {
|
||||
public boolean Q() {
|
||||
return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
public float c(float f) {
|
||||
int i = MathHelper.b(this.locX);
|
||||
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
|
||||
int j = MathHelper.b(this.locY - (double) this.height + d0);
|
||||
@ -677,7 +677,7 @@ public abstract class Entity {
|
||||
this.lastZ = this.locZ = d2;
|
||||
this.lastYaw = this.yaw = f;
|
||||
this.lastPitch = this.pitch = f1;
|
||||
this.R = 0.0F;
|
||||
this.bl = 0.0F;
|
||||
double d3 = (double) (this.lastYaw - f);
|
||||
|
||||
if (d3 < -180.0D) {
|
||||
@ -689,19 +689,19 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.b(f, f1);
|
||||
this.c(f, f1);
|
||||
}
|
||||
|
||||
public void c(double d0, double d1, double d2, float f, float f1) {
|
||||
this.O = this.lastX = this.locX = d0;
|
||||
this.P = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.Q = this.lastZ = this.locZ = d2;
|
||||
this.bi = this.lastX = this.locX = d0;
|
||||
this.bj = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.bk = this.lastZ = this.locZ = d2;
|
||||
this.yaw = f;
|
||||
this.pitch = f1;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
public float a(Entity entity) {
|
||||
public float f(Entity entity) {
|
||||
float f = (float) (this.locX - entity.locX);
|
||||
float f1 = (float) (this.locY - entity.locY);
|
||||
float f2 = (float) (this.locZ - entity.locZ);
|
||||
@ -725,7 +725,7 @@ public abstract class Entity {
|
||||
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
}
|
||||
|
||||
public double b(Entity entity) {
|
||||
public double g(Entity entity) {
|
||||
double d0 = this.locX - entity.locX;
|
||||
double d1 = this.locY - entity.locY;
|
||||
double d2 = this.locZ - entity.locZ;
|
||||
@ -735,7 +735,7 @@ public abstract class Entity {
|
||||
|
||||
public void b(EntityHuman entityhuman) {}
|
||||
|
||||
public void c(Entity entity) {
|
||||
public void h(Entity entity) {
|
||||
if (entity.passenger != this && entity.vehicle != this) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
@ -755,8 +755,8 @@ public abstract class Entity {
|
||||
d1 *= d3;
|
||||
d0 *= 0.05000000074505806D;
|
||||
d1 *= 0.05000000074505806D;
|
||||
d0 *= (double) (1.0F - this.U);
|
||||
d1 *= (double) (1.0F - this.U);
|
||||
d0 *= (double) (1.0F - this.bo);
|
||||
d1 *= (double) (1.0F - this.bo);
|
||||
this.f(-d0, 0.0D, -d1);
|
||||
entity.f(d0, 0.0D, d1);
|
||||
}
|
||||
@ -769,27 +769,27 @@ public abstract class Entity {
|
||||
this.motZ += d2;
|
||||
}
|
||||
|
||||
protected void y() {
|
||||
this.E = true;
|
||||
protected void R() {
|
||||
this.aY = true;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
this.y();
|
||||
this.R();
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
public boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void b(Entity entity, int i) {}
|
||||
public void c(Entity entity, int i) {}
|
||||
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
String s = this.A();
|
||||
String s = this.S();
|
||||
|
||||
if (!this.dead && s != null) {
|
||||
nbttagcompound.a("id", s);
|
||||
@ -808,35 +808,47 @@ public abstract class Entity {
|
||||
nbttagcompound.a("Fire", (short) this.fireTicks);
|
||||
nbttagcompound.a("Air", (short) this.airTicks);
|
||||
nbttagcompound.a("OnGround", this.onGround);
|
||||
nbttagcompound.a("World", world.w); // Craftbukkit
|
||||
nbttagcompound.a("World", world.q.j); // CraftBukkit
|
||||
this.a(nbttagcompound);
|
||||
}
|
||||
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Pos");
|
||||
NBTTagList nbttaglist1 = nbttagcompound.k("Motion");
|
||||
NBTTagList nbttaglist2 = nbttagcompound.k("Rotation");
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Pos");
|
||||
NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
|
||||
NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");
|
||||
|
||||
this.a(0.0D, 0.0D, 0.0D);
|
||||
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
|
||||
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
|
||||
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
|
||||
this.lastX = this.O = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
||||
this.lastY = this.P = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
||||
this.lastZ = this.Q = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
|
||||
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
|
||||
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
|
||||
this.fallDistance = nbttagcompound.f("FallDistance");
|
||||
this.fireTicks = nbttagcompound.c("Fire");
|
||||
this.airTicks = nbttagcompound.c("Air");
|
||||
this.onGround = nbttagcompound.l("OnGround");
|
||||
if (Math.abs(this.motX) > 10.0D) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
|
||||
if (Math.abs(this.motY) > 10.0D) {
|
||||
this.motY = 0.0D;
|
||||
}
|
||||
|
||||
if (Math.abs(this.motZ) > 10.0D) {
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
this.lastX = this.bi = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
||||
this.lastY = this.bj = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
||||
this.lastZ = this.bk = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
|
||||
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a % 6.2831855F;
|
||||
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a % 6.2831855F;
|
||||
this.fallDistance = nbttagcompound.g("FallDistance");
|
||||
this.fireTicks = nbttagcompound.d("Fire");
|
||||
this.airTicks = nbttagcompound.d("Air");
|
||||
this.onGround = nbttagcompound.m("OnGround");
|
||||
|
||||
// Craftbukkit start
|
||||
if (nbttagcompound.a("World")) {
|
||||
String worldName = nbttagcompound.h("World");
|
||||
|
||||
if (nbttagcompound.b("World")) {
|
||||
String worldName = nbttagcompound.i("World");
|
||||
|
||||
for (WorldServer world : ((WorldServer)this.world).getServer().getServer().worlds) {
|
||||
if (world.w.equals(worldName)) {
|
||||
if (world.q.j.equals(worldName)) {
|
||||
this.world = world;
|
||||
break;
|
||||
}
|
||||
@ -848,7 +860,7 @@ public abstract class Entity {
|
||||
this.b(nbttagcompound);
|
||||
}
|
||||
|
||||
protected final String A() {
|
||||
protected final String S() {
|
||||
return EntityTypes.b(this);
|
||||
}
|
||||
|
||||
@ -884,7 +896,7 @@ public abstract class Entity {
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
public EntityItem a(int i, int j) {
|
||||
public EntityItem b(int i, int j) {
|
||||
return this.a(i, j, 0.0F);
|
||||
}
|
||||
|
||||
@ -900,13 +912,13 @@ public abstract class Entity {
|
||||
return entityitem;
|
||||
}
|
||||
|
||||
public boolean B() {
|
||||
public boolean J() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public boolean C() {
|
||||
public boolean D() {
|
||||
int i = MathHelper.b(this.locX);
|
||||
int j = MathHelper.b(this.locY + (double) this.w());
|
||||
int j = MathHelper.b(this.locY + (double) this.p());
|
||||
int k = MathHelper.b(this.locZ);
|
||||
|
||||
return this.world.d(i, j, k);
|
||||
@ -916,19 +928,19 @@ public abstract class Entity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB d(Entity entity) {
|
||||
public AxisAlignedBB a_(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void D() {
|
||||
public void x() {
|
||||
if (this.vehicle.dead) {
|
||||
this.vehicle = null;
|
||||
} else {
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.b_();
|
||||
this.vehicle.E();
|
||||
this.f_();
|
||||
this.vehicle.h_();
|
||||
this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
|
||||
|
||||
for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) {
|
||||
@ -974,11 +986,11 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void E() {
|
||||
this.passenger.a(this.locX, this.locY + this.k() + this.passenger.F(), this.locZ);
|
||||
public void h_() {
|
||||
this.passenger.a(this.locX, this.locY + this.k() + this.passenger.B(), this.locZ);
|
||||
}
|
||||
|
||||
public double F() {
|
||||
public double B() {
|
||||
return (double) this.height;
|
||||
}
|
||||
|
||||
@ -986,7 +998,7 @@ public abstract class Entity {
|
||||
return (double) this.width * 0.75D;
|
||||
}
|
||||
|
||||
public void e(Entity entity) {
|
||||
public void b(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
}
|
||||
@ -1001,7 +1013,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void setPassengerOf(Entity entity) {
|
||||
// e(null) doesn't really fly for overloaded methods,
|
||||
// b(null) doesn't really fly for overloaded methods,
|
||||
// so this method is needed
|
||||
|
||||
// CraftBukkit end
|
||||
@ -1050,25 +1062,25 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public Vec3D G() {
|
||||
public Vec3D N() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void H() {}
|
||||
public void T() {}
|
||||
|
||||
public ItemStack[] I() {
|
||||
public ItemStack[] k_() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean J() {
|
||||
return this.c(1);
|
||||
public boolean U() {
|
||||
return this.d(1);
|
||||
}
|
||||
|
||||
public void b(boolean flag) {
|
||||
this.a(1, flag);
|
||||
}
|
||||
|
||||
protected boolean c(int i) {
|
||||
protected boolean d(int i) {
|
||||
return (this.datawatcher.a(0) & 1 << i) != 0;
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,11 @@ public class EntityArrow extends Entity {
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
private int f = 0;
|
||||
private boolean ak = false;
|
||||
private boolean g = false;
|
||||
public int a = 0;
|
||||
public EntityLiving b;
|
||||
private int al;
|
||||
private int am = 0;
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
public EntityArrow(World world) {
|
||||
super(world);
|
||||
@ -37,7 +37,7 @@ public class EntityArrow extends Entity {
|
||||
super(world);
|
||||
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.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
@ -70,11 +70,11 @@ public class EntityArrow extends Entity {
|
||||
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
|
||||
this.al = 0;
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
public void f_() {
|
||||
super.f_();
|
||||
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
|
||||
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
@ -86,26 +86,26 @@ public class EntityArrow extends Entity {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (this.ak) {
|
||||
if (this.g) {
|
||||
int i = this.world.getTypeId(this.c, this.d, this.e);
|
||||
|
||||
if (i == this.f) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
++this.h;
|
||||
if (this.h == 1200) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.ak = false;
|
||||
this.g = 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;
|
||||
this.h = 0;
|
||||
this.i = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
++this.i;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
@ -127,7 +127,7 @@ public class EntityArrow extends Entity {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1.c_() && (entity1 != this.b || this.am >= 5)) {
|
||||
if (entity1.d_() && (entity1 != this.b || this.i >= 5)) {
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -180,14 +180,14 @@ public class EntityArrow extends Entity {
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
this.q();
|
||||
this.C();
|
||||
} else {
|
||||
this.motX *= -0.10000000149011612D;
|
||||
this.motY *= -0.10000000149011612D;
|
||||
this.motZ *= -0.10000000149011612D;
|
||||
this.yaw += 180.0F;
|
||||
this.lastYaw += 180.0F;
|
||||
this.am = 0;
|
||||
this.i = 0;
|
||||
}
|
||||
} else {
|
||||
this.c = movingobjectposition.b;
|
||||
@ -202,7 +202,7 @@ public class EntityArrow extends Entity {
|
||||
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.g = true;
|
||||
this.a = 7;
|
||||
}
|
||||
}
|
||||
@ -234,7 +234,7 @@ public class EntityArrow extends Entity {
|
||||
float f3 = 0.99F;
|
||||
|
||||
f1 = 0.03F;
|
||||
if (this.v()) {
|
||||
if (this.g_()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
@ -257,24 +257,24 @@ public class EntityArrow extends Entity {
|
||||
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));
|
||||
nbttagcompound.a("inGround", (byte) (this.g ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
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;
|
||||
this.c = nbttagcompound.d("xTile");
|
||||
this.d = nbttagcompound.d("yTile");
|
||||
this.e = nbttagcompound.d("zTile");
|
||||
this.f = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.g = nbttagcompound.c("inGround") == 1;
|
||||
}
|
||||
|
||||
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))) {
|
||||
if (this.g && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
entityhuman.b(this, 1);
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ public class EntityBoat extends Entity {
|
||||
private int d;
|
||||
private double e;
|
||||
private double f;
|
||||
private double ak;
|
||||
private double al;
|
||||
private double am;
|
||||
private double g;
|
||||
private double h;
|
||||
private double i;
|
||||
public double maxSpeed = 0.4D; // CraftBukkit
|
||||
|
||||
// CraftBukkit start
|
||||
public void c(Entity entity) {
|
||||
public void h(Entity entity) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
@ -43,7 +43,7 @@ public class EntityBoat extends Entity {
|
||||
return;
|
||||
}
|
||||
|
||||
super.c(entity);
|
||||
super.h(entity);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -52,23 +52,23 @@ public class EntityBoat extends Entity {
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
this.c = 1;
|
||||
this.i = true;
|
||||
this.aC = true;
|
||||
this.a(1.5F, 0.6F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.M = false;
|
||||
this.bg = false;
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public AxisAlignedBB d(Entity entity) {
|
||||
public AxisAlignedBB a_(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
|
||||
public AxisAlignedBB u() {
|
||||
public AxisAlignedBB d() {
|
||||
return this.boundingBox;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
public boolean e_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class EntityBoat extends Entity {
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.a += i * 10;
|
||||
this.y();
|
||||
this.R();
|
||||
if (this.a > 40) {
|
||||
int j;
|
||||
|
||||
@ -126,7 +126,7 @@ public class EntityBoat extends Entity {
|
||||
this.a(Item.STICK.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -135,11 +135,11 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
public void f_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
@ -148,7 +148,7 @@ public class EntityBoat extends Entity {
|
||||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
super.b_();
|
||||
super.f_();
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
}
|
||||
@ -182,9 +182,9 @@ public class EntityBoat extends Entity {
|
||||
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;
|
||||
d5 = this.locZ + (this.g - this.locZ) / (double) this.d;
|
||||
|
||||
for (d6 = this.al - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) {
|
||||
for (d6 = this.h - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -193,10 +193,10 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d6 / (double) this.d);
|
||||
this.pitch = (float) ((double) this.pitch + (this.am - (double) this.pitch) / (double) this.d);
|
||||
this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
|
||||
--this.d;
|
||||
this.a(d3, d4, d5);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
d3 = this.locX + this.motX;
|
||||
d4 = this.locY + this.motY;
|
||||
@ -269,9 +269,9 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.B && d5 > 0.15D) {
|
||||
if (this.aV && d5 > 0.15D) {
|
||||
if (!this.world.isStatic) {
|
||||
this.q();
|
||||
this.C();
|
||||
|
||||
int k;
|
||||
|
||||
@ -317,7 +317,7 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d13);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
@ -338,8 +338,8 @@ public class EntityBoat extends Entity {
|
||||
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 (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
|
||||
entity.h(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -350,12 +350,12 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void E() {
|
||||
public void h_() {
|
||||
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);
|
||||
this.passenger.a(this.locX + d0, this.locY + this.k() + this.passenger.B(), this.locZ + d1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityhuman.e(this);
|
||||
entityhuman.b((Entity) this);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@ public class EntityCreature extends EntityLiving {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
protected void c_() {
|
||||
this.e = false;
|
||||
float f = 16.0F;
|
||||
|
||||
@ -41,7 +41,7 @@ public class EntityCreature extends EntityLiving {
|
||||
if (this.d != null) {
|
||||
this.a = this.world.a(this, this.d, f);
|
||||
}
|
||||
} else if (!this.d.B()) {
|
||||
} else if (!this.d.J()) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
@ -55,9 +55,9 @@ public class EntityCreature extends EntityLiving {
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
float f1 = this.d.a((Entity) this);
|
||||
float f1 = this.d.f(this);
|
||||
|
||||
if (this.i(this.d)) {
|
||||
if (this.e(this.d)) {
|
||||
this.a(this.d, f1);
|
||||
}
|
||||
}
|
||||
@ -92,8 +92,8 @@ public class EntityCreature extends EntityLiving {
|
||||
}
|
||||
|
||||
int l1 = MathHelper.b(this.boundingBox.b);
|
||||
boolean flag1 = this.v();
|
||||
boolean flag2 = this.x();
|
||||
boolean flag1 = this.g_();
|
||||
boolean flag2 = this.Q();
|
||||
|
||||
this.pitch = 0.0F;
|
||||
if (this.a != null && this.random.nextInt(100) != 0) {
|
||||
@ -110,7 +110,7 @@ public class EntityCreature extends EntityLiving {
|
||||
}
|
||||
}
|
||||
|
||||
this.bA = false;
|
||||
this.ax = false;
|
||||
if (vec3d != null) {
|
||||
double d1 = vec3d.a - this.locX;
|
||||
double d2 = vec3d.c - this.locZ;
|
||||
@ -118,7 +118,7 @@ public class EntityCreature extends EntityLiving {
|
||||
float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; // Craftbukkit
|
||||
float f5 = f4 - this.yaw;
|
||||
|
||||
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) {
|
||||
for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -142,12 +142,12 @@ public class EntityCreature extends EntityLiving {
|
||||
|
||||
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
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;
|
||||
this.au = -MathHelper.a(f5) * this.av * 1.0F;
|
||||
this.av = MathHelper.b(f5) * this.av * 1.0F;
|
||||
}
|
||||
|
||||
if (d3 > 0.0D) {
|
||||
this.bA = true;
|
||||
this.ax = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,15 +155,15 @@ public class EntityCreature extends EntityLiving {
|
||||
this.b(this.d, 30.0F);
|
||||
}
|
||||
|
||||
if (this.B) {
|
||||
this.bA = true;
|
||||
if (this.aV) {
|
||||
this.ax = true;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.8F && (flag1 || flag2)) {
|
||||
this.bA = true;
|
||||
this.ax = true;
|
||||
}
|
||||
} else {
|
||||
super.d();
|
||||
super.c_();
|
||||
this.a = null;
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ public class EntityCreeper extends EntityMonster {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
public void f_() {
|
||||
this.b = this.a;
|
||||
if (this.world.isStatic) {
|
||||
int i = this.K();
|
||||
int i = this.r();
|
||||
|
||||
if (i > 0 && this.a == 0) {
|
||||
this.world.a(this, "random.fuse", 1.0F, 0.5F);
|
||||
@ -48,7 +48,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
super.b_();
|
||||
super.f_();
|
||||
}
|
||||
|
||||
protected String f() {
|
||||
@ -59,18 +59,18 @@ public class EntityCreeper extends EntityMonster {
|
||||
return "mob.creeperdeath";
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
super.f(entity);
|
||||
public void a(Entity entity) {
|
||||
super.a(entity);
|
||||
if (entity instanceof EntitySkeleton) {
|
||||
this.a(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
||||
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
int i = this.K();
|
||||
int i = this.r();
|
||||
|
||||
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
|
||||
this.a(-1);
|
||||
this.e(-1);
|
||||
--this.a;
|
||||
if (this.a < 0) {
|
||||
this.a = 0;
|
||||
@ -80,7 +80,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
this.world.a(this, "random.fuse", 1.0F, 0.5F);
|
||||
}
|
||||
|
||||
this.a(1);
|
||||
this.e(1);
|
||||
++this.a;
|
||||
if (this.a >= 30) {
|
||||
// Craftbukkit start
|
||||
@ -90,7 +90,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
this.q();
|
||||
this.C();
|
||||
} else {
|
||||
this.a = 0;
|
||||
}
|
||||
@ -105,11 +105,11 @@ public class EntityCreeper extends EntityMonster {
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
private int K() {
|
||||
private int r() {
|
||||
return this.datawatcher.a(16);
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
private void e(int i) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) i));
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ public class EntityEgg extends Entity {
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
private EntityLiving ak;
|
||||
private int al;
|
||||
private int am = 0;
|
||||
private EntityLiving g;
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
public EntityEgg(World world) {
|
||||
super(world);
|
||||
@ -35,9 +35,9 @@ public class EntityEgg extends Entity {
|
||||
|
||||
public EntityEgg(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
this.ak = entityliving;
|
||||
this.g = entityliving;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
@ -53,7 +53,7 @@ public class EntityEgg extends Entity {
|
||||
|
||||
public EntityEgg(World world, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.al = 0;
|
||||
this.h = 0;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.a(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
@ -78,14 +78,14 @@ public class EntityEgg extends Entity {
|
||||
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
|
||||
this.al = 0;
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
this.O = this.locX;
|
||||
this.P = this.locY;
|
||||
this.Q = this.locZ;
|
||||
super.b_();
|
||||
public void f_() {
|
||||
this.bi = this.locX;
|
||||
this.bj = this.locY;
|
||||
this.bk = this.locZ;
|
||||
super.f_();
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
@ -94,9 +94,9 @@ public class EntityEgg extends Entity {
|
||||
int i = this.world.getTypeId(this.b, this.c, this.d);
|
||||
|
||||
if (i == this.e) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
++this.h;
|
||||
if (this.h == 1200) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
return;
|
||||
@ -106,10 +106,10 @@ public class EntityEgg extends Entity {
|
||||
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;
|
||||
this.h = 0;
|
||||
this.i = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
++this.i;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
@ -130,7 +130,7 @@ public class EntityEgg extends Entity {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) {
|
||||
if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -157,7 +157,7 @@ public class EntityEgg extends Entity {
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity();
|
||||
org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
@ -169,13 +169,13 @@ public class EntityEgg extends Entity {
|
||||
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the egg should stick or not, i.e. !bounce
|
||||
stick = movingobjectposition.g.a(this.ak, event.getDamage());
|
||||
stick = movingobjectposition.g.a(this.g, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the egg should bounce or not
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.g.a(this.ak, 0);
|
||||
stick = movingobjectposition.g.a(this.g, 0);
|
||||
}
|
||||
|
||||
if (stick) {
|
||||
@ -190,10 +190,10 @@ public class EntityEgg extends Entity {
|
||||
}
|
||||
MobType hatchingType = MobType.CHICKEN;
|
||||
|
||||
if (this.ak instanceof EntityPlayer) {
|
||||
if (this.g instanceof EntityPlayer) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Type eventType = Type.PLAYER_EGG_THROW;
|
||||
Player player = (this.ak == null) ? null : (Player) this.ak.getBukkitEntity();
|
||||
Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity();
|
||||
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType);
|
||||
server.getPluginManager().callEvent(event);
|
||||
@ -246,7 +246,7 @@ public class EntityEgg extends Entity {
|
||||
|
||||
// The world we're spawning in accepts this creature
|
||||
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
|
||||
if ((isAnimal && this.world.L) || (!isAnimal && this.world.K)) {
|
||||
if ((isAnimal && this.world.E) || (!isAnimal && this.world.D)) {
|
||||
entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
||||
this.world.a(entity);
|
||||
}
|
||||
@ -258,7 +258,7 @@ public class EntityEgg extends Entity {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
this.locX += this.motX;
|
||||
@ -289,7 +289,7 @@ public class EntityEgg extends Entity {
|
||||
float f2 = 0.99F;
|
||||
float f3 = 0.03F;
|
||||
|
||||
if (this.v()) {
|
||||
if (this.g_()) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
@ -316,19 +316,19 @@ public class EntityEgg extends Entity {
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
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;
|
||||
this.b = nbttagcompound.d("xTile");
|
||||
this.c = nbttagcompound.d("yTile");
|
||||
this.d = nbttagcompound.d("zTile");
|
||||
this.e = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.f = nbttagcompound.c("inGround") == 1;
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
entityhuman.b(this, 1);
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ public class EntityFireball extends Entity {
|
||||
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int ak = -1;
|
||||
private int al = 0;
|
||||
private boolean am = false;
|
||||
private int g = -1;
|
||||
private int h = 0;
|
||||
private boolean i = false;
|
||||
public int a = 0;
|
||||
private EntityLiving an;
|
||||
private int ao;
|
||||
private int ap = 0;
|
||||
private EntityLiving j;
|
||||
private int k;
|
||||
private int l = 0;
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
@ -35,7 +35,7 @@ public class EntityFireball extends Entity {
|
||||
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.an = entityliving;
|
||||
this.j = 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);
|
||||
@ -51,33 +51,33 @@ public class EntityFireball extends Entity {
|
||||
this.d = d2 / d3 * 0.1D;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
public void f_() {
|
||||
super.f_();
|
||||
this.fireTicks = 10;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (this.am) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.ak);
|
||||
if (this.i) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
|
||||
if (i == this.al) {
|
||||
++this.ao;
|
||||
if (this.ao == 1200) {
|
||||
this.q();
|
||||
if (i == this.h) {
|
||||
++this.k;
|
||||
if (this.k == 1200) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.am = false;
|
||||
this.i = 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;
|
||||
this.k = 0;
|
||||
this.l = 0;
|
||||
} else {
|
||||
++this.ap;
|
||||
++this.l;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
@ -97,7 +97,7 @@ public class EntityFireball extends Entity {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1.c_() && (entity1 != this.an || this.ap >= 25)) {
|
||||
if (entity1.d_() && (entity1 != this.j || this.l >= 25)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -123,7 +123,7 @@ public class EntityFireball extends Entity {
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.an == null) ? null : this.an.getBukkitEntity();
|
||||
org.bukkit.entity.Entity shooter = (this.j == null) ? null : this.j.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
@ -135,27 +135,27 @@ public class EntityFireball extends Entity {
|
||||
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the fireball should stick or not, i.e. !bounce
|
||||
stick = movingobjectposition.g.a(this.an, event.getDamage());
|
||||
stick = movingobjectposition.g.a(this.j, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the fireball should bounce or not
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.g.a(this.an, 0);
|
||||
stick = movingobjectposition.g.a(this.j, 0);
|
||||
}
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
|
||||
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
// Craftbukkit end
|
||||
}
|
||||
@ -187,7 +187,7 @@ public class EntityFireball extends Entity {
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.95F;
|
||||
|
||||
if (this.v()) {
|
||||
if (this.g_()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
float f3 = 0.25F;
|
||||
|
||||
@ -210,29 +210,29 @@ public class EntityFireball extends Entity {
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
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("zTile", (short) this.g);
|
||||
nbttagcompound.a("inTile", (byte) this.h);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.am ? 1 : 0));
|
||||
nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
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;
|
||||
this.e = nbttagcompound.d("xTile");
|
||||
this.f = nbttagcompound.d("yTile");
|
||||
this.g = nbttagcompound.d("zTile");
|
||||
this.h = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.i = nbttagcompound.c("inGround") == 1;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
this.y();
|
||||
this.R();
|
||||
if (entity != null) {
|
||||
Vec3D vec3d = entity.G();
|
||||
Vec3D vec3d = entity.N();
|
||||
|
||||
if (vec3d != null) {
|
||||
this.motX = vec3d.a;
|
||||
|
@ -14,20 +14,20 @@ public class EntityFish extends Entity {
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int ak = 0;
|
||||
private boolean al = false;
|
||||
private int g = 0;
|
||||
private boolean h = false;
|
||||
public int a = 0;
|
||||
public EntityHuman b;
|
||||
private int am;
|
||||
private int an = 0;
|
||||
private int ao = 0;
|
||||
private int i;
|
||||
private int j = 0;
|
||||
private int k = 0;
|
||||
public Entity c = null;
|
||||
private int ap;
|
||||
private double aq;
|
||||
private double ar;
|
||||
private double as;
|
||||
private double at;
|
||||
private double au;
|
||||
private int l;
|
||||
private double m;
|
||||
private double n;
|
||||
private double o;
|
||||
private double p;
|
||||
private double q;
|
||||
|
||||
public EntityFish(World world) {
|
||||
super(world);
|
||||
@ -74,19 +74,19 @@ public class EntityFish extends Entity {
|
||||
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
|
||||
this.am = 0;
|
||||
this.i = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
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;
|
||||
public void f_() {
|
||||
super.f_();
|
||||
if (this.l > 0) {
|
||||
double d0 = this.locX + (this.m - this.locX) / (double) this.l;
|
||||
double d1 = this.locY + (this.n - this.locY) / (double) this.l;
|
||||
double d2 = this.locZ + (this.o - this.locZ) / (double) this.l;
|
||||
|
||||
double d3;
|
||||
|
||||
for (d3 = this.at - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -94,18 +94,17 @@ public class EntityFish extends Entity {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
|
||||
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.yaw = (float) ((double) this.yaw + d3 / (double) this.l);
|
||||
this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l);
|
||||
--this.l;
|
||||
this.a(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
ItemStack itemstack = this.b.P();
|
||||
ItemStack itemstack = this.b.z();
|
||||
|
||||
// CraftBukkit - cast this.b to Entity
|
||||
if (this.b.dead || !this.b.B() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.b((Entity) this.b) > 1024.0D) {
|
||||
this.q();
|
||||
if (this.b.dead || !this.b.J() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.g(this.b) > 1024.0D) {
|
||||
this.C();
|
||||
this.b.hookedFish = null;
|
||||
return;
|
||||
}
|
||||
@ -126,26 +125,26 @@ public class EntityFish extends Entity {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (this.al) {
|
||||
if (this.h) {
|
||||
int i = this.world.getTypeId(this.d, this.e, this.f);
|
||||
|
||||
if (i == this.ak) {
|
||||
++this.am;
|
||||
if (this.am == 1200) {
|
||||
this.q();
|
||||
if (i == this.g) {
|
||||
++this.i;
|
||||
if (this.i == 1200) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.al = false;
|
||||
this.h = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.am = 0;
|
||||
this.an = 0;
|
||||
this.i = 0;
|
||||
this.j = 0;
|
||||
} else {
|
||||
++this.an;
|
||||
++this.j;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
@ -167,7 +166,7 @@ public class EntityFish extends Entity {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1.c_() && (entity1 != this.b || this.an >= 5)) {
|
||||
if (entity1.d_() && (entity1 != this.b || this.j >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -214,15 +213,15 @@ public class EntityFish extends Entity {
|
||||
stick = movingobjectposition.g.a(this.b, 0);
|
||||
}
|
||||
if (!stick) {
|
||||
c = movingobjectposition.g;
|
||||
this.c = movingobjectposition.g;
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
this.al = true;
|
||||
this.h = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.al) {
|
||||
if (!this.h) {
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
@ -248,7 +247,7 @@ public class EntityFish extends Entity {
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.92F;
|
||||
|
||||
if (this.onGround || this.B) {
|
||||
if (this.onGround || this.aV) {
|
||||
f2 = 0.5F;
|
||||
}
|
||||
|
||||
@ -266,10 +265,10 @@ public class EntityFish extends Entity {
|
||||
}
|
||||
|
||||
if (d6 > 0.0D) {
|
||||
if (this.ao > 0) {
|
||||
--this.ao;
|
||||
if (this.k > 0) {
|
||||
--this.k;
|
||||
} else if (this.random.nextInt(500) == 0) {
|
||||
this.ao = this.random.nextInt(30) + 10;
|
||||
this.k = this.random.nextInt(30) + 10;
|
||||
this.motY -= 0.20000000298023224D;
|
||||
this.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);
|
||||
@ -292,7 +291,7 @@ public class EntityFish extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ao > 0) {
|
||||
if (this.k > 0) {
|
||||
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
|
||||
}
|
||||
|
||||
@ -315,21 +314,21 @@ public class EntityFish extends Entity {
|
||||
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("inTile", (byte) this.g);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.al ? 1 : 0));
|
||||
nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
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;
|
||||
this.d = nbttagcompound.d("xTile");
|
||||
this.e = nbttagcompound.d("yTile");
|
||||
this.f = nbttagcompound.d("zTile");
|
||||
this.g = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.h = nbttagcompound.c("inGround") == 1;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int h() {
|
||||
byte b0 = 0;
|
||||
|
||||
if (this.c != null) {
|
||||
@ -343,7 +342,7 @@ public class EntityFish extends Entity {
|
||||
this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D;
|
||||
this.c.motZ += d2 * d4;
|
||||
b0 = 3;
|
||||
} else if (this.ao > 0) {
|
||||
} else if (this.k > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||
double d5 = this.b.locX - this.locX;
|
||||
double d6 = this.b.locY - this.locY;
|
||||
@ -358,11 +357,11 @@ public class EntityFish extends Entity {
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
if (this.al) {
|
||||
if (this.h) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
this.q();
|
||||
this.C();
|
||||
this.b.hookedFish = null;
|
||||
return b0;
|
||||
}
|
||||
|
@ -18,21 +18,26 @@ 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 byte l = 0;
|
||||
public int m = 0;
|
||||
public float n;
|
||||
public float o;
|
||||
public boolean p = false;
|
||||
public int q = 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 double t;
|
||||
public double u;
|
||||
public double v;
|
||||
public double w;
|
||||
public double x;
|
||||
public double y;
|
||||
private boolean sleeping;
|
||||
private ChunkCoordinates b;
|
||||
private int sleepTicks;
|
||||
public float z;
|
||||
public float A;
|
||||
private int d = 0;
|
||||
public EntityFish hookedFish = null;
|
||||
|
||||
public EntityHuman(World world) {
|
||||
@ -40,92 +45,121 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
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);
|
||||
ChunkCoordinates chunkcoordinates = world.l();
|
||||
|
||||
this.c((double) chunkcoordinates.a + 0.5D, (double) (chunkcoordinates.b + 1), (double) chunkcoordinates.c + 0.5D, 0.0F, 0.0F);
|
||||
this.health = 20;
|
||||
this.aS = "humanoid";
|
||||
this.aR = 180.0F;
|
||||
this.P = "humanoid";
|
||||
this.O = 180.0F;
|
||||
this.maxFireTicks = 20;
|
||||
this.texture = "/mob/char.png";
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public void f_() {
|
||||
if (this.E()) {
|
||||
++this.sleepTicks;
|
||||
if (this.sleepTicks > 100) {
|
||||
this.sleepTicks = 100;
|
||||
}
|
||||
|
||||
if (!this.l()) {
|
||||
this.a(true, true);
|
||||
} else if (!this.world.isStatic && this.world.c()) {
|
||||
this.a(false, true);
|
||||
}
|
||||
} else if (this.sleepTicks > 0) {
|
||||
++this.sleepTicks;
|
||||
if (this.sleepTicks >= 110) {
|
||||
this.sleepTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.f_();
|
||||
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
|
||||
this.L();
|
||||
this.t();
|
||||
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;
|
||||
this.t = this.w;
|
||||
this.u = this.x;
|
||||
this.v = this.y;
|
||||
double d0 = this.locX - this.w;
|
||||
double d1 = this.locY - this.x;
|
||||
double d2 = this.locZ - this.y;
|
||||
double d3 = 10.0D;
|
||||
|
||||
if (d0 > d3) {
|
||||
this.ay = this.aB = this.locX;
|
||||
this.t = this.w = this.locX;
|
||||
}
|
||||
|
||||
if (d2 > d3) {
|
||||
this.aA = this.aD = this.locZ;
|
||||
this.v = this.y = this.locZ;
|
||||
}
|
||||
|
||||
if (d1 > d3) {
|
||||
this.az = this.aC = this.locY;
|
||||
this.u = this.x = this.locY;
|
||||
}
|
||||
|
||||
if (d0 < -d3) {
|
||||
this.ay = this.aB = this.locX;
|
||||
this.t = this.w = this.locX;
|
||||
}
|
||||
|
||||
if (d2 < -d3) {
|
||||
this.aA = this.aD = this.locZ;
|
||||
this.v = this.y = this.locZ;
|
||||
}
|
||||
|
||||
if (d1 < -d3) {
|
||||
this.az = this.aC = this.locY;
|
||||
this.u = this.x = this.locY;
|
||||
}
|
||||
|
||||
this.aB += d0 * 0.25D;
|
||||
this.aD += d2 * 0.25D;
|
||||
this.aC += d1 * 0.25D;
|
||||
this.w += d0 * 0.25D;
|
||||
this.y += d2 * 0.25D;
|
||||
this.x += d1 * 0.25D;
|
||||
}
|
||||
|
||||
protected void L() {
|
||||
protected boolean w() {
|
||||
return this.health <= 0 || this.E();
|
||||
}
|
||||
|
||||
protected void t() {
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
public void D() {
|
||||
super.D();
|
||||
this.as = this.at;
|
||||
this.at = 0.0F;
|
||||
public void x() {
|
||||
super.x();
|
||||
this.n = this.o;
|
||||
this.o = 0.0F;
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
if (this.au) {
|
||||
++this.av;
|
||||
if (this.av == 8) {
|
||||
this.av = 0;
|
||||
this.au = false;
|
||||
protected void c_() {
|
||||
if (this.p) {
|
||||
++this.q;
|
||||
if (this.q == 8) {
|
||||
this.q = 0;
|
||||
this.p = false;
|
||||
}
|
||||
} else {
|
||||
this.av = 0;
|
||||
this.q = 0;
|
||||
}
|
||||
|
||||
this.aY = (float) this.av / 8.0F;
|
||||
this.V = (float) this.q / 8.0F;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (this.world.k == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
|
||||
this.d(1);
|
||||
public void q() {
|
||||
if (this.world.j == 0 && this.health < 20 && this.ticksLived % 20 * 12 == 0) {
|
||||
this.b(1);
|
||||
}
|
||||
|
||||
this.inventory.f();
|
||||
this.as = this.at;
|
||||
super.o();
|
||||
this.inventory.e();
|
||||
this.n = this.o;
|
||||
super.q();
|
||||
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
|
||||
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
|
||||
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; // CraftBukkit
|
||||
|
||||
if (f > 0.1F) {
|
||||
f = 0.1F;
|
||||
@ -139,8 +173,8 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
f1 = 0.0F;
|
||||
}
|
||||
|
||||
this.at += (f - this.at) * 0.4F;
|
||||
this.bh += (f1 - this.bh) * 0.8F;
|
||||
this.o += (f - this.o) * 0.4F;
|
||||
this.ae += (f1 - this.ae) * 0.8F;
|
||||
if (this.health > 0) {
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(1.0D, 0.0D, 1.0D));
|
||||
|
||||
@ -149,19 +183,19 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (!entity.dead) {
|
||||
this.j(entity);
|
||||
this.i(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void j(Entity entity) {
|
||||
private void i(Entity entity) {
|
||||
entity.b(this);
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
super.f(entity);
|
||||
public void a(Entity entity) {
|
||||
super.a(entity);
|
||||
this.a(0.2F, 0.2F);
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.motY = 0.10000000149011612D;
|
||||
@ -169,10 +203,10 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.a(new ItemStack(Item.APPLE, 1), true);
|
||||
}
|
||||
|
||||
this.inventory.h();
|
||||
this.inventory.g();
|
||||
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);
|
||||
this.motX = (double) (-MathHelper.b((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
|
||||
this.motZ = (double) (-MathHelper.a((this.aa + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
|
||||
} else {
|
||||
this.motX = this.motZ = 0.0D;
|
||||
}
|
||||
@ -180,12 +214,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.height = 0.1F;
|
||||
}
|
||||
|
||||
public void b(Entity entity, int i) {
|
||||
this.ar += i;
|
||||
public void c(Entity entity, int i) {
|
||||
this.m += i;
|
||||
}
|
||||
|
||||
public void O() {
|
||||
this.a(this.inventory.b(this.inventory.c, 1), false);
|
||||
public void y() {
|
||||
this.a(this.inventory.a(this.inventory.c, 1), false);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
@ -194,7 +228,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
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 entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.p(), this.locZ, itemstack);
|
||||
|
||||
entityitem.c = 40;
|
||||
float f = 0.1F;
|
||||
@ -264,43 +298,59 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Inventory");
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Inventory");
|
||||
|
||||
this.inventory.b(nbttaglist);
|
||||
this.dimension = nbttagcompound.d("Dimension");
|
||||
this.dimension = nbttagcompound.e("Dimension");
|
||||
this.sleeping = nbttagcompound.m("Sleeping");
|
||||
this.sleepTicks = nbttagcompound.d("SleepTimer");
|
||||
if (this.sleeping) {
|
||||
this.b = new ChunkCoordinates(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ));
|
||||
this.a(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList()));
|
||||
nbttagcompound.a("Dimension", this.dimension);
|
||||
nbttagcompound.a("Sleeping", this.sleeping);
|
||||
nbttagcompound.a("SleepTimer", (short) this.sleepTicks);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {}
|
||||
|
||||
public void a(int i, int j, int k) {}
|
||||
public void b(int i, int j, int k) {}
|
||||
|
||||
public void c(Entity entity, int i) {}
|
||||
public void b(Entity entity, int i) {}
|
||||
|
||||
public float w() {
|
||||
public float p() {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
protected void l_() {
|
||||
this.height = 1.62F;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
this.bw = 0;
|
||||
this.at = 0;
|
||||
if (this.health <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.E()) {
|
||||
this.a(true, true);
|
||||
}
|
||||
|
||||
if (entity instanceof EntityMonster || entity instanceof EntityArrow) {
|
||||
if (this.world.k == 0) {
|
||||
if (this.world.j == 0) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (this.world.k == 1) {
|
||||
if (this.world.j == 1) {
|
||||
i = i / 3 + 1;
|
||||
}
|
||||
|
||||
if (this.world.k == 3) {
|
||||
if (this.world.j == 3) {
|
||||
i = i * 3 / 2;
|
||||
}
|
||||
}
|
||||
@ -309,14 +359,14 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
}
|
||||
|
||||
protected void e(int i) {
|
||||
int j = 25 - this.inventory.g();
|
||||
int k = i * j + this.a;
|
||||
protected void c(int i) {
|
||||
int j = 25 - this.inventory.f();
|
||||
int k = i * j + this.d;
|
||||
|
||||
this.inventory.c(i);
|
||||
i = k / 25;
|
||||
this.a = k % 25;
|
||||
super.e(i);
|
||||
this.d = k % 25;
|
||||
super.c(i);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {}
|
||||
@ -325,43 +375,43 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public void a(TileEntitySign tileentitysign) {}
|
||||
|
||||
public void g(Entity entity) {
|
||||
public void c(Entity entity) {
|
||||
if (!entity.a(this)) {
|
||||
ItemStack itemstack = this.P();
|
||||
ItemStack itemstack = this.z();
|
||||
|
||||
if (itemstack != null && entity instanceof EntityLiving) {
|
||||
itemstack.b((EntityLiving) entity);
|
||||
if (itemstack.count <= 0) {
|
||||
itemstack.a(this);
|
||||
this.Q();
|
||||
this.A();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack P() {
|
||||
return this.inventory.e();
|
||||
public ItemStack z() {
|
||||
return this.inventory.b();
|
||||
}
|
||||
|
||||
public void Q() {
|
||||
public void A() {
|
||||
this.inventory.a(this.inventory.c, (ItemStack) null);
|
||||
}
|
||||
|
||||
public double F() {
|
||||
public double B() {
|
||||
return (double) (this.height - 0.5F);
|
||||
}
|
||||
|
||||
public void K() {
|
||||
this.av = -1;
|
||||
this.au = true;
|
||||
public void r() {
|
||||
this.q = -1;
|
||||
this.p = true;
|
||||
}
|
||||
|
||||
public void h(Entity entity) {
|
||||
public void d(Entity entity) {
|
||||
int i = this.inventory.a(entity);
|
||||
|
||||
if (i > 0) {
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
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();
|
||||
@ -381,13 +431,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
ItemStack itemstack = this.P();
|
||||
ItemStack itemstack = this.z();
|
||||
|
||||
if (itemstack != null && entity instanceof EntityLiving) {
|
||||
itemstack.a((EntityLiving) entity);
|
||||
if (itemstack.count <= 0) {
|
||||
itemstack.a(this);
|
||||
this.Q();
|
||||
this.A();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,11 +445,129 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void q() {
|
||||
super.q();
|
||||
public void C() {
|
||||
super.C();
|
||||
this.defaultContainer.a(this);
|
||||
if (this.activeContainer != null) {
|
||||
this.activeContainer.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean D() {
|
||||
return !this.sleeping && super.D();
|
||||
}
|
||||
|
||||
public boolean a(int i, int j, int k) {
|
||||
if (!this.E() && this.J()) {
|
||||
if (this.world.m.c) {
|
||||
return false;
|
||||
} else if (this.world.c()) {
|
||||
return false;
|
||||
} else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) {
|
||||
this.a(0.2F, 0.2F);
|
||||
this.height = 0.2F;
|
||||
if (this.world.f(i, j, k)) {
|
||||
int l = this.world.getData(i, j, k);
|
||||
int i1 = BlockBed.c(l);
|
||||
float f = 0.5F;
|
||||
float f1 = 0.5F;
|
||||
|
||||
switch (i1) {
|
||||
case 0:
|
||||
f1 = 0.9F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
f = 0.1F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f1 = 0.1F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
f = 0.9F;
|
||||
}
|
||||
|
||||
this.e(i1);
|
||||
this.a((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
|
||||
} else {
|
||||
this.a((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
|
||||
}
|
||||
|
||||
this.sleeping = true;
|
||||
this.sleepTicks = 0;
|
||||
this.b = new ChunkCoordinates(i, j, k);
|
||||
this.motX = this.motZ = this.motY = 0.0D;
|
||||
if (!this.world.isStatic) {
|
||||
this.world.o();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void e(int i) {
|
||||
this.z = 0.0F;
|
||||
this.A = 0.0F;
|
||||
switch (i) {
|
||||
case 0:
|
||||
this.A = -1.8F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.z = 1.8F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.A = 1.8F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.z = -1.8F;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(boolean flag, boolean flag1) {
|
||||
this.a(0.6F, 1.8F);
|
||||
this.l_();
|
||||
ChunkCoordinates chunkcoordinates = this.b;
|
||||
|
||||
if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c) == Block.BED.id) {
|
||||
BlockBed.a(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, false);
|
||||
ChunkCoordinates chunkcoordinates1 = BlockBed.g(this.world, chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c, 0);
|
||||
|
||||
this.a((double) ((float) chunkcoordinates1.a + 0.5F), (double) ((float) chunkcoordinates1.b + this.height + 0.1F), (double) ((float) chunkcoordinates1.c + 0.5F));
|
||||
}
|
||||
|
||||
this.sleeping = false;
|
||||
if (!this.world.isStatic && flag1) {
|
||||
this.world.o();
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.sleepTicks = 0;
|
||||
} else {
|
||||
this.sleepTicks = 100;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean l() {
|
||||
return this.world.getTypeId(this.b.a, this.b.b, this.b.c) == Block.BED.id;
|
||||
}
|
||||
|
||||
public boolean E() {
|
||||
return this.sleeping;
|
||||
}
|
||||
|
||||
public boolean F() {
|
||||
return this.sleeping && this.sleepTicks >= 100;
|
||||
}
|
||||
|
||||
public void a(String s) {}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class EntityItem extends Entity {
|
||||
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;
|
||||
this.bg = false;
|
||||
}
|
||||
|
||||
public EntityItem(World world) {
|
||||
@ -36,8 +36,8 @@ public class EntityItem extends Entity {
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
public void f_() {
|
||||
super.f_();
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
@ -76,11 +76,11 @@ public class EntityItem extends Entity {
|
||||
++this.e;
|
||||
++this.b;
|
||||
if (this.b >= 6000) {
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean v() {
|
||||
public boolean g_() {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
}
|
||||
|
||||
@ -162,15 +162,15 @@ public class EntityItem extends Entity {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b(int i) {
|
||||
protected void a(int i) {
|
||||
this.a((Entity) null, i);
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
this.y();
|
||||
this.R();
|
||||
this.f -= i;
|
||||
if (this.f <= 0) {
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -183,9 +183,9 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
this.f = nbttagcompound.c("Health") & 255;
|
||||
this.b = nbttagcompound.c("Age");
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item");
|
||||
this.f = nbttagcompound.d("Health") & 255;
|
||||
this.b = nbttagcompound.d("Age");
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item");
|
||||
|
||||
this.a = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
@ -203,7 +203,7 @@ public class EntityItem extends Entity {
|
||||
if (!event.isCancelled() && entityhuman.inventory.a(this.a)) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, i);
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@ -18,84 +18,84 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
public int maxNoDamageTicks = 20;
|
||||
public float aG;
|
||||
public float aH;
|
||||
public float aI = 0.0F;
|
||||
public float aJ = 0.0F;
|
||||
protected float aK;
|
||||
protected float aL;
|
||||
protected float aM;
|
||||
protected float aN;
|
||||
protected boolean aO = true;
|
||||
public float D;
|
||||
public float E;
|
||||
public float F = 0.0F;
|
||||
public float G = 0.0F;
|
||||
protected float H;
|
||||
protected float I;
|
||||
protected float J;
|
||||
protected float K;
|
||||
protected boolean L = true;
|
||||
protected String texture = "/mob/char.png";
|
||||
protected boolean aQ = true;
|
||||
protected float aR = 0.0F;
|
||||
protected String aS = null;
|
||||
protected float aT = 1.0F;
|
||||
protected int aU = 0;
|
||||
protected float aV = 0.0F;
|
||||
public boolean aW = false;
|
||||
public float aX;
|
||||
public float aY;
|
||||
protected boolean N = true;
|
||||
protected float O = 0.0F;
|
||||
protected String P = null;
|
||||
protected float Q = 1.0F;
|
||||
protected int R = 0;
|
||||
protected float S = 0.0F;
|
||||
public boolean T = false;
|
||||
public float U;
|
||||
public float V;
|
||||
public int health = 10;
|
||||
public int ba;
|
||||
public int X;
|
||||
private int a;
|
||||
public int hurtTicks;
|
||||
public int bc;
|
||||
public float bd = 0.0F;
|
||||
public int Z;
|
||||
public float aa = 0.0F;
|
||||
public int deathTicks = 0;
|
||||
public int attackTicks = 0;
|
||||
public float bg;
|
||||
public float bh;
|
||||
protected boolean bi = false;
|
||||
public int bj = -1;
|
||||
public float bk = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
|
||||
public float bl;
|
||||
public float bm;
|
||||
public float bn;
|
||||
protected int bo;
|
||||
protected double bp;
|
||||
protected double bq;
|
||||
protected double br;
|
||||
protected double bs;
|
||||
protected double bt;
|
||||
float bu = 0.0F;
|
||||
public float ad;
|
||||
public float ae;
|
||||
protected boolean af = false;
|
||||
public int ag = -1;
|
||||
public float ah = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
|
||||
public float ai;
|
||||
public float aj;
|
||||
public float ak;
|
||||
protected int al;
|
||||
protected double am;
|
||||
protected double an;
|
||||
protected double ao;
|
||||
protected double ap;
|
||||
protected double aq;
|
||||
float ar = 0.0F;
|
||||
protected int lastDamage = 0;
|
||||
protected int bw = 0;
|
||||
protected float bx;
|
||||
protected float by;
|
||||
protected float bz;
|
||||
protected boolean bA = false;
|
||||
protected float bB = 0.0F;
|
||||
protected float bC = 0.7F;
|
||||
protected int at = 0;
|
||||
protected float au;
|
||||
protected float av;
|
||||
protected float aw;
|
||||
protected boolean ax = false;
|
||||
protected float ay = 0.0F;
|
||||
protected float az = 0.7F;
|
||||
private Entity b;
|
||||
private int c = 0;
|
||||
|
||||
public EntityLiving(World world) {
|
||||
super(world);
|
||||
this.i = true;
|
||||
this.aH = (float) (Math.random() + 1.0D) * 0.01F;
|
||||
this.aC = true;
|
||||
this.E = (float) (Math.random() + 1.0D) * 0.01F;
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.aG = (float) Math.random() * 12398.0F;
|
||||
this.D = (float) Math.random() * 12398.0F;
|
||||
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
|
||||
this.S = 0.5F;
|
||||
this.bm = 0.5F;
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public boolean i(Entity entity) {
|
||||
return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.w(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.w(), entity.locZ)) == null;
|
||||
public boolean e(Entity entity) {
|
||||
return this.world.a(Vec3D.b(this.locX, this.locY + (double) this.p(), this.locZ), Vec3D.b(entity.locX, entity.locY + (double) entity.p(), entity.locZ)) == null;
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
public boolean e_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public float w() {
|
||||
public float p() {
|
||||
return this.width * 0.85F;
|
||||
}
|
||||
|
||||
@ -103,19 +103,23 @@ public abstract class EntityLiving extends Entity {
|
||||
return 80;
|
||||
}
|
||||
|
||||
public void r() {
|
||||
this.aX = this.aY;
|
||||
super.r();
|
||||
public void G() {
|
||||
String s = this.e();
|
||||
|
||||
if (s != null) {
|
||||
this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public void H() {
|
||||
this.U = this.V;
|
||||
super.H();
|
||||
if (this.random.nextInt(1000) < this.a++) {
|
||||
this.a = -this.c();
|
||||
String s = this.e();
|
||||
|
||||
if (s != null) {
|
||||
this.world.a(this, s, this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
this.G();
|
||||
}
|
||||
|
||||
if (this.B() && this.C()) {
|
||||
if (this.J() && this.D()) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity victim = this.getBukkitEntity();
|
||||
@ -129,13 +133,13 @@ public abstract class EntityLiving extends Entity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.ae || this.world.isStatic) {
|
||||
if (this.by || this.world.isStatic) {
|
||||
this.fireTicks = 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
if (this.B() && this.a(Material.WATER) && !this.d_()) {
|
||||
if (this.J() && this.a(Material.WATER) && !this.b_()) {
|
||||
--this.airTicks;
|
||||
if (this.airTicks == -20) {
|
||||
this.airTicks = 0;
|
||||
@ -168,7 +172,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.airTicks = this.maxAirTicks;
|
||||
}
|
||||
|
||||
this.bg = this.bh;
|
||||
this.ad = this.ae;
|
||||
if (this.attackTicks > 0) {
|
||||
--this.attackTicks;
|
||||
}
|
||||
@ -184,8 +188,8 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.health <= 0) {
|
||||
++this.deathTicks;
|
||||
if (this.deathTicks > 20) {
|
||||
this.T();
|
||||
this.q();
|
||||
this.L();
|
||||
this.C();
|
||||
|
||||
for (i = 0; i < 20; ++i) {
|
||||
double d0 = this.random.nextGaussian() * 0.02D;
|
||||
@ -197,13 +201,13 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
this.aN = this.aM;
|
||||
this.aJ = this.aI;
|
||||
this.K = this.J;
|
||||
this.G = this.F;
|
||||
this.lastYaw = this.yaw;
|
||||
this.lastPitch = this.pitch;
|
||||
}
|
||||
|
||||
public void R() {
|
||||
public void I() {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
double d0 = this.random.nextGaussian() * 0.02D;
|
||||
double d1 = this.random.nextGaussian() * 0.02D;
|
||||
@ -214,22 +218,22 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void D() {
|
||||
super.D();
|
||||
this.aK = this.aL;
|
||||
this.aL = 0.0F;
|
||||
public void x() {
|
||||
super.x();
|
||||
this.H = this.I;
|
||||
this.I = 0.0F;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
this.o();
|
||||
public void f_() {
|
||||
super.f_();
|
||||
this.q();
|
||||
double d0 = this.locX - this.lastX;
|
||||
double d1 = this.locZ - this.lastZ;
|
||||
float f = MathHelper.a(d0 * d0 + d1 * d1);
|
||||
float f1 = this.aI;
|
||||
float f1 = this.F;
|
||||
float f2 = 0.0F;
|
||||
|
||||
this.aK = this.aL;
|
||||
this.H = this.I;
|
||||
float f3 = 0.0F;
|
||||
|
||||
if (f > 0.05F) {
|
||||
@ -238,7 +242,7 @@ public abstract class EntityLiving extends Entity {
|
||||
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit
|
||||
}
|
||||
|
||||
if (this.aY > 0.0F) {
|
||||
if (this.V > 0.0F) {
|
||||
f1 = this.yaw;
|
||||
}
|
||||
|
||||
@ -246,11 +250,11 @@ public abstract class EntityLiving extends Entity {
|
||||
f3 = 0.0F;
|
||||
}
|
||||
|
||||
this.aL += (f3 - this.aL) * 0.3F;
|
||||
this.I += (f3 - this.I) * 0.3F;
|
||||
|
||||
float f4;
|
||||
|
||||
for (f4 = f1 - this.aI; f4 < -180.0F; f4 += 360.0F) {
|
||||
for (f4 = f1 - this.F; f4 < -180.0F; f4 += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -258,11 +262,11 @@ public abstract class EntityLiving extends Entity {
|
||||
f4 -= 360.0F;
|
||||
}
|
||||
|
||||
this.aI += f4 * 0.3F;
|
||||
this.F += f4 * 0.3F;
|
||||
|
||||
float f5;
|
||||
|
||||
for (f5 = this.yaw - this.aI; f5 < -180.0F; f5 += 360.0F) {
|
||||
for (f5 = this.yaw - this.F; f5 < -180.0F; f5 += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -280,9 +284,9 @@ public abstract class EntityLiving extends Entity {
|
||||
f5 = 75.0F;
|
||||
}
|
||||
|
||||
this.aI = this.yaw - f5;
|
||||
this.F = this.yaw - f5;
|
||||
if (f5 * f5 > 2500.0F) {
|
||||
this.aI += f5 * 0.2F;
|
||||
this.F += f5 * 0.2F;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@ -297,12 +301,12 @@ public abstract class EntityLiving extends Entity {
|
||||
this.lastYaw += 360.0F;
|
||||
}
|
||||
|
||||
while (this.aI - this.aJ < -180.0F) {
|
||||
this.aJ -= 360.0F;
|
||||
while (this.F - this.G < -180.0F) {
|
||||
this.G -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.aI - this.aJ >= 180.0F) {
|
||||
this.aJ += 360.0F;
|
||||
while (this.F - this.G >= 180.0F) {
|
||||
this.G += 360.0F;
|
||||
}
|
||||
|
||||
while (this.pitch - this.lastPitch < -180.0F) {
|
||||
@ -313,14 +317,14 @@ public abstract class EntityLiving extends Entity {
|
||||
this.lastPitch += 360.0F;
|
||||
}
|
||||
|
||||
this.aM += f2;
|
||||
this.J += f2;
|
||||
}
|
||||
|
||||
protected void a(float f, float f1) {
|
||||
super.a(f, f1);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
public void b(int i) {
|
||||
if (this.health > 0) {
|
||||
this.health += i;
|
||||
if (this.health > 20) {
|
||||
@ -335,11 +339,11 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.world.isStatic) {
|
||||
return false;
|
||||
} else {
|
||||
this.bw = 0;
|
||||
this.at = 0;
|
||||
if (this.health <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
this.bm = 1.5F;
|
||||
this.aj = 1.5F;
|
||||
boolean flag = true;
|
||||
|
||||
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
|
||||
@ -347,21 +351,21 @@ public abstract class EntityLiving extends Entity {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.e(i - this.lastDamage);
|
||||
this.c(i - this.lastDamage);
|
||||
this.lastDamage = i;
|
||||
flag = false;
|
||||
} else {
|
||||
this.lastDamage = i;
|
||||
this.ba = this.health;
|
||||
this.X = this.health;
|
||||
this.noDamageTicks = this.maxNoDamageTicks;
|
||||
this.e(i);
|
||||
this.hurtTicks = this.bc = 10;
|
||||
this.c(i);
|
||||
this.hurtTicks = this.Z = 10;
|
||||
}
|
||||
|
||||
this.bd = 0.0F;
|
||||
this.aa = 0.0F;
|
||||
if (flag) {
|
||||
this.world.a(this, (byte) 2);
|
||||
this.y();
|
||||
this.R();
|
||||
if (entity != null) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
|
||||
@ -371,10 +375,10 @@ public abstract class EntityLiving extends Entity {
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
this.bd = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
|
||||
this.aa = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
|
||||
this.a(entity, i, d0, d1);
|
||||
} else {
|
||||
this.bd = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||
this.aa = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,7 +387,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.world.a(this, this.g(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
this.f(entity);
|
||||
this.a(entity);
|
||||
} else if (flag) {
|
||||
this.world.a(this, this.f(), this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
@ -393,7 +397,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void e(int i) {
|
||||
protected void c(int i) {
|
||||
this.health -= i;
|
||||
}
|
||||
|
||||
@ -428,20 +432,20 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
if (this.aU > 0 && entity != null) {
|
||||
entity.b(this, this.aU);
|
||||
public void a(Entity entity) {
|
||||
if (this.R > 0 && entity != null) {
|
||||
entity.c(this, this.R);
|
||||
}
|
||||
|
||||
this.bi = true;
|
||||
this.af = true;
|
||||
if (!this.world.isStatic) {
|
||||
this.g_();
|
||||
this.o();
|
||||
}
|
||||
|
||||
this.world.a(this, (byte) 3);
|
||||
}
|
||||
|
||||
protected void g_() {
|
||||
protected void o() {
|
||||
// Craftbukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int drop = this.h();
|
||||
@ -493,10 +497,10 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void c(float f, float f1) {
|
||||
public void b(float f, float f1) {
|
||||
double d0;
|
||||
|
||||
if (this.v()) {
|
||||
if (this.g_()) {
|
||||
d0 = this.locY;
|
||||
this.a(f, f1, 0.02F);
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
@ -504,10 +508,10 @@ public abstract class EntityLiving extends Entity {
|
||||
this.motY *= 0.800000011920929D;
|
||||
this.motZ *= 0.800000011920929D;
|
||||
this.motY -= 0.02D;
|
||||
if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
|
||||
if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
|
||||
this.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else if (this.x()) {
|
||||
} else if (this.Q()) {
|
||||
d0 = this.locY;
|
||||
this.a(f, f1, 0.02F);
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
@ -515,7 +519,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
this.motY -= 0.02D;
|
||||
if (this.B && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
|
||||
if (this.aV && this.b(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
|
||||
this.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else {
|
||||
@ -551,7 +555,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
this.c(this.motX, this.motY, this.motZ);
|
||||
if (this.B && this.m()) {
|
||||
if (this.aV && this.m()) {
|
||||
this.motY = 0.2D;
|
||||
}
|
||||
|
||||
@ -561,7 +565,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.motZ *= (double) f2;
|
||||
}
|
||||
|
||||
this.bl = this.bm;
|
||||
this.ai = this.aj;
|
||||
d0 = this.locX - this.lastX;
|
||||
double d1 = this.locZ - this.lastZ;
|
||||
float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F;
|
||||
@ -570,8 +574,8 @@ public abstract class EntityLiving extends Entity {
|
||||
f4 = 1.0F;
|
||||
}
|
||||
|
||||
this.bm += (f4 - this.bm) * 0.4F;
|
||||
this.bn += this.bm;
|
||||
this.aj += (f4 - this.aj) * 0.4F;
|
||||
this.ak += this.aj;
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
@ -590,33 +594,33 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
this.health = nbttagcompound.c("Health");
|
||||
if (!nbttagcompound.a("Health")) {
|
||||
this.health = nbttagcompound.d("Health");
|
||||
if (!nbttagcompound.b("Health")) {
|
||||
this.health = 10;
|
||||
}
|
||||
|
||||
this.hurtTicks = nbttagcompound.c("HurtTime");
|
||||
this.deathTicks = nbttagcompound.c("DeathTime");
|
||||
this.attackTicks = nbttagcompound.c("AttackTime");
|
||||
this.hurtTicks = nbttagcompound.d("HurtTime");
|
||||
this.deathTicks = nbttagcompound.d("DeathTime");
|
||||
this.attackTicks = nbttagcompound.d("AttackTime");
|
||||
}
|
||||
|
||||
public boolean B() {
|
||||
public boolean J() {
|
||||
return !this.dead && this.health > 0;
|
||||
}
|
||||
|
||||
public boolean d_() {
|
||||
public boolean b_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (this.bo > 0) {
|
||||
double d0 = this.locX + (this.bp - this.locX) / (double) this.bo;
|
||||
double d1 = this.locY + (this.bq - this.locY) / (double) this.bo;
|
||||
double d2 = this.locZ + (this.br - this.locZ) / (double) this.bo;
|
||||
public void q() {
|
||||
if (this.al > 0) {
|
||||
double d0 = this.locX + (this.am - this.locX) / (double) this.al;
|
||||
double d1 = this.locY + (this.an - this.locY) / (double) this.al;
|
||||
double d2 = this.locZ + (this.ao - this.locZ) / (double) this.al;
|
||||
|
||||
double d3;
|
||||
|
||||
for (d3 = this.bs - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
for (d3 = this.ap - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -624,58 +628,62 @@ public abstract class EntityLiving extends Entity {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bo);
|
||||
this.pitch = (float) ((double) this.pitch + (this.bt - (double) this.pitch) / (double) this.bo);
|
||||
--this.bo;
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.al);
|
||||
this.pitch = (float) ((double) this.pitch + (this.aq - (double) this.pitch) / (double) this.al);
|
||||
--this.al;
|
||||
this.a(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
if (this.health <= 0) {
|
||||
this.bA = false;
|
||||
this.bx = 0.0F;
|
||||
this.by = 0.0F;
|
||||
this.bz = 0.0F;
|
||||
} else if (!this.aW) {
|
||||
this.d();
|
||||
if (this.w()) {
|
||||
this.ax = false;
|
||||
this.au = 0.0F;
|
||||
this.av = 0.0F;
|
||||
this.aw = 0.0F;
|
||||
} else if (!this.T) {
|
||||
this.c_();
|
||||
}
|
||||
|
||||
boolean flag = this.v();
|
||||
boolean flag1 = this.x();
|
||||
boolean flag = this.g_();
|
||||
boolean flag1 = this.Q();
|
||||
|
||||
if (this.bA) {
|
||||
if (this.ax) {
|
||||
if (flag) {
|
||||
this.motY += 0.03999999910593033D;
|
||||
} else if (flag1) {
|
||||
this.motY += 0.03999999910593033D;
|
||||
} else if (this.onGround) {
|
||||
this.S();
|
||||
this.K();
|
||||
}
|
||||
}
|
||||
|
||||
this.bx *= 0.98F;
|
||||
this.by *= 0.98F;
|
||||
this.bz *= 0.9F;
|
||||
this.c(this.bx, this.by);
|
||||
this.au *= 0.98F;
|
||||
this.av *= 0.98F;
|
||||
this.aw *= 0.9F;
|
||||
this.b(this.au, this.av);
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (entity.z()) {
|
||||
entity.c((Entity) this);
|
||||
if (entity.e_()) {
|
||||
entity.h(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void S() {
|
||||
protected boolean w() {
|
||||
return this.health <= 0;
|
||||
}
|
||||
|
||||
protected void K() {
|
||||
this.motY = 0.41999998688697815D;
|
||||
}
|
||||
|
||||
protected void d() {
|
||||
++this.bw;
|
||||
protected void c_() {
|
||||
++this.at;
|
||||
EntityHuman entityhuman = this.world.a(this, -1.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
@ -685,20 +693,20 @@ public abstract class EntityLiving extends Entity {
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 > 16384.0D) {
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
if (this.bw > 600 && this.random.nextInt(800) == 0) {
|
||||
if (this.at > 600 && this.random.nextInt(800) == 0) {
|
||||
if (d3 < 1024.0D) {
|
||||
this.bw = 0;
|
||||
this.at = 0;
|
||||
} else {
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bx = 0.0F;
|
||||
this.by = 0.0F;
|
||||
this.au = 0.0F;
|
||||
this.av = 0.0F;
|
||||
float f = 8.0F;
|
||||
|
||||
if (this.random.nextFloat() < 0.02F) {
|
||||
@ -707,29 +715,29 @@ public abstract class EntityLiving extends Entity {
|
||||
this.b = entityhuman;
|
||||
this.c = 10 + this.random.nextInt(20);
|
||||
} else {
|
||||
this.bz = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
this.aw = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.b != null) {
|
||||
this.b(this.b, 10.0F);
|
||||
if (this.c-- <= 0 || this.b.dead || this.b.b((Entity) this) > (double) (f * f)) {
|
||||
if (this.c-- <= 0 || this.b.dead || this.b.g(this) > (double) (f * f)) {
|
||||
this.b = null;
|
||||
}
|
||||
} else {
|
||||
if (this.random.nextFloat() < 0.05F) {
|
||||
this.bz = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
this.aw = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
}
|
||||
|
||||
this.yaw += this.bz;
|
||||
this.pitch = this.bB;
|
||||
this.yaw += this.aw;
|
||||
this.pitch = this.ay;
|
||||
}
|
||||
|
||||
boolean flag = this.v();
|
||||
boolean flag1 = this.x();
|
||||
boolean flag = this.g_();
|
||||
boolean flag1 = this.Q();
|
||||
|
||||
if (flag || flag1) {
|
||||
this.bA = this.random.nextFloat() < 0.8F;
|
||||
this.ax = this.random.nextFloat() < 0.8F;
|
||||
}
|
||||
}
|
||||
|
||||
@ -741,9 +749,9 @@ public abstract class EntityLiving extends Entity {
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
d2 = entityliving.locY + (double) entityliving.w() - (this.locY + (double) this.w());
|
||||
d2 = entityliving.locY + (double) entityliving.p() - (this.locY + (double) this.p());
|
||||
} else {
|
||||
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.w());
|
||||
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.p());
|
||||
}
|
||||
|
||||
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1);
|
||||
@ -776,21 +784,21 @@ public abstract class EntityLiving extends Entity {
|
||||
return f + f3;
|
||||
}
|
||||
|
||||
public void T() {}
|
||||
public void L() {}
|
||||
|
||||
public boolean b() {
|
||||
return this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
|
||||
}
|
||||
|
||||
protected void t() {
|
||||
protected void M() {
|
||||
this.a((Entity) null, 4);
|
||||
}
|
||||
|
||||
public Vec3D G() {
|
||||
return this.c(1.0F);
|
||||
public Vec3D N() {
|
||||
return this.b(1.0F);
|
||||
}
|
||||
|
||||
public Vec3D c(float f) {
|
||||
public Vec3D b(float f) {
|
||||
float f1;
|
||||
float f2;
|
||||
float f3;
|
||||
@ -817,4 +825,8 @@ public abstract class EntityLiving extends Entity {
|
||||
public int j() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public boolean E() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -13,22 +13,22 @@ import org.bukkit.event.vehicle.*;
|
||||
|
||||
public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
private ItemStack[] al;
|
||||
private ItemStack[] h;
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
private boolean am;
|
||||
private boolean i;
|
||||
public int d;
|
||||
public int e;
|
||||
public double f;
|
||||
public double ak;
|
||||
private static final int[][][] an = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
|
||||
private int ao;
|
||||
private double ap;
|
||||
private double aq;
|
||||
private double ar;
|
||||
private double as;
|
||||
private double at;
|
||||
public double g;
|
||||
private static final int[][][] j = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
|
||||
private int k;
|
||||
private double l;
|
||||
private double m;
|
||||
private double n;
|
||||
private double o;
|
||||
private double p;
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean slowWhenEmpty = true;
|
||||
@ -41,21 +41,21 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
public double maxSpeed = 0.4D;
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.al;
|
||||
return this.h;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public EntityMinecart(World world) {
|
||||
super(world);
|
||||
this.al = new ItemStack[27]; //Craftbukkit
|
||||
this.h = new ItemStack[27]; //Craftbukkit
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
this.c = 1;
|
||||
this.am = false;
|
||||
this.i = true;
|
||||
this.i = false;
|
||||
this.aC = true;
|
||||
this.a(0.98F, 0.7F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.M = false;
|
||||
this.bg = false;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
@ -69,15 +69,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public AxisAlignedBB d(Entity entity) {
|
||||
public AxisAlignedBB a_(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
|
||||
public AxisAlignedBB u() {
|
||||
public AxisAlignedBB d() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
public boolean e_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.y();
|
||||
this.R();
|
||||
this.a += i * 10;
|
||||
if (this.a > 40) {
|
||||
this.a(Item.MINECART.id, 1, 0.0F);
|
||||
@ -126,7 +126,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.a(Block.FURNACE.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -135,13 +135,13 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void q() {
|
||||
for (int i = 0; i < this.h_(); ++i) {
|
||||
ItemStack itemstack = this.a(i);
|
||||
public void C() {
|
||||
for (int i = 0; i < this.m_(); ++i) {
|
||||
ItemStack itemstack = this.c_(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
@ -167,10 +167,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
super.q();
|
||||
super.C();
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
public void f_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
@ -189,13 +189,13 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
double d0;
|
||||
|
||||
if (this.world.isStatic && this.ao > 0) {
|
||||
if (this.ao > 0) {
|
||||
double d1 = this.locX + (this.ap - this.locX) / (double) this.ao;
|
||||
double d2 = this.locY + (this.aq - this.locY) / (double) this.ao;
|
||||
double d3 = this.locZ + (this.ar - this.locZ) / (double) this.ao;
|
||||
if (this.world.isStatic && this.k > 0) {
|
||||
if (this.k > 0) {
|
||||
double d1 = this.locX + (this.l - this.locX) / (double) this.k;
|
||||
double d2 = this.locY + (this.m - this.locY) / (double) this.k;
|
||||
double d3 = this.locZ + (this.n - this.locZ) / (double) this.k;
|
||||
|
||||
for (d0 = this.as - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) {
|
||||
for (d0 = this.o - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -203,14 +203,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d0 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d0 / (double) this.ao);
|
||||
this.pitch = (float) ((double) this.pitch + (this.at - (double) this.pitch) / (double) this.ao);
|
||||
--this.ao;
|
||||
this.yaw = (float) ((double) this.yaw + d0 / (double) this.k);
|
||||
this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k);
|
||||
--this.k;
|
||||
this.a(d1, d2, d3);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
this.a(this.locX, this.locY, this.locZ);
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
@ -254,7 +254,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motZ -= d0;
|
||||
}
|
||||
|
||||
int[][] aint = an[l];
|
||||
int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit.
|
||||
double d5 = (double) (aint[1][0] - aint[0][0]);
|
||||
double d6 = (double) (aint[1][2] - aint[0][2]);
|
||||
double d7 = Math.sqrt(d5 * d5 + d6 * d6);
|
||||
@ -333,18 +333,18 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motZ *= 0.996999979019165D;
|
||||
} else {
|
||||
if (this.d == 2) {
|
||||
d16 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak);
|
||||
d16 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
|
||||
if (d16 > 0.01D) {
|
||||
flag = true;
|
||||
this.f /= d16;
|
||||
this.ak /= d16;
|
||||
this.g /= d16;
|
||||
double d18 = 0.04D;
|
||||
|
||||
this.motX *= 0.800000011920929D;
|
||||
this.motY *= 0.0D;
|
||||
this.motZ *= 0.800000011920929D;
|
||||
this.motX += this.f * d18;
|
||||
this.motZ += this.ak * d18;
|
||||
this.motZ += this.g * d18;
|
||||
} else {
|
||||
this.motX *= 0.8999999761581421D;
|
||||
this.motY *= 0.0D;
|
||||
@ -381,17 +381,17 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
if (this.d == 2) {
|
||||
double d20 = (double) MathHelper.a(this.f * this.f + this.ak * this.ak);
|
||||
double d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
|
||||
|
||||
if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
|
||||
this.f /= d20;
|
||||
this.ak /= d20;
|
||||
if (this.f * this.motX + this.ak * this.motZ < 0.0D) {
|
||||
this.g /= d20;
|
||||
if (this.f * this.motX + this.g * this.motZ < 0.0D) {
|
||||
this.f = 0.0D;
|
||||
this.ak = 0.0D;
|
||||
this.g = 0.0D;
|
||||
} else {
|
||||
this.f = this.motX;
|
||||
this.ak = this.motZ;
|
||||
this.g = this.motZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,7 +436,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
if (d21 * d21 + d22 * d22 > 0.0010D) {
|
||||
this.yaw = (float) (Math.atan2(d22, d21) * 180.0D / 3.141592653589793D);
|
||||
if (this.am) {
|
||||
if (this.i) {
|
||||
this.yaw += 180.0F;
|
||||
}
|
||||
}
|
||||
@ -453,10 +453,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
if (d23 < -170.0D || d23 >= 170.0D) {
|
||||
this.yaw += 180.0F;
|
||||
this.am = !this.am;
|
||||
this.i = !this.i;
|
||||
}
|
||||
|
||||
this.b(this.yaw, this.pitch);
|
||||
this.c(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
@ -477,8 +477,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
for (int k1 = 0; k1 < list.size(); ++k1) {
|
||||
Entity entity = (Entity) list.get(k1);
|
||||
|
||||
if (entity != this.passenger && entity.z() && entity instanceof EntityMinecart) {
|
||||
entity.c((Entity) this);
|
||||
if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
|
||||
entity.h(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -490,7 +490,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
if (flag && this.random.nextInt(4) == 0) {
|
||||
--this.e;
|
||||
if (this.e < 0) {
|
||||
this.f = this.ak = 0.0D;
|
||||
this.f = this.g = 0.0D;
|
||||
}
|
||||
|
||||
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
@ -515,7 +515,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 = (double) (j + 1);
|
||||
}
|
||||
|
||||
int[][] aint = an[l];
|
||||
int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit
|
||||
double d3 = 0.0D;
|
||||
double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
|
||||
double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
|
||||
@ -562,17 +562,17 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
nbttagcompound.a("Type", this.d);
|
||||
if (this.d == 2) {
|
||||
nbttagcompound.a("PushX", this.f);
|
||||
nbttagcompound.a("PushZ", this.ak);
|
||||
nbttagcompound.a("PushZ", this.g);
|
||||
nbttagcompound.a("Fuel", (short) this.e);
|
||||
} else if (this.d == 1) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.al.length; ++i) {
|
||||
if (this.al[i] != null) {
|
||||
for (int i = 0; i < this.h.length; ++i) {
|
||||
if (this.h[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.al[i].a(nbttagcompound1);
|
||||
this.h[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@ -582,28 +582,28 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
this.d = nbttagcompound.d("Type");
|
||||
this.d = nbttagcompound.e("Type");
|
||||
if (this.d == 2) {
|
||||
this.f = nbttagcompound.g("PushX");
|
||||
this.ak = nbttagcompound.g("PushZ");
|
||||
this.e = nbttagcompound.c("Fuel");
|
||||
this.f = nbttagcompound.h("PushX");
|
||||
this.g = nbttagcompound.h("PushZ");
|
||||
this.e = nbttagcompound.d("Fuel");
|
||||
} else if (this.d == 1) {
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
|
||||
this.al = new ItemStack[this.h_()];
|
||||
this.h = new ItemStack[this.m_()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.b("Slot") & 255;
|
||||
int j = nbttagcompound1.c("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.al.length) {
|
||||
this.al[j] = new ItemStack(nbttagcompound1);
|
||||
if (j >= 0 && j < this.h.length) {
|
||||
this.h[j] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void c(Entity entity) {
|
||||
public void h(Entity entity) {
|
||||
if (!this.world.isStatic) {
|
||||
if (entity != this.passenger) {
|
||||
|
||||
@ -628,7 +628,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
server.getPluginManager().callEvent(enterEvent);
|
||||
|
||||
if (!enterEvent.isCancelled()) {
|
||||
entity.e((Entity) this);
|
||||
entity.b((Entity) this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -653,8 +653,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 *= d3;
|
||||
d0 *= 0.10000000149011612D;
|
||||
d1 *= 0.10000000149011612D;
|
||||
d0 *= (double) (1.0F - this.U);
|
||||
d1 *= (double) (1.0F - this.U);
|
||||
d0 *= (double) (1.0F - this.bo);
|
||||
d1 *= (double) (1.0F - this.bo);
|
||||
d0 *= 0.5D;
|
||||
d1 *= 0.5D;
|
||||
if (entity instanceof EntityMinecart) {
|
||||
@ -692,26 +692,26 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
public int m_() {
|
||||
return 27;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.al[i];
|
||||
public ItemStack c_(int i) {
|
||||
return this.h[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.al[i] != null) {
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.h[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.al[i].count <= j) {
|
||||
itemstack = this.al[i];
|
||||
this.al[i] = null;
|
||||
if (this.h[i].count <= j) {
|
||||
itemstack = this.h[i];
|
||||
this.h[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.al[i].a(j);
|
||||
if (this.al[i].count == 0) {
|
||||
this.al[i] = null;
|
||||
itemstack = this.h[i].a(j);
|
||||
if (this.h[i].count == 0) {
|
||||
this.h[i] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -722,21 +722,21 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.al[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
this.h[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.n_()) {
|
||||
itemstack.count = this.n_();
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Minecart";
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
public void h() {}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
if (this.d == 0) {
|
||||
@ -759,14 +759,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entityhuman.e(this);
|
||||
entityhuman.b((Entity) this);
|
||||
}
|
||||
} else if (this.d == 1) {
|
||||
if (!this.world.isStatic) {
|
||||
entityhuman.a((IInventory) this);
|
||||
}
|
||||
} else if (this.d == 2) {
|
||||
ItemStack itemstack = entityhuman.inventory.e();
|
||||
ItemStack itemstack = entityhuman.inventory.b();
|
||||
|
||||
if (itemstack != null && itemstack.id == Item.COAL.id) {
|
||||
if (--itemstack.count == 0) {
|
||||
@ -777,13 +777,13 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
this.f = this.locX - entityhuman.locX;
|
||||
this.ak = this.locZ - entityhuman.locZ;
|
||||
this.g = this.locZ - entityhuman.locZ;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.dead ? false : entityhuman.b((Entity) this) <= 64.0D;
|
||||
return this.dead ? false : entityhuman.g(this) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -20,27 +20,27 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
this.health = 20;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
float f = this.b(1.0F);
|
||||
public void q() {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F) {
|
||||
this.bw += 2;
|
||||
this.at += 2;
|
||||
}
|
||||
|
||||
super.o();
|
||||
super.q();
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
super.b_();
|
||||
if (this.world.k == 0) {
|
||||
this.q();
|
||||
public void f_() {
|
||||
super.f_();
|
||||
if (this.world.j == 0) {
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
EntityHuman entityhuman = this.world.a(this, 16.0D);
|
||||
|
||||
return entityhuman != null && this.i(entityhuman) ? entityhuman : null;
|
||||
return entityhuman != null && this.e(entityhuman) ? entityhuman : null;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
@ -57,9 +57,9 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
d = null;
|
||||
this.d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -75,10 +75,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
if ((double) f < 2.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
||||
if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
||||
this.attackTicks = 20;
|
||||
// CraftBukkit start
|
||||
if(entity instanceof EntityLiving) {
|
||||
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();
|
||||
|
@ -18,22 +18,22 @@ public class EntityPigZombie extends EntityZombie {
|
||||
public EntityPigZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.az = 0.5F;
|
||||
this.c = 5;
|
||||
this.ae = true;
|
||||
this.by = true;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
this.bC = this.d != null ? 0.95F : 0.5F;
|
||||
public void f_() {
|
||||
this.az = this.d != null ? 0.95F : 0.5F;
|
||||
if (this.b > 0 && --this.b == 0) {
|
||||
this.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
}
|
||||
|
||||
super.b_();
|
||||
super.f_();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.world.k > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
|
||||
return this.world.j > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -43,15 +43,15 @@ public class EntityPigZombie extends EntityZombie {
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
this.a = nbttagcompound.c("Anger");
|
||||
this.a = nbttagcompound.d("Anger");
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
return this.a == 0 ? null : super.l();
|
||||
}
|
||||
|
||||
public void o() {
|
||||
super.o();
|
||||
public void q() {
|
||||
super.q();
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
@ -64,17 +64,17 @@ public class EntityPigZombie extends EntityZombie {
|
||||
if (entity1 instanceof EntityPigZombie) {
|
||||
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
|
||||
|
||||
entitypigzombie.g(entity);
|
||||
entitypigzombie.c(entity);
|
||||
}
|
||||
}
|
||||
|
||||
this.g(entity);
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
return super.a(entity, i);
|
||||
}
|
||||
|
||||
private void g(Entity entity) {
|
||||
private void c(Entity entity) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
|
@ -21,21 +21,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
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 Set g = new HashSet();
|
||||
private int bE = -99999999;
|
||||
private int bF = 60;
|
||||
private ItemStack[] bG = new ItemStack[] { null, null, null, null, null};
|
||||
private int bH = 0;
|
||||
public boolean h;
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
int i = world.spawnX;
|
||||
int j = world.spawnZ;
|
||||
int k = world.spawnY;
|
||||
ChunkCoordinates chunkcoordinates = world.l();
|
||||
int i = chunkcoordinates.a;
|
||||
int j = chunkcoordinates.c;
|
||||
int k = chunkcoordinates.b;
|
||||
|
||||
if (!world.q.e) {
|
||||
if (!world.m.e) {
|
||||
i += this.random.nextInt(20) - 10;
|
||||
k = world.e(i, j);
|
||||
j += this.random.nextInt(20) - 10;
|
||||
@ -43,7 +43,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
this.c((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
|
||||
this.b = minecraftserver;
|
||||
this.S = 0.0F;
|
||||
this.bm = 0.0F;
|
||||
iteminworldmanager.a = this;
|
||||
this.name = s;
|
||||
this.c = iteminworldmanager;
|
||||
@ -54,29 +54,38 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public ItemStack[] I() {
|
||||
return this.bF;
|
||||
public ItemStack[] k_() {
|
||||
return this.bG;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
--this.bE;
|
||||
protected void l_() {
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public float p() {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
public void f_() {
|
||||
this.c.a();
|
||||
--this.bF;
|
||||
this.activeContainer.a();
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
ItemStack itemstack = this.a(i);
|
||||
ItemStack itemstack = this.b_(i);
|
||||
|
||||
if (itemstack != this.bF[i]) {
|
||||
if (itemstack != this.bG[i]) {
|
||||
this.b.k.a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.bF[i] = itemstack;
|
||||
this.bG[i] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return i == 0 ? this.inventory.e() : this.inventory.b[i - 1];
|
||||
public ItemStack b_(int i) {
|
||||
return i == 0 ? this.inventory.b() : this.inventory.b[i - 1];
|
||||
}
|
||||
|
||||
public void f(Entity entity) {
|
||||
public void a(Entity entity) {
|
||||
// Craftbukkit start
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
@ -105,7 +114,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (this.bE > 0) {
|
||||
if (this.bF > 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (!this.b.n) {
|
||||
@ -126,59 +135,46 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
super.d(i);
|
||||
public void b(int i) {
|
||||
super.b(i);
|
||||
}
|
||||
|
||||
public void n() {
|
||||
super.b_();
|
||||
ChunkCoordIntPair chunkcoordintpair = null;
|
||||
double d0 = 0.0D;
|
||||
public void a(boolean flag) {
|
||||
super.f_();
|
||||
if (flag && !this.f.isEmpty()) {
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0);
|
||||
|
||||
for (int i = 0; i < this.f.size(); ++i) {
|
||||
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.f.get(i);
|
||||
double d1 = chunkcoordintpair1.a(this);
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag1 = false;
|
||||
|
||||
if (i == 0 || d1 < d0) {
|
||||
chunkcoordintpair = chunkcoordintpair1;
|
||||
d0 = chunkcoordintpair1.a(this);
|
||||
}
|
||||
}
|
||||
if (this.a.b() < 2) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag = false;
|
||||
if (flag1) {
|
||||
this.f.remove(chunkcoordintpair);
|
||||
|
||||
if (d0 < 1024.0D) {
|
||||
flag = true;
|
||||
}
|
||||
// CraftBukkit start
|
||||
this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.world)));
|
||||
List list = ((WorldServer) world).d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16);
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.a.b() < 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.f.remove(chunkcoordintpair);
|
||||
|
||||
// Craftbukkit start
|
||||
this.a.b((Packet) (new Packet51MapChunk(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, 16, 128, 16, this.world)));
|
||||
List list = ((WorldServer)world).d(chunkcoordintpair.a * 16, 0, chunkcoordintpair.b * 16, chunkcoordintpair.a * 16 + 16, 128, chunkcoordintpair.b * 16 + 16);
|
||||
// Craftbukkit end
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
this.a((TileEntity) list.get(j));
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
this.a((TileEntity) list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.health != this.bD) {
|
||||
if (this.health != this.bE) {
|
||||
this.a.b((Packet) (new Packet8UpdateHealth(this.health)));
|
||||
this.bD = this.health;
|
||||
this.bE = this.health;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.g();
|
||||
Packet packet = tileentity.e();
|
||||
|
||||
if (packet != null) {
|
||||
this.a.b(packet);
|
||||
@ -186,13 +182,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public void o() {
|
||||
this.motX = this.motY = this.motZ = 0.0D;
|
||||
this.bA = false;
|
||||
super.o();
|
||||
public void q() {
|
||||
super.q();
|
||||
}
|
||||
|
||||
public void c(Entity entity, int i) {
|
||||
public void b(Entity entity, int i) {
|
||||
if (!entity.dead) {
|
||||
if (entity instanceof EntityItem) {
|
||||
this.b.k.a(entity, new Packet22Collect(entity.id, this.id));
|
||||
@ -203,29 +197,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
super.c(entity, i);
|
||||
super.b(entity, i);
|
||||
this.activeContainer.a();
|
||||
}
|
||||
|
||||
public void K() {
|
||||
if (!this.au) {
|
||||
this.av = -1;
|
||||
this.au = true;
|
||||
public void r() {
|
||||
if (!this.p) {
|
||||
this.q = -1;
|
||||
this.p = true;
|
||||
this.b.k.a(this, new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public float w() {
|
||||
return 1.62F;
|
||||
public void s() {}
|
||||
|
||||
public boolean a(int i, int j, int k) {
|
||||
if (super.a(i, j, k)) {
|
||||
this.b.k.a(this, new Packet17(this, 0, i, j, k));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void e(Entity entity) {
|
||||
public void a(boolean flag, boolean flag1) {
|
||||
if (this.E()) {
|
||||
this.b.k.b(this, new Packet18ArmAnimation(this, 3));
|
||||
}
|
||||
|
||||
super.a(flag, flag1);
|
||||
this.a.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
}
|
||||
|
||||
public void setPassengerOf(Entity entity) {
|
||||
// e(null) doesn't really fly for overloaded methods,
|
||||
// b(null) doesn't really fly for overloaded methods,
|
||||
// so this method is needed
|
||||
|
||||
super.setPassengerOf(entity);
|
||||
@ -240,45 +250,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
super.a(d0, flag);
|
||||
}
|
||||
|
||||
private void U() {
|
||||
this.bG = this.bG % 100 + 1;
|
||||
private void V() {
|
||||
this.bH = this.bH % 100 + 1;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 1, "Crafting", 9)));
|
||||
public void b(int i, int j, int k) {
|
||||
this.V();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bH, 1, "Crafting", 9)));
|
||||
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.f = this.bH;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
this.U();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bG, 0, iinventory.b(), iinventory.h_())));
|
||||
this.V();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bH, 0, iinventory.c(), iinventory.m_())));
|
||||
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.f = this.bH;
|
||||
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.V();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bH, 2, tileentityfurnace.c(), tileentityfurnace.m_())));
|
||||
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.f = this.bH;
|
||||
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.V();
|
||||
this.a.b((Packet) (new Packet100OpenWindow(this.bH, 3, tileentitydispenser.c(), tileentitydispenser.m_())));
|
||||
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
|
||||
this.activeContainer.f = this.bG;
|
||||
this.activeContainer.f = this.bH;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(Container container, int i, ItemStack itemstack) {
|
||||
if (!(container.a(i) instanceof SlotResult)) {
|
||||
if (!this.am) {
|
||||
if (!this.h) {
|
||||
this.a.b((Packet) (new Packet103SetSlot(container.f, i, itemstack)));
|
||||
}
|
||||
}
|
||||
@ -295,19 +305,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void L() {
|
||||
public void t() {
|
||||
this.a.b((Packet) (new Packet101CloseWindow(this.activeContainer.f)));
|
||||
this.N();
|
||||
this.v();
|
||||
}
|
||||
|
||||
public void M() {
|
||||
if (!this.am) {
|
||||
public void u() {
|
||||
if (!this.h) {
|
||||
this.a.b((Packet) (new Packet103SetSlot(-1, -1, this.inventory.i())));
|
||||
}
|
||||
}
|
||||
|
||||
public void N() {
|
||||
public void v() {
|
||||
this.activeContainer.a((EntityHuman) this);
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
|
||||
this.au = f;
|
||||
this.av = f1;
|
||||
this.ax = flag;
|
||||
this.b(flag1);
|
||||
this.pitch = f2;
|
||||
this.yaw = f3;
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ public class EntitySkeleton extends EntityMonster {
|
||||
return "mob.skeletonhurt";
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (this.world.b()) {
|
||||
float f = this.b(1.0F);
|
||||
public void q() {
|
||||
if (this.world.c()) {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
// CraftBukkit start
|
||||
@ -51,7 +51,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
super.o();
|
||||
super.q();
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
@ -89,7 +89,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
return Item.ARROW.id;
|
||||
}
|
||||
|
||||
protected void g_() {
|
||||
protected void o() {
|
||||
// Craftbukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
|
@ -17,9 +17,9 @@ public class EntitySnowball extends Entity {
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
private EntityLiving ak;
|
||||
private int al;
|
||||
private int am = 0;
|
||||
private EntityLiving g;
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
public EntitySnowball(World world) {
|
||||
super(world);
|
||||
@ -30,9 +30,9 @@ public class EntitySnowball extends Entity {
|
||||
|
||||
public EntitySnowball(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
this.ak = entityliving;
|
||||
this.g = entityliving;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.c(entityliving.locX, entityliving.locY + (double) entityliving.p(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
@ -48,7 +48,7 @@ public class EntitySnowball extends Entity {
|
||||
|
||||
public EntitySnowball(World world, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.al = 0;
|
||||
this.h = 0;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.a(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
@ -73,14 +73,14 @@ public class EntitySnowball extends Entity {
|
||||
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
|
||||
this.al = 0;
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
this.O = this.locX;
|
||||
this.P = this.locY;
|
||||
this.Q = this.locZ;
|
||||
super.b_();
|
||||
public void f_() {
|
||||
this.bi = this.locX;
|
||||
this.bj = this.locY;
|
||||
this.bk = this.locZ;
|
||||
super.f_();
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
@ -89,9 +89,9 @@ public class EntitySnowball extends Entity {
|
||||
int i = this.world.getTypeId(this.b, this.c, this.d);
|
||||
|
||||
if (i == this.e) {
|
||||
++this.al;
|
||||
if (this.al == 1200) {
|
||||
this.q();
|
||||
++this.h;
|
||||
if (this.h == 1200) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
return;
|
||||
@ -101,10 +101,10 @@ public class EntitySnowball extends Entity {
|
||||
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;
|
||||
this.h = 0;
|
||||
this.i = 0;
|
||||
} else {
|
||||
++this.am;
|
||||
++this.i;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ);
|
||||
@ -125,7 +125,7 @@ public class EntitySnowball extends Entity {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1.c_() && (entity1 != this.ak || this.am >= 5)) {
|
||||
if (entity1.d_() && (entity1 != this.g || this.i >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -152,7 +152,7 @@ public class EntitySnowball extends Entity {
|
||||
boolean stick;
|
||||
if (movingobjectposition.g instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity shooter = (this.ak == null) ? null : this.ak.getBukkitEntity();
|
||||
org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
|
||||
org.bukkit.entity.Entity projectile = this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
@ -164,13 +164,13 @@ public class EntitySnowball extends Entity {
|
||||
|
||||
if(!event.isCancelled()) {
|
||||
// this function returns if the snowball should stick or not, i.e. !bounce
|
||||
stick = movingobjectposition.g.a(this.ak, event.getDamage());
|
||||
stick = movingobjectposition.g.a(this.g, event.getDamage());
|
||||
} else {
|
||||
// event was cancelled, get if the snowball should bounce or not
|
||||
stick = !event.getBounce();
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.g.a(this.ak, 0);
|
||||
stick = movingobjectposition.g.a(this.g, 0);
|
||||
}
|
||||
if (stick) {
|
||||
;
|
||||
@ -182,7 +182,7 @@ public class EntitySnowball extends Entity {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
this.q();
|
||||
this.C();
|
||||
}
|
||||
|
||||
this.locX += this.motX;
|
||||
@ -213,7 +213,7 @@ public class EntitySnowball extends Entity {
|
||||
float f2 = 0.99F;
|
||||
float f3 = 0.03F;
|
||||
|
||||
if (this.v()) {
|
||||
if (this.g_()) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
@ -240,19 +240,19 @@ public class EntitySnowball extends Entity {
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
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;
|
||||
this.b = nbttagcompound.d("xTile");
|
||||
this.c = nbttagcompound.d("yTile");
|
||||
this.d = nbttagcompound.d("zTile");
|
||||
this.e = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.f = nbttagcompound.c("inGround") == 1;
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.ak == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
if (this.f && this.g == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.c(this, 1);
|
||||
this.q();
|
||||
entityhuman.b(this, 1);
|
||||
this.C();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class EntitySpider extends EntityMonster {
|
||||
super(world);
|
||||
this.texture = "/mob/spider.png";
|
||||
this.a(1.4F, 0.9F);
|
||||
this.bC = 0.8F;
|
||||
this.az = 0.8F;
|
||||
}
|
||||
|
||||
public double k() {
|
||||
@ -21,7 +21,7 @@ public class EntitySpider extends EntityMonster {
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
float f = this.b(1.0F);
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f < 0.5F) {
|
||||
double d0 = 16.0D;
|
||||
@ -45,7 +45,7 @@ public class EntitySpider extends EntityMonster {
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
float f1 = this.b(1.0F);
|
||||
float f1 = this.c(1.0F);
|
||||
|
||||
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
|
||||
// CraftBukkit start
|
||||
@ -91,6 +91,6 @@ public class EntitySpider extends EntityMonster {
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
return this.B;
|
||||
return this.aV;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.a = 0;
|
||||
this.i = true;
|
||||
this.aC = true;
|
||||
this.a(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
}
|
||||
@ -26,7 +26,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.M = false;
|
||||
this.bg = false;
|
||||
this.a = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
@ -35,11 +35,11 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean d_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
public void f_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
@ -57,21 +57,23 @@ public class EntityTNTPrimed extends Entity {
|
||||
if (this.a-- <= 0) {
|
||||
// Craftbukkit start
|
||||
// Need to reverse the order of the explosion and the entity death so we have a location for the event.
|
||||
this.d();
|
||||
this.q();
|
||||
this.h();
|
||||
this.C();
|
||||
// Craftbukkit end
|
||||
} else {
|
||||
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
private void d() {
|
||||
private void h() {
|
||||
float f = 4.0F;
|
||||
|
||||
// Craftbukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
|
||||
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 4.0F, false);
|
||||
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if (!event.isCancelled()) {
|
||||
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
}
|
||||
// Craftbukkit end
|
||||
@ -82,6 +84,6 @@ public class EntityTNTPrimed extends Entity {
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.b("Fuse");
|
||||
this.a = nbttagcompound.c("Fuse");
|
||||
}
|
||||
}
|
||||
|
@ -64,12 +64,12 @@ public class EntityTrackerEntry {
|
||||
int k = MathHelper.b(this.a.locZ * 32.0D);
|
||||
int l = MathHelper.d(this.a.yaw * 256.0F / 360.0F);
|
||||
int i1 = MathHelper.d(this.a.pitch * 256.0F / 360.0F);
|
||||
boolean flag = i != this.d || j != this.e || k != this.f;
|
||||
boolean flag1 = l != this.g || i1 != this.h;
|
||||
int j1 = i - this.d;
|
||||
int k1 = j - this.e;
|
||||
int l1 = k - this.f;
|
||||
Object object = null;
|
||||
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
|
||||
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8;
|
||||
|
||||
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) {
|
||||
if (flag && flag1) {
|
||||
@ -78,8 +78,6 @@ public class EntityTrackerEntry {
|
||||
object = new Packet31RelEntityMove(this.a.id, (byte) j1, (byte) k1, (byte) l1);
|
||||
} else if (flag1) {
|
||||
object = new Packet32EntityLook(this.a.id, (byte) l, (byte) i1);
|
||||
} else {
|
||||
object = new Packet30Entity(this.a.id);
|
||||
}
|
||||
} else {
|
||||
object = new Packet34EntityTeleport(this.a.id, i, j, k, (byte) l, (byte) i1);
|
||||
@ -104,22 +102,27 @@ public class EntityTrackerEntry {
|
||||
this.a((Packet) object);
|
||||
}
|
||||
|
||||
DataWatcher datawatcher = this.a.p();
|
||||
DataWatcher datawatcher = this.a.O();
|
||||
|
||||
if (datawatcher.a()) {
|
||||
this.b((Packet) (new Packet40EntityMetadata(this.a.id, datawatcher)));
|
||||
}
|
||||
|
||||
this.d = i;
|
||||
this.e = j;
|
||||
this.f = k;
|
||||
this.g = l;
|
||||
this.h = i1;
|
||||
if (flag) {
|
||||
this.d = i;
|
||||
this.e = j;
|
||||
this.f = k;
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
this.g = l;
|
||||
this.h = i1;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.a.E) {
|
||||
if (this.a.aY) {
|
||||
this.b((Packet) (new Packet28EntityVelocity(this.a)));
|
||||
this.a.E = false;
|
||||
this.a.aY = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +166,7 @@ public class EntityTrackerEntry {
|
||||
entityplayer.a.b((Packet) (new Packet28EntityVelocity(this.a.id, this.a.motX, this.a.motY, this.a.motZ)));
|
||||
}
|
||||
|
||||
ItemStack[] aitemstack = this.a.I();
|
||||
ItemStack[] aitemstack = this.a.k_();
|
||||
|
||||
if (aitemstack != null) {
|
||||
for (int i = 0; i < aitemstack.length; ++i) {
|
||||
|
@ -11,13 +11,13 @@ public class EntityZombie extends EntityMonster {
|
||||
public EntityZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/zombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.az = 0.5F;
|
||||
this.c = 5;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
if (this.world.b()) {
|
||||
float f = this.b(1.0F);
|
||||
public void q() {
|
||||
if (this.world.c()) {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F && this.world.i(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
// CraftBukkit start
|
||||
@ -31,7 +31,7 @@ public class EntityZombie extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
super.o();
|
||||
super.q();
|
||||
}
|
||||
|
||||
protected String e() {
|
||||
|
@ -64,7 +64,7 @@ public class Explosion {
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
float f1 = this.f * (0.7F + this.i.l.nextFloat() * 0.6F);
|
||||
float f1 = this.f * (0.7F + this.i.k.nextFloat() * 0.6F);
|
||||
|
||||
d0 = this.b;
|
||||
d1 = this.c;
|
||||
@ -179,7 +179,7 @@ public class Explosion {
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.l.nextFloat() - this.i.l.nextFloat()) * 0.2F) * 0.7F);
|
||||
this.i.a(this.b, this.c, this.d, "random.explode", 4.0F, (1.0F + (this.i.k.nextFloat() - this.i.k.nextFloat()) * 0.2F) * 0.7F);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
arraylist.addAll(this.g);
|
||||
@ -217,9 +217,9 @@ public class Explosion {
|
||||
int i1 = this.i.getTypeId(j, k, l);
|
||||
|
||||
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 d0 = (double) ((float) j + this.i.k.nextFloat());
|
||||
double d1 = (double) ((float) k + this.i.k.nextFloat());
|
||||
double d2 = (double) ((float) l + this.i.k.nextFloat());
|
||||
double d3 = d0 - this.b;
|
||||
double d4 = d1 - this.c;
|
||||
double d5 = d2 - this.d;
|
||||
@ -230,7 +230,7 @@ public class Explosion {
|
||||
d5 /= d6;
|
||||
double d7 = 0.5D / (d6 / (double) this.f + 0.1D);
|
||||
|
||||
d7 *= (double) (this.i.l.nextFloat() * this.i.l.nextFloat() + 0.3F);
|
||||
d7 *= (double) (this.i.k.nextFloat() * this.i.k.nextFloat() + 0.3F);
|
||||
d3 *= d7;
|
||||
d4 *= d7;
|
||||
d5 *= d7;
|
||||
@ -241,7 +241,7 @@ public class Explosion {
|
||||
if (i1 > 0) {
|
||||
Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit
|
||||
this.i.e(j, k, l, 0);
|
||||
Block.byId[i1].a_(this.i, j, k, l);
|
||||
Block.byId[i1].c(this.i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,19 @@ package net.minecraft.server;
|
||||
|
||||
public interface IInventory {
|
||||
|
||||
int h_();
|
||||
int m_();
|
||||
|
||||
ItemStack a(int i);
|
||||
ItemStack c_(int i);
|
||||
|
||||
ItemStack b(int i, int j);
|
||||
ItemStack a(int i, int j);
|
||||
|
||||
void a(int i, ItemStack itemstack);
|
||||
|
||||
String b();
|
||||
String c();
|
||||
|
||||
int c();
|
||||
int n_();
|
||||
|
||||
void d();
|
||||
void h();
|
||||
|
||||
boolean a_(EntityHuman entityhuman);
|
||||
|
||||
|
@ -12,19 +12,19 @@ public class InventoryCraftResult implements IInventory {
|
||||
|
||||
public InventoryCraftResult() {}
|
||||
|
||||
public int h_() {
|
||||
return this.a.length; //Craftbukkit
|
||||
public int m_() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack c_(int i) {
|
||||
return this.a[i];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Result";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
ItemStack itemstack = this.a[i];
|
||||
|
||||
@ -39,11 +39,11 @@ public class InventoryCraftResult implements IInventory {
|
||||
this.a[i] = itemstack;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
public void h() {}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return true;
|
||||
|
@ -20,29 +20,29 @@ public class InventoryCrafting implements IInventory {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
public int m_() {
|
||||
return this.a.length;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return i >= this.h_() ? null : this.a[i];
|
||||
public ItemStack c_(int i) {
|
||||
return i >= this.m_() ? null : this.a[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack b(int i, int j) {
|
||||
if (i >= 0 && i < this.b) {
|
||||
int k = i + j * this.b;
|
||||
|
||||
return this.a(k);
|
||||
return this.c_(k);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Crafting";
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -70,11 +70,11 @@ public class InventoryCrafting implements IInventory {
|
||||
this.c.a((IInventory) this);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void d() {}
|
||||
public void h() {}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return true;
|
||||
|
@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[h_()];
|
||||
ItemStack[] result = new ItemStack[m_()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = a(i);
|
||||
result[i] = c_(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -22,37 +22,37 @@ public class InventoryLargeChest implements IInventory {
|
||||
this.c = iinventory1;
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return this.b.h_() + this.c.h_();
|
||||
public int m_() {
|
||||
return this.b.m_() + this.c.m_();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
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 c_(int i) {
|
||||
return i >= this.b.m_() ? this.c.c_(i - this.b.m_()) : this.b.c_(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 ItemStack a(int i, int j) {
|
||||
return i >= this.b.m_() ? this.c.a(i - this.b.m_(), j) : this.b.a(i, j);
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
if (i >= this.b.h_()) {
|
||||
this.c.a(i - this.b.h_(), itemstack);
|
||||
if (i >= this.b.m_()) {
|
||||
this.c.a(i - this.b.m_(), itemstack);
|
||||
} else {
|
||||
this.b.a(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b.c();
|
||||
public int n_() {
|
||||
return this.b.n_();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.b.d();
|
||||
this.c.d();
|
||||
public void h() {
|
||||
this.b.h();
|
||||
this.c.h();
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
|
@ -23,7 +23,7 @@ public class InventoryPlayer implements IInventory {
|
||||
this.e = entityhuman;
|
||||
}
|
||||
|
||||
public ItemStack e() {
|
||||
public ItemStack b() {
|
||||
return this.a[this.c];
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class InventoryPlayer implements IInventory {
|
||||
|
||||
private int c(ItemStack itemstack) {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.c() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) {
|
||||
if (this.a[i] != null && this.a[i].id == itemstack.id && this.a[i].c() && this.a[i].count < this.a[i].b() && this.a[i].count < this.n_() && (!this.a[i].e() || this.a[i].h() == itemstack.h())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -79,8 +79,8 @@ public class InventoryPlayer implements IInventory {
|
||||
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 > this.n_() - this.a[k].count) {
|
||||
l = this.n_() - this.a[k].count;
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
@ -94,7 +94,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void f() {
|
||||
public void e() {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null && this.a[i].b > 0) {
|
||||
--this.a[i].b;
|
||||
@ -135,7 +135,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
public ItemStack a(int i, int j) {
|
||||
ItemStack[] aitemstack = this.a;
|
||||
|
||||
if (i >= this.a.length) {
|
||||
@ -213,9 +213,9 @@ public class InventoryPlayer implements IInventory {
|
||||
this.a = new ItemStack[36];
|
||||
this.b = new ItemStack[4];
|
||||
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound.b("Slot") & 255;
|
||||
int j = nbttagcompound.c("Slot") & 255;
|
||||
ItemStack itemstack = new ItemStack(nbttagcompound);
|
||||
|
||||
if (itemstack.a() != null) {
|
||||
@ -230,11 +230,11 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public int h_() {
|
||||
return this.a.length + this.b.length; //Craftbukkit
|
||||
public int m_() {
|
||||
return this.a.length + 4;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack c_(int i) {
|
||||
ItemStack[] aitemstack = this.a;
|
||||
|
||||
if (i >= aitemstack.length) {
|
||||
@ -245,16 +245,16 @@ public class InventoryPlayer implements IInventory {
|
||||
return aitemstack[i];
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Inventory";
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public int a(Entity entity) {
|
||||
ItemStack itemstack = this.a(this.c);
|
||||
ItemStack itemstack = this.c_(this.c);
|
||||
|
||||
return itemstack != null ? itemstack.a(entity) : 1;
|
||||
}
|
||||
@ -263,13 +263,13 @@ public class InventoryPlayer implements IInventory {
|
||||
if (block.material != Material.STONE && block.material != Material.ORE && block.material != Material.SNOW_BLOCK && block.material != Material.SNOW_LAYER) {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = this.a(this.c);
|
||||
ItemStack itemstack = this.c_(this.c);
|
||||
|
||||
return itemstack != null ? itemstack.b(block) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int f() {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
@ -282,7 +282,7 @@ public class InventoryPlayer implements IInventory {
|
||||
|
||||
j += k1;
|
||||
k += i1;
|
||||
int l1 = ((ItemArmor) this.b[l].a()).bh;
|
||||
int l1 = ((ItemArmor) this.b[l].a()).bj;
|
||||
|
||||
i += l1;
|
||||
}
|
||||
@ -307,7 +307,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void g() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < this.a.length; ++i) {
|
||||
@ -325,7 +325,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void h() {
|
||||
this.d = true;
|
||||
}
|
||||
|
||||
@ -339,6 +339,6 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.e.dead ? false : entityhuman.b((Entity) this.e) <= 64.0D;
|
||||
return this.e.dead ? false : entityhuman.g(this.e) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -67,12 +67,12 @@ public class ItemBlock extends Item {
|
||||
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
|
||||
* rather than the block touching the face we clicked on.
|
||||
*/
|
||||
int typeId = blockClicked.getTypeId();
|
||||
int typeId = blockClicked.getTypeId();
|
||||
org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked);
|
||||
|
||||
if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP))
|
||||
replacedBlock = blockClicked;
|
||||
|
||||
|
||||
final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
|
||||
// CraftBukkit end
|
||||
|
||||
@ -95,9 +95,13 @@ public class ItemBlock extends Item {
|
||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ));
|
||||
ChunkCoordinates chunkcoordinates = world.l();
|
||||
int spawnX = chunkcoordinates.a;
|
||||
int spawnZ = chunkcoordinates.c;
|
||||
|
||||
boolean canBuild = distanceFromSpawn > ((WorldServer) world).D.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start
|
||||
int distanceFromSpawn = (int) Math.max(Math.abs(i - spawnX), Math.abs(k - spawnZ));
|
||||
|
||||
boolean canBuild = distanceFromSpawn > ((WorldServer) world).x.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start
|
||||
|
||||
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
@ -121,8 +121,8 @@ public class ItemBucket extends Item {
|
||||
}
|
||||
|
||||
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);
|
||||
if (world.m.d && this.a == Block.WATER.id) {
|
||||
world.a(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
|
||||
|
||||
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);
|
||||
|
@ -52,14 +52,14 @@ public class ItemHoe extends Item {
|
||||
|
||||
world.e(i, j, k, block.id);
|
||||
itemstack.b(1);
|
||||
if (world.l.nextInt(8) == 0 && i1 == Block.GRASS.id) {
|
||||
if (world.k.nextInt(8) == 0 && i1 == Block.GRASS.id) {
|
||||
byte b0 = 1;
|
||||
|
||||
for (int j1 = 0; j1 < b0; ++j1) {
|
||||
float f = 0.7F;
|
||||
float f1 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
float f1 = world.k.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
float f2 = 1.2F;
|
||||
float f3 = world.l.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
float f3 = world.k.nextFloat() * f + (1.0F - f) * 0.5F;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f1), (double) ((float) j + f2), (double) ((float) k + f3), new ItemStack(Item.SEEDS));
|
||||
|
||||
entityitem.c = 10;
|
||||
|
@ -9,82 +9,100 @@ public class ItemInWorldManager {
|
||||
|
||||
private World b;
|
||||
public EntityHuman a;
|
||||
private float c;
|
||||
public float d = 0.0F; // CraftBukkit private -> public
|
||||
public float c = 0.0F; // CraftBukkit private -> public
|
||||
private int d;
|
||||
private int e = 0;
|
||||
private float f = 0.0F;
|
||||
private int g;
|
||||
private int h;
|
||||
private int i;
|
||||
private int j;
|
||||
private boolean k;
|
||||
private int l;
|
||||
private int m;
|
||||
private int n;
|
||||
private int o;
|
||||
|
||||
public ItemInWorldManager(World world) {
|
||||
this.b = world;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
int l = this.b.getTypeId(i, j, k);
|
||||
|
||||
if (l > 0 && this.d == 0.0F) {
|
||||
Block.byId[l].b(this.b, i, j, k, this.a);
|
||||
}
|
||||
|
||||
if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) {
|
||||
this.c(i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.d = 0.0F;
|
||||
this.e = 0;
|
||||
}
|
||||
++this.j;
|
||||
if (this.k) {
|
||||
int i = this.j - this.o;
|
||||
int j = this.b.getTypeId(this.l, this.m, this.n);
|
||||
|
||||
public void a(int i, int j, int k, int l) {
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
} else {
|
||||
if (i == this.g && j == this.h && k == this.i) {
|
||||
int i1 = this.b.getTypeId(i, j, k);
|
||||
if (j != 0) {
|
||||
Block block = Block.byId[j];
|
||||
float f = block.a(this.a) * (float) (i + 1);
|
||||
|
||||
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;
|
||||
if (f >= 1.0F) {
|
||||
this.k = false;
|
||||
this.d(this.l, this.m, this.n);
|
||||
}
|
||||
} else {
|
||||
this.d = 0.0F;
|
||||
this.c = 0.0F;
|
||||
this.f = 0.0F;
|
||||
this.g = i;
|
||||
this.h = j;
|
||||
this.i = k;
|
||||
this.k = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(int i, int j, int k) {
|
||||
public void a(int i, int j, int k) {
|
||||
this.d = this.j;
|
||||
int l = this.b.getTypeId(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
Block.byId[l].b(this.b, i, j, k, this.a);
|
||||
}
|
||||
|
||||
if (l > 0 && Block.byId[l].a(this.a) >= 1.0F) {
|
||||
this.d(i, j, k);
|
||||
} else {
|
||||
this.g = i;
|
||||
this.h = j;
|
||||
this.i = k;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i, int j, int k) {
|
||||
if (i == this.g && j == this.h && k == this.i) {
|
||||
int l = this.j - this.d;
|
||||
int i1 = this.b.getTypeId(i, j, k);
|
||||
|
||||
if (i1 != 0) {
|
||||
Block block = Block.byId[i1];
|
||||
float f = block.a(this.a) * (float) (l + 1);
|
||||
|
||||
if (f >= 1.0F) {
|
||||
this.d(i, j, k);
|
||||
} else if (!this.k) {
|
||||
this.k = true;
|
||||
this.l = i;
|
||||
this.m = j;
|
||||
this.n = k;
|
||||
this.o = this.d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.c = 0.0F;
|
||||
this.e = 0;
|
||||
}
|
||||
|
||||
public boolean c(int i, int j, int k) {
|
||||
Block block = Block.byId[this.b.getTypeId(i, j, k)];
|
||||
int l = this.b.getData(i, j, k);
|
||||
boolean flag = this.b.e(i, j, k, 0);
|
||||
|
||||
if (block != null && flag) {
|
||||
block.a(this.b, i, j, k, l);
|
||||
block.b(this.b, i, j, k, l);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean c(int i, int j, int k) {
|
||||
//CraftBukkit start
|
||||
public boolean d(int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
if (this.a instanceof EntityPlayer){
|
||||
CraftServer server = ((WorldServer) this.b).getServer();
|
||||
org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k);
|
||||
@ -97,23 +115,24 @@ public class ItemInWorldManager {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//CraftBukkit end
|
||||
// CraftBukkit end
|
||||
|
||||
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();
|
||||
boolean flag = this.c(i, j, k);
|
||||
ItemStack itemstack = this.a.z();
|
||||
|
||||
if (itemstack != null) {
|
||||
itemstack.a(l, i, j, k);
|
||||
if (itemstack.count == 0) {
|
||||
itemstack.a(this.a);
|
||||
this.a.Q();
|
||||
this.a.A();
|
||||
}
|
||||
}
|
||||
|
||||
if (flag && this.a.b(Block.byId[l])) {
|
||||
Block.byId[l].g(this.b, i, j, k, i1);
|
||||
Block.byId[l].a_(this.b, i, j, k, i1);
|
||||
((EntityPlayer) this.a).a.b((Packet) (new Packet53BlockChange(i, j, k, this.b)));
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
@ -72,9 +72,9 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
this.id = nbttagcompound.c("id");
|
||||
this.count = nbttagcompound.b("Count");
|
||||
this.damage = nbttagcompound.c("Damage");
|
||||
this.id = nbttagcompound.d("id");
|
||||
this.count = nbttagcompound.c("Count");
|
||||
this.damage = nbttagcompound.d("Damage");
|
||||
}
|
||||
|
||||
public int b() {
|
||||
|
@ -24,7 +24,7 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.world.WorldEvent;
|
||||
//CraftBukkit end
|
||||
|
||||
public class MinecraftServer implements ICommandListener, Runnable {
|
||||
public class MinecraftServer implements Runnable, ICommandListener {
|
||||
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
public static HashMap b = new HashMap();
|
||||
@ -32,13 +32,14 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
public PropertyManager d;
|
||||
//public WorldServer e; // Craftbukkit - removed
|
||||
public ServerConfigurationManager f;
|
||||
private boolean o = true;
|
||||
private ConsoleCommandHandler o;
|
||||
private boolean p = true;
|
||||
public boolean g = false;
|
||||
int h = 0;
|
||||
public String i;
|
||||
public int j;
|
||||
private List p = new ArrayList();
|
||||
private List q = Collections.synchronizedList(new ArrayList());
|
||||
private List q = new ArrayList();
|
||||
private List r = Collections.synchronizedList(new ArrayList());
|
||||
public EntityTracker k;
|
||||
public boolean l;
|
||||
public boolean m;
|
||||
@ -58,6 +59,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
|
||||
private boolean d() throws UnknownHostException { // CraftBukkit - added throws UnknownHostException
|
||||
this.o = new ConsoleCommandHandler(this);
|
||||
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
|
||||
|
||||
threadcommandreader.setDaemon(true);
|
||||
@ -69,7 +71,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true));
|
||||
// Craftbukkit end
|
||||
|
||||
a.info("Starting minecraft server version Beta 1.2_01");
|
||||
a.info("Starting minecraft server version Beta 1.3");
|
||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
|
||||
a.warning("**** NOT ENOUGH RAM!");
|
||||
a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
@ -111,21 +113,27 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
|
||||
this.f = new ServerConfigurationManager(this);
|
||||
this.k = new EntityTracker(this);
|
||||
long j = System.nanoTime();
|
||||
String s1 = this.d.a("level-name", "world");
|
||||
|
||||
a.info("Preparing level \"" + s1 + "\"");
|
||||
this.c(s1);
|
||||
a.info("Done! For help, type \"help\" or \"?\"");
|
||||
this.a((Convertable) (new WorldLoaderServer(new File("."))), s1);
|
||||
a.info("Done (" + (System.nanoTime() - j) + "ns)! For help, type \"help\" or \"?\"");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void c(String s) {
|
||||
private void a(Convertable convertable, String s) {
|
||||
if (convertable.a(s)) {
|
||||
a.info("Converting map!");
|
||||
convertable.a(s, new ConvertProgressUpdater(this));
|
||||
}
|
||||
|
||||
a.info("Preparing start region");
|
||||
|
||||
// Craftbukkit start
|
||||
WorldServer world = new WorldServer(this, new File("."), s, this.d.a("hellworld", false) ? -1 : 0);
|
||||
WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0);
|
||||
world.a(new WorldManager(this, world));
|
||||
world.k = this.d.a("spawn-monsters", true) ? 1 : 0;
|
||||
world.j = this.d.a("spawn-monsters", true) ? 1 : 0;
|
||||
world.a(this.d.a("spawn-monsters", true), this.m);
|
||||
this.f.a(world);
|
||||
worlds.add(world);
|
||||
@ -133,9 +141,10 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
|
||||
short short1 = 196;
|
||||
long i = System.currentTimeMillis();
|
||||
ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // Craftbukkit
|
||||
|
||||
for (int j = -short1; j <= short1 && this.o; j += 16) {
|
||||
for (int k = -short1; k <= short1 && this.o; k += 16) {
|
||||
for (int j = -short1; j <= short1 && this.p; j += 16) {
|
||||
for (int k = -short1; k <= short1 && this.p; k += 16) {
|
||||
long l = System.currentTimeMillis();
|
||||
|
||||
if (l < i) {
|
||||
@ -152,9 +161,9 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
|
||||
// Craftbukkit start
|
||||
for (WorldServer worldserver : worlds) {
|
||||
world.A.d(world.spawnX + j >> 4, world.spawnZ + k >> 4);
|
||||
world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
|
||||
|
||||
while (world.d() && this.o) {
|
||||
while (world.e() && this.p) {
|
||||
;
|
||||
}
|
||||
}
|
||||
@ -184,6 +193,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
// Craftbukkit start
|
||||
for (WorldServer world : worlds) {
|
||||
world.a(true, (IProgressUpdate) null);
|
||||
world.r();
|
||||
|
||||
Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
|
||||
server.getPluginManager().callEvent( worldSaved );
|
||||
@ -209,16 +219,15 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.o = false;
|
||||
this.p = false;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
if (this.d()) {
|
||||
long i = System.currentTimeMillis();
|
||||
long j = 0L;
|
||||
|
||||
while (this.o) {
|
||||
for (long j = 0L; this.p; Thread.sleep(1L)) {
|
||||
long k = System.currentTimeMillis();
|
||||
long l = k - i;
|
||||
|
||||
@ -234,16 +243,18 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
|
||||
j += l;
|
||||
i = k;
|
||||
|
||||
while (j > 50L) {
|
||||
j -= 50L;
|
||||
if (this.worlds.size() > 0 && this.worlds.get(0).q()) { // Craftbukkit - TODO - Replace with loop?
|
||||
this.h();
|
||||
j = 0L;
|
||||
} else {
|
||||
while (j > 50L) {
|
||||
j -= 50L;
|
||||
this.h();
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
} else {
|
||||
while (this.o) {
|
||||
while (this.p) {
|
||||
this.b();
|
||||
|
||||
try {
|
||||
@ -253,11 +264,11 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
a.log(Level.SEVERE, "Unexpected exception", exception);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
a.log(Level.SEVERE, "Unexpected exception", throwable);
|
||||
|
||||
while (this.o) {
|
||||
while (this.p) {
|
||||
this.b();
|
||||
|
||||
try {
|
||||
@ -270,6 +281,8 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
try {
|
||||
this.g();
|
||||
this.g = true;
|
||||
} catch (Throwable throwable1) {
|
||||
throwable1.printStackTrace();
|
||||
} finally {
|
||||
System.exit(0);
|
||||
}
|
||||
@ -305,20 +318,20 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
if (this.h % 20 == 0) {
|
||||
for (int i = 0; i < this.f.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i);
|
||||
entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.e)));
|
||||
entityplayer.a.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
|
||||
}
|
||||
}
|
||||
|
||||
((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h);
|
||||
|
||||
for (WorldServer world : worlds) {
|
||||
world.f();
|
||||
world.g();
|
||||
|
||||
while (world.d()) {
|
||||
while (world.e()) {
|
||||
;
|
||||
}
|
||||
|
||||
world.c();
|
||||
world.d();
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
@ -326,8 +339,8 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
this.f.b();
|
||||
this.k.a();
|
||||
|
||||
for (j = 0; j < this.p.size(); ++j) {
|
||||
((IUpdatePlayerListBox) this.p.get(j)).a();
|
||||
for (j = 0; j < this.q.size(); ++j) {
|
||||
((IUpdatePlayerListBox) this.q.get(j)).a();
|
||||
}
|
||||
|
||||
try {
|
||||
@ -338,236 +351,25 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
|
||||
public void a(String s, ICommandListener icommandlistener) {
|
||||
this.q.add(new ServerCommand(s, icommandlistener));
|
||||
this.r.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void b() {
|
||||
while (this.q.size() > 0) {
|
||||
ServerCommand servercommand = (ServerCommand) this.q.remove(0);
|
||||
String s = servercommand.a;
|
||||
ICommandListener icommandlistener = servercommand.b;
|
||||
String s1 = icommandlistener.c();
|
||||
while (this.r.size() > 0) {
|
||||
ServerCommand servercommand = (ServerCommand) this.r.remove(0);
|
||||
|
||||
// Craftbukkit start
|
||||
if (server.dispatchCommand(console, s)) {
|
||||
if (server.dispatchCommand(console, servercommand.a)) {
|
||||
continue;
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
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..");
|
||||
|
||||
// Craftbukkit start
|
||||
for (WorldServer world : worlds) {
|
||||
world.a(true, (IProgressUpdate) null);
|
||||
|
||||
Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
|
||||
server.getPluginManager().callEvent( worldSaved );
|
||||
}
|
||||
|
||||
this.f.d();
|
||||
// Craftbukkit end
|
||||
|
||||
this.a(s1, "Save complete.");
|
||||
} else if (s.toLowerCase().startsWith("save-off")) {
|
||||
this.a(s1, "Disabling level saving..");
|
||||
|
||||
// Craftbukkit start
|
||||
for (WorldServer world : worlds) {
|
||||
world.C = true;
|
||||
}
|
||||
// Craftbukkit end
|
||||
} else if (s.toLowerCase().startsWith("save-on")) {
|
||||
this.a(s1, "Enabling level saving..");
|
||||
|
||||
// Craftbukkit start
|
||||
for (WorldServer world : worlds) {
|
||||
world.C = false;
|
||||
}
|
||||
// Craftbukkit end
|
||||
} else {
|
||||
String s2;
|
||||
|
||||
if (s.toLowerCase().startsWith("op ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.e(s2);
|
||||
this.a(s1, "Opping " + s2);
|
||||
this.f.a(s2, "\u00A7eYou are now op!");
|
||||
} else if (s.toLowerCase().startsWith("deop ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.f(s2);
|
||||
this.f.a(s2, "\u00A7eYou are no longer op!");
|
||||
this.a(s1, "De-opping " + s2);
|
||||
} else if (s.toLowerCase().startsWith("ban-ip ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.c(s2);
|
||||
this.a(s1, "Banning ip " + s2);
|
||||
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.d(s2);
|
||||
this.a(s1, "Pardoning ip " + s2);
|
||||
} else {
|
||||
EntityPlayer entityplayer;
|
||||
|
||||
if (s.toLowerCase().startsWith("ban ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.a(s2);
|
||||
this.a(s1, "Banning " + s2);
|
||||
entityplayer = this.f.h(s2);
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.a("Banned by admin");
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("pardon ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
this.f.b(s2);
|
||||
this.a(s1, "Pardoning " + s2);
|
||||
} else if (s.toLowerCase().startsWith("kick ")) {
|
||||
s2 = s.substring(s.indexOf(" ")).trim();
|
||||
entityplayer = null;
|
||||
|
||||
for (int i = 0; i < this.f.b.size(); ++i) {
|
||||
EntityPlayer entityplayer1 = (EntityPlayer) this.f.b.get(i);
|
||||
|
||||
if (entityplayer1.name.equalsIgnoreCase(s2)) {
|
||||
entityplayer = entityplayer1;
|
||||
}
|
||||
}
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.a("Kicked by admin");
|
||||
this.a(s1, "Kicking " + entityplayer.name);
|
||||
} else {
|
||||
icommandlistener.b("Can\'t find user " + s2 + ". No kick.");
|
||||
}
|
||||
} else {
|
||||
String[] astring;
|
||||
EntityPlayer entityplayer2;
|
||||
|
||||
if (s.toLowerCase().startsWith("tp ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length == 3) {
|
||||
entityplayer = this.f.h(astring[1]);
|
||||
entityplayer2 = this.f.h(astring[2]);
|
||||
if (entityplayer == null) {
|
||||
icommandlistener.b("Can\'t find user " + astring[1] + ". No tp.");
|
||||
} else if (entityplayer2 == null) {
|
||||
icommandlistener.b("Can\'t find user " + astring[2] + ". No tp.");
|
||||
} else {
|
||||
entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
|
||||
this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("Syntax error, please provice a source and a target.");
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("give ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length != 3 && astring.length != 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
String s3 = astring[1];
|
||||
|
||||
entityplayer2 = this.f.h(s3);
|
||||
if (entityplayer2 != null) {
|
||||
try {
|
||||
int j = Integer.parseInt(astring[2]);
|
||||
|
||||
if (Item.byId[j] != null) {
|
||||
this.a(s1, "Giving " + entityplayer2.name + " some " + j);
|
||||
int k = 1;
|
||||
|
||||
if (astring.length > 3) {
|
||||
k = this.b(astring[3], 1);
|
||||
}
|
||||
|
||||
if (k < 1) {
|
||||
k = 1;
|
||||
}
|
||||
|
||||
if (k > 64) {
|
||||
k = 64;
|
||||
}
|
||||
|
||||
entityplayer2.b(new ItemStack(j, k, 0));
|
||||
} else {
|
||||
icommandlistener.b("There\'s no item with id " + j);
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
icommandlistener.b("There\'s no item with id " + astring[2]);
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("Can\'t find user " + s3);
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("say ")) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info("[" + s1 + "] " + s);
|
||||
this.f.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s)));
|
||||
} else if (s.toLowerCase().startsWith("tell ")) {
|
||||
astring = s.split(" ");
|
||||
if (astring.length >= 3) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
a.info("[" + s1 + "->" + astring[1] + "] " + s);
|
||||
s = "\u00A77" + s1 + " whispers " + s;
|
||||
a.info(s);
|
||||
if (!this.f.a(astring[1], (Packet) (new Packet3Chat(s)))) {
|
||||
icommandlistener.b("There\'s no player by that name online.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
a.info("Unknown console command. Type \"help\" for help.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
icommandlistener.b("To run the server without a gui, start it like this:");
|
||||
icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
|
||||
icommandlistener.b("Console commands:");
|
||||
icommandlistener.b(" help or ? shows this message");
|
||||
icommandlistener.b(" kick <player> removes a player from the server");
|
||||
icommandlistener.b(" ban <player> bans a player from the server");
|
||||
icommandlistener.b(" pardon <player> pardons a banned player so that they can connect again");
|
||||
icommandlistener.b(" ban-ip <ip> bans an IP address from the server");
|
||||
icommandlistener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
|
||||
icommandlistener.b(" op <player> turns a player into an op");
|
||||
icommandlistener.b(" deop <player> removes op status from a player");
|
||||
icommandlistener.b(" tp <player1> <player2> moves one player to the same location as another player");
|
||||
icommandlistener.b(" give <player> <id> [num] gives a player a resource");
|
||||
icommandlistener.b(" tell <player> <message> sends a private message to a player");
|
||||
icommandlistener.b(" stop gracefully stops the server");
|
||||
icommandlistener.b(" save-all forces a server-wide level save");
|
||||
icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)");
|
||||
icommandlistener.b(" save-on re-enables terrain saving");
|
||||
icommandlistener.b(" list lists all currently connected players");
|
||||
icommandlistener.b(" say <message> broadcasts a message to all players");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String s, String s1) {
|
||||
String s2 = s + ": " + s1;
|
||||
|
||||
this.f.i("\u00A77(" + s2 + ")");
|
||||
a.info(s2);
|
||||
}
|
||||
|
||||
private int b(String s, int i) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return i;
|
||||
|
||||
this.o.a(servercommand);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
|
||||
this.p.add(iupdateplayerlistbox);
|
||||
this.q.add(iupdateplayerlistbox);
|
||||
}
|
||||
|
||||
public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[])
|
||||
@ -595,6 +397,6 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
||||
}
|
||||
|
||||
public static boolean a(MinecraftServer minecraftserver) {
|
||||
return minecraftserver.o;
|
||||
return minecraftserver.p;
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ public class NetLoginHandler extends NetHandler {
|
||||
|
||||
public void a(Packet1Login packet1login) {
|
||||
this.g = packet1login.b;
|
||||
if (packet1login.a != 8) {
|
||||
if (packet1login.a > 8) {
|
||||
if (packet1login.a != 9) {
|
||||
if (packet1login.a > 9) {
|
||||
this.a("Outdated server!");
|
||||
} else {
|
||||
this.a("Outdated client!");
|
||||
@ -80,13 +80,14 @@ public class NetLoginHandler extends NetHandler {
|
||||
NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer);
|
||||
|
||||
// Craftbukkit start
|
||||
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.u, (byte) entityplayer.world.q.g)));
|
||||
netserverhandler.b((Packet) (new Packet6SpawnPosition(entityplayer.world.spawnX, entityplayer.world.spawnY, entityplayer.world.spawnZ)));
|
||||
ChunkCoordinates chunkcoordinates = entityplayer.world.l();
|
||||
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (byte) entityplayer.world.m.g)));
|
||||
netserverhandler.b((Packet) (new Packet6SpawnPosition(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c)));
|
||||
this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")));
|
||||
this.e.f.a(entityplayer);
|
||||
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
||||
this.e.c.a(netserverhandler);
|
||||
netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.e)));
|
||||
netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
|
||||
// Craftbukkit end
|
||||
|
||||
entityplayer.l();
|
||||
|
@ -30,12 +30,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
public boolean c = false;
|
||||
private MinecraftServer d;
|
||||
public EntityPlayer e; // Craftbukkit - public
|
||||
private int f = 0;
|
||||
private double g;
|
||||
private double h;
|
||||
private int f;
|
||||
private int g;
|
||||
private boolean h;
|
||||
private double i;
|
||||
private boolean j = true;
|
||||
private Map k = new HashMap();
|
||||
private double j;
|
||||
private double k;
|
||||
private boolean l = true;
|
||||
private Map m = new HashMap();
|
||||
|
||||
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||
this.d = minecraftserver;
|
||||
@ -64,9 +66,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
|
||||
public void a() {
|
||||
this.h = false;
|
||||
this.b.a();
|
||||
if (this.f++ % 20 == 0) {
|
||||
this.b.a((Packet) (new Packet0KeepAlive()));
|
||||
if (this.f - this.g > 20) {
|
||||
this.b((Packet) (new Packet0KeepAlive()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,28 +83,32 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
// Send the possibly modified leave message
|
||||
this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() )));
|
||||
this.d.f.c(this.e);
|
||||
this.b.a((Packet) (new Packet255KickDisconnect( kickEvent.getReason() )));
|
||||
// CraftBukkit end
|
||||
|
||||
this.b.c();
|
||||
this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() )));
|
||||
// CraftBukkit end
|
||||
this.d.f.c(this.e);
|
||||
this.c = true;
|
||||
}
|
||||
|
||||
public void a(Packet27 packet27) {
|
||||
this.e.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f());
|
||||
}
|
||||
|
||||
public void a(Packet10Flying packet10flying) {
|
||||
this.h = true;
|
||||
double d0;
|
||||
|
||||
if (!this.j) {
|
||||
d0 = packet10flying.b - this.h;
|
||||
if (packet10flying.a == this.g && d0 * d0 < 0.01D && packet10flying.c == this.i) {
|
||||
this.j = true;
|
||||
if (!this.l) {
|
||||
d0 = packet10flying.b - this.j;
|
||||
if (packet10flying.a == this.i && d0 * d0 < 0.01D && packet10flying.c == this.k) {
|
||||
this.l = true;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
Player player = getPlayer();
|
||||
Location from = new Location(player.getWorld(), g, h, i, this.e.yaw, this.e.pitch);
|
||||
Location from = new Location(player.getWorld(), i, j, k, this.e.yaw, this.e.pitch);
|
||||
Location to = player.getLocation();
|
||||
if (!from.equals(to)) {
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to);
|
||||
@ -118,7 +125,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.j) {
|
||||
if (this.l) {
|
||||
double d1;
|
||||
double d2;
|
||||
double d3;
|
||||
@ -128,7 +135,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
float f = this.e.yaw;
|
||||
float f1 = this.e.pitch;
|
||||
|
||||
this.e.vehicle.E();
|
||||
this.e.vehicle.h_();
|
||||
d1 = this.e.locX;
|
||||
d2 = this.e.locY;
|
||||
d3 = this.e.locZ;
|
||||
@ -146,7 +153,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
this.e.onGround = packet10flying.g;
|
||||
this.e.n();
|
||||
this.e.a(true);
|
||||
this.e.c(d5, 0.0D, d4);
|
||||
this.e.b(d1, d2, d3, f, f1);
|
||||
this.e.motX = d5;
|
||||
@ -156,21 +163,21 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
if (this.e.vehicle != null) {
|
||||
this.e.vehicle.E();
|
||||
this.e.vehicle.h_();
|
||||
}
|
||||
|
||||
this.d.f.b(this.e);
|
||||
this.g = this.e.locX;
|
||||
this.h = this.e.locY;
|
||||
this.i = this.e.locZ;
|
||||
this.e.world.f(this.e);
|
||||
this.i = this.e.locX;
|
||||
this.j = this.e.locY;
|
||||
this.k = this.e.locZ;
|
||||
this.e.world.f(this.e); // Craftbukkit
|
||||
return;
|
||||
}
|
||||
|
||||
d0 = this.e.locY;
|
||||
this.g = this.e.locX;
|
||||
this.h = this.e.locY;
|
||||
this.i = this.e.locZ;
|
||||
this.i = this.e.locX;
|
||||
this.j = this.e.locY;
|
||||
this.k = this.e.locZ;
|
||||
d1 = this.e.locX;
|
||||
d2 = this.e.locY;
|
||||
d3 = this.e.locZ;
|
||||
@ -190,8 +197,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.a("Illegal stance");
|
||||
a.warning(this.e.name + " had an illegal stance: " + d4);
|
||||
}
|
||||
|
||||
this.e.al = packet10flying.d;
|
||||
}
|
||||
|
||||
if (packet10flying.i) {
|
||||
@ -199,9 +204,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
f3 = packet10flying.f;
|
||||
}
|
||||
|
||||
this.e.n();
|
||||
this.e.R = 0.0F;
|
||||
this.e.b(this.g, this.h, this.i, f2, f3);
|
||||
this.e.a(true);
|
||||
this.e.bl = 0.0F;
|
||||
this.e.b(this.i, this.j, this.k, f2, f3);
|
||||
d4 = d1 - this.e.locX;
|
||||
double d6 = d2 - this.e.locY;
|
||||
double d7 = d3 - this.e.locZ;
|
||||
@ -219,7 +224,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
double d8 = d4 * d4 + d6 * d6 + d7 * d7;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (d8 > 0.0625D) {
|
||||
if (d8 > 0.0625D && !this.e.E()) {
|
||||
flag1 = true;
|
||||
a.warning(this.e.name + " moved wrongly!");
|
||||
System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
|
||||
@ -229,8 +234,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.e.b(d1, d2, d3, f2, f3);
|
||||
boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit
|
||||
|
||||
if (flag && (flag1 || !flag2)) {
|
||||
this.a(this.g, this.h, this.i, f2, f3);
|
||||
if (flag && (flag1 || !flag2) && !this.e.E()) {
|
||||
this.a(this.i, this.j, this.k, f2, f3);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,26 +263,26 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
f1 = to.getPitch();
|
||||
// CraftBukkit end
|
||||
|
||||
this.j = false;
|
||||
this.g = d0;
|
||||
this.h = d1;
|
||||
this.i = d2;
|
||||
this.l = false;
|
||||
this.i = d0;
|
||||
this.j = d1;
|
||||
this.k = d2;
|
||||
this.e.b(d0, d1, d2, f, f1);
|
||||
this.e.a.b((Packet) (new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)));
|
||||
}
|
||||
|
||||
public void a(Packet14BlockDig packet14blockdig) {
|
||||
if (packet14blockdig.e == 4) {
|
||||
this.e.O();
|
||||
this.e.y();
|
||||
} else {
|
||||
boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit
|
||||
boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
|
||||
boolean flag1 = false;
|
||||
|
||||
if (packet14blockdig.e == 0) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (packet14blockdig.e == 1) {
|
||||
if (packet14blockdig.e == 2) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
@ -294,19 +299,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (d3 > 36.0D) {
|
||||
return;
|
||||
}
|
||||
|
||||
double d4 = this.e.locY;
|
||||
|
||||
this.e.locY = this.e.al;
|
||||
this.e.locY = d4;
|
||||
}
|
||||
|
||||
int l = packet14blockdig.d;
|
||||
int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit
|
||||
int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit
|
||||
ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
|
||||
int l = (int) MathHelper.e((float) (i - chunkcoordinates.a));
|
||||
int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
|
||||
|
||||
if (i1 > j1) {
|
||||
j1 = i1;
|
||||
if (l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -321,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
if (packet14blockdig.e == 0) {
|
||||
// CraftBukkit start
|
||||
if (j1 > this.d.spawnProtection || flag) {
|
||||
if (i1 > this.d.spawnProtection || flag) {
|
||||
if (blockId > 0) {
|
||||
BlockDamageEvent event;
|
||||
// If the amount of damage that the player is going to do to the block
|
||||
@ -351,16 +351,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
BlockDamageEvent event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.STOPPED, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.e.c.a();
|
||||
this.e.c.b(i, j, k);
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (packet14blockdig.e == 1) {
|
||||
// CraftBukkit start
|
||||
if (j1 > this.d.spawnProtection || flag) {
|
||||
if (i1 > this.d.spawnProtection || flag) {
|
||||
BlockDamageEvent event;
|
||||
// If the amount of damage going to the block plus the current amount
|
||||
// of damage is greater than 1, the block is going to break.
|
||||
if (e.c.d + damage >= 1.0F) {
|
||||
if (e.c.c + damage >= 1.0F) {
|
||||
// if we are destroying either a redstone wire with a current greater than 0 or
|
||||
// a redstone torch that is on, then we should notify plugins that this block has
|
||||
// returned to a current value of 0 (since it will once the redstone is destroyed)
|
||||
@ -372,37 +372,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
|
||||
}
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.e.c.a(i, j, k, l);
|
||||
} else {
|
||||
e.c.d = 0; // Reset the amount of damage if stopping break.
|
||||
if (event.isCancelled()) {
|
||||
e.c.c = 0; // Reset the amount of damage if stopping break.
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (packet14blockdig.e == 3) {
|
||||
double d5 = this.e.locX - ((double) i + 0.5D);
|
||||
double d6 = this.e.locY - ((double) j + 0.5D);
|
||||
double d7 = this.e.locZ - ((double) k + 0.5D);
|
||||
double d8 = d5 * d5 + d6 * d6 + d7 * d7;
|
||||
double d4 = this.e.locX - ((double) i + 0.5D);
|
||||
double d5 = this.e.locY - ((double) j + 0.5D);
|
||||
double d6 = this.e.locZ - ((double) k + 0.5D);
|
||||
double d7 = d4 * d4 + d5 * d5 + d6 * d6;
|
||||
|
||||
if (d8 < 256.0D) {
|
||||
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); // Craftbukkit
|
||||
if (d7 < 256.0D) {
|
||||
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
lastX = i;
|
||||
lastY = j;
|
||||
lastZ = k;
|
||||
// CraftBukkit end
|
||||
|
||||
((WorldServer)this.e.world).B = false; // Craftbukkit
|
||||
((WorldServer)this.e.world).v = false;
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet15Place packet15place) {
|
||||
ItemStack itemstack = this.e.inventory.e();
|
||||
boolean flag = ((WorldServer)this.e.world).B = this.d.f.g(this.e.name); // Craftbukkit
|
||||
ItemStack itemstack = this.e.inventory.b();
|
||||
boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
|
||||
|
||||
// CraftBukkit start
|
||||
CraftBlock blockClicked = null;
|
||||
@ -475,8 +471,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
int j = packet15place.b;
|
||||
int k = packet15place.c;
|
||||
int l = packet15place.d;
|
||||
int i1 = (int) MathHelper.e((float) (i - this.e.world.spawnX)); // Craftbukkit
|
||||
int j1 = (int) MathHelper.e((float) (k - this.e.world.spawnZ)); // Craftbukkit
|
||||
ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
|
||||
int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
|
||||
int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
|
||||
|
||||
if (i1 > j1) {
|
||||
j1 = i1;
|
||||
@ -523,18 +520,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.e.inventory.a[this.e.inventory.c] = null;
|
||||
}
|
||||
|
||||
this.e.am = true;
|
||||
this.e.h = true;
|
||||
this.e.inventory.a[this.e.inventory.c] = ItemStack.b(this.e.inventory.a[this.e.inventory.c]);
|
||||
Slot slot = this.e.activeContainer.a(this.e.inventory, this.e.inventory.c);
|
||||
|
||||
this.e.activeContainer.a();
|
||||
this.e.am = false;
|
||||
this.e.h = false;
|
||||
|
||||
if (!ItemStack.a(this.e.inventory.e(), packet15place.e) || always) { // CraftBukkit
|
||||
this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.c, this.e.inventory.e())));
|
||||
if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) { // CraftBukkit
|
||||
this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.a, this.e.inventory.b())));
|
||||
}
|
||||
|
||||
((WorldServer)this.e.world).B = false; // Craftbukkit
|
||||
((WorldServer)this.e.world).v = false; // Craftbukkit
|
||||
}
|
||||
|
||||
public void a(String s, Object[] aobject) {
|
||||
@ -551,6 +548,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
public void b(Packet packet) {
|
||||
this.b.a(packet);
|
||||
this.g = this.f;
|
||||
}
|
||||
|
||||
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
|
||||
@ -664,7 +662,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
} else {
|
||||
String s1;
|
||||
|
||||
if (this.d.f.g(this.e.name)) {
|
||||
if (this.d.f.h(this.e.name)) {
|
||||
s1 = s.substring(1);
|
||||
a.info(this.e.name + " issued server command: " + s1);
|
||||
this.d.a(s1, (ICommandListener) this);
|
||||
@ -683,7 +681,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
this.e.K();
|
||||
this.e.r();
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,6 +701,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.e.b(true);
|
||||
} else if (packet19entityaction.b == 2) {
|
||||
this.e.b(false);
|
||||
} else if (packet19entityaction.b == 3) {
|
||||
this.e.a(false, true);
|
||||
this.l = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,11 +726,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
public void a(Packet7UseEntity packet7useentity) {
|
||||
Entity entity = ((WorldServer)this.e.world).a(packet7useentity.b); // Craftbukkit
|
||||
|
||||
if (entity != null && this.e.i(entity)) {
|
||||
if (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) {
|
||||
if (packet7useentity.c == 0) {
|
||||
this.e.g(entity);
|
||||
this.e.c(entity);
|
||||
} else if (packet7useentity.c == 1) {
|
||||
this.e.h(entity);
|
||||
this.e.d(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -746,7 +747,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet101CloseWindow packet101closewindow) {
|
||||
this.e.N();
|
||||
this.e.v();
|
||||
}
|
||||
|
||||
public void a(Packet102WindowClick packet102windowclick) {
|
||||
@ -755,18 +756,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
if (ItemStack.a(packet102windowclick.e, itemstack)) {
|
||||
this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
|
||||
this.e.am = true;
|
||||
this.e.h = true;
|
||||
this.e.activeContainer.a();
|
||||
this.e.M();
|
||||
this.e.am = false;
|
||||
this.e.u();
|
||||
this.e.h = false;
|
||||
} else {
|
||||
this.k.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d));
|
||||
this.m.put(Integer.valueOf(this.e.activeContainer.f), Short.valueOf(packet102windowclick.d));
|
||||
this.e.a.b((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)));
|
||||
this.e.activeContainer.a(this.e, false);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
for (int i = 0; i < this.e.activeContainer.e.size(); ++i) {
|
||||
arraylist.add(((Slot) this.e.activeContainer.e.get(i)).c());
|
||||
arraylist.add(((Slot) this.e.activeContainer.e.get(i)).b());
|
||||
}
|
||||
|
||||
this.e.a(this.e.activeContainer, arraylist);
|
||||
@ -775,7 +776,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet106Transaction packet106transaction) {
|
||||
Short oshort = (Short) this.k.get(Integer.valueOf(this.e.activeContainer.f));
|
||||
Short oshort = (Short) this.m.get(Integer.valueOf(this.e.activeContainer.f));
|
||||
|
||||
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.e.activeContainer.f == packet106transaction.a && !this.e.activeContainer.c(this.e)) {
|
||||
this.e.activeContainer.a(this.e, true);
|
||||
@ -828,10 +829,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
tileentitysign.e[l] = modifyEvent.getLine(l); // CraftBukkit
|
||||
tileentitysign.a[l] = modifyEvent.getLine(l); // CraftBukkit
|
||||
}
|
||||
|
||||
tileentitysign.d();
|
||||
tileentitysign.h();
|
||||
this.e.world.g(i, k, j); // Craftbukkit
|
||||
}
|
||||
}
|
||||
|
@ -29,14 +29,14 @@ class PlayerInstance {
|
||||
this.d = j;
|
||||
this.e = new ChunkCoordIntPair(i, j);
|
||||
|
||||
playermanager.world.A.d(i, j); // Craftbukkit
|
||||
playermanager.world.u.d(i, j); // Craftbukkit
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
if (this.b.contains(entityplayer)) {
|
||||
throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.c + ", " + this.d);
|
||||
} else {
|
||||
entityplayer.ak.add(this.e);
|
||||
entityplayer.g.add(this.e);
|
||||
entityplayer.a.b((Packet) (new Packet50PreChunk(this.e.a, this.e.b, true)));
|
||||
this.b.add(entityplayer);
|
||||
entityplayer.f.add(this.e);
|
||||
@ -56,11 +56,11 @@ class PlayerInstance {
|
||||
PlayerManager.c(this.a).remove(this);
|
||||
}
|
||||
|
||||
((WorldServer)entityplayer.world).A.c(this.c, this.d); // Craftbukkit
|
||||
((WorldServer)entityplayer.world).u.c(this.c, this.d); // Craftbukkit
|
||||
}
|
||||
|
||||
entityplayer.f.remove(this.e);
|
||||
if (entityplayer.ak.contains(this.e)) {
|
||||
if (entityplayer.g.contains(this.e)) {
|
||||
entityplayer.a.b((Packet) (new Packet50PreChunk(this.c, this.d, false)));
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ class PlayerInstance {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (entityplayer.ak.contains(this.e)) {
|
||||
if (entityplayer.g.contains(this.e)) {
|
||||
entityplayer.a.b(packet);
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ class PlayerInstance {
|
||||
|
||||
private void a(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.g();
|
||||
Packet packet = tileentity.e();
|
||||
|
||||
if (packet != null) {
|
||||
this.a(packet);
|
||||
|
@ -9,6 +9,7 @@ public class PlayerManager {
|
||||
private PlayerList b = new PlayerList();
|
||||
private List c = new ArrayList();
|
||||
private MinecraftServer d;
|
||||
private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
|
||||
public WorldServer world; // Craftbukkit
|
||||
|
||||
// Craftbukkit - change of method signature
|
||||
@ -26,8 +27,7 @@ public class PlayerManager {
|
||||
this.c.clear();
|
||||
}
|
||||
|
||||
// Craftbukkit - method signature changed!
|
||||
private PlayerInstance a(int i, int j, boolean flag, WorldServer world) {
|
||||
private PlayerInstance a(int i, int j, boolean flag) {
|
||||
long k = (long) i + 2147483647L | (long) j + 2147483647L << 32;
|
||||
PlayerInstance playerinstance = (PlayerInstance) this.b.a(k);
|
||||
|
||||
@ -39,63 +39,50 @@ public class PlayerManager {
|
||||
return playerinstance;
|
||||
}
|
||||
|
||||
// Craftbukkit - method signature changed!
|
||||
public void a(int i, int j, int k, WorldServer world) {
|
||||
public void a(int i, int j, int k) {
|
||||
int l = i >> 4;
|
||||
int i1 = k >> 4;
|
||||
PlayerInstance playerinstance = this.a(l, i1, false, world);
|
||||
PlayerInstance playerinstance = this.a(l, i1, false);
|
||||
|
||||
if (playerinstance != null) {
|
||||
playerinstance.a(i & 15, j, k & 15);
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private final int[][] direction = new int[][] {
|
||||
{ 1, 0 },
|
||||
{ 0, 1 },
|
||||
{ -1, 0 },
|
||||
{ 0, -1 },
|
||||
};
|
||||
// CraftBukkit end
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
int i = (int) entityplayer.locX >> 4;
|
||||
int j = (int) entityplayer.locZ >> 4;
|
||||
|
||||
entityplayer.d = entityplayer.locX;
|
||||
entityplayer.e = entityplayer.locZ;
|
||||
int k = 0;
|
||||
byte b0 = 10;
|
||||
int l = 0;
|
||||
int i1 = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
int facing = 0;
|
||||
int size = 10;
|
||||
int dx = 0;
|
||||
int dz = 0;
|
||||
this.a(i, j, true).a(entityplayer);
|
||||
|
||||
// Origin
|
||||
this.a(i, j, true, ((WorldServer)entityplayer.world)).a(entityplayer);
|
||||
int j1;
|
||||
|
||||
// All but the last leg
|
||||
for (int legSize = 1; legSize <= size * 2; legSize++) {
|
||||
for (int leg = 0; leg < 2; leg++) {
|
||||
int[] dir = direction[ facing++ % 4 ];
|
||||
for (j1 = 1; j1 <= b0 * 2; ++j1) {
|
||||
for (int k1 = 0; k1 < 2; ++k1) {
|
||||
int[] aint = this.e[k++ % 4];
|
||||
|
||||
for (int k = 0; k < legSize; k++ ) {
|
||||
dx += dir[0];
|
||||
dz += dir[1];
|
||||
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit
|
||||
for (int l1 = 0; l1 < j1; ++l1) {
|
||||
l += aint[0];
|
||||
i1 += aint[1];
|
||||
this.a(i + l, j + i1, true).a(entityplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Final leg
|
||||
facing %= 4;
|
||||
for (int k = 0; k < size * 2; k++) {
|
||||
dx += direction[facing][0];
|
||||
dz += direction[facing][1];
|
||||
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer);
|
||||
k %= 4;
|
||||
|
||||
for (j1 = 0; j1 < b0 * 2; ++j1) {
|
||||
l += this.e[k][0];
|
||||
i1 += this.e[k][1];
|
||||
this.a(i + l, j + i1, true).a(entityplayer);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.a.add(entityplayer);
|
||||
}
|
||||
@ -106,7 +93,7 @@ public class PlayerManager {
|
||||
|
||||
for (int k = i - 10; k <= i + 10; ++k) {
|
||||
for (int l = j - 10; l <= j + 10; ++l) {
|
||||
PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world)); // Craftbukkit
|
||||
PlayerInstance playerinstance = this.a(k, l, false);
|
||||
|
||||
if (playerinstance != null) {
|
||||
playerinstance.b(entityplayer);
|
||||
@ -141,11 +128,11 @@ public class PlayerManager {
|
||||
for (int k1 = i - 10; k1 <= i + 10; ++k1) {
|
||||
for (int l1 = j - 10; l1 <= j + 10; ++l1) {
|
||||
if (!this.a(k1, l1, k, l)) {
|
||||
this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit
|
||||
this.a(k1, l1, true).a(entityplayer);
|
||||
}
|
||||
|
||||
if (!this.a(k1 - i1, l1 - j1, i, j)) {
|
||||
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world)); // Craftbukkit
|
||||
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false);
|
||||
|
||||
if (playerinstance != null) {
|
||||
playerinstance.b(entityplayer);
|
||||
|
@ -90,4 +90,10 @@ public class PropertyManager {
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(String s, boolean flag) {
|
||||
flag = getOverride(s, flag); // CraftBukkit
|
||||
this.b.setProperty(s, "" + flag);
|
||||
this.b();
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,13 @@ public class ServerConfigurationManager {
|
||||
private Set f = new HashSet();
|
||||
private Set g = new HashSet();
|
||||
private Set h = new HashSet();
|
||||
private File i;
|
||||
private Set i = new HashSet();
|
||||
private File j;
|
||||
private File k;
|
||||
private PlayerNBTManager l;
|
||||
private File l;
|
||||
private File m;
|
||||
private PlayerFileData n;
|
||||
private boolean o;
|
||||
|
||||
// CraftBukkit start
|
||||
private CraftServer server;
|
||||
@ -48,23 +51,27 @@ public class ServerConfigurationManager {
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = minecraftserver;
|
||||
this.i = minecraftserver.a("banned-players.txt");
|
||||
this.j = minecraftserver.a("banned-ips.txt");
|
||||
this.k = minecraftserver.a("ops.txt");
|
||||
this.j = minecraftserver.a("banned-players.txt");
|
||||
this.k = minecraftserver.a("banned-ips.txt");
|
||||
this.l = minecraftserver.a("ops.txt");
|
||||
this.m = minecraftserver.a("white-list.txt");
|
||||
// this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed!
|
||||
this.e = minecraftserver.d.a("max-players", 20);
|
||||
this.e();
|
||||
this.o = minecraftserver.d.a("white-list", false);
|
||||
this.g();
|
||||
this.i();
|
||||
this.f();
|
||||
this.k();
|
||||
this.m();
|
||||
this.h();
|
||||
this.j();
|
||||
this.l();
|
||||
this.n();
|
||||
}
|
||||
|
||||
public void a(WorldServer worldserver) {
|
||||
// Craftbukkit start
|
||||
if (this.l == null) {
|
||||
this.l = new PlayerNBTManager(new File(worldserver.t, "players"));
|
||||
if (this.n == null) {
|
||||
this.n = worldserver.m().d();
|
||||
}
|
||||
// Craftbukkit end
|
||||
}
|
||||
@ -75,10 +82,10 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
this.b.add(entityplayer);
|
||||
this.l.b(entityplayer);
|
||||
this.n.b(entityplayer);
|
||||
|
||||
// Craftbukkit start
|
||||
((WorldServer)entityplayer.world).A.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
((WorldServer)entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
|
||||
while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
|
||||
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
|
||||
@ -97,7 +104,7 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void c(EntityPlayer entityplayer) {
|
||||
this.l.a(entityplayer);
|
||||
this.n.a(entityplayer);
|
||||
entityplayer.world.d(entityplayer); // Craftbukkit
|
||||
this.b.remove(entityplayer);
|
||||
|
||||
@ -123,6 +130,8 @@ public class ServerConfigurationManager {
|
||||
|
||||
if (this.f.contains(s.trim().toLowerCase())) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
|
||||
} else if (!this.g(s)) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are not white-listed on this server!");
|
||||
} else if (this.g.contains(s2)) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
|
||||
} else if (this.b.size() >= this.e) {
|
||||
@ -158,7 +167,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
entityplayer1.id = entityplayer.id;
|
||||
entityplayer1.a = entityplayer.a;
|
||||
((WorldServer)entityplayer.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
((WorldServer)entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
|
||||
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
||||
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
||||
@ -177,7 +186,7 @@ public class ServerConfigurationManager {
|
||||
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch();
|
||||
entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle());
|
||||
entityplayer1.c.a = entityplayer1;
|
||||
((WorldServer)entityplayer1.world).A.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
((WorldServer)entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||
// CraftBukkit end
|
||||
|
||||
entityplayer1.a.b((Packet) (new Packet9Respawn()));
|
||||
@ -186,6 +195,7 @@ public class ServerConfigurationManager {
|
||||
entityplayer.world.a(entityplayer1);
|
||||
this.b.add(entityplayer1);
|
||||
entityplayer1.l();
|
||||
entityplayer1.s();
|
||||
return entityplayer1;
|
||||
// Craftbukkit end
|
||||
}
|
||||
@ -200,7 +210,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
// Craftbukkit - changed signature
|
||||
public void a(int i, int j, int k, WorldServer world) {
|
||||
world.manager.a(i, j, k, world); // Craftbukkit
|
||||
world.manager.a(i, j, k);
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
@ -227,18 +237,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void a(String s) {
|
||||
this.f.add(s.toLowerCase());
|
||||
this.f();
|
||||
this.h();
|
||||
}
|
||||
|
||||
public void b(String s) {
|
||||
this.f.remove(s.toLowerCase());
|
||||
this.f();
|
||||
this.h();
|
||||
}
|
||||
|
||||
private void e() {
|
||||
private void g() {
|
||||
try {
|
||||
this.f.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.i));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@ -251,9 +261,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void f() {
|
||||
private void h() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.i, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
|
||||
Iterator iterator = this.f.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -270,18 +280,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void c(String s) {
|
||||
this.g.add(s.toLowerCase());
|
||||
this.h();
|
||||
this.j();
|
||||
}
|
||||
|
||||
public void d(String s) {
|
||||
this.g.remove(s.toLowerCase());
|
||||
this.h();
|
||||
this.j();
|
||||
}
|
||||
|
||||
private void g() {
|
||||
private void i() {
|
||||
try {
|
||||
this.g.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@ -294,9 +304,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void h() {
|
||||
private void j() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
|
||||
Iterator iterator = this.g.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -313,18 +323,18 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void e(String s) {
|
||||
this.h.add(s.toLowerCase());
|
||||
this.j();
|
||||
this.l();
|
||||
}
|
||||
|
||||
public void f(String s) {
|
||||
this.h.remove(s.toLowerCase());
|
||||
this.j();
|
||||
this.l();
|
||||
}
|
||||
|
||||
private void i() {
|
||||
private void k() {
|
||||
try {
|
||||
this.h.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
@ -337,9 +347,9 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void j() {
|
||||
private void l() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
|
||||
Iterator iterator = this.h.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -354,11 +364,49 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void m() {
|
||||
try {
|
||||
this.i.clear();
|
||||
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
|
||||
String s = "";
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null) {
|
||||
this.i.add(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
bufferedreader.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning("Failed to load white-list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void n() {
|
||||
try {
|
||||
PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
|
||||
Iterator iterator = this.i.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
|
||||
printwriter.println(s);
|
||||
}
|
||||
|
||||
printwriter.close();
|
||||
} catch (Exception exception) {
|
||||
a.warning("Failed to save white-list: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean g(String s) {
|
||||
s = s.trim().toLowerCase();
|
||||
return !this.o || this.h.contains(s) || this.i.contains(s);
|
||||
}
|
||||
|
||||
public boolean h(String s) {
|
||||
return this.h.contains(s.trim().toLowerCase());
|
||||
}
|
||||
|
||||
public EntityPlayer h(String s) {
|
||||
public EntityPlayer i(String s) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
@ -371,7 +419,7 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void a(String s, String s1) {
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
EntityPlayer entityplayer = this.i(s);
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b((Packet) (new Packet3Chat(s1)));
|
||||
@ -391,20 +439,20 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void i(String s) {
|
||||
public void j(String s) {
|
||||
Packet3Chat packet3chat = new Packet3Chat(s);
|
||||
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (this.g(entityplayer.name)) {
|
||||
if (this.h(entityplayer.name)) {
|
||||
entityplayer.a.b((Packet) packet3chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(String s, Packet packet) {
|
||||
EntityPlayer entityplayer = this.h(s);
|
||||
EntityPlayer entityplayer = this.i(s);
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a.b(packet);
|
||||
@ -416,9 +464,27 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void d() {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
this.l.a((EntityPlayer) this.b.get(i));
|
||||
this.n.a((EntityHuman) this.b.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {}
|
||||
}
|
||||
|
||||
public void k(String s) {
|
||||
this.i.add(s);
|
||||
this.n();
|
||||
}
|
||||
|
||||
public void l(String s) {
|
||||
this.i.remove(s);
|
||||
this.n();
|
||||
}
|
||||
|
||||
public Set e() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
this.m();
|
||||
}
|
||||
}
|
@ -2,49 +2,49 @@ package net.minecraft.server;
|
||||
|
||||
public class Slot {
|
||||
|
||||
public final int a; // CraftBukkit: private -> public
|
||||
public final IInventory b; // CraftBukkit: private -> public
|
||||
public final int d; // CraftBukkit: private -> public
|
||||
public final IInventory e; // CraftBukkit: private -> public
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
|
||||
public Slot(IInventory iinventory, int i, int j, int k) {
|
||||
this.b = iinventory;
|
||||
this.a = i;
|
||||
this.d = j;
|
||||
this.e = k;
|
||||
this.e = iinventory;
|
||||
this.d = i;
|
||||
this.b = j;
|
||||
this.c = k;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.d();
|
||||
public void a() {
|
||||
this.c();
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack c() {
|
||||
return this.b.a(this.a);
|
||||
public ItemStack b() {
|
||||
return this.e.c_(this.d);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
this.b.a(this.a, itemstack);
|
||||
this.d();
|
||||
this.e.a(this.d, itemstack);
|
||||
this.c();
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.b.d();
|
||||
public void c() {
|
||||
this.e.h();
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.b.c();
|
||||
public int d() {
|
||||
return this.e.n_();
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.b.b(this.a, i);
|
||||
return this.e.a(this.d, i);
|
||||
}
|
||||
|
||||
public boolean a(IInventory iinventory, int i) {
|
||||
return iinventory == this.b && i == this.a;
|
||||
return iinventory == this.e && i == this.d;
|
||||
}
|
||||
}
|
||||
|
@ -2,40 +2,40 @@ package net.minecraft.server;
|
||||
|
||||
public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] e = new ItemStack[27]; //Craftbukkit
|
||||
private ItemStack[] a = new ItemStack[27]; //Craftbukkit
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return e;
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityChest() {}
|
||||
|
||||
public int h_() {
|
||||
return this.e.length; // Craftbukkit
|
||||
public int m_() {
|
||||
return 27;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.e[i];
|
||||
public ItemStack c_(int i) {
|
||||
return this.a[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.e[i] != null) {
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.e[i].count <= j) {
|
||||
itemstack = this.e[i];
|
||||
this.e[i] = null;
|
||||
this.d();
|
||||
if (this.a[i].count <= j) {
|
||||
itemstack = this.a[i];
|
||||
this.a[i] = null;
|
||||
this.h();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.e[i].a(j);
|
||||
if (this.e[i].count == 0) {
|
||||
this.e[i] = null;
|
||||
itemstack = this.a[i].a(j);
|
||||
if (this.a[i].count == 0) {
|
||||
this.a[i] = null;
|
||||
}
|
||||
|
||||
this.d();
|
||||
this.h();
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
@ -44,30 +44,30 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.e[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
this.a[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.n_()) {
|
||||
itemstack.count = this.n_();
|
||||
}
|
||||
|
||||
this.d();
|
||||
this.h();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Chest";
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
|
||||
this.e = new ItemStack[this.h_()];
|
||||
this.a = new ItemStack[this.m_()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.b("Slot") & 255;
|
||||
int j = nbttagcompound1.c("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.e.length) {
|
||||
this.e[j] = new ItemStack(nbttagcompound1);
|
||||
if (j >= 0 && j < this.a.length) {
|
||||
this.a[j] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,12 +76,12 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.e.length; ++i) {
|
||||
if (this.e[i] != null) {
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.e[i].a(nbttagcompound1);
|
||||
this.a[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@ -89,11 +89,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D;
|
||||
return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -1,120 +1,120 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] e = new ItemStack[9];
|
||||
private Random f = new Random();
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return e;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityDispenser() {}
|
||||
|
||||
public int h_() {
|
||||
return this.e.length; //Craftbukkit
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.e[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
if (this.e[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack e() {
|
||||
int i = -1;
|
||||
int j = 1;
|
||||
|
||||
for (int k = 0; k < this.e.length; ++k) {
|
||||
if (this.e[k] != null && this.f.nextInt(j) == 0) {
|
||||
i = k;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0) {
|
||||
return this.b(i, 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.e[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
}
|
||||
|
||||
this.d();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "Trap";
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
|
||||
this.e = new ItemStack[this.h_()];
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.e.length; ++i) {
|
||||
if (this.e[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.e[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] a = new ItemStack[9];
|
||||
private Random b = new Random();
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityDispenser() {}
|
||||
|
||||
public int m_() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
public ItemStack c_(int i) {
|
||||
return this.a[i];
|
||||
}
|
||||
|
||||
public ItemStack a(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.h();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.a[i].a(j);
|
||||
if (this.a[i].count == 0) {
|
||||
this.a[i] = null;
|
||||
}
|
||||
|
||||
this.h();
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack b() {
|
||||
int i = -1;
|
||||
int j = 1;
|
||||
|
||||
for (int k = 0; k < this.a.length; ++k) {
|
||||
if (this.a[k] != null && this.b.nextInt(j) == 0) {
|
||||
i = k;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0) {
|
||||
return this.a(i, 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.a[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.n_()) {
|
||||
itemstack.count = this.n_();
|
||||
}
|
||||
|
||||
this.h();
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return "Trap";
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
|
||||
this.a = new ItemStack[this.m_()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.c("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.a.length) {
|
||||
this.a[j] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.a[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package net.minecraft.server;
|
||||
public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] h = new ItemStack[3];
|
||||
public int e = 0;
|
||||
public int f = 0;
|
||||
public int g = 0;
|
||||
public int a = 0;
|
||||
public int b = 0;
|
||||
public int c = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
@ -15,15 +15,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
public TileEntityFurnace() {}
|
||||
|
||||
public int h_() {
|
||||
public int m_() {
|
||||
return this.h.length;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack c_(int i) {
|
||||
return this.h[i];
|
||||
}
|
||||
|
||||
public ItemStack b(int i, int j) {
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.h[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -46,39 +46,39 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.h[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.c()) {
|
||||
itemstack.count = this.c();
|
||||
if (itemstack != null && itemstack.count > this.n_()) {
|
||||
itemstack.count = this.n_();
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
public String c() {
|
||||
return "Furnace";
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.k("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
|
||||
this.h = new ItemStack[this.h_()];
|
||||
this.h = new ItemStack[this.m_()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.b(); ++i) {
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
byte b0 = nbttagcompound1.b("Slot");
|
||||
byte b0 = nbttagcompound1.c("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.h.length) {
|
||||
this.h[b0] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.e = nbttagcompound.c("BurnTime");
|
||||
this.g = nbttagcompound.c("CookTime");
|
||||
this.f = this.a(this.h[1]);
|
||||
this.a = nbttagcompound.d("BurnTime");
|
||||
this.c = nbttagcompound.d("CookTime");
|
||||
this.b = this.a(this.h[1]);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("BurnTime", (short) this.e);
|
||||
nbttagcompound.a("CookTime", (short) this.g);
|
||||
nbttagcompound.a("BurnTime", (short) this.a);
|
||||
nbttagcompound.a("CookTime", (short) this.c);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.h.length; ++i) {
|
||||
@ -94,26 +94,26 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int n_() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
return this.e > 0;
|
||||
public boolean f() {
|
||||
return this.a > 0;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
boolean flag = this.e > 0;
|
||||
public void i_() {
|
||||
boolean flag = this.a > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
}
|
||||
|
||||
if (!this.a.isStatic) {
|
||||
if (this.e == 0 && this.i()) {
|
||||
this.f = this.e = this.a(this.h[1]);
|
||||
if (this.e > 0) {
|
||||
if (!this.d.isStatic) {
|
||||
if (this.a == 0 && this.i()) {
|
||||
this.b = this.a = this.a(this.h[1]);
|
||||
if (this.a > 0) {
|
||||
flag1 = true;
|
||||
if (this.h[1] != null) {
|
||||
--this.h[1].count;
|
||||
@ -124,25 +124,25 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.e() && this.i()) {
|
||||
++this.g;
|
||||
if (this.g == 200) {
|
||||
this.g = 0;
|
||||
this.h();
|
||||
if (this.f() && this.i()) {
|
||||
++this.c;
|
||||
if (this.c == 200) {
|
||||
this.c = 0;
|
||||
this.g();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
this.g = 0;
|
||||
this.c = 0;
|
||||
}
|
||||
|
||||
if (flag != this.e > 0) {
|
||||
if (flag != this.a > 0) {
|
||||
flag1 = true;
|
||||
BlockFurnace.a(this.e > 0, this.a, this.b, this.c, this.d);
|
||||
BlockFurnace.a(this.a > 0, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
this.d();
|
||||
this.h();
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,11 +152,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
} else {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
|
||||
|
||||
return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.c() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b())));
|
||||
return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.n_() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b())));
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void g() {
|
||||
if (this.i()) {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id);
|
||||
|
||||
@ -184,6 +184,6 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D;
|
||||
return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,13 @@ package net.minecraft.server;
|
||||
|
||||
public class TileEntityMobSpawner extends TileEntity {
|
||||
|
||||
public int e = -1;
|
||||
public int a = -1;
|
||||
public String h = "Pig"; // CraftBukkit private -> public
|
||||
public double f;
|
||||
public double g = 0.0D;
|
||||
public double b;
|
||||
public double c = 0.0D;
|
||||
|
||||
public TileEntityMobSpawner() {
|
||||
this.e = 20;
|
||||
this.a = 20;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
@ -16,34 +16,34 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.a.a((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D, 16.0D) != null;
|
||||
return this.d.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null;
|
||||
}
|
||||
|
||||
public void f() {
|
||||
this.g = this.f;
|
||||
public void i_() {
|
||||
this.c = this.b;
|
||||
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());
|
||||
double d0 = (double) ((float) this.e + this.d.k.nextFloat());
|
||||
double d1 = (double) ((float) this.f + this.d.k.nextFloat());
|
||||
double d2 = (double) ((float) this.g + this.d.k.nextFloat());
|
||||
|
||||
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);
|
||||
this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
for (this.f += (double) (1000.0F / ((float) this.e + 200.0F)); this.f > 360.0D; this.g -= 360.0D) {
|
||||
this.f -= 360.0D;
|
||||
for (this.b += (double) (1000.0F / ((float) this.a + 200.0F)); this.b > 360.0D; this.c -= 360.0D) {
|
||||
this.b -= 360.0D;
|
||||
}
|
||||
|
||||
if (this.e == -1) {
|
||||
this.b();
|
||||
if (this.a == -1) {
|
||||
this.c();
|
||||
}
|
||||
|
||||
if (this.e > 0) {
|
||||
--this.e;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
} else {
|
||||
byte b0 = 4;
|
||||
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.a));
|
||||
EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.h, this.d));
|
||||
|
||||
if (entityliving == null) {
|
||||
return;
|
||||
@ -51,59 +51,59 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
|
||||
// CraftBukkit start - The world we're spawning in accepts this creature
|
||||
boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal;
|
||||
if ((isAnimal && !this.a.L) || (!isAnimal && !this.a.K)) {
|
||||
if ((isAnimal && !this.d.E) || (!isAnimal && !this.d.D)) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
int j = this.d.a(entityliving.getClass(), AxisAlignedBB.b((double) this.e, (double) this.f, (double) this.g, (double) (this.e + 1), (double) (this.f + 1), (double) (this.g + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
|
||||
if (j >= 6) {
|
||||
this.b();
|
||||
this.c();
|
||||
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;
|
||||
double d3 = (double) this.e + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
|
||||
double d4 = (double) (this.f + this.d.k.nextInt(3) - 1);
|
||||
double d5 = (double) this.g + (this.d.k.nextDouble() - this.d.k.nextDouble()) * 4.0D;
|
||||
|
||||
entityliving.c(d3, d4, d5, this.a.l.nextFloat() * 360.0F, 0.0F);
|
||||
entityliving.c(d3, d4, d5, this.d.k.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving.b()) {
|
||||
this.a.a((Entity) entityliving);
|
||||
this.d.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);
|
||||
d0 = (double) this.e + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
|
||||
d1 = (double) this.f + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
|
||||
d2 = (double) this.g + 0.5D + ((double) this.d.k.nextFloat() - 0.5D) * 2.0D;
|
||||
this.d.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.d.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
entityliving.R();
|
||||
this.b();
|
||||
entityliving.I();
|
||||
this.c();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.f();
|
||||
super.i_();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b() {
|
||||
this.e = 200 + this.a.l.nextInt(600);
|
||||
private void c() {
|
||||
this.a = 200 + this.d.k.nextInt(600);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.h = nbttagcompound.h("EntityId");
|
||||
this.e = nbttagcompound.c("Delay");
|
||||
this.h = nbttagcompound.i("EntityId");
|
||||
this.a = nbttagcompound.d("Delay");
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("EntityId", this.h);
|
||||
nbttagcompound.a("Delay", (short) this.e);
|
||||
nbttagcompound.a("Delay", (short) this.a);
|
||||
}
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
147
src/main/java/net/minecraft/server/WorldData.java
Normale Datei
147
src/main/java/net/minecraft/server/WorldData.java
Normale Datei
@ -0,0 +1,147 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WorldData {
|
||||
|
||||
private long a;
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private long e;
|
||||
private long f;
|
||||
private long g;
|
||||
private NBTTagCompound h;
|
||||
private int i;
|
||||
public String j; // CraftBukkit private->public
|
||||
private int k;
|
||||
|
||||
public WorldData(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.f("RandomSeed");
|
||||
this.b = nbttagcompound.e("SpawnX");
|
||||
this.c = nbttagcompound.e("SpawnY");
|
||||
this.d = nbttagcompound.e("SpawnZ");
|
||||
this.e = nbttagcompound.f("Time");
|
||||
this.f = nbttagcompound.f("LastPlayed");
|
||||
this.g = nbttagcompound.f("SizeOnDisk");
|
||||
this.j = nbttagcompound.i("LevelName");
|
||||
this.k = nbttagcompound.e("version");
|
||||
if (nbttagcompound.b("Player")) {
|
||||
this.h = nbttagcompound.k("Player");
|
||||
this.i = this.h.e("Dimension");
|
||||
}
|
||||
}
|
||||
|
||||
public WorldData(long i, String s) {
|
||||
this.a = i;
|
||||
this.j = s;
|
||||
}
|
||||
|
||||
public WorldData(WorldData worlddata) {
|
||||
this.a = worlddata.a;
|
||||
this.b = worlddata.b;
|
||||
this.c = worlddata.c;
|
||||
this.d = worlddata.d;
|
||||
this.e = worlddata.e;
|
||||
this.f = worlddata.f;
|
||||
this.g = worlddata.g;
|
||||
this.h = worlddata.h;
|
||||
this.i = worlddata.i;
|
||||
this.j = worlddata.j;
|
||||
this.k = worlddata.k;
|
||||
}
|
||||
|
||||
public NBTTagCompound a() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
this.a(nbttagcompound, this.h);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public NBTTagCompound a(List list) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
EntityHuman entityhuman = null;
|
||||
NBTTagCompound nbttagcompound1 = null;
|
||||
|
||||
if (list.size() > 0) {
|
||||
entityhuman = (EntityHuman) list.get(0);
|
||||
}
|
||||
|
||||
if (entityhuman != null) {
|
||||
nbttagcompound1 = new NBTTagCompound();
|
||||
entityhuman.d(nbttagcompound1);
|
||||
}
|
||||
|
||||
this.a(nbttagcompound, nbttagcompound1);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
||||
nbttagcompound.a("RandomSeed", this.a);
|
||||
nbttagcompound.a("SpawnX", this.b);
|
||||
nbttagcompound.a("SpawnY", this.c);
|
||||
nbttagcompound.a("SpawnZ", this.d);
|
||||
nbttagcompound.a("Time", this.e);
|
||||
nbttagcompound.a("SizeOnDisk", this.g);
|
||||
nbttagcompound.a("LastPlayed", System.currentTimeMillis());
|
||||
nbttagcompound.a("LevelName", this.j);
|
||||
nbttagcompound.a("version", this.k);
|
||||
if (nbttagcompound1 != null) {
|
||||
nbttagcompound.a("Player", nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
public long b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public long f() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public long g() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public int h() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public void a(long i) {
|
||||
this.e = i;
|
||||
}
|
||||
|
||||
public void b(long i) {
|
||||
this.g = i;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
this.d = k;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
this.j = s;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.k = i;
|
||||
}
|
||||
}
|
@ -1,100 +1,100 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
// CraftBukkit end
|
||||
|
||||
public class WorldGenTrees extends WorldGenerator {
|
||||
|
||||
public WorldGenTrees() {}
|
||||
|
||||
public boolean a(World world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
// sk: The idea is to have (our) WorldServer implement
|
||||
// BlockChangeDelegate and then we can implicitly cast World to
|
||||
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
|
||||
// then allows plugins to catch manually-invoked generation events
|
||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||
}
|
||||
|
||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit end
|
||||
int l = random.nextInt(3) + 4;
|
||||
boolean flag = true;
|
||||
|
||||
if (j >= 1 && j + l + 1 <= 128) {
|
||||
int i1;
|
||||
int j1;
|
||||
int k1;
|
||||
int l1;
|
||||
|
||||
for (i1 = j; i1 <= j + 1 + l; ++i1) {
|
||||
byte b0 = 1;
|
||||
|
||||
if (i1 == j) {
|
||||
b0 = 0;
|
||||
}
|
||||
|
||||
if (i1 >= j + 1 + l - 2) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
|
||||
for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
|
||||
if (i1 >= 0 && i1 < 128) {
|
||||
l1 = world.getTypeId(j1, i1, k1);
|
||||
if (l1 != 0 && l1 != Block.LEAVES.id) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
return false;
|
||||
} else {
|
||||
i1 = world.getTypeId(i, j - 1, k);
|
||||
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
|
||||
world.setTypeId(i, j - 1, k, Block.DIRT.id);
|
||||
|
||||
int i2;
|
||||
|
||||
for (i2 = j - 3 + l; i2 <= j + l; ++i2) {
|
||||
j1 = i2 - (j + l);
|
||||
k1 = 1 - j1 / 2;
|
||||
|
||||
for (l1 = i - k1; l1 <= i + k1; ++l1) {
|
||||
int j2 = l1 - i;
|
||||
|
||||
for (int k2 = k - k1; k2 <= k + k1; ++k2) {
|
||||
int l2 = k2 - k;
|
||||
|
||||
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
|
||||
world.setTypeId(l1, i2, k2, Block.LEAVES.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i2 = 0; i2 < l; ++i2) {
|
||||
j1 = world.getTypeId(i, j + i2, k);
|
||||
if (j1 == 0 || j1 == Block.LEAVES.id) {
|
||||
world.setTypeId(i, j + i2, k, Block.LOG.id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
// CraftBukkit end
|
||||
|
||||
public class WorldGenTrees extends WorldGenerator {
|
||||
|
||||
public WorldGenTrees() {}
|
||||
|
||||
public boolean a(World world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
// sk: The idea is to have (our) WorldServer implement
|
||||
// BlockChangeDelegate and then we can implicitly cast World to
|
||||
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
|
||||
// then allows plugins to catch manually-invoked generation events
|
||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||
}
|
||||
|
||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit end
|
||||
int l = random.nextInt(3) + 4;
|
||||
boolean flag = true;
|
||||
|
||||
if (j >= 1 && j + l + 1 <= 128) {
|
||||
int i1;
|
||||
int j1;
|
||||
int k1;
|
||||
int l1;
|
||||
|
||||
for (i1 = j; i1 <= j + 1 + l; ++i1) {
|
||||
byte b0 = 1;
|
||||
|
||||
if (i1 == j) {
|
||||
b0 = 0;
|
||||
}
|
||||
|
||||
if (i1 >= j + 1 + l - 2) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
|
||||
for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
|
||||
if (i1 >= 0 && i1 < 128) {
|
||||
l1 = world.getTypeId(j1, i1, k1);
|
||||
if (l1 != 0 && l1 != Block.LEAVES.id) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
return false;
|
||||
} else {
|
||||
i1 = world.getTypeId(i, j - 1, k);
|
||||
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
|
||||
world.setTypeId(i, j - 1, k, Block.DIRT.id);
|
||||
|
||||
int i2;
|
||||
|
||||
for (i2 = j - 3 + l; i2 <= j + l; ++i2) {
|
||||
j1 = i2 - (j + l);
|
||||
k1 = 1 - j1 / 2;
|
||||
|
||||
for (l1 = i - k1; l1 <= i + k1; ++l1) {
|
||||
int j2 = l1 - i;
|
||||
|
||||
for (int k2 = k - k1; k2 <= k + k1; ++k2) {
|
||||
int l2 = k2 - k;
|
||||
|
||||
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
|
||||
world.setTypeId(l1, i2, k2, Block.LEAVES.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i2 = 0; i2 < l; ++i2) {
|
||||
j1 = world.getTypeId(i, j + i2, k);
|
||||
if (j1 == 0 || j1 == Block.LEAVES.id) {
|
||||
world.setTypeId(i, j + i2, k, Block.LOG.id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,16 @@ import org.bukkit.craftbukkit.CraftWorld;
|
||||
public class WorldServer extends World implements BlockChangeDelegate {
|
||||
// CraftBukkit end
|
||||
|
||||
public ChunkProviderServer A;
|
||||
public boolean B = false;
|
||||
public boolean C;
|
||||
public final MinecraftServer D; // Craftbukkit
|
||||
private EntityList E = new EntityList();
|
||||
public ChunkProviderServer u;
|
||||
public boolean v = false;
|
||||
public boolean w;
|
||||
public final MinecraftServer x; // Craftbukkit - private -> public final
|
||||
private EntityList y = new EntityList();
|
||||
public PlayerManager manager; // Craftbukkit
|
||||
|
||||
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) {
|
||||
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i));
|
||||
this.D = minecraftserver;
|
||||
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) {
|
||||
super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i));
|
||||
this.x = minecraftserver;
|
||||
|
||||
// CraftBukkit start
|
||||
this.server = minecraftserver.server;
|
||||
@ -42,14 +42,10 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void f() {
|
||||
super.f();
|
||||
}
|
||||
|
||||
public void a(Entity entity, boolean flag) {
|
||||
// CraftBukkit start -- We prevent spawning in general, so this butching is not needed
|
||||
//if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
// entity.q();
|
||||
// CraftBukkit start -- We prevent spawning in general, so this butchering is not needed
|
||||
//if (!this.x.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
// entity.C();
|
||||
//}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -62,9 +58,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
super.a(entity, flag);
|
||||
}
|
||||
|
||||
protected IChunkProvider a(File file1) {
|
||||
this.A = new ChunkProviderServer(this, this.q.a(file1), this.q.c());
|
||||
return this.A;
|
||||
protected IChunkProvider b() {
|
||||
IChunkLoader ichunkloader = this.p.a(this.m);
|
||||
|
||||
this.u = new ChunkProviderServer(this, ichunkloader, this.m.c());
|
||||
return this.u;
|
||||
}
|
||||
|
||||
public List d(int i, int j, int k, int l, int i1, int j1) {
|
||||
@ -73,7 +71,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
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) {
|
||||
if (tileentity.e >= i && tileentity.f >= j && tileentity.g >= k && tileentity.e < l && tileentity.f < i1 && tileentity.g < j1) {
|
||||
arraylist.add(tileentity);
|
||||
}
|
||||
}
|
||||
@ -82,34 +80,34 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
|
||||
int l = (int) MathHelper.e((float) (i - this.spawnX));
|
||||
int i1 = (int) MathHelper.e((float) (k - this.spawnZ));
|
||||
int l = (int) MathHelper.e((float) (i - this.q.c()));
|
||||
int i1 = (int) MathHelper.e((float) (k - this.q.e()));
|
||||
|
||||
if (l > i1) {
|
||||
i1 = l;
|
||||
}
|
||||
|
||||
return i1 > this.D.spawnProtection || this.D.f.g(entityhuman.name); // CraftBukkit Configurable spawn protection start
|
||||
return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name); // CraftBukkit Configurable spawn protection start
|
||||
}
|
||||
|
||||
protected void b(Entity entity) {
|
||||
super.b(entity);
|
||||
this.E.a(entity.id, entity);
|
||||
this.y.a(entity.id, entity);
|
||||
}
|
||||
|
||||
protected void c(Entity entity) {
|
||||
super.c(entity);
|
||||
this.E.d(entity.id);
|
||||
this.y.d(entity.id);
|
||||
}
|
||||
|
||||
public Entity a(int i) {
|
||||
return (Entity) this.E.a(i);
|
||||
return (Entity) this.y.a(i);
|
||||
}
|
||||
|
||||
public void a(Entity entity, byte b0) {
|
||||
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
|
||||
|
||||
this.D.k.b(entity, packet38entitystatus);
|
||||
this.x.k.b(entity, packet38entitystatus);
|
||||
}
|
||||
|
||||
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
||||
@ -121,12 +119,16 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
||||
this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
||||
return explosion;
|
||||
}
|
||||
|
||||
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));
|
||||
public void d(int i, int j, int k, int l, int i1) {
|
||||
super.d(i, j, k, l, i1);
|
||||
this.x.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
|
||||
}
|
||||
|
||||
public void r() {
|
||||
this.p.e();
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.server.ChunkCoordinates;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PropertyManager;
|
||||
import net.minecraft.server.ServerConfigurationManager;
|
||||
import net.minecraft.server.ServerNBTManager;
|
||||
import net.minecraft.server.WorldManager;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.*;
|
||||
@ -177,14 +179,14 @@ public final class CraftServer implements Server {
|
||||
console.d = config;
|
||||
|
||||
boolean animals = config.a("spawn-monsters", console.m);
|
||||
boolean monsters = config.a("spawn-monsters", console.worlds.get(0).k > 0);
|
||||
boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0);
|
||||
|
||||
console.l = config.a("online-mode", console.l);
|
||||
console.m = config.a("spawn-animals", console.m);
|
||||
console.n = config.a("pvp", console.n);
|
||||
|
||||
for (WorldServer world : console.worlds) {
|
||||
world.k = monsters ? 1 : 0;
|
||||
world.j = monsters ? 1 : 0;
|
||||
world.a(monsters, animals);
|
||||
}
|
||||
|
||||
@ -210,10 +212,10 @@ public final class CraftServer implements Server {
|
||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
||||
}
|
||||
|
||||
WorldServer internal = new WorldServer(console, new File("."), name, environment == World.Environment.NETHER ? -1 : 0);
|
||||
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0);
|
||||
|
||||
internal.a(new WorldManager(console, internal));
|
||||
internal.k = 1;
|
||||
internal.j = 1;
|
||||
internal.a(true, true);
|
||||
console.f.a(internal);
|
||||
console.worlds.add(internal);
|
||||
@ -236,9 +238,10 @@ public final class CraftServer implements Server {
|
||||
i = l;
|
||||
}
|
||||
|
||||
internal.A.d(internal.spawnX + j >> 4, internal.spawnZ + k >> 4);
|
||||
ChunkCoordinates chunkcoordinates = internal.l();
|
||||
internal.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
|
||||
|
||||
while (internal.d()) {
|
||||
while (internal.e()) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ public class CraftWorld implements World {
|
||||
public CraftWorld(WorldServer world) {
|
||||
this.world = world;
|
||||
this.server = world.getServer();
|
||||
this.provider = world.A;
|
||||
this.provider = world.u;
|
||||
|
||||
if (world.q instanceof WorldProviderHell) {
|
||||
if (world.m instanceof WorldProviderHell) {
|
||||
environment = Environment.NETHER;
|
||||
} else {
|
||||
environment = Environment.NORMAL;
|
||||
@ -65,7 +65,8 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public Location getSpawnLocation() {
|
||||
return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ);
|
||||
ChunkCoordinates spawn = world.l();
|
||||
return new Location(this, spawn.a, world.e(spawn.a, spawn.c), spawn.c);
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
@ -225,9 +226,9 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
|
||||
double xs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
double ys = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
double zs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
double ys = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
double zs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||
loc = loc.clone();
|
||||
loc.setX(loc.getX() + xs);
|
||||
loc.setY(loc.getY() + ys);
|
||||
@ -324,11 +325,11 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return world.w;
|
||||
return world.q.j;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return world.u;
|
||||
return world.q.b();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -349,11 +350,11 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public long getFullTime() {
|
||||
return world.e;
|
||||
return world.k();
|
||||
}
|
||||
|
||||
public void setFullTime(long time) {
|
||||
world.e = time;
|
||||
world.a(time);
|
||||
}
|
||||
|
||||
public Environment getEnvironment() {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -349,7 +348,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean isBlockFacePowered(BlockFace face) {
|
||||
return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face));
|
||||
return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face));
|
||||
}
|
||||
|
||||
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
|
||||
|
80
src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
Normale Datei → Ausführbare Datei
80
src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
Normale Datei → Ausführbare Datei
@ -1,40 +1,40 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityChest;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a chest.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftChest extends CraftBlockState implements Chest {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityChest chest;
|
||||
|
||||
public CraftChest(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(chest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
chest.d();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityChest;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a chest.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftChest extends CraftBlockState implements Chest {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityChest chest;
|
||||
|
||||
public CraftChest(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(chest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
chest.h();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,84 +1,84 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityMobSpawner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.MobSpawner;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.MobType;
|
||||
|
||||
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityMobSpawner spawner;
|
||||
|
||||
public CraftCreatureSpawner(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public CreatureType getCreatureType() {
|
||||
return CreatureType.fromName(spawner.h);
|
||||
}
|
||||
|
||||
public void setCreatureType(CreatureType creatureType) {
|
||||
spawner.h = creatureType.getName();
|
||||
}
|
||||
|
||||
public String getCreatureTypeId() {
|
||||
return spawner.h;
|
||||
}
|
||||
|
||||
public void setCreatureTypeId(String creatureType) {
|
||||
// Verify input
|
||||
CreatureType type = CreatureType.fromName(creatureType);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
spawner.h = type.getName();
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return spawner.e;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
spawner.e = delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getCreatureType() instead.
|
||||
*/
|
||||
public MobType getMobType() {
|
||||
return MobType.fromName(spawner.h);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use setCreatureType() instead.
|
||||
*/
|
||||
public void setMobType(MobType mobType) {
|
||||
spawner.h = mobType.getName();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getCreatureTypeId() instead.
|
||||
*/
|
||||
public String getMobTypeId() {
|
||||
return spawner.h;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use setCreatureTypeId() instead.
|
||||
*/
|
||||
public void setMobTypeId(String mobType) {
|
||||
// Verify input
|
||||
MobType type = MobType.fromName(mobType);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
spawner.h = type.getName();
|
||||
}
|
||||
}
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityMobSpawner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.MobSpawner;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.MobType;
|
||||
|
||||
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner, MobSpawner {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityMobSpawner spawner;
|
||||
|
||||
public CraftCreatureSpawner(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public CreatureType getCreatureType() {
|
||||
return CreatureType.fromName(spawner.h);
|
||||
}
|
||||
|
||||
public void setCreatureType(CreatureType creatureType) {
|
||||
spawner.h = creatureType.getName();
|
||||
}
|
||||
|
||||
public String getCreatureTypeId() {
|
||||
return spawner.h;
|
||||
}
|
||||
|
||||
public void setCreatureTypeId(String creatureType) {
|
||||
// Verify input
|
||||
CreatureType type = CreatureType.fromName(creatureType);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
spawner.h = type.getName();
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return spawner.a;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
spawner.a = delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getCreatureType() instead.
|
||||
*/
|
||||
public MobType getMobType() {
|
||||
return MobType.fromName(spawner.h);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use setCreatureType() instead.
|
||||
*/
|
||||
public void setMobType(MobType mobType) {
|
||||
spawner.h = mobType.getName();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getCreatureTypeId() instead.
|
||||
*/
|
||||
public String getMobTypeId() {
|
||||
return spawner.h;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use setCreatureTypeId() instead.
|
||||
*/
|
||||
public void setMobTypeId(String mobType) {
|
||||
// Verify input
|
||||
MobType type = MobType.fromName(mobType);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
spawner.h = type.getName();
|
||||
}
|
||||
}
|
||||
|
2
src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
Normale Datei → Ausführbare Datei
2
src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
Normale Datei → Ausführbare Datei
@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
dispenser.d();
|
||||
dispenser.h();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
112
src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
Normale Datei → Ausführbare Datei
112
src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
Normale Datei → Ausführbare Datei
@ -1,56 +1,56 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityFurnace;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a furnace.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityFurnace furnace;
|
||||
|
||||
public CraftFurnace(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(furnace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
furnace.d();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public short getBurnTime() {
|
||||
return (short)furnace.e;
|
||||
}
|
||||
|
||||
public void setBurnTime(short burnTime) {
|
||||
furnace.e = burnTime;
|
||||
}
|
||||
|
||||
public short getCookTime() {
|
||||
return (short)furnace.g;
|
||||
}
|
||||
|
||||
public void setCookTime(short cookTime) {
|
||||
furnace.g = cookTime;
|
||||
}
|
||||
}
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityFurnace;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a furnace.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityFurnace furnace;
|
||||
|
||||
public CraftFurnace(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld)block.getWorld();
|
||||
furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(furnace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force) {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
furnace.h();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public short getBurnTime() {
|
||||
return (short)furnace.a;
|
||||
}
|
||||
|
||||
public void setBurnTime(short burnTime) {
|
||||
furnace.a = burnTime;
|
||||
}
|
||||
|
||||
public short getCookTime() {
|
||||
return (short)furnace.c;
|
||||
}
|
||||
|
||||
public void setCookTime(short cookTime) {
|
||||
furnace.c = cookTime;
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
}
|
||||
|
||||
public byte getNote() {
|
||||
return note.e;
|
||||
return note.a;
|
||||
}
|
||||
|
||||
public void setNote(byte n) {
|
||||
note.e = n;
|
||||
note.a = n;
|
||||
}
|
||||
|
||||
public boolean play() {
|
||||
|
9
src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
Normale Datei → Ausführbare Datei
9
src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
Normale Datei → Ausführbare Datei
@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntitySign;
|
||||
@ -18,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign {
|
||||
}
|
||||
|
||||
public String[] getLines() {
|
||||
return sign.e;
|
||||
return sign.a;
|
||||
}
|
||||
|
||||
public String getLine(int index) throws IndexOutOfBoundsException {
|
||||
return sign.e[index];
|
||||
return sign.a[index];
|
||||
}
|
||||
|
||||
public void setLine(int index, String line) throws IndexOutOfBoundsException {
|
||||
sign.e[index] = line;
|
||||
sign.a[index] = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
sign.d();
|
||||
sign.h();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -160,7 +160,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
newEntity.inventory.e = newEntity;
|
||||
newEntity.activeContainer = entity.activeContainer;
|
||||
newEntity.defaultContainer = entity.defaultContainer;
|
||||
newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||
newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||
|
||||
newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
newWorld.manager.a(newEntity);
|
||||
|
4
src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
Normale Datei → Ausführbare Datei
4
src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
Normale Datei → Ausführbare Datei
@ -19,12 +19,12 @@ public class CraftSheep extends CraftAnimals implements Sheep {
|
||||
|
||||
public DyeColor getColor() {
|
||||
EntitySheep entity = (EntitySheep) getHandle();
|
||||
return DyeColor.getByData((byte) entity.e_());
|
||||
return DyeColor.getByData((byte) entity.n());
|
||||
}
|
||||
|
||||
public void setColor(DyeColor color) {
|
||||
EntitySheep entity = (EntitySheep) getHandle();
|
||||
entity.a(color.getData());
|
||||
entity.a_(color.getData());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,15 +19,15 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return getInventory().h_();
|
||||
return getInventory().m_();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getInventory().b();
|
||||
return getInventory().c();
|
||||
}
|
||||
|
||||
public CraftItemStack getItem(int index) {
|
||||
return new CraftItemStack(getInventory().a(index));
|
||||
return new CraftItemStack(getInventory().c_(index));
|
||||
}
|
||||
|
||||
public CraftItemStack[] getContents() {
|
||||
@ -290,7 +290,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||
}
|
||||
|
||||
private int getMaxItemStack() {
|
||||
return getInventory().c();
|
||||
return getInventory().n_();
|
||||
}
|
||||
|
||||
public void remove(int materialId) {
|
||||
|
2
src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
Normale Datei → Ausführbare Datei
2
src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
Normale Datei → Ausführbare Datei
@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
|
||||
}
|
||||
|
||||
public CraftItemStack getItemInHand() {
|
||||
return new CraftItemStack( getInventory().e() );
|
||||
return new CraftItemStack( getInventory().b() );
|
||||
}
|
||||
|
||||
public void setItemInHand(ItemStack stack) {
|
||||
|
@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory( slot.b );
|
||||
return new CraftInventory( slot.e );
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return slot.a;
|
||||
return slot.d;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return new CraftItemStack( slot.c() );
|
||||
return new CraftItemStack( slot.b() );
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren