From 0dac2eeee906879fab6eadb4c839e6aca8066cd6 Mon Sep 17 00:00:00 2001 From: HellFirePvP Date: Sun, 10 Jan 2016 15:56:59 +0100 Subject: [PATCH] - Added aura effect blacklist - Added more future familiar rework stuff - Rewrote all ResearchItems to mod-internal SimpleResearchItems - Fix for issue with non-intended merging golem core stacks --- .../common/aura/AuraEffectHandler.java | 3 +- .../common/aura/AuraResearchManager.java | 12 +- .../DeprecationItemPaybacks.java | 3 +- .../FamiliarAugmentInfusion.java | 2 +- .../common/data/config/ModConfig.java | 24 ++++ .../common/familiar/FamiliarController.java | 124 ++++++++++++++---- .../gadomancy/common/items/ItemAuraCore.java | 4 +- .../common/items/ItemGolemCoreBreak.java | 2 + .../items/baubles/ItemFamiliar_Old.java | 8 +- .../registration/RegisteredRecipes.java | 7 +- .../registration/RegisteredResearches.java | 99 +++++++------- .../research/IfAnyParentResearchItem.java | 52 ++++++++ .../common/research/SimpleResearchItem.java | 2 + 13 files changed, 245 insertions(+), 97 deletions(-) rename src/main/java/makeo/gadomancy/common/{registration => crafting}/DeprecationItemPaybacks.java (99%) rename src/main/java/makeo/gadomancy/common/{registration => crafting}/FamiliarAugmentInfusion.java (98%) create mode 100644 src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java diff --git a/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java b/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java index 1e9a58c..957f62c 100644 --- a/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java +++ b/src/main/java/makeo/gadomancy/common/aura/AuraEffectHandler.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.aura; import makeo.gadomancy.api.AuraEffect; +import makeo.gadomancy.common.data.config.ModConfig; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; @@ -27,7 +28,7 @@ public class AuraEffectHandler { public static Map registeredEffects = new HashMap(); public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, int tick) { - if(!registeredEffects.containsKey(aspect) || worldObj.isRemote) return; + if(!registeredEffects.containsKey(aspect) || worldObj.isRemote || AuraResearchManager.isBlacklisted(aspect)) return; AuraEffect effect = registeredEffects.get(aspect); if((tick % effect.getTickInterval()) != 0) return; diff --git a/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java b/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java index 6ae1ccc..070375e 100644 --- a/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java +++ b/src/main/java/makeo/gadomancy/common/aura/AuraResearchManager.java @@ -1,6 +1,7 @@ package makeo.gadomancy.common.aura; import makeo.gadomancy.common.Gadomancy; +import makeo.gadomancy.common.data.config.ModConfig; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketTCNotificationText; import net.minecraft.client.Minecraft; @@ -30,6 +31,7 @@ public class AuraResearchManager { public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) { if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return; + if(isBlacklisted(aspect)) return; if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return; if(!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return; @@ -61,12 +63,20 @@ public class AuraResearchManager { List lines = new ArrayList(); for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) { if(ResearchManager.isResearchComplete(player.getCommandSenderName(), String.format(TC_AURA_RESEARCH_STR, a.getTag()))) { - lines.add(a.getTag()); + if(!isBlacklisted(a)) lines.add(a.getTag()); } } return lines; } + public static boolean isBlacklisted(Aspect a) { + for(String aspectTag : ModConfig.blacklistAuraEffects) { + if(aspectTag == null) continue; + if(aspectTag.equals(a.getTag())) return true; + } + return false; + } + public static void registerAuraResearches() { for(Aspect a : AuraEffectHandler.registeredEffects.keySet()) { new ResearchItem(String.format(TC_AURA_RESEARCH_STR, a.getTag()), Gadomancy.MODID).registerResearchItem(); diff --git a/src/main/java/makeo/gadomancy/common/registration/DeprecationItemPaybacks.java b/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java similarity index 99% rename from src/main/java/makeo/gadomancy/common/registration/DeprecationItemPaybacks.java rename to src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java index f7ee27d..efb9ca6 100644 --- a/src/main/java/makeo/gadomancy/common/registration/DeprecationItemPaybacks.java +++ b/src/main/java/makeo/gadomancy/common/crafting/DeprecationItemPaybacks.java @@ -1,5 +1,6 @@ -package makeo.gadomancy.common.registration; +package makeo.gadomancy.common.crafting; +import makeo.gadomancy.common.registration.RegisteredItems; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import thaumcraft.api.aspects.Aspect; diff --git a/src/main/java/makeo/gadomancy/common/registration/FamiliarAugmentInfusion.java b/src/main/java/makeo/gadomancy/common/crafting/FamiliarAugmentInfusion.java similarity index 98% rename from src/main/java/makeo/gadomancy/common/registration/FamiliarAugmentInfusion.java rename to src/main/java/makeo/gadomancy/common/crafting/FamiliarAugmentInfusion.java index 1b5e151..fd48845 100644 --- a/src/main/java/makeo/gadomancy/common/registration/FamiliarAugmentInfusion.java +++ b/src/main/java/makeo/gadomancy/common/crafting/FamiliarAugmentInfusion.java @@ -1,4 +1,4 @@ -package makeo.gadomancy.common.registration; +package makeo.gadomancy.common.crafting; import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java index acd567a..7886807 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java +++ b/src/main/java/makeo/gadomancy/common/data/config/ModConfig.java @@ -2,8 +2,11 @@ package makeo.gadomancy.common.data.config; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import thaumcraft.api.aspects.Aspect; import java.io.File; +import java.util.ArrayList; +import java.util.List; /** * This class is part of the Gadomancy Mod @@ -29,6 +32,10 @@ public class ModConfig { public static int golemDatawatcherId = 29; @Sync public static int dimOuterId = -73; + + @Sync + public static String[] blacklistAuraEffects = new String[0]; + public static boolean doLightCalculations = true; public static int maxMazeCount = -1; public static int renderParticleDistance = 100; @@ -51,6 +58,7 @@ public class ModConfig { } private static void loadFromConfig() { + //Datawatcher entity stuff entityNoClipItemDatawatcherMasterId = config.getInt("itemNoClipDatawatcherMasterId", "entities", 19, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Master-Coordinates for EntityNoClipItem"); entityNoClipItemDatawatcherFixedId = config.getInt("itemNoClipDatawatcherFixId", "entities", 20, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Fixed-Coordinates for EntityNoClipItem"); @@ -58,19 +66,35 @@ public class ModConfig { golemDatawatcherId = config.getInt("datawatcherId", "golem", 29, 0, 31, "Do not edit unless you know what are you doing!"); + //Dimension stuff dimOuterId = config.getInt("dimOuterId", "dimension", -73, Integer.MIN_VALUE, Integer.MAX_VALUE, "Dimension Id for the eldrich mazes accessed via Node Manipulator"); doLightCalculations = config.getBoolean("calculateEldritchLight", "dimension", true, "TRUE = Calculating Light values for the Gadomancy-Eldritch Mazes; FALSE = No calculation, but some Light Bugs - Calculating the Light takes ~2 seconds -> Can be measured when trying to enter the eldritch mazed via Gadomancy Eldritch portal."); maxMazeCount = config.getInt("maxMazeCount", "dimension", -1, -1, Integer.MAX_VALUE, "Defines how many Eldritch mazes may exist at the same time using the Gadomancy Eldritch ritual. (-1 = infinite) Note that 1 maze = 1 player; Once the player finishes the maze, the maze closes itself and teleports the player out."); + //Skyblock stuff ancientStoneRecipes = config.getBoolean("ancientStoneRecipes", "skyblock", false, "TRUE = Adds recipes for Ancient Stone and Ancient Stone Pedestal (This may be usefull for severs and skyblock packs to craft the Node Manipulator and get more primodial pearls). You have to change this client- and server-side!"); + //General stuff renderParticleDistance = config.getInt("particleRenderDistance", "general", 100, 5, 1000, "Defines, how close a player has to be towards the particle origin to see the particles created by it."); enableAdditionalNodeTypes = config.getBoolean("enableAdditionalNodeTypes", "general", true, "Enables our custom node types. This might solve some compatibility issues (e.g. WitchingGadgets). You have to change this client- and server-side! Only change when you experience issues with special mods' features ONLY not working when using the mod together with Gadomancy."); + String listOfAspects = config.getString("auraPylonBlacklist", "general", "", "Write a list of aspects (e.g. aura,aer) here that should not be active/obtainable with the aura pylon. Multiple aspects can be seperated with ','. Leave it empty to blacklist nothing"); + blacklistAuraEffects = refactorAspects(listOfAspects); config.addCustomCategoryComment("potions", "Use the following if you have problems with conflicting potion ids. If the entry is set to '-1' it will try to automatically find the lowest free potion id."); config.addCustomCategoryComment("enchantments", "Use the following if you have problems with conflicting enchantment ids. If the entry is set to '-1' it will try to automatically find the lowest free enchantment id."); } + private static String[] refactorAspects(String listOfAspects) { + List aspects = new ArrayList(); + if(listOfAspects != null && listOfAspects.length() > 0) { + String[] aspectTags = listOfAspects.split(","); + for (String s : aspectTags) { + if(Aspect.getAspect(s) != null) aspects.add(s); + } + } + return aspects.toArray(new String[aspects.size()]); + } + public static int loadPotionId(String name) { return loadId("potions", name); } diff --git a/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java b/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java index 0bb071e..debd7cd 100644 --- a/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java +++ b/src/main/java/makeo/gadomancy/common/familiar/FamiliarController.java @@ -5,7 +5,6 @@ import cpw.mods.fml.common.network.NetworkRegistry; import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar; import makeo.gadomancy.common.network.PacketHandler; import makeo.gadomancy.common.network.packets.PacketFamiliarBolt; -import makeo.gadomancy.common.network.packets.PacketStartAnimation; import makeo.gadomancy.common.utils.MiscUtils; import makeo.gadomancy.common.utils.Vector3; import net.minecraft.entity.EntityLivingBase; @@ -17,7 +16,10 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; +import thaumcraft.api.aspects.AspectList; import thaumcraft.common.config.Config; +import thaumcraft.common.items.baubles.ItemAmuletVis; +import thaumcraft.common.items.wands.ItemWandCasting; import java.util.ArrayList; import java.util.Iterator; @@ -58,40 +60,81 @@ public class FamiliarController { public void tick() { IInventory baubles = BaublesApi.getBaubles(owningPlayer); ItemStack stack = baubles.getStackInSlot(0); - if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return; + if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return; - if(tickLastEffect > 0) { + if (tickLastEffect > 0) { tickLastEffect--; return; } FamiliarAugment.FamiliarAugmentList augments = ItemEtherealFamiliar.getAugments(stack); - if(augments == null) return; + if (augments == null) return; - if(augments.isEmpty()) { + if (augments.isEmpty()) { doDefaultAttack(); tickLastEffect = AS_DELAY_DEF; } else { FamiliarAugment.FamiliarAugmentPair effectElement = null; for (FamiliarAugment.FamiliarAugmentPair pair : augments) { FamiliarAugment augment = pair.augment; - if(augment.equals(FamiliarAugment.SHOCK) || augment.equals(FamiliarAugment.FIRE) + if (augment.equals(FamiliarAugment.SHOCK) || augment.equals(FamiliarAugment.FIRE) || augment.equals(FamiliarAugment.POISON) || augment.equals(FamiliarAugment.WEAKNESS)) { effectElement = pair; break; } } + AspectList costs = new AspectList(); + int dmgLevel = augments.getLevel(FamiliarAugment.DAMAGE_INCREASE); + if (dmgLevel > 0) { + for (int i = 0; i < dmgLevel; i++) { + costs.add(FamiliarAugment.DAMAGE_INCREASE.getCostsPerLevel()); + } + } + int attackSpeedLevel = augments.getLevel(FamiliarAugment.ATTACK_SPEED); + if (attackSpeedLevel > 0) { + for (int i = 0; i < attackSpeedLevel; i++) { + costs.add(FamiliarAugment.ATTACK_SPEED.getCostsPerLevel()); + } + } + int rangeLevel = augments.getLevel(FamiliarAugment.RANGE_INCREASE); + if (rangeLevel > 0) { + for (int i = 0; i < rangeLevel; i++) { + costs.add(FamiliarAugment.RANGE_INCREASE.getCostsPerLevel()); + } + } + double damage = DMG_DEF + (dmgLevel != -1 ? DMG_INC * dmgLevel : 0); int ticksUntilNextAttack = AS_DELAY_DEF - (attackSpeedLevel != -1 ? AS_INC * attackSpeedLevel : 0); double range = RANGE_DEF + (rangeLevel != -1 ? RANGE_INC * rangeLevel : 0); - if(effectElement == null) { - if(doEnhancedDefaultAttack(damage, range)) tickLastEffect = ticksUntilNextAttack; + + if(effectElement != null) { + for (int i = 0; i < effectElement.level; i++) { + costs.add(effectElement.augment.getCostsPerLevel()); + } + } + + if (!owningPlayer.capabilities.isCreativeMode && !consumeVisFromInventory(owningPlayer, costs, false)) { + return; + } + + if (effectElement == null) { + if (doEnhancedDefaultAttack(damage, range)) { + tickLastEffect = ticksUntilNextAttack; + if(!owningPlayer.capabilities.isCreativeMode && RAND.nextInt(3) == 0) { + consumeVisFromInventory(owningPlayer, costs, true); + } + } } else { - if(doAttack(effectElement, damage, range)) tickLastEffect = ticksUntilNextAttack; + if (doAttack(effectElement, damage, range)) { + tickLastEffect = ticksUntilNextAttack; + if(!owningPlayer.capabilities.isCreativeMode && RAND.nextInt(3) == 0) { + consumeVisFromInventory(owningPlayer, costs, true); + } + } } } } @@ -101,59 +144,60 @@ public class FamiliarController { int effectLevel = element.level; FamiliarAugment augment = element.augment; int boltType = 6; - if(augment.equals(FamiliarAugment.SHOCK)) { + if (augment.equals(FamiliarAugment.SHOCK)) { boltType = 1; damage += effectLevel * SHOCK_DMG_INC; - } else if(augment.equals(FamiliarAugment.FIRE)) { + } else if (augment.equals(FamiliarAugment.FIRE)) { boltType = 4; damage += effectLevel * FIRE_DMG_INC; - } else if(augment.equals(FamiliarAugment.POISON)) { + } else if (augment.equals(FamiliarAugment.POISON)) { boltType = 3; range += effectLevel * POISON_RANGE_INC; - } else if(augment.equals(FamiliarAugment.WEAKNESS)) { + } else if (augment.equals(FamiliarAugment.WEAKNESS)) { boltType = 5; damage -= effectLevel * WEAKNESS_DMG_DEC; - if(effectLevel == 3) toSelect = 3; + if (effectLevel == 3) toSelect = 3; } List toAttack = selectEntityToAttack(range, toSelect); - if(toAttack == null || toAttack.isEmpty()) return false; + if (toAttack == null || toAttack.isEmpty()) return false; for (EntityLivingBase entity : toAttack) { attack(entity, damage, boltType); } - if(augment.equals(FamiliarAugment.SHOCK)) { + if (augment.equals(FamiliarAugment.SHOCK)) { for (EntityLivingBase entity : toAttack) { - if(RAND.nextInt(3) == 0) { + if (RAND.nextInt(3) == 0) { Vector3 vel = MiscUtils.getPositionVector(entity).subtract(MiscUtils.getPositionVector(owningPlayer)) .normalize().divide(2).multiply(0.5 * effectLevel); + if (vel.getY() < 0) vel.setY(-vel.getY()); entity.motionX += vel.getX(); entity.motionY += vel.getY(); entity.motionZ += vel.getZ(); } } - } else if(augment.equals(FamiliarAugment.FIRE)) { + } else if (augment.equals(FamiliarAugment.FIRE)) { int fireDur = 14; for (int i = 0; i < effectLevel; i++) { fireDur *= 2; } for (EntityLivingBase entity : toAttack) { entity.setFire(fireDur); - if(effectLevel == 3) { + if (effectLevel == 3) { entity.addPotionEffect(new PotionEffect(Config.potionSunScornedID, MiscUtils.ticksForMinutes(1), 2)); } } - } else if(augment.equals(FamiliarAugment.POISON)) { + } else if (augment.equals(FamiliarAugment.POISON)) { int potionLvl = 0; - if(effectLevel > 1) potionLvl += 1; + if (effectLevel > 1) potionLvl += 1; for (EntityLivingBase entity : toAttack) { entity.addPotionEffect(new PotionEffect(Potion.poison.getId(), MiscUtils.ticksForSeconds(30), potionLvl)); - if(effectLevel == 3) { + if (effectLevel == 3) { entity.addPotionEffect(new PotionEffect(Potion.hunger.getId(), MiscUtils.ticksForMinutes(2), 3)); } } - } else if(augment.equals(FamiliarAugment.WEAKNESS)) { + } else if (augment.equals(FamiliarAugment.WEAKNESS)) { int potionLvl = 0; - if(effectLevel == 3) potionLvl++; + if (effectLevel == 3) potionLvl++; int dur = MiscUtils.ticksForSeconds(30); for (EntityLivingBase entity : toAttack) { entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), dur, potionLvl)); @@ -163,9 +207,31 @@ public class FamiliarController { return true; } + public static boolean consumeVisFromInventory(EntityPlayer player, AspectList cost, boolean doit) { + IInventory baubles = BaublesApi.getBaubles(player); + for (int a = 0; a < 4; a++) { + if ((baubles.getStackInSlot(a) != null) && ((baubles.getStackInSlot(a).getItem() instanceof ItemAmuletVis))) { + boolean done = ((ItemAmuletVis) baubles.getStackInSlot(a).getItem()).consumeAllVis(baubles.getStackInSlot(a), player, cost, doit, true); + if (done) { + return true; + } + } + } + for (int a = player.inventory.mainInventory.length - 1; a >= 0; a--) { + ItemStack item = player.inventory.mainInventory[a]; + if ((item != null) && ((item.getItem() instanceof ItemWandCasting))) { + boolean done = ((ItemWandCasting) item.getItem()).consumeAllVis(item, player, cost, doit, true); + if (done) { + return true; + } + } + } + return false; + } + private boolean doEnhancedDefaultAttack(double damage, double range) { List toAttack = selectEntityToAttack(range, 1); - if(toAttack == null || toAttack.isEmpty()) return false; + if (toAttack == null || toAttack.isEmpty()) return false; attack(toAttack.get(0), damage, 6); return true; @@ -173,7 +239,7 @@ public class FamiliarController { private boolean doDefaultAttack() { List toAttack = selectEntityToAttack(RANGE_DEF, 1); - if(toAttack == null || toAttack.isEmpty()) return false; + if (toAttack == null || toAttack.isEmpty()) return false; attack(toAttack.get(0), DMG_DEF, 6); return true; @@ -189,9 +255,9 @@ public class FamiliarController { private List selectEntityToAttack(double rad, int amountToSelectMax) { List attackable = getAttackableEntities(rad); - if(attackable.size() <= 0) return null; + if (attackable.size() <= 0) return null; List entities = new ArrayList(); - if(attackable.size() <= amountToSelectMax) { + if (attackable.size() <= amountToSelectMax) { entities.addAll(attackable); } else { for (int i = 0; i < amountToSelectMax; i++) { @@ -211,7 +277,7 @@ public class FamiliarController { Iterator it = entities.iterator(); while (it.hasNext()) { EntityLivingBase base = it.next(); - if(base == null || base.isDead || base instanceof EntityPlayer || !(base instanceof IMob)) it.remove(); + if (base == null || base.isDead || base instanceof EntityPlayer || !(base instanceof IMob)) it.remove(); //TODO remove entities we don't want to attack... } diff --git a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java index 96a749d..126e8ea 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemAuraCore.java @@ -117,10 +117,10 @@ public class ItemAuraCore extends Item { BLANK("blank"), AIR(Aspect.AIR), - FIRE(Aspect.FIRE, true), + FIRE(Aspect.FIRE), WATER(Aspect.WATER, true), EARTH(Aspect.EARTH, true), - ORDER(Aspect.ORDER), + ORDER(Aspect.ORDER, true), ENTROPY(Aspect.ENTROPY, true); private final Aspect aspect; diff --git a/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java b/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java index c2ce592..3914645 100644 --- a/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java +++ b/src/main/java/makeo/gadomancy/common/items/ItemGolemCoreBreak.java @@ -23,7 +23,9 @@ import java.util.List; */ //TODO rename when updating to 1.8 public class ItemGolemCoreBreak extends Item { + public ItemGolemCoreBreak() { + setHasSubtypes(true); setCreativeTab(RegisteredItems.creativeTab); } diff --git a/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java b/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java index 9847259..f420cbb 100644 --- a/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java +++ b/src/main/java/makeo/gadomancy/common/items/baubles/ItemFamiliar_Old.java @@ -5,7 +5,7 @@ import baubles.api.IBauble; import makeo.gadomancy.common.Gadomancy; import makeo.gadomancy.common.data.DataFamiliar; import makeo.gadomancy.common.data.SyncDataHolder; -import makeo.gadomancy.common.registration.DeprecationItemPaybacks; +import makeo.gadomancy.common.crafting.DeprecationItemPaybacks; import makeo.gadomancy.common.registration.RegisteredItems; import makeo.gadomancy.common.utils.NBTHelper; import net.minecraft.creativetab.CreativeTabs; @@ -14,17 +14,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; import thaumcraft.common.Thaumcraft; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.config.ConfigItems; -import thaumcraft.common.items.ItemEssence; -import thaumcraft.common.items.ItemWispEssence; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java index cdf712a..9b057b6 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredRecipes.java @@ -3,6 +3,7 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.registry.GameRegistry; import makeo.gadomancy.api.golems.AdditionalGolemType; import makeo.gadomancy.common.Gadomancy; +import makeo.gadomancy.common.crafting.FamiliarAugmentInfusion; import makeo.gadomancy.common.crafting.InfusionDisguiseArmor; import makeo.gadomancy.common.crafting.InfusionUpgradeRecipe; import makeo.gadomancy.common.crafting.RecipeStickyJar; @@ -214,11 +215,11 @@ public class RegisteredRecipes { new AspectList().add(Aspect.ORDER, 80).add(Aspect.WATER, 50).add(Aspect.FIRE, 50).add(Aspect.AIR, 50), "TST", "S S", "TJT", 'T', new ItemStack(ConfigBlocks.blockTube, 1, 6), 'S', new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), 'J', new ItemStack(ConfigBlocks.blockJar, 1, 0)); - ItemStack ordoCore = new ItemStack(RegisteredItems.itemAuraCore); - RegisteredItems.itemAuraCore.setCoreType(ordoCore, ItemAuraCore.AuraCoreType.FIRE); + ItemStack ignisCore = new ItemStack(RegisteredItems.itemAuraCore); + RegisteredItems.itemAuraCore.setCoreType(ignisCore, ItemAuraCore.AuraCoreType.FIRE); recipeAuraPylonPeak = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), new AspectList().add(Aspect.ORDER, 120).add(Aspect.FIRE, 90).add(Aspect.AIR, 70), - " N ", "ACA", " P ", 'A', new ItemStack(ConfigItems.itemResource, 1, 0), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'C', ordoCore, 'P', new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0)); + " N ", "ACA", " P ", 'A', new ItemStack(ConfigItems.itemResource, 1, 0), 'N', new ItemStack(ConfigItems.itemResource, 1, 1), 'C', ignisCore, 'P', new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 0)); ItemStack aerCore = new ItemStack(RegisteredItems.itemAuraCore); RegisteredItems.itemAuraCore.setCoreType(aerCore, ItemAuraCore.AuraCoreType.AIR); diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java index 8f6500e..e739d0d 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredResearches.java @@ -136,51 +136,47 @@ public class RegisteredResearches { .setParents(researchFocusPrimal.key, researchItemVoidMetal.key, researchWandPedestal.key, researchCoreUse.key).setConcealed() .setPages(new ResearchPage("gadomancy.research_page.INFUSIONCLAW.1"), new ResearchPage(RegisteredRecipes.recipeInfusionClaw), new ResearchPage("gadomancy.research_page.INFUSIONCLAW.2")).registerResearchItem(); - researchNodeManipulator = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR", Gadomancy.MODID, - new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.AURA, 6).add(Aspect.DARKNESS, 4).add(Aspect.MAGIC, 8).add(Aspect.GREED, 4).add(Aspect.VOID, 10).add(Aspect.MECHANISM, 6).add(Aspect.EXCHANGE, 4), - -9, -4, 2, new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5)) + researchNodeManipulator = new SimpleResearchItem("NODE_MANIPULATOR", -9, -4, 2, new ItemStack(RegisteredBlocks.blockNodeManipulator, 1, 5), + new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.AURA, 6).add(Aspect.DARKNESS, 4).add(Aspect.MAGIC, 8).add(Aspect.GREED, 4).add(Aspect.VOID, 10).add(Aspect.MECHANISM, 6).add(Aspect.EXCHANGE, 4)) .setConcealed().setSpecial() .setParents(researchItemVoidMetal.key, researchNodeStabilizer.key, researchWardingStone.key, researchWandPedestal.key) .setPages(new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.1"), new ResearchPage(RegisteredRecipes.recipeNodeManipulator), new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.3"), new ResearchPage(RegisteredRecipes.recipeRandomizationFocus), new ResearchPage(RegisteredRecipes.multiblockNodeManipulator), new ResearchPage("gadomancy.research_page.NODE_MANIPULATOR.6")).registerResearchItem(); - researchEldritchPortalCreator = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".E_PORTAL_CREATOR", Gadomancy.MODID, - new AspectList().add(Aspect.ELDRITCH, 6).add(Aspect.DARKNESS, 10).add(Aspect.TRAVEL, 8).add(Aspect.AURA, 10).add(Aspect.VOID, 6).add(Aspect.MECHANISM, 4), - -10, 0, 2, new ItemStack(RegisteredBlocks.blockAdditionalEldrichPortal, 1, 0)) + researchEldritchPortalCreator = new SimpleResearchItem("E_PORTAL_CREATOR", -10, 0, 2, new ItemStack(RegisteredBlocks.blockAdditionalEldrichPortal, 1, 0), + new AspectList().add(Aspect.ELDRITCH, 6).add(Aspect.DARKNESS, 10).add(Aspect.TRAVEL, 8).add(Aspect.AURA, 10).add(Aspect.VOID, 6).add(Aspect.MECHANISM, 4)) .setConcealed().setSpecial() .setParents(researchNodeManipulator.key, researchOculus.key) .setPages(new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.1"), new ResearchPage(RegisteredRecipes.recipeAncientPedestal), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.3"), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.4"), new ResearchPage(RegisteredRecipes.recipePortalFocus), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.6"), new ResearchPage(RegisteredRecipes.multiblockEldritchPortalCreator), new ResearchPage("gadomancy.research_page.E_PORTAL_CREATOR.8")).registerResearchItem(); - researchBlockProtector = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".BLOCK_PROTECTOR", Gadomancy.MODID, - new AspectList().add(Aspect.ORDER, 10).add(Aspect.ARMOR, 8).add(Aspect.EARTH, 12).add(Aspect.LIGHT, 10).add(Aspect.AURA, 8), - 0, -8, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2)) + researchBlockProtector = new SimpleResearchItem("BLOCK_PROTECTOR", 0, -8, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 2), + new AspectList().add(Aspect.ORDER, 10).add(Aspect.ARMOR, 8).add(Aspect.EARTH, 12).add(Aspect.LIGHT, 10).add(Aspect.AURA, 8)) .setConcealed() .setPages(new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.1"), new ResearchPage(RegisteredRecipes.recipeBlockProtector), new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.3"), new ResearchPage("gadomancy.research_page.BLOCK_PROTECTOR.4")).registerResearchItem(); if(ModConfig.enableAdditionalNodeTypes) { - researchGrowingNodes = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".GROWING", Gadomancy.MODID, new AspectList(), -8, -1, 5, new ResourceLocation("thaumcraft", "textures/misc/r_nodes.png")) + researchGrowingNodes = new SimpleResearchItem("GROWING", -8, -1, 5, new ResourceLocation("thaumcraft", "textures/misc/r_nodes.png"), new AspectList()) .setSpecial().setLost().setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".NODE_MANIPULATOR") .setPages(new ResearchPage("gadomancy.research_page.GROWING.1"), new ResearchPage("gadomancy.research_page.GROWING.2")).registerResearchItem(); - researchGrowingNodeAgression = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", Gadomancy.MODID, new AspectList(), -5, 0, 6, new ItemStack(ConfigBlocks.blockAiry, 1, 5)) + researchGrowingNodeAgression = new SimpleResearchItem("GROWING_AGGRESSION", -5, 0, 6, new ItemStack(ConfigBlocks.blockAiry, 1, 5), new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") .setPages(new ResearchPage("gadomancy.research_page.GROWING_AGGRESSION.1")).registerResearchItem(); - researchGrowingNodeGrowth = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", Gadomancy.MODID, new AspectList(), -7, 2, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_star.png")) + researchGrowingNodeGrowth = new SimpleResearchItem("GROWING_GROWTH", -7, 2, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_star.png"), new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") .setPages(new ResearchPage("gadomancy.research_page.GROWING_GROWTH.1"), new ResearchPage("gadomancy.research_page.GROWING_GROWTH.2")).registerResearchItem(); - researchGrowingNodeAttackNodes = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK", Gadomancy.MODID, new AspectList(), -6, 1, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_dark.png")) + researchGrowingNodeAttackNodes = new SimpleResearchItem("GROWING_ATTACK", -6, 1, 6, new ResourceLocation("gadomancy", "textures/misc/r_node_dark.png"), new AspectList()) .setLost() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING") .setPages(new ResearchPage("gadomancy.research_page.GROWING_ATTACK.1")).registerResearchItem(); - researchGrowingNodeGrowthClue = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTHCLUE", Gadomancy.MODID, + researchGrowingNodeGrowthClue = new SimpleResearchItem("GROWING_GROWTHCLUE", -4, 3, 2, new ItemStack(ConfigBlocks.blockAiry, 1, 5), new AspectList().add(Aspect.AURA, 10).add(Aspect.MAGIC, 15).add(Aspect.ELDRITCH, 5).add(Aspect.VOID, 12).add(Aspect.ENERGY, 12).add(Aspect.ENTROPY, 8).add(Aspect.DEATH, 3) - .add(Aspect.GREED, 10).add(Aspect.HUNGER, 10).add(Aspect.MECHANISM, 12).add(Aspect.DARKNESS, 12), - -4, 3, 2, new ItemStack(ConfigBlocks.blockAiry, 1, 5)) + .add(Aspect.GREED, 10).add(Aspect.HUNGER, 10).add(Aspect.MECHANISM, 12).add(Aspect.DARKNESS, 12)) .setSpecial().setRound().setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".GROWING_AGGRESSION", Gadomancy.MODID.toUpperCase() + ".GROWING_GROWTH", Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK") .setPages(new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.1"), new ResearchPage("gadomancy.research_page.GROWING_GROWTHCLUE.2")).registerResearchItem(); @@ -193,27 +189,27 @@ public class RegisteredResearches { ItemStack familiarResearchStack = new ItemStack(RegisteredItems.itemFamiliar_old, 1, 0); NBTHelper.getData(familiarResearchStack).setString("aspect", Aspect.MAGIC.getTag()); - researchFamiliarBasic = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAMILIAR", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 8).add(Aspect.MAGIC, 10).add(Aspect.AIR, 2).add(Aspect.WATER, 2).add(Aspect.EARTH, 2).add(Aspect.FIRE, 2).add(Aspect.ORDER, 2).add(Aspect.ENTROPY, 2), - 3, -2, 2, familiarResearchStack) + researchFamiliarBasic = new SimpleResearchItem("FAMILIAR", + 3, -2, 2, familiarResearchStack, + new AspectList().add(Aspect.AURA, 8).add(Aspect.MAGIC, 10).add(Aspect.AIR, 2).add(Aspect.WATER, 2).add(Aspect.EARTH, 2).add(Aspect.FIRE, 2).add(Aspect.ORDER, 2).add(Aspect.ENTROPY, 2)) .setSpecial().setConcealed() .setParents(nitorResearch.key, runicResearch.key) .setPages(new ResearchPage("gadomancy.research_page.FAMILIAR.1"), new ResearchPage(RegisteredRecipes.recipesFamilar), new ResearchPage("gadomancy.research_page.FAMILIAR.3")).registerResearchItem(); ResearchItem researchTallow = PseudoResearchItem.create("TALLOW", 7, -3).registerResearchItem(); - researchFamiliarAttack_1 = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_1", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 6).add(Aspect.MAGIC, 8).add(Aspect.WEAPON, 6), - 5, -1, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 1)) + researchFamiliarAttack_1 = new SimpleResearchItem("FAM_ATTACK_1", + 5, -1, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 1), + new AspectList().add(Aspect.AURA, 6).add(Aspect.MAGIC, 8).add(Aspect.WEAPON, 6)) .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".FAMILIAR", researchTallow.key) .setPages(new ResearchPage("gadomancy.research_page.FAM_ATTACK_1.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[0])).registerResearchItem(); ResearchItem researchVoidSeed = PseudoResearchItem.create("ELDRITCHMINOR", 8, -2).registerResearchItem(); - researchFamiliarAttack_2 = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_2", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 10).add(Aspect.MAGIC, 12).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 8), - 7, 0, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 2)) + researchFamiliarAttack_2 = new SimpleResearchItem("FAM_ATTACK_2", + 7, 0, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 2), + new AspectList().add(Aspect.AURA, 10).add(Aspect.MAGIC, 12).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 8)) .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_1", researchVoidSeed.key) .setPages(new ResearchPage("gadomancy.research_page.FAM_ATTACK_2.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[1])).registerResearchItem(); @@ -224,23 +220,23 @@ public class RegisteredResearches { ResearchItem researchPrimalFocus2 = PseudoResearchItem.create("FOCUSPRIMAL", 3, 4, true).registerResearchItem(); ResearchItem researchAlumentum = PseudoResearchItem.create("ALUMENTUM", 2, 0).registerResearchItem(); - researchFamiliarAttack_3 = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", Gadomancy.MODID, - new AspectList().add(Aspect.ORDER, 4).add(Aspect.AURA, 6).add(Aspect.FIRE, 6).add(Aspect.MAGIC, 6).add(Aspect.AIR, 6).add(Aspect.ELDRITCH, 8).add(Aspect.WATER, 5).add(Aspect.WEAPON, 8).add(Aspect.ENTROPY, 6).add(Aspect.EARTH, 8), - 8, 2, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 3)) + researchFamiliarAttack_3 = new SimpleResearchItem("FAM_ATTACK_3", + 8, 2, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 3), + new AspectList().add(Aspect.ORDER, 4).add(Aspect.AURA, 6).add(Aspect.FIRE, 6).add(Aspect.MAGIC, 6).add(Aspect.AIR, 6).add(Aspect.ELDRITCH, 8).add(Aspect.WATER, 5).add(Aspect.WEAPON, 8).add(Aspect.ENTROPY, 6).add(Aspect.EARTH, 8)) .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_2", researchPrimodialPearl.key, researchEthBloom.key) .setPages(new ResearchPage("gadomancy.research_page.FAM_ATTACK_3.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[2])).registerResearchItem(); - researchFamiliarRange_1 = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAM_RANGE_1", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 8).add(Aspect.MOTION, 10).add(Aspect.MAGIC, 8).add(Aspect.VOID, 8).add(Aspect.ENERGY, 10), - 4, 1, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 4)) + researchFamiliarRange_1 = new SimpleResearchItem("FAM_RANGE_1", + 4, 1, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 4), + new AspectList().add(Aspect.AURA, 8).add(Aspect.MOTION, 10).add(Aspect.MAGIC, 8).add(Aspect.VOID, 8).add(Aspect.ENERGY, 10)) .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".FAMILIAR", Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_2", researchAlumentum.key) .setPages(new ResearchPage("gadomancy.research_page.FAM_RANGE_1.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[3])).registerResearchItem(); - researchFamiliarCooldown_1 = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAM_COOLDOWN_1", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 12).add(Aspect.MAGIC, 10).add(Aspect.TAINT, 10).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 10).add(Aspect.VOID, 10), - 5, 3, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 5)) + researchFamiliarCooldown_1 = new SimpleResearchItem("FAM_COOLDOWN_1", + 5, 3, 2, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 5), + new AspectList().add(Aspect.AURA, 12).add(Aspect.MAGIC, 10).add(Aspect.TAINT, 10).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 10).add(Aspect.VOID, 10)) .setConcealed() .setParents(Gadomancy.MODID.toUpperCase() + ".FAM_RANGE_1", Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", researchBathSalts.key, researchPrimalFocus2.key) .setPages(new ResearchPage("gadomancy.research_page.FAM_COOLDOWN_1.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[4])).registerResearchItem(); @@ -271,50 +267,49 @@ public class RegisteredResearches { .setConcealed().setParents("INFUSION", "THAUMIUM") .setPages(new ResearchPage("gadomancy.research_page.AURA_CORE.1"), new ResearchPage(RegisteredRecipes.recipeAuraCore), new MultiResearchPage(RegisteredRecipes.auraCoreRecipes)).registerResearchItem(); - researchCleanAuraCore = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".CLEAN_AURA_CORE", Gadomancy.MODID, - new AspectList().add(Aspect.HEAL, 8).add(Aspect.AURA, 6).add(Aspect.MAGIC, 8).add(Aspect.WATER, 10), - 1, 5, 0, new ItemStack(RegisteredItems.itemAuraCore)) + researchCleanAuraCore = new SimpleResearchItem("CLEAN_AURA_CORE", + 1, 5, 0, new ItemStack(RegisteredItems.itemAuraCore), + new AspectList().add(Aspect.HEAL, 8).add(Aspect.AURA, 6).add(Aspect.MAGIC, 8).add(Aspect.WATER, 10)) .setConcealed().setSecondary() .setParents(researchAuraCore.key) .setPages(new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.1"), new ResearchPage(RegisteredRecipes.recipesWashAuraCore), new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.3"), new ResearchPage(RegisteredRecipes.recipesUndoAuraCore)).registerResearchItem(); - researchAuraPylon = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", Gadomancy.MODID, - new AspectList().add(Aspect.ORDER, 12).add(Aspect.AURA, 20).add(Aspect.MAGIC, 12).add(Aspect.MECHANISM, 8), - 0, 9, 2, new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1)) + researchAuraPylon = new SimpleResearchItem("AURA_PYLON", + 0, 9, 2, new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1), + new AspectList().add(Aspect.ORDER, 12).add(Aspect.AURA, 20).add(Aspect.MAGIC, 12).add(Aspect.MECHANISM, 8)) .setHidden() .setParents(researchAuraCore.key, "TUBEFILTER") .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.FIRE.ordinal())) .setPages(new ResearchPage("gadomancy.research_page.AURA_PYLON.1"), new ResearchPage(RegisteredRecipes.recipeAuraPylon), new ResearchPage(RegisteredRecipes.recipeAuraPylonPeak), new ResearchPage(RegisteredRecipes.multiblockAuraPylon)).registerResearchItem(); - researchAuraEffects = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS", Gadomancy.MODID, - new AspectList().add(Aspect.AURA, 6).add(Aspect.MIND, 8).add(Aspect.MAGIC, 4).add(Aspect.ORDER, 4), - 1, 10, 2, - new ResourceLocation("thaumcraft", "textures/misc/r_aspects.png")) + researchAuraEffects = new SimpleResearchItem("AURA_EFFECTS", + 1, 10, 2, new ResourceLocation("thaumcraft", "textures/misc/r_aspects.png"), + new AspectList().add(Aspect.AURA, 6).add(Aspect.MIND, 8).add(Aspect.MAGIC, 4).add(Aspect.ORDER, 4)) .setConcealed().setSecondary() .setParents(researchAuraPylon.key) .setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")).registerResearchItem(); String[] packagerParents = Config.wardedStone ? new String[] { researchAuraCore.key, "WARDEDARCANA" } : new String[] { researchAuraCore.key }; - researchArcanePackager = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".ARCANE_PACKAGER", Gadomancy.MODID, - new AspectList().add(Aspect.AIR, 12).add(Aspect.MECHANISM, 16).add(Aspect.VOID, 10).add(Aspect.MAGIC, 10), - 2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4)) + researchArcanePackager = new SimpleResearchItem("ARCANE_PACKAGER", + 2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4), + new AspectList().add(Aspect.AIR, 12).add(Aspect.MECHANISM, 16).add(Aspect.VOID, 10).add(Aspect.MAGIC, 10)) .setHidden() .setParents(packagerParents) .setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.AIR.ordinal())) .setPages(new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.1"), new ResearchPage(RegisteredRecipes.recipeArcanePackager)).registerResearchItem(); - ResearchItem researchInfusionEnch = PseudoResearchItem.create("INFUSIONENCHANTMENT", -3, 1).registerResearchItem(); + ResearchItem researchInfusionEnch = PseudoResearchItem.create("INFUSIONENCHANTMENT", -1, 2).registerResearchItem(); ItemStack goggles = new ItemStack(ConfigItems.itemGoggles); goggles.addEnchantment(Enchantment.protection, 1); - researchRevealer = new SimpleResearchItem("REVEALER", -2, 2, 1, goggles, new AspectList().add(Aspect.SENSES, 4).add(Aspect.MAGIC, 4)) + researchRevealer = new SimpleResearchItem("REVEALER", 1, 3, 1, goggles, new AspectList().add(Aspect.SENSES, 4).add(Aspect.MAGIC, 4)) .setParents(researchInfusionEnch.key) - .setPages(new ResearchPage("Bla"), new ResearchPage(RegisteredRecipes.recipeRevealer)).registerResearchItem(); + .setPages(new ResearchPage("gadomancy.research_page.GADOMANCY.REVEALER.1"), new ResearchPage(RegisteredRecipes.recipeRevealer)).registerResearchItem(); - researchArmorDisguise = new DisguiseResearchItem("ARMORDISGUISE", -4, 2, 1, new AspectList().add(Aspect.SLIME, 8).add(Aspect.MAGIC, 4).add(Aspect.ARMOR, 4)) + researchArmorDisguise = new DisguiseResearchItem("ARMORDISGUISE", -2, 4, 1, new AspectList().add(Aspect.SLIME, 8).add(Aspect.MAGIC, 4).add(Aspect.ARMOR, 4)) .setParents(researchInfusionEnch.key) - .setPages(new ResearchPage("Blub"), new ResearchPage(new InfusionVisualDisguiseArmor(false)), new ResearchPage(new InfusionVisualDisguiseArmor(true))).registerResearchItem(); + .setPages(new ResearchPage("gadomancy.research_page.GADOMANCY.ARMORDISGUISE.1"), new ResearchPage(new InfusionVisualDisguiseArmor(false)), new ResearchPage(new InfusionVisualDisguiseArmor(true))).registerResearchItem(); //Warpy warpy ThaumcraftApi.addWarpToResearch(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", 2); diff --git a/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java b/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java new file mode 100644 index 0000000..a62f1b6 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/research/IfAnyParentResearchItem.java @@ -0,0 +1,52 @@ +package makeo.gadomancy.common.research; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.research.ResearchCategories; +import thaumcraft.api.research.ResearchItem; +import thaumcraft.client.gui.GuiResearchBrowser; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 03.01.2016 14:35 + */ +public class IfAnyParentResearchItem extends SimpleResearchItem { + + private String[] anyParents = null; + + public IfAnyParentResearchItem(String key, int col, int row, int complex, ItemStack icon, AspectList tags) { + super(key, col, row, complex, icon, tags); + } + + public IfAnyParentResearchItem(String key, int col, int row, int complex, ResourceLocation icon, AspectList tags) { + super(key, col, row, complex, icon, tags); + } + + @Override + public boolean isConcealed() { + if(anyParents != null) { + for(String res : anyParents) { + ResearchItem ri = ResearchCategories.getResearch(res); + if(ri != null) { + if(GuiResearchBrowser.completedResearch.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()).contains(ri.key)) { + return super.isConcealed(); + } + } + } + return true; + } + return super.isConcealed(); + } + + public IfAnyParentResearchItem setAnyParents(String... parents) { + this.anyParents = parents; + return this; + } + +} diff --git a/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java b/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java index 1642cdc..a1c6e72 100644 --- a/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java +++ b/src/main/java/makeo/gadomancy/common/research/SimpleResearchItem.java @@ -15,6 +15,7 @@ import thaumcraft.api.research.ResearchItem; * Created by makeo @ 15.06.2015 19:05 */ public class SimpleResearchItem extends ResearchItem { + private static final String PREFIX = Gadomancy.MODID.toUpperCase() + "."; public SimpleResearchItem(String key, int col, int row, int complex, ResourceLocation icon, AspectList tags) { @@ -28,4 +29,5 @@ public class SimpleResearchItem extends ResearchItem { public static String getFullName(String name) { return PREFIX + name; } + }