3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 21:40:08 +01:00
Paper/src/main/java/net/minecraft/server/EntitySpider.java
2011-01-26 14:26:24 -05:00

103 Zeilen
2.7 KiB
Java

package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftSpider;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
// CraftBukkit stop
public class EntitySpider extends EntityMobs {
public EntitySpider(World world) {
super(world);
aP = "/mob/spider.png";
a(1.4F, 0.9F);
bC = 0.8F;
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSpider(server, this);
// CraftBukkit end
}
public double k() {
return (double) J * 0.75D - 0.5D;
}
protected Entity l() {
float f1 = b(1.0F);
if (f1 < 0.5F) {
double d = 16D;
return ((Entity) (l.a(((Entity) (this)), d)));
} else {
return null;
}
}
protected String e() {
return "mob.spider";
}
protected String f() {
return "mob.spider";
}
protected String g() {
return "mob.spiderdeath";
}
protected void a(Entity entity, float f1) {
float f2 = b(1.0F);
if (f2 > 0.5F && W.nextInt(100) == 0) {
// CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
CraftServer server = ((WorldServer) this.l).getServer();
server.getPluginManager().callEvent(event);
if(!event.isCancelled()) {
if(event.getTarget() == null) {
this.d = null;
} else {
this.d = ((CraftEntity) event.getTarget()).getHandle();
}
return;
}
// CraftBukkit end
}
if (f1 > 2.0F && f1 < 6F && W.nextInt(10) == 0) {
if (A) {
double d = entity.p - p;
double d1 = entity.r - r;
float f3 = MathHelper.a(d * d + d1 * d1);
s = (d / (double) f3) * 0.5D * 0.80000001192092896D + s * 0.20000000298023224D;
u = (d1 / (double) f3) * 0.5D * 0.80000001192092896D + u * 0.20000000298023224D;
t = 0.40000000596046448D;
}
} else {
super.a(entity, f1);
}
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
protected int h() {
return Item.I.ba;
}
public boolean m() {
return B;
}
}