2011-09-18 02:16:18 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
import java.util.UUID;
|
|
|
|
|
2011-09-21 02:40:22 +02:00
|
|
|
// CraftBukkit start
|
2011-09-18 02:16:18 +02:00
|
|
|
import org.bukkit.Location;
|
2011-09-21 16:41:24 +02:00
|
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
2012-02-08 05:49:07 +01:00
|
|
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
2011-09-21 02:40:22 +02:00
|
|
|
// CraftBukkit end
|
2011-09-18 02:16:18 +02:00
|
|
|
|
|
|
|
public class EntityEnderman extends EntityMonster {
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
private static final UUID bp = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
|
|
|
private static final AttributeModifier bq = (new AttributeModifier(bp, "Attacking speed boost", 6.199999809265137D, 0)).a(false);
|
|
|
|
private static boolean[] br = new boolean[256];
|
|
|
|
private int bs;
|
|
|
|
private int bt;
|
|
|
|
private Entity bu;
|
|
|
|
private boolean bv;
|
2011-09-18 02:16:18 +02:00
|
|
|
|
|
|
|
public EntityEnderman(World world) {
|
|
|
|
super(world);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(0.6F, 2.9F);
|
2013-03-13 23:33:27 +01:00
|
|
|
this.Y = 1.0F;
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected void ax() {
|
|
|
|
super.ax();
|
|
|
|
this.a(GenericAttributes.a).a(40.0D);
|
|
|
|
this.a(GenericAttributes.d).a(0.30000001192092896D);
|
|
|
|
this.a(GenericAttributes.e).a(7.0D);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected void a() {
|
|
|
|
super.a();
|
2011-09-18 02:16:18 +02:00
|
|
|
this.datawatcher.a(16, new Byte((byte) 0));
|
|
|
|
this.datawatcher.a(17, new Byte((byte) 0));
|
2012-07-29 09:33:13 +02:00
|
|
|
this.datawatcher.a(18, new Byte((byte) 0));
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
|
|
super.b(nbttagcompound);
|
2011-11-30 00:17:43 +01:00
|
|
|
nbttagcompound.setShort("carried", (short) this.getCarriedId());
|
|
|
|
nbttagcompound.setShort("carriedData", (short) this.getCarriedData());
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(NBTTagCompound nbttagcompound) {
|
|
|
|
super.a(nbttagcompound);
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setCarriedId(nbttagcompound.getShort("carried"));
|
|
|
|
this.setCarriedData(nbttagcompound.getShort("carriedData"));
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected Entity findTarget() {
|
2011-11-30 00:17:43 +01:00
|
|
|
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
|
2011-09-18 02:16:18 +02:00
|
|
|
|
|
|
|
if (entityhuman != null) {
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.f(entityhuman)) {
|
|
|
|
this.bv = true;
|
|
|
|
if (this.bt == 0) {
|
2012-10-25 05:53:23 +02:00
|
|
|
this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.bt++ == 5) {
|
|
|
|
this.bt = 0;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(true);
|
2011-09-18 02:16:18 +02:00
|
|
|
return entityhuman;
|
|
|
|
}
|
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bt = 0;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
private boolean f(EntityHuman entityhuman) {
|
2011-09-18 02:16:18 +02:00
|
|
|
ItemStack itemstack = entityhuman.inventory.armor[3];
|
|
|
|
|
|
|
|
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
|
|
|
|
return false;
|
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
Vec3D vec3d = entityhuman.j(1.0F).a();
|
2012-10-25 05:53:23 +02:00
|
|
|
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
|
|
|
|
double d0 = vec3d1.b();
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
vec3d1 = vec3d1.a();
|
2012-07-29 09:33:13 +02:00
|
|
|
double d1 = vec3d.b(vec3d1);
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
return d1 > 1.0D - 0.025D / d0 ? entityhuman.o(this) : false;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public void c() {
|
2013-03-13 23:33:27 +01:00
|
|
|
if (this.F()) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.damageEntity(DamageSource.DROWN, 1.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.bu != this.target) {
|
|
|
|
AttributeInstance attributeinstance = this.a(GenericAttributes.d);
|
|
|
|
|
|
|
|
attributeinstance.b(bq);
|
|
|
|
if (this.target != null) {
|
|
|
|
attributeinstance.a(bq);
|
|
|
|
}
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bu = this.target;
|
2011-09-18 02:16:18 +02:00
|
|
|
int i;
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
|
2011-09-18 02:16:18 +02:00
|
|
|
int j;
|
|
|
|
int k;
|
|
|
|
int l;
|
|
|
|
|
|
|
|
if (this.getCarriedId() == 0) {
|
|
|
|
if (this.random.nextInt(20) == 0) {
|
|
|
|
i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D);
|
|
|
|
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
|
|
|
|
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
|
|
|
|
l = this.world.getTypeId(i, j, k);
|
2013-07-01 13:03:00 +02:00
|
|
|
if (br[l]) {
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Pickup event
|
2012-02-21 13:51:56 +01:00
|
|
|
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
|
2011-09-18 02:16:18 +02:00
|
|
|
this.setCarriedId(this.world.getTypeId(i, j, k));
|
|
|
|
this.setCarriedData(this.world.getData(i, j, k));
|
2013-03-13 23:33:27 +01:00
|
|
|
this.world.setTypeIdUpdate(i, j, k, 0);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this.random.nextInt(2000) == 0) {
|
|
|
|
i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D);
|
|
|
|
j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D);
|
|
|
|
k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D);
|
|
|
|
l = this.world.getTypeId(i, j, k);
|
|
|
|
int i1 = this.world.getTypeId(i, j - 1, k);
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Place event
|
2012-11-30 18:53:31 +01:00
|
|
|
if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
|
2011-09-18 02:16:18 +02:00
|
|
|
this.setCarriedId(0);
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 2; ++i) {
|
2012-10-25 05:53:23 +02:00
|
|
|
this.world.addParticle("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-04-27 11:40:05 +02:00
|
|
|
if (this.world.v() && !this.world.isStatic) {
|
2013-07-01 13:03:00 +02:00
|
|
|
float f = this.d(1.0F);
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
if (f > 0.5F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.target = null;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(false);
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = false;
|
|
|
|
this.bP();
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
if (this.F() || this.isBurning()) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.target = null;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(false);
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = false;
|
|
|
|
this.bP();
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.bT() && !this.bv && this.random.nextInt(100) == 0) {
|
2013-04-27 11:40:05 +02:00
|
|
|
this.a(false);
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bd = false;
|
2011-09-18 02:16:18 +02:00
|
|
|
if (this.target != null) {
|
|
|
|
this.a(this.target, 100.0F, 100.0F);
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
if (!this.world.isStatic && this.isAlive()) {
|
2011-09-18 02:16:18 +02:00
|
|
|
if (this.target != null) {
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) {
|
2012-07-29 09:33:13 +02:00
|
|
|
if (this.target.e((Entity) this) < 16.0D) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bP();
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bs = 0;
|
|
|
|
} else if (this.target.e((Entity) this) > 256.0D && this.bs++ >= 30 && this.c(this.target)) {
|
|
|
|
this.bs = 0;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
} else {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(false);
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bs = 0;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
super.c();
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected boolean bP() {
|
2011-09-18 02:16:18 +02:00
|
|
|
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
|
|
|
|
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
|
|
|
|
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
return this.j(d0, d1, d2);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected boolean c(Entity entity) {
|
2012-10-25 05:53:23 +02:00
|
|
|
Vec3D vec3d = this.world.getVec3DPool().create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
vec3d = vec3d.a();
|
2011-09-18 02:16:18 +02:00
|
|
|
double d0 = 16.0D;
|
2012-10-25 05:53:23 +02:00
|
|
|
double d1 = this.locX + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
|
|
|
|
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.d * d0;
|
|
|
|
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.e * d0;
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
return this.j(d1, d2, d3);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected boolean j(double d0, double d1, double d2) {
|
2011-09-18 02:16:18 +02:00
|
|
|
double d3 = this.locX;
|
|
|
|
double d4 = this.locY;
|
|
|
|
double d5 = this.locZ;
|
|
|
|
|
|
|
|
this.locX = d0;
|
|
|
|
this.locY = d1;
|
|
|
|
this.locZ = d2;
|
|
|
|
boolean flag = false;
|
|
|
|
int i = MathHelper.floor(this.locX);
|
|
|
|
int j = MathHelper.floor(this.locY);
|
|
|
|
int k = MathHelper.floor(this.locZ);
|
|
|
|
int l;
|
|
|
|
|
|
|
|
if (this.world.isLoaded(i, j, k)) {
|
|
|
|
boolean flag1 = false;
|
|
|
|
|
|
|
|
while (!flag1 && j > 0) {
|
|
|
|
l = this.world.getTypeId(i, j - 1, k);
|
|
|
|
if (l != 0 && Block.byId[l].material.isSolid()) {
|
|
|
|
flag1 = true;
|
|
|
|
} else {
|
|
|
|
--this.locY;
|
|
|
|
--j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag1) {
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Teleport event
|
2012-02-08 05:49:07 +01:00
|
|
|
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
|
|
|
|
this.world.getServer().getPluginManager().callEvent(teleport);
|
2012-02-29 22:31:04 +01:00
|
|
|
if (teleport.isCancelled()) {
|
2012-02-08 05:49:07 +01:00
|
|
|
return false;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
2012-02-29 22:31:04 +01:00
|
|
|
|
|
|
|
Location to = teleport.getTo();
|
|
|
|
this.setPosition(to.getX(), to.getY(), to.getZ());
|
2012-02-08 05:49:07 +01:00
|
|
|
// CraftBukkit end
|
2012-02-29 22:31:04 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
if (this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
|
2012-02-29 22:31:04 +01:00
|
|
|
flag = true;
|
|
|
|
}
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flag) {
|
|
|
|
this.setPosition(d3, d4, d5);
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
short short1 = 128;
|
|
|
|
|
|
|
|
for (l = 0; l < short1; ++l) {
|
|
|
|
double d6 = (double) l / ((double) short1 - 1.0D);
|
|
|
|
float f = (this.random.nextFloat() - 0.5F) * 0.2F;
|
|
|
|
float f1 = (this.random.nextFloat() - 0.5F) * 0.2F;
|
|
|
|
float f2 = (this.random.nextFloat() - 0.5F) * 0.2F;
|
2011-11-30 00:17:43 +01:00
|
|
|
double d7 = d3 + (this.locX - d3) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
|
|
|
|
double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length;
|
|
|
|
double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
this.world.addParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
|
2012-11-06 13:05:28 +01:00
|
|
|
this.makeSound("mob.endermen.portal", 1.0F, 1.0F);
|
2011-09-18 02:16:18 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected String r() {
|
|
|
|
return this.bT() ? "mob.endermen.scream" : "mob.endermen.idle";
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected String aK() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return "mob.endermen.hit";
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected String aL() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return "mob.endermen.death";
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
protected int getLootId() {
|
2011-09-18 02:16:18 +02:00
|
|
|
return Item.ENDER_PEARL.id;
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
protected void dropDeathLoot(boolean flag, int i) {
|
2012-01-14 21:03:48 +01:00
|
|
|
int j = this.getLootId();
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (j > 0) {
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Whole method
|
2012-07-22 08:18:00 +02:00
|
|
|
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
2011-11-20 09:01:14 +01:00
|
|
|
int count = this.random.nextInt(2 + i);
|
2011-09-18 02:16:18 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if ((j > 0) && (count > 0)) {
|
|
|
|
loot.add(new org.bukkit.inventory.ItemStack(j, count));
|
|
|
|
}
|
2011-09-21 02:40:22 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
CraftEventFactory.callEntityDeathEvent(this, loot);
|
|
|
|
// CraftBukkit end
|
|
|
|
}
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setCarriedId(int i) {
|
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (i & 255)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCarriedId() {
|
2011-09-24 23:03:31 +02:00
|
|
|
return this.datawatcher.getByte(16);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setCarriedData(int i) {
|
|
|
|
this.datawatcher.watch(17, Byte.valueOf((byte) (i & 255)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCarriedData() {
|
2011-09-24 23:03:31 +02:00
|
|
|
return this.datawatcher.getByte(17);
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
2012-11-06 13:05:28 +01:00
|
|
|
if (this.isInvulnerable()) {
|
|
|
|
return false;
|
2012-12-20 05:03:52 +01:00
|
|
|
} else {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(true);
|
2013-04-27 11:40:05 +02:00
|
|
|
if (damagesource instanceof EntityDamageSource && damagesource.getEntity() instanceof EntityHuman) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = true;
|
2013-04-27 11:40:05 +02:00
|
|
|
}
|
|
|
|
|
2012-12-20 05:03:52 +01:00
|
|
|
if (damagesource instanceof EntityDamageSourceIndirect) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = false;
|
2013-04-27 11:40:05 +02:00
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
for (int i = 0; i < 64; ++i) {
|
|
|
|
if (this.bP()) {
|
2012-12-20 05:03:52 +01:00
|
|
|
return true;
|
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2012-12-20 05:03:52 +01:00
|
|
|
return false;
|
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
return super.damageEntity(damagesource, f);
|
2012-07-29 09:33:13 +02:00
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public boolean bT() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return this.datawatcher.getByte(18) > 0;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public void a(boolean flag) {
|
2012-07-29 09:33:13 +02:00
|
|
|
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
|
|
|
|
}
|
|
|
|
|
2011-09-18 02:16:18 +02:00
|
|
|
static {
|
2013-07-01 13:03:00 +02:00
|
|
|
br[Block.GRASS.id] = true;
|
|
|
|
br[Block.DIRT.id] = true;
|
|
|
|
br[Block.SAND.id] = true;
|
|
|
|
br[Block.GRAVEL.id] = true;
|
|
|
|
br[Block.YELLOW_FLOWER.id] = true;
|
|
|
|
br[Block.RED_ROSE.id] = true;
|
|
|
|
br[Block.BROWN_MUSHROOM.id] = true;
|
|
|
|
br[Block.RED_MUSHROOM.id] = true;
|
|
|
|
br[Block.TNT.id] = true;
|
|
|
|
br[Block.CACTUS.id] = true;
|
|
|
|
br[Block.CLAY.id] = true;
|
|
|
|
br[Block.PUMPKIN.id] = true;
|
|
|
|
br[Block.MELON.id] = true;
|
|
|
|
br[Block.MYCEL.id] = true;
|
2011-09-18 02:16:18 +02:00
|
|
|
}
|
|
|
|
}
|