3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-18 14:00:05 +01:00
Paper/src/main/java/net/minecraft/server/EntityCreeper.java

116 Zeilen
2.8 KiB
Java

2011-02-04 04:03:11 +01:00
package net.minecraft.server;
//CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent;
// CraftBukkit end
public class EntityCreeper extends EntityMonster {
int a;
int b;
public EntityCreeper(World world) {
super(world);
this.texture = "/mob/creeper.png";
}
protected void a() {
super.a();
this.datawatcher.a(16, Byte.valueOf((byte) -1));
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
2011-02-23 03:37:56 +01:00
public void f_() {
2011-02-04 04:03:11 +01:00
this.b = this.a;
if (this.world.isStatic) {
2011-02-23 03:37:56 +01:00
int i = this.r();
2011-02-04 04:03:11 +01:00
if (i > 0 && this.a == 0) {
this.world.a(this, "random.fuse", 1.0F, 0.5F);
}
this.a += i;
if (this.a < 0) {
this.a = 0;
}
if (this.a >= 30) {
this.a = 30;
}
}
2011-02-23 03:37:56 +01:00
super.f_();
2011-02-04 04:03:11 +01:00
}
protected String f() {
return "mob.creeper";
}
protected String g() {
return "mob.creeperdeath";
}
2011-02-23 03:37:56 +01:00
public void a(Entity entity) {
super.a(entity);
2011-02-04 04:03:11 +01:00
if (entity instanceof EntitySkeleton) {
2011-02-23 03:37:56 +01:00
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
2011-02-04 04:03:11 +01:00
}
}
protected void a(Entity entity, float f) {
2011-02-23 03:37:56 +01:00
int i = this.r();
2011-02-04 04:03:11 +01:00
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
2011-02-23 03:37:56 +01:00
this.e(-1);
2011-02-04 04:03:11 +01:00
--this.a;
if (this.a < 0) {
this.a = 0;
}
} else {
if (this.a == 0) {
this.world.a(this, "random.fuse", 1.0F, 0.5F);
}
2011-02-23 03:37:56 +01:00
this.e(1);
2011-02-04 04:03:11 +01:00
++this.a;
if (this.a >= 30) {
// 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), 3.0F, false);
server.getPluginManager().callEvent(event);
if(!event.isCancelled()) {
this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
2011-02-23 03:37:56 +01:00
this.C();
2011-02-04 04:03:11 +01:00
} else {
this.a = 0;
}
// Craftbukkit end
}
this.e = true;
}
}
protected int h() {
return Item.SULPHUR.id;
}
2011-02-23 03:37:56 +01:00
private int r() {
2011-02-04 04:03:11 +01:00
return this.datawatcher.a(16);
}
2011-02-23 03:37:56 +01:00
private void e(int i) {
2011-02-04 04:03:11 +01:00
this.datawatcher.b(16, Byte.valueOf((byte) i));
}
}