diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-12 20:48:13 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-12 20:48:13 +0100 |
commit | 800119d6a1e75ffd0201a9dfc44c53a7604a9f37 (patch) | |
tree | cf24750911b3325dba459dc76f19684c15fb535d | |
parent | 36cae46b02a783e2ef4887b614934b4df72bcf5a (diff) | |
download | GT5-Unofficial-800119d6a1e75ffd0201a9dfc44c53a7604a9f37.tar.gz GT5-Unofficial-800119d6a1e75ffd0201a9dfc44c53a7604a9f37.tar.bz2 GT5-Unofficial-800119d6a1e75ffd0201a9dfc44c53a7604a9f37.zip |
+ Added Reliquary support.
$ Fixed #527.
$ Fixed Sugar Coke Recipe.
11 files changed, 332 insertions, 8 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 9813e550ad..8c8b973dc9 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -69,7 +69,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") -@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts;") +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts; after:xreliquary;") public class GTplusplus implements ActionListener { public static enum INIT_PHASE { diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java index 7ec418cbb1..55e0f4c571 100644 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java @@ -18,6 +18,7 @@ import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.RandomPositionGenerator; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.player.EntityPlayer; @@ -66,7 +67,7 @@ public class EntityBatKing extends EntityMob implements IRangedAttackMob { //this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); - this.targetTasks.addTask(2, this.aiAttack); + //this.targetTasks.addTask(2, this.aiAttack); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBat.class, 0, false)); @@ -123,7 +124,7 @@ public class EntityBatKing extends EntityMob implements IRangedAttackMob { * colliding. */ public boolean canBePushed() { - return false; + return true; } protected void collideWithEntity(Entity aEntity) { @@ -145,10 +146,10 @@ public class EntityBatKing extends EntityMob implements IRangedAttackMob { this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250.0D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(32.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120.0D); } public boolean getIsBatHanging() { @@ -215,6 +216,15 @@ public class EntityBatKing extends EntityMob implements IRangedAttackMob { } } + else { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this, 32, 20); + if (vec3 != null) { + double xPosition = vec3.xCoord; + double yPosition = vec3.yCoord; + double zPosition = vec3.zCoord; + this.getNavigator().tryMoveToXYZ(xPosition, yPosition, zPosition, 3); + } + } } } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index d6a24d718a..b7efcf08ea 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -13,6 +13,7 @@ import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.growthcraft.HANDLER_GC; import gtPlusPlus.xmod.ic2.HANDLER_IC2; import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft; +import gtPlusPlus.xmod.reliquary.HANDLER_Reliquary; import gtPlusPlus.xmod.sc2.HANDLER_SC2; import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; @@ -35,6 +36,7 @@ public class COMPAT_IntermodStaging { HANDLER_GalactiCraft.preInit(); HANDLER_CropsPlusPlus.preInit(preinit); HANDLER_Railcraft.preInit(); + HANDLER_Reliquary.preInit(); } public static void init(FMLInitializationEvent init){ @@ -52,6 +54,7 @@ public class COMPAT_IntermodStaging { HANDLER_GalactiCraft.init(); HANDLER_CropsPlusPlus.init(init); HANDLER_Railcraft.init(); + HANDLER_Reliquary.init(); } public static void postInit(FMLPostInitializationEvent postinit){ @@ -69,6 +72,7 @@ public class COMPAT_IntermodStaging { HANDLER_GalactiCraft.postInit(); HANDLER_CropsPlusPlus.postInit(postinit); HANDLER_Railcraft.postInit(); + HANDLER_Reliquary.postInit(); } public static void onLoadComplete(FMLLoadCompleteEvent event) { diff --git a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java index 04467091c0..3c7ea9d2c9 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java @@ -11,6 +11,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.DevHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -28,7 +29,7 @@ public class FireProtectionBauble extends BaseBauble { private static Field isImmuneToFire; static { - isImmuneToFire = ReflectionUtils.getField(Entity.class, "isImmuneToFire"); + isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.IsObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire"); } public static boolean fireImmune(Entity aEntity) { diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 5a2b75337b..d96875b811 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -55,6 +55,7 @@ public class LoadedMods { public static boolean Witchery = false; public static boolean Waila = false; public static boolean CropsPlusPlus = false; //Barts Crop Mod + public static boolean Reliquary = false; @@ -102,6 +103,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: Crops++"); totalMods++; } + if (Loader.isModLoaded("xreliquary")) { + Reliquary = true; + Logger.INFO("Components enabled for: Reliquary"); + totalMods++; + } if (Loader.isModLoaded("TConstruct")){ TiCon = true; Logger.INFO("Components enabled for: Tinkers Construct"); diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index efc86122e2..19e42735d7 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -813,5 +813,17 @@ public class ReflectionUtils { return false; } + public static Object getFieldValue(Field field) { + return getFieldValue(field, null); + } + + public static Object getFieldValue(Field field, Object instance) { + try { + return field.get(instance); + } catch (IllegalArgumentException | IllegalAccessException e) { + } + return null; + } + } diff --git a/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java b/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java index b146e00830..a21a759a77 100644 --- a/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java +++ b/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java @@ -56,7 +56,7 @@ public class HANDLER_Railcraft { private static void generateCokeOvenRecipes() { ItemStack[] aInputs1 = new ItemStack[] { ItemUtils.getSimpleStack(Blocks.cactus), - ItemUtils.getSimpleStack(Blocks.reeds) + ItemUtils.getSimpleStack(Items.reeds) }; ItemStack[] aInputs2 = new ItemStack[] { ItemUtils.getSimpleStack(ModItems.itemCactusCharcoal), diff --git a/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java b/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java new file mode 100644 index 0000000000..7ebb4c7b1f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.reliquary; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.reliquary.util.ReliquaryRecipeHandler; + +public class HANDLER_Reliquary { + + public static void preInit() { + if (LoadedMods.Reliquary) { + + } + } + + public static void init() { + if (LoadedMods.Reliquary) { + + } + } + + public static void postInit() { + if (LoadedMods.Reliquary) { + ReliquaryRecipeHandler.gregifyDefaultRecipes(); + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java b/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java new file mode 100644 index 0000000000..c0db095346 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java @@ -0,0 +1,161 @@ +package gtPlusPlus.xmod.reliquary.item; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import xreliquary.Reliquary; + +public class ReliquaryItems { + + private static Class<?> CLASS_MAIN = ReflectionUtils.getClass("xreliquary.Reliquary"); + private static Field FIELD_CONTENT = ReflectionUtils.getField(CLASS_MAIN, "CONTENT"); + private static Object OBJECT_CONTENT = ReflectionUtils.getFieldValue(FIELD_CONTENT); + private static Method METHOD_GETITEM = ReflectionUtils.getMethod(OBJECT_CONTENT, "getItem", new Class[] {String.class}); + + public static Item getItem(String name) { + try { + return (Item) METHOD_GETITEM.invoke(OBJECT_CONTENT, name); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } + return null; + } + + public static ItemStack emptyVoidTear() { + return new ItemStack(getItem("void_tear_empty"), 1, 0); + } + + public static ItemStack glowingWater() { + return new ItemStack(getItem("glowing_water")); + } + + public static ItemStack emptyVial() { + return new ItemStack(Reliquary.CONTENT.getItem("potion"), 1, 0); + } + + public static ItemStack emperorChalice() { + return new ItemStack(getItem("emperor_chalice")); + } + + public static ItemStack infernalChalice() { + return new ItemStack(getItem("infernal_chalice")); + } + + public static ItemStack witherSkull() { + return new ItemStack(Items.skull, 1, 1); + } + + public static ItemStack roseBush() { + return new ItemStack(Blocks.double_plant, 1, 4); + } + + public static ItemStack blackWool() { + return new ItemStack(Blocks.wool, 1, 15); + } + + public static ItemStack lapis() { + return new ItemStack(Items.dye, 1, 4); + } + + public static ItemStack gunPart(int i, int m) { + return new ItemStack(getItem("gun_part"), i, m); + } + + public static ItemStack magazine(int m) { + return magazine(1, m); + } + + public static ItemStack magazine(int i, int m) { + return new ItemStack(getItem("magazine"), i, m); + } + + public static ItemStack bullet(int m) { + return bullet(1, m); + } + + public static ItemStack bullet(int i, int m) { + return new ItemStack(getItem("bullet"), i, m); + } + + public static ItemStack ingredient(int m) { + return new ItemStack(getItem("mob_ingredient"), 1, m); + } + + public static ItemStack enderHeart() { + return ingredient(11); + } + + public static ItemStack creeperGland() { + return ingredient(3); + } + + public static ItemStack slimePearl() { + return ingredient(4); + } + + public static ItemStack batWing() { + return ingredient(5); + } + + public static ItemStack ribBone() { + return ingredient(0); + } + + public static ItemStack witherRib() { + return ingredient(1); + } + + public static ItemStack stormEye() { + return ingredient(8); + } + + public static ItemStack fertileEssence() { + return ingredient(9); + } + + public static ItemStack frozenCore() { + return ingredient(10); + } + + public static ItemStack moltenCore() { + return ingredient(7); + } + + public static ItemStack zombieHeart() { + return ingredient(6); + } + + public static ItemStack infernalClaw() { + return ingredient(13); + } + + public static ItemStack shellFragment() { + return ingredient(14); + } + + public static ItemStack squidBeak() { + return ingredient(12); + } + + public static ItemStack spiderFangs() { + return ingredient(2); + } + + public static ItemStack heartPearl(int m) { + return new ItemStack(getItem("heart_pearl"), 1, m); + } + + public static ItemStack nianZhu(int m) { + return new ItemStack(getItem("heart_zhu"), 1, m); + } + + public static ItemStack emptyVoidSatchel() { + return new ItemStack(getItem("void_tear_empty"), 1, 0); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java b/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java new file mode 100644 index 0000000000..6086b74ec4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java @@ -0,0 +1,47 @@ +package gtPlusPlus.xmod.reliquary.util; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; + +public class AlkahestRecipeWrapper { + public ItemStack item = null; + public int yield = 0; + public int cost = 0; + public String dictionaryName = null; + + public AlkahestRecipeWrapper(ItemStack par1, int par2, int par3) { + this.item = par1; + this.yield = par2; + this.cost = par3; + } + + public AlkahestRecipeWrapper(String par1, int par2, int par3) { + this.dictionaryName = par1; + this.yield = par2; + this.cost = par3; + } + + public Object getOriginalRecipe() { + try { + Constructor<?> o; + if (dictionaryName == null) { + o = ReflectionUtils.getClass("xreliquary.util.alkahestry.AlkahestRecipe").getConstructor(ItemStack.class, int.class, int.class); + } + else { + o = ReflectionUtils.getClass("xreliquary.util.alkahestry.AlkahestRecipe").getConstructor(String.class, int.class, int.class); + } + + Object r = o.newInstance(dictionaryName == null ? item : dictionaryName, yield, cost); + if (r != null) { + return r; + } + + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + // oops + } + return null; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java b/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java new file mode 100644 index 0000000000..b79a4f45a5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java @@ -0,0 +1,57 @@ +package gtPlusPlus.xmod.reliquary.util; + +import static gtPlusPlus.core.lib.CORE.GTNH; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.reliquary.item.ReliquaryItems; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class ReliquaryRecipeHandler { + + public static boolean removeAlkahestRecipe(ItemStack aOutput) { + return false; + } + + public static boolean addAlkahestRecipe(ItemStack[] aInputs, ItemStack aOutput) { + if (aInputs == null || aInputs.length <= 0 || aInputs.length > 9) { + return false; + } + return false; + } + + public static void gregifyDefaultRecipes() { + Logger.INFO("Gregifying Reliquary recipes."); + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.glowingWater())) { + Logger.INFO("Removing recipe for Glowing Water."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.emptyVoidTear())) { + Logger.INFO("Removing recipe for Empty Void Tears."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.emperorChalice())) { + Logger.INFO("Removing recipe for the Emperor Chalice."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.infernalChalice())) { + Logger.INFO("Removing recipe for the Infernal Chalice."); + } + Logger.INFO("Finished removing original recipes."); + + // Add new recipes + if (GT_Values.RA.addChemicalRecipe(ALLOY.ENERGYCRYSTAL.getDust(4), ReliquaryItems.emptyVial(), FluidUtils.getHotWater(2000), null, ReliquaryItems.glowingWater(), 20 * 30, 500)) { + Logger.INFO("Added new recipe for Glowing Water."); + } + if (CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.simpleMetaStack(Items.ender_eye, 0, 32), CI.getFieldGenerator(5, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), CI.getEmitter(3, 20)}, FluidUtils.getUUM(50), ReliquaryItems.emptyVoidTear(), 20 * 2000, 2000)){ + Logger.INFO("Added new recipe for Empty Void Tears."); + } + Logger.INFO("Finished adding new recipes."); + + } +} |