Port to new mc-dev format.

This commit is contained in:
Erik Broes
2011-01-29 22:50:29 +01:00
parent d0cd8c6cc7
commit df69047324
96 changed files with 8809 additions and 9406 deletions

View File

@@ -1,122 +1,122 @@
package net.minecraft.server;
import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftGhast;
// CraftBukkit end
public class EntityGhast extends EntityFlying implements IMobs {
public class EntityGhast extends EntityFlying implements IMonster {
public int a;
public int a = 0;
public double b;
public double c;
public double d;
private Entity ak;
private int al;
public int e;
public int f;
private Entity ak = null;
private int al = 0;
public int e = 0;
public int f = 0;
public EntityGhast(World world) {
super(world);
a = 0;
ak = null;
al = 0;
e = 0;
f = 0;
aP = "/mob/ghast.png";
a(4F, 4F);
ae = true;
this.texture = "/mob/ghast.png";
this.a(4.0F, 4.0F);
this.ae = true;
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
CraftServer server = ((WorldServer) this.world).getServer();
this.bukkitEntity = new CraftGhast(server, this);
// CraftBukkit end
}
protected void d() {
if (l.k == 0) {
q();
if (this.world.k == 0) {
this.q();
}
e = f;
double d1 = b - p;
double d2 = c - q;
double d3 = d - r;
double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3);
if (d4 < 1.0D || d4 > 60D) {
b = p + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
c = q + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
d = r + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F);
this.e = this.f;
double d0 = this.b - this.locX;
double d1 = this.c - this.locY;
double d2 = this.d - this.locZ;
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
if (d3 < 1.0D || d3 > 60.0D) {
this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.c = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.d = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
}
if (a-- <= 0) {
a += W.nextInt(5) + 2;
if (a(b, c, d, d4)) {
s += (d1 / d4) * 0.10000000000000001D;
t += (d2 / d4) * 0.10000000000000001D;
u += (d3 / d4) * 0.10000000000000001D;
if (this.a-- <= 0) {
this.a += this.random.nextInt(5) + 2;
if (this.a(this.b, this.c, this.d, d3)) {
this.motX += d0 / d3 * 0.1D;
this.motY += d1 / d3 * 0.1D;
this.motZ += d2 / d3 * 0.1D;
} else {
b = p;
c = q;
d = r;
this.b = this.locX;
this.c = this.locY;
this.d = this.locZ;
}
}
if (ak != null && ak.G) {
ak = null;
if (this.ak != null && this.ak.dead) {
this.ak = null;
}
if (ak == null || al-- <= 0) {
ak = ((Entity) (l.a(((Entity) (this)), 100D)));
if (ak != null) {
al = 20;
if (this.ak == null || this.al-- <= 0) {
this.ak = this.world.a(this, 100.0D);
if (this.ak != null) {
this.al = 20;
}
}
double d5 = 64D;
if (ak != null && ak.b(((Entity) (this))) < d5 * d5) {
double d6 = ak.p - p;
double d7 = (ak.z.b + (double) (ak.J / 2.0F)) - (q + (double) (J / 2.0F));
double d8 = ak.r - r;
double d4 = 64.0D;
aI = v = (-(float) Math.atan2(d6, d8) * 180F) / 3.141593F;
if (i(ak)) {
if (f == 10) {
l.a(((Entity) (this)), "mob.ghast.charge", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
if (this.ak != null && this.ak.b((Entity) this) < d4 * d4) {
double d5 = this.ak.locX - this.locX;
double d6 = this.ak.boundingBox.b + (double) (this.ak.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
double d7 = this.ak.locZ - this.locZ;
this.aI = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.i(this.ak)) {
if (this.f == 10) {
this.world.a(this, "mob.ghast.charge", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
f++;
if (f == 20) {
l.a(((Entity) (this)), "mob.ghast.fireball", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F);
EntityFireball entityfireball = new EntityFireball(l, ((EntityLiving) (this)), d6, d7, d8);
double d9 = 4D;
Vec3D vec3d = c(1.0F);
entityfireball.p = p + vec3d.a * d9;
entityfireball.q = q + (double) (J / 2.0F) + 0.5D;
entityfireball.r = r + vec3d.c * d9;
l.a(((Entity) (entityfireball)));
f = -40;
++this.f;
if (this.f == 20) {
this.world.a(this, "mob.ghast.fireball", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D;
Vec3D vec3d = this.c(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D;
entityfireball.locZ = this.locZ + vec3d.c * d8;
this.world.a((Entity) entityfireball);
this.f = -40;
}
} else if (f > 0) {
f--;
} else if (this.f > 0) {
--this.f;
}
} else {
aI = v = (-(float) Math.atan2(s, u) * 180F) / 3.141593F;
if (f > 0) {
f--;
this.aI = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.f > 0) {
--this.f;
}
}
aP = f <= 10 ? "/mob/ghast.png" : "/mob/ghast_fire.png";
this.texture = this.f > 10 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
}
private boolean a(double d1, double d2, double d3, double d4) {
double d5 = (b - p) / d4;
double d6 = (c - q) / d4;
double d7 = (d - r) / d4;
AxisAlignedBB axisalignedbb = z.b();
private boolean a(double d0, double d1, double d2, double d3) {
double d4 = (this.b - this.locX) / d3;
double d5 = (this.c - this.locY) / d3;
double d6 = (this.d - this.locZ) / d3;
AxisAlignedBB axisalignedbb = this.boundingBox.b();
for (int k = 1; (double) k < d4; k++) {
axisalignedbb.d(d5, d6, d7);
if (l.a(((Entity) (this)), axisalignedbb).size() > 0) {
for (int i = 1; (double) i < d3; ++i) {
axisalignedbb.d(d4, d5, d6);
if (this.world.a((Entity) this, axisalignedbb).size() > 0) {
return false;
}
}
@@ -137,15 +137,15 @@ public class EntityGhast extends EntityFlying implements IMobs {
}
protected int h() {
return Item.K.ba;
return Item.SULPHUR.id;
}
protected float i() {
return 10F;
return 10.0F;
}
public boolean b() {
return W.nextInt(20) == 0 && super.b() && l.k > 0;
return this.random.nextInt(20) == 0 && super.b() && this.world.k > 0;
}
public int j() {