@@ -1,36 +1,37 @@
|
||||
--- a/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -5,7 +5,12 @@
|
||||
@@ -6,7 +6,13 @@
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
+import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
+// PAIL: Fixme
|
||||
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
|
||||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final Logger bQ = LogManager.getLogger();
|
||||
@@ -33,6 +38,7 @@
|
||||
private final PathPoint[] bV = new PathPoint[24];
|
||||
private final int[] bW = new int[24];
|
||||
private final Path bX = new Path();
|
||||
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
private static final Logger bN = LogManager.getLogger();
|
||||
@@ -35,6 +41,7 @@
|
||||
private final PathPoint[] bT = new PathPoint[24];
|
||||
private final int[] bU = new int[24];
|
||||
private final Path bV = new Path();
|
||||
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
|
||||
super(EntityTypes.ENDER_DRAGON, world);
|
||||
@@ -170,7 +176,7 @@
|
||||
@@ -173,7 +180,7 @@
|
||||
|
||||
Vec3D vec3d = idragoncontroller.g();
|
||||
Vec3D vec3d1 = idragoncontroller.g();
|
||||
|
||||
- if (vec3d != null) {
|
||||
+ if (vec3d != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVER) { // CraftBukkit - Don't move when hovering
|
||||
d0 = vec3d.x - this.locX;
|
||||
d1 = vec3d.y - this.locY;
|
||||
d2 = vec3d.z - this.locZ;
|
||||
@@ -326,7 +332,14 @@
|
||||
- if (vec3d1 != null) {
|
||||
+ if (vec3d1 != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVER) { // CraftBukkit - Don't move when hovering
|
||||
d0 = vec3d1.x - this.locX;
|
||||
d1 = vec3d1.y - this.locY;
|
||||
d2 = vec3d1.z - this.locZ;
|
||||
@@ -315,7 +322,14 @@
|
||||
if (this.currentEnderCrystal.dead) {
|
||||
this.currentEnderCrystal = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
@@ -46,31 +47,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,6 +412,10 @@
|
||||
@@ -388,6 +402,9 @@
|
||||
int j1 = MathHelper.floor(axisalignedbb.maxZ);
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
+ // CraftBukkit start - Create a list to hold all the destroyed blocks
|
||||
+ List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
+ org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
@@ -412,7 +429,11 @@
|
||||
@@ -398,7 +415,11 @@
|
||||
|
||||
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
|
||||
if (this.world.getGameRules().getBoolean("mobGriefing") && !TagsBlock.DRAGON_IMMUNE.isTagged(block)) {
|
||||
- flag1 = this.world.a(blockposition, false) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.world.a(blockposition, false) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(CraftBlock.at(world, blockposition));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
} else if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME) {
|
||||
if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY) {
|
||||
- flag1 = this.world.setAir(blockposition) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.world.setAir(blockposition) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -424,6 +445,42 @@
|
||||
}
|
||||
@@ -407,6 +428,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
+ } else if (event.getYield() == 0F) {
|
||||
+ // Yield zero ==> no drops
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
+ this.world.setAir(new BlockPosition(block.getX(), block.getY(), block.getZ()));
|
||||
+ this.world.a(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
@@ -94,22 +94,23 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ int blockX = block.getX();
|
||||
+ int blockY = block.getY();
|
||||
+ int blockZ = block.getZ();
|
||||
+ CraftBlock craftBlock = ((CraftBlock) block);
|
||||
+ BlockPosition blockposition = craftBlock.getPosition();
|
||||
+
|
||||
+ Block nmsBlock = org.bukkit.craftbukkit.util.CraftMagicNumbers.getBlock(blockId);
|
||||
+ Block nmsBlock = craftBlock.getNMS().getBlock();
|
||||
+ if (nmsBlock.a(explosionSource)) {
|
||||
+ BlockPosition pos = new BlockPosition(blockX, blockY, blockZ);
|
||||
+ nmsBlock.dropNaturally(world.getType(pos), world, pos, event.getYield(), 0);
|
||||
+ }
|
||||
+ nmsBlock.wasExploded(world, new BlockPosition(blockX, blockY, blockZ), explosionSource);
|
||||
+ TileEntity tileentity = nmsBlock.isTileEntity() ? this.world.getTileEntity(blockposition) : null;
|
||||
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
|
||||
+
|
||||
+ this.world.setAir(new BlockPosition(blockX, blockY, blockZ));
|
||||
+ Block.b(craftBlock.getNMS(), loottableinfo_builder);
|
||||
+ }
|
||||
+ nmsBlock.wasExploded(world, blockposition, explosionSource);
|
||||
+
|
||||
+ this.world.a(blockposition, false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1) {
|
||||
double d0 = axisalignedbb.minX + (axisalignedbb.maxX - axisalignedbb.minX) * (double) this.random.nextFloat();
|
||||
double d1 = axisalignedbb.minY + (axisalignedbb.maxY - axisalignedbb.minY) * (double) this.random.nextFloat();
|
||||
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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user