From 43be31d2ac5c8d390579edd4faa5817e91fc4b1a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 23 Jan 2022 17:41:06 +0000 Subject: Added framework for custom bees. Boosted drops of Dragon Metal from Chaos Dragons. Fixed https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9556. --- .../handler/events/EnderDragonDeathHandler.java | 57 +++++++++++----------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/handler') diff --git a/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java b/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java index 884f14386d..967a51fad6 100644 --- a/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java +++ b/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java @@ -13,47 +13,48 @@ public class EnderDragonDeathHandler { private static final String mDragonClassName = "chylex.hee.entity.boss.EntityBossDragon"; private static final boolean mHEE; private static final Class mHardcoreDragonClass; - + + private static final String mChaosDragonClassName = "com.brandon3055.draconicevolution.common.entity.EntityCustomDragon"; + private static final boolean mDE; + private static final Class mChaoseDragonClass; + static { mHEE = ReflectionUtils.doesClassExist(mDragonClassName); mHardcoreDragonClass = (mHEE ? ReflectionUtils.getClass(mDragonClassName) : null); + mDE = ReflectionUtils.doesClassExist(mChaosDragonClassName); + mChaoseDragonClass = (mDE ? ReflectionUtils.getClass(mChaosDragonClassName) : null); } @SubscribeEvent public void onEntityDrop(LivingDropsEvent event) { - - boolean aDidDrop = false; + int aCountTotal = 0; - - //HEE Dragon - if (mHEE) { - if (mHardcoreDragonClass != null) { - if (mHardcoreDragonClass.isInstance(event.entityLiving)) { - for (int y = 0; y < MathUtils.randInt(100, 250); y++) { - int aAmount = MathUtils.randInt(5, 25); - event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); - aDidDrop = true; - aCountTotal =+ aAmount; - } - } + + if (mHEE && mHardcoreDragonClass != null && mHardcoreDragonClass.isInstance(event.entityLiving)) { + for (int y = 0; y < MathUtils.randInt(100, 250); y++) { + int aAmount = MathUtils.randInt(5, 25); + event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); + aCountTotal = +aAmount; } } - //Vanilla Dragon or any other dragon that extends it - else { - if (event.entityLiving instanceof EntityDragon) { - for (int y = 0; y < MathUtils.randInt(25, 50); y++) { - int aAmount = MathUtils.randInt(1, 10); - event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); - aDidDrop = true; - aCountTotal =+ aAmount; - } + else if (mDE && mChaoseDragonClass != null && mChaoseDragonClass.isInstance(event.entityLiving)) { + for (int y = 0; y < MathUtils.randInt(100, 200); y++) { + int aAmount = MathUtils.randInt(1, 5); + event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getIngot(aAmount), MathUtils.randFloat(0, 1)); + aCountTotal = +aAmount; } } - - if (aDidDrop) { - PlayerUtils.messageAllPlayers(aCountTotal+" Shards of Dragons Blood have crystalized into a metallic form."); + else if (event.entityLiving instanceof EntityDragon) { + for (int y = 0; y < MathUtils.randInt(25, 50); y++) { + int aAmount = MathUtils.randInt(1, 10); + event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); + aCountTotal = +aAmount; + } + } + if (aCountTotal > 0) { + PlayerUtils.messageAllPlayers(aCountTotal + " Shards of Dragons Blood have crystalized into a metallic form."); } - + } } -- cgit