|
|
|
|
@@ -1,12 +1,13 @@
|
|
|
|
|
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
|
|
|
|
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
|
|
|
|
@@ -52,6 +52,21 @@
|
|
|
|
|
@@ -52,6 +52,22 @@
|
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
|
+import net.minecraft.world.item.ItemStack;
|
|
|
|
|
+import net.minecraft.world.level.Explosion;
|
|
|
|
|
+import net.minecraft.world.level.ServerExplosion;
|
|
|
|
|
+import net.minecraft.world.level.block.Block;
|
|
|
|
|
+import net.minecraft.world.level.block.entity.TileEntity;
|
|
|
|
|
+import net.minecraft.world.level.storage.loot.LootParams;
|
|
|
|
|
@@ -22,7 +23,7 @@
|
|
|
|
|
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
|
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
|
|
|
@@ -89,6 +104,7 @@
|
|
|
|
|
@@ -88,6 +104,7 @@
|
|
|
|
|
private final PathPoint[] nodes;
|
|
|
|
|
private final int[] nodeAdjacency;
|
|
|
|
|
private final Path openSet;
|
|
|
|
|
@@ -30,15 +31,15 @@
|
|
|
|
|
|
|
|
|
|
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
|
|
|
|
|
super(EntityTypes.ENDER_DRAGON, world);
|
|
|
|
|
@@ -110,6 +126,7 @@
|
|
|
|
|
@@ -108,6 +125,7 @@
|
|
|
|
|
this.setHealth(this.getMaxHealth());
|
|
|
|
|
this.noPhysics = true;
|
|
|
|
|
this.noCulling = true;
|
|
|
|
|
this.phaseManager = new DragonControllerManager(this);
|
|
|
|
|
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY, Particles.EXPLOSION, Particles.EXPLOSION_EMITTER, SoundEffects.GENERIC_EXPLODE); // CraftBukkit
|
|
|
|
|
+ this.explosionSource = new ServerExplosion(world.getMinecraftWorld(), this, null, null, new Vec3D(Double.NaN, Double.NaN, Double.NaN), Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
|
|
|
|
|
@@ -257,7 +274,7 @@
|
|
|
|
|
@@ -218,7 +236,7 @@
|
|
|
|
|
|
|
|
|
|
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
|
|
|
|
|
|
|
|
|
|
@@ -47,7 +48,7 @@
|
|
|
|
|
double d0 = vec3d1.x - this.getX();
|
|
|
|
|
double d1 = vec3d1.y - this.getY();
|
|
|
|
|
double d2 = vec3d1.z - this.getZ();
|
|
|
|
|
@@ -404,7 +421,14 @@
|
|
|
|
|
@@ -379,7 +397,14 @@
|
|
|
|
|
if (this.nearestCrystal.isRemoved()) {
|
|
|
|
|
this.nearestCrystal = null;
|
|
|
|
|
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
|
|
|
|
@@ -63,7 +64,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -489,6 +513,9 @@
|
|
|
|
|
@@ -458,6 +483,9 @@
|
|
|
|
|
int j1 = MathHelper.floor(axisalignedbb.maxZ);
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
boolean flag1 = false;
|
|
|
|
|
@@ -73,20 +74,20 @@
|
|
|
|
|
|
|
|
|
|
for (int k1 = i; k1 <= l; ++k1) {
|
|
|
|
|
for (int l1 = j; l1 <= i1; ++l1) {
|
|
|
|
|
@@ -498,7 +525,11 @@
|
|
|
|
|
@@ -467,7 +495,11 @@
|
|
|
|
|
|
|
|
|
|
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
|
|
|
|
|
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
|
|
|
|
|
- flag1 = this.level().removeBlock(blockposition, false) || flag1;
|
|
|
|
|
if (worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
|
|
|
|
|
- flag1 = worldserver.removeBlock(blockposition, false) || flag1;
|
|
|
|
|
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
|
|
|
|
+ // flag1 = this.level().removeBlock(blockposition, false) || flag1;
|
|
|
|
|
+ // flag1 = worldserver.removeBlock(blockposition, false) || flag1;
|
|
|
|
|
+ flag1 = true;
|
|
|
|
|
+ destroyedBlocks.add(CraftBlock.at(this.level(), blockposition));
|
|
|
|
|
+ destroyedBlocks.add(CraftBlock.at(worldserver, blockposition));
|
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
} else {
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
@@ -507,6 +538,49 @@
|
|
|
|
|
@@ -476,6 +508,49 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -126,7 +127,7 @@
|
|
|
|
|
+ });
|
|
|
|
|
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) this.level(), blockposition, ItemStack.EMPTY, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ nmsBlock.wasExploded(this.level(), blockposition, explosionSource);
|
|
|
|
|
+ nmsBlock.wasExploded((WorldServer) this.level(), blockposition, explosionSource);
|
|
|
|
|
+
|
|
|
|
|
+ this.level().removeBlock(blockposition, false);
|
|
|
|
|
+ }
|
|
|
|
|
@@ -136,24 +137,24 @@
|
|
|
|
|
if (flag1) {
|
|
|
|
|
BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1));
|
|
|
|
|
|
|
|
|
|
@@ -562,7 +636,7 @@
|
|
|
|
|
@@ -531,7 +606,7 @@
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void kill() {
|
|
|
|
|
public void kill(WorldServer worldserver) {
|
|
|
|
|
- this.remove(Entity.RemovalReason.KILLED);
|
|
|
|
|
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
|
|
|
|
this.gameEvent(GameEvent.ENTITY_DIE);
|
|
|
|
|
if (this.dragonFight != null) {
|
|
|
|
|
this.dragonFight.updateDragon(this);
|
|
|
|
|
@@ -571,6 +645,21 @@
|
|
|
|
|
@@ -540,6 +615,21 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // CraftBukkit start - SPIGOT-2420: Special case, the ender dragon drops 12000 xp for the first kill and 500 xp for every other kill and this over time.
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int getExpReward(Entity entity) {
|
|
|
|
|
+ public int getExpReward(WorldServer worldserver, Entity entity) {
|
|
|
|
|
+ // CraftBukkit - Moved from #tickDeath method
|
|
|
|
|
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
|
|
|
|
+ boolean flag = worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
|
|
|
|
+ short short0 = 500;
|
|
|
|
|
+
|
|
|
|
|
+ if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
|
|
|
|
@@ -167,13 +168,12 @@
|
|
|
|
|
@Override
|
|
|
|
|
protected void tickDeath() {
|
|
|
|
|
if (this.dragonFight != null) {
|
|
|
|
|
@@ -586,15 +675,20 @@
|
|
|
|
|
@@ -555,16 +645,21 @@
|
|
|
|
|
this.level().addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // CraftBukkit start - SPIGOT-2420: Moved up to #getExpReward method
|
|
|
|
|
+ /*
|
|
|
|
|
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
|
|
|
|
short short0 = 500;
|
|
|
|
|
|
|
|
|
|
if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
|
|
|
|
@@ -183,31 +183,35 @@
|
|
|
|
|
+ int short0 = expToDrop;
|
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
|
|
if (this.level() instanceof WorldServer) {
|
|
|
|
|
- if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && flag) {
|
|
|
|
|
World world = this.level();
|
|
|
|
|
|
|
|
|
|
if (world instanceof WorldServer worldserver) {
|
|
|
|
|
- if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
|
|
|
|
+ if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
|
|
|
|
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
|
|
|
|
|
EntityExperienceOrb.award(worldserver, this.position(), MathHelper.floor((float) short0 * 0.08F));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -605,7 +699,7 @@
|
|
|
|
|
@@ -577,8 +672,8 @@
|
|
|
|
|
if (this.dragonDeathTime == 200) {
|
|
|
|
|
world = this.level();
|
|
|
|
|
if (world instanceof WorldServer) {
|
|
|
|
|
- worldserver = (WorldServer) world;
|
|
|
|
|
- if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
|
|
|
|
+ WorldServer worldserver = (WorldServer) world; // CraftBukkit - decompile error
|
|
|
|
|
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
|
|
|
|
EntityExperienceOrb.award(worldserver, this.position(), MathHelper.floor((float) short0 * 0.2F));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
|
|
|
|
|
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
|
|
|
|
|
- if (flag) {
|
|
|
|
|
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
|
|
|
|
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
|
|
|
|
|
@@ -586,7 +681,7 @@
|
|
|
|
|
this.dragonFight.setDragonKilled(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- this.remove(Entity.RemovalReason.KILLED);
|
|
|
|
|
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
|
|
|
|
this.gameEvent(GameEvent.ENTITY_DIE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -613,7 +707,7 @@
|
|
|
|
|
this.dragonFight.setDragonKilled(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- this.remove(Entity.RemovalReason.KILLED);
|
|
|
|
|
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
|
|
|
|
this.gameEvent(GameEvent.ENTITY_DIE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -826,6 +920,7 @@
|
|
|
|
|
@@ -800,6 +895,7 @@
|
|
|
|
|
super.addAdditionalSaveData(nbttagcompound);
|
|
|
|
|
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
|
|
|
|
|
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
|
|
|
|
|
@@ -215,7 +219,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -839,6 +934,11 @@
|
|
|
|
|
@@ -813,6 +909,11 @@
|
|
|
|
|
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|