From 006a27dcd66034524064479b67d36add357fc095 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 14 Oct 2012 20:17:07 -0700 Subject: [PATCH] New Block hook to determine if it can be destroied by the ender dragon, for PR 199 --- .../common/net/minecraft/src/Block.java.patch | 17 ++++++++++++++++- .../net/minecraft/src/EntityDragon.java.patch | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 patches/common/net/minecraft/src/EntityDragon.java.patch diff --git a/patches/common/net/minecraft/src/Block.java.patch b/patches/common/net/minecraft/src/Block.java.patch index 013866a64..0b9603cc6 100644 --- a/patches/common/net/minecraft/src/Block.java.patch +++ b/patches/common/net/minecraft/src/Block.java.patch @@ -102,7 +102,7 @@ { ItemStack var8 = this.createStackedBlock(par6); -@@ -1249,4 +1255,816 @@ +@@ -1249,4 +1255,831 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -917,5 +917,20 @@ + public int getLightOpacity(World world, int x, int y, int z) + { + return lightOpacity[blockID]; ++ } ++ ++ /** ++ * Determines if this block is destroyed when a ender dragon tries to fly through it. ++ * The block will be set to 0, nothing will drop. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z position ++ * @return True to allow the ender dragon to destroy this block ++ */ ++ public boolean canDragonDestroy(World world, int x, int y, int z) ++ { ++ return blockID != obsidian.blockID && blockID != whiteStone.blockID && blockID != bedrock.blockID; + } } diff --git a/patches/common/net/minecraft/src/EntityDragon.java.patch b/patches/common/net/minecraft/src/EntityDragon.java.patch new file mode 100644 index 000000000..d883d502e --- /dev/null +++ b/patches/common/net/minecraft/src/EntityDragon.java.patch @@ -0,0 +1,17 @@ +--- ../src_base/common/net/minecraft/src/EntityDragon.java ++++ ../src_work/common/net/minecraft/src/EntityDragon.java +@@ -505,10 +505,11 @@ + for (int var12 = var4; var12 <= var7; ++var12) + { + int var13 = this.worldObj.getBlockId(var10, var11, var12); +- +- if (var13 != 0) ++ Block block = Block.blocksList[var13]; ++ ++ if (block != null) + { +- if (var13 != Block.obsidian.blockID && var13 != Block.whiteStone.blockID && var13 != Block.bedrock.blockID) ++ if (block.canDragonDestroy(worldObj, var10, var11, var12)) + { + var9 = true; + this.worldObj.setBlockWithNotify(var10, var11, var12, 0);