added BW integration

+removed unessecary GT lib

Signed-off-by: bartimaeusnek <[email protected]>
This commit is contained in:
bartimaeusnek committed 2019-08-30 23:27:26 +02:00
1 parent d5b4687dbf
commit 1eba34b256
3 files changed
+38 -27

No files matched your search

@@ -94,7 +94,6 @@ public class CommonProxy {
DETab.initialize();
PotionHandler.init();
CCOCIntegration.init();
ModHelper.init();
DragonChunkLoader.init();
LogHelper.info("Finished Initialization");
@@ -3,7 +3,6 @@ package com.brandon3055.draconicevolution.integration;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler.ArmorSummery;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
@@ -14,19 +13,32 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
*/
public class ModHelper {
public static boolean isTConInstalled;
public static boolean isAvaritiaInstalled;
public static boolean isRotaryCraftInstalled;
public static boolean isGregTechInstalled;
private static boolean isTConInstalled;
private static boolean isAvaritiaInstalled;
//private static boolean isRotaryCraftInstalled;
private static boolean isGregTechInstalled;
private static Item cleaver;
private static Item avaritiaSword;
private static Item bedrockSword;
//private static Item bedrockSword;
public static void init() {
private static Class bwores;
private static Class GTores;
static {
isTConInstalled = Loader.isModLoaded("TConstruct");
isAvaritiaInstalled = Loader.isModLoaded("Avaritia");
isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft");
//isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft");
isGregTechInstalled = Loader.isModLoaded("gregtech");
if (isGregTechInstalled)
try {
GTores = Class.forName("gregtech.common.blocks.GT_TileEntity_Ores");
} catch (ClassNotFoundException e) {}
if (Loader.isModLoaded("bartworks"))
try {
bwores = Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE");
} catch (ClassNotFoundException e) {}
}
public static boolean isHoldingCleaver(EntityPlayer player) {
@@ -43,12 +55,12 @@ public class ModHelper {
return avaritiaSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(avaritiaSword);
}
public static boolean isHoldingBedrockSword(EntityPlayer player) {
if (!isRotaryCraftInstalled) return false;
else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", "rotarycraft_item_bedsword");
return bedrockSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(bedrockSword);
}
// public static boolean isHoldingBedrockSword(EntityPlayer player) {
// if (!isRotaryCraftInstalled) return false;
// else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", "rotarycraft_item_bedsword");
//
// return bedrockSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(bedrockSword);
// }
public static float applyModDamageAdjustments(ArmorSummery summery, LivingAttackEvent event) {
if (summery == null) return event.ammount;
@@ -61,15 +73,17 @@ public class ModHelper {
if (isHoldingAvaritiaSword(attacker)) {
event.entityLiving.hurtResistantTime = 0;
return 300F;
} else if (isHoldingBedrockSword(attacker)) {
summery.entropy += 10;
if (summery.entropy > 100) {
summery.entropy = 100;
}
return Math.max(event.ammount, Math.min(50F, summery.protectionPoints));
} else if (event.source.isUnblockable() || event.source.canHarmInCreative()) {
}
// else if (isHoldingBedrockSword(attacker)) {
// summery.entropy += 10;
//
// if (summery.entropy > 100) {
// summery.entropy = 100;
// }
//
// return Math.max(event.ammount, Math.min(50F, summery.protectionPoints));
// }
else if (event.source.isUnblockable() || event.source.canHarmInCreative()) {
summery.entropy += 3;
if (summery.entropy > 100) {
@@ -83,9 +97,7 @@ public class ModHelper {
}
public static boolean isGregTechTileEntityOre(TileEntity te) {
if (!isGregTechInstalled) return false;
else if (te instanceof gregtech.common.blocks.GT_TileEntity_Ores) return true;
else return false;
return isGregTechInstalled && GTores.isInstance(te) || isGregTechInstalled && Loader.isModLoaded("bartworks") && bwores.isInstance(te);
}
}