2012-02-09 02:01:46 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2013-03-25 05:22:32 +01:00
|
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
|
2012-02-09 02:01:46 +01:00
|
|
|
public class EntityEnderCrystal extends Entity {
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public int a;
|
2012-02-09 02:01:46 +01:00
|
|
|
public int b;
|
|
|
|
|
|
|
|
public EntityEnderCrystal(World world) {
|
|
|
|
super(world);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.m = true;
|
|
|
|
this.a(2.0F, 2.0F);
|
2012-02-09 02:01:46 +01:00
|
|
|
this.height = this.length / 2.0F;
|
|
|
|
this.b = 5;
|
|
|
|
this.a = this.random.nextInt(100000);
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected boolean e_() {
|
2012-02-09 02:01:46 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected void a() {
|
2012-02-09 02:01:46 +01:00
|
|
|
this.datawatcher.a(8, Integer.valueOf(this.b));
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public void l_() {
|
2012-02-09 02:01:46 +01:00
|
|
|
this.lastX = this.locX;
|
|
|
|
this.lastY = this.locY;
|
|
|
|
this.lastZ = this.locZ;
|
|
|
|
++this.a;
|
|
|
|
this.datawatcher.watch(8, Integer.valueOf(this.b));
|
|
|
|
int i = MathHelper.floor(this.locX);
|
|
|
|
int j = MathHelper.floor(this.locY);
|
|
|
|
int k = MathHelper.floor(this.locZ);
|
|
|
|
|
|
|
|
if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
|
2013-03-17 21:46:48 +01:00
|
|
|
// CraftBukkit start
|
2013-03-25 05:22:32 +01:00
|
|
|
if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
|
2013-03-17 21:46:48 +01:00
|
|
|
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2012-02-09 02:01:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void b(NBTTagCompound nbttagcompound) {}
|
|
|
|
|
|
|
|
protected void a(NBTTagCompound nbttagcompound) {}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public boolean K() {
|
2012-02-09 02:01:46 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
if (!this.dead && !this.world.isStatic) {
|
|
|
|
// CraftBukkit start - All non-living entities need this
|
2013-07-01 13:03:00 +02:00
|
|
|
if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
2012-11-06 13:05:28 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2012-07-29 09:33:13 +02:00
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
this.b = 0;
|
|
|
|
if (this.b <= 0) {
|
|
|
|
this.die();
|
|
|
|
if (!this.world.isStatic) {
|
|
|
|
this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
|
|
|
|
}
|
2012-02-09 02:01:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
return true;
|
|
|
|
}
|
2012-02-09 02:01:46 +01:00
|
|
|
}
|
|
|
|
}
|