diff options
| author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-09-21 01:38:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-21 01:38:28 +0200 |
| commit | c10272e0e358a233ed0ce7d591e9e43ca7ffa26c (patch) | |
| tree | a097f2307d43a5c3d77a698b3c01eae801d35c6c /src/main/java/gtPlusPlus/core/handler | |
| parent | e567c18792be9fe623ec777b40f3cbc36572b78e (diff) | |
| download | GT5-Unofficial-c10272e0e358a233ed0ce7d591e9e43ca7ffa26c.tar.gz GT5-Unofficial-c10272e0e358a233ed0ce7d591e9e43ca7ffa26c.tar.bz2 GT5-Unofficial-c10272e0e358a233ed0ce7d591e9e43ca7ffa26c.zip | |
Delete more reflection (#3233)
Diffstat (limited to 'src/main/java/gtPlusPlus/core/handler')
| -rw-r--r-- | src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java b/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java index 13dc18c4b1..51780fd030 100644 --- a/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java +++ b/src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java @@ -13,36 +13,23 @@ import com.kuba6000.mobsinfo.api.MobRecipe; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.util.ReflectionUtil; import gtPlusPlus.core.material.MaterialsElements; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; @Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo") public class EnderDragonDeathHandler implements IMobExtraInfoProvider { - 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); - } + private static final Class<?> mHardcoreDragonClass = ReflectionUtil + .getClass("chylex.hee.entity.boss.EntityBossDragon"); + private static final Class<?> mChaoseDragonClass = ReflectionUtil + .getClass("com.brandon3055.draconicevolution.common.entity.EntityCustomDragon"); @SubscribeEvent public void onEntityDrop(LivingDropsEvent event) { - // - int aCountTotal = 0; - - if (mHEE && mHardcoreDragonClass != null && mHardcoreDragonClass.isInstance(event.entityLiving)) { + if (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( @@ -50,7 +37,7 @@ public class EnderDragonDeathHandler implements IMobExtraInfoProvider { MathUtils.randFloat(0, 1)); aCountTotal = +aAmount; } - } else if (mDE && mChaoseDragonClass != null && mChaoseDragonClass.isInstance(event.entityLiving)) { + } else if (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( @@ -69,7 +56,7 @@ public class EnderDragonDeathHandler implements IMobExtraInfoProvider { } if (aCountTotal > 0) { PlayerUtils - .messageAllPlayers(aCountTotal + " Shards of Dragons Blood have crystalized into a metallic form."); + .messageAllPlayers(aCountTotal + " Shards of Dragons Blood have crystallized into a metallic form."); } } @@ -77,7 +64,7 @@ public class EnderDragonDeathHandler implements IMobExtraInfoProvider { @Override public void provideExtraDropsInformation(@NotNull String entityString, @NotNull ArrayList<MobDrop> drops, @NotNull MobRecipe recipe) { - if (mHEE && mHardcoreDragonClass != null && mHardcoreDragonClass.isInstance(recipe.entity)) { + if (mHardcoreDragonClass != null && mHardcoreDragonClass.isInstance(recipe.entity)) { MobDrop drop = new MobDrop( MaterialsElements.STANDALONE.DRAGON_METAL.getNugget(1), MobDrop.DropType.Normal, @@ -90,7 +77,7 @@ public class EnderDragonDeathHandler implements IMobExtraInfoProvider { drop.clampChance(); drops.add(drop); - } else if (mDE && mChaoseDragonClass != null && mChaoseDragonClass.isInstance(recipe.entity)) { + } else if (mChaoseDragonClass != null && mChaoseDragonClass.isInstance(recipe.entity)) { MobDrop drop = new MobDrop( MaterialsElements.STANDALONE.DRAGON_METAL.getIngot(1), MobDrop.DropType.Normal, |
