@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -52,6 +52,17 @@
|
||||
@@ -54,6 +54,17 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -15,29 +15,29 @@
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
|
||||
@@ -234,16 +245,40 @@
|
||||
i = this.getInvul() - 1;
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.a(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -238,16 +249,40 @@
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
+ // CraftBukkit start
|
||||
+ // this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
- this.level.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
if (!this.isSilent()) {
|
||||
- this.world.b(1023, this.getChunkCoordinates(), 0);
|
||||
- this.level.b(1023, this.getChunkCoordinates(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.b(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
+ int viewDistance = ((WorldServer) this.level).getServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.locX() - player.locX();
|
||||
+ double deltaZ = this.locZ() - player.locZ();
|
||||
@@ -46,9 +46,9 @@
|
||||
+ double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true));
|
||||
+ player.connection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true));
|
||||
+ } else {
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, this.getChunkCoordinates(), 0, true));
|
||||
+ player.connection.sendPacket(new PacketPlayOutWorldEvent(1023, this.getChunkCoordinates(), 0, true));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -56,26 +56,22 @@
|
||||
}
|
||||
|
||||
this.setInvul(i);
|
||||
if (this.ticksLived % 10 == 0) {
|
||||
if (this.tickCount % 10 == 0) {
|
||||
- this.heal(10.0F);
|
||||
+ this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -295,9 +330,11 @@
|
||||
if (entityliving != this && entityliving.isAlive() && this.hasLineOfSight(entityliving)) {
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
if (!((EntityHuman) entityliving).abilities.isInvulnerable) {
|
||||
+ if (CraftEventFactory.callEntityTargetLivingEvent(this, entityliving, EntityTargetEvent.TargetReason.CLOSEST_PLAYER).isCancelled()) continue; // CraftBukkit
|
||||
this.setHeadTarget(i, entityliving.getId());
|
||||
}
|
||||
} else {
|
||||
+ if (CraftEventFactory.callEntityTargetLivingEvent(this, entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY).isCancelled()) continue; // CraftBukkit
|
||||
this.setHeadTarget(i, entityliving.getId());
|
||||
}
|
||||
break;
|
||||
@@ -333,6 +370,11 @@
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
@@ -292,6 +327,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
+ if (CraftEventFactory.callEntityTargetLivingEvent(this, entityliving1, EntityTargetEvent.TargetReason.CLOSEST_ENTITY).isCancelled()) continue; // CraftBukkit
|
||||
this.setHeadTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -322,6 +358,11 @@
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
|
||||
if (c(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
@@ -83,15 +79,15 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = this.world.a(blockposition, true, this) || flag;
|
||||
flag = this.level.a(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +388,7 @@
|
||||
@@ -335,7 +376,7 @@
|
||||
}
|
||||
|
||||
if (this.ticksLived % 20 == 0) {
|
||||
if (this.tickCount % 20 == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
||||
}
|
||||
|
||||
this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
|
||||
Reference in New Issue
Block a user