@@ -26,10 +26,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,12 +104,26 @@
|
||||
@@ -99,12 +109,26 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
if (!this.isRemoved()) {
|
||||
- this.remove(Entity.RemovalReason.KILLED);
|
||||
+ // CraftBukkit start - All non-living entities need this
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
||||
@@ -39,7 +39,7 @@
|
||||
if (!damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
DamageSource damagesource1 = damagesource.getEntity() != null ? this.damageSources().explosion(this, damagesource.getEntity()) : null;
|
||||
|
||||
- this.level().explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
- worldserver.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, 6.0F, false);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -47,11 +47,11 @@
|
||||
+ }
|
||||
+
|
||||
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
+ this.level().explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ worldserver.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ } else {
|
||||
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.onDestroyedBy(damagesource);
|
||||
this.onDestroyedBy(worldserver, damagesource);
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java
|
||||
@@ -10,6 +10,10 @@
|
||||
@@ -11,6 +11,10 @@
|
||||
import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class DragonControllerLandedFlame extends AbstractDragonControllerLanded {
|
||||
|
||||
private static final int FLAME_DURATION = 200;
|
||||
@@ -99,7 +103,7 @@
|
||||
@@ -100,7 +104,7 @@
|
||||
@Override
|
||||
public void end() {
|
||||
if (this.flame != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -59,6 +59,18 @@
|
||||
@@ -57,6 +57,18 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -16,29 +16,29 @@
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -255,15 +267,40 @@
|
||||
@@ -253,15 +265,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
- this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
- worldserver.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // CraftBukkit start
|
||||
+ // this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // worldserver.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ worldserver.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!this.isSilent()) {
|
||||
- this.level().globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
- worldserver.globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.level().globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.level()).getCraftServer().getViewDistance() * 16;
|
||||
+ // worldserver.globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = worldserver.getCraftServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.getX() - player.getX();
|
||||
+ double deltaZ = this.getZ() - player.getZ();
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -308,6 +345,7 @@
|
||||
@@ -306,6 +343,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -334,6 +372,11 @@
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
@@ -332,6 +370,11 @@
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
@@ -80,10 +80,10 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
flag = worldserver.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -345,7 +388,7 @@
|
||||
@@ -343,7 +386,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
|
||||
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
@@ -502,7 +545,7 @@
|
||||
@@ -500,7 +543,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
||||
Reference in New Issue
Block a user