diff --git a/src/api/java/am2/api/ArsMagicaApi.java b/src/api/java/am2/api/ArsMagicaApi.java index 6424ae0..32bfefc 100644 --- a/src/api/java/am2/api/ArsMagicaApi.java +++ b/src/api/java/am2/api/ArsMagicaApi.java @@ -1,12 +1,5 @@ package am2.api; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.ai.attributes.BaseAttribute; -import net.minecraft.entity.ai.attributes.IAttribute; -import net.minecraft.entity.ai.attributes.RangedAttribute; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.util.IIcon; import am2.api.enchantment.IAMEnchantmentHelper; import am2.api.entities.IEntityManager; import am2.api.flickers.IFlickerRegistry; @@ -21,258 +14,287 @@ import am2.api.spell.enums.SkillPointTypes; import am2.api.spell.enums.SkillTrees; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.RangedAttribute; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.IIcon; public class ArsMagicaApi { - public static final ArsMagicaApi instance = new ArsMagicaApi(); + public static final ArsMagicaApi instance = new ArsMagicaApi(); - /** - * Easy access to this mod's ID - */ - public static final String AM2ModID = "arsmagica2"; + /** + * Easy access to this mod's ID + */ + public static final String AM2ModID = "arsmagica2"; - private static String extendedPropertiesIdentifier; - private static String affinityDataIdentifier; - private static String skillDataIdentifier; - private static String riftStorageIdentifier; + private static String extendedPropertiesIdentifier; + private static String affinityDataIdentifier; + private static String skillDataIdentifier; + private static String riftStorageIdentifier; - /** - * Attributes for AM2's properties - */ - //Bonus to max mana. Applied additively. - public static final IAttribute maxManaBonus = new RangedAttribute("am2.maxManaBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Mana Bonus").setShouldWatch(true); - //Bonus to max burnout. Applied additively. - public static final IAttribute maxBurnoutBonus = new RangedAttribute("am2.maxBurnoutBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Burnout Bonus").setShouldWatch(true); - //Bonus to XP gained. Applied multiplicatively. - public static final IAttribute xpGainModifier = new RangedAttribute("am2.xpMultiplier", 1.0f, 0.0f, Double.MAX_VALUE).setDescription("XP Mutiplier").setShouldWatch(true); - //Bonus to mana regen rate. Applied multiplicatively. - public static final IAttribute manaRegenTimeModifier = new RangedAttribute("am2.manaRegenModifier", 1.0f, 0.5f, 2.0f).setDescription("Mana Regen Rate Multiplier").setShouldWatch(true); - //Bonus to burnout reduction rate. Applied multiplicatively. - public static final IAttribute burnoutReductionRate = new RangedAttribute("am2.burnoutReduction", 1.0f, 0.1f, 2.0f).setDescription("Burnout Reduction Rate").setShouldWatch(true); + /** + * Attributes for AM2's properties + */ + // Bonus to max mana. Applied additively. + public static final IAttribute maxManaBonus = new RangedAttribute("am2.maxManaBonus", 0.0f, 0.0f, Double.MAX_VALUE) + .setDescription("Mana Bonus") + .setShouldWatch(true); + // Bonus to max burnout. Applied additively. + public static final IAttribute maxBurnoutBonus = new RangedAttribute( + "am2.maxBurnoutBonus", 0.0f, 0.0f, Double.MAX_VALUE) + .setDescription("Burnout Bonus") + .setShouldWatch(true); + // Bonus to XP gained. Applied multiplicatively. + public static final IAttribute xpGainModifier = new RangedAttribute( + "am2.xpMultiplier", 1.0f, 0.0f, Double.MAX_VALUE) + .setDescription("XP Mutiplier") + .setShouldWatch(true); + // Bonus to mana regen rate. Applied multiplicatively. + public static final IAttribute manaRegenTimeModifier = new RangedAttribute( + "am2.manaRegenModifier", 1.0f, 0.5f, 2.0f) + .setDescription("Mana Regen Rate Multiplier") + .setShouldWatch(true); + // Bonus to burnout reduction rate. Applied multiplicatively. + public static final IAttribute burnoutReductionRate = new RangedAttribute("am2.burnoutReduction", 1.0f, 0.1f, 2.0f) + .setDescription("Burnout Reduction Rate") + .setShouldWatch(true); - private static final float manaBurnoutRatio = 0.38f; - private ArsMagicaApi(){ + private static final float manaBurnoutRatio = 0.38f; - } + private ArsMagicaApi() {} - //================================================================================ - // Getters - //================================================================================ - /** - * Gets the spell part manager. Used to register new shapes/components/modifiers/talents - */ - public final ISpellPartManager getSpellPartManager(){ - return spellPartManager; - } + // ================================================================================ + // Getters + // ================================================================================ + /** + * Gets the spell part manager. Used to register new shapes/components/modifiers/talents + */ + public final ISpellPartManager getSpellPartManager() { + return spellPartManager; + } - /** - * Gets the enchantment helper. Used to resolve current enchantment IDs. - */ - public final IAMEnchantmentHelper getEnchantHelper(){ - return enchantmentHelper; - } + /** + * Gets the enchantment helper. Used to resolve current enchantment IDs. + */ + public final IAMEnchantmentHelper getEnchantHelper() { + return enchantmentHelper; + } - /** - * Gets the skill tree manager. Used to register spell parts into the skill trees (accessible via occulus) - */ - public final ISkillTreeManager getSkillTreeManager(){ - return this.skillTreeManager; - } + /** + * Gets the skill tree manager. Used to register spell parts into the skill trees (accessible via occulus) + */ + public final ISkillTreeManager getSkillTreeManager() { + return this.skillTreeManager; + } - /** - * Helper method to calculate the burnout for a spell based on mana cost. - */ - public static final float getBurnoutFromMana(float manaCost){ - return manaCost * manaBurnoutRatio; - } + /** + * Helper method to calculate the burnout for a spell based on mana cost. + */ + public static final float getBurnoutFromMana(float manaCost) { + return manaCost * manaBurnoutRatio; + } - /** - * Gets the keystone helper instance. Used to check inventories for keys and check access to blocks lockable by keystone. - */ - public final IKeystoneHelper getKeystoneHelper(){ - return this.keystoneHelper; - } + /** + * Gets the keystone helper instance. Used to check inventories for keys and check access to blocks lockable by keystone. + */ + public final IKeystoneHelper getKeystoneHelper() { + return this.keystoneHelper; + } - /** - * Gets the entity manager. Used to blacklist things from the progeny and butchery flicker operators - */ - public final IEntityManager getEntityManager(){ - return this.entityManager; - } + /** + * Gets the entity manager. Used to blacklist things from the progeny and butchery flicker operators + */ + public final IEntityManager getEntityManager() { + return this.entityManager; + } - /** - * Gets the fuel helper instance. Used to register new fuels for the Obelisk. - */ - public final IObeliskFuelHelper getFuelHelper(){ - return this.obeliskFuelHelper; - } + /** + * Gets the fuel helper instance. Used to register new fuels for the Obelisk. + */ + public final IObeliskFuelHelper getFuelHelper() { + return this.obeliskFuelHelper; + } - /** - * Gets the flicker registry. Used to register new flicker operators into the habitat. - */ - public final IFlickerRegistry getFlickerOperatorRegistry(){ - return flickerOperatorRegistry; - } + /** + * Gets the flicker registry. Used to register new flicker operators into the habitat. + */ + public final IFlickerRegistry getFlickerOperatorRegistry() { + return flickerOperatorRegistry; + } - /** - * Gets the armor imbuement registry. Used to register new imbuements and check if imbuements are present on a given item stack. - */ - public final IImbuementRegistry getArmorInfusionRegistry(){ - return this.armorInfusionRegistry; - } + /** + * Gets the armor imbuement registry. Used to register new imbuements and check if imbuements are present on a given item stack. + */ + public final IImbuementRegistry getArmorInfusionRegistry() { + return this.armorInfusionRegistry; + } - /** - * Gets the AM recipe manager. Used to register new essence refiner recipes. - */ - public final IAMRecipeManager getEssenceRecipeManager(){ - return this.essenceRecipes; - } + /** + * Gets the AM recipe manager. Used to register new essence refiner recipes. + */ + public final IAMRecipeManager getEssenceRecipeManager() { + return this.essenceRecipes; + } - /** - * Is AM2 running in colourblind mode? - */ - public final boolean getColourblindMode(){ - return this.colourblindMode; - } + /** + * Is AM2 running in colourblind mode? + */ + public final boolean getColourblindMode() { + return this.colourblindMode; + } - /** - * Returns the extended properties for the passed in entity living - */ - public final IExtendedProperties getExtendedProperties(EntityLivingBase entity){ - return (IExtendedProperties) entity.getExtendedProperties(extendedPropertiesIdentifier); - } + /** + * Returns the extended properties for the passed in entity living + */ + public final IExtendedProperties getExtendedProperties(EntityLivingBase entity) { + return (IExtendedProperties) entity.getExtendedProperties(extendedPropertiesIdentifier); + } - /** - * Returns the skill data instance (known shapes/modifiers/components/talents) - */ - public final ISkillData getSkillData(EntityPlayer entity){ - return (ISkillData) entity.getExtendedProperties(skillDataIdentifier); - } + /** + * Returns the skill data instance (known shapes/modifiers/components/talents) + */ + public final ISkillData getSkillData(EntityPlayer entity) { + return (ISkillData) entity.getExtendedProperties(skillDataIdentifier); + } - /** - * Returns the affinity data for the passed in entity - */ - public final IAffinityData getAffinityData(EntityLivingBase entity){ - return (IAffinityData) entity.getExtendedProperties(affinityDataIdentifier); - } + /** + * Returns the affinity data for the passed in entity + */ + public final IAffinityData getAffinityData(EntityLivingBase entity) { + return (IAffinityData) entity.getExtendedProperties(affinityDataIdentifier); + } - /** - * Returns the rift storage for the passed in player. - */ - public final IInventory getRiftStorage(EntityPlayer entity){ - return (IInventory) entity.getExtendedProperties(riftStorageIdentifier); - } + /** + * Returns the rift storage for the passed in player. + */ + public final IInventory getRiftStorage(EntityPlayer entity) { + return (IInventory) entity.getExtendedProperties(riftStorageIdentifier); + } - /** - * Registers a skill tree entry (Shape, Component, Modifier, or Talent) into the mod - * @param entry The skill tree entry to register - * @param name The unlocalized name that is used to identify this entry - * @param tree Which skill tree the entry should be located in - * @param x The x coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items. - * @param y The y coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items. - * @param point The type of skill point needed to unlock this entry - * @param prerequs Any skill tree entries that are required as prerequisites for this one. All prerequisites must be registered before the current entry. - */ - public final void registerSkillTreeEntry(ISkillTreeEntry entry, String name, SkillTrees tree, int x, int y, SkillPointTypes point, ISkillTreeEntry...prereqs){ - spellPartManager.registerSkillTreeEntry(entry, name); - skillTreeManager.RegisterPart(entry, x, y, tree, point, prereqs); - } + /** + * Registers a skill tree entry (Shape, Component, Modifier, or Talent) into the mod + * @param entry The skill tree entry to register + * @param name The unlocalized name that is used to identify this entry + * @param tree Which skill tree the entry should be located in + * @param x The x coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items. + * @param y The y coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items. + * @param point The type of skill point needed to unlock this entry + * @param prerequs Any skill tree entries that are required as prerequisites for this one. All prerequisites must be registered before the current entry. + */ + public final void registerSkillTreeEntry( + ISkillTreeEntry entry, + String name, + SkillTrees tree, + int x, + int y, + SkillPointTypes point, + ISkillTreeEntry... prereqs) { + spellPartManager.registerSkillTreeEntry(entry, name); + skillTreeManager.RegisterPart(entry, x, y, tree, point, prereqs); + } - /** - * Registers the IIcon to use for the specified skill. This should be called during the API's registerSkillTreeIcons event for each entry that you registered. You get a reference to the ISpellIconManager which has the same method, so this is only here for convenience. - * @param name The unlocalized name that was used to register the spell. See {@link #registerSkillTreeEntry(ISkillTreeEntry, String, SkillTrees, int, int, SkillPointTypes, ISkillTreeEntry...) registerSkillTreeEntry} method for more info on the name. - * @param IIcon The IIcon to use. You need to register these IIcons with the game beforehand during your mod's load phase - AM won't do it for you. - */ - @SideOnly(Side.CLIENT) - public final void registerSkillIcon(String name, IIcon IIcon){ - spellIconManager.registerIcon(name, IIcon); - } + /** + * Registers the IIcon to use for the specified skill. This should be called during the API's registerSkillTreeIcons event for each entry that you registered. You get a reference to the ISpellIconManager which has the same method, so this is only here for convenience. + * @param name The unlocalized name that was used to register the spell. See {@link #registerSkillTreeEntry(ISkillTreeEntry, String, SkillTrees, int, int, SkillPointTypes, ISkillTreeEntry...) registerSkillTreeEntry} method for more info on the name. + * @param IIcon The IIcon to use. You need to register these IIcons with the game beforehand during your mod's load phase - AM won't do it for you. + */ + @SideOnly(Side.CLIENT) + public final void registerSkillIcon(String name, IIcon IIcon) { + spellIconManager.registerIcon(name, IIcon); + } - /** - * Returns the IIcon manager. This is used to register spell IIcons. - */ - @SideOnly(Side.CLIENT) - public final ISpellIconManager getSpellIconManager(){ - return spellIconManager; - } + /** + * Returns the IIcon manager. This is used to register spell IIcons. + */ + @SideOnly(Side.CLIENT) + public final ISpellIconManager getSpellIconManager() { + return spellIconManager; + } - //================================================================================ - // Setters - for AM use only, do not call these. - //================================================================================ - public final void setSpellPartManager(ISpellPartManager manager){ - if (this.spellPartManager == null){ - this.spellPartManager = manager; - } - } - public final void setEnchantmentHelper(IAMEnchantmentHelper helper){ - if (this.enchantmentHelper == null){ - this.enchantmentHelper = helper; - } - } - public final void setSkillTreeManager(ISkillTreeManager manager){ - if (this.skillTreeManager == null) - this.skillTreeManager = manager; - } - @SideOnly(Side.CLIENT) - public final void setSpellIconManager(ISpellIconManager manager){ - if (this.spellIconManager == null) - this.spellIconManager = manager; - } - public final void setKeystoneHelper(IKeystoneHelper helper){ - if (this.keystoneHelper == null){ - this.keystoneHelper = helper; - } - } - public final void setExtendedPropertiesID(String identifier){ - if (extendedPropertiesIdentifier == null) - extendedPropertiesIdentifier = identifier; - } - public final void setAffinityDataID(String identifier){ - if (affinityDataIdentifier == null) - affinityDataIdentifier = identifier; - } - public final void setSkillDataID(String identifier){ - if (skillDataIdentifier == null) - skillDataIdentifier = identifier; - } - public final void setRiftStorageID(String identifier){ - if (riftStorageIdentifier == null) - riftStorageIdentifier = identifier; - } - public final void setEntityManager(IEntityManager manager){ - if (entityManager == null) - entityManager = manager; - } - public final void setObeliskFuelHelper(IObeliskFuelHelper manager){ - if (obeliskFuelHelper == null) - obeliskFuelHelper = manager; - } - public final void setFlickerOperatorRegistry(IFlickerRegistry registry){ - if (flickerOperatorRegistry == null) - flickerOperatorRegistry = registry; - } - public final void setInfusionRegistry(IImbuementRegistry registry){ - if (this.armorInfusionRegistry == null) - this.armorInfusionRegistry = registry; - } - public final void setEssenceRecipeHandler(IAMRecipeManager manager){ - if (this.essenceRecipes != null) - this.essenceRecipes = manager; - } - public final void setColourblindMode(boolean colourblindMode){ - this.colourblindMode = colourblindMode; - } + // ================================================================================ + // Setters - for AM use only, do not call these. + // ================================================================================ + public final void setSpellPartManager(ISpellPartManager manager) { + if (this.spellPartManager == null) { + this.spellPartManager = manager; + } + } - private ISpellPartManager spellPartManager; - private ISkillTreeManager skillTreeManager; - private IAMEnchantmentHelper enchantmentHelper; - private IEntityManager entityManager; - private IKeystoneHelper keystoneHelper; - private IObeliskFuelHelper obeliskFuelHelper; - private IFlickerRegistry flickerOperatorRegistry; - private IImbuementRegistry armorInfusionRegistry; - private IAMRecipeManager essenceRecipes; - @SideOnly(Side.CLIENT) - private ISpellIconManager spellIconManager; - private boolean colourblindMode; + public final void setEnchantmentHelper(IAMEnchantmentHelper helper) { + if (this.enchantmentHelper == null) { + this.enchantmentHelper = helper; + } + } + public final void setSkillTreeManager(ISkillTreeManager manager) { + if (this.skillTreeManager == null) this.skillTreeManager = manager; + } + + @SideOnly(Side.CLIENT) + public final void setSpellIconManager(ISpellIconManager manager) { + if (this.spellIconManager == null) this.spellIconManager = manager; + } + + public final void setKeystoneHelper(IKeystoneHelper helper) { + if (this.keystoneHelper == null) { + this.keystoneHelper = helper; + } + } + + public final void setExtendedPropertiesID(String identifier) { + if (extendedPropertiesIdentifier == null) extendedPropertiesIdentifier = identifier; + } + + public final void setAffinityDataID(String identifier) { + if (affinityDataIdentifier == null) affinityDataIdentifier = identifier; + } + + public final void setSkillDataID(String identifier) { + if (skillDataIdentifier == null) skillDataIdentifier = identifier; + } + + public final void setRiftStorageID(String identifier) { + if (riftStorageIdentifier == null) riftStorageIdentifier = identifier; + } + + public final void setEntityManager(IEntityManager manager) { + if (entityManager == null) entityManager = manager; + } + + public final void setObeliskFuelHelper(IObeliskFuelHelper manager) { + if (obeliskFuelHelper == null) obeliskFuelHelper = manager; + } + + public final void setFlickerOperatorRegistry(IFlickerRegistry registry) { + if (flickerOperatorRegistry == null) flickerOperatorRegistry = registry; + } + + public final void setInfusionRegistry(IImbuementRegistry registry) { + if (this.armorInfusionRegistry == null) this.armorInfusionRegistry = registry; + } + + public final void setEssenceRecipeHandler(IAMRecipeManager manager) { + if (this.essenceRecipes != null) this.essenceRecipes = manager; + } + + public final void setColourblindMode(boolean colourblindMode) { + this.colourblindMode = colourblindMode; + } + + private ISpellPartManager spellPartManager; + private ISkillTreeManager skillTreeManager; + private IAMEnchantmentHelper enchantmentHelper; + private IEntityManager entityManager; + private IKeystoneHelper keystoneHelper; + private IObeliskFuelHelper obeliskFuelHelper; + private IFlickerRegistry flickerOperatorRegistry; + private IImbuementRegistry armorInfusionRegistry; + private IAMRecipeManager essenceRecipes; + + @SideOnly(Side.CLIENT) + private ISpellIconManager spellIconManager; + + private boolean colourblindMode; } diff --git a/src/api/java/am2/api/IAMRecipeManager.java b/src/api/java/am2/api/IAMRecipeManager.java index 140b2ad..d2ece9d 100644 --- a/src/api/java/am2/api/IAMRecipeManager.java +++ b/src/api/java/am2/api/IAMRecipeManager.java @@ -3,10 +3,10 @@ package am2.api; import net.minecraft.item.ItemStack; public interface IAMRecipeManager { - /** - * Adds a recipe to the essence refiner. - * @param output The output created - * @param components The components required. Must be a length of 5. - */ - public void addRefinerRecipe(ItemStack output, ItemStack[] components); + /** + * Adds a recipe to the essence refiner. + * @param output The output created + * @param components The components required. Must be a length of 5. + */ + public void addRefinerRecipe(ItemStack output, ItemStack[] components); } diff --git a/src/api/java/am2/api/IAffinityData.java b/src/api/java/am2/api/IAffinityData.java index e3adf27..3a71a9b 100644 --- a/src/api/java/am2/api/IAffinityData.java +++ b/src/api/java/am2/api/IAffinityData.java @@ -4,25 +4,25 @@ import am2.api.spell.enums.Affinity; public interface IAffinityData { - /** - * Gets the depth of the specified affinity as a percentage. - */ - float getAffinityDepth(Affinity affinity); - /** - * Gets the factor at which affinity gains are currently reduced. - */ - float getDiminishingReturnsFactor(); - /** - * Directly sets an affinity. Does not take into account oppositions. Use sparingly. - * @param affinity The affinity to set - * @param depth The depth to set - */ - void setAffinityAndDepth(Affinity affinity, float depth); - /** - * Increments the affinity by the specified amount, and decrements other affinities by an amount related to - * how much in opposition they are to the specified affinity. - * @param affinity The affinity to increase - * @param amt The amount to increase the affinity by - */ - void incrementAffinity(Affinity affinity, float amt); + /** + * Gets the depth of the specified affinity as a percentage. + */ + float getAffinityDepth(Affinity affinity); + /** + * Gets the factor at which affinity gains are currently reduced. + */ + float getDiminishingReturnsFactor(); + /** + * Directly sets an affinity. Does not take into account oppositions. Use sparingly. + * @param affinity The affinity to set + * @param depth The depth to set + */ + void setAffinityAndDepth(Affinity affinity, float depth); + /** + * Increments the affinity by the specified amount, and decrements other affinities by an amount related to + * how much in opposition they are to the specified affinity. + * @param affinity The affinity to increase + * @param amt The amount to increase the affinity by + */ + void incrementAffinity(Affinity affinity, float amt); } diff --git a/src/api/java/am2/api/IExtendedProperties.java b/src/api/java/am2/api/IExtendedProperties.java index b822a6f..a6ba65b 100644 --- a/src/api/java/am2/api/IExtendedProperties.java +++ b/src/api/java/am2/api/IExtendedProperties.java @@ -8,18 +8,23 @@ import am2.api.math.AMVector3; * */ public interface IExtendedProperties { - public float getCurrentMana(); - public float getMaxMana(); + public float getCurrentMana(); - public int getMarkDimension(); - public int getMagicLevel(); - public int getNumSummons(); + public float getMaxMana(); - public AMVector3 getMarkLocation(); + public int getMarkDimension(); - public boolean getHasUnlockedAugmented(); - public boolean getMarkSet(); + public int getMagicLevel(); - public boolean setMagicLevelWithMana(int magicLevel); - public void setCurrentMana(float currentMana); + public int getNumSummons(); + + public AMVector3 getMarkLocation(); + + public boolean getHasUnlockedAugmented(); + + public boolean getMarkSet(); + + public boolean setMagicLevelWithMana(int magicLevel); + + public void setCurrentMana(float currentMana); } diff --git a/src/api/java/am2/api/ISkillData.java b/src/api/java/am2/api/ISkillData.java index 4c663c6..3467f2d 100644 --- a/src/api/java/am2/api/ISkillData.java +++ b/src/api/java/am2/api/ISkillData.java @@ -1,66 +1,66 @@ package am2.api; -import net.minecraft.entity.player.EntityPlayer; import am2.api.spell.component.interfaces.ISkillTreeEntry; import am2.api.spell.enums.LearnStates; import am2.api.spell.enums.SkillPointTypes; +import net.minecraft.entity.player.EntityPlayer; public interface ISkillData { - /** - * Checks if the specified skill tree entry is known - */ - boolean isEntryKnown(SkillTreeEntry entry); - /** - * Returns the number of skill points of the given type that this skill data has - */ - int getSpellPoints(SkillPointTypes type); - /** - * Sets the number of skill points of the given type that this skill data has - */ - void setSpellPoints(int spellPoints, SkillPointTypes type); - /** - * Sets the number of skill points for all types that this skill data has - */ - void setSpellPoints(int spellPoints_blue, int spellPoints_green, int spellPoints_red); - /** - * Increments the skill points of the specified type. - */ - void incrementSpellPoints(SkillPointTypes type); - /** - * Decrements the skill points of the specified type. Cannot go below 0. - */ - void decrementSpellPoints(SkillPointTypes type); - /** - * Learns the specified entry. This will attempt to decrement skill points but is not bounded by it - make sure you check {@link #getLearnState(SkillTreeEntry, EntityPlayer)} first! - * @param entry - */ - void learn(ISkillTreeEntry entry); - /** - * Returns an array of shifted IDs representing the known shapes. - */ - Integer[] getKnownShapes(); - /** - * Returns an array of shifted IDs representing the known components. - */ - Integer[] getKnownComponents(); - /** - * Returns an array of shifted IDs representing the known modifiers. - */ - Integer[] getKnownModifiers(); - /** - * Returns an array of shifted IDs representing the known talents. - */ - Integer[] getKnownTalents(); - /** - * Forces changes to sync to appropriate clients. Chances are you won't have to call this, as the sync will happen at regular intervals if there are actually changes to sync. This is for when you need the changes clientside immediately. - */ - void forceSync(); - /** - * Clears all spell knowledge and skill points. Does not do any refunding -- this is NOT a respec! - */ - void clearAllKnowledge(); - /** - * Gets the learn state for the specified skill. - */ - LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player); + /** + * Checks if the specified skill tree entry is known + */ + boolean isEntryKnown(SkillTreeEntry entry); + /** + * Returns the number of skill points of the given type that this skill data has + */ + int getSpellPoints(SkillPointTypes type); + /** + * Sets the number of skill points of the given type that this skill data has + */ + void setSpellPoints(int spellPoints, SkillPointTypes type); + /** + * Sets the number of skill points for all types that this skill data has + */ + void setSpellPoints(int spellPoints_blue, int spellPoints_green, int spellPoints_red); + /** + * Increments the skill points of the specified type. + */ + void incrementSpellPoints(SkillPointTypes type); + /** + * Decrements the skill points of the specified type. Cannot go below 0. + */ + void decrementSpellPoints(SkillPointTypes type); + /** + * Learns the specified entry. This will attempt to decrement skill points but is not bounded by it - make sure you check {@link #getLearnState(SkillTreeEntry, EntityPlayer)} first! + * @param entry + */ + void learn(ISkillTreeEntry entry); + /** + * Returns an array of shifted IDs representing the known shapes. + */ + Integer[] getKnownShapes(); + /** + * Returns an array of shifted IDs representing the known components. + */ + Integer[] getKnownComponents(); + /** + * Returns an array of shifted IDs representing the known modifiers. + */ + Integer[] getKnownModifiers(); + /** + * Returns an array of shifted IDs representing the known talents. + */ + Integer[] getKnownTalents(); + /** + * Forces changes to sync to appropriate clients. Chances are you won't have to call this, as the sync will happen at regular intervals if there are actually changes to sync. This is for when you need the changes clientside immediately. + */ + void forceSync(); + /** + * Clears all spell knowledge and skill points. Does not do any refunding -- this is NOT a respec! + */ + void clearAllKnowledge(); + /** + * Gets the learn state for the specified skill. + */ + LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player); } diff --git a/src/api/java/am2/api/SkillTreeEntry.java b/src/api/java/am2/api/SkillTreeEntry.java index ab74d6f..312aaa5 100644 --- a/src/api/java/am2/api/SkillTreeEntry.java +++ b/src/api/java/am2/api/SkillTreeEntry.java @@ -4,29 +4,35 @@ import am2.api.spell.component.interfaces.ISkillTreeEntry; import am2.api.spell.enums.SkillTrees; public class SkillTreeEntry { - public final int x; - public final int y; - public final SkillTrees tree; - public final SkillTreeEntry[] prerequisites; - public final ISkillTreeEntry registeredItem; - public final int tier; - public boolean enabled; + public final int x; + public final int y; + public final SkillTrees tree; + public final SkillTreeEntry[] prerequisites; + public final ISkillTreeEntry registeredItem; + public final int tier; + public boolean enabled; - public SkillTreeEntry(int x, int y, SkillTrees tree, SkillTreeEntry[] prerequisites, ISkillTreeEntry registeredItem, boolean enabled){ - this.x = x; - this.y = y; - this.tree = tree; - this.prerequisites = prerequisites; - this.registeredItem = registeredItem; - this.enabled = enabled; + public SkillTreeEntry( + int x, + int y, + SkillTrees tree, + SkillTreeEntry[] prerequisites, + ISkillTreeEntry registeredItem, + boolean enabled) { + this.x = x; + this.y = y; + this.tree = tree; + this.prerequisites = prerequisites; + this.registeredItem = registeredItem; + this.enabled = enabled; - int highestTier = 0; - for (SkillTreeEntry entry : prerequisites){ - if (entry.tier >= highestTier){ - highestTier = entry.tier + 1; - } - } + int highestTier = 0; + for (SkillTreeEntry entry : prerequisites) { + if (entry.tier >= highestTier) { + highestTier = entry.tier + 1; + } + } - this.tier = highestTier; - } + this.tier = highestTier; + } } diff --git a/src/api/java/am2/api/blocks/IKeystoneLockable.java b/src/api/java/am2/api/blocks/IKeystoneLockable.java index c4a7ca1..4d2368b 100644 --- a/src/api/java/am2/api/blocks/IKeystoneLockable.java +++ b/src/api/java/am2/api/blocks/IKeystoneLockable.java @@ -3,20 +3,20 @@ package am2.api.blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -public interface IKeystoneLockable { - /** - * Return a three element array of the three runes in the inventory that make up the current keystone combination. - * Elements can be NULL if there is no rune present. - */ - public ItemStack[] getRunesInKey(); +public interface IKeystoneLockable { + /** + * Return a three element array of the three runes in the inventory that make up the current keystone combination. + * Elements can be NULL if there is no rune present. + */ + public ItemStack[] getRunesInKey(); - /** - * Does the keystone need to be the currently held item? Trumps {@link #keystoneMustBeInActionBar()}. - */ - public boolean keystoneMustBeHeld(); + /** + * Does the keystone need to be the currently held item? Trumps {@link #keystoneMustBeInActionBar()}. + */ + public boolean keystoneMustBeHeld(); - /** - * Does the keystone need to be in the action bar? Or can it be anywhere in the inventory? - */ - public boolean keystoneMustBeInActionBar(); + /** + * Does the keystone need to be in the action bar? Or can it be anywhere in the inventory? + */ + public boolean keystoneMustBeInActionBar(); } diff --git a/src/api/java/am2/api/blocks/MultiblockStructureDefinition.java b/src/api/java/am2/api/blocks/MultiblockStructureDefinition.java index fc8ec78..7bcacb2 100644 --- a/src/api/java/am2/api/blocks/MultiblockStructureDefinition.java +++ b/src/api/java/am2/api/blocks/MultiblockStructureDefinition.java @@ -2,404 +2,409 @@ package am2.api.blocks; import java.util.ArrayList; import java.util.HashMap; - import net.minecraft.block.Block; import net.minecraft.world.World; -public class MultiblockStructureDefinition{ - public class BlockDec{ - Block block; - int meta; - - public BlockDec(Block block, int meta){ - this.block = block; - this.meta = meta; - } - - public Block getBlock(){ - return block; - } - - public int getMeta(){ - return meta; - } - - @Override - public String toString() { - String blockName = ""; - if (block != null){ - blockName = block.getLocalizedName(); - }else{ - blockName = "Unknown"; - } - return String.format("Block: %s, meta: %d", blockName, meta); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof BlockDec){ - return this.block == ((BlockDec)obj).block && (this.meta == -1 || ((BlockDec)obj).meta == -1 || this.meta == ((BlockDec)obj).meta); - } - return false; - } - - @Override - public int hashCode() { - return Block.getIdFromBlock(block); - } - } - - public class BlockCoord implements Comparable{ - public int x; - public int y; - public int z; - - public BlockCoord(int offsetX, int offsetY, int offsetZ){ - this.x = offsetX; - this.y = offsetY; - this.z = offsetZ; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof BlockCoord){ - return this.x == ((BlockCoord)obj).x && this.y == ((BlockCoord)obj).y && this.z == ((BlockCoord)obj).z; - } - return false; - } - - @Override - public int hashCode() { - return this.x + this.y + this.z; - } - - - public int getX(){ - return this.x; - } - - public int getY(){ - return this.y; - } - - public int getZ(){ - return this.z; - } - - @Override - public String toString() { - return String.format("BlockCoord: %d, %d, %d", x, y, z); - } - - @Override - public int compareTo(BlockCoord o) { - return this.z > o.z ? 1 : this.z < o.z ? -1 : this.x > o.x ? 1 : this.x < o.x ? -1 : this.y > o.y ? 1 : this.y < o.y ? -1 : 0; - } - } - - public class StructureGroup - { - String name; - int mutex; - HashMap> allowedBlocks; - - public StructureGroup(String name, int mutex){ - this.name = name; - this.mutex = mutex; - allowedBlocks = new HashMap>(); - } - - void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){ - BlockCoord originOffset = new BlockCoord(offsetX, offsetY, offsetZ); - if (!allowedBlocks.containsKey(originOffset)){ - allowedBlocks.put(originOffset, new ArrayList()); - } - ArrayList positionReplacements = allowedBlocks.get(originOffset); - positionReplacements.add(new BlockDec(block, meta)); - } - - ArrayList getAllowedBlocksAt(BlockCoord coord){ - return allowedBlocks.get(coord); - } - - boolean matchGroup(World world, int originX, int originY, int originZ){ - for (BlockCoord offset : allowedBlocks.keySet()){ - Block block = world.getBlock(originX + offset.x, originY + offset.y, originZ + offset.z); - int meta = world.getBlockMetadata(originX + offset.x, originY + offset.y, originZ + offset.z); - ArrayList positionReplacements = allowedBlocks.get(offset); - boolean valid = false; - for (BlockDec bd : positionReplacements){ - if (bd.block == block && (bd.meta == -1 || bd.meta == meta)){ - valid = true; - } - } - if (!valid) return false; - } - return true; - } - - HashMap> getStructureLayer(int layer){ - HashMap> toReturn = new HashMap>(); - - if (layer > getMaxLayer() || layer < getMinLayer()){ - return toReturn; - } - - for (BlockCoord bc : allowedBlocks.keySet()){ - if (bc.y == layer){ - toReturn.put(bc, allowedBlocks.get(bc)); - } - } - return toReturn; - } - - public void replaceAllBlocksOfType(Block originalBlock, Block newBlock){ - replaceAllBlocksOfType(originalBlock, -1, newBlock, -1); - } - - public void replaceAllBlocksOfType(Block originalBlock, int originalMeta, Block newBlock, int newMeta){ - for (BlockCoord bc : allowedBlocks.keySet()){ - for (BlockDec bd : allowedBlocks.get(bc)){ - if (bd.block == originalBlock){ - if (bd.meta == originalMeta || originalMeta == -1){ - bd.block = newBlock; - if (newMeta != -1){ - bd.meta = newMeta; - } - } - } - } - } - } - - public HashMap> getAllowedBlocks(){ - return (HashMap>) allowedBlocks.clone(); - } - - public void deleteBlocksFromWorld(World world, int x, int y, int z) { - for (BlockCoord offset : allowedBlocks.keySet()){ - world.setBlockToAir(x + offset.x, y + offset.y, z + offset.z); - } - } - } - - private StructureGroup mainGroup; - private ArrayList blockGroups; - private ArrayList mutexCache; - - public static final int MAINGROUP_MUTEX = 1; - - private String id; - - private int maxX = 0; - private int minX = 0; - private int maxY = 0; - private int minY = 0; - private int maxZ = 0; - private int minZ = 0; - - public MultiblockStructureDefinition(String id){ - blockGroups = new ArrayList(); - mutexCache = new ArrayList(); - this.id = id; - - //default group - mainGroup = createGroup("main", MAINGROUP_MUTEX); - } - - public String getID(){ - return this.id; - } - - public ArrayList getMutexList(){ - return mutexCache; - } - - public ArrayList getGroupsForMutex(int mutex){ - ArrayList toReturn = new ArrayList(); - - for (StructureGroup group : blockGroups){ - if (group.mutex == mutex){ - toReturn.add(group); - } - } - - return toReturn; - } - - public ArrayList getAllowedBlocksAt(StructureGroup group, BlockCoord coord){ - return group.getAllowedBlocksAt(coord); - } - - public ArrayList getAllowedBlocksAt(BlockCoord coord){ - return mainGroup.getAllowedBlocksAt(coord); - } - - public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){ - - if (offsetY > maxY){ - maxY = offsetY; - }else if (offsetY < minY){ - minY = offsetY; - } - - if (offsetX > maxX){ - maxX = offsetX; - }else if (offsetX < minX){ - minX = offsetX; - } - - if (offsetZ > maxZ){ - maxZ = offsetZ; - }else if (offsetZ < minZ){ - minZ = offsetZ; - } - - mainGroup.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta); - } - - public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block){ - addAllowedBlock(offsetX, offsetY, offsetZ, block, -1); - } - - public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block, int meta){ - if (!blockGroups.contains(group)){ - blockGroups.add(group); - } - - if (offsetY > maxY){ - maxY = offsetY; - }else if (offsetY < minY){ - minY = offsetY; - } - - if (offsetX > maxX){ - maxX = offsetX; - }else if (offsetX < minX){ - minX = offsetX; - } - - if (offsetZ > maxZ){ - maxZ = offsetZ; - }else if (offsetZ < minZ){ - minZ = offsetZ; - } - - group.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta); - } - - public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block){ - addAllowedBlock(group, offsetX, offsetY, offsetZ, block, -1); - } - - public StructureGroup createGroup(String name, int mutex){ - if (!mutexCache.contains(mutex)){ - mutexCache.add(mutex); - } - StructureGroup group = new StructureGroup(name, mutex); - blockGroups.add(group); - return group; - } - - public StructureGroup copyGroup(String originalName, String destinationName, int newMutex){ - StructureGroup copyGroup = null; - for (StructureGroup group : blockGroups){ - if (group.name.equals(originalName)){ - copyGroup = group; - break; - } - } - - if (copyGroup == null) return null; - - StructureGroup newGroup; - - if (newMutex > -1){ - newGroup = new StructureGroup(destinationName, newMutex); - }else{ - newGroup = new StructureGroup(destinationName, copyGroup.mutex); - } - - for (BlockCoord bc : copyGroup.allowedBlocks.keySet()){ - for (BlockDec bd : copyGroup.allowedBlocks.get(bc)){ - newGroup.addAllowedBlock(bc.x, bc.y, bc.z, bd.block, bd.meta); - } - } - - blockGroups.add(newGroup); - - return newGroup; - } - - public StructureGroup copyGroup(String originalName, String destinationName){ - return copyGroup(originalName, destinationName, -1); - } - - public ArrayList getMatchedGroups(int mutex, World world, int originX, int originY, int originZ){ - ArrayList toReturn = new ArrayList(); - for (StructureGroup group : blockGroups){ - if ((group.mutex & mutex) == group.mutex){ - if (group.matchGroup(world, originX, originY, originZ)){ - toReturn.add(group); - } - } - } - return toReturn; - } - - private boolean matchMutex(int mutex, World world, int originX, int originY, int originZ){ - for (StructureGroup group : blockGroups){ - if ((group.mutex & mutex) == group.mutex){ - if (group.matchGroup(world, originX, originY, originZ)){ - return true; - } - } - } - return false; - } - - public boolean checkStructure(World world, int originX, int originY, int originZ){ - boolean valid = true; - for (int i: mutexCache){ - valid &= matchMutex(i, world, originX, originY, originZ); - if (!valid) break; - } - return valid; - } - - public int getMinLayer(){ - return this.minY; - } - - public int getMaxLayer(){ - return this.maxY; - } - - public int getHeight(){ - return this.maxY - this.minY; - } - - public int getWidth(){ - return this.maxX - this.minX; - } - - public int getLength(){ - return this.maxZ - this.minZ; - } - - public HashMap> getStructureLayer(int layer){ - return mainGroup.getStructureLayer(layer); - } - - public HashMap> getStructureLayer(StructureGroup group, int layer){ - return group.getStructureLayer(layer); - } - - public void removeMutex(int mutex, World world, int x, int y, int z){ - for (StructureGroup group : blockGroups){ - if (group.mutex == mutex){ - group.deleteBlocksFromWorld(world, x, y, z); - } - } - } +public class MultiblockStructureDefinition { + public class BlockDec { + Block block; + int meta; + + public BlockDec(Block block, int meta) { + this.block = block; + this.meta = meta; + } + + public Block getBlock() { + return block; + } + + public int getMeta() { + return meta; + } + + @Override + public String toString() { + String blockName = ""; + if (block != null) { + blockName = block.getLocalizedName(); + } else { + blockName = "Unknown"; + } + return String.format("Block: %s, meta: %d", blockName, meta); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof BlockDec) { + return this.block == ((BlockDec) obj).block + && (this.meta == -1 || ((BlockDec) obj).meta == -1 || this.meta == ((BlockDec) obj).meta); + } + return false; + } + + @Override + public int hashCode() { + return Block.getIdFromBlock(block); + } + } + + public class BlockCoord implements Comparable { + public int x; + public int y; + public int z; + + public BlockCoord(int offsetX, int offsetY, int offsetZ) { + this.x = offsetX; + this.y = offsetY; + this.z = offsetZ; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof BlockCoord) { + return this.x == ((BlockCoord) obj).x + && this.y == ((BlockCoord) obj).y + && this.z == ((BlockCoord) obj).z; + } + return false; + } + + @Override + public int hashCode() { + return this.x + this.y + this.z; + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getZ() { + return this.z; + } + + @Override + public String toString() { + return String.format("BlockCoord: %d, %d, %d", x, y, z); + } + + @Override + public int compareTo(BlockCoord o) { + return this.z > o.z + ? 1 + : this.z < o.z + ? -1 + : this.x > o.x ? 1 : this.x < o.x ? -1 : this.y > o.y ? 1 : this.y < o.y ? -1 : 0; + } + } + + public class StructureGroup { + String name; + int mutex; + HashMap> allowedBlocks; + + public StructureGroup(String name, int mutex) { + this.name = name; + this.mutex = mutex; + allowedBlocks = new HashMap>(); + } + + void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta) { + BlockCoord originOffset = new BlockCoord(offsetX, offsetY, offsetZ); + if (!allowedBlocks.containsKey(originOffset)) { + allowedBlocks.put(originOffset, new ArrayList()); + } + ArrayList positionReplacements = allowedBlocks.get(originOffset); + positionReplacements.add(new BlockDec(block, meta)); + } + + ArrayList getAllowedBlocksAt(BlockCoord coord) { + return allowedBlocks.get(coord); + } + + boolean matchGroup(World world, int originX, int originY, int originZ) { + for (BlockCoord offset : allowedBlocks.keySet()) { + Block block = world.getBlock(originX + offset.x, originY + offset.y, originZ + offset.z); + int meta = world.getBlockMetadata(originX + offset.x, originY + offset.y, originZ + offset.z); + ArrayList positionReplacements = allowedBlocks.get(offset); + boolean valid = false; + for (BlockDec bd : positionReplacements) { + if (bd.block == block && (bd.meta == -1 || bd.meta == meta)) { + valid = true; + } + } + if (!valid) return false; + } + return true; + } + + HashMap> getStructureLayer(int layer) { + HashMap> toReturn = + new HashMap>(); + + if (layer > getMaxLayer() || layer < getMinLayer()) { + return toReturn; + } + + for (BlockCoord bc : allowedBlocks.keySet()) { + if (bc.y == layer) { + toReturn.put(bc, allowedBlocks.get(bc)); + } + } + return toReturn; + } + + public void replaceAllBlocksOfType(Block originalBlock, Block newBlock) { + replaceAllBlocksOfType(originalBlock, -1, newBlock, -1); + } + + public void replaceAllBlocksOfType(Block originalBlock, int originalMeta, Block newBlock, int newMeta) { + for (BlockCoord bc : allowedBlocks.keySet()) { + for (BlockDec bd : allowedBlocks.get(bc)) { + if (bd.block == originalBlock) { + if (bd.meta == originalMeta || originalMeta == -1) { + bd.block = newBlock; + if (newMeta != -1) { + bd.meta = newMeta; + } + } + } + } + } + } + + public HashMap> getAllowedBlocks() { + return (HashMap>) allowedBlocks.clone(); + } + + public void deleteBlocksFromWorld(World world, int x, int y, int z) { + for (BlockCoord offset : allowedBlocks.keySet()) { + world.setBlockToAir(x + offset.x, y + offset.y, z + offset.z); + } + } + } + + private StructureGroup mainGroup; + private ArrayList blockGroups; + private ArrayList mutexCache; + + public static final int MAINGROUP_MUTEX = 1; + + private String id; + + private int maxX = 0; + private int minX = 0; + private int maxY = 0; + private int minY = 0; + private int maxZ = 0; + private int minZ = 0; + + public MultiblockStructureDefinition(String id) { + blockGroups = new ArrayList(); + mutexCache = new ArrayList(); + this.id = id; + + // default group + mainGroup = createGroup("main", MAINGROUP_MUTEX); + } + + public String getID() { + return this.id; + } + + public ArrayList getMutexList() { + return mutexCache; + } + + public ArrayList getGroupsForMutex(int mutex) { + ArrayList toReturn = new ArrayList(); + + for (StructureGroup group : blockGroups) { + if (group.mutex == mutex) { + toReturn.add(group); + } + } + + return toReturn; + } + + public ArrayList getAllowedBlocksAt(StructureGroup group, BlockCoord coord) { + return group.getAllowedBlocksAt(coord); + } + + public ArrayList getAllowedBlocksAt(BlockCoord coord) { + return mainGroup.getAllowedBlocksAt(coord); + } + + public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta) { + + if (offsetY > maxY) { + maxY = offsetY; + } else if (offsetY < minY) { + minY = offsetY; + } + + if (offsetX > maxX) { + maxX = offsetX; + } else if (offsetX < minX) { + minX = offsetX; + } + + if (offsetZ > maxZ) { + maxZ = offsetZ; + } else if (offsetZ < minZ) { + minZ = offsetZ; + } + + mainGroup.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta); + } + + public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block) { + addAllowedBlock(offsetX, offsetY, offsetZ, block, -1); + } + + public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block, int meta) { + if (!blockGroups.contains(group)) { + blockGroups.add(group); + } + + if (offsetY > maxY) { + maxY = offsetY; + } else if (offsetY < minY) { + minY = offsetY; + } + + if (offsetX > maxX) { + maxX = offsetX; + } else if (offsetX < minX) { + minX = offsetX; + } + + if (offsetZ > maxZ) { + maxZ = offsetZ; + } else if (offsetZ < minZ) { + minZ = offsetZ; + } + + group.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta); + } + + public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block) { + addAllowedBlock(group, offsetX, offsetY, offsetZ, block, -1); + } + + public StructureGroup createGroup(String name, int mutex) { + if (!mutexCache.contains(mutex)) { + mutexCache.add(mutex); + } + StructureGroup group = new StructureGroup(name, mutex); + blockGroups.add(group); + return group; + } + + public StructureGroup copyGroup(String originalName, String destinationName, int newMutex) { + StructureGroup copyGroup = null; + for (StructureGroup group : blockGroups) { + if (group.name.equals(originalName)) { + copyGroup = group; + break; + } + } + + if (copyGroup == null) return null; + + StructureGroup newGroup; + + if (newMutex > -1) { + newGroup = new StructureGroup(destinationName, newMutex); + } else { + newGroup = new StructureGroup(destinationName, copyGroup.mutex); + } + + for (BlockCoord bc : copyGroup.allowedBlocks.keySet()) { + for (BlockDec bd : copyGroup.allowedBlocks.get(bc)) { + newGroup.addAllowedBlock(bc.x, bc.y, bc.z, bd.block, bd.meta); + } + } + + blockGroups.add(newGroup); + + return newGroup; + } + + public StructureGroup copyGroup(String originalName, String destinationName) { + return copyGroup(originalName, destinationName, -1); + } + + public ArrayList getMatchedGroups(int mutex, World world, int originX, int originY, int originZ) { + ArrayList toReturn = new ArrayList(); + for (StructureGroup group : blockGroups) { + if ((group.mutex & mutex) == group.mutex) { + if (group.matchGroup(world, originX, originY, originZ)) { + toReturn.add(group); + } + } + } + return toReturn; + } + + private boolean matchMutex(int mutex, World world, int originX, int originY, int originZ) { + for (StructureGroup group : blockGroups) { + if ((group.mutex & mutex) == group.mutex) { + if (group.matchGroup(world, originX, originY, originZ)) { + return true; + } + } + } + return false; + } + + public boolean checkStructure(World world, int originX, int originY, int originZ) { + boolean valid = true; + for (int i : mutexCache) { + valid &= matchMutex(i, world, originX, originY, originZ); + if (!valid) break; + } + return valid; + } + + public int getMinLayer() { + return this.minY; + } + + public int getMaxLayer() { + return this.maxY; + } + + public int getHeight() { + return this.maxY - this.minY; + } + + public int getWidth() { + return this.maxX - this.minX; + } + + public int getLength() { + return this.maxZ - this.minZ; + } + + public HashMap> getStructureLayer(int layer) { + return mainGroup.getStructureLayer(layer); + } + + public HashMap> getStructureLayer(StructureGroup group, int layer) { + return group.getStructureLayer(layer); + } + + public void removeMutex(int mutex, World world, int x, int y, int z) { + for (StructureGroup group : blockGroups) { + if (group.mutex == mutex) { + group.deleteBlocksFromWorld(world, x, y, z); + } + } + } } diff --git a/src/api/java/am2/api/enchantment/IAMEnchantmentHelper.java b/src/api/java/am2/api/enchantment/IAMEnchantmentHelper.java index 59c914c..a42115a 100644 --- a/src/api/java/am2/api/enchantment/IAMEnchantmentHelper.java +++ b/src/api/java/am2/api/enchantment/IAMEnchantmentHelper.java @@ -1,12 +1,12 @@ package am2.api.enchantment; public interface IAMEnchantmentHelper { - /** - * Gets the current ID for soulbound enchantment - */ - public int getSoulboundID(); - /** - * Gets the current ID for magic resist enchantment - */ - public int getMagicResistID(); + /** + * Gets the current ID for soulbound enchantment + */ + public int getSoulboundID(); + /** + * Gets the current ID for magic resist enchantment + */ + public int getMagicResistID(); } diff --git a/src/api/java/am2/api/entities/IEntityManager.java b/src/api/java/am2/api/entities/IEntityManager.java index b2620df..41813e6 100644 --- a/src/api/java/am2/api/entities/IEntityManager.java +++ b/src/api/java/am2/api/entities/IEntityManager.java @@ -1,12 +1,12 @@ package am2.api.entities; public interface IEntityManager { - /** - * Adds the specified entities to the butchery blacklist (won't be affected by sigil of butchery) - */ - public void addButcheryBlacklist(Class...clazz); - /** - * Adds the specified entities to the progeny blacklist (won't be affected by sigil of progeny) - */ - public void addProgenyBlacklist(Class...clazz); + /** + * Adds the specified entities to the butchery blacklist (won't be affected by sigil of butchery) + */ + public void addButcheryBlacklist(Class... clazz); + /** + * Adds the specified entities to the progeny blacklist (won't be affected by sigil of progeny) + */ + public void addProgenyBlacklist(Class... clazz); } diff --git a/src/api/java/am2/api/events/ManaCostEvent.java b/src/api/java/am2/api/events/ManaCostEvent.java index 036a0f2..db41d04 100644 --- a/src/api/java/am2/api/events/ManaCostEvent.java +++ b/src/api/java/am2/api/events/ManaCostEvent.java @@ -9,16 +9,16 @@ import net.minecraft.item.ItemStack; * @author Mithion * */ -public class ManaCostEvent extends Event{ - public final ItemStack spell; - public final EntityLivingBase caster; - public float manaCost; - public float burnout; +public class ManaCostEvent extends Event { + public final ItemStack spell; + public final EntityLivingBase caster; + public float manaCost; + public float burnout; - public ManaCostEvent(ItemStack spell, EntityLivingBase caster, float manaCost, float burnout){ - this.spell = spell; - this.caster = caster; - this.manaCost = manaCost; - this.burnout = burnout; - } + public ManaCostEvent(ItemStack spell, EntityLivingBase caster, float manaCost, float burnout) { + this.spell = spell; + this.caster = caster; + this.manaCost = manaCost; + this.burnout = burnout; + } } diff --git a/src/api/java/am2/api/events/ModifierCalculatedEvent.java b/src/api/java/am2/api/events/ModifierCalculatedEvent.java index 1df2afe..8aa6b18 100644 --- a/src/api/java/am2/api/events/ModifierCalculatedEvent.java +++ b/src/api/java/am2/api/events/ModifierCalculatedEvent.java @@ -1,9 +1,9 @@ package am2.api.events; +import am2.api.spell.enums.SpellModifiers; import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -import am2.api.spell.enums.SpellModifiers; /** * Called whenever a spell's modified variable is calculated @@ -11,31 +11,37 @@ import am2.api.spell.enums.SpellModifiers; * */ public class ModifierCalculatedEvent extends Event { - //The attribute being modified - public final SpellModifiers attribute; - //The caster of the spell - public final EntityLivingBase caster; - //The spell being cast. This is a copy of the ItemStack. - public final ItemStack spell; - //the initial value of the variable - public final double initialValue; - //the type of operation being used to modify the value - public final OperationType operation; + // The attribute being modified + public final SpellModifiers attribute; + // The caster of the spell + public final EntityLivingBase caster; + // The spell being cast. This is a copy of the ItemStack. + public final ItemStack spell; + // the initial value of the variable + public final double initialValue; + // the type of operation being used to modify the value + public final OperationType operation; - //the final modified value of the variable - public double modifiedValue; + // the final modified value of the variable + public double modifiedValue; - public enum OperationType{ - ADD, - MULTIPLY - } + public enum OperationType { + ADD, + MULTIPLY + } - public ModifierCalculatedEvent(ItemStack spell, EntityLivingBase caster, SpellModifiers attribute, double initialValue, double modifiedValue, OperationType operation){ - this.spell = spell; - this.caster = caster; - this.attribute = attribute; - this.initialValue = initialValue; - this.modifiedValue = modifiedValue; - this.operation = operation; - } + public ModifierCalculatedEvent( + ItemStack spell, + EntityLivingBase caster, + SpellModifiers attribute, + double initialValue, + double modifiedValue, + OperationType operation) { + this.spell = spell; + this.caster = caster; + this.attribute = attribute; + this.initialValue = initialValue; + this.modifiedValue = modifiedValue; + this.operation = operation; + } } diff --git a/src/api/java/am2/api/events/PlayerMagicLevelChangeEvent.java b/src/api/java/am2/api/events/PlayerMagicLevelChangeEvent.java index 4da7262..6a15ec1 100644 --- a/src/api/java/am2/api/events/PlayerMagicLevelChangeEvent.java +++ b/src/api/java/am2/api/events/PlayerMagicLevelChangeEvent.java @@ -1,7 +1,7 @@ package am2.api.events; -import net.minecraft.entity.EntityLivingBase; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.entity.EntityLivingBase; /** * Raised when a player's magic level changes. @@ -9,11 +9,11 @@ import cpw.mods.fml.common.eventhandler.Event; * */ public class PlayerMagicLevelChangeEvent extends Event { - public final int level; - public final EntityLivingBase entity; + public final int level; + public final EntityLivingBase entity; - public PlayerMagicLevelChangeEvent(EntityLivingBase entity, int level){ - this.entity = entity; - this.level = level; - } + public PlayerMagicLevelChangeEvent(EntityLivingBase entity, int level) { + this.entity = entity; + this.level = level; + } } diff --git a/src/api/java/am2/api/events/ReconstructorRepairEvent.java b/src/api/java/am2/api/events/ReconstructorRepairEvent.java index d4ee631..b9d5b59 100644 --- a/src/api/java/am2/api/events/ReconstructorRepairEvent.java +++ b/src/api/java/am2/api/events/ReconstructorRepairEvent.java @@ -1,22 +1,22 @@ package am2.api.events; -import net.minecraft.item.ItemStack; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.item.ItemStack; @Cancelable -public class ReconstructorRepairEvent extends Event{ - - /** - * The item being repaired. - */ - public ItemStack item; - - /** - * Called when the arcane reconstructor ticks on repairing an item. - * @param item - */ - public ReconstructorRepairEvent(ItemStack item){ - this.item = item; - } +public class ReconstructorRepairEvent extends Event { + + /** + * The item being repaired. + */ + public ItemStack item; + + /** + * Called when the arcane reconstructor ticks on repairing an item. + * @param item + */ + public ReconstructorRepairEvent(ItemStack item) { + this.item = item; + } } diff --git a/src/api/java/am2/api/events/RegisterSkillTreeIcons.java b/src/api/java/am2/api/events/RegisterSkillTreeIcons.java index 4ed371f..ca9e293 100644 --- a/src/api/java/am2/api/events/RegisterSkillTreeIcons.java +++ b/src/api/java/am2/api/events/RegisterSkillTreeIcons.java @@ -1,12 +1,12 @@ package am2.api.events; -import cpw.mods.fml.common.eventhandler.Event; import am2.api.spell.ISpellIconManager; +import cpw.mods.fml.common.eventhandler.Event; -public class RegisterSkillTreeIcons extends Event{ - public final ISpellIconManager manager; +public class RegisterSkillTreeIcons extends Event { + public final ISpellIconManager manager; - public RegisterSkillTreeIcons(ISpellIconManager manager){ - this.manager = manager; - } + public RegisterSkillTreeIcons(ISpellIconManager manager) { + this.manager = manager; + } } diff --git a/src/api/java/am2/api/events/SkillLearnedEvent.java b/src/api/java/am2/api/events/SkillLearnedEvent.java index 1e53eb8..3b37e8f 100644 --- a/src/api/java/am2/api/events/SkillLearnedEvent.java +++ b/src/api/java/am2/api/events/SkillLearnedEvent.java @@ -1,20 +1,20 @@ package am2.api.events; -import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.eventhandler.Event; import am2.api.spell.component.interfaces.ISkillTreeEntry; +import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.entity.player.EntityPlayer; /** * Raised when a player learns a skill at the Occulus * @author Mithion * */ -public class SkillLearnedEvent extends Event{ - public final EntityPlayer player; - public final ISkillTreeEntry skill; +public class SkillLearnedEvent extends Event { + public final EntityPlayer player; + public final ISkillTreeEntry skill; - public SkillLearnedEvent(EntityPlayer player, ISkillTreeEntry entry){ - this.player = player; - this.skill = entry; - } + public SkillLearnedEvent(EntityPlayer player, ISkillTreeEntry entry) { + this.player = player; + this.skill = entry; + } } diff --git a/src/api/java/am2/api/events/SpellCastingEvent.java b/src/api/java/am2/api/events/SpellCastingEvent.java index 02c0b51..d81310f 100644 --- a/src/api/java/am2/api/events/SpellCastingEvent.java +++ b/src/api/java/am2/api/events/SpellCastingEvent.java @@ -1,93 +1,106 @@ package am2.api.events; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; import am2.api.spell.ItemSpellBase; import am2.api.spell.enums.SpellCastResult; +import cpw.mods.fml.common.eventhandler.Cancelable; +import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; -public class SpellCastingEvent{ - @Cancelable - public class Pre extends Event{ - /** - * The spell being cast - */ - public final ItemSpellBase spell; - /** - * The caster of the spell - */ - public final EntityLivingBase caster; - /** - * The calculated mana cost of the spell - */ - public final float manaCost; - /** - * The calculated burnout of the spell - */ - public final float burnout; - /** - * The itemstack representing the spell - */ - public final ItemStack stack; - /** - * The result to be returned after casting the spell - */ - public SpellCastResult castResult; - /** - * Is the spell channeled (maintained in any way, not the shape, so beam counts too) - */ - public final boolean isChanneled; +public class SpellCastingEvent { + @Cancelable + public class Pre extends Event { + /** + * The spell being cast + */ + public final ItemSpellBase spell; + /** + * The caster of the spell + */ + public final EntityLivingBase caster; + /** + * The calculated mana cost of the spell + */ + public final float manaCost; + /** + * The calculated burnout of the spell + */ + public final float burnout; + /** + * The itemstack representing the spell + */ + public final ItemStack stack; + /** + * The result to be returned after casting the spell + */ + public SpellCastResult castResult; + /** + * Is the spell channeled (maintained in any way, not the shape, so beam counts too) + */ + public final boolean isChanneled; - public Pre(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled){ - this.caster = caster; - this.spell = spell; - this.manaCost = manaCost; - this.burnout = burnout; - this.stack = stack; - this.isChanneled = isChanneled; - } - } - - @Cancelable - public class Post extends Event{ - /** - * The spell being cast - */ - public final ItemSpellBase spell; - /** - * The caster of the spell - */ - public final EntityLivingBase caster; - /** - * The calculated mana cost of the spell - */ - public final float manaCost; - /** - * The calculated burnout of the spell - */ - public final float burnout; - /** - * The itemstack representing the spell - */ - public final ItemStack stack; - /** - * The result to be returned after casting the spell - */ - public final SpellCastResult castResult; - /** - * Is the spell channeled (maintained in any way, not the shape, so beam counts too) - */ - public final boolean isChanneled; + public Pre( + ItemStack stack, + ItemSpellBase spell, + EntityLivingBase caster, + float manaCost, + float burnout, + boolean isChanneled) { + this.caster = caster; + this.spell = spell; + this.manaCost = manaCost; + this.burnout = burnout; + this.stack = stack; + this.isChanneled = isChanneled; + } + } - public Post(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled, SpellCastResult castResult){ - this.caster = caster; - this.spell = spell; - this.manaCost = manaCost; - this.burnout = burnout; - this.stack = stack; - this.isChanneled = isChanneled; - this.castResult = castResult; - } - } + @Cancelable + public class Post extends Event { + /** + * The spell being cast + */ + public final ItemSpellBase spell; + /** + * The caster of the spell + */ + public final EntityLivingBase caster; + /** + * The calculated mana cost of the spell + */ + public final float manaCost; + /** + * The calculated burnout of the spell + */ + public final float burnout; + /** + * The itemstack representing the spell + */ + public final ItemStack stack; + /** + * The result to be returned after casting the spell + */ + public final SpellCastResult castResult; + /** + * Is the spell channeled (maintained in any way, not the shape, so beam counts too) + */ + public final boolean isChanneled; + + public Post( + ItemStack stack, + ItemSpellBase spell, + EntityLivingBase caster, + float manaCost, + float burnout, + boolean isChanneled, + SpellCastResult castResult) { + this.caster = caster; + this.spell = spell; + this.manaCost = manaCost; + this.burnout = burnout; + this.stack = stack; + this.isChanneled = isChanneled; + this.castResult = castResult; + } + } } diff --git a/src/api/java/am2/api/events/SpellRecipeItemsEvent.java b/src/api/java/am2/api/events/SpellRecipeItemsEvent.java index 1186c1b..65309d6 100644 --- a/src/api/java/am2/api/events/SpellRecipeItemsEvent.java +++ b/src/api/java/am2/api/events/SpellRecipeItemsEvent.java @@ -2,32 +2,34 @@ package am2.api.events; import cpw.mods.fml.common.eventhandler.Event; -public class SpellRecipeItemsEvent extends Event{ - public final String registeredName; //The registered name of the spell part. Used to identify what spell shape/component/modifier we are working with - public final int ID; //The ID of the spell part. Also can be used to identify what we are working with, if you don't like strings. +public class SpellRecipeItemsEvent extends Event { + public final String registeredName; // The registered name of the spell part. Used to identify what spell + // shape/component/modifier we are working with + public final int + ID; // The ID of the spell part. Also can be used to identify what we are working with, if you don't like + // strings. - /** - * recipe items, in order, that need to be thrown into the crafting altar in order to create the item. - *
- * Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts. - *
- * Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored. - *
- * Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags, - *
- * For example: - *
-	 *     new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
-	 *     new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
-	 *     etc.
-	 *
- */ - public Object[] recipeItems; //The actual recipe items. Change or verify them here. - - public SpellRecipeItemsEvent(String name, int ID, Object[] recipeItems){ - registeredName = name; - this.ID = ID; - this.recipeItems = recipeItems; - } + /** + * recipe items, in order, that need to be thrown into the crafting altar in order to create the item. + *
+ * Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts. + *
+ * Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored. + *
+ * Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags, + *
+ * For example: + *
+     *     new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
+     *     new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
+     *     etc.
+     *
+ */ + public Object[] recipeItems; // The actual recipe items. Change or verify them here. + public SpellRecipeItemsEvent(String name, int ID, Object[] recipeItems) { + registeredName = name; + this.ID = ID; + this.recipeItems = recipeItems; + } } diff --git a/src/api/java/am2/api/flickers/IFlickerController.java b/src/api/java/am2/api/flickers/IFlickerController.java index 5259d02..2d5fe87 100644 --- a/src/api/java/am2/api/flickers/IFlickerController.java +++ b/src/api/java/am2/api/flickers/IFlickerController.java @@ -2,8 +2,10 @@ package am2.api.flickers; import net.minecraft.tileentity.TileEntity; -public interface IFlickerController { - public byte[] getMetadata(IFlickerFunctionality operator); - public void setMetadata(IFlickerFunctionality operator, byte[] meta); - public void removeMetadata(IFlickerFunctionality operator); +public interface IFlickerController { + public byte[] getMetadata(IFlickerFunctionality operator); + + public void setMetadata(IFlickerFunctionality operator, byte[] meta); + + public void removeMetadata(IFlickerFunctionality operator); } diff --git a/src/api/java/am2/api/flickers/IFlickerFunctionality.java b/src/api/java/am2/api/flickers/IFlickerFunctionality.java index 0073993..a70c594 100644 --- a/src/api/java/am2/api/flickers/IFlickerFunctionality.java +++ b/src/api/java/am2/api/flickers/IFlickerFunctionality.java @@ -1,15 +1,22 @@ package am2.api.flickers; -import net.minecraft.world.World; import am2.api.spell.enums.Affinity; +import net.minecraft.world.World; public interface IFlickerFunctionality { - boolean RequiresPower(); - int PowerPerOperation(); - boolean DoOperation(World worldObj, IFlickerController controller, boolean powered); - boolean DoOperation(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers); - void RemoveOperator(World worldObj, IFlickerController controller, boolean powered); - int TimeBetweenOperation(boolean powered, Affinity[] flickers); - void RemoveOperator(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers); - Object[] getRecipe(); + boolean RequiresPower(); + + int PowerPerOperation(); + + boolean DoOperation(World worldObj, IFlickerController controller, boolean powered); + + boolean DoOperation(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers); + + void RemoveOperator(World worldObj, IFlickerController controller, boolean powered); + + int TimeBetweenOperation(boolean powered, Affinity[] flickers); + + void RemoveOperator(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers); + + Object[] getRecipe(); } diff --git a/src/api/java/am2/api/flickers/IFlickerRegistry.java b/src/api/java/am2/api/flickers/IFlickerRegistry.java index 8b8ddc7..cc4928e 100644 --- a/src/api/java/am2/api/flickers/IFlickerRegistry.java +++ b/src/api/java/am2/api/flickers/IFlickerRegistry.java @@ -1,11 +1,11 @@ package am2.api.flickers; public interface IFlickerRegistry { - /** - * Attempts to register a flicker operator into the flicker network - * @param singleton The instance of the class that should be called upon to perform the operations when loaded into a flicker block - * @param mask The bit mask representing the flicker combination. These are ORed affinity masks. @see am2.api.spell.enums.Affinity.getMask for specific mask flags (flickers represent an affinity) - * @return True if registered, false if the mask is already in use. - */ - public boolean registerFlickerOperator(IFlickerFunctionality singleton, int mask); + /** + * Attempts to register a flicker operator into the flicker network + * @param singleton The instance of the class that should be called upon to perform the operations when loaded into a flicker block + * @param mask The bit mask representing the flicker combination. These are ORed affinity masks. @see am2.api.spell.enums.Affinity.getMask for specific mask flags (flickers represent an affinity) + * @return True if registered, false if the mask is already in use. + */ + public boolean registerFlickerOperator(IFlickerFunctionality singleton, int mask); } diff --git a/src/api/java/am2/api/illeffect/BadThingTypes.java b/src/api/java/am2/api/illeffect/BadThingTypes.java index 3ac544f..529e4a6 100644 --- a/src/api/java/am2/api/illeffect/BadThingTypes.java +++ b/src/api/java/am2/api/illeffect/BadThingTypes.java @@ -1,6 +1,6 @@ package am2.api.illeffect; -public enum BadThingTypes{ - ALL, - DARKNEXUS -} \ No newline at end of file +public enum BadThingTypes { + ALL, + DARKNEXUS +} diff --git a/src/api/java/am2/api/illeffect/IIllEffect.java b/src/api/java/am2/api/illeffect/IIllEffect.java index 2c1f111..9b2ff9e 100644 --- a/src/api/java/am2/api/illeffect/IIllEffect.java +++ b/src/api/java/am2/api/illeffect/IIllEffect.java @@ -1,8 +1,6 @@ package am2.api.illeffect; -import java.util.List; import java.util.Map; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -14,25 +12,25 @@ import net.minecraft.world.World; * */ public interface IIllEffect extends Comparable { - /** - * The severity level of the effect. Controls at what instability level the effect could be applied. - * @return One of the values in the IllEffectSeverity enum. - */ - public IllEffectSeverity GetSeverity(); - - /** - * Callback to actually apply the ill effect. - * @param world The world the effect is happening in - * @param x The x coordinate of the vinteum crystal - * @param y The y coordinate of the vinteum crystal - * @param z The z coordinate of the vinteum crystal - * @return A map of entity players affected, as well as any metadata relevant to the effect applied on that player. - */ - public Map ApplyIllEffect(World world, int x, int y, int z); - - /** - * Gets the localized description of this ill effect as pertains to the affected entity player. - * This will only be called based on your own class, so you can assume the metadata matches your metadata output from ApplyIllEffect. - */ - public String getDescription(EntityPlayer player, Object metadata); + /** + * The severity level of the effect. Controls at what instability level the effect could be applied. + * @return One of the values in the IllEffectSeverity enum. + */ + public IllEffectSeverity GetSeverity(); + + /** + * Callback to actually apply the ill effect. + * @param world The world the effect is happening in + * @param x The x coordinate of the vinteum crystal + * @param y The y coordinate of the vinteum crystal + * @param z The z coordinate of the vinteum crystal + * @return A map of entity players affected, as well as any metadata relevant to the effect applied on that player. + */ + public Map ApplyIllEffect(World world, int x, int y, int z); + + /** + * Gets the localized description of this ill effect as pertains to the affected entity player. + * This will only be called based on your own class, so you can assume the metadata matches your metadata output from ApplyIllEffect. + */ + public String getDescription(EntityPlayer player, Object metadata); } diff --git a/src/api/java/am2/api/illeffect/IllEffectBase.java b/src/api/java/am2/api/illeffect/IllEffectBase.java index 4ca2293..7f7e7af 100644 --- a/src/api/java/am2/api/illeffect/IllEffectBase.java +++ b/src/api/java/am2/api/illeffect/IllEffectBase.java @@ -1,8 +1,6 @@ package am2.api.illeffect; -import java.util.List; import java.util.Map; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -11,31 +9,30 @@ import net.minecraft.world.World; * @author Mithion * */ -public abstract class IllEffectBase implements IIllEffect{ +public abstract class IllEffectBase implements IIllEffect { - @Override - public final int compareTo(Object o) { - if (!(o instanceof IIllEffect)) return 0; - IIllEffect right = (IIllEffect)o; - int myOrdinal = this.GetSeverity().ordinal(); - int theirOrdinal = right.GetSeverity().ordinal(); - - if (myOrdinal == theirOrdinal){ - return 0; - }else if (myOrdinal < theirOrdinal){ - return -1; - }else{ - return 1; - } - } + @Override + public final int compareTo(Object o) { + if (!(o instanceof IIllEffect)) return 0; + IIllEffect right = (IIllEffect) o; + int myOrdinal = this.GetSeverity().ordinal(); + int theirOrdinal = right.GetSeverity().ordinal(); - @Override - public abstract IllEffectSeverity GetSeverity(); - - @Override - public abstract String getDescription(EntityPlayer player, Object metadata); + if (myOrdinal == theirOrdinal) { + return 0; + } else if (myOrdinal < theirOrdinal) { + return -1; + } else { + return 1; + } + } - @Override - public abstract Map ApplyIllEffect(World world, int x, int y, int z); + @Override + public abstract IllEffectSeverity GetSeverity(); + @Override + public abstract String getDescription(EntityPlayer player, Object metadata); + + @Override + public abstract Map ApplyIllEffect(World world, int x, int y, int z); } diff --git a/src/api/java/am2/api/illeffect/IllEffectSeverity.java b/src/api/java/am2/api/illeffect/IllEffectSeverity.java index d86c9bb..ff3cf61 100644 --- a/src/api/java/am2/api/illeffect/IllEffectSeverity.java +++ b/src/api/java/am2/api/illeffect/IllEffectSeverity.java @@ -6,9 +6,9 @@ package am2.api.illeffect; * */ public enum IllEffectSeverity { - MINOR, - MODERATE, - MAJOR, - SEVERE, - FATAL + MINOR, + MODERATE, + MAJOR, + SEVERE, + FATAL } diff --git a/src/api/java/am2/api/items/IKeystoneHelper.java b/src/api/java/am2/api/items/IKeystoneHelper.java index 7b0b192..f84e17d 100644 --- a/src/api/java/am2/api/items/IKeystoneHelper.java +++ b/src/api/java/am2/api/items/IKeystoneHelper.java @@ -1,30 +1,29 @@ package am2.api.items; +import am2.api.blocks.IKeystoneLockable; import java.util.ArrayList; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import am2.api.blocks.IKeystoneLockable; public interface IKeystoneHelper { - /** - * Gets all the keys from all keystones in the entity's inventory - */ - public ArrayList GetKeysInInvenory(EntityLivingBase ent); + /** + * Gets all the keys from all keystones in the entity's inventory + */ + public ArrayList GetKeysInInvenory(EntityLivingBase ent); - /** - * Returns the key combination made by the specified runes - * @param runes An array of runes no larger than three elements (anything above will be ignored) - * @return - */ - public long getKeyFromRunes(ItemStack[] runes); + /** + * Returns the key combination made by the specified runes + * @param runes An array of runes no larger than three elements (anything above will be ignored) + * @return + */ + public long getKeyFromRunes(ItemStack[] runes); - /** - * Returns true or false based on whether the passed in player meets the keystone requirements needed to access the specified container - * @param inventory The inventory the player is trying to access - * @param player The player attempting the access check - * @return True if the conditions are met, otherwise false - */ - public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player); + /** + * Returns true or false based on whether the passed in player meets the keystone requirements needed to access the specified container + * @param inventory The inventory the player is trying to access + * @param player The player attempting the access check + * @return True if the conditions are met, otherwise false + */ + public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player); } diff --git a/src/api/java/am2/api/items/armor/ArmorTextureEvent.java b/src/api/java/am2/api/items/armor/ArmorTextureEvent.java index 2701d9b..fca2539 100644 --- a/src/api/java/am2/api/items/armor/ArmorTextureEvent.java +++ b/src/api/java/am2/api/items/armor/ArmorTextureEvent.java @@ -2,15 +2,14 @@ package am2.api.items.armor; import cpw.mods.fml.common.eventhandler.Event; +public class ArmorTextureEvent extends Event { + public final int slot; + public final int renderIndex; -public class ArmorTextureEvent extends Event{ - public final int slot; - public final int renderIndex; + public String texture; - public String texture; - - public ArmorTextureEvent(int slot, int renderIndex){ - this.slot = slot; - this.renderIndex = renderIndex; - } + public ArmorTextureEvent(int slot, int renderIndex) { + this.slot = slot; + this.renderIndex = renderIndex; + } } diff --git a/src/api/java/am2/api/items/armor/IArmorImbuement.java b/src/api/java/am2/api/items/armor/IArmorImbuement.java index fe71ed7..1661a39 100644 --- a/src/api/java/am2/api/items/armor/IArmorImbuement.java +++ b/src/api/java/am2/api/items/armor/IArmorImbuement.java @@ -1,60 +1,60 @@ package am2.api.items.armor; import java.util.EnumSet; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public interface IArmorImbuement { - /** - * Gets the ID of the infusion effect. Must be unique. - */ - String getID(); - /** - * Gets the IIcon index for the texture in the GUI - */ - int getIconIndex(); - /** - * Gets the tier for this infusion - */ - ImbuementTiers getTier(); - /** - * Gets all situations under which this infusion applies - */ - EnumSet getApplicationTypes(); - /** - * Applies the effect. This will be called when any of the application types is matched in an event. - * @param player The player wearing the armor - * @param world The world the player is in - * @param stack The itemstack that was matched - * @param matchedType The application type that was matched. - * @param params Depends on the application type. - *
- * In the case of ON_TICK, it will be a 1-length array with the first element being the LivingEvent event
- * In the case of ON_JUMP, it will be a 1-length array with the first element being the LivingJumpEvent event
- * In the case of ON_HIT, it will be a 1-length array with the first element being the LivingHurtEvent event
- * In the case of ON_MINING_SPEED, it will be a 1-length array with the first element being the BreakSpeed event
- */ - boolean applyEffect(EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object...params); + /** + * Gets the ID of the infusion effect. Must be unique. + */ + String getID(); + /** + * Gets the IIcon index for the texture in the GUI + */ + int getIconIndex(); + /** + * Gets the tier for this infusion + */ + ImbuementTiers getTier(); + /** + * Gets all situations under which this infusion applies + */ + EnumSet getApplicationTypes(); + /** + * Applies the effect. This will be called when any of the application types is matched in an event. + * @param player The player wearing the armor + * @param world The world the player is in + * @param stack The itemstack that was matched + * @param matchedType The application type that was matched. + * @param params Depends on the application type. + *
+ * In the case of ON_TICK, it will be a 1-length array with the first element being the LivingEvent event
+ * In the case of ON_JUMP, it will be a 1-length array with the first element being the LivingJumpEvent event
+ * In the case of ON_HIT, it will be a 1-length array with the first element being the LivingHurtEvent event
+ * In the case of ON_MINING_SPEED, it will be a 1-length array with the first element being the BreakSpeed event
+ */ + boolean applyEffect( + EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object... params); - /** - * Gets all armor slots that this effect can be applied to - */ - int[] getValidSlots(); + /** + * Gets all armor slots that this effect can be applied to + */ + int[] getValidSlots(); - /** - * If the slot is on cooldown, can the effect still apply? - */ - boolean canApplyOnCooldown(); + /** + * If the slot is on cooldown, can the effect still apply? + */ + boolean canApplyOnCooldown(); - /** - * Get the amount of cooldown to add to the slot once the effect applies - */ - int getCooldown(); + /** + * Get the amount of cooldown to add to the slot once the effect applies + */ + int getCooldown(); - /** - * How much does the infusion damage the armor? - */ - int getArmorDamage(); + /** + * How much does the infusion damage the armor? + */ + int getArmorDamage(); } diff --git a/src/api/java/am2/api/items/armor/IImbuementRegistry.java b/src/api/java/am2/api/items/armor/IImbuementRegistry.java index fad9d28..d97dec5 100644 --- a/src/api/java/am2/api/items/armor/IImbuementRegistry.java +++ b/src/api/java/am2/api/items/armor/IImbuementRegistry.java @@ -2,27 +2,26 @@ package am2.api.items.armor; import net.minecraft.item.ItemStack; - public interface IImbuementRegistry { - /** - * Registers a new imbuement instance into the system - */ - void registerImbuement(IArmorImbuement imbuementInstance); - /** - * Locates the specified imbuement registered to the passed-in ID. - * Returns null if not found. - */ - IArmorImbuement getImbuementByID(String ID); - /** - * Returns all imbuements registered into the specified tier for the given armor type (slot). - */ - IArmorImbuement[] getImbuementsForTier(ImbuementTiers tier, int armorType); - /** - * Is the given imbuement instance present on the passed-in item stack? - */ - boolean isImbuementPresent(ItemStack stack, IArmorImbuement imbuement); - /** - * Is the given imbuement ID present on the passed-in item stack? - */ - boolean isImbuementPresent(ItemStack stack, String id); + /** + * Registers a new imbuement instance into the system + */ + void registerImbuement(IArmorImbuement imbuementInstance); + /** + * Locates the specified imbuement registered to the passed-in ID. + * Returns null if not found. + */ + IArmorImbuement getImbuementByID(String ID); + /** + * Returns all imbuements registered into the specified tier for the given armor type (slot). + */ + IArmorImbuement[] getImbuementsForTier(ImbuementTiers tier, int armorType); + /** + * Is the given imbuement instance present on the passed-in item stack? + */ + boolean isImbuementPresent(ItemStack stack, IArmorImbuement imbuement); + /** + * Is the given imbuement ID present on the passed-in item stack? + */ + boolean isImbuementPresent(ItemStack stack, String id); } diff --git a/src/api/java/am2/api/items/armor/ImbuementApplicationTypes.java b/src/api/java/am2/api/items/armor/ImbuementApplicationTypes.java index 4eb633a..d072ef0 100644 --- a/src/api/java/am2/api/items/armor/ImbuementApplicationTypes.java +++ b/src/api/java/am2/api/items/armor/ImbuementApplicationTypes.java @@ -1,10 +1,10 @@ package am2.api.items.armor; public enum ImbuementApplicationTypes { - NONE, - ON_TICK, - ON_HIT, - ON_JUMP, - ON_MINING_SPEED, - ON_DEATH + NONE, + ON_TICK, + ON_HIT, + ON_JUMP, + ON_MINING_SPEED, + ON_DEATH } diff --git a/src/api/java/am2/api/items/armor/ImbuementTiers.java b/src/api/java/am2/api/items/armor/ImbuementTiers.java index b6c8b90..fbd4a51 100644 --- a/src/api/java/am2/api/items/armor/ImbuementTiers.java +++ b/src/api/java/am2/api/items/armor/ImbuementTiers.java @@ -1,8 +1,8 @@ package am2.api.items.armor; public enum ImbuementTiers { - FIRST, - SECOND, - THIRD, - FOURTH + FIRST, + SECOND, + THIRD, + FOURTH } diff --git a/src/api/java/am2/api/math/AMLineSegment.java b/src/api/java/am2/api/math/AMLineSegment.java index d723ab0..0103183 100644 --- a/src/api/java/am2/api/math/AMLineSegment.java +++ b/src/api/java/am2/api/math/AMLineSegment.java @@ -1,42 +1,39 @@ package am2.api.math; public class AMLineSegment { - private AMVector3 a,b; + private AMVector3 a, b; - public AMLineSegment(AMVector3 a, AMVector3 b){ - this.a = a; - this.b = b; - } + public AMLineSegment(AMVector3 a, AMVector3 b) { + this.a = a; + this.b = b; + } - public AMVector3 closestPointOnLine(AMVector3 vPoint) - { + public AMVector3 closestPointOnLine(AMVector3 vPoint) { - // Create the vector from end point vA to our point vPoint. - AMVector3 vVector1 = vPoint.copy().sub(a); + // Create the vector from end point vA to our point vPoint. + AMVector3 vVector1 = vPoint.copy().sub(a); - // Create a normalized direction vector from end point vA to end point vB - AMVector3 vVector2 = b.copy().sub(a).normalize(); + // Create a normalized direction vector from end point vA to end point vB + AMVector3 vVector2 = b.copy().sub(a).normalize(); - // Use the distance formula to find the distance of the line segment (or magnitude) - float d = (float) a.distanceTo(b); + // Use the distance formula to find the distance of the line segment (or magnitude) + float d = (float) a.distanceTo(b); - // Using the dot product, we project the vVector1 onto the vector vVector2. - // This essentially gives us the distance from our projected vector from vA. - float t = AMVector3.dotProduct(vVector2, vVector1); + // Using the dot product, we project the vVector1 onto the vector vVector2. + // This essentially gives us the distance from our projected vector from vA. + float t = AMVector3.dotProduct(vVector2, vVector1); - // If our projected distance from vA, "t", is less than or equal to 0, it must - // be closest to the end point vA. We want to return this end point. - if (t <= 0) - return a.copy(); + // If our projected distance from vA, "t", is less than or equal to 0, it must + // be closest to the end point vA. We want to return this end point. + if (t <= 0) return a.copy(); - // If our projected distance from vA, "t", is greater than or equal to the magnitude - // or distance of the line segment, it must be closest to the end point vB. So, return vB. - if (t >= d) - return b.copy(); + // If our projected distance from vA, "t", is greater than or equal to the magnitude + // or distance of the line segment, it must be closest to the end point vB. So, return vB. + if (t >= d) return b.copy(); - AMVector3 vVector3 = vVector2.copy().scale(t); - AMVector3 vClosestPoint = a.copy().add(vVector3); + AMVector3 vVector3 = vVector2.copy().scale(t); + AMVector3 vClosestPoint = a.copy().add(vVector3); - return vClosestPoint; - } + return vClosestPoint; + } } diff --git a/src/api/java/am2/api/math/AMMatrix4.java b/src/api/java/am2/api/math/AMMatrix4.java index 402d9e5..0bd2582 100644 --- a/src/api/java/am2/api/math/AMMatrix4.java +++ b/src/api/java/am2/api/math/AMMatrix4.java @@ -1,56 +1,50 @@ package am2.api.math; +public class AMMatrix4 { + float[] mat; -public class AMMatrix4 -{ - float[] mat; + public AMMatrix4() { + loadIdentity(); + } - public AMMatrix4() - { - loadIdentity(); - } + public AMMatrix4 loadIdentity() { + this.mat = new float[16]; + float tmp35_34 = (this.mat[10] = this.mat[15] = 1.0F); + this.mat[5] = tmp35_34; + this.mat[0] = tmp35_34; + return this; + } - public AMMatrix4 loadIdentity() - { - this.mat = new float[16]; - float tmp35_34 = (this.mat[10] = this.mat[15] = 1.0F); - this.mat[5] = tmp35_34; - this.mat[0] = tmp35_34; - return this; - } + public AMVector3 translate(AMVector3 vec) { + float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3]; + float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7]; + float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11]; + vec.x = x; + vec.y = y; + vec.z = z; + return vec; + } - public AMVector3 translate(AMVector3 vec) - { - float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3]; - float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7]; - float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11]; - vec.x = x; - vec.y = y; - vec.z = z; - return vec; - } - - public static AMMatrix4 rotationMat(double angle, AMVector3 axis) - { - axis = axis.copy().normalize(); - float x = axis.x; - float y = axis.y; - float z = axis.z; - angle *= 0.0174532925D; - float cos = (float)Math.cos(angle); - float ocos = 1.0F - cos; - float sin = (float)Math.sin(angle); - AMMatrix4 rotmat = new AMMatrix4(); - rotmat.mat[0] = (x * x * ocos + cos); - rotmat.mat[1] = (y * x * ocos + z * sin); - rotmat.mat[2] = (x * z * ocos - y * sin); - rotmat.mat[4] = (x * y * ocos - z * sin); - rotmat.mat[5] = (y * y * ocos + cos); - rotmat.mat[6] = (y * z * ocos + x * sin); - rotmat.mat[8] = (x * z * ocos + y * sin); - rotmat.mat[9] = (y * z * ocos - x * sin); - rotmat.mat[10] = (z * z * ocos + cos); - rotmat.mat[15] = 1.0F; - return rotmat; - } + public static AMMatrix4 rotationMat(double angle, AMVector3 axis) { + axis = axis.copy().normalize(); + float x = axis.x; + float y = axis.y; + float z = axis.z; + angle *= 0.0174532925D; + float cos = (float) Math.cos(angle); + float ocos = 1.0F - cos; + float sin = (float) Math.sin(angle); + AMMatrix4 rotmat = new AMMatrix4(); + rotmat.mat[0] = (x * x * ocos + cos); + rotmat.mat[1] = (y * x * ocos + z * sin); + rotmat.mat[2] = (x * z * ocos - y * sin); + rotmat.mat[4] = (x * y * ocos - z * sin); + rotmat.mat[5] = (y * y * ocos + cos); + rotmat.mat[6] = (y * z * ocos + x * sin); + rotmat.mat[8] = (x * z * ocos + y * sin); + rotmat.mat[9] = (y * z * ocos - x * sin); + rotmat.mat[10] = (z * z * ocos + cos); + rotmat.mat[15] = 1.0F; + return rotmat; + } } diff --git a/src/api/java/am2/api/math/AMPlane.java b/src/api/java/am2/api/math/AMPlane.java index 28ed9a9..06e733e 100644 --- a/src/api/java/am2/api/math/AMPlane.java +++ b/src/api/java/am2/api/math/AMPlane.java @@ -1,47 +1,54 @@ package am2.api.math; public class AMPlane { - AMVector3 planeDef[]; + AMVector3 planeDef[]; - public AMPlane(AMVector3...plane){ - planeDef = plane; - } + public AMPlane(AMVector3... plane) { + planeDef = plane; + } - private AMVector3 planeNormal(){ - AMVector3 vVector1 = new AMVector3(planeDef[2], planeDef[0]); - AMVector3 vVector2 = new AMVector3(planeDef[1], planeDef[0]); + private AMVector3 planeNormal() { + AMVector3 vVector1 = new AMVector3(planeDef[2], planeDef[0]); + AMVector3 vVector2 = new AMVector3(planeDef[1], planeDef[0]); - AMVector3 vNormal = AMVector3.crossProduct(vVector1, vVector2); + AMVector3 vNormal = AMVector3.crossProduct(vVector1, vVector2); - vNormal.normalize(); - return vNormal; - } + vNormal.normalize(); + return vNormal; + } - private float planeDistance(AMVector3 normal, AMVector3 point){ - float distance = 0; - distance = - ((normal.x * point.x) + (normal.y * point.y) + (normal.z * point.z)); + private float planeDistance(AMVector3 normal, AMVector3 point) { + float distance = 0; + distance = -((normal.x * point.x) + (normal.y * point.y) + (normal.z * point.z)); - return distance; - } + return distance; + } - public boolean lineSegmentCrosses(AMVector3 p1, AMVector3 p2){ - float distance1=0, distance2=0; + public boolean lineSegmentCrosses(AMVector3 p1, AMVector3 p2) { + float distance1 = 0, distance2 = 0; - AMVector3 vNormal = planeNormal(); + AMVector3 vNormal = planeNormal(); - float originDistance = planeDistance(vNormal, planeDef[0]); + float originDistance = planeDistance(vNormal, planeDef[0]); - distance1 = ((vNormal.x * p1.x) + // Ax + - (vNormal.y * p1.y) + // Bx + - (vNormal.z * p1.z)) + originDistance; // Cz + D + distance1 = ((vNormal.x * p1.x) + + // Ax + + (vNormal.y * p1.y) + + // Bx + + (vNormal.z * p1.z)) + + originDistance; // Cz + D - distance2 = ((vNormal.x * p2.x) + // Ax + - (vNormal.y * p2.y) + // Bx + - (vNormal.z * p2.z)) + originDistance; // Cz + D + distance2 = ((vNormal.x * p2.x) + + // Ax + + (vNormal.y * p2.y) + + // Bx + + (vNormal.z * p2.z)) + + originDistance; // Cz + D - if(distance1 * distance2 >= 0) // Check to see if both point's distances are both negative or both positive - return false; // Return false if each point has the same sign. -1 and 1 would mean each point is on either side of the plane. -1 -2 or 3 4 wouldn't... + if (distance1 * distance2 >= 0) // Check to see if both point's distances are both negative or both positive + return false; // Return false if each point has the same sign. -1 and 1 would mean each point is on either side + // of the plane. -1 -2 or 3 4 wouldn't... - return true; // The line intersected the plane, Return TRUE - } + return true; // The line intersected the plane, Return TRUE + } } diff --git a/src/api/java/am2/api/math/AMVector2.java b/src/api/java/am2/api/math/AMVector2.java index 84b7b82..d20706d 100644 --- a/src/api/java/am2/api/math/AMVector2.java +++ b/src/api/java/am2/api/math/AMVector2.java @@ -1,32 +1,32 @@ package am2.api.math; public class AMVector2 { - public double x; - public double y; - - public int iX; - public int iY; - - public AMVector2(double x, double y){ - this.x = x; - this.y = y; - this.iX = (int)x; - this.iY = (int)y; - } - - public AMVector2 subtract(AMVector2 vec){ - return new AMVector2(this.x - vec.x, this.y - vec.y); - } - - public AMVector2 add(AMVector2 vec){ - return new AMVector2(this.x + vec.x, this.y + vec.y); - } - - public AMVector2 multiply(AMVector2 vec){ - return new AMVector2(this.x * vec.x, this.y * vec.y); - } - - public AMVector2 divide(AMVector2 vec){ - return new AMVector2(this.x / vec.x, this.y / vec.y); - } + public double x; + public double y; + + public int iX; + public int iY; + + public AMVector2(double x, double y) { + this.x = x; + this.y = y; + this.iX = (int) x; + this.iY = (int) y; + } + + public AMVector2 subtract(AMVector2 vec) { + return new AMVector2(this.x - vec.x, this.y - vec.y); + } + + public AMVector2 add(AMVector2 vec) { + return new AMVector2(this.x + vec.x, this.y + vec.y); + } + + public AMVector2 multiply(AMVector2 vec) { + return new AMVector2(this.x * vec.x, this.y * vec.y); + } + + public AMVector2 divide(AMVector2 vec) { + return new AMVector2(this.x / vec.x, this.y / vec.y); + } } diff --git a/src/api/java/am2/api/math/AMVector3.java b/src/api/java/am2/api/math/AMVector3.java index a38c098..debfeca 100644 --- a/src/api/java/am2/api/math/AMVector3.java +++ b/src/api/java/am2/api/math/AMVector3.java @@ -6,241 +6,219 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; -public class AMVector3 -{ - public float x; - public float y; - public float z; +public class AMVector3 { + public float x; + public float y; + public float z; - public AMVector3(double x, double y, double z) - { - this.x = (float)x; - this.y = (float)y; - this.z = (float)z; - } + public AMVector3(double x, double y, double z) { + this.x = (float) x; + this.y = (float) y; + this.z = (float) z; + } - public AMVector3(TileEntity tile) - { - this.x = (tile.xCoord); - this.y = (tile.yCoord); - this.z = (tile.zCoord); - } + public AMVector3(TileEntity tile) { + this.x = (tile.xCoord); + this.y = (tile.yCoord); + this.z = (tile.zCoord); + } - public AMVector3(Vec3 vec){ - this.x = (float) vec.xCoord; - this.y = (float) vec.yCoord; - this.z = (float) vec.zCoord; - } + public AMVector3(Vec3 vec) { + this.x = (float) vec.xCoord; + this.y = (float) vec.yCoord; + this.z = (float) vec.zCoord; + } - public AMVector3(AMVector3 a, AMVector3 b){ - this.x = a.x - b.x; // Get the X value of our new vector - this.y = a.y - b.y; // Get the Y value of our new vector - this.z = a.z - b.z; // Get the Z value of our new vector - } + public AMVector3(AMVector3 a, AMVector3 b) { + this.x = a.x - b.x; // Get the X value of our new vector + this.y = a.y - b.y; // Get the Y value of our new vector + this.z = a.z - b.z; // Get the Z value of our new vector + } - public AMVector3(Entity entity) - { - this(entity.posX, entity.posY, entity.posZ); - } + public AMVector3(Entity entity) { + this(entity.posX, entity.posY, entity.posZ); + } - public AMVector3 add(AMVector3 vec) - { - this.x += vec.x; - this.y += vec.y; - this.z += vec.z; - return this; - } + public AMVector3 add(AMVector3 vec) { + this.x += vec.x; + this.y += vec.y; + this.z += vec.z; + return this; + } - public AMVector3 sub(AMVector3 vec) - { - this.x -= vec.x; - this.y -= vec.y; - this.z -= vec.z; - return this; - } + public AMVector3 sub(AMVector3 vec) { + this.x -= vec.x; + this.y -= vec.y; + this.z -= vec.z; + return this; + } - public AMVector3 scale(float scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - return this; - } + public AMVector3 scale(float scale) { + this.x *= scale; + this.y *= scale; + this.z *= scale; + return this; + } - public AMVector3 scale(float scalex, float scaley, float scalez) - { - this.x *= scalex; - this.y *= scaley; - this.z *= scalez; - return this; - } + public AMVector3 scale(float scalex, float scaley, float scalez) { + this.x *= scalex; + this.y *= scaley; + this.z *= scalez; + return this; + } - public AMVector3 modulo(float divisor){ - this.x %= divisor; - this.y %= divisor; - this.z %= divisor; - return this; - } + public AMVector3 modulo(float divisor) { + this.x %= divisor; + this.y %= divisor; + this.z %= divisor; + return this; + } - public AMVector3 normalize() - { - float length = length(); - this.x /= length; - this.y /= length; - this.z /= length; - return this; - } + public AMVector3 normalize() { + float length = length(); + this.x /= length; + this.y /= length; + this.z /= length; + return this; + } - public float length() - { - return (float)Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } + public float length() { + return (float) Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + } - public float lengthPow2() - { - return this.x * this.x + this.y * this.y + this.z * this.z; - } + public float lengthPow2() { + return this.x * this.x + this.y * this.y + this.z * this.z; + } - public AMVector3 copy() - { - return new AMVector3(this.x, this.y, this.z); - } + public AMVector3 copy() { + return new AMVector3(this.x, this.y, this.z); + } - public static AMVector3 crossProduct(AMVector3 vec1, AMVector3 vec2) - { - return new AMVector3(vec1.y * vec2.z - vec1.z * vec2.y, vec1.z * vec2.x - vec1.x * vec2.z, vec1.x * vec2.y - vec1.y * vec2.x); - } + public static AMVector3 crossProduct(AMVector3 vec1, AMVector3 vec2) { + return new AMVector3( + vec1.y * vec2.z - vec1.z * vec2.y, + vec1.z * vec2.x - vec1.x * vec2.z, + vec1.x * vec2.y - vec1.y * vec2.x); + } - public static AMVector3 xCrossProduct(AMVector3 vec) - { - return new AMVector3(0.0D, vec.z, -vec.y); - } + public static AMVector3 xCrossProduct(AMVector3 vec) { + return new AMVector3(0.0D, vec.z, -vec.y); + } - public static AMVector3 zCrossProduct(AMVector3 vec) - { - return new AMVector3(-vec.y, vec.x, 0.0D); - } + public static AMVector3 zCrossProduct(AMVector3 vec) { + return new AMVector3(-vec.y, vec.x, 0.0D); + } - public static float dotProduct(AMVector3 vec1, AMVector3 vec2) - { - return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z); - } + public static float dotProduct(AMVector3 vec1, AMVector3 vec2) { + return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z); + } - public static float angle(AMVector3 vec1, AMVector3 vec2) - { - return anglePreNorm(vec1.copy().normalize(), vec2.copy().normalize()); - } + public static float angle(AMVector3 vec1, AMVector3 vec2) { + return anglePreNorm(vec1.copy().normalize(), vec2.copy().normalize()); + } - public static float anglePreNorm(AMVector3 vec1, AMVector3 vec2) - { - return (float)Math.acos(dotProduct(vec1, vec2)); - } + public static float anglePreNorm(AMVector3 vec1, AMVector3 vec2) { + return (float) Math.acos(dotProduct(vec1, vec2)); + } - public static AMVector3 zero(){ - return new AMVector3(0,0,0); - } + public static AMVector3 zero() { + return new AMVector3(0, 0, 0); + } - public AMVector3 rotate(float angle, AMVector3 axis) - { - return AMMatrix4.rotationMat(angle, axis).translate(this); - } + public AMVector3 rotate(float angle, AMVector3 axis) { + return AMMatrix4.rotationMat(angle, axis).translate(this); + } - @Override - public String toString() - { - return "[" + this.x + "," + this.y + "," + this.z + "]"; - } + @Override + public String toString() { + return "[" + this.x + "," + this.y + "," + this.z + "]"; + } - public Vec3 toVec3D() - { - return Vec3.createVectorHelper(this.x, this.y, this.z); - } + public Vec3 toVec3D() { + return Vec3.createVectorHelper(this.x, this.y, this.z); + } - public static AMVector3 getPerpendicular(AMVector3 vec) - { - if (vec.z == 0.0F) { - return zCrossProduct(vec); - } - return xCrossProduct(vec); - } + public static AMVector3 getPerpendicular(AMVector3 vec) { + if (vec.z == 0.0F) { + return zCrossProduct(vec); + } + return xCrossProduct(vec); + } - public boolean isZero() - { - return (this.x == 0.0F) && (this.y == 0.0F) && (this.z == 0.0F); - } + public boolean isZero() { + return (this.x == 0.0F) && (this.y == 0.0F) && (this.z == 0.0F); + } - public boolean isWithinRange(float min, float max) - { - return (this.x >= min && x <= max) && (this.y >= min && this.y <= max) && (this.z >= min && this.z <= max); - } + public boolean isWithinRange(float min, float max) { + return (this.x >= min && x <= max) && (this.y >= min && this.y <= max) && (this.z >= min && this.z <= max); + } - public double distanceTo(AMVector3 target){ - double var2 = target.x - this.x; - double var4 = target.y - this.y; - double var6 = target.z - this.z; - return MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6); - } + public double distanceTo(AMVector3 target) { + double var2 = target.x - this.x; + double var4 = target.y - this.y; + double var6 = target.z - this.z; + return MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6); + } - public double distanceSqTo(AMVector3 target){ - double var2 = target.x - this.x; - double var4 = target.y - this.y; - double var6 = target.z - this.z; - return var2 * var2 + var4 * var4 + var6 * var6; - } + public double distanceSqTo(AMVector3 target) { + double var2 = target.x - this.x; + double var4 = target.y - this.y; + double var6 = target.z - this.z; + return var2 * var2 + var4 * var4 + var6 * var6; + } + /** + * Rounds all values in this Vector to their integral floors + */ + public void floorToI() { + this.x = (float) Math.floor(this.x); + this.y = (float) Math.floor(this.y); + this.z = (float) Math.floor(this.z); + } - /** - * Rounds all values in this Vector to their integral floors - */ - public void floorToI(){ - this.x = (float) Math.floor(this.x); - this.y = (float) Math.floor(this.y); - this.z = (float) Math.floor(this.z); - } + /** + * Rounds all values in this Vector to their integral logical roundings + */ + public void roundToI() { + this.x = Math.round(this.x); + this.y = Math.round(this.y); + this.z = Math.round(this.z); + } - /** - * Rounds all values in this Vector to their integral logical roundings - */ - public void roundToI(){ - this.x = Math.round(this.x); - this.y = Math.round(this.y); - this.z = Math.round(this.z); - } + /** + * Rounds all values in this Vector to their integral ceilings + */ + public void ceilToI() { + this.x = (float) Math.ceil(this.x); + this.y = (float) Math.ceil(this.y); + this.z = (float) Math.ceil(this.z); + } - /** - * Rounds all values in this Vector to their integral ceilings - */ - public void ceilToI(){ - this.x = (float) Math.ceil(this.x); - this.y = (float) Math.ceil(this.y); - this.z = (float) Math.ceil(this.z); - } + /** + * Writes the vector3 to the specified compound - note that the way this function works, only one vector3 can be written to a compound at a time. + * Use sub-compounds if you need more! + */ + public void writeToNBT(NBTTagCompound compound) { + compound.setFloat("Vec3_x", x); + compound.setFloat("Vec3_y", y); + compound.setFloat("Vec3_z", z); + } - /** - * Writes the vector3 to the specified compound - note that the way this function works, only one vector3 can be written to a compound at a time. - * Use sub-compounds if you need more! - */ - public void writeToNBT(NBTTagCompound compound){ - compound.setFloat("Vec3_x", x); - compound.setFloat("Vec3_y", y); - compound.setFloat("Vec3_z", z); - } + public static AMVector3 readFromNBT(NBTTagCompound compound) { + return new AMVector3(compound.getFloat("Vec3_x"), compound.getFloat("Vec3_y"), compound.getFloat("Vec3_z")); + } - public static AMVector3 readFromNBT(NBTTagCompound compound){ - return new AMVector3(compound.getFloat("Vec3_x"), compound.getFloat("Vec3_y"), compound.getFloat("Vec3_z")); - } + @Override + public boolean equals(Object obj) { + if (obj instanceof AMVector3) { + AMVector3 comp = (AMVector3) obj; + return (comp.x == this.x && comp.y == this.y && comp.z == this.z); + } + return false; + } - @Override - public boolean equals(Object obj) { - if (obj instanceof AMVector3){ - AMVector3 comp = (AMVector3) obj; - return (comp.x == this.x && comp.y == this.y && comp.z == this.z); - } - return false; - } - - @Override - public int hashCode() { - return (int) (x + y + z); - } + @Override + public int hashCode() { + return (int) (x + y + z); + } } diff --git a/src/api/java/am2/api/particles/IBeamParticle.java b/src/api/java/am2/api/particles/IBeamParticle.java index a821cec..af5124d 100644 --- a/src/api/java/am2/api/particles/IBeamParticle.java +++ b/src/api/java/am2/api/particles/IBeamParticle.java @@ -1,26 +1,26 @@ package am2.api.particles; public interface IBeamParticle { - /** - * Sets the beam type. Determines the texture of the beam. Valid types are 0-2. - */ - public void setType(int type); - /** - * Sets the color from a single integer. Good for hex colors. - */ - public void setRGBColor(int color); - /** - * Sets the beam color from 3 int values (0-255). - */ - public void setRGBColorI(int r, int g, int b); - /** - * Sets the beam color from 3 floating point values (0.0f - 1.0f) - */ - public void setRGBColorF(float r, float g, float b); - /** - * Indicates that this beam is being cast by a player that is in first person. Should only be called when creating a beam from the local player, if the player is in first person. - *
- * This will offset the beam to make it look like it is coming from the player's active item and not their face. - */ - public void setFirstPersonPlayerCast(); + /** + * Sets the beam type. Determines the texture of the beam. Valid types are 0-2. + */ + public void setType(int type); + /** + * Sets the color from a single integer. Good for hex colors. + */ + public void setRGBColor(int color); + /** + * Sets the beam color from 3 int values (0-255). + */ + public void setRGBColorI(int r, int g, int b); + /** + * Sets the beam color from 3 floating point values (0.0f - 1.0f) + */ + public void setRGBColorF(float r, float g, float b); + /** + * Indicates that this beam is being cast by a player that is in first person. Should only be called when creating a beam from the local player, if the player is in first person. + *
+ * This will offset the beam to make it look like it is coming from the player's active item and not their face. + */ + public void setFirstPersonPlayerCast(); } diff --git a/src/api/java/am2/api/power/IObeliskFuelHelper.java b/src/api/java/am2/api/power/IObeliskFuelHelper.java index 01d3760..d92e58e 100644 --- a/src/api/java/am2/api/power/IObeliskFuelHelper.java +++ b/src/api/java/am2/api/power/IObeliskFuelHelper.java @@ -3,14 +3,14 @@ package am2.api.power; import net.minecraft.item.ItemStack; public interface IObeliskFuelHelper { - /** - * Registers a new fuel type for the obelisk to burn - * @param stack The stack to use as a comparator (stackSize is ignored, just use 1) - * @param burnTime How long the obelisk should burn for when given one of these items - */ - public void registerFuelType(ItemStack stack, int burnTime); - /** - * Retrieves the burn time for the specified stack. Returns 0 if it is not a valid fuel. - */ - public int getFuelBurnTime(ItemStack stack); + /** + * Registers a new fuel type for the obelisk to burn + * @param stack The stack to use as a comparator (stackSize is ignored, just use 1) + * @param burnTime How long the obelisk should burn for when given one of these items + */ + public void registerFuelType(ItemStack stack, int burnTime); + /** + * Retrieves the burn time for the specified stack. Returns 0 if it is not a valid fuel. + */ + public int getFuelBurnTime(ItemStack stack); } diff --git a/src/api/java/am2/api/power/IPowerNode.java b/src/api/java/am2/api/power/IPowerNode.java index 985564d..8d9bb75 100644 --- a/src/api/java/am2/api/power/IPowerNode.java +++ b/src/api/java/am2/api/power/IPowerNode.java @@ -1,4 +1,5 @@ package am2.api.power; + import net.minecraft.tileentity.TileEntity; /** @@ -6,49 +7,48 @@ import net.minecraft.tileentity.TileEntity; * @author Mithion * This will eventually allow you to interface with the AM power network - currently it is not fully working. */ -public interface IPowerNode { +public interface IPowerNode { - /** - * Gets the current capacity in the power block - */ - public float getCapacity(); + /** + * Gets the current capacity in the power block + */ + public float getCapacity(); - /** - * Can this block provide power? - * @param type The power type we are checking for - */ - public boolean canProvidePower(PowerTypes type); + /** + * Can this block provide power? + * @param type The power type we are checking for + */ + public boolean canProvidePower(PowerTypes type); - /** - * Can this block relay power? - * @param type The type of power we are looking for - */ - public boolean canRelayPower(PowerTypes type); + /** + * Can this block relay power? + * @param type The type of power we are looking for + */ + public boolean canRelayPower(PowerTypes type); - /** - * Can this block request power? - */ - public boolean canRequestPower(); + /** + * Can this block request power? + */ + public boolean canRequestPower(); - /** - * Is this block a nexus? - */ - public boolean isSource(); + /** + * Is this block a nexus? + */ + public boolean isSource(); - /** - * How fast does this block charge? - */ - public int getChargeRate(); + /** + * How fast does this block charge? + */ + public int getChargeRate(); - /** - * Gets the current power type of the block. - */ - public PowerTypes[] getValidPowerTypes(); - - /** - * Offset of any particle effects to the origin of the block - * @param axis The axis in question. 0=x, 1=y, 2=z - */ - public float particleOffset(int axis); + /** + * Gets the current power type of the block. + */ + public PowerTypes[] getValidPowerTypes(); + /** + * Offset of any particle effects to the origin of the block + * @param axis The axis in question. 0=x, 1=y, 2=z + */ + public float particleOffset(int axis); } diff --git a/src/api/java/am2/api/power/PowerTypes.java b/src/api/java/am2/api/power/PowerTypes.java index 62dd4d5..22bc122 100644 --- a/src/api/java/am2/api/power/PowerTypes.java +++ b/src/api/java/am2/api/power/PowerTypes.java @@ -1,69 +1,70 @@ package am2.api.power; -import java.security.InvalidParameterException; -import java.util.ArrayList; - import am2.api.ArsMagicaApi; import cpw.mods.fml.common.FMLLog; +import java.security.InvalidParameterException; +import java.util.ArrayList; -public final class PowerTypes{ +public final class PowerTypes { - public static final PowerTypes NONE = new PowerTypes(0, "None", "\u00A7f"); - public static final PowerTypes LIGHT = new PowerTypes(1, "Light", "\u00A7b"); - public static final PowerTypes NEUTRAL = new PowerTypes(2, "Neutral", "\u00A71"); - public static final PowerTypes DARK = new PowerTypes(4, "Dark", "\u00A74"); + public static final PowerTypes NONE = new PowerTypes(0, "None", "\u00A7f"); + public static final PowerTypes LIGHT = new PowerTypes(1, "Light", "\u00A7b"); + public static final PowerTypes NEUTRAL = new PowerTypes(2, "Neutral", "\u00A71"); + public static final PowerTypes DARK = new PowerTypes(4, "Dark", "\u00A74"); - private static final ArrayList allPowerTypes = new ArrayList() {{ - add(LIGHT); - add(NEUTRAL); - add(DARK); - }}; + private static final ArrayList allPowerTypes = new ArrayList() { + { + add(LIGHT); + add(NEUTRAL); + add(DARK); + } + }; - private int _id; - private String _name; - private String _chatColor; + private int _id; + private String _name; + private String _chatColor; - private PowerTypes(int ID, String name, String chatColor){ - if ((ID & -ID) != ID){ - throw new InvalidParameterException(String.format("ID must be a bitflag that is a power of 2! (You used %d)", ID)); - } - _id = ID; - _name = name; - _chatColor = chatColor; - } + private PowerTypes(int ID, String name, String chatColor) { + if ((ID & -ID) != ID) { + throw new InvalidParameterException( + String.format("ID must be a bitflag that is a power of 2! (You used %d)", ID)); + } + _id = ID; + _name = name; + _chatColor = chatColor; + } - public static void RegisterPowerType(int id, String name, String chatColor){ - if (getByID(id) == NONE){ - FMLLog.info("Ars Magica 2 >> Attempted to register power type %s with ID of %d, but that ID is already taken! The type was NOT registered!"); - }else{ - allPowerTypes.add(new PowerTypes(id, name, chatColor)); - FMLLog.info("Ars Magica 2 >> Registered new power type %s with ID %d", name, id); - } - } + public static void RegisterPowerType(int id, String name, String chatColor) { + if (getByID(id) == NONE) { + FMLLog.info( + "Ars Magica 2 >> Attempted to register power type %s with ID of %d, but that ID is already taken! The type was NOT registered!"); + } else { + allPowerTypes.add(new PowerTypes(id, name, chatColor)); + FMLLog.info("Ars Magica 2 >> Registered new power type %s with ID %d", name, id); + } + } - public int ID(){ - return _id; - } + public int ID() { + return _id; + } - public String name(){ - return _name; - } + public String name() { + return _name; + } - public String chatColor(){ - if (ArsMagicaApi.instance.getColourblindMode()){ - return ""; - } - return _chatColor; - } + public String chatColor() { + if (ArsMagicaApi.instance.getColourblindMode()) { + return ""; + } + return _chatColor; + } - public static PowerTypes[] all(){ - return allPowerTypes.toArray(new PowerTypes[allPowerTypes.size()]); - } + public static PowerTypes[] all() { + return allPowerTypes.toArray(new PowerTypes[allPowerTypes.size()]); + } - public static PowerTypes getByID(int id){ - for (PowerTypes type : all()) - if (type.ID() == id) - return type; - return NONE; - } + public static PowerTypes getByID(int id) { + for (PowerTypes type : all()) if (type.ID() == id) return type; + return NONE; + } } diff --git a/src/api/java/am2/api/spell/ISkillTreeManager.java b/src/api/java/am2/api/spell/ISkillTreeManager.java index 00ed0c6..1bf7367 100644 --- a/src/api/java/am2/api/spell/ISkillTreeManager.java +++ b/src/api/java/am2/api/spell/ISkillTreeManager.java @@ -5,15 +5,21 @@ import am2.api.spell.enums.SkillPointTypes; import am2.api.spell.enums.SkillTrees; public interface ISkillTreeManager { - /** - * Registers a spell part into the skill tree (where it can be unlocked). - * Pass a null prerequisite for no prerequisite. - * Throws an exception if the prerequisite passed in is not a registered entry in the skill tree, or if it is in a different tree. - * @param shape The shape to register - * @param x The x-coordinate in the skill tree to display the shape IIcon - * @param y The y-coordinate in the skill tree to display the shape IIcon - * @param tree The skill tree to register the shape into - * @param prerequisites The prerequisite skills needed for the shape. - */ - public void RegisterPart(ISkillTreeEntry part, int x, int y, SkillTrees tree, SkillPointTypes requiredPoint, ISkillTreeEntry ... prerequisites); + /** + * Registers a spell part into the skill tree (where it can be unlocked). + * Pass a null prerequisite for no prerequisite. + * Throws an exception if the prerequisite passed in is not a registered entry in the skill tree, or if it is in a different tree. + * @param shape The shape to register + * @param x The x-coordinate in the skill tree to display the shape IIcon + * @param y The y-coordinate in the skill tree to display the shape IIcon + * @param tree The skill tree to register the shape into + * @param prerequisites The prerequisite skills needed for the shape. + */ + public void RegisterPart( + ISkillTreeEntry part, + int x, + int y, + SkillTrees tree, + SkillPointTypes requiredPoint, + ISkillTreeEntry... prerequisites); } diff --git a/src/api/java/am2/api/spell/ISpellIconManager.java b/src/api/java/am2/api/spell/ISpellIconManager.java index b0c86b7..f85903a 100644 --- a/src/api/java/am2/api/spell/ISpellIconManager.java +++ b/src/api/java/am2/api/spell/ISpellIconManager.java @@ -1,20 +1,20 @@ package am2.api.spell; -import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.util.IIcon; @SideOnly(Side.CLIENT) public interface ISpellIconManager { - /** - * Returns the IIcon registered to the specified spell name. Returns the missing IIcon if one doesn't exist. - */ - public IIcon getIcon(String spellName); - - /** - * Registers an IIcon to be associated with a spell component - * @param spellName The unlocalized name of the spell used when it was registered - * @param IIcon The IIcon of the spell - */ - public void registerIcon(String spellName, IIcon IIcon); + /** + * Returns the IIcon registered to the specified spell name. Returns the missing IIcon if one doesn't exist. + */ + public IIcon getIcon(String spellName); + + /** + * Registers an IIcon to be associated with a spell component + * @param spellName The unlocalized name of the spell used when it was registered + * @param IIcon The IIcon of the spell + */ + public void registerIcon(String spellName, IIcon IIcon); } diff --git a/src/api/java/am2/api/spell/ISpellModifierManager.java b/src/api/java/am2/api/spell/ISpellModifierManager.java index 137a2e8..e7b68b6 100644 --- a/src/api/java/am2/api/spell/ISpellModifierManager.java +++ b/src/api/java/am2/api/spell/ISpellModifierManager.java @@ -3,6 +3,7 @@ package am2.api.spell; import am2.api.spell.component.interfaces.ISpellModifier; public interface ISpellModifierManager { - public int registerSpellModifier(ISpellModifier modifier, String modifierName); - public ISpellModifier getSpellModifier(int modifierID); + public int registerSpellModifier(ISpellModifier modifier, String modifierName); + + public ISpellModifier getSpellModifier(int modifierID); } diff --git a/src/api/java/am2/api/spell/ISpellPartManager.java b/src/api/java/am2/api/spell/ISpellPartManager.java index 3b7acdb..4d0c1d1 100644 --- a/src/api/java/am2/api/spell/ISpellPartManager.java +++ b/src/api/java/am2/api/spell/ISpellPartManager.java @@ -3,25 +3,25 @@ package am2.api.spell; import am2.api.spell.component.interfaces.ISkillTreeEntry; public interface ISpellPartManager { - /** - * Registers the skill tree entry into the skill manager. - * @param component The skill tree entry to register - * @param name The unlocalized name you want to register it to. Local translations are am2.spell.unlocalized_name, so register this into the language registry for localization. - * @return The shifted numeric ID that is used, this should be stored somewhere - */ - public int registerSkillTreeEntry(ISkillTreeEntry component, String name); - - /** - * - * @param ID The shifted ID of the skill. - * @return The skill tree entry or null if not found. - */ - public ISkillTreeEntry getSkill(int ID); - - /** - * - * @param name The unlocalized name of the skill - * @return The skill tree entry or null if not found. - */ - public ISkillTreeEntry getSkill(String name); + /** + * Registers the skill tree entry into the skill manager. + * @param component The skill tree entry to register + * @param name The unlocalized name you want to register it to. Local translations are am2.spell.unlocalized_name, so register this into the language registry for localization. + * @return The shifted numeric ID that is used, this should be stored somewhere + */ + public int registerSkillTreeEntry(ISkillTreeEntry component, String name); + + /** + * + * @param ID The shifted ID of the skill. + * @return The skill tree entry or null if not found. + */ + public ISkillTreeEntry getSkill(int ID); + + /** + * + * @param name The unlocalized name of the skill + * @return The skill tree entry or null if not found. + */ + public ISkillTreeEntry getSkill(String name); } diff --git a/src/api/java/am2/api/spell/ISpellShapeManager.java b/src/api/java/am2/api/spell/ISpellShapeManager.java index 86c1108..13e60c1 100644 --- a/src/api/java/am2/api/spell/ISpellShapeManager.java +++ b/src/api/java/am2/api/spell/ISpellShapeManager.java @@ -3,6 +3,7 @@ package am2.api.spell; import am2.api.spell.component.interfaces.ISpellShape; public interface ISpellShapeManager { - public int registerSpellShape(ISpellShape shape, String shapeName); - public ISpellShape getSpellShape(int shapeID); + public int registerSpellShape(ISpellShape shape, String shapeName); + + public ISpellShape getSpellShape(int shapeID); } diff --git a/src/api/java/am2/api/spell/ItemSpellBase.java b/src/api/java/am2/api/spell/ItemSpellBase.java index 09b7b5a..56c7224 100644 --- a/src/api/java/am2/api/spell/ItemSpellBase.java +++ b/src/api/java/am2/api/spell/ItemSpellBase.java @@ -10,19 +10,20 @@ import net.minecraft.world.World; * @author Mithion * */ -public abstract class ItemSpellBase extends Item{ - public ItemSpellBase() { - super(); - } +public abstract class ItemSpellBase extends Item { + public ItemSpellBase() { + super(); + } - /** - * Specific version of getMovingObjectPosition that takes into account the targeting types that I need - * @param caster The caster of the spell - * @param world The world the spell is being cast in - * @param range The range to raycast - * @param targetEntities Stop at collision with entities - * @param targetWater Stop at collision with any non-solid block - * @return A MovingObjectPosition instance if a collision was found, null otherwise - */ - public abstract MovingObjectPosition getMovingObjectPosition(EntityLivingBase caster, World world, double range, boolean targetEntities, boolean targetWater); + /** + * Specific version of getMovingObjectPosition that takes into account the targeting types that I need + * @param caster The caster of the spell + * @param world The world the spell is being cast in + * @param range The range to raycast + * @param targetEntities Stop at collision with entities + * @param targetWater Stop at collision with any non-solid block + * @return A MovingObjectPosition instance if a collision was found, null otherwise + */ + public abstract MovingObjectPosition getMovingObjectPosition( + EntityLivingBase caster, World world, double range, boolean targetEntities, boolean targetWater); } diff --git a/src/api/java/am2/api/spell/component/interfaces/IRitualInteraction.java b/src/api/java/am2/api/spell/component/interfaces/IRitualInteraction.java index 096c25b..5bb4e74 100644 --- a/src/api/java/am2/api/spell/component/interfaces/IRitualInteraction.java +++ b/src/api/java/am2/api/spell/component/interfaces/IRitualInteraction.java @@ -1,23 +1,23 @@ package am2.api.spell.component.interfaces; -import net.minecraft.item.ItemStack; import am2.api.blocks.MultiblockStructureDefinition; +import net.minecraft.item.ItemStack; -public interface IRitualInteraction { - /** - * Gets a MultiblockStructureDefinition outlining the ritual blocks needed and where they should be relative to a given location. - * This should be instantiated on mod load and cached somewhere, and NOT instantiated upon request. - */ - public MultiblockStructureDefinition getRitualShape(); +public interface IRitualInteraction { + /** + * Gets a MultiblockStructureDefinition outlining the ritual blocks needed and where they should be relative to a given location. + * This should be instantiated on mod load and cached somewhere, and NOT instantiated upon request. + */ + public MultiblockStructureDefinition getRitualShape(); - /** - * Gets a list of items that need to be present in {@link #getReagentSearchRadius() getReagentSearchRadius()} for the ritual to match. - * Items on the ground as well as items attached to Wizard's Chalk are included. - */ - public ItemStack[] getReagents(); + /** + * Gets a list of items that need to be present in {@link #getReagentSearchRadius() getReagentSearchRadius()} for the ritual to match. + * Items on the ground as well as items attached to Wizard's Chalk are included. + */ + public ItemStack[] getReagents(); - /** - * Gets the radius to search for reagents when checking the ritual. - */ - public int getReagentSearchRadius(); + /** + * Gets the radius to search for reagents when checking the ritual. + */ + public int getReagentSearchRadius(); } diff --git a/src/api/java/am2/api/spell/component/interfaces/ISkillTreeEntry.java b/src/api/java/am2/api/spell/component/interfaces/ISkillTreeEntry.java index 36dcb55..f95c5fd 100644 --- a/src/api/java/am2/api/spell/component/interfaces/ISkillTreeEntry.java +++ b/src/api/java/am2/api/spell/component/interfaces/ISkillTreeEntry.java @@ -1,9 +1,9 @@ package am2.api.spell.component.interfaces; public interface ISkillTreeEntry { - /** - * Gets the ID of the skill. Must be unique among all other skills. - * @return The ID of the part. - */ - public int getID(); + /** + * Gets the ID of the skill. Must be unique among all other skills. + * @return The ID of the part. + */ + public int getID(); } diff --git a/src/api/java/am2/api/spell/component/interfaces/ISpellComponent.java b/src/api/java/am2/api/spell/component/interfaces/ISpellComponent.java index b35d577..3d32d9f 100644 --- a/src/api/java/am2/api/spell/component/interfaces/ISpellComponent.java +++ b/src/api/java/am2/api/spell/component/interfaces/ISpellComponent.java @@ -1,72 +1,89 @@ package am2.api.spell.component.interfaces; +import am2.api.spell.enums.Affinity; import java.util.EnumSet; import java.util.Random; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import am2.api.spell.enums.Affinity; -public interface ISpellComponent extends ISpellPart{ - /** - * Apply the effect to a single block - * @param stack The item stack that contains the effect data - * @param world The world the effect is in - * @param blockx The x coordinate of the block - * @param blocky The y coordinate of the block - * @param blockz The z coordinate of the block - * @param blockFace The face of the block that was targeted - * @param impactX The x coordinate of the impact - * @param impactY The y coordinate of the impact - * @param impactZ The z coordinate of the impact - * @param caster The caster of the spell - * @return True if the effect was successfully applied to the block - */ - public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster); - - /** - * Apply the effect to a single entity - * @param stack The stack representing the spell - * @param world The world the spell was cast in - * @param caster The caster of the spell - * @param target The current target of the spell - * @return True if the effect was applied successfully to the entity - */ - public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target); - - /** - * Gets the mana cost of the spell - */ - public float manaCost(EntityLivingBase caster); - - /** - * Gets the burnout of the spell - */ - public float burnout(EntityLivingBase caster); - - /** - * Gets any reagents that must be present in the caster's inventory in order - * to cast the spell. - */ - public ItemStack[] reagents(EntityLivingBase caster); - - /** - * Spawn visual effects for the component - * @param colorModifier The color from the color modifier. -1 if missing. - */ - public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier); - - /** - * Gets the affinity of the spell - */ - public EnumSet getAffinity(); - - /** - * Gets the amount (before diminishing returns) that this component, when successfully applied, - * shifts the caster's affinity - * @param affinity The affinity being shifted - */ - public float getAffinityShift(Affinity affinity); +public interface ISpellComponent extends ISpellPart { + /** + * Apply the effect to a single block + * @param stack The item stack that contains the effect data + * @param world The world the effect is in + * @param blockx The x coordinate of the block + * @param blocky The y coordinate of the block + * @param blockz The z coordinate of the block + * @param blockFace The face of the block that was targeted + * @param impactX The x coordinate of the impact + * @param impactY The y coordinate of the impact + * @param impactZ The z coordinate of the impact + * @param caster The caster of the spell + * @return True if the effect was successfully applied to the block + */ + public boolean applyEffectBlock( + ItemStack stack, + World world, + int blockx, + int blocky, + int blockz, + int blockFace, + double impactX, + double impactY, + double impactZ, + EntityLivingBase caster); + + /** + * Apply the effect to a single entity + * @param stack The stack representing the spell + * @param world The world the spell was cast in + * @param caster The caster of the spell + * @param target The current target of the spell + * @return True if the effect was applied successfully to the entity + */ + public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target); + + /** + * Gets the mana cost of the spell + */ + public float manaCost(EntityLivingBase caster); + + /** + * Gets the burnout of the spell + */ + public float burnout(EntityLivingBase caster); + + /** + * Gets any reagents that must be present in the caster's inventory in order + * to cast the spell. + */ + public ItemStack[] reagents(EntityLivingBase caster); + + /** + * Spawn visual effects for the component + * @param colorModifier The color from the color modifier. -1 if missing. + */ + public void spawnParticles( + World world, + double x, + double y, + double z, + EntityLivingBase caster, + Entity target, + Random rand, + int colorModifier); + + /** + * Gets the affinity of the spell + */ + public EnumSet getAffinity(); + + /** + * Gets the amount (before diminishing returns) that this component, when successfully applied, + * shifts the caster's affinity + * @param affinity The affinity being shifted + */ + public float getAffinityShift(Affinity affinity); } diff --git a/src/api/java/am2/api/spell/component/interfaces/ISpellModifier.java b/src/api/java/am2/api/spell/component/interfaces/ISpellModifier.java index 0aa0e90..6b91c08 100644 --- a/src/api/java/am2/api/spell/component/interfaces/ISpellModifier.java +++ b/src/api/java/am2/api/spell/component/interfaces/ISpellModifier.java @@ -1,43 +1,42 @@ package am2.api.spell.component.interfaces; +import am2.api.spell.enums.SpellModifiers; import java.util.EnumSet; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import am2.api.spell.enums.SpellModifiers; -public interface ISpellModifier extends ISpellPart{ - /** - * Returns a list of the aspects of a spell that this modifier can change. - * @return - */ - public EnumSet getAspectsModified(); - - /** - * Returns the modified value for the specified type. - * @param type The type of value we are modifying - * @param caster The caster - * @param target The target (can be the same as the caster) - * @param world The world in which the spell is being cast. - * @param metadata Any metadata written to the spell for this modifier (obtained from getModifierMetadata) - * @return A factor to multiply the default value by (or add, depending on the component's programming) - */ - public float getModifier(SpellModifiers type, EntityLivingBase caster, Entity target, World world, byte[] metadata); - - /** - * Gets the amount that adding this modifier to the spell alters the mana cost. - * @param spellStack The itemstack comprising the spell (in case you want to base it on other modifiers added) - * @param stage The stage in which this modifier has been added (if the modifier is added to multiple stages, this will be called multiple times, once per stage) - * @param quantity The quantity of this multiplier in the specified stage. - */ - public float getManaCostMultiplier(ItemStack spellStack, int stage, int quantity); - - /** - * Gets any metadata needed by this modifier for the current spell. Used, for example, in the color modifier to determine what color was specified. - * @param stage The stage this modifier is at - * @param matchedRecipe The items that were added to the crafting altar which resulted in the matching of the recipe. - */ - public byte[] getModifierMetadata(int stage, ItemStack[] matchedRecipe); +public interface ISpellModifier extends ISpellPart { + /** + * Returns a list of the aspects of a spell that this modifier can change. + * @return + */ + public EnumSet getAspectsModified(); + + /** + * Returns the modified value for the specified type. + * @param type The type of value we are modifying + * @param caster The caster + * @param target The target (can be the same as the caster) + * @param world The world in which the spell is being cast. + * @param metadata Any metadata written to the spell for this modifier (obtained from getModifierMetadata) + * @return A factor to multiply the default value by (or add, depending on the component's programming) + */ + public float getModifier(SpellModifiers type, EntityLivingBase caster, Entity target, World world, byte[] metadata); + + /** + * Gets the amount that adding this modifier to the spell alters the mana cost. + * @param spellStack The itemstack comprising the spell (in case you want to base it on other modifiers added) + * @param stage The stage in which this modifier has been added (if the modifier is added to multiple stages, this will be called multiple times, once per stage) + * @param quantity The quantity of this multiplier in the specified stage. + */ + public float getManaCostMultiplier(ItemStack spellStack, int stage, int quantity); + + /** + * Gets any metadata needed by this modifier for the current spell. Used, for example, in the color modifier to determine what color was specified. + * @param stage The stage this modifier is at + * @param matchedRecipe The items that were added to the crafting altar which resulted in the matching of the recipe. + */ + public byte[] getModifierMetadata(int stage, ItemStack[] matchedRecipe); } diff --git a/src/api/java/am2/api/spell/component/interfaces/ISpellPart.java b/src/api/java/am2/api/spell/component/interfaces/ISpellPart.java index b276755..e3f7608 100644 --- a/src/api/java/am2/api/spell/component/interfaces/ISpellPart.java +++ b/src/api/java/am2/api/spell/component/interfaces/ISpellPart.java @@ -8,21 +8,21 @@ package am2.api.spell.component.interfaces; */ public interface ISpellPart extends ISkillTreeEntry { - /** - * recipe items, in order, that need to be thrown into the crafting altar in order to create the item. - *
- * Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts. - *
- * Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored. - *
- * Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags, - *
- * For example: - *
-	 *     new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
-	 *     new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
-	 *     etc.
-	 *
- */ - public Object[] getRecipeItems(); + /** + * recipe items, in order, that need to be thrown into the crafting altar in order to create the item. + *
+ * Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts. + *
+ * Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored. + *
+ * Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags, + *
+ * For example: + *
+     *     new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
+     *     new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
+     *     etc.
+     *
+ */ + public Object[] getRecipeItems(); } diff --git a/src/api/java/am2/api/spell/component/interfaces/ISpellShape.java b/src/api/java/am2/api/spell/component/interfaces/ISpellShape.java index 9ad24ec..f5cece0 100644 --- a/src/api/java/am2/api/spell/component/interfaces/ISpellShape.java +++ b/src/api/java/am2/api/spell/component/interfaces/ISpellShape.java @@ -1,54 +1,65 @@ package am2.api.spell.component.interfaces; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import am2.api.spell.ItemSpellBase; import am2.api.spell.enums.Affinity; import am2.api.spell.enums.SpellCastResult; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; public interface ISpellShape extends ISpellPart { - /** - * Creates the target area/entity list and applies the effects to ground/mobs - * @param item The spell being cast - * @param stack The itemstack representing the spell - * @param caster The caster of the spell - * @param target The specified target of the spell. If this is not NULL, this is a forced target, and should be included with any other targets of the shape. Otherwise the default spell shape logic should apply. - * @param world The world the spell is being cast in - * @param x The x-coordinate of the spell's effect - * @param y The y-coordinate of the spell's effect - * @param z The z-coordinate of the spell's effect - * @param side The side the spell is applied on - * @param giveXP This is passed along to be given back to the SpellHelper where needed. - * @param useCount The number of ticks the spell item has been in use for - * @return The result of the spell cast. - */ - public SpellCastResult beginStackStage(ItemSpellBase item, ItemStack stack, EntityLivingBase caster, EntityLivingBase target, World world, double x, double y, double z, int side, boolean giveXP, int useCount); - - /** - * Is this shape a valid shape for a channeled/maintained spell? - */ - public boolean isChanneled(); - - /** - * Allows different shapes to vary the mana cost of a spell - * @param spellStack the itemstack representing the spell (useful if you want to vary based on added modifiers as well, for example) - * @return - */ - public float manaCostMultiplier(ItemStack spellStack); - - /** - * Is the spell a terminus shape? Return true if this component does not continue the spell chain when proccing. - */ - public boolean isTerminusShape(); - - /** - * Is the shape a principal shape? Return true if this spell requires another shape to proc (like runes and zones) - */ - public boolean isPrincipumShape(); - - /** - * Play the sound for the specified affinity - */ - public String getSoundForAffinity(Affinity affinity, ItemStack stack, World world); + /** + * Creates the target area/entity list and applies the effects to ground/mobs + * @param item The spell being cast + * @param stack The itemstack representing the spell + * @param caster The caster of the spell + * @param target The specified target of the spell. If this is not NULL, this is a forced target, and should be included with any other targets of the shape. Otherwise the default spell shape logic should apply. + * @param world The world the spell is being cast in + * @param x The x-coordinate of the spell's effect + * @param y The y-coordinate of the spell's effect + * @param z The z-coordinate of the spell's effect + * @param side The side the spell is applied on + * @param giveXP This is passed along to be given back to the SpellHelper where needed. + * @param useCount The number of ticks the spell item has been in use for + * @return The result of the spell cast. + */ + public SpellCastResult beginStackStage( + ItemSpellBase item, + ItemStack stack, + EntityLivingBase caster, + EntityLivingBase target, + World world, + double x, + double y, + double z, + int side, + boolean giveXP, + int useCount); + + /** + * Is this shape a valid shape for a channeled/maintained spell? + */ + public boolean isChanneled(); + + /** + * Allows different shapes to vary the mana cost of a spell + * @param spellStack the itemstack representing the spell (useful if you want to vary based on added modifiers as well, for example) + * @return + */ + public float manaCostMultiplier(ItemStack spellStack); + + /** + * Is the spell a terminus shape? Return true if this component does not continue the spell chain when proccing. + */ + public boolean isTerminusShape(); + + /** + * Is the shape a principal shape? Return true if this spell requires another shape to proc (like runes and zones) + */ + public boolean isPrincipumShape(); + + /** + * Play the sound for the specified affinity + */ + public String getSoundForAffinity(Affinity affinity, ItemStack stack, World world); } diff --git a/src/api/java/am2/api/spell/enums/Affinity.java b/src/api/java/am2/api/spell/enums/Affinity.java index 0acef4d..af8ecbb 100644 --- a/src/api/java/am2/api/spell/enums/Affinity.java +++ b/src/api/java/am2/api/spell/enums/Affinity.java @@ -3,191 +3,195 @@ package am2.api.spell.enums; import net.minecraft.item.Item; public enum Affinity { - NONE(0, - 0xFFFFFF, - -1, //no direct opposite - new int[] {}, //no major opposites - new int[] {}, //no minor opposites - new int[] {}), + NONE( + 0, + 0xFFFFFF, + -1, // no direct opposite + new int[] {}, // no major opposites + new int[] {}, // no minor opposites + new int[] {}), - ARCANE(1, - 0xb935cd, - 9, //nature is direct opposite - new int[] { 9, 4, 2, 7 }, //Major Opposites: life, earth, water, ice - new int[] { 5, 10 }, //Minor Opposites: Air, Ender - new int[] { 6, 3 }), //Adjacent Affinities: Lightning, Fire + ARCANE( + 1, + 0xb935cd, + 9, // nature is direct opposite + new int[] {9, 4, 2, 7}, // Major Opposites: life, earth, water, ice + new int[] {5, 10}, // Minor Opposites: Air, Ender + new int[] {6, 3}), // Adjacent Affinities: Lightning, Fire - WATER(2, - 0x0b5cef, - 3, //fire is direct opposite - new int[] { 7, 4, 1, 10 }, //Major Opposites: lightning, earth, arcane, ender - new int[] { 5, 7 }, //Minor Opposites: Air, Ice - new int[] { 9, 8 }), //Adjacent Affinities: Life, Nature + WATER( + 2, + 0x0b5cef, + 3, // fire is direct opposite + new int[] {7, 4, 1, 10}, // Major Opposites: lightning, earth, arcane, ender + new int[] {5, 7}, // Minor Opposites: Air, Ice + new int[] {9, 8}), // Adjacent Affinities: Life, Nature - FIRE(3, - 0xef260b, - 2, //water is direct opposite - new int[] { 5, 7, 8, 9 }, //Major Opposites: air, ice, nature, life - new int[] { 4, 6 }, //Minor Opposites: Earth, Lightning - new int[] { 10, 1 }), //Adjacent Affinities: Ender, Arcane + FIRE( + 3, + 0xef260b, + 2, // water is direct opposite + new int[] {5, 7, 8, 9}, // Major Opposites: air, ice, nature, life + new int[] {4, 6}, // Minor Opposites: Earth, Lightning + new int[] {10, 1}), // Adjacent Affinities: Ender, Arcane - EARTH(4, - 0x61330b, - 5, //air is direct opposite - new int[] { 2, 1, 9, 6 }, //Major Opposites: water, arcane, life, lightning - new int[] { 8, 3 }, //Minor Opposites: Nature, Fire - new int[] { 7, 10 }), //Adjacent Affinities: Ice, Ender + EARTH( + 4, + 0x61330b, + 5, // air is direct opposite + new int[] {2, 1, 9, 6}, // Major Opposites: water, arcane, life, lightning + new int[] {8, 3}, // Minor Opposites: Nature, Fire + new int[] {7, 10}), // Adjacent Affinities: Ice, Ender - AIR(5, - 0x777777, - 4, //earth is direct opposite - new int[] { 8, 3, 7, 10 }, //Major Opposites: nature, fire, ice, ender - new int[] { 2, 1 }, //Minor Opposites: Water, Arcane - new int[] { 9, 6 }), //Adjacent Affinities: Life, Lightning + AIR( + 5, + 0x777777, + 4, // earth is direct opposite + new int[] {8, 3, 7, 10}, // Major Opposites: nature, fire, ice, ender + new int[] {2, 1}, // Minor Opposites: Water, Arcane + new int[] {9, 6}), // Adjacent Affinities: Life, Lightning - LIGHTNING(6, - 0xdece19, - 7, //ice is direct opposite - new int[] { 2, 10, 8, 4 }, //Major Opposites: water, ender, nature, earth - new int[] { 9, 3 }, //Minor Opposites: Life, Fire - new int[] { 5, 1 }), //Adjacent Affinities: Air, Arcane + LIGHTNING( + 6, + 0xdece19, + 7, // ice is direct opposite + new int[] {2, 10, 8, 4}, // Major Opposites: water, ender, nature, earth + new int[] {9, 3}, // Minor Opposites: Life, Fire + new int[] {5, 1}), // Adjacent Affinities: Air, Arcane - ICE(7, - 0xd3e8fc, - 6, //lightning is direct opposite - new int[] { 9, 3, 5, 1 }, //Major Opposites: life, fire, air, arcane - new int[] { 2, 10 }, //Minor Opposites: Water, Ender - new int[] { 8, 4 }), //Adjacent Affinities: Nature, Earth + ICE( + 7, + 0xd3e8fc, + 6, // lightning is direct opposite + new int[] {9, 3, 5, 1}, // Major Opposites: life, fire, air, arcane + new int[] {2, 10}, // Minor Opposites: Water, Ender + new int[] {8, 4}), // Adjacent Affinities: Nature, Earth - NATURE(8, - 0x228718, - 6, //arcane is direct opposite - new int[] { 5, 10, 6, 3 }, //Major Opposites: air, ender, lightning, fire - new int[] { 9, 4 }, //Minor Opposites: Life, Earth - new int[] { 2, 7 }), //Adjacent Affinities: Water, Ice + NATURE( + 8, + 0x228718, + 6, // arcane is direct opposite + new int[] {5, 10, 6, 3}, // Major Opposites: air, ender, lightning, fire + new int[] {9, 4}, // Minor Opposites: Life, Earth + new int[] {2, 7}), // Adjacent Affinities: Water, Ice - LIFE(9, - 0x34e122, - 10, //ender is direct opposite - new int[] { 1, 7, 3, 4 }, //Major Opposites: arcane, ice, fire, earth - new int[] { 8, 6 }, //Minor Opposites: Nature, Lightning - new int[] { 2, 5 }), //Adjacent Affinities: Water, Air + LIFE( + 9, + 0x34e122, + 10, // ender is direct opposite + new int[] {1, 7, 3, 4}, // Major Opposites: arcane, ice, fire, earth + new int[] {8, 6}, // Minor Opposites: Nature, Lightning + new int[] {2, 5}), // Adjacent Affinities: Water, Air - ENDER(10, - 0x3f043d, - 9, //life is direct opposite - new int[] { 8, 6, 2, 5 }, //Major Opposites: nature, lightning, water, air - new int[] { 1, 7 }, //Minor Opposites: Arcane, Ice - new int[] { 4, 3 }); //Adjacent Affinities: Earth, Fire + ENDER( + 10, + 0x3f043d, + 9, // life is direct opposite + new int[] {8, 6, 2, 5}, // Major Opposites: nature, lightning, water, air + new int[] {1, 7}, // Minor Opposites: Arcane, Ice + new int[] {4, 3}); // Adjacent Affinities: Earth, Fire + public int ID; + private int directOpposingAffinity; + private int[] majorOppositions; + private int[] minorOppositions; + private int[] adjacentAffinities; + public Item representItem; + public int representMeta; + public final int color; - public int ID; - private int directOpposingAffinity; - private int[] majorOppositions; - private int[] minorOppositions; - private int[] adjacentAffinities; - public Item representItem; - public int representMeta; - public final int color; + private Affinity( + int ID, + int color, + int directOppositeAffinity, + int[] majorOppositions, + int[] minorOppositions, + int[] adjacentAffinities) { + this.ID = ID; + this.directOpposingAffinity = directOppositeAffinity; + this.majorOppositions = majorOppositions; + this.minorOppositions = minorOppositions; + this.adjacentAffinities = adjacentAffinities; + this.color = color; + } - private Affinity(int ID, int color, int directOppositeAffinity, int[] majorOppositions, int[] minorOppositions, int[] adjacentAffinities){ - this.ID = ID; - this.directOpposingAffinity = directOppositeAffinity; - this.majorOppositions = majorOppositions; - this.minorOppositions = minorOppositions; - this.adjacentAffinities = adjacentAffinities; - this.color = color; - } + public Affinity getOpposingAffinity() { + if (this.directOpposingAffinity > -1) return Affinity.values()[this.directOpposingAffinity]; + return Affinity.NONE; + } - public Affinity getOpposingAffinity(){ - if (this.directOpposingAffinity > -1) - return Affinity.values()[this.directOpposingAffinity]; - return Affinity.NONE; - } + public Affinity[] getMajorOpposingAffinities() { + Affinity[] opposing = new Affinity[this.majorOppositions.length]; + int count = 0; + for (int i : this.majorOppositions) { + opposing[count++] = Affinity.values()[i]; + } + return opposing; + } - public Affinity[] getMajorOpposingAffinities(){ - Affinity[] opposing = new Affinity[this.majorOppositions.length]; - int count = 0; - for (int i : this.majorOppositions){ - opposing[count++] = Affinity.values()[i]; - } - return opposing; - } + public Affinity[] getMinorOpposingAffinities() { + Affinity[] opposing = new Affinity[this.minorOppositions.length]; + int count = 0; + for (int i : this.minorOppositions) { + opposing[count++] = Affinity.values()[i]; + } + return opposing; + } - public Affinity[] getMinorOpposingAffinities(){ - Affinity[] opposing = new Affinity[this.minorOppositions.length]; - int count = 0; - for (int i : this.minorOppositions){ - opposing[count++] = Affinity.values()[i]; - } - return opposing; - } + public Affinity[] getAdjacentAffinities() { + Affinity[] adjacent = new Affinity[this.adjacentAffinities.length]; + int count = 0; + for (int i : this.adjacentAffinities) { + adjacent[count++] = Affinity.values()[i]; + } + return adjacent; + } - public Affinity[] getAdjacentAffinities(){ - Affinity[] adjacent = new Affinity[this.adjacentAffinities.length]; - int count = 0; - for (int i : this.adjacentAffinities){ - adjacent[count++] = Affinity.values()[i]; - } - return adjacent; - } + public void setRepresentItem(Item representItem, int meta) { + if (this.representItem == null) { + this.representItem = representItem; + this.representMeta = meta; + } + } - public void setRepresentItem(Item representItem, int meta){ - if (this.representItem == null){ - this.representItem = representItem; - this.representMeta = meta; - } - } + public static Affinity getByID(int ID) { + for (Affinity affinity : Affinity.values()) { + if (affinity.ID == ID) { + return affinity; + } + } + return Affinity.NONE; + } - public static Affinity getByID(int ID){ - for (Affinity affinity : Affinity.values()){ - if (affinity.ID == ID){ - return affinity; - } - } - return Affinity.NONE; - } + public static Affinity[] getOrderedAffinities() { + return new Affinity[] {AIR, LIGHTNING, ARCANE, FIRE, ENDER, EARTH, ICE, NATURE, WATER, LIFE}; + } - public static Affinity[] getOrderedAffinities(){ - return new Affinity[]{ - AIR, - LIGHTNING, - ARCANE, - FIRE, - ENDER, - EARTH, - ICE, - NATURE, - WATER, - LIFE - }; - } - - public int getAffinityMask(){ - switch (this){ - case AIR: - return 0x1; - case ARCANE: - return 0x2; - case EARTH: - return 0x4; - case ENDER: - return 0x8; - case FIRE: - return 0x10; - case ICE: - return 0x20; - case LIFE: - return 0x40; - case LIGHTNING: - return 0x80; - case NATURE: - return 0x100; - case WATER: - return 0x200; - case NONE: - default: - return 0; - } - } + public int getAffinityMask() { + switch (this) { + case AIR: + return 0x1; + case ARCANE: + return 0x2; + case EARTH: + return 0x4; + case ENDER: + return 0x8; + case FIRE: + return 0x10; + case ICE: + return 0x20; + case LIFE: + return 0x40; + case LIGHTNING: + return 0x80; + case NATURE: + return 0x100; + case WATER: + return 0x200; + case NONE: + default: + return 0; + } + } } diff --git a/src/api/java/am2/api/spell/enums/BuffPowerLevel.java b/src/api/java/am2/api/spell/enums/BuffPowerLevel.java index 71f098b..72b35f7 100644 --- a/src/api/java/am2/api/spell/enums/BuffPowerLevel.java +++ b/src/api/java/am2/api/spell/enums/BuffPowerLevel.java @@ -1,7 +1,7 @@ package am2.api.spell.enums; public class BuffPowerLevel { - public static final int Low = 0; - public static final int Medium = 1; - public static final int High = 2; + public static final int Low = 0; + public static final int Medium = 1; + public static final int High = 2; } diff --git a/src/api/java/am2/api/spell/enums/ContingencyTypes.java b/src/api/java/am2/api/spell/enums/ContingencyTypes.java index 60bdc67..a1cf1d2 100644 --- a/src/api/java/am2/api/spell/enums/ContingencyTypes.java +++ b/src/api/java/am2/api/spell/enums/ContingencyTypes.java @@ -1,10 +1,10 @@ package am2.api.spell.enums; public enum ContingencyTypes { - NONE, - FALL, - DAMAGE_TAKEN, - ON_FIRE, - HEALTH_LOW, - DEATH + NONE, + FALL, + DAMAGE_TAKEN, + ON_FIRE, + HEALTH_LOW, + DEATH } diff --git a/src/api/java/am2/api/spell/enums/LearnStates.java b/src/api/java/am2/api/spell/enums/LearnStates.java index 2685501..62638d3 100644 --- a/src/api/java/am2/api/spell/enums/LearnStates.java +++ b/src/api/java/am2/api/spell/enums/LearnStates.java @@ -1,9 +1,9 @@ package am2.api.spell.enums; -public enum LearnStates{ - LEARNED, - CAN_LEARN, - CANNOT_LEARN, - LOCKED, - DISABLED -}; \ No newline at end of file +public enum LearnStates { + LEARNED, + CAN_LEARN, + CANNOT_LEARN, + LOCKED, + DISABLED +}; diff --git a/src/api/java/am2/api/spell/enums/SkillPointTypes.java b/src/api/java/am2/api/spell/enums/SkillPointTypes.java index 6174c0d..5aadeab 100644 --- a/src/api/java/am2/api/spell/enums/SkillPointTypes.java +++ b/src/api/java/am2/api/spell/enums/SkillPointTypes.java @@ -1,8 +1,8 @@ package am2.api.spell.enums; -public enum SkillPointTypes{ - BLUE, - GREEN, - RED, - SILVER +public enum SkillPointTypes { + BLUE, + GREEN, + RED, + SILVER } diff --git a/src/api/java/am2/api/spell/enums/SkillTrees.java b/src/api/java/am2/api/spell/enums/SkillTrees.java index 1dbbcfa..4b16bb1 100644 --- a/src/api/java/am2/api/spell/enums/SkillTrees.java +++ b/src/api/java/am2/api/spell/enums/SkillTrees.java @@ -1,11 +1,11 @@ package am2.api.spell.enums; public enum SkillTrees { - None, - Offense, - Defense, - Utility, - Talents, - Familiar, - Affinity + None, + Offense, + Defense, + Utility, + Talents, + Familiar, + Affinity } diff --git a/src/api/java/am2/api/spell/enums/SpellCastResult.java b/src/api/java/am2/api/spell/enums/SpellCastResult.java index cbfe3a5..6cb761f 100644 --- a/src/api/java/am2/api/spell/enums/SpellCastResult.java +++ b/src/api/java/am2/api/spell/enums/SpellCastResult.java @@ -1,11 +1,11 @@ package am2.api.spell.enums; public enum SpellCastResult { - SUCCESS, - NOT_ENOUGH_MANA, - REAGENTS_MISSING, - MALFORMED_SPELL_STACK, - EFFECT_FAILED, - SUCCESS_REDUCE_MANA, - SILENCED + SUCCESS, + NOT_ENOUGH_MANA, + REAGENTS_MISSING, + MALFORMED_SPELL_STACK, + EFFECT_FAILED, + SUCCESS_REDUCE_MANA, + SILENCED } diff --git a/src/api/java/am2/api/spell/enums/SpellModifiers.java b/src/api/java/am2/api/spell/enums/SpellModifiers.java index ac6b34c..35fc0c5 100644 --- a/src/api/java/am2/api/spell/enums/SpellModifiers.java +++ b/src/api/java/am2/api/spell/enums/SpellModifiers.java @@ -1,30 +1,30 @@ package am2.api.spell.enums; public enum SpellModifiers { - SPEED(1.0D), - GRAVITY(0), - BOUNCE(0), - DAMAGE(4.0D), - HEALING(1.0D), - VELOCITY_ADDED(0.0D), - RADIUS(1.0D), - DURATION(1.0D), - PROCS(1), - RANGE(8.0D), - TARGET_NONSOLID_BLOCKS(0), - PIERCING(2), - COLOR(0xFFFFFF), - MINING_POWER(1), - FORTUNE_LEVEL(1), - SILKTOUCH_LEVEL(1), - DISMEMBERING_LEVEL(1), - BUFF_POWER(1); + SPEED(1.0D), + GRAVITY(0), + BOUNCE(0), + DAMAGE(4.0D), + HEALING(1.0D), + VELOCITY_ADDED(0.0D), + RADIUS(1.0D), + DURATION(1.0D), + PROCS(1), + RANGE(8.0D), + TARGET_NONSOLID_BLOCKS(0), + PIERCING(2), + COLOR(0xFFFFFF), + MINING_POWER(1), + FORTUNE_LEVEL(1), + SILKTOUCH_LEVEL(1), + DISMEMBERING_LEVEL(1), + BUFF_POWER(1); - public double defaultValue = 0D; - public int defaultValueInt = 0; + public double defaultValue = 0D; + public int defaultValueInt = 0; - private SpellModifiers(double defaultValue){ - this.defaultValue = defaultValue; - this.defaultValueInt = (int)defaultValue; - } + private SpellModifiers(double defaultValue) { + this.defaultValue = defaultValue; + this.defaultValueInt = (int) defaultValue; + } } diff --git a/src/main/java/fox/spiteful/forbidden/CommonProxy.java b/src/main/java/fox/spiteful/forbidden/CommonProxy.java index f0765c5..9f0160b 100644 --- a/src/main/java/fox/spiteful/forbidden/CommonProxy.java +++ b/src/main/java/fox/spiteful/forbidden/CommonProxy.java @@ -2,8 +2,5 @@ package fox.spiteful.forbidden; public class CommonProxy { - public void registerRenderInfo(){ - - } - -} \ No newline at end of file + public void registerRenderInfo() {} +} diff --git a/src/main/java/fox/spiteful/forbidden/Config.java b/src/main/java/fox/spiteful/forbidden/Config.java index e48c42f..3988439 100644 --- a/src/main/java/fox/spiteful/forbidden/Config.java +++ b/src/main/java/fox/spiteful/forbidden/Config.java @@ -3,14 +3,11 @@ package fox.spiteful.forbidden; import java.io.File; import java.util.ArrayList; import java.util.HashMap; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraftforge.common.config.Configuration; - import org.apache.logging.log4j.Level; - import thaumcraft.api.ItemApi; import thaumcraft.api.aspects.Aspect; @@ -60,7 +57,7 @@ public class Config { public static boolean special = true; public static boolean twilight = true; public static boolean emc = true; - //public static boolean eewand = true; + // public static boolean eewand = true; public static int bloodvis = 5; public static int manavis = 8; @@ -81,56 +78,133 @@ public class Config { wrathEnchID = conf.get("enchantments", "Wrath", enchCount++).getInt(); greedyEnchID = conf.get("enchantments", "Capitalist", enchCount++).getInt(); consumingEnchID = conf.get("enchantments", "Consuming", enchCount++).getInt(); - educationalEnchID = conf.get("enchantments", "Educational", enchCount++).getInt(); - corruptingEnchID = conf.get("enchantments", "Corrupting", enchCount++).getInt(); + educationalEnchID = + conf.get("enchantments", "Educational", enchCount++).getInt(); + corruptingEnchID = + conf.get("enchantments", "Corrupting", enchCount++).getInt(); voidEnchID = conf.get("enchantments", "Voidtouched", enchCount++).getInt(); impactEnchID = conf.get("enchantments", "Impact", enchCount++).getInt(); int upgradeCount = 42; - hellfireUpgradeID = conf.get("focus upgrades", "Hellfire", upgradeCount).getInt(upgradeCount++); - pandemoniumUpgradeID = conf.get("focus upgrades", "Pandemonium", upgradeCount).getInt(upgradeCount++); + hellfireUpgradeID = + conf.get("focus upgrades", "Hellfire", upgradeCount).getInt(upgradeCount++); + pandemoniumUpgradeID = + conf.get("focus upgrades", "Pandemonium", upgradeCount).getInt(upgradeCount++); - noLust = conf.get("general", "No Lust", noLust, "Enable to remove Luxuria aspect and related items.").getBoolean(false); - silverfishEmeralds = conf.get("general", "Silverfish Drop Emerald Nuggets", silverfishEmeralds, "Disable to prevent Silverfish from dropping emerald nuggets.").getBoolean(true); - greedyEnch = conf.get("general", "Capitalist Enchantment", greedyEnch, "Disable to remove the recipe and effects of the Capitalist enchantment.").getBoolean(true); - emeraldTrans = conf.get("general", "Emerald Transmutation", emeraldTrans, "Disable to remove the Emerald Transmutation research and recipe.").getBoolean(true); - tagResearch = conf.get("general", "Tag Research Items", tagResearch, "Disable to get rid of the [FM] tags in the Thaumonomicon.").getBoolean(true); - wrathCage = conf.get("general", "Wrath Cage Enabled", wrathCage, "Disable if you don't want players using the Wrath Cage.").getBoolean(true); - wrathCost = conf.get("general", "Wrath Cage Fuel Cost", wrathCost, "Cost of essentia per round of spawns in the Wrath Cage. Raise to increase essentia costs. Defaults to 5. Set to 0 to remove the need to fuel the Wrath Cage. Setting the cost above 64 is not recommended.").getInt(5); - wrathEff = conf.get("general", "Wrath Cage Fuel Efficiency", wrathEff, "Number of spawns a Wrath Cage can get per fuel cost. Defaults to 4. Lower to make the cage less efficient and raise to make it more efficient.").getInt(4); - if (wrathEff < 0) - wrathEff = 4; - wrathCrazy = conf.get("general", "Wrath Cage Cries Havoc", wrathCrazy, "Enable to let the Wrath Cage imprint on ANY non-boss mob. May break your game or make your game Awesome.").getBoolean(false); - enchanting = conf.get("general", "Enchantments Enabled", enchanting, "Disable if you don't like enchantments.").getBoolean(true); - spork = conf.get("silly", "Spork of Doom", spork, "What is this? I don't even...").getBoolean(false); - gluttony = (byte)conf.get("general", "Gluttony", gluttony, "Whether gluttony research is enabled. 0 = Enabled, 1 = Disabled, 2 = Hardcore").getInt(0); - if(gluttony < 0 || gluttony > 2) - gluttony = 0; + noLust = conf.get("general", "No Lust", noLust, "Enable to remove Luxuria aspect and related items.") + .getBoolean(false); + silverfishEmeralds = conf.get( + "general", + "Silverfish Drop Emerald Nuggets", + silverfishEmeralds, + "Disable to prevent Silverfish from dropping emerald nuggets.") + .getBoolean(true); + greedyEnch = conf.get( + "general", + "Capitalist Enchantment", + greedyEnch, + "Disable to remove the recipe and effects of the Capitalist enchantment.") + .getBoolean(true); + emeraldTrans = conf.get( + "general", + "Emerald Transmutation", + emeraldTrans, + "Disable to remove the Emerald Transmutation research and recipe.") + .getBoolean(true); + tagResearch = conf.get( + "general", + "Tag Research Items", + tagResearch, + "Disable to get rid of the [FM] tags in the Thaumonomicon.") + .getBoolean(true); + wrathCage = conf.get( + "general", + "Wrath Cage Enabled", + wrathCage, + "Disable if you don't want players using the Wrath Cage.") + .getBoolean(true); + wrathCost = conf.get( + "general", + "Wrath Cage Fuel Cost", + wrathCost, + "Cost of essentia per round of spawns in the Wrath Cage. Raise to increase essentia costs. Defaults to 5. Set to 0 to remove the need to fuel the Wrath Cage. Setting the cost above 64 is not recommended.") + .getInt(5); + wrathEff = conf.get( + "general", + "Wrath Cage Fuel Efficiency", + wrathEff, + "Number of spawns a Wrath Cage can get per fuel cost. Defaults to 4. Lower to make the cage less efficient and raise to make it more efficient.") + .getInt(4); + if (wrathEff < 0) wrathEff = 4; + wrathCrazy = conf.get( + "general", + "Wrath Cage Cries Havoc", + wrathCrazy, + "Enable to let the Wrath Cage imprint on ANY non-boss mob. May break your game or make your game Awesome.") + .getBoolean(false); + enchanting = conf.get( + "general", "Enchantments Enabled", enchanting, "Disable if you don't like enchantments.") + .getBoolean(true); + spork = conf.get("silly", "Spork of Doom", spork, "What is this? I don't even...") + .getBoolean(false); + gluttony = (byte) conf.get( + "general", + "Gluttony", + gluttony, + "Whether gluttony research is enabled. 0 = Enabled, 1 = Disabled, 2 = Hardcore") + .getInt(0); + if (gluttony < 0 || gluttony > 2) gluttony = 0; hereticID = conf.get("general", "Heretic Villager ID", hereticID).getInt(hereticID); - String trashlist = conf.get("general", "Garbage Blocks", "dirt;sand;gravel;cobblestone;netherrack", "List of OreDict names for garbage blocks, separated by semicolons, for the Consuming enchant to eat").getString(); + String trashlist = conf.get( + "general", + "Garbage Blocks", + "dirt;sand;gravel;cobblestone;netherrack", + "List of OreDict names for garbage blocks, separated by semicolons, for the Consuming enchant to eat") + .getString(); String[] trashpile = trashlist.split(";"); - for(String garbage : trashpile){ + for (String garbage : trashpile) { trash.add(garbage); } - bloodSealPotionID = conf.get("potions", "Blood Seal", bloodSealPotionID).getInt(bloodSealPotionID); - dragonwrackPotionID = conf.get("potions", "Dragonwrack", dragonwrackPotionID).getInt(dragonwrackPotionID); + bloodSealPotionID = + conf.get("potions", "Blood Seal", bloodSealPotionID).getInt(bloodSealPotionID); + dragonwrackPotionID = + conf.get("potions", "Dragonwrack", dragonwrackPotionID).getInt(dragonwrackPotionID); - crossMod = conf.get("compatibility", "Cross-Mod Interaction", crossMod, "Disable to keep mods segregated.").getBoolean(true); - crossWand = conf.get("compatibility", "Conversion Wands", crossWand, "Disable to remove all conversion wands.").getBoolean(true); + crossMod = conf.get("compatibility", "Cross-Mod Interaction", crossMod, "Disable to keep mods segregated.") + .getBoolean(true); + crossWand = conf.get( + "compatibility", "Conversion Wands", crossWand, "Disable to remove all conversion wands.") + .getBoolean(true); botan = conf.get("compatibility", "Botania Interaction", botan).getBoolean(true); - bloodMagic = conf.get("compatibility", "Blood Magic Interaction", bloodMagic).getBoolean(true); - am2 = conf.get("compatibility", "Ars Magica 2 Interaction", am2, "AM2 interaction is unsupported. Enable at your own risk.").getBoolean(true); + bloodMagic = conf.get("compatibility", "Blood Magic Interaction", bloodMagic) + .getBoolean(true); + am2 = conf.get( + "compatibility", + "Ars Magica 2 Interaction", + am2, + "AM2 interaction is unsupported. Enable at your own risk.") + .getBoolean(true); tt = conf.get("compatibility", "Thaumic Tinkerer Interaction", tt).getBoolean(true); tc = conf.get("compatibility", "Tinkers Construct Interaction", tc).getBoolean(true); - special = conf.get("compatibility", "Special Mobs Interaction", special).getBoolean(true); - twilight = conf.get("compatibility", "Twilight Forest Interaction", twilight).getBoolean(true); - emc = conf.get("compatibility", "Equivalent Exchange 3 EMC", emc, "Disable if you don't want Forbidden Magic to add EMC values to items.").getBoolean(true); - //eewand = conf.get("compatibility", "Equivalent Exchange 3 Wand", eewand, "Disable to specifically disable the EMC to Vis wand.").getBoolean(true); + special = conf.get("compatibility", "Special Mobs Interaction", special) + .getBoolean(true); + twilight = conf.get("compatibility", "Twilight Forest Interaction", twilight) + .getBoolean(true); + emc = conf.get( + "compatibility", + "Equivalent Exchange 3 EMC", + emc, + "Disable if you don't want Forbidden Magic to add EMC values to items.") + .getBoolean(true); + // eewand = conf.get("compatibility", "Equivalent Exchange 3 Wand", eewand, "Disable to specifically disable + // the EMC to Vis wand.").getBoolean(true); - bloodvis = conf.get("power converters", "LP to Vis", bloodvis, "How much LP 0.01 Vis is worth").getInt(bloodvis); - manavis = conf.get("power converters", "Mana to Vis", manavis, "How much Mana 0.01 Vis is worth").getInt(manavis); + bloodvis = conf.get("power converters", "LP to Vis", bloodvis, "How much LP 0.01 Vis is worth") + .getInt(bloodvis); + manavis = conf.get("power converters", "Mana to Vis", manavis, "How much Mana 0.01 Vis is worth") + .getInt(manavis); } catch (Exception e) { LogHandler.log(Level.ERROR, e, "Had a problem loading its configuration."); } finally { @@ -142,7 +216,8 @@ public class Config { thaumcraftShard = ItemApi.getItem("itemShard", 0); thaumcraftTaintBlock = ItemApi.getBlock("blockTaint", 0); thaumcraftOre = ItemApi.getBlock("blockCustomOre", 0); - taintMaterial = Block.getBlockFromItem(thaumcraftTaintBlock.getItem()).getMaterial(); + taintMaterial = + Block.getBlockFromItem(thaumcraftTaintBlock.getItem()).getMaterial(); } catch (Exception e) { LogHandler.log(Level.ERROR, e, "There was problem when retrieving information from Thaumcraft."); e.printStackTrace(); @@ -170,10 +245,8 @@ public class Config { spawnerMobs.put("PigZombie", Aspect.GREED); spawnerMobs.put("Enderman", Aspect.ELDRITCH); spawnerMobs.put("CaveSpider", Aspect.POISON); - if (silverfishEmeralds) - spawnerMobs.put("Silverfish", Aspect.GREED); - else - spawnerMobs.put("Silverfish", Aspect.BEAST); + if (silverfishEmeralds) spawnerMobs.put("Silverfish", Aspect.GREED); + else spawnerMobs.put("Silverfish", Aspect.BEAST); spawnerMobs.put("Blaze", Aspect.FIRE); spawnerMobs.put("LavaSlime", Aspect.FIRE); spawnerMobs.put("Witch", Aspect.MAGIC); @@ -199,4 +272,4 @@ public class Config { // spawnerMobs.put("Taintacle", DarkAspects.LUST); } } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/DarkAspects.java b/src/main/java/fox/spiteful/forbidden/DarkAspects.java index 4e36c17..3d071e3 100644 --- a/src/main/java/fox/spiteful/forbidden/DarkAspects.java +++ b/src/main/java/fox/spiteful/forbidden/DarkAspects.java @@ -1,7 +1,8 @@ package fox.spiteful.forbidden; +import fox.spiteful.forbidden.blocks.ForbiddenBlocks; +import fox.spiteful.forbidden.items.ForbiddenItems; import java.util.Iterator; - import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -12,9 +13,6 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import fox.spiteful.forbidden.blocks.ForbiddenBlocks; -import fox.spiteful.forbidden.items.ForbiddenItems; - public class DarkAspects { public static Aspect NETHER; public static Aspect WRATH; @@ -26,16 +24,50 @@ public class DarkAspects { public static void initAspects() { if (!Config.noLust) { - LUST = new Aspect("luxuria", 0xffc1ce, new Aspect[] { Aspect.FLESH, Aspect.HUNGER }, new ResourceLocation("forbidden", "textures/aspects/luxuria.png"), 1); + LUST = new Aspect( + "luxuria", + 0xffc1ce, + new Aspect[] {Aspect.FLESH, Aspect.HUNGER}, + new ResourceLocation("forbidden", "textures/aspects/luxuria.png"), + 1); } - NETHER = new Aspect("infernus", 0xff0000, new Aspect[] { Aspect.FIRE, Aspect.MAGIC }, new ResourceLocation("forbidden", "textures/aspects/infernus.png"), 771); - PRIDE = new Aspect("superbia", 0x9639ff, new Aspect[] { Aspect.FLIGHT, Aspect.VOID }, new ResourceLocation("forbidden", "textures/aspects/superbia.png"), 1); - GLUTTONY = new Aspect("gula", 0xd59c46, new Aspect[] { Aspect.HUNGER, Aspect.VOID }, new ResourceLocation("forbidden", "textures/aspects/gula.png"), 1); - ENVY = new Aspect("invidia", 0x00ba00, new Aspect[] { Aspect.SENSES, Aspect.HUNGER }, new ResourceLocation("forbidden", "textures/aspects/invidia.png"), 1); - SLOTH = new Aspect("desidia", 0x6e6e6e, new Aspect[] { Aspect.TRAP, Aspect.SOUL }, new ResourceLocation("forbidden", "textures/aspects/desidia.png"), 771); - WRATH = new Aspect("ira", 0x870404, new Aspect[] { Aspect.WEAPON, Aspect.FIRE }, new ResourceLocation("forbidden", "textures/aspects/ira.png"), 771); - + NETHER = new Aspect( + "infernus", + 0xff0000, + new Aspect[] {Aspect.FIRE, Aspect.MAGIC}, + new ResourceLocation("forbidden", "textures/aspects/infernus.png"), + 771); + PRIDE = new Aspect( + "superbia", + 0x9639ff, + new Aspect[] {Aspect.FLIGHT, Aspect.VOID}, + new ResourceLocation("forbidden", "textures/aspects/superbia.png"), + 1); + GLUTTONY = new Aspect( + "gula", + 0xd59c46, + new Aspect[] {Aspect.HUNGER, Aspect.VOID}, + new ResourceLocation("forbidden", "textures/aspects/gula.png"), + 1); + ENVY = new Aspect( + "invidia", + 0x00ba00, + new Aspect[] {Aspect.SENSES, Aspect.HUNGER}, + new ResourceLocation("forbidden", "textures/aspects/invidia.png"), + 1); + SLOTH = new Aspect( + "desidia", + 0x6e6e6e, + new Aspect[] {Aspect.TRAP, Aspect.SOUL}, + new ResourceLocation("forbidden", "textures/aspects/desidia.png"), + 771); + WRATH = new Aspect( + "ira", + 0x870404, + new Aspect[] {Aspect.WEAPON, Aspect.FIRE}, + new ResourceLocation("forbidden", "textures/aspects/ira.png"), + 771); } private static AspectList getAspectList(ItemStack stack) { @@ -58,7 +90,8 @@ public class DarkAspects { // list.add(NETHER, 2); // ThaumcraftApi.registerObjectTag(Block.oreNetherQuartz.blockID, -1, // list); - ThaumcraftApi.registerObjectTag("oreQuartz", (new AspectList()).add(Aspect.CRYSTAL, 3).add(NETHER, 2)); + ThaumcraftApi.registerObjectTag( + "oreQuartz", (new AspectList()).add(Aspect.CRYSTAL, 3).add(NETHER, 2)); list = getAspectList(new ItemStack(Items.nether_star)); list.add(NETHER, 8).add(PRIDE, 8); @@ -105,13 +138,15 @@ public class DarkAspects { list = getAspectList(new ItemStack(Items.golden_chestplate)); if (list != null) { list.add(PRIDE, 1); - ThaumcraftApi.registerObjectTag(new ItemStack(Items.golden_chestplate, 1, OreDictionary.WILDCARD_VALUE), list); + ThaumcraftApi.registerObjectTag( + new ItemStack(Items.golden_chestplate, 1, OreDictionary.WILDCARD_VALUE), list); } list = getAspectList(new ItemStack(Items.golden_leggings)); if (list != null) { list.add(PRIDE, 1); - ThaumcraftApi.registerObjectTag(new ItemStack(Items.golden_leggings, 1, OreDictionary.WILDCARD_VALUE), list); + ThaumcraftApi.registerObjectTag( + new ItemStack(Items.golden_leggings, 1, OreDictionary.WILDCARD_VALUE), list); } list = getAspectList(new ItemStack(Items.golden_boots)); @@ -161,7 +196,12 @@ public class DarkAspects { // -1, (new AspectList()).merge(Aspect.MECHANISM, 2).merge(Aspect.ORDER, // 2).merge(ENVY, 2)); - list = (new AspectList()).add(Aspect.FLESH, 6).add(Aspect.LIFE, 6).add(Aspect.ENERGY, 6).add(Aspect.BEAST, 4).add(GLUTTONY, 6); + list = (new AspectList()) + .add(Aspect.FLESH, 6) + .add(Aspect.LIFE, 6) + .add(Aspect.ENERGY, 6) + .add(Aspect.BEAST, 4) + .add(GLUTTONY, 6); ThaumcraftApi.registerObjectTag("itemBacon", list); if (!Config.noLust) { @@ -188,10 +228,8 @@ public class DarkAspects { } else if (mobTag.entityName.equals("Skeleton") && mobTag.nbts.length > 0) { mobTag.aspects.add(NETHER, 3); } else if (mobTag.entityName.equals("Creeper")) { - if (mobTag.nbts.length > 0) - mobTag.aspects.add(WRATH, 4); - else - mobTag.aspects.add(WRATH, 2); + if (mobTag.nbts.length > 0) mobTag.aspects.add(WRATH, 4); + else mobTag.aspects.add(WRATH, 2); } else if (mobTag.entityName.equals("WitherBoss")) { mobTag.aspects.add(NETHER, 7).add(WRATH, 7); } else if (mobTag.entityName.equals("Ozelot")) { @@ -229,27 +267,70 @@ public class DarkAspects { } } - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 0), (new AspectList()).add(NETHER, 1).add(WRATH, 2).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 1), (new AspectList()).add(NETHER, 1).add(ENVY, 2).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 2), (new AspectList()).add(Aspect.TAINT, 3).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 3), (new AspectList()).add(NETHER, 1).add(PRIDE, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + (new AspectList()).add(NETHER, 1).add(WRATH, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + (new AspectList()).add(NETHER, 1).add(ENVY, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + (new AspectList()).add(Aspect.TAINT, 3).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 3), + (new AspectList()).add(NETHER, 1).add(PRIDE, 2).add(Aspect.CRYSTAL, 1)); if (!Config.noLust) - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), (new AspectList()).add(NETHER, 1).add(LUST, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 4), + (new AspectList()).add(NETHER, 1).add(LUST, 2).add(Aspect.CRYSTAL, 1)); else - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), (new AspectList()).add(Aspect.VOID, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.gluttonyShard, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(NETHER, 1).add(GLUTTONY, 2).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 5), (new AspectList()).add(NETHER, 1).add(SLOTH, 2).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.deadlyShards, 1, 6), (new AspectList()).add(NETHER, 1).add(Aspect.GREED, 2).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.resource, 1, 0), (new AspectList()).add(Aspect.CRYSTAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.resource, 1, 1), (new AspectList()).add(Aspect.DARKNESS, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenBlocks.blackFlower, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIFE, 1).add(Aspect.SENSES, 1).add(Aspect.DARKNESS, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 4), (new AspectList()).add(Aspect.VOID, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.gluttonyShard, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(NETHER, 1).add(GLUTTONY, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 5), + (new AspectList()).add(NETHER, 1).add(SLOTH, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.deadlyShards, 1, 6), + (new AspectList()).add(NETHER, 1).add(Aspect.GREED, 2).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.resource, 1, 0), (new AspectList()).add(Aspect.CRYSTAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.resource, 1, 1), (new AspectList()).add(Aspect.DARKNESS, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenBlocks.blackFlower, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()) + .add(Aspect.PLANT, 1) + .add(Aspect.LIFE, 1) + .add(Aspect.SENSES, 1) + .add(Aspect.DARKNESS, 1)); if (!Config.noLust) - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.ridingCrop, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.CLOTH, 2).add(Aspect.BEAST, 1).add(LUST, 1).add(Aspect.WEAPON, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.taintFruit, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TAINT, 2).add(Aspect.POISON, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenItems.taintCoal, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TAINT, 2).add(Aspect.ENTROPY, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenBlocks.taintLeaves, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TAINT, 1).add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenBlocks.taintLog, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TAINT, 1).add(Aspect.TREE, 3)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenBlocks.taintPlanks, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.TREE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(ForbiddenBlocks.taintStone, 1, 1), (new AspectList()).add(Aspect.EARTH, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.ridingCrop, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()) + .add(Aspect.TREE, 2) + .add(Aspect.CLOTH, 2) + .add(Aspect.BEAST, 1) + .add(LUST, 1) + .add(Aspect.WEAPON, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.taintFruit, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(Aspect.TAINT, 2).add(Aspect.POISON, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenItems.taintCoal, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(Aspect.TAINT, 2).add(Aspect.ENTROPY, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenBlocks.taintLeaves, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(Aspect.TAINT, 1).add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenBlocks.taintLog, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(Aspect.TAINT, 1).add(Aspect.TREE, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenBlocks.taintPlanks, 1, OreDictionary.WILDCARD_VALUE), + (new AspectList()).add(Aspect.TREE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(ForbiddenBlocks.taintStone, 1, 1), (new AspectList()).add(Aspect.EARTH, 1)); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/DarkResearchItem.java b/src/main/java/fox/spiteful/forbidden/DarkResearchItem.java index ff1cd93..9cee9e5 100644 --- a/src/main/java/fox/spiteful/forbidden/DarkResearchItem.java +++ b/src/main/java/fox/spiteful/forbidden/DarkResearchItem.java @@ -1,12 +1,12 @@ package fox.spiteful.forbidden; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.research.ResearchItem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class DarkResearchItem extends ResearchItem { String inter = null; @@ -23,12 +23,14 @@ public class DarkResearchItem extends ResearchItem { super(par1, x, tags, y, z, par5, icon); } - public DarkResearchItem(String par1, String x, String mod, AspectList tags, int y, int z, int par5, ResourceLocation icon) { + public DarkResearchItem( + String par1, String x, String mod, AspectList tags, int y, int z, int par5, ResourceLocation icon) { super(par1, x, tags, y, z, par5, icon); inter = mod; } - public DarkResearchItem(String par1, String x, String mod, AspectList tags, int y, int z, int par5, ItemStack icon) { + public DarkResearchItem( + String par1, String x, String mod, AspectList tags, int y, int z, int par5, ItemStack icon) { super(par1, x, tags, y, z, par5, icon); inter = mod; } @@ -41,11 +43,8 @@ public class DarkResearchItem extends ResearchItem { @SideOnly(Side.CLIENT) public String getText() { if (Config.tagResearch) { - if (inter == null) - return "[FM] " + StatCollector.translateToLocal("forbidden.research_text." + key); - else - return "[FM] " + inter + " " + StatCollector.translateToLocal("forbidden.research_text." + key); - } else - return StatCollector.translateToLocal("forbidden.research_text." + key); + if (inter == null) return "[FM] " + StatCollector.translateToLocal("forbidden.research_text." + key); + else return "[FM] " + inter + " " + StatCollector.translateToLocal("forbidden.research_text." + key); + } else return StatCollector.translateToLocal("forbidden.research_text." + key); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/FMEventHandler.java b/src/main/java/fox/spiteful/forbidden/FMEventHandler.java index 9150ad2..f794d10 100644 --- a/src/main/java/fox/spiteful/forbidden/FMEventHandler.java +++ b/src/main/java/fox/spiteful/forbidden/FMEventHandler.java @@ -1,17 +1,20 @@ package fox.spiteful.forbidden; -import java.util.*; - import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import baubles.api.BaublesApi; +import com.google.common.collect.Multimap; import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; import fox.spiteful.forbidden.blocks.ForbiddenBlocks; import fox.spiteful.forbidden.compat.Compat; -import fox.spiteful.forbidden.items.tools.ItemRidingCrop; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; +import fox.spiteful.forbidden.items.ForbiddenItems; import fox.spiteful.forbidden.items.baubles.ItemSubCollar; +import fox.spiteful.forbidden.items.tools.ItemRidingCrop; import fox.spiteful.forbidden.items.tools.ItemTaintPickaxe; import fox.spiteful.forbidden.potions.DarkPotions; +import java.util.*; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -34,10 +37,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.*; -import net.minecraft.util.StatCollector; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.util.FakePlayer; @@ -47,28 +50,19 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; - import net.minecraftforge.oredict.OreDictionary; import org.apache.logging.log4j.Level; - import thaumcraft.api.aspects.Aspect; import thaumcraft.api.entities.ITaintedMob; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.lib.utils.Utils; -import com.google.common.collect.Multimap; -import fox.spiteful.forbidden.enchantments.DarkEnchantments; -import fox.spiteful.forbidden.items.ForbiddenItems; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - public class FMEventHandler { Random randy = new Random(); - final Aspect[] primals = { Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE, Aspect.WATER, Aspect.EARTH, Aspect.AIR }; + final Aspect[] primals = {Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE, Aspect.WATER, Aspect.EARTH, Aspect.AIR}; HashMap lastLP = new HashMap(); - @SubscribeEvent public void onPlayerBreaking(BreakSpeed event) { if (event.entityPlayer.getCurrentEquippedItem() != null) { @@ -79,25 +73,19 @@ public class FMEventHandler { int y = event.y; int z = event.z; float hardness = world.getBlock(x, y, z).getBlockHardness(world, x, y, z); - if (hardness == 0.0F) - event.newSpeed = 0.0F; - else if (hardness < 5.0F) - event.newSpeed = 0.1F; - else if (hardness < 20.0F) - event.newSpeed = hardness / 2.0F; - else - event.newSpeed = 5.0F + hardness; + if (hardness == 0.0F) event.newSpeed = 0.0F; + else if (hardness < 5.0F) event.newSpeed = 0.1F; + else if (hardness < 20.0F) event.newSpeed = hardness / 2.0F; + else event.newSpeed = 5.0F + hardness; } } } @SubscribeEvent public void onLivingDrops(LivingDropsEvent event) { - if (event.source.getDamageType().equals("player") && event.entityLiving instanceof ITaintedMob) - { + if (event.source.getDamageType().equals("player") && event.entityLiving instanceof ITaintedMob) { PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness); - if (effect != null) - { + if (effect != null) { if (effect.getAmplifier() >= 2) { double rand = Math.random(); if (rand < 0.50d) { @@ -108,50 +96,87 @@ public class FMEventHandler { } if (Config.silverfishEmeralds && event.entityLiving instanceof EntitySilverfish) { - if (event.entityLiving.worldObj.getBiomeGenForCoords((int) event.entityLiving.posX, (int) event.entityLiving.posZ).biomeID == BiomeGenBase.extremeHills.biomeID) { - if (event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer && randy.nextInt(30) <= (2 + event.lootingLevel * 2)) + if (event.entityLiving.worldObj.getBiomeGenForCoords( + (int) event.entityLiving.posX, (int) event.entityLiving.posZ) + .biomeID + == BiomeGenBase.extremeHills.biomeID) { + if (event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer + && randy.nextInt(30) <= (2 + event.lootingLevel * 2)) addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 0)); - } else if (event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer && !(event.source.getEntity() instanceof FakePlayer) && randy.nextInt(70) <= (1 + event.lootingLevel * 3)) { + } else if (event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer + && !(event.source.getEntity() instanceof FakePlayer) + && randy.nextInt(70) <= (1 + event.lootingLevel * 3)) { addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 0)); } - } - if (Config.greedyEnch && (event.entityLiving instanceof EntityVillager || event.entityLiving instanceof IMob) && event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (Config.greedyEnch + && (event.entityLiving instanceof EntityVillager || event.entityLiving instanceof IMob) + && event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getEntity(); ItemStack equip = player.getCurrentEquippedItem(); - if (equip != null && EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.greedy.effectId, equip) > 0 && event.lootingLevel <= 0) { - if (event.entityLiving instanceof EntityVillager) - addDrop(event, new ItemStack(Items.emerald, 1)); - else if (randy.nextInt(35) < 3) - addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 0)); + if (equip != null + && EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.greedy.effectId, equip) > 0 + && event.lootingLevel <= 0) { + if (event.entityLiving instanceof EntityVillager) addDrop(event, new ItemStack(Items.emerald, 1)); + else if (randy.nextInt(35) < 3) addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 0)); } } - if (event.entityLiving.getClass() == EntitySkeleton.class && event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (event.entityLiving.getClass() == EntitySkeleton.class + && event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer) { ItemStack weap = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); - if (weap != null && weap.getItem() == ForbiddenItems.skullAxe && randy.nextInt(26) <= (3 + EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { + if (weap != null + && weap.getItem() == ForbiddenItems.skullAxe + && randy.nextInt(26) + <= (3 + EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { addDrop(event, new ItemStack(Items.skull, 1, ((EntitySkeleton) event.entityLiving).getSkeletonType())); } } - if (event.entityLiving.getClass() == EntityZombie.class && event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (event.entityLiving.getClass() == EntityZombie.class + && event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer) { ItemStack weap = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); - if (weap != null && weap.getItem() == ForbiddenItems.skullAxe && randy.nextInt(26) <= (2 + 2 * EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { + if (weap != null + && weap.getItem() == ForbiddenItems.skullAxe + && randy.nextInt(26) + <= (2 + 2 * EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { addDrop(event, new ItemStack(Items.skull, 1, 2)); } } - if (event.entityLiving.getClass() == EntityCreeper.class && event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (event.entityLiving.getClass() == EntityCreeper.class + && event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer) { ItemStack weap = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); - if (weap != null && weap.getItem() == ForbiddenItems.skullAxe && randy.nextInt(26) <= (2 + 2 * EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { + if (weap != null + && weap.getItem() == ForbiddenItems.skullAxe + && randy.nextInt(26) + <= (2 + 2 * EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { addDrop(event, new ItemStack(Items.skull, 1, 4)); } } - if (event.entityLiving instanceof EntityPlayer && event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (event.entityLiving instanceof EntityPlayer + && event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer) { ItemStack weap = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); - if (weap != null && weap.getItem() == ForbiddenItems.skullAxe && randy.nextInt(11) <= (1 + EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { + if (weap != null + && weap.getItem() == ForbiddenItems.skullAxe + && randy.nextInt(11) + <= (1 + EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, weap))) { ItemStack head = new ItemStack(Items.skull, 1, 3); NBTTagCompound nametag = new NBTTagCompound(); nametag.setString("SkullOwner", ((EntityPlayer) event.entityLiving).getCommandSenderName()); @@ -160,16 +185,21 @@ public class FMEventHandler { } } - if (event.entityLiving.worldObj.provider.dimensionId != -1) - return; + if (event.entityLiving.worldObj.provider.dimensionId != -1) return; - if (!event.recentlyHit || event.source.getEntity() == null || !(event.source.getEntity() instanceof EntityPlayer) || event.source.getEntity() instanceof FakePlayer) { + if (!event.recentlyHit + || event.source.getEntity() == null + || !(event.source.getEntity() instanceof EntityPlayer) + || event.source.getEntity() instanceof FakePlayer) { if (randy.nextInt(30) < 4) { addDrop(event, new ItemStack(ForbiddenItems.deadlyShards, 1 + randy.nextInt(3), 5)); } } - if (event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer && !(event.source.getEntity() instanceof FakePlayer)) { + if (event.recentlyHit + && event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer + && !(event.source.getEntity() instanceof FakePlayer)) { if (event.entityLiving instanceof IMob) { int wrath = 2; int greed = 0; @@ -177,7 +207,8 @@ public class FMEventHandler { if (heldItem != null) { if (heldItem.getItem() instanceof ItemTool) { Multimap map = heldItem.getItem().getAttributeModifiers(heldItem); - Collection collect = map.get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); + Collection collect = + map.get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); if (collect instanceof AttributeModifier) { wrath += (int) ((AttributeModifier) collect).getAmount(); } @@ -201,9 +232,9 @@ public class FMEventHandler { wrath += EnchantmentHelper.getEnchantmentLevel(Enchantment.baneOfArthropods.effectId, heldItem); } - if(heldItem.getItem() instanceof ItemWandCasting){ - wrath += ((ItemWandCasting)(heldItem.getItem())).getFocusPotency(heldItem); - greed += ((ItemWandCasting)(heldItem.getItem())).getFocusTreasure(heldItem); + if (heldItem.getItem() instanceof ItemWandCasting) { + wrath += ((ItemWandCasting) (heldItem.getItem())).getFocusPotency(heldItem); + greed += ((ItemWandCasting) (heldItem.getItem())).getFocusTreasure(heldItem); } greed += EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, heldItem); @@ -214,16 +245,20 @@ public class FMEventHandler { } if (event.entityLiving instanceof IBossDisplayData) { - addDrop(event, new ItemStack(ForbiddenItems.deadlyShards, 2 + randy.nextInt(1 + event.lootingLevel), 3)); + addDrop( + event, + new ItemStack(ForbiddenItems.deadlyShards, 2 + randy.nextInt(1 + event.lootingLevel), 3)); } - if(greed > 0 && randy.nextInt(20) <= greed){ + if (greed > 0 && randy.nextInt(20) <= greed) { addDrop(event, new ItemStack(ForbiddenItems.deadlyShards, 1, 6)); } } if (event.entityLiving instanceof EntityPigZombie && !(event.source.getEntity() instanceof FakePlayer)) { - if (event.entityLiving.getHeldItem() != null && event.entityLiving.getHeldItem().getItem() == ForbiddenItems.deadlyShards && event.entityLiving.getHeldItem().getItemDamage() == 1) { + if (event.entityLiving.getHeldItem() != null + && event.entityLiving.getHeldItem().getItem() == ForbiddenItems.deadlyShards + && event.entityLiving.getHeldItem().getItemDamage() == 1) { addDrop(event, new ItemStack(ForbiddenItems.deadlyShards, 1, 1)); } } @@ -231,14 +266,21 @@ public class FMEventHandler { } public void addDrop(LivingDropsEvent event, ItemStack drop) { - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, drop); + EntityItem entityitem = new EntityItem( + event.entityLiving.worldObj, + event.entityLiving.posX, + event.entityLiving.posY, + event.entityLiving.posZ, + drop); entityitem.delayBeforeCanPickup = 10; event.drops.add(entityitem); } @SubscribeEvent public void onDeath(LivingDeathEvent event) { - if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer && ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem() != null) { + if (event.source.getEntity() != null + && event.source.getEntity() instanceof EntityPlayer + && ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem() != null) { ItemStack equip = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); if (equip.getItem() == ForbiddenItems.fork) { String name = null; @@ -251,21 +293,30 @@ public class FMEventHandler { return; } } finally { - if (name == null) - return; + if (name == null) return; } - if (Config.spawnerMobs.containsKey(name) || (Config.wrathCrazy && !(event.entityLiving instanceof IBossDisplayData))) + if (Config.spawnerMobs.containsKey(name) + || (Config.wrathCrazy && !(event.entityLiving instanceof IBossDisplayData))) imprintCrystal((EntityPlayer) (event.source.getEntity()), name); } - if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.educational.effectId, equip) > 0 && event.entityLiving instanceof EntityLiving && EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, equip) == 0) { + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.educational.effectId, equip) > 0 + && event.entityLiving instanceof EntityLiving + && EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, equip) == 0) { try { - int learning = 3 * XPReflectionHelper.getXP(((EntityLiving) event.entityLiving)) * EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.educational.effectId, equip); + int learning = 3 + * XPReflectionHelper.getXP(((EntityLiving) event.entityLiving)) + * EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.educational.effectId, equip); while (learning > 0) { int xp = EntityXPOrb.getXPSplit(learning); learning -= xp; - event.entityLiving.worldObj.spawnEntityInWorld(new EntityXPOrb(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, xp)); + event.entityLiving.worldObj.spawnEntityInWorld(new EntityXPOrb( + event.entityLiving.worldObj, + event.entityLiving.posX, + event.entityLiving.posY, + event.entityLiving.posZ, + xp)); } } catch (Throwable e) { LogHandler.log(Level.ERROR, "Failed to educate!"); @@ -277,9 +328,10 @@ public class FMEventHandler { public void imprintCrystal(EntityPlayer player, String mob) { for (int x = 0; x < player.inventory.getSizeInventory(); ++x) { ItemStack item = player.inventory.getStackInSlot(x); - if (item != null && item.getItem() == ForbiddenItems.mobCrystal && (!item.hasTagCompound() || !item.getTagCompound().hasKey("mob"))) { - if (!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); + if (item != null + && item.getItem() == ForbiddenItems.mobCrystal + && (!item.hasTagCompound() || !item.getTagCompound().hasKey("mob"))) { + if (!item.hasTagCompound()) item.setTagCompound(new NBTTagCompound()); item.stackTagCompound.setString("mob", mob); return; } @@ -291,17 +343,20 @@ public class FMEventHandler { EntityPlayer player = event.harvester; if (player != null && player.inventory.getCurrentItem() != null) { ItemStack equip = player.inventory.getCurrentItem(); - if (equip.getItem() == ForbiddenItems.taintShovel && event.block.getMaterial() == thaumcraft.common.config.Config.taintMaterial && event.drops.size() == 0 && event.block != ForbiddenBlocks.taintLeaves) { + if (equip.getItem() == ForbiddenItems.taintShovel + && event.block.getMaterial() == thaumcraft.common.config.Config.taintMaterial + && event.drops.size() == 0 + && event.block != ForbiddenBlocks.taintLeaves) { int fortune = EnchantmentHelper.getFortuneModifier(player); int chance = 1 + (2 * fortune); - if (event.isSilkTouching) - chance += 6; + if (event.isSilkTouching) chance += 6; if (randy.nextInt(31) <= chance) { event.drops.add(new ItemStack(ForbiddenItems.deadlyShards, 1, 2)); } } - if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.cluster.effectId, equip) > 0 && EnchantmentHelper.getFortuneModifier(player) == 0) { + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.cluster.effectId, equip) > 0 + && EnchantmentHelper.getFortuneModifier(player) == 0) { if (event.drops != null && event.drops.size() > 0) { int cluster = EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.cluster.effectId, equip); float chance = 0.2F + (float) cluster * 0.075F; @@ -312,7 +367,13 @@ public class FMEventHandler { if (!is.isItemEqual(smr)) { event.drops.set(a, smr); if (!event.world.isRemote) { - event.world.playSoundEffect((double) ((float) event.x + 0.5F), (double) ((float) event.y + 0.5F), (double) ((float) event.z + 0.5F), "random.orb", 0.2F, 0.7F + event.world.rand.nextFloat() * 0.2F); + event.world.playSoundEffect( + (double) ((float) event.x + 0.5F), + (double) ((float) event.y + 0.5F), + (double) ((float) event.z + 0.5F), + "random.orb", + 0.2F, + 0.7F + event.world.rand.nextFloat() * 0.2F); } } } @@ -321,11 +382,12 @@ public class FMEventHandler { if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.consuming.effectId, equip) > 0) { for (int x = 0; x < event.drops.size(); x++) { ItemStack drop = (ItemStack) event.drops.get(x); - if (drop != null && isGarbage(drop)) - event.drops.remove(x); + if (drop != null && isGarbage(drop)) event.drops.remove(x); } } - if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.corrupting.effectId, equip) > 0 && event.block == Block.getBlockFromItem(Config.thaumcraftOre.getItem()) && randy.nextInt(3) == 1) { + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.corrupting.effectId, equip) > 0 + && event.block == Block.getBlockFromItem(Config.thaumcraftOre.getItem()) + && randy.nextInt(3) == 1) { ArrayList moarDrops = new ArrayList(); ArrayList deadDrops = new ArrayList(); Iterator current = event.drops.iterator(); @@ -348,9 +410,9 @@ public class FMEventHandler { event.drops.add((ItemStack) (current.next())); } } - if(player.worldObj.provider.dimensionId == -1 && event.block == Blocks.quartz_ore){ + if (player.worldObj.provider.dimensionId == -1 && event.block == Blocks.quartz_ore) { int fortune = EnchantmentHelper.getFortuneModifier(player); - if(fortune > 0 && randy.nextInt(60) <= fortune){ + if (fortune > 0 && randy.nextInt(60) <= fortune) { event.drops.add(new ItemStack(ForbiddenItems.deadlyShards, 1, 6)); } } @@ -358,30 +420,31 @@ public class FMEventHandler { } private boolean isGarbage(ItemStack drop) { - for(int id : OreDictionary.getOreIDs(drop)) { - for(String ore : Config.trash) { - if(OreDictionary.getOreName(id).equals(ore)) - return true; + for (int id : OreDictionary.getOreIDs(drop)) { + for (String ore : Config.trash) { + if (OreDictionary.getOreName(id).equals(ore)) return true; } } return false; } @SubscribeEvent - public void onEat(PlayerUseItemEvent.Finish event){ - if(event.entityPlayer.worldObj.isRemote) - return; - if(event.item.getItem() instanceof ItemFood){ - if(event.entityPlayer.worldObj.provider.dimensionId == -1 && event.item.getItem() != ForbiddenItems.gluttonyShard - && randy.nextInt(10) < 2){ - EntityItem ent = event.entityPlayer.entityDropItem(new ItemStack(ForbiddenItems.gluttonyShard, 1), 1.0F); + public void onEat(PlayerUseItemEvent.Finish event) { + if (event.entityPlayer.worldObj.isRemote) return; + if (event.item.getItem() instanceof ItemFood) { + if (event.entityPlayer.worldObj.provider.dimensionId == -1 + && event.item.getItem() != ForbiddenItems.gluttonyShard + && randy.nextInt(10) < 2) { + EntityItem ent = + event.entityPlayer.entityDropItem(new ItemStack(ForbiddenItems.gluttonyShard, 1), 1.0F); ent.motionY += randy.nextFloat() * 0.05F; ent.motionX += (randy.nextFloat() - randy.nextFloat()) * 0.1F; ent.motionZ += (randy.nextFloat() - randy.nextFloat()) * 0.1F; } ItemStack ring = BaublesApi.getBaubles(event.entityPlayer).getStackInSlot(1); ItemStack ring2 = BaublesApi.getBaubles(event.entityPlayer).getStackInSlot(2); - if((ring != null && ring.getItem() == ForbiddenItems.ringFood) || (ring2 != null && ring2.getItem() == ForbiddenItems.ringFood)){ + if ((ring != null && ring.getItem() == ForbiddenItems.ringFood) + || (ring2 != null && ring2.getItem() == ForbiddenItems.ringFood)) { event.entityPlayer.getFoodStats().addStats(2, 2.0F); } } @@ -390,43 +453,46 @@ public class FMEventHandler { public ItemStack getSinShard() { int x = randy.nextInt(7); switch (x) { - case 0: - case 1: - case 3: - case 5: - case 6: - return new ItemStack(ForbiddenItems.deadlyShards, 1, x); - case 2: - return new ItemStack(ForbiddenItems.gluttonyShard, 1, 0); - case 4: - if (Config.noLust) - return getSinShard(); - else - return new ItemStack(ForbiddenItems.deadlyShards, 1, 4); + case 0: + case 1: + case 3: + case 5: + case 6: + return new ItemStack(ForbiddenItems.deadlyShards, 1, x); + case 2: + return new ItemStack(ForbiddenItems.gluttonyShard, 1, 0); + case 4: + if (Config.noLust) return getSinShard(); + else return new ItemStack(ForbiddenItems.deadlyShards, 1, 4); } return null; } @SubscribeEvent public void onSpawn(LivingSpawnEvent event) { - if (event.entityLiving.worldObj.provider.dimensionId == -1 && event.entityLiving instanceof EntityPigZombie && randy.nextInt(175) == 1) + if (event.entityLiving.worldObj.provider.dimensionId == -1 + && event.entityLiving instanceof EntityPigZombie + && randy.nextInt(175) == 1) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ForbiddenItems.deadlyShards, 1, 1)); } @SubscribeEvent public void onGetHurt(LivingHurtEvent event) { - if (event.entityLiving instanceof EntityPlayer && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem() != null && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem().getItem() instanceof ItemWandCasting) { + if (event.entityLiving instanceof EntityPlayer + && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem() != null + && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem().getItem() instanceof ItemWandCasting) { ItemStack wand = ((EntityPlayer) event.entityLiving).getCurrentEquippedItem(); - if (event.source.getDamageType().equals("taint") && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("tainted")) { + if (event.source.getDamageType().equals("taint") + && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("tainted")) { for (int x = 0; x < 3; x++) { ((ItemWandCasting) wand.getItem()).addVis(wand, primals[randy.nextInt(6)], 1, true); } - } - if ((event.source.getDamageType().equals("wither") || event.source.isFireDamage()) && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("infernal")) { + if ((event.source.getDamageType().equals("wither") || event.source.isFireDamage()) + && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("infernal")) { event.setCanceled(true); } @@ -435,7 +501,11 @@ public class FMEventHandler { if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { ItemStack equip = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem(); if (equip != null && equip.getItem() instanceof ItemWandCasting) { - if (((ItemWandCasting) equip.getItem()).getCap(equip).getTag().equals("alchemical") && ((ItemWandCasting) equip.getItem()).getRod(equip).getTag().startsWith("blood")) { + if (((ItemWandCasting) equip.getItem()).getCap(equip).getTag().equals("alchemical") + && ((ItemWandCasting) equip.getItem()) + .getRod(equip) + .getTag() + .startsWith("blood")) { event.entityLiving.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2)); } } @@ -443,28 +513,28 @@ public class FMEventHandler { } @SubscribeEvent(priority = EventPriority.LOWEST) - public void onFeelPain(LivingHurtEvent event){ - if(!Config.noLust && event.ammount > 0 && event.entityLiving instanceof EntityPlayer){ - EntityPlayer player = (EntityPlayer)event.entityLiving; + public void onFeelPain(LivingHurtEvent event) { + if (!Config.noLust && event.ammount > 0 && event.entityLiving instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.entityLiving; ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(0); - if(amulet != null && amulet.getItem() == ForbiddenItems.subCollar){ - int doses = 3 * (int)event.ammount; - if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer){ - EntityPlayer dom = (EntityPlayer)event.source.getEntity(); + if (amulet != null && amulet.getItem() == ForbiddenItems.subCollar) { + int doses = 3 * (int) event.ammount; + if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + EntityPlayer dom = (EntityPlayer) event.source.getEntity(); int chance = 1; - if(dom.getHeldItem() != null && dom.getHeldItem().getItem() instanceof ItemRidingCrop) { + if (dom.getHeldItem() != null && dom.getHeldItem().getItem() instanceof ItemRidingCrop) { doses += 3; chance += 3; } - if(player.worldObj.provider.dimensionId == -1 && randy.nextInt(30) < chance){ + if (player.worldObj.provider.dimensionId == -1 && randy.nextInt(30) < chance) { EntityItem ent = player.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F); ent.motionY += player.worldObj.rand.nextFloat() * 0.05F; ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F; ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F; } } - for(int x = 0;x < doses; x++){ - ((ItemSubCollar)ForbiddenItems.subCollar).addVis(amulet, primals[randy.nextInt(6)], 1, true); + for (int x = 0; x < doses; x++) { + ((ItemSubCollar) ForbiddenItems.subCollar).addVis(amulet, primals[randy.nextInt(6)], 1, true); } } } @@ -473,58 +543,66 @@ public class FMEventHandler { @SubscribeEvent public void onTooltip(ItemTooltipEvent event) { if (event.itemStack.getItem() instanceof ItemWandCasting) { - if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("blood") && !event.itemStack.stackTagCompound.getString("ownerName").equals("")) { - event.toolTip.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + event.itemStack.stackTagCompound.getString("ownerName")); - } else if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("neutronium")) { + if (((ItemWandCasting) event.itemStack.getItem()) + .getRod(event.itemStack) + .getTag() + .startsWith("blood") + && !event.itemStack.stackTagCompound.getString("ownerName").equals("")) { + event.toolTip.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + + event.itemStack.stackTagCompound.getString("ownerName")); + } else if (((ItemWandCasting) event.itemStack.getItem()) + .getRod(event.itemStack) + .getTag() + .startsWith("neutronium")) { event.toolTip.add(StatCollector.translateToLocal("tooltip.creativeonly")); - } else if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("profane")) { - event.toolTip.add("Contract: " + event.itemStack.getTagCompound().getInteger("contract")); + } else if (((ItemWandCasting) event.itemStack.getItem()) + .getRod(event.itemStack) + .getTag() + .startsWith("profane")) { + event.toolTip.add( + "Contract: " + event.itemStack.getTagCompound().getInteger("contract")); } } } @SubscribeEvent - public void onEntityUpdate(LivingUpdateEvent event){ - if(Compat.bm && event.entityLiving != null && event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote){ - EntityPlayer player = (EntityPlayer)event.entityLiving; + public void onEntityUpdate(LivingUpdateEvent event) { + if (Compat.bm + && event.entityLiving != null + && event.entityLiving instanceof EntityPlayer + && !event.entityLiving.worldObj.isRemote) { + EntityPlayer player = (EntityPlayer) event.entityLiving; String name = player.getDisplayName(); - if(player.isPotionActive(DarkPotions.bloodSeal)){ + if (player.isPotionActive(DarkPotions.bloodSeal)) { try { if (lastLP.containsKey(name)) { if (SoulNetworkHandler.getCurrentEssence(name) > lastLP.get(name)) SoulNetworkHandler.setCurrentEssence(name, lastLP.get(name)); - else - lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name)); - } - else - lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name)); - } - catch(Throwable e){ + else lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name)); + } else lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name)); + } catch (Throwable e) { Compat.bm = false; } - } - else if(lastLP.containsKey(name)) - lastLP.remove(name); + } else if (lastLP.containsKey(name)) lastLP.remove(name); } } @SubscribeEvent public void onCrafting(ItemCraftedEvent event) { - if(event.crafting.getItem() == ForbiddenItems.primewell) { - for(int x = 0; x < 9; ++x) { + if (event.crafting.getItem() == ForbiddenItems.primewell) { + for (int x = 0; x < 9; ++x) { ItemStack item = event.craftMatrix.getStackInSlot(x); - if(item != null && item.getItem() == ConfigItems.itemEldritchObject) { + if (item != null && item.getItem() == ConfigItems.itemEldritchObject) { ++item.stackSize; event.craftMatrix.setInventorySlotContents(x, item); } } } - if(Compat.bm && event.crafting.getItem() == ForbiddenItems.bloodOrb){ + if (Compat.bm && event.crafting.getItem() == ForbiddenItems.bloodOrb) { EntityItem ent = event.player.entityDropItem(new ItemStack(ConfigItems.itemEldritchObject, 1, 3), 0); ent.motionY += randy.nextFloat() * 0.05F; ent.motionX += (randy.nextFloat() - randy.nextFloat()) * 0.1F; ent.motionZ += (randy.nextFloat() - randy.nextFloat()) * 0.1F; } } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/Forbidden.java b/src/main/java/fox/spiteful/forbidden/Forbidden.java index 556cede..bb20a58 100644 --- a/src/main/java/fox/spiteful/forbidden/Forbidden.java +++ b/src/main/java/fox/spiteful/forbidden/Forbidden.java @@ -1,20 +1,6 @@ package fox.spiteful.forbidden; import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.VillagerRegistry; -import fox.spiteful.forbidden.potions.DarkPotions; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraftforge.common.MinecraftForge; -import org.apache.logging.log4j.Level; -import thaumcraft.api.wands.WandTriggerRegistry; - -import fox.spiteful.forbidden.blocks.ForbiddenBlocks; -import fox.spiteful.forbidden.compat.Compat; -import fox.spiteful.forbidden.enchantments.DarkEnchantments; -import fox.spiteful.forbidden.items.ForbiddenItems; - import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -22,22 +8,40 @@ import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.VillagerRegistry; +import fox.spiteful.forbidden.blocks.ForbiddenBlocks; +import fox.spiteful.forbidden.compat.Compat; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; +import fox.spiteful.forbidden.items.ForbiddenItems; +import fox.spiteful.forbidden.potions.DarkPotions; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraftforge.common.MinecraftForge; +import thaumcraft.api.wands.WandTriggerRegistry; -import java.util.Collection; - -@Mod(modid = "ForbiddenMagic", name = "Forbidden Magic", version = "GRADLETOKEN_VERSION", dependencies = "required-after:Thaumcraft@[4.2.2.0,);after:ThaumicTinkerer;after:AWWayofTime;after:Botania") +@Mod( + modid = "ForbiddenMagic", + name = "Forbidden Magic", + version = "GRADLETOKEN_VERSION", + dependencies = "required-after:Thaumcraft@[4.2.2.0,);after:ThaumicTinkerer;after:AWWayofTime;after:Botania") public class Forbidden { @Instance("ForbiddenMagic") public static Forbidden instance; - public static CreativeTabs tab = new CreativeTabs("forbidden"){ + + public static CreativeTabs tab = new CreativeTabs("forbidden") { @Override public Item getTabIconItem() { return ForbiddenItems.fork; } }; public static CreativeTabs crysTab; - @SidedProxy(clientSide = "fox.spiteful.forbidden.client.ClientProxy", serverSide = "fox.spiteful.forbidden.CommonProxy") + + @SidedProxy( + clientSide = "fox.spiteful.forbidden.client.ClientProxy", + serverSide = "fox.spiteful.forbidden.CommonProxy") public static CommonProxy proxy; + public static WandOverlord wandLord; public static FMEventHandler events; @@ -46,7 +50,7 @@ public class Forbidden { instance = this; Config.configurate(event.getSuggestedConfigurationFile()); if (Config.wrathCage) - crysTab = new CreativeTabs("mobcrystal"){ + crysTab = new CreativeTabs("mobcrystal") { @Override public Item getTabIconItem() { return ForbiddenItems.mobCrystal; @@ -58,8 +62,7 @@ public class Forbidden { ForbiddenItems.addItems(); ForbiddenBlocks.addBlocks(); DarkEnchantments.hex(); - if(Compat.bm) - DarkPotions.alchemize(); + if (Compat.bm) DarkPotions.alchemize(); proxy.registerRenderInfo(); } @@ -83,4 +86,4 @@ public class Forbidden { WandTriggerRegistry.registerWandBlockTrigger(wandLord, 1, Blocks.obsidian, 0); WandTriggerRegistry.registerWandBlockTrigger(wandLord, 1, Blocks.netherrack, 0); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/ForbiddenRecipes.java b/src/main/java/fox/spiteful/forbidden/ForbiddenRecipes.java index adafc8d..b49c2a1 100644 --- a/src/main/java/fox/spiteful/forbidden/ForbiddenRecipes.java +++ b/src/main/java/fox/spiteful/forbidden/ForbiddenRecipes.java @@ -1,11 +1,11 @@ package fox.spiteful.forbidden; -import java.util.Iterator; -import java.util.Random; - import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.registry.GameRegistry; -import fox.spiteful.forbidden.compat.Compat; +import fox.spiteful.forbidden.blocks.ForbiddenBlocks; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; +import fox.spiteful.forbidden.items.ForbiddenItems; +import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -15,97 +15,615 @@ import thaumcraft.api.ItemApi; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.crafting.InfusionEnchantmentRecipe; -import thaumcraft.api.wands.WandCap; - -import fox.spiteful.forbidden.blocks.ForbiddenBlocks; -import fox.spiteful.forbidden.enchantments.DarkEnchantments; -import fox.spiteful.forbidden.items.ForbiddenItems; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; public class ForbiddenRecipes { public static void addRecipes() { - ForbiddenResearch.recipes.put("TaintShovel", ThaumcraftApi.addInfusionCraftingRecipe("TAINTSHOVEL", new ItemStack(ForbiddenItems.taintShovel), 5, (new AspectList()).add(Aspect.HEAL, 8).add(Aspect.CRYSTAL, 24).add(Aspect.MINE, 12), ItemApi.getItem("itemShovelThaumium", 0), new ItemStack[] { ItemApi.getItem("itemShard", 4), new ItemStack(ConfigItems.itemResource, 1, 6), new ItemStack(Items.diamond), ItemApi.getBlock("blockMagicalLog", 1) })); - ForbiddenResearch.recipes.put("TaintPick", ThaumcraftApi.addInfusionCraftingRecipe("TAINTPICK", new ItemStack(ForbiddenItems.taintPickaxe), 1, (new AspectList()).add(Aspect.ENTROPY, 8).add(Aspect.MINE, 8).add(Aspect.TAINT, 12), ItemApi.getItem("itemPickThaumium", 0), new ItemStack[] { ItemApi.getItem("itemShard", 5), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(Items.diamond), ItemApi.getBlock("blockMagicalLog", 0) })); - ForbiddenResearch.recipes.put("WandRodTainted", ThaumcraftApi.addInfusionCraftingRecipe("ROD_tainted", new ItemStack(ForbiddenItems.wandCore, 1, 0), 5, (new AspectList()).add(Aspect.TAINT, 24).add(Aspect.MAGIC, 12).add(Aspect.ENTROPY, 12), ItemApi.getItem("itemResource", 12), new ItemStack[]{ItemApi.getItem("itemResource", 14), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(ForbiddenItems.deadlyShards, 1, 2), new ItemStack(ForbiddenItems.deadlyShards, 1, 2)})); - ForbiddenResearch.recipes.put("TaintTree", ThaumcraftApi.addCrucibleRecipe("TAINTTREE", new ItemStack(ForbiddenBlocks.taintSapling, 1, 0), new ItemStack(Blocks.sapling, 1, 0), (new AspectList()).merge(Aspect.TAINT, 10).add(Aspect.POISON, 4))); - ForbiddenResearch.recipes.put("TaintPlank", CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.taintPlanks, 4, 0), new Object[]{"#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.taintLog, 1, 0)})); + ForbiddenResearch.recipes.put( + "TaintShovel", + ThaumcraftApi.addInfusionCraftingRecipe( + "TAINTSHOVEL", + new ItemStack(ForbiddenItems.taintShovel), + 5, + (new AspectList()) + .add(Aspect.HEAL, 8) + .add(Aspect.CRYSTAL, 24) + .add(Aspect.MINE, 12), + ItemApi.getItem("itemShovelThaumium", 0), + new ItemStack[] { + ItemApi.getItem("itemShard", 4), + new ItemStack(ConfigItems.itemResource, 1, 6), + new ItemStack(Items.diamond), + ItemApi.getBlock("blockMagicalLog", 1) + })); + ForbiddenResearch.recipes.put( + "TaintPick", + ThaumcraftApi.addInfusionCraftingRecipe( + "TAINTPICK", + new ItemStack(ForbiddenItems.taintPickaxe), + 1, + (new AspectList()) + .add(Aspect.ENTROPY, 8) + .add(Aspect.MINE, 8) + .add(Aspect.TAINT, 12), + ItemApi.getItem("itemPickThaumium", 0), + new ItemStack[] { + ItemApi.getItem("itemShard", 5), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(Items.diamond), + ItemApi.getBlock("blockMagicalLog", 0) + })); + ForbiddenResearch.recipes.put( + "WandRodTainted", + ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_tainted", + new ItemStack(ForbiddenItems.wandCore, 1, 0), + 5, + (new AspectList()) + .add(Aspect.TAINT, 24) + .add(Aspect.MAGIC, 12) + .add(Aspect.ENTROPY, 12), + ItemApi.getItem("itemResource", 12), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2), + new ItemStack(ForbiddenItems.deadlyShards, 1, 2) + })); + ForbiddenResearch.recipes.put( + "TaintTree", + ThaumcraftApi.addCrucibleRecipe( + "TAINTTREE", + new ItemStack(ForbiddenBlocks.taintSapling, 1, 0), + new ItemStack(Blocks.sapling, 1, 0), + (new AspectList()).merge(Aspect.TAINT, 10).add(Aspect.POISON, 4))); + ForbiddenResearch.recipes.put( + "TaintPlank", + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.taintPlanks, 4, 0), new Object[] { + "#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.taintLog, 1, 0) + })); GameRegistry.addSmelting(ForbiddenBlocks.taintLog, new ItemStack(ForbiddenItems.taintCoal, 1), 0.15F); OreDictionary.registerOre("resourceTaint", new ItemStack(ConfigItems.itemResource, 1, 11)); OreDictionary.registerOre("resourceTaint", new ItemStack(ForbiddenItems.deadlyShards, 1, 2)); - ForbiddenResearch.recipes.put("TaintStone", ThaumcraftApi.addArcaneCraftingRecipe("TAINTSTONE", new ItemStack(ForbiddenBlocks.taintStone, 9, 0), (new AspectList()).add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 1), new Object[]{"SSS", "SXS", "SSS", Character.valueOf('S'), new ItemStack(Blocks.stone, 1), Character.valueOf('X'), "resourceTaint"})); - ForbiddenResearch.recipes.put("TaintBrick", CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.taintStone, 4, 1), new Object[] { "##", "##", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.taintStone, 1, 0) })); + ForbiddenResearch.recipes.put( + "TaintStone", + ThaumcraftApi.addArcaneCraftingRecipe( + "TAINTSTONE", + new ItemStack(ForbiddenBlocks.taintStone, 9, 0), + (new AspectList()).add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 1), + new Object[] { + "SSS", + "SXS", + "SSS", + Character.valueOf('S'), + new ItemStack(Blocks.stone, 1), + Character.valueOf('X'), + "resourceTaint" + })); + ForbiddenResearch.recipes.put( + "TaintBrick", + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.taintStone, 4, 1), new Object[] { + "##", "##", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.taintStone, 1, 0) + })); - ForbiddenResearch.recipes.put("SkullAxe", ThaumcraftApi.addInfusionCraftingRecipe("SKULLAXE", new ItemStack(ForbiddenItems.skullAxe), 1, (new AspectList()).add(DarkAspects.WRATH, 8).add(Aspect.WEAPON, 8).add(DarkAspects.NETHER, 8), ItemApi.getItem("itemAxeThaumium", 0), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(Items.diamond), new ItemStack(Items.skull, 1, 1) })); - if(!Config.noLust) - ForbiddenResearch.recipes.put("SubCollar", ThaumcraftApi.addInfusionCraftingRecipe("SUBCOLLAR", new ItemStack(ForbiddenItems.subCollar), 1, (new AspectList()).add(DarkAspects.LUST, 8).add(Aspect.TRAP, 8).add(DarkAspects.NETHER, 4).add(Aspect.FLESH, 4), new ItemStack(ConfigItems.itemAmuletVis, 1, 1), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 4), new ItemStack(ForbiddenItems.deadlyShards, 1, 4), new ItemStack(ForbiddenItems.deadlyShards, 1, 4), new ItemStack(Items.lead, 1), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 2) })); - if(Config.gluttony == 0) { - ForbiddenResearch.recipes.put("ArcaneCake", ThaumcraftApi.addInfusionCraftingRecipe("ARCANECAKE", new ItemStack(ForbiddenItems.arcaneCakeItem), 3, (new AspectList()).add(DarkAspects.GLUTTONY, 12).add(Aspect.HUNGER, 24).add(Aspect.CRAFT, 24), new ItemStack(Items.cake), new ItemStack[]{ItemApi.getItem("itemResource", 14), new ItemStack(Items.egg), new ItemStack(Items.milk_bucket), new ItemStack(Items.egg), new ItemStack(ForbiddenItems.gluttonyShard), new ItemStack(ForbiddenItems.gluttonyShard)})); - ForbiddenResearch.recipes.put("RingFood", ThaumcraftApi.addArcaneCraftingRecipe("RINGFOOD", new ItemStack(ForbiddenItems.ringFood), (new AspectList()).add(Aspect.ENTROPY, 10).add(Aspect.WATER, 20).add(Aspect.EARTH, 20), new Object[]{" D ", "SXS", " S ", Character.valueOf('S'), new ItemStack(ForbiddenItems.gluttonyShard, 1), Character.valueOf('X'), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), Character.valueOf('D'), new ItemStack(Items.diamond)})); + ForbiddenResearch.recipes.put( + "SkullAxe", + ThaumcraftApi.addInfusionCraftingRecipe( + "SKULLAXE", + new ItemStack(ForbiddenItems.skullAxe), + 1, + (new AspectList()) + .add(DarkAspects.WRATH, 8) + .add(Aspect.WEAPON, 8) + .add(DarkAspects.NETHER, 8), + ItemApi.getItem("itemAxeThaumium", 0), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(Items.diamond), + new ItemStack(Items.skull, 1, 1) + })); + if (!Config.noLust) + ForbiddenResearch.recipes.put( + "SubCollar", + ThaumcraftApi.addInfusionCraftingRecipe( + "SUBCOLLAR", + new ItemStack(ForbiddenItems.subCollar), + 1, + (new AspectList()) + .add(DarkAspects.LUST, 8) + .add(Aspect.TRAP, 8) + .add(DarkAspects.NETHER, 4) + .add(Aspect.FLESH, 4), + new ItemStack(ConfigItems.itemAmuletVis, 1, 1), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 4), + new ItemStack(ForbiddenItems.deadlyShards, 1, 4), + new ItemStack(ForbiddenItems.deadlyShards, 1, 4), + new ItemStack(Items.lead, 1), + new ItemStack(ConfigItems.itemBaubleBlanks, 1, 2) + })); + if (Config.gluttony == 0) { + ForbiddenResearch.recipes.put( + "ArcaneCake", + ThaumcraftApi.addInfusionCraftingRecipe( + "ARCANECAKE", + new ItemStack(ForbiddenItems.arcaneCakeItem), + 3, + (new AspectList()) + .add(DarkAspects.GLUTTONY, 12) + .add(Aspect.HUNGER, 24) + .add(Aspect.CRAFT, 24), + new ItemStack(Items.cake), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(Items.egg), + new ItemStack(Items.milk_bucket), + new ItemStack(Items.egg), + new ItemStack(ForbiddenItems.gluttonyShard), + new ItemStack(ForbiddenItems.gluttonyShard) + })); + ForbiddenResearch.recipes.put( + "RingFood", + ThaumcraftApi.addArcaneCraftingRecipe( + "RINGFOOD", + new ItemStack(ForbiddenItems.ringFood), + (new AspectList()) + .add(Aspect.ENTROPY, 10) + .add(Aspect.WATER, 20) + .add(Aspect.EARTH, 20), + new Object[] { + " D ", + "SXS", + " S ", + Character.valueOf('S'), + new ItemStack(ForbiddenItems.gluttonyShard, 1), + Character.valueOf('X'), + new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), + Character.valueOf('D'), + new ItemStack(Items.diamond) + })); + } else if (Config.gluttony == 2) { + ForbiddenResearch.recipes.put( + "ArcaneCake", + ThaumcraftApi.addInfusionCraftingRecipe( + "ARCANECAKE", + new ItemStack(ForbiddenItems.arcaneCakeItem), + 3, + (new AspectList()) + .add(DarkAspects.GLUTTONY, 12) + .add(Aspect.HUNGER, 24) + .add(Aspect.CRAFT, 24), + new ItemStack(Items.cake), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(ForbiddenBlocks.starBlock), + new ItemStack(ForbiddenBlocks.starBlock), + new ItemStack(Items.egg), + new ItemStack(ForbiddenItems.gluttonyShard), + new ItemStack(ForbiddenItems.gluttonyShard) + })); + ForbiddenResearch.recipes.put( + "RingFood", + ThaumcraftApi.addArcaneCraftingRecipe( + "RINGFOOD", + new ItemStack(ForbiddenItems.ringFood), + (new AspectList()) + .add(Aspect.ENTROPY, 10) + .add(Aspect.WATER, 20) + .add(Aspect.EARTH, 20), + new Object[] { + " D ", + "SXS", + " S ", + Character.valueOf('S'), + new ItemStack(ForbiddenItems.gluttonyShard, 1), + Character.valueOf('X'), + new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), + Character.valueOf('D'), + new ItemStack(ForbiddenBlocks.starBlock) + })); } - else if(Config.gluttony == 2){ - ForbiddenResearch.recipes.put("ArcaneCake", ThaumcraftApi.addInfusionCraftingRecipe("ARCANECAKE", new ItemStack(ForbiddenItems.arcaneCakeItem), 3, (new AspectList()).add(DarkAspects.GLUTTONY, 12).add(Aspect.HUNGER, 24).add(Aspect.CRAFT, 24), new ItemStack(Items.cake), new ItemStack[]{ItemApi.getItem("itemResource", 14), new ItemStack(ForbiddenBlocks.starBlock), new ItemStack(ForbiddenBlocks.starBlock), new ItemStack(Items.egg), new ItemStack(ForbiddenItems.gluttonyShard), new ItemStack(ForbiddenItems.gluttonyShard)})); - ForbiddenResearch.recipes.put("RingFood", ThaumcraftApi.addArcaneCraftingRecipe("RINGFOOD", new ItemStack(ForbiddenItems.ringFood), (new AspectList()).add(Aspect.ENTROPY, 10).add(Aspect.WATER, 20).add(Aspect.EARTH, 20), new Object[]{" D ", "SXS", " S ", Character.valueOf('S'), new ItemStack(ForbiddenItems.gluttonyShard, 1), Character.valueOf('X'), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), Character.valueOf('D'), new ItemStack(ForbiddenBlocks.starBlock)})); - } - ForbiddenResearch.recipes.put("FocusBlink", ThaumcraftApi.addInfusionCraftingRecipe("FOCUSBLINK", new ItemStack(ForbiddenItems.blinkFocus), 3, (new AspectList()).add(Aspect.TRAVEL, 25).add(DarkAspects.NETHER, 10).add(DarkAspects.SLOTH, 10).add(Aspect.ENTROPY, 25), new ItemStack(Items.ender_pearl), new ItemStack[]{new ItemStack(Items.quartz), new ItemStack(ForbiddenItems.deadlyShards, 1, 5), new ItemStack(Items.quartz), new ItemStack(ForbiddenItems.deadlyShards, 1, 5), new ItemStack(Items.quartz), new ItemStack(ForbiddenItems.deadlyShards, 1, 5)})); - ForbiddenResearch.recipes.put("MorphPick", ThaumcraftApi.addInfusionCraftingRecipe("MORPHTOOLS", new ItemStack(ForbiddenItems.morphPickaxe), 6, (new AspectList()).add(Aspect.EXCHANGE, 32).add(DarkAspects.ENVY, 16).add(Aspect.TOOL, 16), ItemApi.getItem("itemPickThaumium", 0), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(Items.diamond), ItemApi.getItem("itemResource", 3), ItemApi.getBlock("blockMagicalLog", 1) })); - ForbiddenResearch.recipes.put("MorphSword", ThaumcraftApi.addInfusionCraftingRecipe("MORPHTOOLS", new ItemStack(ForbiddenItems.morphSword), 6, (new AspectList()).add(Aspect.EXCHANGE, 32).add(DarkAspects.ENVY, 16).add(Aspect.WEAPON, 16), ItemApi.getItem("itemSwordThaumium", 0), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(Items.diamond), ItemApi.getItem("itemResource", 3), ItemApi.getBlock("blockMagicalLog", 1) })); - ForbiddenResearch.recipes.put("MorphShovel", ThaumcraftApi.addInfusionCraftingRecipe("MORPHTOOLS", new ItemStack(ForbiddenItems.morphShovel), 6, (new AspectList()).add(Aspect.EXCHANGE, 32).add(DarkAspects.ENVY, 16).add(Aspect.TOOL, 16), ItemApi.getItem("itemShovelThaumium", 0), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(Items.diamond), ItemApi.getItem("itemResource", 3), ItemApi.getBlock("blockMagicalLog", 1) })); - ForbiddenResearch.recipes.put("MorphAxe", ThaumcraftApi.addInfusionCraftingRecipe("MORPHTOOLS", new ItemStack(ForbiddenItems.morphAxe), 6, (new AspectList()).add(Aspect.EXCHANGE, 32).add(DarkAspects.ENVY, 16).add(Aspect.TOOL, 16), ItemApi.getItem("itemAxeThaumium", 0), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(Items.diamond), ItemApi.getItem("itemResource", 3), ItemApi.getBlock("blockMagicalLog", 1) })); - ForbiddenResearch.recipes.put("WandRodInfernal", ThaumcraftApi.addInfusionCraftingRecipe("ROD_infernal", new ItemStack(ForbiddenItems.wandCore, 1, 1), 5, (new AspectList()).add(DarkAspects.NETHER, 32).add(Aspect.MAGIC, 12).add(DarkAspects.PRIDE, 12), new ItemStack(Items.blaze_rod), new ItemStack[] { ItemApi.getItem("itemResource", 14), new ItemStack(ForbiddenItems.deadlyShards, 1, 3), new ItemStack(ForbiddenItems.deadlyShards, 1, 3), new ItemStack(Blocks.soul_sand), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.quartz), new ItemStack(Items.blaze_powder) })); + ForbiddenResearch.recipes.put( + "FocusBlink", + ThaumcraftApi.addInfusionCraftingRecipe( + "FOCUSBLINK", + new ItemStack(ForbiddenItems.blinkFocus), + 3, + (new AspectList()) + .add(Aspect.TRAVEL, 25) + .add(DarkAspects.NETHER, 10) + .add(DarkAspects.SLOTH, 10) + .add(Aspect.ENTROPY, 25), + new ItemStack(Items.ender_pearl), + new ItemStack[] { + new ItemStack(Items.quartz), + new ItemStack(ForbiddenItems.deadlyShards, 1, 5), + new ItemStack(Items.quartz), + new ItemStack(ForbiddenItems.deadlyShards, 1, 5), + new ItemStack(Items.quartz), + new ItemStack(ForbiddenItems.deadlyShards, 1, 5) + })); + ForbiddenResearch.recipes.put( + "MorphPick", + ThaumcraftApi.addInfusionCraftingRecipe( + "MORPHTOOLS", + new ItemStack(ForbiddenItems.morphPickaxe), + 6, + (new AspectList()) + .add(Aspect.EXCHANGE, 32) + .add(DarkAspects.ENVY, 16) + .add(Aspect.TOOL, 16), + ItemApi.getItem("itemPickThaumium", 0), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(Items.diamond), + ItemApi.getItem("itemResource", 3), + ItemApi.getBlock("blockMagicalLog", 1) + })); + ForbiddenResearch.recipes.put( + "MorphSword", + ThaumcraftApi.addInfusionCraftingRecipe( + "MORPHTOOLS", + new ItemStack(ForbiddenItems.morphSword), + 6, + (new AspectList()) + .add(Aspect.EXCHANGE, 32) + .add(DarkAspects.ENVY, 16) + .add(Aspect.WEAPON, 16), + ItemApi.getItem("itemSwordThaumium", 0), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(Items.diamond), + ItemApi.getItem("itemResource", 3), + ItemApi.getBlock("blockMagicalLog", 1) + })); + ForbiddenResearch.recipes.put( + "MorphShovel", + ThaumcraftApi.addInfusionCraftingRecipe( + "MORPHTOOLS", + new ItemStack(ForbiddenItems.morphShovel), + 6, + (new AspectList()) + .add(Aspect.EXCHANGE, 32) + .add(DarkAspects.ENVY, 16) + .add(Aspect.TOOL, 16), + ItemApi.getItem("itemShovelThaumium", 0), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(Items.diamond), + ItemApi.getItem("itemResource", 3), + ItemApi.getBlock("blockMagicalLog", 1) + })); + ForbiddenResearch.recipes.put( + "MorphAxe", + ThaumcraftApi.addInfusionCraftingRecipe( + "MORPHTOOLS", + new ItemStack(ForbiddenItems.morphAxe), + 6, + (new AspectList()) + .add(Aspect.EXCHANGE, 32) + .add(DarkAspects.ENVY, 16) + .add(Aspect.TOOL, 16), + ItemApi.getItem("itemAxeThaumium", 0), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(Items.diamond), + ItemApi.getItem("itemResource", 3), + ItemApi.getBlock("blockMagicalLog", 1) + })); + ForbiddenResearch.recipes.put( + "WandRodInfernal", + ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_infernal", + new ItemStack(ForbiddenItems.wandCore, 1, 1), + 5, + (new AspectList()) + .add(DarkAspects.NETHER, 32) + .add(Aspect.MAGIC, 12) + .add(DarkAspects.PRIDE, 12), + new ItemStack(Items.blaze_rod), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(ForbiddenItems.deadlyShards, 1, 3), + new ItemStack(ForbiddenItems.deadlyShards, 1, 3), + new ItemStack(Blocks.soul_sand), + new ItemStack(Items.skull, 1, 1), + new ItemStack(Items.quartz), + new ItemStack(Items.blaze_powder) + })); if (Config.wrathCage) { - ForbiddenResearch.recipes.put("WrathCage", ThaumcraftApi.addInfusionCraftingRecipe("WRATHCAGE", new ItemStack(ForbiddenBlocks.wrathCage, 1, 0), 10, (new AspectList()).add(DarkAspects.WRATH, 32).add(Aspect.MAGIC, 32).add(Aspect.BEAST, 32).add(Aspect.MECHANISM, 16), ItemApi.getBlock("blockCosmeticSolid", 4), new ItemStack[] { new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(Items.diamond, 1, 0), new ItemStack(Items.diamond, 1, 0), new ItemStack(Items.diamond, 1, 0), new ItemStack(Items.diamond, 1, 0), ItemApi.getBlock("blockJar", 0), ItemApi.getBlock("blockJar", 0), ItemApi.getBlock("blockJar", 0) })); - ForbiddenResearch.recipes.put("MobCrystal", ThaumcraftApi.addCrucibleRecipe("WRATHCAGE", new ItemStack(ForbiddenItems.mobCrystal, 1, 0), new ItemStack(Items.diamond, 1), (new AspectList()).merge(Aspect.MIND, 10).merge(Aspect.ENERGY, 10))); + ForbiddenResearch.recipes.put( + "WrathCage", + ThaumcraftApi.addInfusionCraftingRecipe( + "WRATHCAGE", + new ItemStack(ForbiddenBlocks.wrathCage, 1, 0), + 10, + (new AspectList()) + .add(DarkAspects.WRATH, 32) + .add(Aspect.MAGIC, 32) + .add(Aspect.BEAST, 32) + .add(Aspect.MECHANISM, 16), + ItemApi.getBlock("blockCosmeticSolid", 4), + new ItemStack[] { + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(Items.diamond, 1, 0), + new ItemStack(Items.diamond, 1, 0), + new ItemStack(Items.diamond, 1, 0), + new ItemStack(Items.diamond, 1, 0), + ItemApi.getBlock("blockJar", 0), + ItemApi.getBlock("blockJar", 0), + ItemApi.getBlock("blockJar", 0) + })); + ForbiddenResearch.recipes.put( + "MobCrystal", + ThaumcraftApi.addCrucibleRecipe( + "WRATHCAGE", + new ItemStack(ForbiddenItems.mobCrystal, 1, 0), + new ItemStack(Items.diamond, 1), + (new AspectList()).merge(Aspect.MIND, 10).merge(Aspect.ENERGY, 10))); } - ForbiddenResearch.recipes.put("Fork", ThaumcraftApi.addInfusionCraftingRecipe("FORK", new ItemStack(ForbiddenItems.fork, 1, 0), 1, (new AspectList()).add(DarkAspects.NETHER, 8).add(Aspect.MECHANISM, 8).add(Aspect.ENERGY, 8), ItemApi.getItem("itemSwordThaumium", 0), new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Items.quartz), new ItemStack(Items.quartz), new ItemStack(Items.redstone) })); + ForbiddenResearch.recipes.put( + "Fork", + ThaumcraftApi.addInfusionCraftingRecipe( + "FORK", + new ItemStack(ForbiddenItems.fork, 1, 0), + 1, + (new AspectList()) + .add(DarkAspects.NETHER, 8) + .add(Aspect.MECHANISM, 8) + .add(Aspect.ENERGY, 8), + ItemApi.getItem("itemSwordThaumium", 0), + new ItemStack[] { + new ItemStack(Items.quartz), + new ItemStack(Items.quartz), + new ItemStack(Items.quartz), + new ItemStack(Items.redstone) + })); if (Config.emeraldTrans) - ForbiddenResearch.recipes.put("TransEmerald", ThaumcraftApi.addCrucibleRecipe("TRANSEMERALD", new ItemStack(ForbiddenItems.resource, 4, 0), "nuggetEmerald", (new AspectList()).merge(Aspect.CRYSTAL, 2).merge(Aspect.GREED, 2))); - ForbiddenResearch.recipes.put("BlackFlower", ThaumcraftApi.addCrucibleRecipe("BLACKFLOWER", new ItemStack(ForbiddenBlocks.roseBush, 1, 0), new ItemStack(Blocks.double_plant, 1, 4), (new AspectList()).merge(Aspect.DARKNESS, 8).merge(Aspect.LIFE, 5))); - ForbiddenResearch.recipes.put("BlackInk", CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 2, 1), new Object[]{"#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.blackFlower, 1, 0)})); + ForbiddenResearch.recipes.put( + "TransEmerald", + ThaumcraftApi.addCrucibleRecipe( + "TRANSEMERALD", + new ItemStack(ForbiddenItems.resource, 4, 0), + "nuggetEmerald", + (new AspectList()).merge(Aspect.CRYSTAL, 2).merge(Aspect.GREED, 2))); + ForbiddenResearch.recipes.put( + "BlackFlower", + ThaumcraftApi.addCrucibleRecipe( + "BLACKFLOWER", + new ItemStack(ForbiddenBlocks.roseBush, 1, 0), + new ItemStack(Blocks.double_plant, 1, 4), + (new AspectList()).merge(Aspect.DARKNESS, 8).merge(Aspect.LIFE, 5))); + ForbiddenResearch.recipes.put( + "BlackInk", + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 2, 1), new Object[] { + "#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.blackFlower, 1, 0) + })); - if(thaumcraft.common.config.Config.researchDifficulty == -1) - ForbiddenResearch.recipes.put("Crystalwell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRYSTALWELL", new ItemStack(ForbiddenItems.crystalwell, 1, 0), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), new Object[] { new ItemStack(ConfigItems.itemInkwell, 1, 32767), "dyeBlack", new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6) })); + if (thaumcraft.common.config.Config.researchDifficulty == -1) + ForbiddenResearch.recipes.put( + "Crystalwell", + ThaumcraftApi.addShapelessArcaneCraftingRecipe( + "CRYSTALWELL", + new ItemStack(ForbiddenItems.crystalwell, 1, 0), + (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), + new Object[] { + new ItemStack(ConfigItems.itemInkwell, 1, 32767), + "dyeBlack", + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 6) + })); else - ForbiddenResearch.recipes.put("Crystalwell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRYSTALWELL", new ItemStack(ForbiddenItems.crystalwell, 1, 0), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), new Object[] { new ItemStack(ConfigItems.itemInkwell, 1, 32767), "dyeBlack", new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6) })); + ForbiddenResearch.recipes.put( + "Crystalwell", + ThaumcraftApi.addShapelessArcaneCraftingRecipe( + "CRYSTALWELL", + new ItemStack(ForbiddenItems.crystalwell, 1, 0), + (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), + new Object[] { + new ItemStack(ConfigItems.itemInkwell, 1, 32767), + "dyeBlack", + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 6) + })); - ForbiddenResearch.recipes.put("Primewell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("PRIMEWELL", new ItemStack(ForbiddenItems.primewell, 1, 0), (new AspectList()).add(Aspect.WATER, 50).add(Aspect.EARTH, 50).add(Aspect.FIRE, 50).add(Aspect.AIR, 50).add(Aspect.ORDER, 50).add(Aspect.ENTROPY, 50), new Object[] { new ItemStack(Items.feather, 1, 0), new ItemStack(ConfigItems.itemEldritchObject, 1, 3), new ItemStack(Items.glass_bottle, 1, 0) })); + ForbiddenResearch.recipes.put( + "Primewell", + ThaumcraftApi.addShapelessArcaneCraftingRecipe( + "PRIMEWELL", + new ItemStack(ForbiddenItems.primewell, 1, 0), + (new AspectList()) + .add(Aspect.WATER, 50) + .add(Aspect.EARTH, 50) + .add(Aspect.FIRE, 50) + .add(Aspect.AIR, 50) + .add(Aspect.ORDER, 50) + .add(Aspect.ENTROPY, 50), + new Object[] { + new ItemStack(Items.feather, 1, 0), + new ItemStack(ConfigItems.itemEldritchObject, 1, 3), + new ItemStack(Items.glass_bottle, 1, 0) + })); - if(Config.enchanting) { + if (Config.enchanting) { if (Config.greedyEnch) - ForbiddenResearch.recipes.put("Greedy", ThaumcraftApi.addInfusionEnchantmentRecipe("GREEDY", DarkEnchantments.greedy, 4, (new AspectList()).add(DarkAspects.NETHER, 16).add(Aspect.WEAPON, 8).add(Aspect.GREED, 16), new ItemStack[]{new ItemStack(Items.golden_sword), new ItemStack(Items.diamond), new ItemStack(ForbiddenItems.deadlyShards, 1, 6), new ItemStack(ForbiddenItems.deadlyShards, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 14)})); - ForbiddenResearch.recipes.put("Consuming", ThaumcraftApi.addInfusionEnchantmentRecipe("CONSUMING", DarkEnchantments.consuming, 3, (new AspectList()).add(Aspect.VOID, 8).add(Aspect.TOOL, 8).add(Aspect.HUNGER, 8), new ItemStack[]{new ItemStack(Items.iron_pickaxe), new ItemStack(Items.lava_bucket), ItemApi.getItem("itemResource", 14)})); - ForbiddenResearch.recipes.put("Wrath", ThaumcraftApi.addInfusionEnchantmentRecipe("WRATH", DarkEnchantments.wrath, 8, (new AspectList()).add(DarkAspects.WRATH, 16).add(Aspect.WEAPON, 16).add(DarkAspects.NETHER, 8), new ItemStack[]{ItemApi.getItem("itemResource", 14), new ItemStack(Items.diamond_sword, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.deadlyShards, 1, 0)})); - ForbiddenResearch.recipes.put("Educational", ThaumcraftApi.addInfusionEnchantmentRecipe("EDUCATIONAL", DarkEnchantments.educational, 3, (new AspectList()).add(Aspect.MAGIC, 4).add(Aspect.WEAPON, 4).add(Aspect.MIND, 8), new ItemStack[]{ItemApi.getItem("itemZombieBrain", 0), new ItemStack(Items.book), ItemApi.getItem("itemResource", 14)})); - ForbiddenResearch.recipes.put("Corrupting", ThaumcraftApi.addInfusionEnchantmentRecipe("CORRUPTING", DarkEnchantments.corrupting, 4, (new AspectList()).add(DarkAspects.NETHER, 16).add(Aspect.EXCHANGE, 16).add(Aspect.CRYSTAL, 8), new ItemStack[]{new ItemStack(Items.nether_wart), new ItemStack(Blocks.soul_sand), ItemApi.getItem("itemResource", 14)})); + ForbiddenResearch.recipes.put( + "Greedy", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "GREEDY", + DarkEnchantments.greedy, + 4, + (new AspectList()) + .add(DarkAspects.NETHER, 16) + .add(Aspect.WEAPON, 8) + .add(Aspect.GREED, 16), + new ItemStack[] { + new ItemStack(Items.golden_sword), + new ItemStack(Items.diamond), + new ItemStack(ForbiddenItems.deadlyShards, 1, 6), + new ItemStack(ForbiddenItems.deadlyShards, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 14) + })); + ForbiddenResearch.recipes.put( + "Consuming", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "CONSUMING", + DarkEnchantments.consuming, + 3, + (new AspectList()) + .add(Aspect.VOID, 8) + .add(Aspect.TOOL, 8) + .add(Aspect.HUNGER, 8), + new ItemStack[] { + new ItemStack(Items.iron_pickaxe), + new ItemStack(Items.lava_bucket), + ItemApi.getItem("itemResource", 14) + })); + ForbiddenResearch.recipes.put( + "Wrath", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "WRATH", + DarkEnchantments.wrath, + 8, + (new AspectList()) + .add(DarkAspects.WRATH, 16) + .add(Aspect.WEAPON, 16) + .add(DarkAspects.NETHER, 8), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(Items.diamond_sword, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0) + })); + ForbiddenResearch.recipes.put( + "Educational", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "EDUCATIONAL", + DarkEnchantments.educational, + 3, + (new AspectList()) + .add(Aspect.MAGIC, 4) + .add(Aspect.WEAPON, 4) + .add(Aspect.MIND, 8), + new ItemStack[] { + ItemApi.getItem("itemZombieBrain", 0), + new ItemStack(Items.book), + ItemApi.getItem("itemResource", 14) + })); + ForbiddenResearch.recipes.put( + "Corrupting", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "CORRUPTING", + DarkEnchantments.corrupting, + 4, + (new AspectList()) + .add(DarkAspects.NETHER, 16) + .add(Aspect.EXCHANGE, 16) + .add(Aspect.CRYSTAL, 8), + new ItemStack[] { + new ItemStack(Items.nether_wart), + new ItemStack(Blocks.soul_sand), + ItemApi.getItem("itemResource", 14) + })); - ForbiddenResearch.recipes.put("Cluster", ThaumcraftApi.addInfusionEnchantmentRecipe("CLUSTER", DarkEnchantments.cluster, 3, (new AspectList()).add(Aspect.FIRE, 4).add(Aspect.METAL, 4).add(Aspect.GREED, 4), new ItemStack[]{ItemApi.getItem("itemPickElemental", 0), ItemApi.getItem("itemResource", 14)})); - ForbiddenResearch.recipes.put("Impact", ThaumcraftApi.addInfusionEnchantmentRecipe("IMPACT", DarkEnchantments.impact, 4, (new AspectList()).add(Aspect.ENTROPY, 16).add(Aspect.MINE, 16), new ItemStack[]{ItemApi.getItem("itemResource", 14), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ConfigItems.itemShovelElemental, 1, 0)})); - ForbiddenResearch.recipes.put("Voidtouched", ThaumcraftApi.addInfusionEnchantmentRecipe("VOIDTOUCHED", DarkEnchantments.voidtouched, 8, (new AspectList()).add(Aspect.VOID, 16).add(Aspect.DARKNESS, 16).add(DarkAspects.ENVY, 24).add(Aspect.ELDRITCH, 16), new ItemStack[]{ItemApi.getItem("itemResource", 14), ItemApi.getItem("itemResource", 16), ItemApi.getItem("itemResource", 16), ItemApi.getItem("itemResource", 16), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1), new ItemStack(ForbiddenItems.deadlyShards, 1, 1)})); + ForbiddenResearch.recipes.put( + "Cluster", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "CLUSTER", + DarkEnchantments.cluster, + 3, + (new AspectList()) + .add(Aspect.FIRE, 4) + .add(Aspect.METAL, 4) + .add(Aspect.GREED, 4), + new ItemStack[] { + ItemApi.getItem("itemPickElemental", 0), ItemApi.getItem("itemResource", 14) + })); + ForbiddenResearch.recipes.put( + "Impact", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "IMPACT", + DarkEnchantments.impact, + 4, + (new AspectList()).add(Aspect.ENTROPY, 16).add(Aspect.MINE, 16), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ConfigItems.itemShovelElemental, 1, 0) + })); + ForbiddenResearch.recipes.put( + "Voidtouched", + ThaumcraftApi.addInfusionEnchantmentRecipe( + "VOIDTOUCHED", + DarkEnchantments.voidtouched, + 8, + (new AspectList()) + .add(Aspect.VOID, 16) + .add(Aspect.DARKNESS, 16) + .add(DarkAspects.ENVY, 24) + .add(Aspect.ELDRITCH, 16), + new ItemStack[] { + ItemApi.getItem("itemResource", 14), + ItemApi.getItem("itemResource", 16), + ItemApi.getItem("itemResource", 16), + ItemApi.getItem("itemResource", 16), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1), + new ItemStack(ForbiddenItems.deadlyShards, 1, 1) + })); } - CraftingManager.getInstance().addRecipe(new ItemStack(Items.emerald, 1, 0), new Object[] { "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 0) }); - CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Items.emerald, 1, 0) }); - CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.starBlock, 1, 0), new Object[] { "###", "###", "###", Character.valueOf('#'), new ItemStack(Items.nether_star, 1, 0) }); - CraftingManager.getInstance().addRecipe(new ItemStack(Items.nether_star, 9, 0), new Object[]{"#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.starBlock, 1, 0)}); - ForbiddenResearch.recipes.put("RidingCrop", CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.ridingCrop, 1, 0), new Object[]{"X", "#", "#", Character.valueOf('#'), Items.stick, Character.valueOf('X'), Items.leather})); + CraftingManager.getInstance().addRecipe(new ItemStack(Items.emerald, 1, 0), new Object[] { + "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 0) + }); + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 0), new Object[] { + "#", Character.valueOf('#'), new ItemStack(Items.emerald, 1, 0) + }); + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenBlocks.starBlock, 1, 0), new Object[] { + "###", "###", "###", Character.valueOf('#'), new ItemStack(Items.nether_star, 1, 0) + }); + CraftingManager.getInstance().addRecipe(new ItemStack(Items.nether_star, 9, 0), new Object[] { + "#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.starBlock, 1, 0) + }); + ForbiddenResearch.recipes.put( + "RidingCrop", + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.ridingCrop, 1, 0), new Object[] { + "X", "#", "#", Character.valueOf('#'), Items.stick, Character.valueOf('X'), Items.leather + })); ThaumcraftApi.addSmeltingBonus(new ItemStack(Items.emerald), new ItemStack(ForbiddenItems.resource, 0, 0)); GameRegistry.registerFuelHandler(new IFuelHandler() { Random randy = new Random(); + @Override public int getBurnTime(ItemStack fuel) { - if(fuel.getItem() == ForbiddenItems.taintCoal) { + if (fuel.getItem() == ForbiddenItems.taintCoal) { return 1 + randy.nextInt(2400); } return 0; } }); - OreDictionary.registerOre("logWood", new ItemStack(ConfigBlocks.blockMagicalLog, 1, OreDictionary.WILDCARD_VALUE)); - + OreDictionary.registerOre( + "logWood", new ItemStack(ConfigBlocks.blockMagicalLog, 1, OreDictionary.WILDCARD_VALUE)); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/ForbiddenResearch.java b/src/main/java/fox/spiteful/forbidden/ForbiddenResearch.java index 1563753..85d287e 100644 --- a/src/main/java/fox/spiteful/forbidden/ForbiddenResearch.java +++ b/src/main/java/fox/spiteful/forbidden/ForbiddenResearch.java @@ -1,9 +1,9 @@ package fox.spiteful.forbidden; -import java.util.HashMap; - import fox.spiteful.forbidden.blocks.ForbiddenBlocks; import fox.spiteful.forbidden.compat.Compat; +import fox.spiteful.forbidden.items.ForbiddenItems; +import java.util.HashMap; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -18,95 +18,678 @@ import thaumcraft.api.crafting.InfusionRecipe; import thaumcraft.api.research.ResearchCategories; import thaumcraft.api.research.ResearchPage; -import fox.spiteful.forbidden.items.ForbiddenItems; - public class ForbiddenResearch { public static HashMap recipes = new HashMap(); public static void addResearch() { - ResearchCategories.registerCategory("FORBIDDEN", new ResourceLocation("forbidden", "textures/misc/forbidden.png"), new ResourceLocation("forbidden", "textures/misc/runecircle.png")); + ResearchCategories.registerCategory( + "FORBIDDEN", + new ResourceLocation("forbidden", "textures/misc/forbidden.png"), + new ResourceLocation("forbidden", "textures/misc/runecircle.png")); addInfernalism(); addTaint(); - if(thaumcraft.common.config.Config.researchDifficulty != -1) - (new DarkResearchItem("CRYSTALWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.CRYSTAL, 2).add(Aspect.MAGIC, 1), -2, -8, 1, new ItemStack(ForbiddenItems.crystalwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CRYSTALWELL.1"), new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) }).setParents(new String[] { "RESEARCH" }).registerResearchItem(); + if (thaumcraft.common.config.Config.researchDifficulty != -1) + (new DarkResearchItem( + "CRYSTALWELL", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MIND, 3) + .add(Aspect.CRYSTAL, 2) + .add(Aspect.MAGIC, 1), + -2, + -8, + 1, + new ItemStack(ForbiddenItems.crystalwell, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CRYSTALWELL.1"), + new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) + }) + .setParents(new String[] {"RESEARCH"}) + .registerResearchItem(); else - (new DarkResearchItem("CRYSTALWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.CRYSTAL, 2).add(Aspect.MAGIC, 1), -2, -8, 1, new ItemStack(ForbiddenItems.crystalwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CRYSTALWELL.1b"), new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) }).setParents(new String[] { "RESEARCH" }).registerResearchItem(); + (new DarkResearchItem( + "CRYSTALWELL", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MIND, 3) + .add(Aspect.CRYSTAL, 2) + .add(Aspect.MAGIC, 1), + -2, + -8, + 1, + new ItemStack(ForbiddenItems.crystalwell, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CRYSTALWELL.1b"), + new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) + }) + .setParents(new String[] {"RESEARCH"}) + .registerResearchItem(); - (new DarkResearchItem("PRIMEWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.ELDRITCH, 6).add(Aspect.CRAFT, 1), 2, -8, 1, new ItemStack(ForbiddenItems.primewell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.PRIMEWELL.1"), new ResearchPage((IArcaneRecipe) recipes.get("Primewell")) }).setParents(new String[] { "PRIMPEARL" }).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "PRIMEWELL", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MIND, 3) + .add(Aspect.ELDRITCH, 6) + .add(Aspect.CRAFT, 1), + 2, + -8, + 1, + new ItemStack(ForbiddenItems.primewell, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.PRIMEWELL.1"), + new ResearchPage((IArcaneRecipe) recipes.get("Primewell")) + }) + .setParents(new String[] {"PRIMPEARL"}) + .setConcealed() + .registerResearchItem(); if (Config.emeraldTrans) - (new DarkResearchItem("TRANSEMERALD", "FORBIDDEN", (new AspectList()).add(Aspect.CRYSTAL, 2).add(Aspect.EXCHANGE, 5).add(Aspect.GREED, 4), 0, -6, 3, new ItemStack(ForbiddenItems.resource, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TRANSEMERALD.1"), new ResearchPage((CrucibleRecipe) recipes.get("TransEmerald")) }).setSecondary().setConcealed().setParents(new String[] { "TRANSGOLD" }).registerResearchItem(); - (new DarkResearchItem("BLACKFLOWER", "FORBIDDEN", (new AspectList()).add(Aspect.PLANT, 3).add(Aspect.SENSES, 2).add(Aspect.DARKNESS, 4), -2, -6, 1, new ItemStack(ForbiddenBlocks.blackFlower, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BLACKFLOWER.1"), new ResearchPage((CrucibleRecipe) recipes.get("BlackFlower")), new ResearchPage((IRecipe) recipes.get("BlackInk")) }).setAspectTriggers(new Aspect[] { Aspect.SENSES }).registerResearchItem(); - (new DarkResearchItem("RIDINGCROP", "FORBIDDEN", new AspectList(), 0, -8, 0, new ItemStack(ForbiddenItems.ridingCrop))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.RIDINGCROP.1"), new ResearchPage((IRecipe) recipes.get("RidingCrop")) }).setStub().setRound().setAutoUnlock().registerResearchItem(); + (new DarkResearchItem( + "TRANSEMERALD", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.CRYSTAL, 2) + .add(Aspect.EXCHANGE, 5) + .add(Aspect.GREED, 4), + 0, + -6, + 3, + new ItemStack(ForbiddenItems.resource, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TRANSEMERALD.1"), + new ResearchPage((CrucibleRecipe) recipes.get("TransEmerald")) + }) + .setSecondary() + .setConcealed() + .setParents(new String[] {"TRANSGOLD"}) + .registerResearchItem(); + (new DarkResearchItem( + "BLACKFLOWER", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.PLANT, 3) + .add(Aspect.SENSES, 2) + .add(Aspect.DARKNESS, 4), + -2, + -6, + 1, + new ItemStack(ForbiddenBlocks.blackFlower, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.BLACKFLOWER.1"), + new ResearchPage((CrucibleRecipe) recipes.get("BlackFlower")), + new ResearchPage((IRecipe) recipes.get("BlackInk")) + }) + .setAspectTriggers(new Aspect[] {Aspect.SENSES}) + .registerResearchItem(); + (new DarkResearchItem( + "RIDINGCROP", + "FORBIDDEN", + new AspectList(), + 0, + -8, + 0, + new ItemStack(ForbiddenItems.ridingCrop))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.RIDINGCROP.1"), + new ResearchPage((IRecipe) recipes.get("RidingCrop")) + }) + .setStub() + .setRound() + .setAutoUnlock() + .registerResearchItem(); - - if(Config.enchanting) { - (new DarkResearchItem("CONSUMING", "FORBIDDEN", (new AspectList()).add(Aspect.VOID, 4).add(Aspect.ENTROPY, 3).add(Aspect.MAGIC, 2), -4, -8, 1, new ResourceLocation("forbidden", "textures/misc/consuming.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CONSUMING.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Consuming"))}).setParents(new String[]{"INFUSIONENCHANTMENT"}).setSecondary().setConcealed().registerResearchItem(); - (new DarkResearchItem("EDUCATIONAL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 5).add(Aspect.WEAPON, 1).add(Aspect.MAGIC, 3), -4, -7, 2, new ResourceLocation("forbidden", "textures/misc/educational.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.EDUCATIONAL.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Educational"))}).setParents(new String[]{"INFUSIONENCHANTMENT"}).setSecondary().setConcealed().registerResearchItem(); + if (Config.enchanting) { + (new DarkResearchItem( + "CONSUMING", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.VOID, 4) + .add(Aspect.ENTROPY, 3) + .add(Aspect.MAGIC, 2), + -4, + -8, + 1, + new ResourceLocation("forbidden", "textures/misc/consuming.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CONSUMING.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Consuming")) + }) + .setParents(new String[] {"INFUSIONENCHANTMENT"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "EDUCATIONAL", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MIND, 5) + .add(Aspect.WEAPON, 1) + .add(Aspect.MAGIC, 3), + -4, + -7, + 2, + new ResourceLocation("forbidden", "textures/misc/educational.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.EDUCATIONAL.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Educational")) + }) + .setParents(new String[] {"INFUSIONENCHANTMENT"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); } - if(Compat.botan || Compat.bm || Compat.am2) - (new DarkResearchItem("SCHOOLS", "FORBIDDEN", new AspectList(), -1, 1, 0, new ItemStack(Blocks.enchanting_table))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.SCHOOLS.1") }).setRound().setStub().setAutoUnlock().registerResearchItem(); - + if (Compat.botan || Compat.bm || Compat.am2) + (new DarkResearchItem( + "SCHOOLS", "FORBIDDEN", new AspectList(), -1, 1, 0, new ItemStack(Blocks.enchanting_table))) + .setPages(new ResearchPage[] {new ResearchPage("forbidden.research_page.SCHOOLS.1")}) + .setRound() + .setStub() + .setAutoUnlock() + .registerResearchItem(); } public static void addInfernalism() { if (!Config.noLust) - (new DarkResearchItem("NETHERSHARDS", "FORBIDDEN", new AspectList(), -8, -5, 0, new ItemStack(ForbiddenItems.deadlyShards, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.NETHERSHARDS.1"), new ResearchPage("forbidden.research_page.NETHERSHARDS.2"), new ResearchPage("forbidden.research_page.NETHERSHARDS.3") }).setStub().setRound().setAutoUnlock().registerResearchItem(); + (new DarkResearchItem( + "NETHERSHARDS", + "FORBIDDEN", + new AspectList(), + -8, + -5, + 0, + new ItemStack(ForbiddenItems.deadlyShards, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.NETHERSHARDS.1"), + new ResearchPage("forbidden.research_page.NETHERSHARDS.2"), + new ResearchPage("forbidden.research_page.NETHERSHARDS.3") + }) + .setStub() + .setRound() + .setAutoUnlock() + .registerResearchItem(); else - (new DarkResearchItem("NETHERSHARDS", "FORBIDDEN", new AspectList(), -8, -5, 0, new ItemStack(ForbiddenItems.deadlyShards, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.NETHERSHARDS.1"), new ResearchPage("forbidden.research_page.NETHERSHARDS.2b"), new ResearchPage("forbidden.research_page.NETHERSHARDS.3") }).setStub().setRound().setAutoUnlock().registerResearchItem(); + (new DarkResearchItem( + "NETHERSHARDS", + "FORBIDDEN", + new AspectList(), + -8, + -5, + 0, + new ItemStack(ForbiddenItems.deadlyShards, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.NETHERSHARDS.1"), + new ResearchPage("forbidden.research_page.NETHERSHARDS.2b"), + new ResearchPage("forbidden.research_page.NETHERSHARDS.3") + }) + .setStub() + .setRound() + .setAutoUnlock() + .registerResearchItem(); - (new DarkResearchItem("HELLFIRE", "FORBIDDEN", (new AspectList()).add(Aspect.FIRE, 3).add(DarkAspects.NETHER, 4).add(Aspect.TRAVEL, 2), -8, -8, 1, new ItemStack(Blocks.fire))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.HELLFIRE.1") }).setRound().registerResearchItem().setHidden().setAspectTriggers(new Aspect[]{DarkAspects.NETHER}).setParents(new String[] { "NETHERSHARDS" }); - (new DarkResearchItem("ROD_profane", "FORBIDDEN", (new AspectList()), -9, -8, 0, new ItemStack(ForbiddenItems.wandCore, 1, 5))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.ROD_profane.1") }).setRound().registerResearchItem().setHidden().setParents(new String[] { "NETHERSHARDS" }).setStub(); - if(!Config.noLust) - (new DarkResearchItem("SUBCOLLAR", "FORBIDDEN", (new AspectList().add(Aspect.AURA, 3).add(DarkAspects.LUST, 8).add(Aspect.MAGIC, 3).add(Aspect.TRAP, 6).add(Aspect.FLESH, 4)), -11, -5, 2, new ItemStack(ForbiddenItems.subCollar))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.SUBCOLLAR.1"), new ResearchPage((InfusionRecipe) recipes.get("SubCollar")) }).setParents(new String[] { "NETHERSHARDS", "VISAMULET", "INFUSION" }).setHidden().setAspectTriggers(new Aspect[]{DarkAspects.LUST}).registerResearchItem(); + (new DarkResearchItem( + "HELLFIRE", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.FIRE, 3) + .add(DarkAspects.NETHER, 4) + .add(Aspect.TRAVEL, 2), + -8, + -8, + 1, + new ItemStack(Blocks.fire))) + .setPages(new ResearchPage[] {new ResearchPage("forbidden.research_page.HELLFIRE.1")}) + .setRound() + .registerResearchItem() + .setHidden() + .setAspectTriggers(new Aspect[] {DarkAspects.NETHER}) + .setParents(new String[] {"NETHERSHARDS"}); + (new DarkResearchItem( + "ROD_profane", + "FORBIDDEN", + (new AspectList()), + -9, + -8, + 0, + new ItemStack(ForbiddenItems.wandCore, 1, 5))) + .setPages(new ResearchPage[] {new ResearchPage("forbidden.research_page.ROD_profane.1")}) + .setRound() + .registerResearchItem() + .setHidden() + .setParents(new String[] {"NETHERSHARDS"}) + .setStub(); + if (!Config.noLust) + (new DarkResearchItem( + "SUBCOLLAR", + "FORBIDDEN", + (new AspectList() + .add(Aspect.AURA, 3) + .add(DarkAspects.LUST, 8) + .add(Aspect.MAGIC, 3) + .add(Aspect.TRAP, 6) + .add(Aspect.FLESH, 4)), + -11, + -5, + 2, + new ItemStack(ForbiddenItems.subCollar))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.SUBCOLLAR.1"), + new ResearchPage((InfusionRecipe) recipes.get("SubCollar")) + }) + .setParents(new String[] {"NETHERSHARDS", "VISAMULET", "INFUSION"}) + .setHidden() + .setAspectTriggers(new Aspect[] {DarkAspects.LUST}) + .registerResearchItem(); - (new DarkResearchItem("SKULLAXE", "FORBIDDEN", (new AspectList()).add(Aspect.WEAPON, 3).add(DarkAspects.WRATH, 4).add(DarkAspects.NETHER, 1), -11, -7, 2, new ItemStack(ForbiddenItems.skullAxe))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.SKULLAXE.1"), new ResearchPage((InfusionRecipe) recipes.get("SkullAxe")) }).setParents(new String[] { "NETHERSHARDS", "THAUMIUM", "INFUSION" }).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "SKULLAXE", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.WEAPON, 3) + .add(DarkAspects.WRATH, 4) + .add(DarkAspects.NETHER, 1), + -11, + -7, + 2, + new ItemStack(ForbiddenItems.skullAxe))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.SKULLAXE.1"), + new ResearchPage((InfusionRecipe) recipes.get("SkullAxe")) + }) + .setParents(new String[] {"NETHERSHARDS", "THAUMIUM", "INFUSION"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("SKULLAXE", 1); - if(Config.gluttony != 1) { - (new DarkResearchItem("RINGFOOD", "FORBIDDEN", (new AspectList()).add(DarkAspects.GLUTTONY, 4).add(Aspect.HUNGER, 3).add(Aspect.LIFE, 2), -11, -6, 2, new ItemStack(ForbiddenItems.ringFood))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.RINGFOOD.1"), new ResearchPage((IArcaneRecipe) recipes.get("RingFood"))}).setParents(new String[]{"NETHERSHARDS"}).registerResearchItem(); - (new DarkResearchItem("ARCANECAKE", "FORBIDDEN", (new AspectList()).add(DarkAspects.GLUTTONY, 6).add(Aspect.HUNGER, 3).add(Aspect.CRAFT, 2), -12, -6, 2, new ItemStack(ForbiddenItems.arcaneCakeItem))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ARCANECAKE.1"), new ResearchPage((InfusionRecipe) recipes.get("ArcaneCake"))}).setParents(new String[]{"NETHERSHARDS", "INFUSION"}).setAspectTriggers(new Aspect[]{DarkAspects.GLUTTONY}).setConcealed().registerResearchItem(); + if (Config.gluttony != 1) { + (new DarkResearchItem( + "RINGFOOD", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.GLUTTONY, 4) + .add(Aspect.HUNGER, 3) + .add(Aspect.LIFE, 2), + -11, + -6, + 2, + new ItemStack(ForbiddenItems.ringFood))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.RINGFOOD.1"), + new ResearchPage((IArcaneRecipe) recipes.get("RingFood")) + }) + .setParents(new String[] {"NETHERSHARDS"}) + .registerResearchItem(); + (new DarkResearchItem( + "ARCANECAKE", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.GLUTTONY, 6) + .add(Aspect.HUNGER, 3) + .add(Aspect.CRAFT, 2), + -12, + -6, + 2, + new ItemStack(ForbiddenItems.arcaneCakeItem))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ARCANECAKE.1"), + new ResearchPage((InfusionRecipe) recipes.get("ArcaneCake")) + }) + .setParents(new String[] {"NETHERSHARDS", "INFUSION"}) + .setAspectTriggers(new Aspect[] {DarkAspects.GLUTTONY}) + .setConcealed() + .registerResearchItem(); } - (new DarkResearchItem("FOCUSBLINK", "FORBIDDEN", (new AspectList()).add(Aspect.TRAVEL, 3).add(Aspect.ENTROPY, 3).add(DarkAspects.NETHER, 3).add(DarkAspects.SLOTH, 6), -11, -3, 2, new ItemStack(ForbiddenItems.blinkFocus))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.FOCUSBLINK.1"), new ResearchPage((InfusionRecipe) recipes.get("FocusBlink"))}).setConcealed().setParents(new String[]{"NETHERSHARDS", "INFUSION"}).registerResearchItem(); - (new DarkResearchItem("MORPHTOOLS", "FORBIDDEN", (new AspectList()).add(Aspect.TOOL, 2).add(DarkAspects.ENVY, 3).add(Aspect.EXCHANGE, 2), -9, -3, 4, new ItemStack(ForbiddenItems.morphPickaxe))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.MORPHTOOLS.1"), new ResearchPage((InfusionRecipe) recipes.get("MorphPick")), new ResearchPage((InfusionRecipe) recipes.get("MorphSword")), new ResearchPage((InfusionRecipe) recipes.get("MorphShovel")), new ResearchPage((InfusionRecipe) recipes.get("MorphAxe")) }).setParentsHidden(new String[] { "THAUMIUM", "INFUSIONENCHANTMENT" }).setParents(new String[] { "NETHERSHARDS" }).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "FOCUSBLINK", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.TRAVEL, 3) + .add(Aspect.ENTROPY, 3) + .add(DarkAspects.NETHER, 3) + .add(DarkAspects.SLOTH, 6), + -11, + -3, + 2, + new ItemStack(ForbiddenItems.blinkFocus))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.FOCUSBLINK.1"), + new ResearchPage((InfusionRecipe) recipes.get("FocusBlink")) + }) + .setConcealed() + .setParents(new String[] {"NETHERSHARDS", "INFUSION"}) + .registerResearchItem(); + (new DarkResearchItem( + "MORPHTOOLS", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.TOOL, 2) + .add(DarkAspects.ENVY, 3) + .add(Aspect.EXCHANGE, 2), + -9, + -3, + 4, + new ItemStack(ForbiddenItems.morphPickaxe))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.MORPHTOOLS.1"), + new ResearchPage((InfusionRecipe) recipes.get("MorphPick")), + new ResearchPage((InfusionRecipe) recipes.get("MorphSword")), + new ResearchPage((InfusionRecipe) recipes.get("MorphShovel")), + new ResearchPage((InfusionRecipe) recipes.get("MorphAxe")) + }) + .setParentsHidden(new String[] {"THAUMIUM", "INFUSIONENCHANTMENT"}) + .setParents(new String[] {"NETHERSHARDS"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("MORPHTOOLS", 4); - (new DarkResearchItem("ROD_infernal", "FORBIDDEN", (new AspectList()).add(DarkAspects.NETHER, 4).add(Aspect.FIRE, 3).add(Aspect.TOOL, 1), -11, -4, 3, new ItemStack(ForbiddenItems.wandCore, 1, 1))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.ROD_infernal.1"), new ResearchPage((InfusionRecipe) recipes.get("WandRodInfernal")), new ResearchPage("forbidden.research_page.ROD_infernal.2") }).setParents(new String[] { "ROD_silverwood", "INFUSION", "NETHERSHARDS" }).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "ROD_infernal", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.NETHER, 4) + .add(Aspect.FIRE, 3) + .add(Aspect.TOOL, 1), + -11, + -4, + 3, + new ItemStack(ForbiddenItems.wandCore, 1, 1))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_infernal.1"), + new ResearchPage((InfusionRecipe) recipes.get("WandRodInfernal")), + new ResearchPage("forbidden.research_page.ROD_infernal.2") + }) + .setParents(new String[] {"ROD_silverwood", "INFUSION", "NETHERSHARDS"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_infernal", 2); - if(Config.enchanting) { - (new DarkResearchItem("WRATH", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 16).add(Aspect.WEAPON, 20).add(Aspect.MAGIC, 10), -6, -3, 4, new ResourceLocation("forbidden", "textures/misc/wrath.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATH.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Wrath"))}).setParents(new String[]{"NETHERSHARDS", "INFUSIONENCHANTMENT"}).setConcealed().registerResearchItem(); + if (Config.enchanting) { + (new DarkResearchItem( + "WRATH", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.WRATH, 16) + .add(Aspect.WEAPON, 20) + .add(Aspect.MAGIC, 10), + -6, + -3, + 4, + new ResourceLocation("forbidden", "textures/misc/wrath.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.WRATH.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Wrath")) + }) + .setParents(new String[] {"NETHERSHARDS", "INFUSIONENCHANTMENT"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("WRATH", 3); if (Config.greedyEnch) - (new DarkResearchItem("GREEDY", "FORBIDDEN", (new AspectList()).add(Aspect.MAGIC, 2).add(Aspect.WEAPON, 1).add(Aspect.GREED, 3), -6, -5, 2, new ResourceLocation("forbidden", "textures/misc/greedy.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.GREEDY.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Greedy"))}).setParents(new String[]{"NETHERSHARDS", "INFUSIONENCHANTMENT"}).setConcealed().registerResearchItem(); - (new DarkResearchItem("CORRUPTING", "FORBIDDEN", (new AspectList()).add(DarkAspects.NETHER, 5).add(Aspect.CRYSTAL, 2).add(Aspect.EXCHANGE, 1), -6, -4, 1, new ResourceLocation("forbidden", "textures/misc/corrupting.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CORRUPTING.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Corrupting"))}).setParents(new String[]{"NETHERSHARDS", "INFUSIONENCHANTMENT"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "GREEDY", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MAGIC, 2) + .add(Aspect.WEAPON, 1) + .add(Aspect.GREED, 3), + -6, + -5, + 2, + new ResourceLocation("forbidden", "textures/misc/greedy.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.GREEDY.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Greedy")) + }) + .setParents(new String[] {"NETHERSHARDS", "INFUSIONENCHANTMENT"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "CORRUPTING", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.NETHER, 5) + .add(Aspect.CRYSTAL, 2) + .add(Aspect.EXCHANGE, 1), + -6, + -4, + 1, + new ResourceLocation("forbidden", "textures/misc/corrupting.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CORRUPTING.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Corrupting")) + }) + .setParents(new String[] {"NETHERSHARDS", "INFUSIONENCHANTMENT"}) + .setConcealed() + .registerResearchItem(); - (new DarkResearchItem("CLUSTER", "FORBIDDEN", (new AspectList()).add(Aspect.METAL, 1).add(Aspect.FIRE, 4).add(DarkAspects.ENVY, 3), -10, -1, 3, new ResourceLocation("forbidden", "textures/misc/lucrative.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CLUSTER.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Cluster"))}).setParents(new String[]{"MORPHTOOLS", "ELEMENTALPICK"}).setSecondary().setConcealed().registerResearchItem(); - (new DarkResearchItem("IMPACT", "FORBIDDEN", (new AspectList()).add(Aspect.ENTROPY, 8).add(Aspect.TOOL, 10).add(Aspect.MINE, 16).add(DarkAspects.ENVY, 10), -9, -1, 3, new ResourceLocation("forbidden", "textures/misc/impact.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.IMPACT.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Impact"))}).setParents(new String[]{"MORPHTOOLS", "ELEMENTALSHOVEL"}).setConcealed().registerResearchItem(); - (new DarkResearchItem("VOIDTOUCHED", "FORBIDDEN", (new AspectList()).add(Aspect.ELDRITCH, 16).add(Aspect.TOOL, 10).add(Aspect.CRAFT, 8).add(DarkAspects.ENVY, 32), -8, -1, 4, new ResourceLocation("forbidden", "textures/misc/voidtouched.png"))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.VOIDTOUCHED.1"), new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Voidtouched"))}).setParents(new String[]{"MORPHTOOLS", "VOIDMETAL"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "CLUSTER", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.METAL, 1) + .add(Aspect.FIRE, 4) + .add(DarkAspects.ENVY, 3), + -10, + -1, + 3, + new ResourceLocation("forbidden", "textures/misc/lucrative.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CLUSTER.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Cluster")) + }) + .setParents(new String[] {"MORPHTOOLS", "ELEMENTALPICK"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "IMPACT", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.ENTROPY, 8) + .add(Aspect.TOOL, 10) + .add(Aspect.MINE, 16) + .add(DarkAspects.ENVY, 10), + -9, + -1, + 3, + new ResourceLocation("forbidden", "textures/misc/impact.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.IMPACT.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Impact")) + }) + .setParents(new String[] {"MORPHTOOLS", "ELEMENTALSHOVEL"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "VOIDTOUCHED", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.ELDRITCH, 16) + .add(Aspect.TOOL, 10) + .add(Aspect.CRAFT, 8) + .add(DarkAspects.ENVY, 32), + -8, + -1, + 4, + new ResourceLocation("forbidden", "textures/misc/voidtouched.png"))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.VOIDTOUCHED.1"), + new ResearchPage((InfusionEnchantmentRecipe) recipes.get("Voidtouched")) + }) + .setParents(new String[] {"MORPHTOOLS", "VOIDMETAL"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("VOIDTOUCHED", 3); } if (Config.wrathCage) { - (new DarkResearchItem("FORK", "FORBIDDEN", (new AspectList()).add(DarkAspects.NETHER, 3).add(Aspect.MECHANISM, 1).add(Aspect.TOOL, 1), -6, -7, 0, new ItemStack(ForbiddenItems.fork))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.FORK.1"), new ResearchPage((InfusionRecipe) recipes.get("Fork")), new ResearchPage("WRATHCAGE", "forbidden.research_page.FORK.wc") }).setParents(new String[] {"INFUSION", "NETHERSHARDS", "THAUMIUM"}).setSecondary().setConcealed().registerResearchItem(); + (new DarkResearchItem( + "FORK", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.NETHER, 3) + .add(Aspect.MECHANISM, 1) + .add(Aspect.TOOL, 1), + -6, + -7, + 0, + new ItemStack(ForbiddenItems.fork))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.FORK.1"), + new ResearchPage((InfusionRecipe) recipes.get("Fork")), + new ResearchPage("WRATHCAGE", "forbidden.research_page.FORK.wc") + }) + .setParents(new String[] {"INFUSION", "NETHERSHARDS", "THAUMIUM"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); if (Config.wrathCost > 0) - (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -6, -9, 4, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe) recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.2"), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe) recipes.get("MobCrystal"))}).setParents(new String[]{"FORK"}).setParentsHidden(new String[]{"INFUSION", "THAUMIUM", "DISTILESSENTIA"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "WRATHCAGE", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.WRATH, 5) + .add(Aspect.MECHANISM, 3) + .add(Aspect.BEAST, 2), + -6, + -9, + 4, + new ItemStack(ForbiddenBlocks.wrathCage))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.WRATHCAGE.1"), + new ResearchPage((InfusionRecipe) recipes.get("WrathCage")), + new ResearchPage("forbidden.research_page.WRATHCAGE.2"), + new ResearchPage("forbidden.research_page.WRATHCAGE.3"), + new ResearchPage((CrucibleRecipe) recipes.get("MobCrystal")) + }) + .setParents(new String[] {"FORK"}) + .setParentsHidden(new String[] {"INFUSION", "THAUMIUM", "DISTILESSENTIA"}) + .setConcealed() + .registerResearchItem(); else - (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -6, -9, 4, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe) recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe) recipes.get("MobCrystal"))}).setParents(new String[]{"FORK"}).setParentsHidden(new String[]{"INFUSION", "THAUMIUM", "DISTILESSENTIA"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "WRATHCAGE", + "FORBIDDEN", + (new AspectList()) + .add(DarkAspects.WRATH, 5) + .add(Aspect.MECHANISM, 3) + .add(Aspect.BEAST, 2), + -6, + -9, + 4, + new ItemStack(ForbiddenBlocks.wrathCage))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.WRATHCAGE.1"), + new ResearchPage((InfusionRecipe) recipes.get("WrathCage")), + new ResearchPage("forbidden.research_page.WRATHCAGE.3"), + new ResearchPage((CrucibleRecipe) recipes.get("MobCrystal")) + }) + .setParents(new String[] {"FORK"}) + .setParentsHidden(new String[] {"INFUSION", "THAUMIUM", "DISTILESSENTIA"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("WRATHCAGE", 3); ThaumcraftApi.addWarpToItem(new ItemStack(ForbiddenBlocks.wrathCage, 1), 5); } - } public static void addTaint() { - (new DarkResearchItem("TAINTSHOVEL", "FORBIDDEN", (new AspectList()).add(Aspect.CRYSTAL, 3).add(Aspect.TAINT, 2).add(Aspect.TOOL, 1), -8, 1, 2, new ItemStack(ForbiddenItems.taintShovel))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TAINTSHOVEL.1"), new ResearchPage((InfusionRecipe) recipes.get("TaintShovel")), new ResearchPage("forbidden.research_page.TAINTSHOVEL.2") }).setParents(new String[] { "THAUMIUM", "INFUSION", "ETHEREALBLOOM" }).setConcealed().registerResearchItem(); - (new DarkResearchItem("TAINTPICK", "FORBIDDEN", (new AspectList()).add(Aspect.TOOL, 2).add(Aspect.TAINT, 4).add(Aspect.ENTROPY, 3), -10, 1, 2, new ItemStack(ForbiddenItems.taintPickaxe))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TAINTPICK.1"), new ResearchPage((InfusionRecipe) recipes.get("TaintPick")) }).setParents(new String[] { "THAUMIUM", "INFUSION" }).setConcealed().registerResearchItem(); - (new DarkResearchItem("ROD_tainted", "FORBIDDEN", (new AspectList()).add(Aspect.MAGIC, 4).add(Aspect.TAINT, 5).add(Aspect.TOOL, 2), -8, 3, 3, new ItemStack(ForbiddenItems.wandCore, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.ROD_tainted.1"), new ResearchPage((InfusionRecipe) recipes.get("WandRodTainted")) }).setParents(new String[] { "ROD_silverwood", "TAINTSHOVEL", "INFUSION" }).setConcealed().registerResearchItem(); - (new DarkResearchItem("TAINTTREE", "FORBIDDEN", (new AspectList()).add(Aspect.TREE, 4).add(Aspect.TAINT, 6).add(Aspect.POISON, 2).add(Aspect.PLANT, 3), -11, 3, 3, new ItemStack(ForbiddenBlocks.taintSapling))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TAINTTREE.1"), new ResearchPage((CrucibleRecipe) recipes.get("TaintTree")), new ResearchPage((IRecipe) recipes.get("TaintPlank")), new ResearchPage(new ItemStack(ForbiddenBlocks.taintLog, 1, 0)) }).setParents(new String[]{"THAUMIUM", "INFUSION", "ETHEREALBLOOM"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "TAINTSHOVEL", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.CRYSTAL, 3) + .add(Aspect.TAINT, 2) + .add(Aspect.TOOL, 1), + -8, + 1, + 2, + new ItemStack(ForbiddenItems.taintShovel))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TAINTSHOVEL.1"), + new ResearchPage((InfusionRecipe) recipes.get("TaintShovel")), + new ResearchPage("forbidden.research_page.TAINTSHOVEL.2") + }) + .setParents(new String[] {"THAUMIUM", "INFUSION", "ETHEREALBLOOM"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "TAINTPICK", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.TOOL, 2) + .add(Aspect.TAINT, 4) + .add(Aspect.ENTROPY, 3), + -10, + 1, + 2, + new ItemStack(ForbiddenItems.taintPickaxe))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TAINTPICK.1"), + new ResearchPage((InfusionRecipe) recipes.get("TaintPick")) + }) + .setParents(new String[] {"THAUMIUM", "INFUSION"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "ROD_tainted", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.MAGIC, 4) + .add(Aspect.TAINT, 5) + .add(Aspect.TOOL, 2), + -8, + 3, + 3, + new ItemStack(ForbiddenItems.wandCore, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_tainted.1"), + new ResearchPage((InfusionRecipe) recipes.get("WandRodTainted")) + }) + .setParents(new String[] {"ROD_silverwood", "TAINTSHOVEL", "INFUSION"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem( + "TAINTTREE", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.TREE, 4) + .add(Aspect.TAINT, 6) + .add(Aspect.POISON, 2) + .add(Aspect.PLANT, 3), + -11, + 3, + 3, + new ItemStack(ForbiddenBlocks.taintSapling))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TAINTTREE.1"), + new ResearchPage((CrucibleRecipe) recipes.get("TaintTree")), + new ResearchPage((IRecipe) recipes.get("TaintPlank")), + new ResearchPage(new ItemStack(ForbiddenBlocks.taintLog, 1, 0)) + }) + .setParents(new String[] {"THAUMIUM", "INFUSION", "ETHEREALBLOOM"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("TAINTTREE", 1); ThaumcraftApi.addWarpToItem(new ItemStack(ForbiddenBlocks.taintSapling, 1, 0), 1); - (new DarkResearchItem("TAINTSTONE", "FORBIDDEN", (new AspectList()).add(Aspect.EARTH, 4).add(Aspect.TAINT, 6).add(Aspect.ORDER, 2), -10, 3, 2, new ItemStack(ForbiddenBlocks.taintStone, 1, 1))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.TAINTSTONE.1"), new ResearchPage((IArcaneRecipe) recipes.get("TaintStone")), new ResearchPage((IRecipe) recipes.get("TaintBrick"))}).setParents(new String[]{"THAUMIUM", "INFUSION", "ETHEREALBLOOM"}).setConcealed().registerResearchItem(); + (new DarkResearchItem( + "TAINTSTONE", + "FORBIDDEN", + (new AspectList()) + .add(Aspect.EARTH, 4) + .add(Aspect.TAINT, 6) + .add(Aspect.ORDER, 2), + -10, + 3, + 2, + new ItemStack(ForbiddenBlocks.taintStone, 1, 1))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TAINTSTONE.1"), + new ResearchPage((IArcaneRecipe) recipes.get("TaintStone")), + new ResearchPage((IRecipe) recipes.get("TaintBrick")) + }) + .setParents(new String[] {"THAUMIUM", "INFUSION", "ETHEREALBLOOM"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_tainted", 2); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/VillagerHereticManager.java b/src/main/java/fox/spiteful/forbidden/VillagerHereticManager.java index 78a0580..d0b39cc 100644 --- a/src/main/java/fox/spiteful/forbidden/VillagerHereticManager.java +++ b/src/main/java/fox/spiteful/forbidden/VillagerHereticManager.java @@ -2,6 +2,7 @@ package fox.spiteful.forbidden; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; import fox.spiteful.forbidden.items.ForbiddenItems; +import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -14,12 +15,10 @@ import thaumcraft.api.wands.WandRod; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.Random; - public class VillagerHereticManager implements IVillageTradeHandler { public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - if(villager.getProfession() == Config.hereticID) { + if (villager.getProfession() == Config.hereticID) { /*recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 20 + random.nextInt(3), 18), new ItemStack(Items.emerald))); recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 9))); recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 4 + random.nextInt(3), 3), new ItemStack(Items.emerald))); @@ -36,26 +35,49 @@ public class VillagerHereticManager implements IVillageTradeHandler { recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemAmuletVis, 1, 0))); recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 3 + random.nextInt(6)))); */ - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(2)), new ItemStack(ForbiddenItems.deadlyShards, 3 + random.nextInt(2), 6))); - if(!Config.noLust) - recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 2 + random.nextInt(4), 4), new ItemStack(Items.emerald))); - recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald))); - recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.gluttonyShard, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(3)), new ItemStack(Items.skull, 1, 0))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(4)), new ItemStack(Items.ghast_tear, 1))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(Items.glowstone_dust, 8 + random.nextInt(9)))); + recipeList.add(new MerchantRecipe( + new ItemStack(Items.emerald, 1 + random.nextInt(2)), + new ItemStack(ForbiddenItems.deadlyShards, 3 + random.nextInt(2), 6))); + if (!Config.noLust) + recipeList.add(new MerchantRecipe( + new ItemStack(ForbiddenItems.deadlyShards, 2 + random.nextInt(4), 4), + new ItemStack(Items.emerald))); + recipeList.add(new MerchantRecipe( + new ItemStack(ForbiddenItems.deadlyShards, 4 + random.nextInt(6), 0), + new ItemStack(Items.emerald))); + recipeList.add(new MerchantRecipe( + new ItemStack(ForbiddenItems.gluttonyShard, 4 + random.nextInt(6), 0), + new ItemStack(Items.emerald))); + recipeList.add(new MerchantRecipe( + new ItemStack(Items.emerald, 1 + random.nextInt(3)), new ItemStack(Items.skull, 1, 0))); + recipeList.add(new MerchantRecipe( + new ItemStack(Items.emerald, 4 + random.nextInt(4)), new ItemStack(Items.ghast_tear, 1))); + recipeList.add(new MerchantRecipe( + new ItemStack(Items.emerald, 1), new ItemStack(Items.glowstone_dust, 8 + random.nextInt(9)))); ItemStack wand = new ItemStack(ConfigItems.itemWandCasting, 1, 36); ((ItemWandCasting) wand.getItem()).setCap(wand, (WandCap) WandCap.caps.get("iron")); ((ItemWandCasting) wand.getItem()).setRod(wand, (WandRod) WandRod.rods.get("profane")); - ((ItemWandCasting) wand.getItem()).storeAllVis(wand, new AspectList().add(Aspect.FIRE, 5000).add(Aspect.WATER, 5000).add(Aspect.EARTH, 5000).add(Aspect.AIR, 5000).add(Aspect.ORDER, 5000).add(Aspect.ENTROPY, 5000)); - MerchantRecipe profane = new MerchantRecipe(new ItemStack(Items.emerald, 8 + random.nextInt(5)), new ItemStack(Items.stick), wand); + ((ItemWandCasting) wand.getItem()) + .storeAllVis( + wand, + new AspectList() + .add(Aspect.FIRE, 5000) + .add(Aspect.WATER, 5000) + .add(Aspect.EARTH, 5000) + .add(Aspect.AIR, 5000) + .add(Aspect.ORDER, 5000) + .add(Aspect.ENTROPY, 5000)); + MerchantRecipe profane = new MerchantRecipe( + new ItemStack(Items.emerald, 8 + random.nextInt(5)), new ItemStack(Items.stick), wand); profane.func_82783_a(-6); recipeList.add(profane); - MerchantRecipe fire = new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(5)), new ItemStack(Items.diamond, 1), new ItemStack(ConfigItems.itemFocusFire, 1)); + MerchantRecipe fire = new MerchantRecipe( + new ItemStack(Items.emerald, 4 + random.nextInt(5)), + new ItemStack(Items.diamond, 1), + new ItemStack(ConfigItems.itemFocusFire, 1)); fire.func_82783_a(-6); recipeList.add(fire); } - } } diff --git a/src/main/java/fox/spiteful/forbidden/WandOverlord.java b/src/main/java/fox/spiteful/forbidden/WandOverlord.java index c3b03e6..6be052f 100644 --- a/src/main/java/fox/spiteful/forbidden/WandOverlord.java +++ b/src/main/java/fox/spiteful/forbidden/WandOverlord.java @@ -12,22 +12,32 @@ import thaumcraft.common.lib.research.ResearchManager; public class WandOverlord implements IWandTriggerManager { @Override - public boolean performTrigger(World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side, int event) { - if (event == 1 && side == 1) - return hellfire(world, wand, player, x, y, z, side); + public boolean performTrigger( + World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side, int event) { + if (event == 1 && side == 1) return hellfire(world, wand, player, x, y, z, side); return false; } public boolean hellfire(World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side) { - if (world.isRemote || wand == null || !(wand.getItem() instanceof ItemWandCasting) || ((ItemWandCasting) wand.getItem()).getFocusItem(wand) != null || !ResearchManager.isResearchComplete(player.getCommandSenderName(), "HELLFIRE") || !player.canPlayerEdit(x, y, z, side, new ItemStack(Items.fire_charge))) - return false; + if (world.isRemote + || wand == null + || !(wand.getItem() instanceof ItemWandCasting) + || ((ItemWandCasting) wand.getItem()).getFocusItem(wand) != null + || !ResearchManager.isResearchComplete(player.getCommandSenderName(), "HELLFIRE") + || !player.canPlayerEdit(x, y, z, side, new ItemStack(Items.fire_charge))) return false; - if (world.isAirBlock(x, y + 1, z) && ((ItemWandCasting) wand.getItem()).consumeVis(wand, player, Aspect.FIRE, 2, false)) { - world.playSoundEffect((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D, "fire.ignite", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); + if (world.isAirBlock(x, y + 1, z) + && ((ItemWandCasting) wand.getItem()).consumeVis(wand, player, Aspect.FIRE, 2, false)) { + world.playSoundEffect( + (double) x + 0.5D, + (double) y + 1.5D, + (double) z + 0.5D, + "fire.ignite", + 1.0F, + world.rand.nextFloat() * 0.4F + 0.8F); world.setBlock(x, y + 1, z, Blocks.fire); player.swingItem(); return true; - } else - return false; + } else return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/WorldGenTaintedTree.java b/src/main/java/fox/spiteful/forbidden/WorldGenTaintedTree.java index 14d46cc..1ca3a96 100644 --- a/src/main/java/fox/spiteful/forbidden/WorldGenTaintedTree.java +++ b/src/main/java/fox/spiteful/forbidden/WorldGenTaintedTree.java @@ -1,90 +1,73 @@ package fox.spiteful.forbidden; import fox.spiteful.forbidden.blocks.ForbiddenBlocks; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.init.Blocks; -import net.minecraft.util.Direction; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Random; - -public class WorldGenTaintedTree extends WorldGenAbstractTree -{ +public class WorldGenTaintedTree extends WorldGenAbstractTree { /** The minimum height of a generated tree. */ private final int minTreeHeight; - public WorldGenTaintedTree(boolean p_i2027_1_) - { + public WorldGenTaintedTree(boolean p_i2027_1_) { this(p_i2027_1_, 4); } - public WorldGenTaintedTree(boolean p_i2028_1_, int p_i2028_2_) - { + public WorldGenTaintedTree(boolean p_i2028_1_, int p_i2028_2_) { super(p_i2028_1_); this.minTreeHeight = p_i2028_2_; } - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { + public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { int l = p_76484_2_.nextInt(3) + this.minTreeHeight; boolean flag = true; - if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) - { + if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) { byte b0; int k1; Block block; - for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) - { + for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) { b0 = 1; - if (i1 == p_76484_4_) - { + if (i1 == p_76484_4_) { b0 = 0; } - if (i1 >= p_76484_4_ + 1 + l - 2) - { + if (i1 >= p_76484_4_ + 1 + l - 2) { b0 = 2; } - for (int j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) - { - for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) - { - if (i1 >= 0 && i1 < 256) - { + for (int j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) { + for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) { + if (i1 >= 0 && i1 < 256) { block = p_76484_1_.getBlock(j1, i1, k1); - if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) - { + if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) { flag = false; } - } - else - { + } else { flag = false; } } } } - if (!flag) - { + if (!flag) { return false; - } - else - { + } else { Block block2 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_); - boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling) Blocks.sapling); - if (isSoil && p_76484_4_ < 256 - l - 1) - { - block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); + boolean isSoil = block2.canSustainPlant( + p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling) + Blocks.sapling); + if (isSoil && p_76484_4_ < 256 - l - 1) { + block2.onPlantGrow( + p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); b0 = 3; byte b1 = 0; int l1; @@ -92,53 +75,45 @@ public class WorldGenTaintedTree extends WorldGenAbstractTree int j2; int i3; - for (k1 = p_76484_4_ - b0 + l; k1 <= p_76484_4_ + l; ++k1) - { + for (k1 = p_76484_4_ - b0 + l; k1 <= p_76484_4_ + l; ++k1) { i3 = k1 - (p_76484_4_ + l); l1 = b1 + 1 - i3 / 2; - for (i2 = p_76484_3_ - l1; i2 <= p_76484_3_ + l1; ++i2) - { + for (i2 = p_76484_3_ - l1; i2 <= p_76484_3_ + l1; ++i2) { j2 = i2 - p_76484_3_; - for (int k2 = p_76484_5_ - l1; k2 <= p_76484_5_ + l1; ++k2) - { + for (int k2 = p_76484_5_ - l1; k2 <= p_76484_5_ + l1; ++k2) { int l2 = k2 - p_76484_5_; - if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || p_76484_2_.nextInt(2) != 0 && i3 != 0) - { + if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || p_76484_2_.nextInt(2) != 0 && i3 != 0) { Block block1 = p_76484_1_.getBlock(i2, k1, k2); - if (block1.isAir(p_76484_1_, i2, k1, k2) || block1.isLeaves(p_76484_1_, i2, k1, k2)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, i2, k1, k2, ForbiddenBlocks.taintLeaves, 0); + if (block1.isAir(p_76484_1_, i2, k1, k2) + || block1.isLeaves(p_76484_1_, i2, k1, k2)) { + this.setBlockAndNotifyAdequately( + p_76484_1_, i2, k1, k2, ForbiddenBlocks.taintLeaves, 0); } } } } } - for (k1 = 0; k1 < l; ++k1) - { + for (k1 = 0; k1 < l; ++k1) { block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + k1, p_76484_5_); - if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_, ForbiddenBlocks.taintLog, 0); - + if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_) + || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_)) { + this.setBlockAndNotifyAdequately( + p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_, ForbiddenBlocks.taintLog, 0); } } return true; - } - else - { + } else { return false; } } - } - else - { + } else { return false; } } @@ -146,17 +121,17 @@ public class WorldGenTaintedTree extends WorldGenAbstractTree /** * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length */ - private void growVines(World p_76529_1_, int p_76529_2_, int p_76529_3_, int p_76529_4_, int p_76529_5_) - { + private void growVines(World p_76529_1_, int p_76529_2_, int p_76529_3_, int p_76529_4_, int p_76529_5_) { this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_); int i1 = 4; - while (true) - { + while (true) { --p_76529_3_; - if (!p_76529_1_.getBlock(p_76529_2_, p_76529_3_, p_76529_4_).isAir(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_) || i1 <= 0) - { + if (!p_76529_1_ + .getBlock(p_76529_2_, p_76529_3_, p_76529_4_) + .isAir(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_) + || i1 <= 0) { return; } @@ -164,4 +139,4 @@ public class WorldGenTaintedTree extends WorldGenAbstractTree --i1; } } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/XPReflectionHelper.java b/src/main/java/fox/spiteful/forbidden/XPReflectionHelper.java index cbf0a4d..e0f247c 100644 --- a/src/main/java/fox/spiteful/forbidden/XPReflectionHelper.java +++ b/src/main/java/fox/spiteful/forbidden/XPReflectionHelper.java @@ -1,8 +1,7 @@ package fox.spiteful.forbidden; -import java.lang.reflect.Field; - import cpw.mods.fml.relauncher.ReflectionHelper; +import java.lang.reflect.Field; import net.minecraft.entity.EntityLiving; import org.apache.logging.log4j.Level; @@ -11,10 +10,10 @@ public class XPReflectionHelper { static { try { - stupidMojangProtectedVariable = ReflectionHelper.findField(EntityLiving.class, "experienceValue", "field_70728_aV"); + stupidMojangProtectedVariable = + ReflectionHelper.findField(EntityLiving.class, "experienceValue", "field_70728_aV"); stupidMojangProtectedVariable.setAccessible(true); - } - catch(Exception e){ + } catch (Exception e) { LogHandler.log(Level.ERROR, e.toString()); e.printStackTrace(); } diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockArcaneCake.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockArcaneCake.java index 99d931e..00bc91f 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockArcaneCake.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockArcaneCake.java @@ -1,9 +1,10 @@ package fox.spiteful.forbidden.blocks; -import java.util.Random; - import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,8 +16,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import squeek.applecore.api.food.FoodValues; import squeek.applecore.api.food.IEdibleBlock; import squeek.applecore.api.food.ItemFoodProxy; @@ -24,10 +23,13 @@ import squeek.applecore.api.food.ItemFoodProxy; @Optional.Interface(iface = "squeek.applecore.api.food.IEdibleBlock", modid = "AppleCore") public class BlockArcaneCake extends Block implements IEdibleBlock { private boolean isEdibleAtMaxHunger = false; + @SideOnly(Side.CLIENT) private IIcon cakeTopIcon; + @SideOnly(Side.CLIENT) private IIcon cakeBottomIcon; + @SideOnly(Side.CLIENT) private IIcon cakeInsideIcon; @@ -59,8 +61,15 @@ public class BlockArcaneCake extends Block implements IEdibleBlock { float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; float f2 = 0.5F; - //return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + f1), (double) y, (double) ((float) z + f), (double) ((float) (x + 1) - f), (double) ((float) y + f2 - f), (double) ((float) (z + 1) - f)); - return AxisAlignedBB.getBoundingBox((double)((float)x + f1), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)y + f2 - f), (double)((float)(z + 1) - f)); + // return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + f1), (double) y, (double) ((float) z + f), + // (double) ((float) (x + 1) - f), (double) ((float) y + f2 - f), (double) ((float) (z + 1) - f)); + return AxisAlignedBB.getBoundingBox( + (double) ((float) x + f1), + (double) y, + (double) ((float) z + f), + (double) ((float) (x + 1) - f), + (double) ((float) y + f2 - f), + (double) ((float) (z + 1) - f)); } @Override @@ -75,14 +84,23 @@ public class BlockArcaneCake extends Block implements IEdibleBlock { float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; float f2 = 0.5F; - //return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + f1), (double) y, (double) ((float) z + f), (double) ((float) (x + 1) - f), (double) ((float) y + f2), (double) ((float) (z + 1) - f)); - return AxisAlignedBB.getBoundingBox((double)((float)x + f1), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)y + f2), (double)((float)(z + 1) - f)); + // return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + f1), (double) y, (double) ((float) z + f), + // (double) ((float) (x + 1) - f), (double) ((float) y + f2), (double) ((float) (z + 1) - f)); + return AxisAlignedBB.getBoundingBox( + (double) ((float) x + f1), + (double) y, + (double) ((float) z + f), + (double) ((float) (x + 1) - f), + (double) ((float) y + f2), + (double) ((float) (z + 1) - f)); } @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int par1, int x) { - return par1 == 1 ? this.cakeTopIcon : (par1 == 0 ? this.cakeBottomIcon : (x > 0 && par1 == 4 ? this.cakeInsideIcon : this.blockIcon)); + return par1 == 1 + ? this.cakeTopIcon + : (par1 == 0 ? this.cakeBottomIcon : (x > 0 && par1 == 4 ? this.cakeInsideIcon : this.blockIcon)); } @SideOnly(Side.CLIENT) @@ -100,7 +118,8 @@ public class BlockArcaneCake extends Block implements IEdibleBlock { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { this.eatCakeSlice(world, x, y, z, player); return true; } diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockBlackFlower.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockBlackFlower.java index 80f9eb6..f0fd9b7 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockBlackFlower.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockBlackFlower.java @@ -1,23 +1,20 @@ package fox.spiteful.forbidden.blocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Forbidden; import java.util.List; import java.util.Random; - -import fox.spiteful.forbidden.Forbidden; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class BlockBlackFlower extends BlockFlower { protected BlockBlackFlower() { super(1); diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockLeavesTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockLeavesTainted.java index 73e516b..a797491 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockLeavesTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockLeavesTainted.java @@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.items.ForbiddenItems; +import java.lang.reflect.Field; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,19 +19,16 @@ import net.minecraft.world.World; import thaumcraft.common.config.Config; import thaumcraft.common.config.ConfigBlocks; -import java.lang.reflect.Field; -import java.util.Random; - -public class BlockLeavesTainted extends BlockLeaves -{ +public class BlockLeavesTainted extends BlockLeaves { int[] decayThingy; + @SideOnly(Side.CLIENT) private IIcon opaqueIcon; + @SideOnly(Side.CLIENT) private IIcon transparentIcon; - public BlockLeavesTainted() - { + public BlockLeavesTainted() { super(); setCreativeTab(Forbidden.tab); setLightOpacity(0); @@ -38,60 +37,55 @@ public class BlockLeavesTainted extends BlockLeaves try { Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J"); mat.set(this, Config.taintMaterial); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } @Override - public Item getItemDropped(int i, Random random, int j) - { + public Item getItemDropped(int i, Random random, int j) { return Item.getItemFromBlock(ForbiddenBlocks.taintSapling); } /** - * Chance of sapling dropping + * Chance of sapling dropping */ @Override - protected int func_150123_b(int p_150123_1_) - { + protected int func_150123_b(int p_150123_1_) { return 60; } @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess iba, int x, int y, int z, int side) - { + public boolean shouldSideBeRendered(IBlockAccess iba, int x, int y, int z, int side) { return !Blocks.leaves.isOpaqueCube() || super.shouldSideBeRendered(iba, x, y, z, side); } + @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } + @Override - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return !Blocks.leaves.isOpaqueCube() ? transparentIcon : opaqueIcon; } + @Override - public String[] func_150125_e() - { + public String[] func_150125_e() { return new String[0]; } + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister register) - { + public void registerBlockIcons(IIconRegister register) { opaqueIcon = register.registerIcon("forbidden:taint_leaves_opaque"); transparentIcon = register.registerIcon("forbidden:taint_leaves"); } @Override - protected void func_150124_c(World world, int x, int y, int z, int meta, int wat) - { - if (world.rand.nextInt(20) == 0) - { + protected void func_150124_c(World world, int x, int y, int z, int meta, int wat) { + if (world.rand.nextInt(20) == 0) { this.dropBlockAsItem(world, x, y, z, new ItemStack(ForbiddenItems.taintFruit, 1, 0)); } } @@ -99,96 +93,71 @@ public class BlockLeavesTainted extends BlockLeaves /** * Ticks the block if it's been scheduled */ - public void updateTick(World world, int x, int y, int z, Random rand) - { - if (!world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random rand) { + if (!world.isRemote) { int l = world.getBlockMetadata(x, y, z); - if ((l & 8) != 0 && (l & 4) == 0) - { + if ((l & 8) != 0 && (l & 4) == 0) { byte b0 = 4; int i1 = b0 + 1; byte b1 = 32; int j1 = b1 * b1; int k1 = b1 / 2; - if (this.decayThingy == null) - { + if (this.decayThingy == null) { this.decayThingy = new int[b1 * b1 * b1]; } int l1; - if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1)) - { + if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1)) { int i2; int j2; - for (l1 = -b0; l1 <= b0; ++l1) - { - for (i2 = -b0; i2 <= b0; ++i2) - { - for (j2 = -b0; j2 <= b0; ++j2) - { + for (l1 = -b0; l1 <= b0; ++l1) { + for (i2 = -b0; i2 <= b0; ++i2) { + for (j2 = -b0; j2 <= b0; ++j2) { Block block = world.getBlock(x + l1, y + i2, z + j2); - if (block != ForbiddenBlocks.taintLog) - { - if (block.isLeaves(world, x + l1, y + i2, z + j2)) - { + if (block != ForbiddenBlocks.taintLog) { + if (block.isLeaves(world, x + l1, y + i2, z + j2)) { this.decayThingy[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; - } - else - { + } else { this.decayThingy[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1; } - } - else - { + } else { this.decayThingy[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0; } } } } - for (l1 = 1; l1 <= 4; ++l1) - { - for (i2 = -b0; i2 <= b0; ++i2) - { - for (j2 = -b0; j2 <= b0; ++j2) - { - for (int k2 = -b0; k2 <= b0; ++k2) - { - if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) - { - if (this.decayThingy[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) - { + for (l1 = 1; l1 <= 4; ++l1) { + for (i2 = -b0; i2 <= b0; ++i2) { + for (j2 = -b0; j2 <= b0; ++j2) { + for (int k2 = -b0; k2 <= b0; ++k2) { + if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) { + if (this.decayThingy[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { this.decayThingy[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; } - if (this.decayThingy[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) - { + if (this.decayThingy[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) { this.decayThingy[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1; } - if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) - { + if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) { this.decayThingy[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1; } - if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) - { + if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) { this.decayThingy[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1; } - if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) - { + if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) { this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1; } - if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) - { + if (this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) { this.decayThingy[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1; } } @@ -200,27 +169,22 @@ public class BlockLeavesTainted extends BlockLeaves l1 = this.decayThingy[k1 * j1 + k1 * b1 + k1]; - if (l1 >= 0) - { + if (l1 >= 0) { world.setBlockMetadataWithNotify(x, y, z, l & -9, 4); - } - else - { + } else { this.removeLeaves(world, x, y, z); } } } } - private void removeLeaves(World world, int x, int y, int z) - { + private void removeLeaves(World world, int x, int y, int z) { this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } @SideOnly(Side.CLIENT) - public int getBlockColor() - { + public int getBlockColor() { return 0xFFFFFF; } @@ -229,8 +193,7 @@ public class BlockLeavesTainted extends BlockLeaves */ @SideOnly(Side.CLIENT) @Override - public int getRenderColor(int metadata) - { + public int getRenderColor(int metadata) { return 0xFFFFFF; } @@ -239,14 +202,12 @@ public class BlockLeavesTainted extends BlockLeaves * when first determining what to render. */ @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) - { + public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { return 0xFFFFFF; } @Override - public boolean isLeaves(IBlockAccess world, int x, int y, int z) - { + public boolean isLeaves(IBlockAccess world, int x, int y, int z) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockLogTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockLogTainted.java index b5915f3..50816fb 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockLogTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockLogTainted.java @@ -1,61 +1,53 @@ package fox.spiteful.forbidden.blocks; -import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; -import fox.spiteful.forbidden.LogHandler; +import java.lang.reflect.Field; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import org.apache.logging.log4j.Level; import thaumcraft.common.config.Config; import thaumcraft.common.config.ConfigBlocks; -import java.lang.reflect.Field; -import java.util.List; -import java.util.Random; - -public class BlockLogTainted extends BlockLog -{ +public class BlockLogTainted extends BlockLog { @SideOnly(Side.CLIENT) private IIcon sides; + @SideOnly(Side.CLIENT) private IIcon ends; + @SideOnly(Side.CLIENT) private IIcon gross; + @SideOnly(Side.CLIENT) private IIcon gross2; - public BlockLogTainted() - { + public BlockLogTainted() { super(); setCreativeTab(Forbidden.tab); setStepSound(ConfigBlocks.blockTaint.stepSound); try { Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J"); mat.set(this, Config.taintMaterial); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } this.setHarvestLevel("axe", 0); } @Override - public int damageDropped(int p_149692_1_) - { + public int damageDropped(int p_149692_1_) { return 0; } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister register) - { + public void registerBlockIcons(IIconRegister register) { sides = register.registerIcon("forbidden:taint_log_side"); ends = register.registerIcon("forbidden:taint_log_bottom"); gross = register.registerIcon("forbidden:taint_log_side_gross"); @@ -64,41 +56,40 @@ public class BlockLogTainted extends BlockLog @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { int logDirection = meta & 12; - return logDirection == 0 && (side == 1 || side == 0) ? ends : (logDirection == 4 && (side == 5 || side == 4) ? ends : (logDirection == 8 && (side == 2 || side == 3) ? ends : sides)); + return logDirection == 0 && (side == 1 || side == 0) + ? ends + : (logDirection == 4 && (side == 5 || side == 4) + ? ends + : (logDirection == 8 && (side == 2 || side == 3) ? ends : sides)); } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { int meta = world.getBlockMetadata(x, y, z); int logDirection = meta & 12; - if((logDirection == 0 && (side == 1 || side == 0)) || (logDirection == 4 && (side == 5 || side == 4)) || (logDirection == 8 && (side == 2 || side == 3))) - return ends; + if ((logDirection == 0 && (side == 1 || side == 0)) + || (logDirection == 4 && (side == 5 || side == 4)) + || (logDirection == 8 && (side == 2 || side == 3))) return ends; else { - Random r = new Random((long)(side + y + x * z)); + Random r = new Random((long) (side + y + x * z)); return r.nextInt(100) < 75 ? sides : r.nextBoolean() ? gross : gross2; } } @SideOnly(Side.CLIENT) - protected IIcon getSideIcon(int meta) - { + protected IIcon getSideIcon(int meta) { return sides; } @SideOnly(Side.CLIENT) - protected IIcon getTopIcon(int meta) - { + protected IIcon getTopIcon(int meta) { return ends; } - public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) - { + public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) { return false; } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockPlanksTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockPlanksTainted.java index 71f8f46..5ee5191 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockPlanksTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockPlanksTainted.java @@ -4,9 +4,9 @@ import fox.spiteful.forbidden.Forbidden; import net.minecraft.block.Block; import thaumcraft.common.config.Config; -public class BlockPlanksTainted extends Block{ +public class BlockPlanksTainted extends Block { - public BlockPlanksTainted(){ + public BlockPlanksTainted() { super(Config.taintMaterial); setCreativeTab(Forbidden.tab); setStepSound(Block.soundTypeWood); @@ -15,5 +15,4 @@ public class BlockPlanksTainted extends Block{ setBlockTextureName("forbidden:taint_planks"); this.setHarvestLevel("axe", 0); } - } diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockResource.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockResource.java index ce848c8..6ddeb2f 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockResource.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockResource.java @@ -20,5 +20,4 @@ public class BlockResource extends Block { return true; } - } diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockRoseBush.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockRoseBush.java index ad456e6..3ba9d3e 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockRoseBush.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockRoseBush.java @@ -3,6 +3,7 @@ package fox.spiteful.forbidden.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; @@ -16,18 +17,15 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Random; - -public class BlockRoseBush extends BlockBush implements IGrowable -{ +public class BlockRoseBush extends BlockBush implements IGrowable { @SideOnly(Side.CLIENT) public IIcon top; + @SideOnly(Side.CLIENT) public IIcon bottom; - public BlockRoseBush() - { + public BlockRoseBush() { super(Material.plants); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); @@ -39,40 +37,36 @@ public class BlockRoseBush extends BlockBush implements IGrowable /** * The type of render function that is called for this block */ - public int getRenderType() - { + public int getRenderType() { return 1; } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { + public void setBlockBoundsBasedOnState( + IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ - public boolean canPlaceBlockAt(World world, int x, int y, int z) - { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { return super.canPlaceBlockAt(world, x, y, z) && world.isAirBlock(x, y + 1, z); } /** * checks if the block can stay, if not drop as item */ - protected void checkAndDropBlock(World world, int x, int y, int z) - { + protected void checkAndDropBlock(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if(meta == 0){ - if(world.getBlock(x, y - 1, z) != this){ + if (meta == 0) { + if (world.getBlock(x, y - 1, z) != this) { world.setBlockToAir(x, y, z); } - } - else if(meta == 1){ - if(world.getBlock(x, y + 1, z) != this){ + } else if (meta == 1) { + if (world.getBlock(x, y + 1, z) != this) { dropBlockAsItem(world, x, y, z, new ItemStack(this, 1)); world.setBlockToAir(x, y, z); } @@ -82,23 +76,21 @@ public class BlockRoseBush extends BlockBush implements IGrowable /** * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ - public boolean canBlockStay(World world, int x, int y, int z) - { - if (world.getBlock(x, y, z) != this) return super.canBlockStay(world, x, y, z); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - if(world.getBlockMetadata(x, y, z) == 0) - return world.getBlock(x, y - 1, z) == this; + public boolean canBlockStay(World world, int x, int y, int z) { + if (world.getBlock(x, y, z) != this) + return super.canBlockStay( + world, x, y, + z); // Forge: This function is called during world gen and placement, before this block is set, so + // if we are not 'here' then assume it's the pre-check. + if (world.getBlockMetadata(x, y, z) == 0) return world.getBlock(x, y - 1, z) == this; Block block = world.getBlock(x, y - 1, z); return block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this); } - public Item getItemDropped(int metadata, Random rand, int fortune) - { - if (metadata != 1) - { + public Item getItemDropped(int metadata, Random rand, int fortune) { + if (metadata != 1) { return null; - } - else - { + } else { return Item.getItemFromBlock(this); } } @@ -107,55 +99,47 @@ public class BlockRoseBush extends BlockBush implements IGrowable * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(meta == 1) - return bottom; - else - return top; + public IIcon getIcon(int side, int meta) { + if (meta == 1) return bottom; + else return top; } /** * Called when the block is placed in the world. */ - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { world.setBlock(x, y, z, this, 1, 2); world.setBlock(x, y + 1, z, this, 0, 2); } @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister register) - { + public void registerBlockIcons(IIconRegister register) { this.top = register.registerIcon("forbidden:umbral_rose_top"); this.bottom = register.registerIcon("forbidden:umbral_rose_bottom"); } @Override /* Whether the plant isn't fully grown? Who knows? Aside from Mojang. */ - public boolean func_149851_a(World world, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) - { + public boolean func_149851_a(World world, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) { return true; } @Override /* Whether it can accept bonemeal? Who knows? Aside from Mojang. */ - public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) - { + public boolean func_149852_a( + World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) { return true; } @Override /* What happens when the block is bonemealed? Maybe? Fuck Obfuscation. */ - public void func_149853_b(World world, Random rand, int x, int y, int z) - { + public void func_149853_b(World world, Random rand, int x, int y, int z) { spreadFlowers(world, x, y, z, rand); } @Override public void updateTick(World world, int x, int y, int z, Random rand) { - if (!world.isRemote && rand.nextInt(10) <= 2) - spreadFlowers(world, x, y, z, rand); + if (!world.isRemote && rand.nextInt(10) <= 2) spreadFlowers(world, x, y, z, rand); } public void spreadFlowers(World world, int x, int y, int z, Random rand) { @@ -183,5 +167,4 @@ public class BlockRoseBush extends BlockBush implements IGrowable world.setBlock(i1, j1, k1, ForbiddenBlocks.blackFlower, 0, 2); } } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockSaplingTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockSaplingTainted.java index 6efa083..283122f 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockSaplingTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockSaplingTainted.java @@ -1,11 +1,13 @@ package fox.spiteful.forbidden.blocks; -import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.WorldGenTaintedTree; +import java.lang.reflect.Field; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.client.renderer.texture.IIconRegister; @@ -14,28 +16,21 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; import thaumcraft.common.config.Config; import thaumcraft.common.config.ConfigBlocks; -import java.lang.reflect.Field; -import java.util.List; -import java.util.Random; - -public class BlockSaplingTainted extends BlockSapling -{ +public class BlockSaplingTainted extends BlockSapling { @SideOnly(Side.CLIENT) private IIcon icon; - public BlockSaplingTainted() - { + public BlockSaplingTainted() { super(); setCreativeTab(Forbidden.tab); setStepSound(ConfigBlocks.blockTaint.stepSound); try { Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J"); mat.set(this, Config.taintMaterial); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } @@ -44,16 +39,13 @@ public class BlockSaplingTainted extends BlockSapling * Grow the tree */ @Override - public void func_149878_d(World world, int x, int y, int z, Random rand) - { - if(!world.isRemote) - { + public void func_149878_d(World world, int x, int y, int z, Random rand) { + if (!world.isRemote) { int meta = world.getBlockMetadata(x, y, z); world.setBlockToAir(x, y, z); WorldGenTaintedTree tree = new WorldGenTaintedTree(true); - if (!tree.generate(world, rand, x, y, z)) - { + if (!tree.generate(world, rand, x, y, z)) { world.setBlock(x, y, z, this, meta, 2); } } @@ -61,28 +53,24 @@ public class BlockSaplingTainted extends BlockSapling @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { + public void getSubBlocks(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(this, 1, 0)); } @Override - public Item getItemDropped(int wut, Random random, int yeah) - { + public Item getItemDropped(int wut, Random random, int yeah) { return Item.getItemFromBlock(this); } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister register) - { + public void registerBlockIcons(IIconRegister register) { icon = register.registerIcon("forbidden:sapling_taint"); } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return icon; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockStoneTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockStoneTainted.java index 44d02c4..82eb508 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockStoneTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockStoneTainted.java @@ -3,6 +3,7 @@ package fox.spiteful.forbidden.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -10,16 +11,13 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import thaumcraft.common.config.Config; -import thaumcraft.common.config.ConfigBlocks; - -import java.util.List; public class BlockStoneTainted extends Block { private IIcon smooth; private IIcon brick; - public BlockStoneTainted(){ + public BlockStoneTainted() { super(Config.taintMaterial); setHardness(2.0F); setResistance(10.0F); @@ -30,31 +28,25 @@ public class BlockStoneTainted extends Block { @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { smooth = iconRegister.registerIcon("forbidden:taint_stone_smooth"); brick = iconRegister.registerIcon("forbidden:taint_stone_brick"); } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int metadata) - { - if(metadata == 0) - return smooth; - else - return brick; + public IIcon getIcon(int side, int metadata) { + if (metadata == 0) return smooth; + else return brick; } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return metadata; } @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { + public void getSubBlocks(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(item, 1, 0)); list.add(new ItemStack(item, 1, 1)); } diff --git a/src/main/java/fox/spiteful/forbidden/blocks/BlockWrathCage.java b/src/main/java/fox/spiteful/forbidden/blocks/BlockWrathCage.java index e3e0928..86f6ddc 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/BlockWrathCage.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/BlockWrathCage.java @@ -1,9 +1,12 @@ package fox.spiteful.forbidden.blocks; -import java.util.Random; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.items.ForbiddenItems; import fox.spiteful.forbidden.tiles.TileEntityWrathCage; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -17,12 +20,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import fox.spiteful.forbidden.Config; -import fox.spiteful.forbidden.items.ForbiddenItems; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class BlockWrathCage extends BlockContainer { protected BlockWrathCage() { super(Material.iron); @@ -49,14 +46,13 @@ public class BlockWrathCage extends BlockContainer { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { ItemStack held = player.getCurrentEquippedItem(); if (held != null && held.getItem() == ForbiddenItems.mobCrystal) { NBTTagCompound nbttagcompound = held.getTagCompound(); - if (nbttagcompound == null) - return false; - if(!nbttagcompound.hasKey("mob")) - return false; + if (nbttagcompound == null) return false; + if (!nbttagcompound.hasKey("mob")) return false; String string = nbttagcompound.getString("mob"); if (string != null) { if (!world.isRemote) { @@ -80,8 +76,7 @@ public class BlockWrathCage extends BlockContainer { } } else if (held != null && held.getItem() == ForbiddenItems.fork && Config.wrathCost > 0) { TileEntityWrathCage spawner = (TileEntityWrathCage) world.getTileEntity(x, y, z); - if (++spawner.mode > 2) - spawner.mode = 0; + if (++spawner.mode > 2) spawner.mode = 0; player.swingItem(); } return false; @@ -101,13 +96,13 @@ public class BlockWrathCage extends BlockContainer { String mob = spawner.getSpawnerLogic().getEntityNameToSpawn(); crystal.stackTagCompound.setString("mob", mob); - EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), crystal); + EntityItem entityitem = new EntityItem( + world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), crystal); entityitem.motionX = (double) ((float) world.rand.nextGaussian() * 0.05F); entityitem.motionY = (double) ((float) world.rand.nextGaussian() * 0.05F + 0.2F); entityitem.motionZ = (double) ((float) world.rand.nextGaussian() * 0.05F); world.spawnEntityInWorld(entityitem); - } super.onBlockPreDestroy(world, x, y, z, side); diff --git a/src/main/java/fox/spiteful/forbidden/blocks/ForbiddenBlocks.java b/src/main/java/fox/spiteful/forbidden/blocks/ForbiddenBlocks.java index dcd860b..3f32115 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/ForbiddenBlocks.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/ForbiddenBlocks.java @@ -1,12 +1,11 @@ package fox.spiteful.forbidden.blocks; +import cpw.mods.fml.common.registry.GameRegistry; import fox.spiteful.forbidden.tiles.TileEntityWrathCage; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; - public class ForbiddenBlocks { public static Block arcaneCake; public static Block blackFlower; @@ -35,8 +34,9 @@ public class ForbiddenBlocks { taintLog = GameRegistry.registerBlock(new BlockLogTainted().setBlockName("TaintLog"), "TaintLog"); taintPlanks = GameRegistry.registerBlock(new BlockPlanksTainted().setBlockName("TaintPlank"), "TaintPlank"); taintLeaves = GameRegistry.registerBlock(new BlockLeavesTainted().setBlockName("TaintLeaves"), "TaintLeaves"); - taintSapling = GameRegistry.registerBlock(new BlockSaplingTainted().setBlockName("TaintSapling"), "TaintSapling"); + taintSapling = + GameRegistry.registerBlock(new BlockSaplingTainted().setBlockName("TaintSapling"), "TaintSapling"); taintStone = GameRegistry.registerBlock(new BlockStoneTainted(), ItemBlockStoneTainted.class, "TaintBlock"); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/blocks/ItemBlockStoneTainted.java b/src/main/java/fox/spiteful/forbidden/blocks/ItemBlockStoneTainted.java index 5f7c109..5cb8b2b 100644 --- a/src/main/java/fox/spiteful/forbidden/blocks/ItemBlockStoneTainted.java +++ b/src/main/java/fox/spiteful/forbidden/blocks/ItemBlockStoneTainted.java @@ -5,19 +5,18 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemBlockStoneTainted extends ItemBlock { - public ItemBlockStoneTainted(Block block){ + public ItemBlockStoneTainted(Block block) { super(block); this.setHasSubtypes(true); } @Override - public int getMetadata(int meta) - { + public int getMetadata(int meta) { return meta; } + @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { return "tile.TaintStone_" + (itemStack.getItemDamage() == 0 ? "Smooth" : "Brick"); } } diff --git a/src/main/java/fox/spiteful/forbidden/client/ClientProxy.java b/src/main/java/fox/spiteful/forbidden/client/ClientProxy.java index acc8b23..6fa55ff 100644 --- a/src/main/java/fox/spiteful/forbidden/client/ClientProxy.java +++ b/src/main/java/fox/spiteful/forbidden/client/ClientProxy.java @@ -1,11 +1,10 @@ package fox.spiteful.forbidden.client; +import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.registry.VillagerRegistry; import fox.spiteful.forbidden.CommonProxy; import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.tiles.TileEntityWrathCage; - -import cpw.mods.fml.client.registry.ClientRegistry; import net.minecraft.util.ResourceLocation; public class ClientProxy extends CommonProxy { @@ -13,7 +12,8 @@ public class ClientProxy extends CommonProxy { @Override public void registerRenderInfo() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWrathCage.class, new TileEntityWrathCageRenderer()); - VillagerRegistry.instance().registerVillagerSkin(Config.hereticID, new ResourceLocation("forbidden", "textures/models/heretic.png")); + VillagerRegistry.instance() + .registerVillagerSkin( + Config.hereticID, new ResourceLocation("forbidden", "textures/models/heretic.png")); } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/client/TileEntityWrathCageRenderer.java b/src/main/java/fox/spiteful/forbidden/client/TileEntityWrathCageRenderer.java index 1ba7108..7918e37 100644 --- a/src/main/java/fox/spiteful/forbidden/client/TileEntityWrathCageRenderer.java +++ b/src/main/java/fox/spiteful/forbidden/client/TileEntityWrathCageRenderer.java @@ -1,22 +1,19 @@ package fox.spiteful.forbidden.client; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.tiles.TileEntityWrathCage; import fox.spiteful.forbidden.tiles.WrathSpawnerLogic; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class TileEntityWrathCageRenderer extends TileEntitySpecialRenderer { public void renderTileEntityWrathCage(TileEntityWrathCage wrathCage, double x, double z, double par6, float par8) { - if (!wrathCage.getSpawnerLogic().isMobSet()) - return; + if (!wrathCage.getSpawnerLogic().isMobSet()) return; GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) z, (float) par6 + 0.5F); renderMob(wrathCage.getSpawnerLogic(), x, z, par6, par8); @@ -29,15 +26,22 @@ public class TileEntityWrathCageRenderer extends TileEntitySpecialRenderer { if (entity != null) { entity.setWorld(spawnLogic.getSpawnerWorld()); float f1 = 0.4375F; - if (spawnLogic.getEntityNameToSpawn().equals("Ghast")) - f1 = 0.1F; - else if (spawnLogic.getEntityNameToSpawn().equals("Slime") || spawnLogic.getEntityNameToSpawn().equals("ThaumSlime")) - f1 = 0.4F; - else if (spawnLogic.getEntityNameToSpawn().equals("Enderman")) - f1 = 0.3F; + if (spawnLogic.getEntityNameToSpawn().equals("Ghast")) f1 = 0.1F; + else if (spawnLogic.getEntityNameToSpawn().equals("Slime") + || spawnLogic.getEntityNameToSpawn().equals("ThaumSlime")) f1 = 0.4F; + else if (spawnLogic.getEntityNameToSpawn().equals("Enderman")) f1 = 0.3F; GL11.glTranslatef(0.0F, 0.4F, 0.0F); - if (!spawnLogic.getSpawnerWorld().isBlockIndirectlyGettingPowered(spawnLogic.getSpawnerX(), spawnLogic.getSpawnerY(), spawnLogic.getSpawnerZ())) - GL11.glRotatef((float) (spawnLogic.field_98284_d + (spawnLogic.field_98287_c - spawnLogic.field_98284_d) * (double) par7) * 10.0F, 0.0F, 1.0F, 0.0F); + if (!spawnLogic + .getSpawnerWorld() + .isBlockIndirectlyGettingPowered( + spawnLogic.getSpawnerX(), spawnLogic.getSpawnerY(), spawnLogic.getSpawnerZ())) + GL11.glRotatef( + (float) (spawnLogic.field_98284_d + + (spawnLogic.field_98287_c - spawnLogic.field_98284_d) * (double) par7) + * 10.0F, + 0.0F, + 1.0F, + 0.0F); GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.4F, 0.0F); GL11.glScalef(f1, f1, f1); diff --git a/src/main/java/fox/spiteful/forbidden/compat/BloodMagic.java b/src/main/java/fox/spiteful/forbidden/compat/BloodMagic.java index 0bf76e0..ed3d040 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/BloodMagic.java +++ b/src/main/java/fox/spiteful/forbidden/compat/BloodMagic.java @@ -1,20 +1,22 @@ package fox.spiteful.forbidden.compat; import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler; +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import cpw.mods.fml.common.FMLLog; import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.DarkAspects; +import fox.spiteful.forbidden.DarkResearchItem; import fox.spiteful.forbidden.LogHandler; +import fox.spiteful.forbidden.items.ForbiddenItems; import fox.spiteful.forbidden.potions.DarkPotions; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; - import org.apache.logging.log4j.Level; - import thaumcraft.api.ItemApi; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; @@ -23,12 +25,6 @@ import thaumcraft.api.crafting.IArcaneRecipe; import thaumcraft.api.crafting.InfusionRecipe; import thaumcraft.api.potions.PotionFluxTaint; import thaumcraft.api.research.ResearchPage; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; - -import fox.spiteful.forbidden.DarkResearchItem; -import fox.spiteful.forbidden.items.ForbiddenItems; - -import cpw.mods.fml.common.FMLLog; import thaumcraft.common.config.ConfigItems; public class BloodMagic { @@ -50,40 +46,260 @@ public class BloodMagic { Item bloodBucket = Compat.getItem("AWWayofTime", "bucketLife"); Item kamiOrb = Compat.getItem("AWWayofTime", "transcendentBloodOrb"); - (new DarkResearchItem("BLOODMAGIC", "FORBIDDEN", "[BM]", new AspectList(), -1, -1, 0, new ResourceLocation("alchemicalwizardry", "textures/items/SacrificialDagger.png"))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BLOODMAGIC.1")}).setParents(new String [] {"SCHOOLS"}).setRound().setStub().setAutoUnlock().registerResearchItem(); + (new DarkResearchItem( + "BLOODMAGIC", + "FORBIDDEN", + "[BM]", + new AspectList(), + -1, + -1, + 0, + new ResourceLocation("alchemicalwizardry", "textures/items/SacrificialDagger.png"))) + .setPages(new ResearchPage[] {new ResearchPage("forbidden.research_page.BLOODMAGIC.1")}) + .setParents(new String[] {"SCHOOLS"}) + .setRound() + .setStub() + .setAutoUnlock() + .registerResearchItem(); - if(Config.crossWand) { + if (Config.crossWand) { - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ForbiddenItems.wandCore, 1, 3), new ItemStack(ForbiddenItems.wandCore, 1, 6), 4, 20000, 15, 20, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ForbiddenItems.wandCore, 1, 3), + new ItemStack(ForbiddenItems.wandCore, 1, 6), + 4, + 20000, + 15, + 20, + false); - InfusionRecipe blood_recipe = ThaumcraftApi.addInfusionCraftingRecipe("ROD_blood", new ItemStack(ForbiddenItems.wandCore, 1, 6), 2, (new AspectList()).add(Aspect.LIFE, 32).add(Aspect.MAGIC, 12).add(Aspect.WATER, 16), new ItemStack(masterOrb), new ItemStack[]{new ItemStack(magicales), new ItemStack(imbuedSlate), new ItemStack(imbuedSlate), new ItemStack(tennebrae), new ItemStack(sanctus), new ItemStack(aquasalus), new ItemStack(incendium), new ItemStack(terrae), new ItemStack(aether)}); - (new DarkResearchItem("ROD_blood", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 5).add(Aspect.WATER, 4).add(Aspect.WEAPON, 3), -1, -3, 3, new ItemStack(ForbiddenItems.wandCore, 1, 3))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_blood.1"), new ResearchPage(blood_recipe), new ResearchPage("forbidden.research_page.ROD_blood.2")}).setParents(new String[]{"ROD_silverwood", "INFUSION", "BLOODMAGIC"}).setConcealed().registerResearchItem(); + InfusionRecipe blood_recipe = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_blood", + new ItemStack(ForbiddenItems.wandCore, 1, 6), + 2, + (new AspectList()) + .add(Aspect.LIFE, 32) + .add(Aspect.MAGIC, 12) + .add(Aspect.WATER, 16), + new ItemStack(masterOrb), + new ItemStack[] { + new ItemStack(magicales), + new ItemStack(imbuedSlate), + new ItemStack(imbuedSlate), + new ItemStack(tennebrae), + new ItemStack(sanctus), + new ItemStack(aquasalus), + new ItemStack(incendium), + new ItemStack(terrae), + new ItemStack(aether) + }); + (new DarkResearchItem( + "ROD_blood", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 5) + .add(Aspect.WATER, 4) + .add(Aspect.WEAPON, 3), + -1, + -3, + 3, + new ItemStack(ForbiddenItems.wandCore, 1, 3))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_blood.1"), + new ResearchPage(blood_recipe), + new ResearchPage("forbidden.research_page.ROD_blood.2") + }) + .setParents(new String[] {"ROD_silverwood", "INFUSION", "BLOODMAGIC"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_blood", 2); - IArcaneRecipe blood_staff = ThaumcraftApi.addArcaneCraftingRecipe("ROD_blood_staff", new ItemStack(ForbiddenItems.wandCore, 1, 9), (new AspectList()).add(Aspect.ENTROPY, 26).add(Aspect.FIRE, 26).add(Aspect.WATER, 26).add(Aspect.AIR, 26).add(Aspect.EARTH, 26).add(Aspect.ORDER, 26), new Object[]{"__D", "_B_", "B__", Character.valueOf('B'), new ItemStack(ForbiddenItems.wandCore, 1, 3), Character.valueOf('D'), new ItemStack(demonShard)}); - (new DarkResearchItem("ROD_blood_staff", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 8).add(Aspect.WATER, 7).add(Aspect.WEAPON, 6), -3, -2, 2, new ItemStack(ForbiddenItems.wandCore, 1, 9))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_blood_staff.1"), new ResearchPage(blood_staff)}).setParents(new String[]{"ROD_silverwood_staff", "ROD_blood"}).setSpecial().setConcealed().registerResearchItem(); - - InfusionRecipe alchemical_recipe = ThaumcraftApi.addInfusionCraftingRecipe("CAP_alchemical", new ItemStack(ForbiddenItems.wandCap, 1, 0), 3, (new AspectList()).add(Aspect.LIFE, 12).add(Aspect.WATER, 6), ItemApi.getItem("itemWandCap", 1), new ItemStack[] { new ItemStack(magicales), new ItemStack(magicales), new ItemStack(magicales) }); - (new DarkResearchItem("CAP_alchemical", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 4).add(Aspect.TOOL, 1).add(Aspect.WATER, 3), -3, -3, 2, new ItemStack(ForbiddenItems.wandCap, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CAP_alchemical.1"), new ResearchPage(alchemical_recipe) }).setParents(new String[] { "ROD_blood", "CAP_gold" }).setSecondary().setConcealed().registerResearchItem(); + IArcaneRecipe blood_staff = ThaumcraftApi.addArcaneCraftingRecipe( + "ROD_blood_staff", + new ItemStack(ForbiddenItems.wandCore, 1, 9), + (new AspectList()) + .add(Aspect.ENTROPY, 26) + .add(Aspect.FIRE, 26) + .add(Aspect.WATER, 26) + .add(Aspect.AIR, 26) + .add(Aspect.EARTH, 26) + .add(Aspect.ORDER, 26), + new Object[] { + "__D", + "_B_", + "B__", + Character.valueOf('B'), + new ItemStack(ForbiddenItems.wandCore, 1, 3), + Character.valueOf('D'), + new ItemStack(demonShard) + }); + (new DarkResearchItem( + "ROD_blood_staff", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 8) + .add(Aspect.WATER, 7) + .add(Aspect.WEAPON, 6), + -3, + -2, + 2, + new ItemStack(ForbiddenItems.wandCore, 1, 9))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_blood_staff.1"), new ResearchPage(blood_staff) + }) + .setParents(new String[] {"ROD_silverwood_staff", "ROD_blood"}) + .setSpecial() + .setConcealed() + .registerResearchItem(); + InfusionRecipe alchemical_recipe = ThaumcraftApi.addInfusionCraftingRecipe( + "CAP_alchemical", + new ItemStack(ForbiddenItems.wandCap, 1, 0), + 3, + (new AspectList()).add(Aspect.LIFE, 12).add(Aspect.WATER, 6), + ItemApi.getItem("itemWandCap", 1), + new ItemStack[] {new ItemStack(magicales), new ItemStack(magicales), new ItemStack(magicales)}); + (new DarkResearchItem( + "CAP_alchemical", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 4) + .add(Aspect.TOOL, 1) + .add(Aspect.WATER, 3), + -3, + -3, + 2, + new ItemStack(ForbiddenItems.wandCap, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CAP_alchemical.1"), + new ResearchPage(alchemical_recipe) + }) + .setParents(new String[] {"ROD_blood", "CAP_gold"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); } - IArcaneRecipe bloodwell_recipe = ThaumcraftApi.addShapelessArcaneCraftingRecipe("BLOODWELL", new ItemStack(ForbiddenItems.bloodwell, 1, 0), (new AspectList()).add(Aspect.WATER, 10).add(Aspect.EARTH, 10), new Object[] { new ItemStack(Items.feather, 1, 0), new ItemStack(bloodBucket, 1, 0), new ItemStack(Items.glass_bottle, 1, 0), new ItemStack(crapOrb, 1, 0) }); - (new DarkResearchItem("BLOODWELL", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 5).add(Aspect.MIND, 4).add(Aspect.SENSES, 3), 1, -1, 1, new ItemStack(ForbiddenItems.bloodwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BLOODWELL.1"), new ResearchPage(bloodwell_recipe) }).setParents(new String[] { "BLOODMAGIC" }).registerResearchItem(); + IArcaneRecipe bloodwell_recipe = ThaumcraftApi.addShapelessArcaneCraftingRecipe( + "BLOODWELL", + new ItemStack(ForbiddenItems.bloodwell, 1, 0), + (new AspectList()).add(Aspect.WATER, 10).add(Aspect.EARTH, 10), + new Object[] { + new ItemStack(Items.feather, 1, 0), + new ItemStack(bloodBucket, 1, 0), + new ItemStack(Items.glass_bottle, 1, 0), + new ItemStack(crapOrb, 1, 0) + }); + (new DarkResearchItem( + "BLOODWELL", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 5) + .add(Aspect.MIND, 4) + .add(Aspect.SENSES, 3), + 1, + -1, + 1, + new ItemStack(ForbiddenItems.bloodwell, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.BLOODWELL.1"), new ResearchPage(bloodwell_recipe) + }) + .setParents(new String[] {"BLOODMAGIC"}) + .registerResearchItem(); - InfusionRecipe blood_rapier = ThaumcraftApi.addInfusionCraftingRecipe("BLOODRAPIER", new ItemStack(ForbiddenItems.bloodRapier, 1, 0), 8, (new AspectList()).add(Aspect.LIFE, 18).add(Aspect.HUNGER, 32).add(Aspect.WEAPON, 8), ItemApi.getItem("itemSwordVoid", 0), new ItemStack[] { new ItemStack(ConfigItems.itemResource, 1, 12), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.gluttonyShard, 1, 0), new ItemStack(Items.feather), new ItemStack(ConfigItems.itemResource, 1, 6) }); - (new DarkResearchItem("BLOODRAPIER", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 16).add(Aspect.HUNGER, 12).add(Aspect.WEAPON, 12).add(Aspect.MAGIC, 12), 1, -2, 3, new ItemStack(ForbiddenItems.bloodRapier, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BLOODRAPIER.1"), new ResearchPage(blood_rapier) }).setParents(new String[] { "BLOODMAGIC", "INFUSION", "VOIDMETAL" }).setConcealed().registerResearchItem(); + InfusionRecipe blood_rapier = ThaumcraftApi.addInfusionCraftingRecipe( + "BLOODRAPIER", + new ItemStack(ForbiddenItems.bloodRapier, 1, 0), + 8, + (new AspectList()) + .add(Aspect.LIFE, 18) + .add(Aspect.HUNGER, 32) + .add(Aspect.WEAPON, 8), + ItemApi.getItem("itemSwordVoid", 0), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack(ForbiddenItems.deadlyShards, 1, 0), + new ItemStack(ForbiddenItems.gluttonyShard, 1, 0), + new ItemStack(Items.feather), + new ItemStack(ConfigItems.itemResource, 1, 6) + }); + (new DarkResearchItem( + "BLOODRAPIER", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 16) + .add(Aspect.HUNGER, 12) + .add(Aspect.WEAPON, 12) + .add(Aspect.MAGIC, 12), + 1, + -2, + 3, + new ItemStack(ForbiddenItems.bloodRapier, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.BLOODRAPIER.1"), new ResearchPage(blood_rapier) + }) + .setParents(new String[] {"BLOODMAGIC", "INFUSION", "VOIDMETAL"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("BLOODRAPIER", 2); ThaumcraftApi.addWarpToItem(new ItemStack(ForbiddenItems.bloodRapier), 2); - InfusionRecipe eldritch_orb = ThaumcraftApi.addInfusionCraftingRecipe("ELDRITCHORB", new ItemStack(ForbiddenItems.bloodOrb, 1, 0), 2, (new AspectList()).add(Aspect.LIFE, 64).add(Aspect.ELDRITCH, 48).add(Aspect.DARKNESS, 32).add(Aspect.VOID, 64), new ItemStack(kamiOrb), new ItemStack[] { new ItemStack(ConfigItems.itemEldritchObject, 1, 3), new ItemStack(ConfigItems.itemEldritchObject, 1, 0), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(Items.nether_star), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigItems.itemResource, 1, 16), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemEldritchObject, 1, 0) }); - (new DarkResearchItem("ELDRITCHORB", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 24).add(Aspect.VOID, 32).add(Aspect.CRYSTAL, 24).add(Aspect.ELDRITCH, 12), 1, -3, 4, new ItemStack(ForbiddenItems.bloodOrb, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.ELDRITCHORB.1"), new ResearchPage(eldritch_orb) }).setParents(new String[] { "BLOODMAGIC", "INFUSION", "PRIMPEARL", "VOIDMETAL" }).setConcealed().setSpecial().registerResearchItem(); + InfusionRecipe eldritch_orb = ThaumcraftApi.addInfusionCraftingRecipe( + "ELDRITCHORB", + new ItemStack(ForbiddenItems.bloodOrb, 1, 0), + 2, + (new AspectList()) + .add(Aspect.LIFE, 64) + .add(Aspect.ELDRITCH, 48) + .add(Aspect.DARKNESS, 32) + .add(Aspect.VOID, 64), + new ItemStack(kamiOrb), + new ItemStack[] { + new ItemStack(ConfigItems.itemEldritchObject, 1, 3), + new ItemStack(ConfigItems.itemEldritchObject, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(Items.nether_star), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemEldritchObject, 1, 0) + }); + (new DarkResearchItem( + "ELDRITCHORB", + "FORBIDDEN", + "[BM]", + (new AspectList()) + .add(Aspect.LIFE, 24) + .add(Aspect.VOID, 32) + .add(Aspect.CRYSTAL, 24) + .add(Aspect.ELDRITCH, 12), + 1, + -3, + 4, + new ItemStack(ForbiddenItems.bloodOrb, 1, 0))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ELDRITCHORB.1"), new ResearchPage(eldritch_orb) + }) + .setParents(new String[] {"BLOODMAGIC", "INFUSION", "PRIMPEARL", "VOIDMETAL"}) + .setConcealed() + .setSpecial() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ELDRITCHORB", 3); ThaumcraftApi.addWarpToItem(new ItemStack(ForbiddenItems.bloodOrb), 5); - BindingRegistry.registerRecipe(new ItemStack(ForbiddenItems.boundwell, 1, 0), new ItemStack(ForbiddenItems.crystalwell, 1, 0)); - AlchemicalPotionCreationHandler.addPotion(new ItemStack(ConfigItems.itemResource, 1, 11), PotionFluxTaint.instance.getId(), 450); - AlchemicalPotionCreationHandler.addPotion(new ItemStack(ForbiddenItems.resource, 1, 3), DarkPotions.bloodSeal.getId(), 1200); + BindingRegistry.registerRecipe( + new ItemStack(ForbiddenItems.boundwell, 1, 0), new ItemStack(ForbiddenItems.crystalwell, 1, 0)); + AlchemicalPotionCreationHandler.addPotion( + new ItemStack(ConfigItems.itemResource, 1, 11), PotionFluxTaint.instance.getId(), 450); + AlchemicalPotionCreationHandler.addPotion( + new ItemStack(ForbiddenItems.resource, 1, 3), DarkPotions.bloodSeal.getId(), 1200); Rituals.registerRitual("SpiteSanity", 1, 20000, new RitualSanity(), "Plea of Delayed Insanity"); @@ -99,28 +315,65 @@ public class BloodMagic { list = (new AspectList()).add(Aspect.LIFE, 16).add(Aspect.MAGIC, 8).add(Aspect.CRYSTAL, 4); ThaumcraftApi.registerObjectTag(new ItemStack(masterOrb, 1, OreDictionary.WILDCARD_VALUE), list); - list = (new AspectList()).add(Aspect.LIFE, 16).add(DarkAspects.NETHER, 8).add(Aspect.CRYSTAL, 4).add(Aspect.FIRE, 1).add(Aspect.WATER, 1).add(Aspect.AIR, 1).add(Aspect.EARTH, 1).add(Aspect.LIGHT, 1).add(Aspect.DARKNESS, 1); + list = (new AspectList()) + .add(Aspect.LIFE, 16) + .add(DarkAspects.NETHER, 8) + .add(Aspect.CRYSTAL, 4) + .add(Aspect.FIRE, 1) + .add(Aspect.WATER, 1) + .add(Aspect.AIR, 1) + .add(Aspect.EARTH, 1) + .add(Aspect.LIGHT, 1) + .add(Aspect.DARKNESS, 1); ThaumcraftApi.registerObjectTag(new ItemStack(demonShard, 1, OreDictionary.WILDCARD_VALUE), list); - list = (new AspectList()).add(Aspect.LIFE, 32).add(DarkAspects.NETHER, 4).add(Aspect.MAGIC, 8).add(Aspect.CRYSTAL, 4); + list = (new AspectList()) + .add(Aspect.LIFE, 32) + .add(DarkAspects.NETHER, 4) + .add(Aspect.MAGIC, 8) + .add(Aspect.CRYSTAL, 4); aspectBloodItem("archmageBloodOrb", OreDictionary.WILDCARD_VALUE, list); - list = (new AspectList()).add(Aspect.LIFE, 32).add(DarkAspects.NETHER, 16).add(Aspect.MAGIC, 16).add(Aspect.CRYSTAL, 16); + list = (new AspectList()) + .add(Aspect.LIFE, 32) + .add(DarkAspects.NETHER, 16) + .add(Aspect.MAGIC, 16) + .add(Aspect.CRYSTAL, 16); ThaumcraftApi.registerObjectTag(new ItemStack(kamiOrb, 1, OreDictionary.WILDCARD_VALUE), list); - list = (new AspectList()).add(Aspect.ELDRITCH, 5).add(Aspect.WEAPON, 5).add(DarkAspects.WRATH, 5).add(Aspect.POISON, 1); + list = (new AspectList()) + .add(Aspect.ELDRITCH, 5) + .add(Aspect.WEAPON, 5) + .add(DarkAspects.WRATH, 5) + .add(Aspect.POISON, 1); aspectBloodItem("energySword", OreDictionary.WILDCARD_VALUE, list); - list = (new AspectList()).add(Aspect.ELDRITCH, 5).add(Aspect.WEAPON, 6).add(DarkAspects.WRATH, 6).add(Aspect.POISON, 1); + list = (new AspectList()) + .add(Aspect.ELDRITCH, 5) + .add(Aspect.WEAPON, 6) + .add(DarkAspects.WRATH, 6) + .add(Aspect.POISON, 1); aspectBloodItem("energyBlaster", OreDictionary.WILDCARD_VALUE, list); - list = (new AspectList()).add(Aspect.ELDRITCH, 6).add(Aspect.MINE, 5).add(DarkAspects.WRATH, 4).add(Aspect.TRAP, 4); + list = (new AspectList()) + .add(Aspect.ELDRITCH, 6) + .add(Aspect.MINE, 5) + .add(DarkAspects.WRATH, 4) + .add(Aspect.TRAP, 4); aspectBloodItem("boundPickaxe", OreDictionary.WILDCARD_VALUE, list); - list = (new AspectList()).add(Aspect.ELDRITCH, 4).add(Aspect.TOOL, 5).add(DarkAspects.WRATH, 2).add(Aspect.TRAP, 2); + list = (new AspectList()) + .add(Aspect.ELDRITCH, 4) + .add(Aspect.TOOL, 5) + .add(DarkAspects.WRATH, 2) + .add(Aspect.TRAP, 2); aspectBloodItem("boundShovel", OreDictionary.WILDCARD_VALUE, list); - list = (new AspectList()).add(Aspect.ELDRITCH, 6).add(Aspect.TOOL, 5).add(DarkAspects.WRATH, 4).add(Aspect.TRAP, 4); + list = (new AspectList()) + .add(Aspect.ELDRITCH, 6) + .add(Aspect.TOOL, 5) + .add(DarkAspects.WRATH, 4) + .add(Aspect.TRAP, 4); aspectBloodItem("boundAxe", OreDictionary.WILDCARD_VALUE, list); list = (new AspectList()).add(Aspect.METAL, 8).add(Aspect.VOID, 1).add(Aspect.LIFE, 4); diff --git a/src/main/java/fox/spiteful/forbidden/compat/Compat.java b/src/main/java/fox/spiteful/forbidden/compat/Compat.java index bc88a3d..57a34cb 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/Compat.java +++ b/src/main/java/fox/spiteful/forbidden/compat/Compat.java @@ -1,8 +1,11 @@ package fox.spiteful.forbidden.compat; import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import fox.spiteful.forbidden.*; import fox.spiteful.forbidden.blocks.ForbiddenBlocks; +import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -17,10 +20,6 @@ import thaumcraft.api.crafting.InfusionRecipe; import thaumcraft.api.research.ResearchPage; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; -import fox.spiteful.forbidden.items.ForbiddenItems; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; - public class Compat { public static boolean tt = false; @@ -34,8 +33,7 @@ public class Compat { public static boolean ee3 = false; public static void initiate() { - if(!Config.crossMod) - return; + if (!Config.crossMod) return; tt = Config.tt && Loader.isModLoaded("ThaumicTinkerer"); kami = tt && Loader.isModLoaded("ThaumicTinkererKami"); natura = Loader.isModLoaded("Natura"); @@ -54,7 +52,9 @@ public class Compat { if (tt) { if (!kami) { try { - kami = Class.forName("thaumic.tinkerer.common.core.handler.ConfigHandler").getField("enableKami").getBoolean(null); + kami = Class.forName("thaumic.tinkerer.common.core.handler.ConfigHandler") + .getField("enableKami") + .getBoolean(null); } catch (Exception e) { } } @@ -62,30 +62,48 @@ public class Compat { if (kami) { try { Item kamiResource = getItem("ThaumicTinkerer", "kamiResource"); - list = new AspectList().add(DarkAspects.NETHER, 2).add(Aspect.MAGIC, 1).add(Aspect.CRYSTAL, 1); + list = new AspectList() + .add(DarkAspects.NETHER, 2) + .add(Aspect.MAGIC, 1) + .add(Aspect.CRYSTAL, 1); ThaumcraftApi.registerObjectTag(new ItemStack(kamiResource, 1, 6), list); - list = new AspectList().add(Aspect.ELDRITCH, 2).add(Aspect.MAGIC, 1).add(Aspect.CRYSTAL, 1); + list = new AspectList() + .add(Aspect.ELDRITCH, 2) + .add(Aspect.MAGIC, 1) + .add(Aspect.CRYSTAL, 1); ThaumcraftApi.registerObjectTag(new ItemStack(kamiResource, 1, 7), list); } catch (Exception e) { LogHandler.log(Level.INFO, e, "Forbidden Magic doesn't have Thaumic Tinkerer's nose."); kami = false; } - } } if (natura) { try { - list = (new AspectList()).add(Aspect.BEAST, 2).add(DarkAspects.NETHER, 4).add(DarkAspects.SLOTH, 2); + list = (new AspectList()) + .add(Aspect.BEAST, 2) + .add(DarkAspects.NETHER, 4) + .add(DarkAspects.SLOTH, 2); ThaumcraftApi.registerEntityTag("Natura.Imp", list); - list = (new AspectList()).add(Aspect.BEAST, 3).add(Aspect.FIRE, 3).add(DarkAspects.NETHER, 2); + list = (new AspectList()) + .add(Aspect.BEAST, 3) + .add(Aspect.FIRE, 3) + .add(DarkAspects.NETHER, 2); ThaumcraftApi.registerEntityTag("Natura.HeatscarSpider", list); ThaumcraftApi.registerEntityTag("Natura.FlameSpider", list); - list = (new AspectList()).add(Aspect.BEAST, 1).add(Aspect.FIRE, 2).add(DarkAspects.NETHER, 1); + list = (new AspectList()) + .add(Aspect.BEAST, 1) + .add(Aspect.FIRE, 2) + .add(DarkAspects.NETHER, 1); ThaumcraftApi.registerEntityTag("Natura.BabyHeatscarSpider", list); ThaumcraftApi.registerEntityTag("Natura.FlameSpiderBaby", list); - list = (new AspectList()).add(Aspect.BEAST, 2).add(Aspect.FIRE, 4).add(DarkAspects.NETHER, 2).add(Aspect.ENTROPY, 4); + list = (new AspectList()) + .add(Aspect.BEAST, 2) + .add(Aspect.FIRE, 4) + .add(DarkAspects.NETHER, 2) + .add(Aspect.ENTROPY, 4); ThaumcraftApi.registerEntityTag("Natura.NitroCreeper", list); i = GameRegistry.findItemStack("Natura", "Dark Tree", 1); @@ -98,7 +116,7 @@ public class Compat { i = GameRegistry.findItemStack("Natura", "soil.tainted", 1); if (i != null) { - //list = ThaumcraftApiHelper.getObjectAspects(new ItemStack(i.getItem(), 1, 0)); + // list = ThaumcraftApiHelper.getObjectAspects(new ItemStack(i.getItem(), 1, 0)); list = new AspectList().add(Aspect.EARTH, 1); list.add(DarkAspects.NETHER, 1); ThaumcraftApi.registerObjectTag(new ItemStack(i.getItem(), 1, OreDictionary.WILDCARD_VALUE), list); @@ -106,7 +124,7 @@ public class Compat { i = GameRegistry.findItemStack("Natura", "heatsand", 1); if (i != null) { - //list = ThaumcraftApiHelper.getObjectAspects(new ItemStack(i.getItem(), 1, 0)); + // list = ThaumcraftApiHelper.getObjectAspects(new ItemStack(i.getItem(), 1, 0)); list = new AspectList().add(Aspect.FIRE, 1).add(Aspect.EARTH, 1); list.add(DarkAspects.NETHER, 1); ThaumcraftApi.registerObjectTag(new ItemStack(i.getItem(), 1, OreDictionary.WILDCARD_VALUE), list); @@ -114,9 +132,16 @@ public class Compat { i = GameRegistry.findItemStack("Natura", "rawImphide", 1); if (i != null) { - list = (new AspectList()).add(Aspect.FLESH, 4).add(Aspect.HUNGER, 1).add(DarkAspects.NETHER, 1); + list = (new AspectList()) + .add(Aspect.FLESH, 4) + .add(Aspect.HUNGER, 1) + .add(DarkAspects.NETHER, 1); ThaumcraftApi.registerObjectTag(new ItemStack(i.getItem(), 1, 0), list); - list = (new AspectList()).add(Aspect.FLESH, 4).add(Aspect.POISON, 2).add(Aspect.FIRE, 2).add(DarkAspects.NETHER, 1); + list = (new AspectList()) + .add(Aspect.FLESH, 4) + .add(Aspect.POISON, 2) + .add(Aspect.FIRE, 2) + .add(DarkAspects.NETHER, 1); ThaumcraftApi.registerObjectTag(new ItemStack(i.getItem(), 1, 1), list); } } catch (Exception e) { @@ -137,19 +162,121 @@ public class Compat { try { Class amItems = Class.forName("am2.items.ItemsCommonProxy"); Class amBlocks = Class.forName("am2.blocks.BlocksCommonProxy"); - Item essence = (Item)(amItems.getField("essence").get(null)); - Item amOre = (Item)(amItems.getField("itemOre").get(null)); - Block witchwood = (Block)(amBlocks.getField("witchwoodLog").get(null)); + Item essence = (Item) (amItems.getField("essence").get(null)); + Item amOre = (Item) (amItems.getField("itemOre").get(null)); + Block witchwood = (Block) (amBlocks.getField("witchwoodLog").get(null)); - InfusionRecipe witchwood_recipe = ThaumcraftApi.addInfusionCraftingRecipe("ROD_witchwood", new ItemStack(ForbiddenItems.wandCore, 1, 4), 5, (new AspectList()).add(Aspect.MAGIC, 16).add(Aspect.EARTH, 9).add(Aspect.WATER, 9).add(Aspect.FIRE, 9).add(Aspect.AIR, 9), new ItemStack(witchwood), new ItemStack[]{new ItemStack(essence, 1, 0), new ItemStack(amOre, 1, 3), new ItemStack(essence, 1, 1), new ItemStack(essence, 1, 2), new ItemStack(essence, 1, 3), new ItemStack(essence, 1, 4), new ItemStack(amOre, 1, 6), new ItemStack(amOre, 1, 7), new ItemStack(amOre, 1, 2)}); - (new DarkResearchItem("ROD_witchwood", "FORBIDDEN", "[AM2]", (new AspectList()).add(Aspect.MAGIC, 6).add(Aspect.TREE, 5).add(Aspect.MIND, 4), -3, 1, 3, new ItemStack(ForbiddenItems.wandCore, 1, 4))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_witchwood.1"), new ResearchPage(witchwood_recipe)}).setParents(new String[]{ "SCHOOLS", "ROD_silverwood", "INFUSION" }).setConcealed().registerResearchItem(); + InfusionRecipe witchwood_recipe = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_witchwood", + new ItemStack(ForbiddenItems.wandCore, 1, 4), + 5, + (new AspectList()) + .add(Aspect.MAGIC, 16) + .add(Aspect.EARTH, 9) + .add(Aspect.WATER, 9) + .add(Aspect.FIRE, 9) + .add(Aspect.AIR, 9), + new ItemStack(witchwood), + new ItemStack[] { + new ItemStack(essence, 1, 0), + new ItemStack(amOre, 1, 3), + new ItemStack(essence, 1, 1), + new ItemStack(essence, 1, 2), + new ItemStack(essence, 1, 3), + new ItemStack(essence, 1, 4), + new ItemStack(amOre, 1, 6), + new ItemStack(amOre, 1, 7), + new ItemStack(amOre, 1, 2) + }); + (new DarkResearchItem( + "ROD_witchwood", + "FORBIDDEN", + "[AM2]", + (new AspectList()) + .add(Aspect.MAGIC, 6) + .add(Aspect.TREE, 5) + .add(Aspect.MIND, 4), + -3, + 1, + 3, + new ItemStack(ForbiddenItems.wandCore, 1, 4))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_witchwood.1"), + new ResearchPage(witchwood_recipe) + }) + .setParents(new String[] {"SCHOOLS", "ROD_silverwood", "INFUSION"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_witchwood", 2); - InfusionRecipe vinteum_recipe = ThaumcraftApi.addInfusionCraftingRecipe("CAP_vinteum", new ItemStack(ForbiddenItems.wandCap, 1, 1), 5, (new AspectList()).add(Aspect.ENERGY, 12).add(Aspect.MAGIC, 6), ItemApi.getItem("itemWandCap", 6), new ItemStack[]{new ItemStack(amOre, 1, 0), new ItemStack(amOre, 1, 0), new ItemStack(amOre, 1, 0)}); - (new DarkResearchItem("CAP_vinteum", "FORBIDDEN", "[AM2]", (new AspectList()).add(Aspect.MAGIC, 4).add(Aspect.TOOL, 1).add(Aspect.ENERGY, 2), -4, -1, 1, new ItemStack(ForbiddenItems.wandCap, 1, 1))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CAP_vinteum.1"), new ResearchPage(vinteum_recipe)}).setParents(new String[]{"ROD_witchwood", "CAP_thaumium"}).setSecondary().setConcealed().registerResearchItem(); + InfusionRecipe vinteum_recipe = ThaumcraftApi.addInfusionCraftingRecipe( + "CAP_vinteum", + new ItemStack(ForbiddenItems.wandCap, 1, 1), + 5, + (new AspectList()).add(Aspect.ENERGY, 12).add(Aspect.MAGIC, 6), + ItemApi.getItem("itemWandCap", 6), + new ItemStack[] { + new ItemStack(amOre, 1, 0), new ItemStack(amOre, 1, 0), new ItemStack(amOre, 1, 0) + }); + (new DarkResearchItem( + "CAP_vinteum", + "FORBIDDEN", + "[AM2]", + (new AspectList()) + .add(Aspect.MAGIC, 4) + .add(Aspect.TOOL, 1) + .add(Aspect.ENERGY, 2), + -4, + -1, + 1, + new ItemStack(ForbiddenItems.wandCap, 1, 1))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CAP_vinteum.1"), new ResearchPage(vinteum_recipe) + }) + .setParents(new String[] {"ROD_witchwood", "CAP_thaumium"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); - IArcaneRecipe witchwood_staff = ThaumcraftApi.addArcaneCraftingRecipe("ROD_witchwood_staff", new ItemStack(ForbiddenItems.wandCore, 1, 10), (new AspectList()).add(Aspect.ENTROPY, 26).add(Aspect.FIRE, 26).add(Aspect.WATER, 26).add(Aspect.AIR, 26).add(Aspect.EARTH, 26).add(Aspect.ORDER, 26), new Object[]{"__D", "_B_", "B__", Character.valueOf('B'), new ItemStack(ForbiddenItems.wandCore, 1, 4), Character.valueOf('D'), new ItemStack(essence, 1, 10)}); - (new DarkResearchItem("ROD_witchwood_staff", "FORBIDDEN", "[AM2]", (new AspectList()).add(Aspect.MAGIC, 8).add(Aspect.MIND, 7).add(Aspect.TOOL, 6), -3, -1, 2, new ItemStack(ForbiddenItems.wandCore, 1, 10))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_witchwood_staff.1"), new ResearchPage(witchwood_staff)}).setParents(new String[]{"ROD_silverwood_staff", "ROD_witchwood"}).setSpecial().setConcealed().registerResearchItem(); + IArcaneRecipe witchwood_staff = ThaumcraftApi.addArcaneCraftingRecipe( + "ROD_witchwood_staff", + new ItemStack(ForbiddenItems.wandCore, 1, 10), + (new AspectList()) + .add(Aspect.ENTROPY, 26) + .add(Aspect.FIRE, 26) + .add(Aspect.WATER, 26) + .add(Aspect.AIR, 26) + .add(Aspect.EARTH, 26) + .add(Aspect.ORDER, 26), + new Object[] { + "__D", + "_B_", + "B__", + Character.valueOf('B'), + new ItemStack(ForbiddenItems.wandCore, 1, 4), + Character.valueOf('D'), + new ItemStack(essence, 1, 10) + }); + (new DarkResearchItem( + "ROD_witchwood_staff", + "FORBIDDEN", + "[AM2]", + (new AspectList()) + .add(Aspect.MAGIC, 8) + .add(Aspect.MIND, 7) + .add(Aspect.TOOL, 6), + -3, + -1, + 2, + new ItemStack(ForbiddenItems.wandCore, 1, 10))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_witchwood_staff.1"), + new ResearchPage(witchwood_staff) + }) + .setParents(new String[] {"ROD_silverwood_staff", "ROD_witchwood"}) + .setSpecial() + .setConcealed() + .registerResearchItem(); } catch (Exception e) { LogHandler.log(Level.INFO, e, "Forbidden Magic was slain by a Hecate."); am2 = false; @@ -159,34 +286,49 @@ public class Compat { if (botan) { try { ForbiddenBotany.flowerPowerHippymancy(); - } - catch (Throwable e){ + } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic: Botania? Do you wanna build a snowman?"); botan = false; } } - if(ee3){ - if(Config.emc){ + if (ee3) { + if (Config.emc) { try { - for(int x = 0;x < 6;x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemShard, 1, x), 256); + for (int x = 0; x < 6; x++) { + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemShard, 1, x), 256); } - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemShard, 1, 6), 354); - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 0), 83); - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 1), 459); - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 2), 272); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 3), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 4), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 6), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 7), 112); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 8), 2056); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 9), 5120); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 11), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 12), 32); - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 14), 354); - //EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 15), 5986); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 18), 227.556F); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemShard, 1, 6), + // 354); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 0), + // 83); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 1), + // 459); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, 2), + // 272); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 3), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 4), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 6), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 7), 112); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 8), 2056); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 9), 5120); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 11), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 12), 32); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, + // 14), 354); + // EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigItems.itemResource, 1, + // 15), 5986); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigItems.itemResource, 1, 18), 227.556F); EnergyValueRegistryProxy.addPreAssignedEnergyValue(ConfigItems.itemZombieBrain, 1024); EnergyValueRegistryProxy.addPreAssignedEnergyValue(ConfigItems.itemWispEssence, 1024); EnergyValueRegistryProxy.addPreAssignedEnergyValue(ConfigItems.itemManaBean, 32); @@ -202,47 +344,69 @@ public class Compat { EnergyValueRegistryProxy.addPreAssignedEnergyValue(ConfigItems.itemHelmetCultistRobe, 1536); EnergyValueRegistryProxy.addPreAssignedEnergyValue(ConfigItems.itemLegsCultistRobe, 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 0), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2), 392); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 3), 392); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), 264); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), 264); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 12), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 14), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCustomPlant, 1, 0), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCustomPlant, 1, 1), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), 768); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCustomPlant, 1, 5), 16); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockMetalDevice, 1, 0), 1792); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockTable, 1, 0), 28); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockTable, 1, 15), 28); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockEldritch, 1, 4), 4); - for(int x = 0;x < 7;x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockCrystal, 1, x), 1536); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 0), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2), 392); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 3), 392); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), 264); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), 264); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 12), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 14), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 15), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 0), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 1), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), 768); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 5), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 0), 1792); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockTable, 1, 0), 28); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockTable, 1, 15), 28); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockEldritch, 1, 4), 4); + for (int x = 0; x < 7; x++) { + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockCrystal, 1, x), 1536); } - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, 0), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, 1), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, 0), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, 1), 1); EnergyValueRegistryProxy.addPreAssignedEnergyValue(ForbiddenBlocks.starBlock, 221184); - for(int x = 0;x < 7;x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ForbiddenItems.deadlyShards, 1, x), 256); + for (int x = 0; x < 7; x++) { + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ForbiddenItems.deadlyShards, 1, x), 256); } - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ForbiddenItems.gluttonyShard, 1), 256); - } - catch(Throwable e){ + EnergyValueRegistryProxy.addPreAssignedEnergyValue( + new ItemStack(ForbiddenItems.gluttonyShard, 1), 256); + } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic appears to be having trouble with EE3, eh?"); ee3 = false; } } - } - if(special){ + if (special) { Config.spawnerMobs.put("SpecialMobs.SpecialCaveSpider", Aspect.POISON); Config.spawnerMobs.put("SpecialMobs.BabyCaveSpider", Aspect.POISON); Config.spawnerMobs.put("SpecialMobs.FlyingCaveSpider", Aspect.POISON); @@ -292,10 +456,8 @@ public class Compat { Config.spawnerMobs.put("SpecialMobs.VampirePigZombie", Aspect.GREED); Aspect silver; - if(Config.silverfishEmeralds) - silver = Aspect.GREED; - else - silver = Aspect.BEAST; + if (Config.silverfishEmeralds) silver = Aspect.GREED; + else silver = Aspect.BEAST; Config.spawnerMobs.put("SpecialMobs.SpecialSilverfish", silver); Config.spawnerMobs.put("SpecialMobs.BlindingSilverfish", silver); @@ -336,10 +498,9 @@ public class Compat { Config.spawnerMobs.put("SpecialMobs.GiantZombie", Aspect.FLESH); Config.spawnerMobs.put("SpecialMobs.HungryZombie", Aspect.FLESH); Config.spawnerMobs.put("SpecialMobs.PlagueZombie", Aspect.FLESH); - } - if(twilight){ + if (twilight) { Config.spawnerMobs.put("TwilightForest.Wild Boar", Aspect.BEAST); Config.spawnerMobs.put("TwilightForest.Bighorn Sheep", Aspect.CLOTH); Config.spawnerMobs.put("TwilightForest.Wild Deer", Aspect.BEAST); @@ -361,10 +522,8 @@ public class Compat { Config.spawnerMobs.put("TwilightForest.Minoshroom", Aspect.PLANT); Config.spawnerMobs.put("TwilightForest.Fire Beetle", Aspect.FIRE); Config.spawnerMobs.put("TwilightForest.Slime Beetle", Aspect.SLIME); - if(!Config.noLust) - Config.spawnerMobs.put("TwilightForest.Pinch Beetle", DarkAspects.LUST); - else - Config.spawnerMobs.put("TwilightForest.Pinch Beetle", Aspect.BEAST); + if (!Config.noLust) Config.spawnerMobs.put("TwilightForest.Pinch Beetle", DarkAspects.LUST); + else Config.spawnerMobs.put("TwilightForest.Pinch Beetle", Aspect.BEAST); Config.spawnerMobs.put("TwilightForest.Maze Slime", Aspect.SLIME); Config.spawnerMobs.put("TwilightForest.Mist Wolf", Aspect.BEAST); Config.spawnerMobs.put("TwilightForest.King Spider", DarkAspects.PRIDE); @@ -379,19 +538,17 @@ public class Compat { Config.spawnerMobs.put("TwilightForest.Yeti", Aspect.COLD); Config.spawnerMobs.put("TwilightForest.WinterWolf", Aspect.COLD); } - } public static Item getItem(String mod, String item) throws ItemNotFoundException { Item target = GameRegistry.findItem(mod, item); - if(target == null) - throw new ItemNotFoundException(mod, item); + if (target == null) throw new ItemNotFoundException(mod, item); return target; } public static class ItemNotFoundException extends Exception { - public ItemNotFoundException(String mod, String item){ + public ItemNotFoundException(String mod, String item) { super("Unable to find item " + item + " in mod " + mod + "! Are you using the correct version of the mod?"); } } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java b/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java index 2598b48..246a8fe 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java +++ b/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java @@ -1,45 +1,34 @@ package fox.spiteful.forbidden.compat; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.item.ItemStack; - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.IIcon; - import net.minecraft.util.StatCollector; - import vazkii.botania.api.BotaniaAPI; - import vazkii.botania.api.subtile.SubTileEntity; - import vazkii.botania.api.subtile.SubTileFunctional; - import vazkii.botania.api.subtile.SubTileGenerating; - import vazkii.botania.api.subtile.signature.BasicSignature; - import vazkii.botania.api.subtile.signature.SubTileSignature; - - import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import vazkii.botania.api.subtile.signature.BasicSignature; public class DarkSignature extends BasicSignature { IIcon icon; - public DarkSignature(String name){ + public DarkSignature(String name) { super(name); } @Override - public void registerIcons(IIconRegister reg){ + public void registerIcons(IIconRegister reg) { icon = reg.registerIcon("forbidden:" + getName()); } @Override - public IIcon getIconForStack(ItemStack item){ + public IIcon getIconForStack(ItemStack item) { return icon; } @Override - public String getUnlocalizedNameForStack(ItemStack item){ + public String getUnlocalizedNameForStack(ItemStack item) { return "darkflower." + getName(); } @Override - public String getUnlocalizedLoreTextForStack(ItemStack item){ + public String getUnlocalizedLoreTextForStack(ItemStack item) { return "tile.darkflower." + getName() + ".lore"; } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java index 9dd387b..906332c 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java +++ b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java @@ -10,6 +10,7 @@ import fox.spiteful.forbidden.tiles.SubTileBloodthorn; import fox.spiteful.forbidden.tiles.SubTileEuclidaisy; import fox.spiteful.forbidden.tiles.SubTileTainthistle; import fox.spiteful.forbidden.tiles.SubTileWhisperweed; +import java.lang.reflect.Field; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -28,13 +29,9 @@ import thaumcraft.api.crafting.InfusionRecipe; import thaumcraft.api.research.ResearchPage; import thaumcraft.common.config.ConfigItems; import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.lexicon.LexiconCategory; - -import java.lang.reflect.Field; -import java.util.List; public class ForbiddenBotany { - public static void flowerPowerHippymancy(){ + public static void flowerPowerHippymancy() { try { Item rune = Compat.getItem("Botania", "rune"); Item resource = Compat.getItem("Botania", "manaResource"); @@ -48,48 +45,262 @@ public class ForbiddenBotany { Class stupidLib = Class.forName("vazkii.botania.common.lib.LibOreDict"); Field nugget = stupidLib.getDeclaredField("MANASTEEL_NUGGET"); - } - catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); LogHandler.log(Level.INFO, "Somebody's using an outdated version of Botania."); - CraftingManager.getInstance().addRecipe(new ItemStack(resource, 1, 0), new Object[] { "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 2) }); - CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 2), new Object[] { "#", Character.valueOf('#'), new ItemStack(resource, 1, 0) }); + CraftingManager.getInstance().addRecipe(new ItemStack(resource, 1, 0), new Object[] { + "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 2) + }); + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 2), new Object[] { + "#", Character.valueOf('#'), new ItemStack(resource, 1, 0) + }); - CraftingManager.getInstance().addRecipe(new ItemStack(resource, 1, 7), new Object[] { "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 4) }); - CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 4), new Object[] { "#", Character.valueOf('#'), new ItemStack(resource, 1, 7) }); + CraftingManager.getInstance().addRecipe(new ItemStack(resource, 1, 7), new Object[] { + "###", "###", "###", Character.valueOf('#'), new ItemStack(ForbiddenItems.resource, 1, 4) + }); + CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 9, 4), new Object[] { + "#", Character.valueOf('#'), new ItemStack(resource, 1, 7) + }); } OreDictionary.registerOre("nuggetManasteel", new ItemStack(ForbiddenItems.resource, 1, 2)); OreDictionary.registerOre("nuggetElvenElementium", new ItemStack(ForbiddenItems.resource, 1, 4)); - (new DarkResearchItem("BOTANY", "FORBIDDEN", "[B]", new AspectList(), -3, 3, 0, new ItemStack(lexicon))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BOTANY.1")}).setParents(new String [] {"SCHOOLS"}).setRound().setStub().setAutoUnlock().registerResearchItem(); + (new DarkResearchItem("BOTANY", "FORBIDDEN", "[B]", new AspectList(), -3, 3, 0, new ItemStack(lexicon))) + .setPages(new ResearchPage[] {new ResearchPage("forbidden.research_page.BOTANY.1")}) + .setParents(new String[] {"SCHOOLS"}) + .setRound() + .setStub() + .setAutoUnlock() + .registerResearchItem(); - if(Config.crossWand) { + if (Config.crossWand) { - InfusionRecipe livingwood_rod = ThaumcraftApi.addInfusionCraftingRecipe("ROD_livingwood", new ItemStack(ForbiddenItems.wandCore, 1, 8), 3, (new AspectList()).add(Aspect.MAGIC, 16).add(Aspect.TREE, 32).add(Aspect.LIFE, 16).add(Aspect.SENSES, 8).add(Aspect.PLANT, 8), new ItemStack(livingLog), new ItemStack[]{new ItemStack(resource, 1, 2), new ItemStack(rune, 1, 8), new ItemStack(rune, 1, 0), new ItemStack(rune, 1, 1), new ItemStack(rune, 1, 2), new ItemStack(rune, 1, 3), new ItemStack(rune, 1, 4), new ItemStack(rune, 1, 5), new ItemStack(rune, 1, 6), new ItemStack(rune, 1, 7)}); - (new DarkResearchItem("ROD_livingwood", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.TREE, 8).add(Aspect.MAGIC, 4).add(Aspect.PLANT, 6), -1, 3, 3, new ItemStack(ForbiddenItems.wandCore, 1, 7))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_livingwood.1"), new ResearchPage(livingwood_rod)}).setParents(new String[]{"BOTANY", "ROD_silverwood", "INFUSION"}).setConcealed().registerResearchItem(); + InfusionRecipe livingwood_rod = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_livingwood", + new ItemStack(ForbiddenItems.wandCore, 1, 8), + 3, + (new AspectList()) + .add(Aspect.MAGIC, 16) + .add(Aspect.TREE, 32) + .add(Aspect.LIFE, 16) + .add(Aspect.SENSES, 8) + .add(Aspect.PLANT, 8), + new ItemStack(livingLog), + new ItemStack[] { + new ItemStack(resource, 1, 2), + new ItemStack(rune, 1, 8), + new ItemStack(rune, 1, 0), + new ItemStack(rune, 1, 1), + new ItemStack(rune, 1, 2), + new ItemStack(rune, 1, 3), + new ItemStack(rune, 1, 4), + new ItemStack(rune, 1, 5), + new ItemStack(rune, 1, 6), + new ItemStack(rune, 1, 7) + }); + (new DarkResearchItem( + "ROD_livingwood", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.TREE, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.PLANT, 6), + -1, + 3, + 3, + new ItemStack(ForbiddenItems.wandCore, 1, 7))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_livingwood.1"), + new ResearchPage(livingwood_rod) + }) + .setParents(new String[] {"BOTANY", "ROD_silverwood", "INFUSION"}) + .setConcealed() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_livingwood", 2); - BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ForbiddenItems.wandCore, 1, 7), new ItemStack(ForbiddenItems.wandCore, 1, 8), 10000); + BotaniaAPI.registerManaInfusionRecipe( + new ItemStack(ForbiddenItems.wandCore, 1, 7), + new ItemStack(ForbiddenItems.wandCore, 1, 8), + 10000); - IArcaneRecipe manasteel_cap = ThaumcraftApi.addArcaneCraftingRecipe("CAP_manasteel", new ItemStack(ForbiddenItems.wandCap, 1, 4), (new AspectList()).add(Aspect.ENTROPY, 6).add(Aspect.FIRE, 6).add(Aspect.WATER, 6).add(Aspect.AIR, 6).add(Aspect.EARTH, 6).add(Aspect.ORDER, 6), new Object[]{"NNN", "N N", Character.valueOf('N'), "nuggetManasteel"}); - (new DarkResearchItem("CAP_manasteel", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.AURA, 6).add(Aspect.MAGIC, 4).add(Aspect.METAL, 4), 1, 2, 2, new ItemStack(ForbiddenItems.wandCap, 1, 3))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CAP_manasteel.1"), new ResearchPage(manasteel_cap)}).setParents(new String[]{"ROD_livingwood"}).setSecondary().setConcealed().registerResearchItem(); - BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ForbiddenItems.wandCap, 1, 3), new ItemStack(ForbiddenItems.wandCap, 1, 4), 1000); + IArcaneRecipe manasteel_cap = ThaumcraftApi.addArcaneCraftingRecipe( + "CAP_manasteel", + new ItemStack(ForbiddenItems.wandCap, 1, 4), + (new AspectList()) + .add(Aspect.ENTROPY, 6) + .add(Aspect.FIRE, 6) + .add(Aspect.WATER, 6) + .add(Aspect.AIR, 6) + .add(Aspect.EARTH, 6) + .add(Aspect.ORDER, 6), + new Object[] {"NNN", "N N", Character.valueOf('N'), "nuggetManasteel"}); + (new DarkResearchItem( + "CAP_manasteel", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.AURA, 6) + .add(Aspect.MAGIC, 4) + .add(Aspect.METAL, 4), + 1, + 2, + 2, + new ItemStack(ForbiddenItems.wandCap, 1, 3))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CAP_manasteel.1"), new ResearchPage(manasteel_cap) + }) + .setParents(new String[] {"ROD_livingwood"}) + .setSecondary() + .setConcealed() + .registerResearchItem(); + BotaniaAPI.registerManaInfusionRecipe( + new ItemStack(ForbiddenItems.wandCap, 1, 3), new ItemStack(ForbiddenItems.wandCap, 1, 4), 1000); - InfusionRecipe dreamwood_rod = ThaumcraftApi.addInfusionCraftingRecipe("ROD_dreamwood", new ItemStack(ForbiddenItems.wandCore, 1, 12), 3, (new AspectList()).add(Aspect.MAGIC, 16).add(Aspect.TREE, 32).add(Aspect.LIFE, 16).add(Aspect.SENSES, 8).add(Aspect.PLANT, 8), new ItemStack(dreamwood), new ItemStack[]{new ItemStack(resource, 1, 2), new ItemStack(rune, 1, 8), new ItemStack(rune, 1, 0), new ItemStack(rune, 1, 1), new ItemStack(rune, 1, 2), new ItemStack(rune, 1, 3), new ItemStack(rune, 1, 4), new ItemStack(rune, 1, 5), new ItemStack(rune, 1, 6), new ItemStack(rune, 1, 7)}); - IArcaneRecipe dreamwood_staff = ThaumcraftApi.addArcaneCraftingRecipe("ROD_dreamwood_staff", new ItemStack(ForbiddenItems.wandCore, 1, 13), (new AspectList()).add(Aspect.ENTROPY, 26).add(Aspect.FIRE, 26).add(Aspect.WATER, 26).add(Aspect.AIR, 26).add(Aspect.EARTH, 26).add(Aspect.ORDER, 26), new Object[]{"__D", "_B_", "B__", Character.valueOf('B'), new ItemStack(ForbiddenItems.wandCore, 1, 11), Character.valueOf('D'), new ItemStack(resource, 1, 9)}); - BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ForbiddenItems.wandCore, 1, 11), new ItemStack(ForbiddenItems.wandCore, 1, 12), 10000); - (new DarkResearchItem("ROD_dreamwood_staff", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.TREE, 16).add(Aspect.MAGIC, 8).add(Aspect.ELDRITCH, 6), 1, 3, 2, new ItemStack(ForbiddenItems.wandCore, 1, 13))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.ROD_dreamwood_staff.1"), new ResearchPage(dreamwood_staff), new ResearchPage(dreamwood_rod)}).setParents(new String[]{"ROD_livingwood", "ROD_silverwood_staff"}).setSiblings(new String[]{"ROD_dreamwood"}).setConcealed().registerResearchItem(); - (new DarkResearchItem("ROD_dreamwood", "FORBIDDEN")).setVirtual().registerResearchItem(); + InfusionRecipe dreamwood_rod = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_dreamwood", + new ItemStack(ForbiddenItems.wandCore, 1, 12), + 3, + (new AspectList()) + .add(Aspect.MAGIC, 16) + .add(Aspect.TREE, 32) + .add(Aspect.LIFE, 16) + .add(Aspect.SENSES, 8) + .add(Aspect.PLANT, 8), + new ItemStack(dreamwood), + new ItemStack[] { + new ItemStack(resource, 1, 2), + new ItemStack(rune, 1, 8), + new ItemStack(rune, 1, 0), + new ItemStack(rune, 1, 1), + new ItemStack(rune, 1, 2), + new ItemStack(rune, 1, 3), + new ItemStack(rune, 1, 4), + new ItemStack(rune, 1, 5), + new ItemStack(rune, 1, 6), + new ItemStack(rune, 1, 7) + }); + IArcaneRecipe dreamwood_staff = ThaumcraftApi.addArcaneCraftingRecipe( + "ROD_dreamwood_staff", + new ItemStack(ForbiddenItems.wandCore, 1, 13), + (new AspectList()) + .add(Aspect.ENTROPY, 26) + .add(Aspect.FIRE, 26) + .add(Aspect.WATER, 26) + .add(Aspect.AIR, 26) + .add(Aspect.EARTH, 26) + .add(Aspect.ORDER, 26), + new Object[] { + "__D", + "_B_", + "B__", + Character.valueOf('B'), + new ItemStack(ForbiddenItems.wandCore, 1, 11), + Character.valueOf('D'), + new ItemStack(resource, 1, 9) + }); + BotaniaAPI.registerManaInfusionRecipe( + new ItemStack(ForbiddenItems.wandCore, 1, 11), + new ItemStack(ForbiddenItems.wandCore, 1, 12), + 10000); + (new DarkResearchItem( + "ROD_dreamwood_staff", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.TREE, 16) + .add(Aspect.MAGIC, 8) + .add(Aspect.ELDRITCH, 6), + 1, + 3, + 2, + new ItemStack(ForbiddenItems.wandCore, 1, 13))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.ROD_dreamwood_staff.1"), + new ResearchPage(dreamwood_staff), + new ResearchPage(dreamwood_rod) + }) + .setParents(new String[] {"ROD_livingwood", "ROD_silverwood_staff"}) + .setSiblings(new String[] {"ROD_dreamwood"}) + .setConcealed() + .registerResearchItem(); + (new DarkResearchItem("ROD_dreamwood", "FORBIDDEN")) + .setVirtual() + .registerResearchItem(); - IArcaneRecipe elementium_cap_inert = ThaumcraftApi.addArcaneCraftingRecipe("CAP_elementium", new ItemStack(ForbiddenItems.wandCap, 1, 6), (new AspectList()).add(Aspect.ENTROPY, 27).add(Aspect.FIRE, 27).add(Aspect.WATER, 27).add(Aspect.AIR, 27).add(Aspect.EARTH, 27).add(Aspect.ORDER, 27), new Object[]{"NNN", "N N", Character.valueOf('N'), "nuggetElvenElementium"}); - InfusionRecipe elementium_cap = ThaumcraftApi.addInfusionCraftingRecipe("CAP_elementium", new ItemStack(ForbiddenItems.wandCap, 1, 5), 1, (new AspectList()).add(Aspect.EARTH, 18).add(Aspect.FIRE, 18).add(Aspect.WATER, 18).add(Aspect.AIR, 18), new ItemStack(ForbiddenItems.wandCap, 1, 6), new ItemStack[]{new ItemStack(resource, 1, 5), new ItemStack(rune, 1, 0), new ItemStack(rune, 1, 1), new ItemStack(rune, 1, 2), new ItemStack(rune, 1, 3)}); - (new DarkResearchItem("CAP_elementium", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.FIRE, 8).add(Aspect.MAGIC, 12).add(Aspect.WATER, 8).add(Aspect.AIR, 8).add(Aspect.EARTH, 8), 3, 3, 4, new ItemStack(ForbiddenItems.wandCap, 1, 5))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CAP_elementium.1"), new ResearchPage(elementium_cap_inert), new ResearchPage(elementium_cap)}).setParents(new String[]{"ROD_dreamwood_staff"}).setConcealed().registerResearchItem(); + IArcaneRecipe elementium_cap_inert = ThaumcraftApi.addArcaneCraftingRecipe( + "CAP_elementium", + new ItemStack(ForbiddenItems.wandCap, 1, 6), + (new AspectList()) + .add(Aspect.ENTROPY, 27) + .add(Aspect.FIRE, 27) + .add(Aspect.WATER, 27) + .add(Aspect.AIR, 27) + .add(Aspect.EARTH, 27) + .add(Aspect.ORDER, 27), + new Object[] {"NNN", "N N", Character.valueOf('N'), "nuggetElvenElementium"}); + InfusionRecipe elementium_cap = ThaumcraftApi.addInfusionCraftingRecipe( + "CAP_elementium", + new ItemStack(ForbiddenItems.wandCap, 1, 5), + 1, + (new AspectList()) + .add(Aspect.EARTH, 18) + .add(Aspect.FIRE, 18) + .add(Aspect.WATER, 18) + .add(Aspect.AIR, 18), + new ItemStack(ForbiddenItems.wandCap, 1, 6), + new ItemStack[] { + new ItemStack(resource, 1, 5), + new ItemStack(rune, 1, 0), + new ItemStack(rune, 1, 1), + new ItemStack(rune, 1, 2), + new ItemStack(rune, 1, 3) + }); + (new DarkResearchItem( + "CAP_elementium", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.FIRE, 8) + .add(Aspect.MAGIC, 12) + .add(Aspect.WATER, 8) + .add(Aspect.AIR, 8) + .add(Aspect.EARTH, 8), + 3, + 3, + 4, + new ItemStack(ForbiddenItems.wandCap, 1, 5))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CAP_elementium.1"), + new ResearchPage(elementium_cap_inert), + new ResearchPage(elementium_cap) + }) + .setParents(new String[] {"ROD_dreamwood_staff"}) + .setConcealed() + .registerResearchItem(); - IRecipe terrasteel_cap = new ShapedOreRecipe(new ItemStack(ForbiddenItems.wandCap, 1, 2), new Object[]{"NNN", "N N", Character.valueOf('N'), "nuggetTerrasteel"}); + IRecipe terrasteel_cap = new ShapedOreRecipe( + new ItemStack(ForbiddenItems.wandCap, 1, 2), + new Object[] {"NNN", "N N", Character.valueOf('N'), "nuggetTerrasteel"}); CraftingManager.getInstance().getRecipeList().add(terrasteel_cap); - (new DarkResearchItem("CAP_terrasteel", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.ENERGY, 1).add(Aspect.METAL, 1), 3, 2, 1, new ItemStack(ForbiddenItems.wandCap, 1, 2))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.CAP_terrasteel.1"), new ResearchPage(terrasteel_cap)}).setParents(new String[]{"CAP_manasteel"}).setConcealed().setSecondary().registerResearchItem(); - + (new DarkResearchItem( + "CAP_terrasteel", + "FORBIDDEN", + "[B]", + (new AspectList()).add(Aspect.ENERGY, 1).add(Aspect.METAL, 1), + 3, + 2, + 1, + new ItemStack(ForbiddenItems.wandCap, 1, 2))) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.CAP_terrasteel.1"), + new ResearchPage(terrasteel_cap) + }) + .setParents(new String[] {"CAP_manasteel"}) + .setConcealed() + .setSecondary() + .registerResearchItem(); } BotaniaAPI.registerSubTile("euclidaisy", SubTileEuclidaisy.class); @@ -103,8 +314,42 @@ public class ForbiddenBotany { ItemStack euclidaisy = getFlower("euclidaisy"); SubTileEuclidaisy.lexicon.setIcon(euclidaisy); - InfusionRecipe euclid = ThaumcraftApi.addInfusionCraftingRecipe("EUCLIDAISY", euclidaisy, 8, (new AspectList()).add(Aspect.AURA, 8).add(Aspect.ELDRITCH, 10).add(Aspect.MAGIC, 8), new ItemStack(flower, 1, 6), new ItemStack[] { new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(resource, 1, 1), new ItemStack(resource, 1, 6), new ItemStack(petal, 1, 6), new ItemStack(petal, 1, 6), new ItemStack(rune, 1, 12), new ItemStack(rune, 1, 11) }); - (new DarkResearchItem("EUCLIDAISY", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.PLANT, 8).add(Aspect.MAGIC, 4).add(Aspect.AURA, 12), -3, 5, 2, euclidaisy)).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.EUCLIDAISY.1"), new ResearchPage(euclid) }).setParents(new String[] { "BOTANY", "INFUSION" }).setConcealed().registerResearchItem(); + InfusionRecipe euclid = ThaumcraftApi.addInfusionCraftingRecipe( + "EUCLIDAISY", + euclidaisy, + 8, + (new AspectList()) + .add(Aspect.AURA, 8) + .add(Aspect.ELDRITCH, 10) + .add(Aspect.MAGIC, 8), + new ItemStack(flower, 1, 6), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(resource, 1, 1), + new ItemStack(resource, 1, 6), + new ItemStack(petal, 1, 6), + new ItemStack(petal, 1, 6), + new ItemStack(rune, 1, 12), + new ItemStack(rune, 1, 11) + }); + (new DarkResearchItem( + "EUCLIDAISY", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.PLANT, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.AURA, 12), + -3, + 5, + 2, + euclidaisy)) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.EUCLIDAISY.1"), new ResearchPage(euclid) + }) + .setParents(new String[] {"BOTANY", "INFUSION"}) + .setConcealed() + .registerResearchItem(); BotaniaAPI.registerSubTile("whisperweed", SubTileWhisperweed.class); BotaniaAPI.registerSubTileSignature(SubTileWhisperweed.class, new DarkSignature("whisperweed")); @@ -117,8 +362,44 @@ public class ForbiddenBotany { ItemStack whisperweed = getFlower("whisperweed"); SubTileWhisperweed.lexicon.setIcon(whisperweed); - IArcaneRecipe whispercraft = ThaumcraftApi.addShapelessArcaneCraftingRecipe("WHISPERWEED", whisperweed, (new AspectList()).add(Aspect.FIRE, 10).add(Aspect.WATER, 10).add(Aspect.EARTH, 10).add(Aspect.AIR, 10).add(Aspect.ORDER, 10).add(Aspect.ENTROPY, 10), new ItemStack[] { new ItemStack(Blocks.tallgrass, 1, 1), new ItemStack(resource, 1, 2), new ItemStack(resource, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 9), new ItemStack(petal, 1, 7), new ItemStack(petal, 1, 10), new ItemStack(rune, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 6) }); - (new DarkResearchItem("WHISPERWEED", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.PLANT, 8).add(Aspect.MIND, 10).add(Aspect.SENSES, 4), -4, 5, 1, whisperweed)).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.WHISPERWEED.1"), new ResearchPage(whispercraft) }).setParents(new String[] { "BOTANY" }).setConcealed().registerResearchItem(); + IArcaneRecipe whispercraft = ThaumcraftApi.addShapelessArcaneCraftingRecipe( + "WHISPERWEED", + whisperweed, + (new AspectList()) + .add(Aspect.FIRE, 10) + .add(Aspect.WATER, 10) + .add(Aspect.EARTH, 10) + .add(Aspect.AIR, 10) + .add(Aspect.ORDER, 10) + .add(Aspect.ENTROPY, 10), + new ItemStack[] { + new ItemStack(Blocks.tallgrass, 1, 1), + new ItemStack(resource, 1, 2), + new ItemStack(resource, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(petal, 1, 7), + new ItemStack(petal, 1, 10), + new ItemStack(rune, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 6) + }); + (new DarkResearchItem( + "WHISPERWEED", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.PLANT, 8) + .add(Aspect.MIND, 10) + .add(Aspect.SENSES, 4), + -4, + 5, + 1, + whisperweed)) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.WHISPERWEED.1"), new ResearchPage(whispercraft) + }) + .setParents(new String[] {"BOTANY"}) + .setConcealed() + .registerResearchItem(); BotaniaAPI.registerSubTile("tainthistle", SubTileTainthistle.class); BotaniaAPI.registerSubTileSignature(SubTileTainthistle.class, new DarkSignature("tainthistle")); @@ -131,34 +412,70 @@ public class ForbiddenBotany { ItemStack tainthistle = getFlower("tainthistle"); SubTileTainthistle.lexicon.setIcon(tainthistle); - InfusionRecipe thistlecraft = ThaumcraftApi.addInfusionCraftingRecipe("TAINTHISTLE", tainthistle, 4, (new AspectList()).add(Aspect.TAINT, 8).add(Aspect.HUNGER, 4).add(Aspect.AIR, 4).add(Aspect.WATER, 4), new ItemStack(ConfigItems.itemResource, 1, 12), new ItemStack[] { new ItemStack(petal, 1, 10), new ItemStack(petal, 1, 10), new ItemStack(petal, 1, 10), new ItemStack(rune, 1, 10), new ItemStack(rune, 1, 8)}); - (new DarkResearchItem("TAINTHISTLE", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.PLANT, 8).add(Aspect.TAINT, 10).add(Aspect.MAGIC, 4), -2, 5, 2, tainthistle)).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TAINTHISTLE.1"), new ResearchPage(thistlecraft) }).setParents(new String[] { "BOTANY", "INFUSION" }).setConcealed().registerResearchItem(); + InfusionRecipe thistlecraft = ThaumcraftApi.addInfusionCraftingRecipe( + "TAINTHISTLE", + tainthistle, + 4, + (new AspectList()) + .add(Aspect.TAINT, 8) + .add(Aspect.HUNGER, 4) + .add(Aspect.AIR, 4) + .add(Aspect.WATER, 4), + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack[] { + new ItemStack(petal, 1, 10), + new ItemStack(petal, 1, 10), + new ItemStack(petal, 1, 10), + new ItemStack(rune, 1, 10), + new ItemStack(rune, 1, 8) + }); + (new DarkResearchItem( + "TAINTHISTLE", + "FORBIDDEN", + "[B]", + (new AspectList()) + .add(Aspect.PLANT, 8) + .add(Aspect.TAINT, 10) + .add(Aspect.MAGIC, 4), + -2, + 5, + 2, + tainthistle)) + .setPages(new ResearchPage[] { + new ResearchPage("forbidden.research_page.TAINTHISTLE.1"), new ResearchPage(thistlecraft) + }) + .setParents(new String[] {"BOTANY", "INFUSION"}) + .setConcealed() + .registerResearchItem(); - if(Compat.bm){ + if (Compat.bm) { BotaniaAPI.registerSubTile("bloodthorn", SubTileBloodthorn.class); BotaniaAPI.registerSubTileSignature(SubTileBloodthorn.class, new DarkSignature("bloodthorn")); BotaniaAPI.addSubTileToCreativeMenu("bloodthorn"); - SubTileBloodthorn.lexicon = new ForbiddenLexicon("bloodthorn", BotaniaAPI.categoryFunctionalFlowers){ + SubTileBloodthorn.lexicon = new ForbiddenLexicon("bloodthorn", BotaniaAPI.categoryFunctionalFlowers) { @Override - public String getSubtitle(){ + public String getSubtitle() { return "[Forbidden Magic x Blood Magic x Botania]"; } }; - SubTileBloodthorn.lexicon.addPage(BotaniaAPI.internalHandler.textPage("forbidden.lexicon.bloodthorn.0")); + SubTileBloodthorn.lexicon.addPage( + BotaniaAPI.internalHandler.textPage("forbidden.lexicon.bloodthorn.0")); ItemStack bloodthorn = getFlower("bloodthorn"); SubTileBloodthorn.lexicon.setIcon(bloodthorn); - try{ - AltarRecipeRegistry.registerAltarRecipe(bloodthorn, new ItemStack(flower, 1, 14), 4, 15000, 25, 50, false); - } - catch(Throwable e){ + try { + AltarRecipeRegistry.registerAltarRecipe( + bloodthorn, new ItemStack(flower, 1, 14), 4, 15000, 25, 50, false); + } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic tried to do some Blood Magic, but bled out."); } } - ThaumcraftApi.registerObjectTag(new ItemStack(Compat.getItem("Botania", "specialFlower"), 1), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(Compat.getItem("Botania", "specialFlower"), 1), + (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1)); } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic: Botania? Do you wanna build a snowman?"); diff --git a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenLexicon.java b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenLexicon.java index 6f53fec..c624f0d 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenLexicon.java +++ b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenLexicon.java @@ -7,14 +7,13 @@ import vazkii.botania.api.lexicon.LexiconEntry; public class ForbiddenLexicon extends LexiconEntry implements IAddonEntry { - - public ForbiddenLexicon(String name, LexiconCategory category){ + public ForbiddenLexicon(String name, LexiconCategory category) { super(name, category); BotaniaAPI.addEntry(this, category); } @Override - public String getSubtitle(){ + public String getSubtitle() { return "[Forbidden Magic x Botania]"; } diff --git a/src/main/java/fox/spiteful/forbidden/compat/RitualSanity.java b/src/main/java/fox/spiteful/forbidden/compat/RitualSanity.java index 9ba7555..f56a2f8 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/RitualSanity.java +++ b/src/main/java/fox/spiteful/forbidden/compat/RitualSanity.java @@ -5,24 +5,20 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.potions.PotionWarpWard; -import java.util.ArrayList; -import java.util.List; - -public class RitualSanity extends RitualEffect -{ +public class RitualSanity extends RitualEffect { public static final int crystallosDrain = 4; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -33,14 +29,14 @@ public class RitualSanity extends RitualEffect int timeDelay = 600; - if (world.getWorldTime() % timeDelay != 0) - { + if (world.getWorldTime() % timeDelay != 0) { return; } boolean crazy = world.getWorldTime() % (timeDelay * 4) == 0; - boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); + boolean hasCrystallos = + this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); int range = 15 * (hasCrystallos ? 3 : 1); int vertRange = 15 * (hasCrystallos ? 3 : 1); @@ -48,42 +44,41 @@ public class RitualSanity extends RitualEffect float posX = x + 0.5f; float posY = y + 0.5f; float posZ = z + 0.5f; - List list = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, vertRange, range)); + List list = world.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(range, vertRange, range)); int entityCount = 0; - for (EntityPlayer player : list) - { - entityCount ++; + for (EntityPlayer player : list) { + entityCount++; } int cost = this.getCostPerRefresh(); - if (currentEssence < cost * entityCount) - { + if (currentEssence < cost * entityCount) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { entityCount = 0; - for (EntityPlayer player : list) - { + for (EntityPlayer player : list) { PotionEffect effect = player.getActivePotionEffect(PotionWarpWard.instance); - if (effect == null || effect.getDuration() <= timeDelay) - { + if (effect == null || effect.getDuration() <= timeDelay) { PotionEffect ward = new PotionEffect(PotionWarpWard.instance.id, timeDelay + 2, 0, true); ward.getCurativeItems().clear(); player.addPotionEffect(ward); entityCount++; - if(crazy && world.rand.nextInt(35) <= 3) - Thaumcraft.proxy.getPlayerKnowledge().addWarpTemp(player.getDisplayName(), 1 + world.rand.nextInt(3)); + if (crazy && world.rand.nextInt(35) <= 3) + Thaumcraft.proxy + .getPlayerKnowledge() + .addWarpTemp(player.getDisplayName(), 1 + world.rand.nextInt(3)); } } - if (entityCount > 0) - { - if (hasCrystallos) - { + if (entityCount > 0) { + if (hasCrystallos) { this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true); } SoulNetworkHandler.syphonFromNetwork(owner, cost * entityCount); @@ -92,14 +87,12 @@ public class RitualSanity extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 15000; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList sanityRitual = new ArrayList(); sanityRitual.add(new RitualComponent(4, 1, 0, RitualComponent.DUSK)); sanityRitual.add(new RitualComponent(-4, 1, 0, RitualComponent.DUSK)); @@ -132,4 +125,4 @@ public class RitualSanity extends RitualEffect return sanityRitual; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/DarkEnchantments.java b/src/main/java/fox/spiteful/forbidden/enchantments/DarkEnchantments.java index 951dd29..480d16e 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/DarkEnchantments.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/DarkEnchantments.java @@ -1,14 +1,12 @@ package fox.spiteful.forbidden.enchantments; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.compat.Compat; +import java.lang.reflect.Method; import net.minecraft.enchantment.Enchantment; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import fox.spiteful.forbidden.Config; - -import java.lang.reflect.Method; - public class DarkEnchantments { public static Enchantment cluster; public static Enchantment wrath; @@ -20,8 +18,7 @@ public class DarkEnchantments { public static Enchantment impact; public static void hex() { - if(!Config.enchanting) - return; + if (!Config.enchanting) return; cluster = new EnchantmentCluster(Config.clusterEnchID); wrath = new EnchantmentWrath(Config.wrathEnchID); @@ -34,19 +31,88 @@ public class DarkEnchantments { if (Compat.tt) { try { - Method reg = Class.forName("thaumic.tinkerer.common.enchantment.core.EnchantmentManager").getDeclaredMethod("registerExponentialCostData", Enchantment.class, String.class, Boolean.TYPE, AspectList.class, String.class); - reg.invoke(null, wrath, "forbidden:textures/misc/wrath.png", false, (new AspectList()).add(Aspect.ENTROPY, 6).add(Aspect.FIRE, 6), "WRATH"); - reg.invoke(null, cluster, "forbidden:textures/misc/lucrative.png", false, (new AspectList()).add(Aspect.FIRE, 5).add(Aspect.EARTH, 5).add(Aspect.ORDER, 5), "CLUSTER"); - reg.invoke(null, greedy, "forbidden:textures/misc/greedy.png", false, (new AspectList()).add(Aspect.ENTROPY, 50).add(Aspect.EARTH, 30).add(Aspect.ORDER, 20), "GREEDY"); - reg.invoke(null, educational, "forbidden:textures/misc/educational.png", false, new AspectList().add(Aspect.AIR, 10).add(Aspect.FIRE, 10).add(Aspect.WATER, 10).add(Aspect.EARTH, 10).add(Aspect.ORDER, 15).add(Aspect.ENTROPY, 15), "EDUCATIONAL"); - reg.invoke(null, consuming, "forbidden:textures/misc/consuming.png", false, (new AspectList()).add(Aspect.ENTROPY, 10), "CONSUMING"); - reg.invoke(null, corrupting, "forbidden:textures/misc/corrupting.png", false, (new AspectList()).add(Aspect.ENTROPY, 20).add(Aspect.FIRE, 15).add(Aspect.EARTH, 10), "CORRUPTING"); - reg.invoke(null, voidtouched, "forbidden:textures/misc/voidtouched.png", false, (new AspectList()).add(Aspect.ENTROPY, 70), "VOIDTOUCHED"); - reg.invoke(null, impact, "forbidden:textures/misc/impact.png", false, (new AspectList()).add(Aspect.ENTROPY, 30).add(Aspect.EARTH, 30), "IMPACT"); + Method reg = Class.forName("thaumic.tinkerer.common.enchantment.core.EnchantmentManager") + .getDeclaredMethod( + "registerExponentialCostData", + Enchantment.class, + String.class, + Boolean.TYPE, + AspectList.class, + String.class); + reg.invoke( + null, + wrath, + "forbidden:textures/misc/wrath.png", + false, + (new AspectList()).add(Aspect.ENTROPY, 6).add(Aspect.FIRE, 6), + "WRATH"); + reg.invoke( + null, + cluster, + "forbidden:textures/misc/lucrative.png", + false, + (new AspectList()) + .add(Aspect.FIRE, 5) + .add(Aspect.EARTH, 5) + .add(Aspect.ORDER, 5), + "CLUSTER"); + reg.invoke( + null, + greedy, + "forbidden:textures/misc/greedy.png", + false, + (new AspectList()) + .add(Aspect.ENTROPY, 50) + .add(Aspect.EARTH, 30) + .add(Aspect.ORDER, 20), + "GREEDY"); + reg.invoke( + null, + educational, + "forbidden:textures/misc/educational.png", + false, + new AspectList() + .add(Aspect.AIR, 10) + .add(Aspect.FIRE, 10) + .add(Aspect.WATER, 10) + .add(Aspect.EARTH, 10) + .add(Aspect.ORDER, 15) + .add(Aspect.ENTROPY, 15), + "EDUCATIONAL"); + reg.invoke( + null, + consuming, + "forbidden:textures/misc/consuming.png", + false, + (new AspectList()).add(Aspect.ENTROPY, 10), + "CONSUMING"); + reg.invoke( + null, + corrupting, + "forbidden:textures/misc/corrupting.png", + false, + (new AspectList()) + .add(Aspect.ENTROPY, 20) + .add(Aspect.FIRE, 15) + .add(Aspect.EARTH, 10), + "CORRUPTING"); + reg.invoke( + null, + voidtouched, + "forbidden:textures/misc/voidtouched.png", + false, + (new AspectList()).add(Aspect.ENTROPY, 70), + "VOIDTOUCHED"); + reg.invoke( + null, + impact, + "forbidden:textures/misc/impact.png", + false, + (new AspectList()).add(Aspect.ENTROPY, 30).add(Aspect.EARTH, 30), + "IMPACT"); } catch (Throwable e) { e.printStackTrace(); } } } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCluster.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCluster.java index 1da13b8..2f2801a 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCluster.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCluster.java @@ -23,14 +23,12 @@ public class EnchantmentCluster extends Enchantment { @Override public boolean canApply(ItemStack item) { - if (item.getItem() instanceof ItemMorphPickaxe) - return true; - else - return false; + if (item.getItem() instanceof ItemMorphPickaxe) return true; + else return false; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentConsuming.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentConsuming.java index d1f81b0..4118838 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentConsuming.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentConsuming.java @@ -25,14 +25,14 @@ public class EnchantmentConsuming extends Enchantment { @Override public boolean canApply(ItemStack item) { - if (item.getItem() instanceof ItemPickaxe || item.getItem() instanceof ItemSpade || item.getItem() instanceof ItemPrimalCrusher) - return true; - else - return false; + if (item.getItem() instanceof ItemPickaxe + || item.getItem() instanceof ItemSpade + || item.getItem() instanceof ItemPrimalCrusher) return true; + else return false; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCorrupting.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCorrupting.java index 56545da..db28064 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCorrupting.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentCorrupting.java @@ -29,14 +29,12 @@ public class EnchantmentCorrupting extends Enchantment { @Override public boolean canApply(ItemStack item) { - if (item.getItem() instanceof ItemPickaxe || item.getItem() instanceof ItemPrimalCrusher) - return true; - else - return false; + if (item.getItem() instanceof ItemPickaxe || item.getItem() instanceof ItemPrimalCrusher) return true; + else return false; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentEducational.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentEducational.java index 7097149..66f19cb 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentEducational.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentEducational.java @@ -17,11 +17,13 @@ public class EnchantmentEducational extends Enchantment { @Override public boolean canApplyTogether(Enchantment ench) { - return super.canApplyTogether(ench) && ench.effectId != Enchantment.looting.effectId && ench.effectId != DarkEnchantments.greedy.effectId; + return super.canApplyTogether(ench) + && ench.effectId != Enchantment.looting.effectId + && ench.effectId != DarkEnchantments.greedy.effectId; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentGreedy.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentGreedy.java index d227f9f..9b0f467 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentGreedy.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentGreedy.java @@ -27,11 +27,13 @@ public class EnchantmentGreedy extends Enchantment { @Override public boolean canApplyTogether(Enchantment ench) { - return super.canApplyTogether(ench) && ench.effectId != Enchantment.looting.effectId && ench.effectId != DarkEnchantments.educational.effectId; + return super.canApplyTogether(ench) + && ench.effectId != Enchantment.looting.effectId + && ench.effectId != DarkEnchantments.educational.effectId; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentImpact.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentImpact.java index f97d2db..e79709a 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentImpact.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentImpact.java @@ -36,4 +36,4 @@ public class EnchantmentImpact extends Enchantment { public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentVoid.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentVoid.java index 917862f..583f2fc 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentVoid.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentVoid.java @@ -2,13 +2,12 @@ package fox.spiteful.forbidden.enchantments; import fox.spiteful.forbidden.items.tools.ItemMorphAxe; import fox.spiteful.forbidden.items.tools.ItemMorphPickaxe; +import fox.spiteful.forbidden.items.tools.ItemMorphShovel; import fox.spiteful.forbidden.items.tools.ItemMorphSword; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; -import fox.spiteful.forbidden.items.tools.ItemMorphShovel; - public class EnchantmentVoid extends Enchantment { public EnchantmentVoid(int id) { super(id, 1, EnumEnchantmentType.digger); @@ -32,11 +31,14 @@ public class EnchantmentVoid extends Enchantment { @Override public boolean canApply(ItemStack item) { - return (item.getItem() instanceof ItemMorphPickaxe || item.getItem() instanceof ItemMorphAxe || item.getItem() instanceof ItemMorphSword || item.getItem() instanceof ItemMorphShovel); + return (item.getItem() instanceof ItemMorphPickaxe + || item.getItem() instanceof ItemMorphAxe + || item.getItem() instanceof ItemMorphSword + || item.getItem() instanceof ItemMorphShovel); } @Override public boolean canApplyAtEnchantingTable(ItemStack stack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentWrath.java b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentWrath.java index 312b6f7..20a52b1 100644 --- a/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentWrath.java +++ b/src/main/java/fox/spiteful/forbidden/enchantments/EnchantmentWrath.java @@ -7,13 +7,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -public class EnchantmentWrath extends Enchantment -{ - public EnchantmentWrath(int id) - { +public class EnchantmentWrath extends Enchantment { + public EnchantmentWrath(int id) { super(id, 1, EnumEnchantmentType.weapon); setName("wrath"); } @@ -21,41 +17,33 @@ public class EnchantmentWrath extends Enchantment /** * Returns the minimal value of enchantability needed on the enchantment level passed. */ - public int getMinEnchantability(int level) - { + public int getMinEnchantability(int level) { return 5 + (level - 1) * 11; } /** * Returns the maximum value of enchantability nedded on the enchantment level passed. */ - public int getMaxEnchantability(int level) - { + public int getMaxEnchantability(int level) { return this.getMinEnchantability(level) + 20; } /** * Returns the maximum level that the enchantment can have. */ - public int getMaxLevel() - { + public int getMaxLevel() { return 5; } - //Amount of bonus damage added by the enchant on hit - public float func_152376_a(int level, EnumCreatureAttribute target) - { - return (float)level * 1.25F; + // Amount of bonus damage added by the enchant on hit + public float func_152376_a(int level, EnumCreatureAttribute target) { + return (float) level * 1.25F; } - public boolean canApply(ItemStack stack) - { + public boolean canApply(ItemStack stack) { return stack.getItem() instanceof ItemAxe ? true : super.canApply(stack); } - //Effect that enchant does on hit - public void func_151368_a(EntityLivingBase wut, Entity who, int level) - { - - } -} \ No newline at end of file + // Effect that enchant does on hit + public void func_151368_a(EntityLivingBase wut, Entity who, int level) {} +} diff --git a/src/main/java/fox/spiteful/forbidden/items/ForbiddenItems.java b/src/main/java/fox/spiteful/forbidden/items/ForbiddenItems.java index 9d6a119..21edc5d 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ForbiddenItems.java +++ b/src/main/java/fox/spiteful/forbidden/items/ForbiddenItems.java @@ -1,13 +1,13 @@ package fox.spiteful.forbidden.items; -import java.util.Arrays; - +import cpw.mods.fml.common.registry.GameRegistry; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.compat.Compat; import fox.spiteful.forbidden.items.baubles.*; import fox.spiteful.forbidden.items.scribes.*; import fox.spiteful.forbidden.items.tools.*; -import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.items.wands.*; +import java.util.Arrays; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; @@ -22,8 +22,6 @@ import thaumcraft.api.wands.StaffRod; import thaumcraft.api.wands.WandCap; import thaumcraft.api.wands.WandRod; -import cpw.mods.fml.common.registry.GameRegistry; - public class ForbiddenItems { public static Item deadlyShards; public static Item gluttonyShard; @@ -115,38 +113,150 @@ public class ForbiddenItems { } fork = new ItemDiabolistFork(ThaumcraftApi.toolMatThaumium).setUnlocalizedName("DiabolistFork"); - if (Config.spork) - fork.setUnlocalizedName("DiabolistSpork"); + if (Config.spork) fork.setUnlocalizedName("DiabolistSpork"); GameRegistry.registerItem(fork, "DiabolistFork"); wandCore = new ItemWandCores().setUnlocalizedName("WandCores"); GameRegistry.registerItem(wandCore, "WandCores"); wandCap = new ItemWandCaps().setUnlocalizedName("WandCaps"); GameRegistry.registerItem(wandCap, "WandCaps"); - WAND_ROD_TAINTED = new WandRod("tainted", 150, new ItemStack(wandCore, 1, 0), 12, new TaintedWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_tainted.png")); - WAND_ROD_INFERNAL = new WandRod("infernal", 150, new ItemStack(wandCore, 1, 1), 12, new InfernalWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_infernal.png")); - WAND_ROD_NEUTRONIUM = new WandRod("neutronium", 9001, new ItemStack(Blocks.bedrock, 1), 1000, new CreativeWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_neutronium.png")); + WAND_ROD_TAINTED = new WandRod( + "tainted", + 150, + new ItemStack(wandCore, 1, 0), + 12, + new TaintedWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_tainted.png")); + WAND_ROD_INFERNAL = new WandRod( + "infernal", + 150, + new ItemStack(wandCore, 1, 1), + 12, + new InfernalWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_infernal.png")); + WAND_ROD_NEUTRONIUM = new WandRod( + "neutronium", + 9001, + new ItemStack(Blocks.bedrock, 1), + 1000, + new CreativeWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_neutronium.png")); WAND_ROD_NEUTRONIUM.setGlowing(true); - WAND_ROD_BLOOD = new WandRod("blood", 100, new ItemStack(wandCore, 1, 3), 12, new BloodWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_blood.png")); - WAND_ROD_WITCHWOOD = new WandRod("witchwood", 100, new ItemStack(wandCore, 1, 4), 12, new ManaWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_witchwood.png")); - WAND_ROD_LIVINGWOOD = new WandRod("livingwood", 100, new ItemStack(wandCore, 1, 7), 12, new YandereWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_livingwood.png")); - WAND_ROD_DREAMWOOD = new WandRod("dreamwood", 100, new ItemStack(wandCore, 1, 11), 12, new YandereWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_dreamwood.png")); - WAND_ROD_EQUIVALENT = new WandRod("equivalent", 100, new ItemStack(wandCore, 1, 11), 12, new ResourceLocation("forbidden", "textures/models/wand_rod_equivalent.png")); - WAND_ROD_PROFANE = new WandRod("profane", 50, new ItemStack(wandCore, 1, 5), 12, new ProfaneWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_profane.png")); - WAND_ROD_PROFANED = new WandRod("profaned", 50, new ItemStack(Blocks.bedrock, 1), 1000, new ResourceLocation("forbidden", "textures/models/wand_rod_profaned.png")); - STAFF_ROD_BLOOD = new StaffRod("blood", 50, new ItemStack(wandCore, 1, 9), 24, new BloodStaffUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_blood.png")); - STAFF_ROD_NEUTRONIUM = new StaffRod("neutronium", 9002, new ItemStack(Blocks.bedrock, 1), 1000, new CreativeWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_neutronium.png")); + WAND_ROD_BLOOD = new WandRod( + "blood", + 100, + new ItemStack(wandCore, 1, 3), + 12, + new BloodWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_blood.png")); + WAND_ROD_WITCHWOOD = new WandRod( + "witchwood", + 100, + new ItemStack(wandCore, 1, 4), + 12, + new ManaWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_witchwood.png")); + WAND_ROD_LIVINGWOOD = new WandRod( + "livingwood", + 100, + new ItemStack(wandCore, 1, 7), + 12, + new YandereWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_livingwood.png")); + WAND_ROD_DREAMWOOD = new WandRod( + "dreamwood", + 100, + new ItemStack(wandCore, 1, 11), + 12, + new YandereWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_dreamwood.png")); + WAND_ROD_EQUIVALENT = new WandRod( + "equivalent", + 100, + new ItemStack(wandCore, 1, 11), + 12, + new ResourceLocation("forbidden", "textures/models/wand_rod_equivalent.png")); + WAND_ROD_PROFANE = new WandRod( + "profane", + 50, + new ItemStack(wandCore, 1, 5), + 12, + new ProfaneWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_profane.png")); + WAND_ROD_PROFANED = new WandRod( + "profaned", + 50, + new ItemStack(Blocks.bedrock, 1), + 1000, + new ResourceLocation("forbidden", "textures/models/wand_rod_profaned.png")); + STAFF_ROD_BLOOD = new StaffRod( + "blood", + 50, + new ItemStack(wandCore, 1, 9), + 24, + new BloodStaffUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_blood.png")); + STAFF_ROD_NEUTRONIUM = new StaffRod( + "neutronium", + 9002, + new ItemStack(Blocks.bedrock, 1), + 1000, + new CreativeWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_neutronium.png")); STAFF_ROD_NEUTRONIUM.setGlowing(true); - STAFF_ROD_WITCHWOOD = new StaffRod("witchwood", 50, new ItemStack(wandCore, 1, 10), 24, new ManaStaffUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_witchwood.png")); - STAFF_ROD_DREAMWOOD = new StaffRod("dreamwood", 250, new ItemStack(wandCore, 1, 13), 25, new YandereWandUpdate(), new ResourceLocation("forbidden", "textures/models/wand_rod_dreamwood.png")); + STAFF_ROD_WITCHWOOD = new StaffRod( + "witchwood", + 50, + new ItemStack(wandCore, 1, 10), + 24, + new ManaStaffUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_witchwood.png")); + STAFF_ROD_DREAMWOOD = new StaffRod( + "dreamwood", + 250, + new ItemStack(wandCore, 1, 13), + 25, + new YandereWandUpdate(), + new ResourceLocation("forbidden", "textures/models/wand_rod_dreamwood.png")); STAFF_ROD_DREAMWOOD.setRunes(true); - WAND_CAP_ORICHALCUM = new DarkWandCap("orichalcum", 0.0F, new ItemStack(Blocks.command_block, 1), 1000, new ResourceLocation("forbidden", "textures/models/wand_cap_orichalcum.png")); - WAND_CAP_ALCHEMICAL = new DarkWandCap("alchemical", 0.9F, Arrays.asList(new Aspect[] { Aspect.WATER }), 0.8F, new ItemStack(wandCap, 1, 0), 7, new ResourceLocation("forbidden", "textures/models/wand_cap_alchemical.png")); - WAND_CAP_VINTEUM = new DarkWandCap("vinteum", 0.9F, new ItemStack(wandCap, 1, 1), 6, new ResourceLocation("forbidden", "textures/models/wand_cap_vinteum.png")); - WAND_CAP_MANASTEEL = new DarkWandCap("manasteel", 0.9F, new ItemStack(wandCap, 1, 3), 6, new ResourceLocation("forbidden", "textures/models/wand_cap_manasteel.png")); - WAND_CAP_ELEMENTIUM = new DarkWandCap("elementium", 0.8F, new ItemStack(wandCap, 1, 5), 9, new ResourceLocation("forbidden", "textures/models/wand_cap_elementium.png")); - WAND_CAP_TERRASTEEL = new DarkWandCap("terrasteel", 1.8F, new ItemStack(wandCap, 1, 2), 1, new ResourceLocation("forbidden", "textures/models/wand_cap_terrasteel.png")); - + WAND_CAP_ORICHALCUM = new DarkWandCap( + "orichalcum", + 0.0F, + new ItemStack(Blocks.command_block, 1), + 1000, + new ResourceLocation("forbidden", "textures/models/wand_cap_orichalcum.png")); + WAND_CAP_ALCHEMICAL = new DarkWandCap( + "alchemical", + 0.9F, + Arrays.asList(new Aspect[] {Aspect.WATER}), + 0.8F, + new ItemStack(wandCap, 1, 0), + 7, + new ResourceLocation("forbidden", "textures/models/wand_cap_alchemical.png")); + WAND_CAP_VINTEUM = new DarkWandCap( + "vinteum", + 0.9F, + new ItemStack(wandCap, 1, 1), + 6, + new ResourceLocation("forbidden", "textures/models/wand_cap_vinteum.png")); + WAND_CAP_MANASTEEL = new DarkWandCap( + "manasteel", + 0.9F, + new ItemStack(wandCap, 1, 3), + 6, + new ResourceLocation("forbidden", "textures/models/wand_cap_manasteel.png")); + WAND_CAP_ELEMENTIUM = new DarkWandCap( + "elementium", + 0.8F, + new ItemStack(wandCap, 1, 5), + 9, + new ResourceLocation("forbidden", "textures/models/wand_cap_elementium.png")); + WAND_CAP_TERRASTEEL = new DarkWandCap( + "terrasteel", + 1.8F, + new ItemStack(wandCap, 1, 2), + 1, + new ResourceLocation("forbidden", "textures/models/wand_cap_terrasteel.png")); resource = new ItemResource().setUnlocalizedName("FMResource"); GameRegistry.registerItem(resource, "FMResource"); @@ -180,10 +290,9 @@ public class ForbiddenItems { ridingCrop = new ItemRidingCrop(ToolMaterial.WOOD).setUnlocalizedName("RidingCrop"); GameRegistry.registerItem(ridingCrop, "RidingCrop"); - if(!Config.noLust) { + if (!Config.noLust) { subCollar = new ItemSubCollar().setUnlocalizedName("SubCollar"); GameRegistry.registerItem(subCollar, "SubCollar"); - } ringFood = new ItemRingNutrition().setUnlocalizedName("RingNutrition"); @@ -197,15 +306,15 @@ public class ForbiddenItems { blinkFocus = new ItemFocusBlink().setUnlocalizedName("BlinkFocus"); GameRegistry.registerItem(blinkFocus, "BlinkFocus"); - } - public static FocusUpgradeType getUpgrade(int id, ResourceLocation icon, String name, String text, AspectList aspects){ + public static FocusUpgradeType getUpgrade( + int id, ResourceLocation icon, String name, String text, AspectList aspects) { if (id >= FocusUpgradeType.types.length) { - FocusUpgradeType[] temp = new FocusUpgradeType[id+1]; + FocusUpgradeType[] temp = new FocusUpgradeType[id + 1]; System.arraycopy(FocusUpgradeType.types, 0, temp, 0, FocusUpgradeType.types.length); FocusUpgradeType.types = temp; } return new FocusUpgradeType(id, icon, name, text, aspects); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemArcaneCake.java b/src/main/java/fox/spiteful/forbidden/items/ItemArcaneCake.java index 9ce5e31..9217a71 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemArcaneCake.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemArcaneCake.java @@ -1,6 +1,9 @@ package fox.spiteful.forbidden.items; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.blocks.ForbiddenBlocks; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -10,18 +13,23 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import fox.spiteful.forbidden.blocks.ForbiddenBlocks; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemArcaneCake extends Item { public ItemArcaneCake() { this.setCreativeTab(Forbidden.tab); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World yWorld, int z, int par5, int par6, int par7, float par8, float par9, float par10) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World yWorld, + int z, + int par5, + int par6, + int par7, + float par8, + float par9, + float par10) { Block block = yWorld.getBlock(z, par5, par6); if (block == Blocks.snow_layer && (yWorld.getBlockMetadata(z, par5, par6) & 7) < 1) { @@ -67,7 +75,13 @@ public class ItemArcaneCake extends Item { cake.onPostBlockPlaced(yWorld, z, par5, par6, j1); } - yWorld.playSoundEffect((double) ((float) z + 0.5F), (double) ((float) par5 + 0.5F), (double) ((float) par6 + 0.5F), block.stepSound.soundName, (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + yWorld.playSoundEffect( + (double) ((float) z + 0.5F), + (double) ((float) par5 + 0.5F), + (double) ((float) par6 + 0.5F), + block.stepSound.soundName, + (block.stepSound.getVolume() + 1.0F) / 2.0F, + block.stepSound.getPitch() * 0.8F); --stack.stackSize; } } diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemDeadlyShard.java b/src/main/java/fox/spiteful/forbidden/items/ItemDeadlyShard.java index 086a070..8dc441b 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemDeadlyShard.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemDeadlyShard.java @@ -1,8 +1,10 @@ package fox.spiteful.forbidden.items; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -10,13 +12,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemDeadlyShard extends Item { - public static final String[] vices = new String[] { "wrath", "envy", "taint", "pride", "lust", "sloth", "greed" }; + public static final String[] vices = new String[] {"wrath", "envy", "taint", "pride", "lust", "sloth", "greed"}; @SideOnly(Side.CLIENT) public IIcon[] icons; @@ -26,8 +23,7 @@ public class ItemDeadlyShard extends Item { this.setHasSubtypes(true); this.setMaxDamage(0); this.setCreativeTab(Forbidden.tab); - if (Config.noLust) - vices[4] = "despair"; + if (Config.noLust) vices[4] = "despair"; } @SideOnly(Side.CLIENT) diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemDivineOrb.java b/src/main/java/fox/spiteful/forbidden/items/ItemDivineOrb.java index 68ae2a0..ac96942 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemDivineOrb.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemDivineOrb.java @@ -1,25 +1,23 @@ package fox.spiteful.forbidden.items; -import java.util.List; - +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.compat.Compat; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; 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.DamageSource; import net.minecraft.util.StatCollector; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.IWarpingGear; public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpingGear { @@ -40,15 +38,14 @@ public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpin list.add(StatCollector.translateToLocal("tooltip.divineorb")); if (!(stack.stackTagCompound == null)) { - list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + stack.stackTagCompound.getString("ownerName")); + list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + + stack.stackTagCompound.getString("ownerName")); } - } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (!Compat.bm) - return itemstack; + if (!Compat.bm) return itemstack; SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); @@ -56,7 +53,13 @@ public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpin double posX = player.posX; double posY = player.posY; double posZ = player.posZ; - world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + world.playSoundEffect( + (double) ((float) posX + 0.5F), + (double) ((float) posY + 0.5F), + (double) ((float) posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); } if (world.isRemote) { return itemstack; @@ -68,8 +71,7 @@ public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpin return itemstack; } - if(itemTag.getString("ownerName").equals(SoulNetworkHandler.getUsername(player))) - { + if (itemTag.getString("ownerName").equals(SoulNetworkHandler.getUsername(player))) { SoulNetworkHandler.setMaxOrbToMax(itemTag.getString("ownerName"), 6); } @@ -100,45 +102,34 @@ public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpin } @Override - public boolean hasContainerItem() - { + public boolean hasContainerItem() { return true; } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { + public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } - private void hurtPlayer(EntityPlayer user, int energySyphoned) - { - if (energySyphoned < 100 && energySyphoned > 0) - { - if (!user.capabilities.isCreativeMode) - { + private void hurtPlayer(EntityPlayer user, int energySyphoned) { + if (energySyphoned < 100 && energySyphoned > 0) { + if (!user.capabilities.isCreativeMode) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.func_110142_aN().func_94547_a(new DamageSource("blooderp"), 1, 1); user.onDeath(new DamageSource("blooderp")); } } - } else if (energySyphoned >= 100) - { - if (!user.capabilities.isCreativeMode) - { - for (int i = 0; i < ((energySyphoned + 99) / 100); i++) - { + } else if (energySyphoned >= 100) { + if (!user.capabilities.isCreativeMode) { + for (int i = 0; i < ((energySyphoned + 99) / 100); i++) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.func_110142_aN().func_94547_a(new DamageSource("blooderp"), 1, 1); user.onDeath(new DamageSource("blooderp")); break; @@ -147,4 +138,4 @@ public class ItemDivineOrb extends Item implements IBloodOrb, IBindable, IWarpin } } } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemFruitTainted.java b/src/main/java/fox/spiteful/forbidden/items/ItemFruitTainted.java index bc51dfa..5694c0e 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemFruitTainted.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemFruitTainted.java @@ -20,18 +20,19 @@ import thaumcraft.common.lib.potions.PotionThaumarhia; public class ItemFruitTainted extends ItemFood { - public ItemFruitTainted(){ + public ItemFruitTainted() { super(4, 0.8F, false); setCreativeTab(Forbidden.tab); } public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { - if(!world.isRemote && player instanceof EntityPlayerMP) { + if (!world.isRemote && player instanceof EntityPlayerMP) { Thaumcraft.addStickyWarpToPlayer(player, 1); player.addPotionEffect(getEffect(PotionFluxTaint.instance.id, 600, false)); player.addPotionEffect(getEffect(Potion.hunger.id, 600, false)); - if(world.rand.nextFloat() < 0.4F){ - player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("warp.text.15"))); + if (world.rand.nextFloat() < 0.4F) { + player.addChatMessage(new ChatComponentText( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("warp.text.15"))); player.addPotionEffect(getEffect(PotionThaumarhia.instance.id, 600, true)); } } @@ -44,10 +45,9 @@ public class ItemFruitTainted extends ItemFood { this.itemIcon = iconRegister.registerIcon("forbidden:taint_fruit"); } - private PotionEffect getEffect(int id, int duration, boolean ambient){ + private PotionEffect getEffect(int id, int duration, boolean ambient) { PotionEffect potion = new PotionEffect(id, duration, 0, ambient); potion.getCurativeItems().clear(); return potion; } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemGluttonyShard.java b/src/main/java/fox/spiteful/forbidden/items/ItemGluttonyShard.java index 611309b..f5be86b 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemGluttonyShard.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemGluttonyShard.java @@ -1,13 +1,12 @@ package fox.spiteful.forbidden.items; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemFood; import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemGluttonyShard extends ItemFood { IIcon icon; @@ -27,4 +26,4 @@ public class ItemGluttonyShard extends ItemFood { public IIcon getIconFromDamage(int par1) { return this.icon; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemMobCrystal.java b/src/main/java/fox/spiteful/forbidden/items/ItemMobCrystal.java index 6f928a0..4c06fcf 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemMobCrystal.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemMobCrystal.java @@ -1,8 +1,10 @@ package fox.spiteful.forbidden.items; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -13,11 +15,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import thaumcraft.api.aspects.Aspect; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemMobCrystal extends Item { IIcon[] icons; @@ -34,13 +31,12 @@ public class ItemMobCrystal extends Item { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean z) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); - if(nbttagcompound.hasKey("mob")) { + if (nbttagcompound.hasKey("mob")) { String string = nbttagcompound.getString("mob"); if (string != null) { Aspect mobAspect = Config.spawnerMobs.get(string); - if (mobAspect != null) - list.add(mobAspect.getName()); + if (mobAspect != null) list.add(mobAspect.getName()); } } } @@ -62,8 +58,7 @@ public class ItemMobCrystal extends Item { NBTTagCompound nbttagcompound = stack.getTagCompound(); String string = nbttagcompound.getString("mob"); - if (string != null) - return icons[1]; + if (string != null) return icons[1]; } return icons[0]; @@ -74,8 +69,7 @@ public class ItemMobCrystal extends Item { public IIcon getIconIndex(ItemStack stack) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); - if (nbttagcompound.hasKey("mob")) - return icons[1]; + if (nbttagcompound.hasKey("mob")) return icons[1]; } return icons[0]; @@ -98,11 +92,15 @@ public class ItemMobCrystal extends Item { public String getItemStackDisplayName(ItemStack stack) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); - if(nbttagcompound.hasKey("mob")) { + if (nbttagcompound.hasKey("mob")) { String string = nbttagcompound.getString("mob"); if (string != null) - return ("" + StatCollector.translateToLocal("item.MobCrystal.name").replace("%s", StatCollector.translateToLocal("entity." + string + ".name"))).trim(); + return ("" + + StatCollector.translateToLocal("item.MobCrystal.name") + .replace( + "%s", StatCollector.translateToLocal("entity." + string + ".name"))) + .trim(); } } diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemResource.java b/src/main/java/fox/spiteful/forbidden/items/ItemResource.java index 54743bc..5d7310a 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemResource.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemResource.java @@ -1,8 +1,9 @@ package fox.spiteful.forbidden.items; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -11,10 +12,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemResource extends Item { @SideOnly(Side.CLIENT) @@ -47,7 +44,7 @@ public class ItemResource extends Item { @Override public String getUnlocalizedName(ItemStack stack) { - //int i = MathHelper.clamp_int(stack.getItemDamage(), 0, 3); + // int i = MathHelper.clamp_int(stack.getItemDamage(), 0, 3); int i = stack.getItemDamage(); return super.getUnlocalizedName() + "." + i; } diff --git a/src/main/java/fox/spiteful/forbidden/items/ItemTaintCoal.java b/src/main/java/fox/spiteful/forbidden/items/ItemTaintCoal.java index d986787..d4aa651 100644 --- a/src/main/java/fox/spiteful/forbidden/items/ItemTaintCoal.java +++ b/src/main/java/fox/spiteful/forbidden/items/ItemTaintCoal.java @@ -8,7 +8,7 @@ import net.minecraft.item.Item; public class ItemTaintCoal extends Item { - public ItemTaintCoal(){ + public ItemTaintCoal() { super(); setCreativeTab(Forbidden.tab); } diff --git a/src/main/java/fox/spiteful/forbidden/items/baubles/ItemRingNutrition.java b/src/main/java/fox/spiteful/forbidden/items/baubles/ItemRingNutrition.java index b6f736c..226beec 100644 --- a/src/main/java/fox/spiteful/forbidden/items/baubles/ItemRingNutrition.java +++ b/src/main/java/fox/spiteful/forbidden/items/baubles/ItemRingNutrition.java @@ -7,6 +7,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.compat.Compat; +import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -14,21 +15,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import thaumcraft.api.IRunicArmor; -import thaumcraft.api.aspects.Aspect; import vazkii.botania.api.item.ICosmeticAttachable; -import java.util.Iterator; -import java.util.List; - @Optional.Interface(iface = "vazkii.botania.api.item.ICosmeticAttachable", modid = "Botania") public class ItemRingNutrition extends Item implements IRunicArmor, IBauble, ICosmeticAttachable { IIcon icon; - public ItemRingNutrition(){ + public ItemRingNutrition() { super(); maxStackSize = 1; setCreativeTab(Forbidden.tab); @@ -46,45 +42,43 @@ public class ItemRingNutrition extends Item implements IRunicArmor, IBauble, ICo return icon; } - public BaubleType getBaubleType(ItemStack itemstack){ + public BaubleType getBaubleType(ItemStack itemstack) { return BaubleType.RING; } - public void onWornTick(ItemStack itemstack, EntityLivingBase player){} - public void onEquipped(ItemStack itemstack, EntityLivingBase player){} - public void onUnequipped(ItemStack itemstack, EntityLivingBase player){} + public void onWornTick(ItemStack itemstack, EntityLivingBase player) {} - public boolean canEquip(ItemStack itemstack, EntityLivingBase player){ + public void onEquipped(ItemStack itemstack, EntityLivingBase player) {} + + public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {} + + public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { return true; } - public boolean canUnequip(ItemStack itemstack, EntityLivingBase player){ + public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) { return true; } - public int getRunicCharge(ItemStack itemstack){ + public int getRunicCharge(ItemStack itemstack) { return 0; } @Override public ItemStack getCosmeticItem(ItemStack stack) { - if(stack == null || stack.getTagCompound() == null) - return null; - if(!stack.getTagCompound().hasKey("cosmeticItem")) - return null; + if (stack == null || stack.getTagCompound() == null) return null; + if (!stack.getTagCompound().hasKey("cosmeticItem")) return null; NBTTagCompound cosmetic = stack.getTagCompound().getCompoundTag("cosmeticItem"); return ItemStack.loadItemStackFromNBT(cosmetic); } @Override public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) { - if(stack == null) - return; + if (stack == null) return; NBTTagCompound cmp = new NBTTagCompound(); - if(cosmetic != null) - cosmetic.writeToNBT(cmp); + if (cosmetic != null) cosmetic.writeToNBT(cmp); NBTTagCompound tag = stack.getTagCompound(); - if(tag == null){ + if (tag == null) { tag = new NBTTagCompound(); stack.setTagCompound(tag); } @@ -95,8 +89,10 @@ public class ItemRingNutrition extends Item implements IRunicArmor, IBauble, ICo @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { - if(Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null) - list.add(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), getCosmeticItem(stack).getDisplayName()).replaceAll("&", "\u00a7")); - + if (Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null) + list.add(String.format( + StatCollector.translateToLocal("botaniamisc.hasCosmetic"), + getCosmeticItem(stack).getDisplayName()) + .replaceAll("&", "\u00a7")); } } diff --git a/src/main/java/fox/spiteful/forbidden/items/baubles/ItemSubCollar.java b/src/main/java/fox/spiteful/forbidden/items/baubles/ItemSubCollar.java index 38296a3..3ca2c78 100644 --- a/src/main/java/fox/spiteful/forbidden/items/baubles/ItemSubCollar.java +++ b/src/main/java/fox/spiteful/forbidden/items/baubles/ItemSubCollar.java @@ -6,6 +6,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.compat.Compat; +import java.text.DecimalFormat; +import java.util.Iterator; +import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -24,17 +27,13 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.common.items.baubles.ItemAmuletVis; import vazkii.botania.api.item.ICosmeticAttachable; -import java.text.DecimalFormat; -import java.util.Iterator; -import java.util.List; - @Optional.Interface(iface = "vazkii.botania.api.item.ICosmeticAttachable", modid = "Botania") public class ItemSubCollar extends ItemAmuletVis implements ICosmeticAttachable { public IIcon icon; DecimalFormat myFormatter = new DecimalFormat("#######.##"); - public ItemSubCollar(){ + public ItemSubCollar() { super(); maxStackSize = 1; setCreativeTab(Forbidden.tab); @@ -74,55 +73,61 @@ public class ItemSubCollar extends ItemAmuletVis implements ICosmeticAttachable @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { - list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.capacity.text") + " " + this.getMaxVis(stack) / 100); - if(stack.hasTagCompound()) { + list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.capacity.text") + " " + + this.getMaxVis(stack) / 100); + if (stack.hasTagCompound()) { Iterator count = Aspect.getPrimalAspects().iterator(); - while(count.hasNext()) { - Aspect aspect = (Aspect)count.next(); - if(stack.stackTagCompound.hasKey(aspect.getTag())) { - String amount = this.myFormatter.format((double)((float)stack.stackTagCompound.getInteger(aspect.getTag()) / 100.0F)); - list.add("\u00a7" + aspect.getChatcolor() + aspect.getName() + EnumChatFormatting.RESET + " x " + amount); + while (count.hasNext()) { + Aspect aspect = (Aspect) count.next(); + if (stack.stackTagCompound.hasKey(aspect.getTag())) { + String amount = this.myFormatter.format( + (double) ((float) stack.stackTagCompound.getInteger(aspect.getTag()) / 100.0F)); + list.add("\u00a7" + aspect.getChatcolor() + aspect.getName() + EnumChatFormatting.RESET + " x " + + amount); } } - if(stack.stackTagCompound.hasKey("owner")) - list.add(StatCollector.translateToLocal("tooltip.collar.owner") + " " + stack.stackTagCompound.getString("owner")); - - if(Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null) - list.add(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), getCosmeticItem(stack).getDisplayName()).replaceAll("&", "\u00a7")); + if (stack.stackTagCompound.hasKey("owner")) + list.add(StatCollector.translateToLocal("tooltip.collar.owner") + " " + + stack.stackTagCompound.getString("owner")); + if (Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null) + list.add(String.format( + StatCollector.translateToLocal("botaniamisc.hasCosmetic"), + getCosmeticItem(stack).getDisplayName()) + .replaceAll("&", "\u00a7")); } - } /** * Returns true if the item can be used on the given entity, e.g. shears on sheep. */ @Override - public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) - { - if (entity.worldObj.isRemote) - { + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { + if (entity.worldObj.isRemote) { return false; } - if (entity instanceof EntityPlayer) - { - EntityPlayer sub = (EntityPlayer)entity; + if (entity instanceof EntityPlayer) { + EntityPlayer sub = (EntityPlayer) entity; IInventory baubles = BaublesApi.getBaubles(sub); - if(baubles.getStackInSlot(0) == null) { - if(!itemstack.hasTagCompound()){ + if (baubles.getStackInSlot(0) == null) { + if (!itemstack.hasTagCompound()) { NBTTagCompound tag = new NBTTagCompound(); itemstack.setTagCompound(tag); } itemstack.stackTagCompound.setString("owner", player.getDisplayName()); baubles.setInventorySlotContents(0, itemstack.copy()); itemstack.stackSize = 0; - sub.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.placescollar").replace("%s", player.getDisplayName()))); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.youplacecollar").replace("%s", sub.getDisplayName()))); + sub.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.placescollar") + .replace("%s", player.getDisplayName()))); + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.collar.youplacecollar") + .replace("%s", sub.getDisplayName()))); return true; - } - else - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.alreadywearing").replace("%s", sub.getDisplayName()))); + } else + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.collar.alreadywearing") + .replace("%s", sub.getDisplayName()))); } return false; } @@ -135,28 +140,23 @@ public class ItemSubCollar extends ItemAmuletVis implements ICosmeticAttachable @Override public ItemStack getCosmeticItem(ItemStack stack) { - if(stack == null || stack.getTagCompound() == null) - return null; - if(!stack.getTagCompound().hasKey("cosmeticItem")) - return null; + if (stack == null || stack.getTagCompound() == null) return null; + if (!stack.getTagCompound().hasKey("cosmeticItem")) return null; NBTTagCompound cosmetic = stack.getTagCompound().getCompoundTag("cosmeticItem"); return ItemStack.loadItemStackFromNBT(cosmetic); } @Override public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) { - if(stack == null) - return; + if (stack == null) return; NBTTagCompound cmp = new NBTTagCompound(); - if(cosmetic != null) - cosmetic.writeToNBT(cmp); + if (cosmetic != null) cosmetic.writeToNBT(cmp); NBTTagCompound tag = stack.getTagCompound(); - if(tag == null){ + if (tag == null) { tag = new NBTTagCompound(); stack.setTagCompound(tag); } tag.setTag("cosmeticItem", cmp); } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBloodwell.java b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBloodwell.java index 2a23f8d..d60022a 100644 --- a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBloodwell.java +++ b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBloodwell.java @@ -1,23 +1,21 @@ package fox.spiteful.forbidden.items.scribes; -import java.util.List; - +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.compat.Compat; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import thaumcraft.api.IScribeTools; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemBloodwell extends Item implements IScribeTools, IBindable { @@ -48,13 +46,10 @@ public class ItemBloodwell extends Item implements IScribeTools, IBindable { public void onUpdate(ItemStack stack, World world, Entity fauxplayer, int z, boolean par5) { if (Compat.bm && stack.getItemDamage() > 0 && stack.hasTagCompound()) { EntityPlayer player = null; - if (fauxplayer instanceof EntityPlayer) - player = (EntityPlayer) fauxplayer; - else - return; + if (fauxplayer instanceof EntityPlayer) player = (EntityPlayer) fauxplayer; + else return; - if (player.capabilities.isCreativeMode) - stack.setItemDamage(0); + if (player.capabilities.isCreativeMode) stack.setItemDamage(0); else if (SoulNetworkHandler.syphonFromNetwork(stack, 25) > 0) stack.setItemDamage(stack.getItemDamage() - 1); else if (player.getHealth() > 6) { @@ -66,7 +61,7 @@ public class ItemBloodwell extends Item implements IScribeTools, IBindable { @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); + SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); return itemstack; } @@ -74,18 +69,16 @@ public class ItemBloodwell extends Item implements IScribeTools, IBindable { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean z) { if (stack.hasTagCompound()) { list.add(""); - list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + stack.stackTagCompound.getString("ownerName")); + list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + + stack.stackTagCompound.getString("ownerName")); } } @Override public void setDamage(ItemStack stack, int damage) { if (damage > 0) { - if (SoulNetworkHandler.syphonFromNetwork(stack, 25 * damage) > 0) - super.setDamage(stack, 0); - else - super.setDamage(stack, damage); - } else - super.setDamage(stack, damage); + if (SoulNetworkHandler.syphonFromNetwork(stack, 25 * damage) > 0) super.setDamage(stack, 0); + else super.setDamage(stack, damage); + } else super.setDamage(stack, damage); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBoundwell.java b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBoundwell.java index b86a9ea..c7eaf9c 100644 --- a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBoundwell.java +++ b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemBoundwell.java @@ -5,6 +5,8 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import java.util.Iterator; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -20,10 +22,7 @@ import thaumcraft.common.lib.network.PacketHandler; import thaumcraft.common.lib.network.playerdata.PacketAspectPool; import thaumcraft.common.lib.research.ResearchManager; -import java.util.Iterator; -import java.util.List; - -public class ItemBoundwell extends Item implements IScribeTools, IBindable{ +public class ItemBoundwell extends Item implements IScribeTools, IBindable { @SideOnly(Side.CLIENT) public IIcon icon; @@ -53,22 +52,26 @@ public class ItemBoundwell extends Item implements IScribeTools, IBindable{ if (itemstack.getItemDamage() >= 100) { player.swingItem(); if (!world.isRemote) { - if (player.capabilities.isCreativeMode) - itemstack.setItemDamage(0); + if (player.capabilities.isCreativeMode) itemstack.setItemDamage(0); else { SoulNetworkHandler.syphonAndDamageFromNetwork(itemstack, player, 10000); - if(player.getHealth() > 0){ + if (player.getHealth() > 0) { itemstack.setItemDamage(0); - } - else - return itemstack; + } else return itemstack; } Aspect aspect; short amount; - for(Iterator count = Aspect.getPrimalAspects().iterator(); count.hasNext(); PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), Short.valueOf(amount), Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP)player)) - { - aspect = (Aspect)count.next(); - amount = (short)(world.rand.nextInt(4) + 4); + for (Iterator count = Aspect.getPrimalAspects().iterator(); + count.hasNext(); + PacketHandler.INSTANCE.sendTo( + new PacketAspectPool( + aspect.getTag(), + Short.valueOf(amount), + Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor( + player.getCommandSenderName(), aspect))), + (EntityPlayerMP) player)) { + aspect = (Aspect) count.next(); + amount = (short) (world.rand.nextInt(4) + 4); Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount); ResearchManager.scheduleSave(player); } @@ -81,7 +84,8 @@ public class ItemBoundwell extends Item implements IScribeTools, IBindable{ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean z) { if (stack.hasTagCompound()) { list.add(""); - list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + stack.stackTagCompound.getString("ownerName")); + list.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + + stack.stackTagCompound.getString("ownerName")); } } @@ -93,5 +97,4 @@ public class ItemBoundwell extends Item implements IScribeTools, IBindable{ public boolean hasEffect(ItemStack stack, int pass) { return stack.getItemDamage() >= 100; } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemCrystalwell.java b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemCrystalwell.java index 5aa195b..9ed1e7e 100644 --- a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemCrystalwell.java +++ b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemCrystalwell.java @@ -1,19 +1,17 @@ package fox.spiteful.forbidden.items.scribes; -import java.util.Iterator; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; -import fox.spiteful.forbidden.LogHandler; +import java.util.Iterator; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import org.apache.logging.log4j.Level; import thaumcraft.api.IScribeTools; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.Thaumcraft; @@ -21,9 +19,6 @@ import thaumcraft.common.config.Config; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.lib.network.PacketHandler; import thaumcraft.common.lib.network.playerdata.PacketAspectPool; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.common.lib.research.ResearchManager; public class ItemCrystalwell extends Item implements IScribeTools { @@ -34,13 +29,10 @@ public class ItemCrystalwell extends Item implements IScribeTools { public ItemCrystalwell() { maxStackSize = 1; canRepair = false; - if(Config.researchDifficulty == -1) - setMaxDamage(50); - else - setMaxDamage(100); + if (Config.researchDifficulty == -1) setMaxDamage(50); + else setMaxDamage(100); setCreativeTab(Forbidden.tab); setHasSubtypes(false); - } @SideOnly(Side.CLIENT) @@ -61,35 +53,46 @@ public class ItemCrystalwell extends Item implements IScribeTools { if (!world.isRemote) { Aspect aspect; short amount; - for(Iterator count = Aspect.getPrimalAspects().iterator(); count.hasNext(); PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), Short.valueOf(amount), Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP)player)) - { - aspect = (Aspect)count.next(); - amount = (short)(world.rand.nextInt(4) + 4); + for (Iterator count = Aspect.getPrimalAspects().iterator(); + count.hasNext(); + PacketHandler.INSTANCE.sendTo( + new PacketAspectPool( + aspect.getTag(), + Short.valueOf(amount), + Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor( + player.getCommandSenderName(), aspect))), + (EntityPlayerMP) player)) { + aspect = (Aspect) count.next(); + amount = (short) (world.rand.nextInt(4) + 4); Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount); ResearchManager.scheduleSave(player); } } player.swingItem(); return new ItemStack(ConfigItems.itemInkwell, 1, 100); - } else - return stack; + } else return stack; } @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) { - if(world.isRemote) - return; - if(Config.researchDifficulty == -1 && entity.ticksExisted % 200 == 0 && (entity instanceof EntityPlayer)){ - EntityPlayer player = (EntityPlayer)entity; - Aspect aspect = (Aspect)Aspect.getPrimalAspects().get(world.rand.nextInt(6)); - short amount = (short)(world.rand.nextInt(4) + 1); + if (world.isRemote) return; + if (Config.researchDifficulty == -1 && entity.ticksExisted % 200 == 0 && (entity instanceof EntityPlayer)) { + EntityPlayer player = (EntityPlayer) entity; + Aspect aspect = (Aspect) Aspect.getPrimalAspects().get(world.rand.nextInt(6)); + short amount = (short) (world.rand.nextInt(4) + 1); Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount); - PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), amount, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player); + PacketHandler.INSTANCE.sendTo( + new PacketAspectPool( + aspect.getTag(), + amount, + Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor( + player.getCommandSenderName(), aspect))), + (EntityPlayerMP) player); ResearchManager.scheduleSave(player); stack.setItemDamage(stack.getItemDamage() + 1); - if(stack.getItemDamage() >= stack.getMaxDamage()) - ((EntityPlayer)entity).inventory.setInventorySlotContents(slot, null); + if (stack.getItemDamage() >= stack.getMaxDamage()) + ((EntityPlayer) entity).inventory.setInventorySlotContents(slot, null); } } @@ -101,5 +104,4 @@ public class ItemCrystalwell extends Item implements IScribeTools { public boolean hasEffect(ItemStack stack, int pass) { return Config.researchDifficulty != -1 && stack.getItemDamage() >= 100; } - -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemPrimewell.java b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemPrimewell.java index d909a5d..d378a1f 100644 --- a/src/main/java/fox/spiteful/forbidden/items/scribes/ItemPrimewell.java +++ b/src/main/java/fox/spiteful/forbidden/items/scribes/ItemPrimewell.java @@ -4,22 +4,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.world.World; import thaumcraft.api.IScribeTools; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.config.ConfigItems; -import thaumcraft.common.lib.network.PacketHandler; -import thaumcraft.common.lib.network.playerdata.PacketAspectPool; -import thaumcraft.common.lib.research.ResearchManager; - -import java.util.Iterator; public class ItemPrimewell extends Item implements IScribeTools { @@ -32,7 +21,6 @@ public class ItemPrimewell extends Item implements IScribeTools { setMaxDamage(100); setCreativeTab(Forbidden.tab); setHasSubtypes(false); - } @SideOnly(Side.CLIENT) @@ -48,12 +36,12 @@ public class ItemPrimewell extends Item implements IScribeTools { } @Override - public EnumRarity getRarity(ItemStack stack){ + public EnumRarity getRarity(ItemStack stack) { return EnumRarity.epic; } @Override - public void setDamage(ItemStack stack, int damage){ + public void setDamage(ItemStack stack, int damage) { super.setDamage(stack, 0); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemBloodRapier.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemBloodRapier.java index 49a6d8d..0be3ac5 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemBloodRapier.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemBloodRapier.java @@ -20,12 +20,12 @@ import thaumcraft.api.IRepairable; import thaumcraft.api.IWarpingGear; import thaumcraft.common.config.ConfigItems; -public class ItemBloodRapier extends ItemSword implements IRepairable, IWarpingGear{ +public class ItemBloodRapier extends ItemSword implements IRepairable, IWarpingGear { static final ToolMaterial bloodsucker = EnumHelper.addToolMaterial("BLOODSUCKER", 3, 700, 10F, -3F, 18); private IIcon icon; - public ItemBloodRapier(){ + public ItemBloodRapier() { super(bloodsucker); } @@ -33,16 +33,13 @@ public class ItemBloodRapier extends ItemSword implements IRepairable, IWarpingG public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) { stack.damageItem(1, player); victim.motionY *= 0.8; - if (victim.hurtResistantTime > 18) - victim.hurtResistantTime -= 5; + if (victim.hurtResistantTime > 18) victim.hurtResistantTime -= 5; if (Compat.bm & victim instanceof EntityPlayer) { String target = ((EntityPlayer) victim).getDisplayName(); int lp = SoulNetworkHandler.getCurrentEssence(target); int damage = Math.max(4000, lp / 4); - if (lp >= damage) - lp -= damage; - else - lp = 0; + if (lp >= damage) lp -= damage; + else lp = 0; SoulNetworkHandler.setCurrentEssence(target, lp); victim.addPotionEffect(new PotionEffect(DarkPotions.bloodSeal.getId(), 1200)); } @@ -52,8 +49,11 @@ public class ItemBloodRapier extends ItemSword implements IRepairable, IWarpingG @Override public void onUpdate(ItemStack stack, World world, Entity entity, int wat, boolean fuckObfuscation) { super.onUpdate(stack, world, entity, wat, fuckObfuscation); - if(stack.isItemDamaged() && entity != null && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase) { - stack.damageItem(-1, (EntityLivingBase)entity); + if (stack.isItemDamaged() + && entity != null + && entity.ticksExisted % 20 == 0 + && entity instanceof EntityLivingBase) { + stack.damageItem(-1, (EntityLivingBase) entity); } } @@ -76,7 +76,9 @@ public class ItemBloodRapier extends ItemSword implements IRepairable, IWarpingG @Override public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { - return par2ItemStack.isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 15))?true:super.getIsRepairable(par1ItemStack, par2ItemStack); + return par2ItemStack.isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 15)) + ? true + : super.getIsRepairable(par1ItemStack, par2ItemStack); } @Override diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemDiabolistFork.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemDiabolistFork.java index 1bf0319..bcd7d16 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemDiabolistFork.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemDiabolistFork.java @@ -1,5 +1,8 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -12,11 +15,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.api.IRepairable; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemDiabolistFork extends ItemSword implements IRepairable { public IIcon icon; @@ -29,10 +27,8 @@ public class ItemDiabolistFork extends ItemSword implements IRepairable { @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister ir) { - if (Config.spork) - this.icon = ir.registerIcon("forbidden:spork"); - else - this.icon = ir.registerIcon("forbidden:fork"); + if (Config.spork) this.icon = ir.registerIcon("forbidden:spork"); + else this.icon = ir.registerIcon("forbidden:fork"); } @Override @@ -70,4 +66,4 @@ public class ItemDiabolistFork extends ItemSword implements IRepairable { public boolean canHarvestBlock(Block block, ItemStack itemStack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphAxe.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphAxe.java index 7f728fd..4104896 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphAxe.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphAxe.java @@ -1,6 +1,9 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; @@ -15,11 +18,6 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.api.IRepairable; - -import fox.spiteful.forbidden.enchantments.DarkEnchantments; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.IWarpingGear; public class ItemMorphAxe extends ItemAxe implements IRepairable, IWarpingGear { @@ -48,50 +46,53 @@ public class ItemMorphAxe extends ItemAxe implements IRepairable, IWarpingGear { } public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) ? true : super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) + ? true + : super.getIsRepairable(stack, stack2); } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (player.isSneaking() && itemstack.hasTagCompound() && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { + if (player.isSneaking() + && itemstack.hasTagCompound() + && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { NBTTagCompound tags = itemstack.getTagCompound(); byte phase = tags.getByte("phase"); - if(tags.hasKey("ench")){ + if (tags.hasKey("ench")) { NBTTagList enchants = itemstack.getEnchantmentTagList(); tags.setTag("enchants" + phase, enchants); - } - else - tags.removeTag("enchants" + phase); + } else tags.removeTag("enchants" + phase); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name"); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name" + phase, name); - else - tags.getCompoundTag("display").removeTag("Name" + phase); + else tags.getCompoundTag("display").removeTag("Name" + phase); } - if (++phase > 2) - phase = 0; + if (++phase > 2) phase = 0; tags.setByte("phase", phase); - if(tags.hasKey("enchants" + phase)) { + if (tags.hasKey("enchants" + phase)) { NBTTagList enchants = (NBTTagList) (tags.getTag("enchants" + phase)); tags.setTag("ench", enchants); - } - else - tags.removeTag("ench"); + } else tags.removeTag("ench"); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name" + phase); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name", name); - else - tags.getCompoundTag("display").removeTag("Name"); + else tags.getCompoundTag("display").removeTag("Name"); } itemstack.setTagCompound(tags); itemstack.damageItem(5, player); player.swingItem(); - world.playSoundEffect(player.posX, player.posY, player.posZ, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + world.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "thaumcraft:wandfail", + 0.2F, + 0.2F + world.rand.nextFloat() * 0.2F); } return itemstack; } @@ -99,18 +100,13 @@ public class ItemMorphAxe extends ItemAxe implements IRepairable, IWarpingGear { @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemstack, int renderpass) { - if (renderpass != 1) - return 16777215; + if (renderpass != 1) return 16777215; else { - if (!itemstack.hasTagCompound()) - return 0x980000; + if (!itemstack.hasTagCompound()) return 0x980000; byte phase = itemstack.getTagCompound().getByte("phase"); - if (phase == 1) - return 0x0010CC; - else if (phase == 2) - return 0xE5DA00; - else - return 0x980000; + if (phase == 1) return 0x0010CC; + else if (phase == 2) return 0xE5DA00; + else return 0x980000; } } @@ -121,17 +117,17 @@ public class ItemMorphAxe extends ItemAxe implements IRepairable, IWarpingGear { public void onUpdate(ItemStack stack, World world, Entity entity, int fuckObfuscation, boolean fuckObfuscation2) { super.onUpdate(stack, world, entity, fuckObfuscation, fuckObfuscation2); - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 && stack.isItemDamaged() && entity != null && entity.ticksExisted % 10 == 0 && entity instanceof EntityLivingBase) { - stack.damageItem(-1, (EntityLivingBase)entity); + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 + && stack.isItemDamaged() + && entity != null + && entity.ticksExisted % 10 == 0 + && entity instanceof EntityLivingBase) { + stack.damageItem(-1, (EntityLivingBase) entity); } - } public int getWarp(ItemStack itemstack, EntityPlayer player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) - return 1; - else - return 0; + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) return 1; + else return 0; } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphPickaxe.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphPickaxe.java index d1341ad..5e6a786 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphPickaxe.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphPickaxe.java @@ -1,5 +1,9 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -7,29 +11,18 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import thaumcraft.api.IRepairable; -import thaumcraft.common.lib.utils.BlockUtils; - -import fox.spiteful.forbidden.Forbidden; -import fox.spiteful.forbidden.enchantments.DarkEnchantments; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.IWarpingGear; - -import java.util.List; +import thaumcraft.common.lib.utils.BlockUtils; public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpingGear { public IIcon[] icon; @@ -62,50 +55,53 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi @Override public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) ? true : super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) + ? true + : super.getIsRepairable(stack, stack2); } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (player.isSneaking() && itemstack.hasTagCompound() && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { + if (player.isSneaking() + && itemstack.hasTagCompound() + && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { NBTTagCompound tags = itemstack.getTagCompound(); byte phase = tags.getByte("phase"); - if(tags.hasKey("ench")){ + if (tags.hasKey("ench")) { NBTTagList enchants = itemstack.getEnchantmentTagList(); tags.setTag("enchants" + phase, enchants); - } - else - tags.removeTag("enchants" + phase); + } else tags.removeTag("enchants" + phase); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name"); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name" + phase, name); - else - tags.getCompoundTag("display").removeTag("Name" + phase); + else tags.getCompoundTag("display").removeTag("Name" + phase); } - if (++phase > 2) - phase = 0; + if (++phase > 2) phase = 0; tags.setByte("phase", phase); - if(tags.hasKey("enchants" + phase)) { + if (tags.hasKey("enchants" + phase)) { NBTTagList enchants = (NBTTagList) (tags.getTag("enchants" + phase)); tags.setTag("ench", enchants); - } - else - tags.removeTag("ench"); + } else tags.removeTag("ench"); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name" + phase); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name", name); - else - tags.getCompoundTag("display").removeTag("Name"); + else tags.getCompoundTag("display").removeTag("Name"); } itemstack.setTagCompound(tags); itemstack.damageItem(5, player); player.swingItem(); - world.playSoundEffect(player.posX, player.posY, player.posZ, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + world.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "thaumcraft:wandfail", + 0.2F, + 0.2F + world.rand.nextFloat() * 0.2F); } return itemstack; } @@ -113,18 +109,13 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi @SideOnly(Side.CLIENT) @Override public int getColorFromItemStack(ItemStack itemstack, int renderpass) { - if (renderpass != 1) - return 16777215; + if (renderpass != 1) return 16777215; else { - if (!itemstack.hasTagCompound()) - return 0x980000; + if (!itemstack.hasTagCompound()) return 0x980000; byte phase = itemstack.getTagCompound().getByte("phase"); - if (phase == 1) - return 0x0010CC; - else if (phase == 2) - return 0xE5DA00; - else - return 0x980000; + if (phase == 1) return 0x0010CC; + else if (phase == 2) return 0xE5DA00; + else return 0x980000; } } @@ -136,23 +127,25 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi public void onUpdate(ItemStack stack, World world, Entity entity, int fuckObfuscation, boolean fuckObfuscation2) { super.onUpdate(stack, world, entity, fuckObfuscation, fuckObfuscation2); - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 && stack.isItemDamaged() && entity != null && entity.ticksExisted % 10 == 0 && entity instanceof EntityLivingBase) { - stack.damageItem(-1, (EntityLivingBase)entity); + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 + && stack.isItemDamaged() + && entity != null + && entity.ticksExisted % 10 == 0 + && entity instanceof EntityLivingBase) { + stack.damageItem(-1, (EntityLivingBase) entity); } - } public int getWarp(ItemStack itemstack, EntityPlayer player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) - return 1; - else - return 0; + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) return 1; + else return 0; } @Override public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { MovingObjectPosition movingobjectposition = BlockUtils.getTargetBlock(player.worldObj, player, true); - if(movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (movingobjectposition != null + && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { this.side = movingobjectposition.sideHit; } @@ -160,21 +153,22 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0) + public boolean onBlockDestroyed( + ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0) return super.onBlockDestroyed(stack, world, block, x, y, z, player); - if(!player.worldObj.isRemote) { + if (!player.worldObj.isRemote) { int meta = world.getBlockMetadata(x, y, z); - if(ForgeHooks.isToolEffective(stack, block, meta)) { - for(int aa = -1; aa <= 1; ++aa) { - for(int bb = -1; bb <= 1; ++bb) { + if (ForgeHooks.isToolEffective(stack, block, meta)) { + for (int aa = -1; aa <= 1; ++aa) { + for (int bb = -1; bb <= 1; ++bb) { int xx = 0; int yy = 0; int zz = 0; - if(this.side <= 1) { + if (this.side <= 1) { xx = aa; zz = bb; - } else if(this.side <= 3) { + } else if (this.side <= 3) { xx = aa; yy = bb; } else { @@ -182,22 +176,21 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi yy = bb; } - if(!(player instanceof EntityPlayer) || world.canMineBlock((EntityPlayer)player, x + xx, y + yy, z + zz)) { + if (!(player instanceof EntityPlayer) + || world.canMineBlock((EntityPlayer) player, x + xx, y + yy, z + zz)) { Block bl = world.getBlock(x + xx, y + yy, z + zz); meta = world.getBlockMetadata(x + xx, y + yy, z + zz); - if(bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F && ForgeHooks.isToolEffective(stack, bl, meta)) { + if (bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F + && ForgeHooks.isToolEffective(stack, bl, meta)) { stack.damageItem(1, player); - BlockUtils.harvestBlock(world, (EntityPlayer)player, x + xx, y + yy, z + zz, true, 2); + BlockUtils.harvestBlock(world, (EntityPlayer) player, x + xx, y + yy, z + zz, true, 2); } } } } - } - else - return super.onBlockDestroyed(stack, world, block, x, y, z, player); + } else return super.onBlockDestroyed(stack, world, block, x, y, z, player); } return super.onBlockDestroyed(stack, world, block, x, y, z, player); } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphShovel.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphShovel.java index 562c290..014e858 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphShovel.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphShovel.java @@ -1,32 +1,26 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.enchantments.DarkEnchantments; import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import thaumcraft.api.IRepairable; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.IWarpingGear; import thaumcraft.common.lib.utils.BlockUtils; @@ -57,50 +51,53 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG } public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) ? true : super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) + ? true + : super.getIsRepairable(stack, stack2); } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (player.isSneaking() && itemstack.hasTagCompound() && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { + if (player.isSneaking() + && itemstack.hasTagCompound() + && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { NBTTagCompound tags = itemstack.getTagCompound(); byte phase = tags.getByte("phase"); - if(tags.hasKey("ench")){ + if (tags.hasKey("ench")) { NBTTagList enchants = itemstack.getEnchantmentTagList(); tags.setTag("enchants" + phase, enchants); - } - else - tags.removeTag("enchants" + phase); + } else tags.removeTag("enchants" + phase); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name"); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name" + phase, name); - else - tags.getCompoundTag("display").removeTag("Name" + phase); + else tags.getCompoundTag("display").removeTag("Name" + phase); } - if (++phase > 2) - phase = 0; + if (++phase > 2) phase = 0; tags.setByte("phase", phase); - if(tags.hasKey("enchants" + phase)) { + if (tags.hasKey("enchants" + phase)) { NBTTagList enchants = (NBTTagList) (tags.getTag("enchants" + phase)); tags.setTag("ench", enchants); - } - else - tags.removeTag("ench"); + } else tags.removeTag("ench"); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name" + phase); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name", name); - else - tags.getCompoundTag("display").removeTag("Name"); + else tags.getCompoundTag("display").removeTag("Name"); } itemstack.setTagCompound(tags); itemstack.damageItem(5, player); player.swingItem(); - world.playSoundEffect(player.posX, player.posY, player.posZ, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + world.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "thaumcraft:wandfail", + 0.2F, + 0.2F + world.rand.nextFloat() * 0.2F); } return itemstack; } @@ -108,18 +105,13 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemstack, int renderpass) { - if (renderpass != 1) - return 16777215; + if (renderpass != 1) return 16777215; else { - if (!itemstack.hasTagCompound()) - return 0x980000; + if (!itemstack.hasTagCompound()) return 0x980000; byte phase = itemstack.getTagCompound().getByte("phase"); - if (phase == 1) - return 0x0010CC; - else if (phase == 2) - return 0xE5DA00; - else - return 0x980000; + if (phase == 1) return 0x0010CC; + else if (phase == 2) return 0xE5DA00; + else return 0x980000; } } @@ -130,23 +122,25 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG public void onUpdate(ItemStack stack, World world, Entity entity, int fuckObfuscation, boolean fuckObfuscation2) { super.onUpdate(stack, world, entity, fuckObfuscation, fuckObfuscation2); - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 && stack.isItemDamaged() && entity != null && entity.ticksExisted % 10 == 0 && entity instanceof EntityLivingBase) { - stack.damageItem(-1, (EntityLivingBase)entity); + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 + && stack.isItemDamaged() + && entity != null + && entity.ticksExisted % 10 == 0 + && entity instanceof EntityLivingBase) { + stack.damageItem(-1, (EntityLivingBase) entity); } - } public int getWarp(ItemStack itemstack, EntityPlayer player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) - return 1; - else - return 0; + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) return 1; + else return 0; } @Override public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { MovingObjectPosition movingobjectposition = BlockUtils.getTargetBlock(player.worldObj, player, true); - if(movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (movingobjectposition != null + && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { this.side = movingobjectposition.sideHit; } @@ -154,21 +148,22 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0) + public boolean onBlockDestroyed( + ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.impact.effectId, stack) <= 0) return super.onBlockDestroyed(stack, world, block, x, y, z, player); - if(!player.worldObj.isRemote) { + if (!player.worldObj.isRemote) { int meta = world.getBlockMetadata(x, y, z); - if(ForgeHooks.isToolEffective(stack, block, meta)) { - for(int aa = -1; aa <= 1; ++aa) { - for(int bb = -1; bb <= 1; ++bb) { + if (ForgeHooks.isToolEffective(stack, block, meta)) { + for (int aa = -1; aa <= 1; ++aa) { + for (int bb = -1; bb <= 1; ++bb) { int xx = 0; int yy = 0; int zz = 0; - if(this.side <= 1) { + if (this.side <= 1) { xx = aa; zz = bb; - } else if(this.side <= 3) { + } else if (this.side <= 3) { xx = aa; yy = bb; } else { @@ -176,22 +171,21 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG yy = bb; } - if(!(player instanceof EntityPlayer) || world.canMineBlock((EntityPlayer)player, x + xx, y + yy, z + zz)) { + if (!(player instanceof EntityPlayer) + || world.canMineBlock((EntityPlayer) player, x + xx, y + yy, z + zz)) { Block bl = world.getBlock(x + xx, y + yy, z + zz); meta = world.getBlockMetadata(x + xx, y + yy, z + zz); - if(bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F && ForgeHooks.isToolEffective(stack, bl, meta)) { + if (bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F + && ForgeHooks.isToolEffective(stack, bl, meta)) { stack.damageItem(1, player); - BlockUtils.harvestBlock(world, (EntityPlayer)player, x + xx, y + yy, z + zz, true, 2); + BlockUtils.harvestBlock(world, (EntityPlayer) player, x + xx, y + yy, z + zz, true, 2); } } } } - } - else - return super.onBlockDestroyed(stack, world, block, x, y, z, player); + } else return super.onBlockDestroyed(stack, world, block, x, y, z, player); } return super.onBlockDestroyed(stack, world, block, x, y, z, player); } - } diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphSword.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphSword.java index 1c844d3..d177253 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphSword.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemMorphSword.java @@ -1,6 +1,9 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.enchantments.DarkEnchantments; import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; @@ -15,11 +18,6 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.api.IRepairable; - -import fox.spiteful.forbidden.enchantments.DarkEnchantments; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.IWarpingGear; public class ItemMorphSword extends ItemSword implements IRepairable, IWarpingGear { @@ -49,50 +47,53 @@ public class ItemMorphSword extends ItemSword implements IRepairable, IWarpingGe @Override public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) ? true : super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(ForbiddenItems.deadlyShards, 1, 1)) + ? true + : super.getIsRepairable(stack, stack2); } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (player.isSneaking() && itemstack.hasTagCompound() && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { + if (player.isSneaking() + && itemstack.hasTagCompound() + && getMaxDamage(itemstack) - itemstack.getItemDamage() > 5) { NBTTagCompound tags = itemstack.getTagCompound(); byte phase = tags.getByte("phase"); - if(tags.hasKey("ench")){ + if (tags.hasKey("ench")) { NBTTagList enchants = itemstack.getEnchantmentTagList(); tags.setTag("enchants" + phase, enchants); - } - else - tags.removeTag("enchants" + phase); + } else tags.removeTag("enchants" + phase); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name"); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name" + phase, name); - else - tags.getCompoundTag("display").removeTag("Name" + phase); + else tags.getCompoundTag("display").removeTag("Name" + phase); } - if (++phase > 2) - phase = 0; + if (++phase > 2) phase = 0; tags.setByte("phase", phase); - if(tags.hasKey("enchants" + phase)) { + if (tags.hasKey("enchants" + phase)) { NBTTagList enchants = (NBTTagList) (tags.getTag("enchants" + phase)); tags.setTag("ench", enchants); - } - else - tags.removeTag("ench"); + } else tags.removeTag("ench"); if (tags.hasKey("display")) { String name = tags.getCompoundTag("display").getString("Name" + phase); if (name != null && !name.equals("")) tags.getCompoundTag("display").setString("Name", name); - else - tags.getCompoundTag("display").removeTag("Name"); + else tags.getCompoundTag("display").removeTag("Name"); } itemstack.setTagCompound(tags); itemstack.damageItem(5, player); player.swingItem(); - world.playSoundEffect(player.posX, player.posY, player.posZ, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + world.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "thaumcraft:wandfail", + 0.2F, + 0.2F + world.rand.nextFloat() * 0.2F); } return itemstack; } @@ -100,18 +101,13 @@ public class ItemMorphSword extends ItemSword implements IRepairable, IWarpingGe @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemstack, int renderpass) { - if (renderpass != 1) - return 16777215; + if (renderpass != 1) return 16777215; else { - if (!itemstack.hasTagCompound()) - return 0x980000; + if (!itemstack.hasTagCompound()) return 0x980000; byte phase = itemstack.getTagCompound().getByte("phase"); - if (phase == 1) - return 0x0010CC; - else if (phase == 2) - return 0xE5DA00; - else - return 0x980000; + if (phase == 1) return 0x0010CC; + else if (phase == 2) return 0xE5DA00; + else return 0x980000; } } @@ -122,16 +118,17 @@ public class ItemMorphSword extends ItemSword implements IRepairable, IWarpingGe public void onUpdate(ItemStack stack, World world, Entity entity, int fuckObfuscation, boolean fuckObfuscation2) { super.onUpdate(stack, world, entity, fuckObfuscation, fuckObfuscation2); - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 && stack.isItemDamaged() && entity != null && entity.ticksExisted % 10 == 0 && entity instanceof EntityLivingBase) { - stack.damageItem(-1, (EntityLivingBase)entity); + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, stack) > 0 + && stack.isItemDamaged() + && entity != null + && entity.ticksExisted % 10 == 0 + && entity instanceof EntityLivingBase) { + stack.damageItem(-1, (EntityLivingBase) entity); } - } public int getWarp(ItemStack itemstack, EntityPlayer player) { - if(EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) - return 1; - else - return 0; + if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.voidtouched.effectId, itemstack) > 0) return 1; + else return 0; } } diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemRidingCrop.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemRidingCrop.java index 2959364..c33f823 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemRidingCrop.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemRidingCrop.java @@ -1,5 +1,8 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.items.ForbiddenItems; import net.minecraft.block.Block; @@ -20,11 +23,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemRidingCrop extends ItemSword { public IIcon icon; @@ -50,7 +48,10 @@ public class ItemRidingCrop extends ItemSword { victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 200, 1)); victim.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1)); } - if (!player.worldObj.isRemote && !Config.noLust && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(15) == 1) { + if (!player.worldObj.isRemote + && !Config.noLust + && player.worldObj.provider.dimensionId == -1 + && player.worldObj.rand.nextInt(15) == 1) { EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F); ent.motionY += player.worldObj.rand.nextFloat() * 0.05F; ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F; @@ -103,4 +104,4 @@ public class ItemRidingCrop extends ItemSword { public boolean canHarvestBlock(Block block, ItemStack itemStack) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemSkullAxe.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemSkullAxe.java index 9759ec7..6bd0815 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemSkullAxe.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemSkullAxe.java @@ -1,5 +1,8 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -9,11 +12,6 @@ import net.minecraft.item.ItemSword; import net.minecraft.util.IIcon; import thaumcraft.api.IRepairable; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemSkullAxe extends ItemSword implements IRepairable { public IIcon icon; @@ -41,7 +39,8 @@ public class ItemSkullAxe extends ItemSword implements IRepairable { @Override public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) || super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) + || super.getIsRepairable(stack, stack2); } @Override diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintPickaxe.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintPickaxe.java index 42721ab..f9779d8 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintPickaxe.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintPickaxe.java @@ -1,5 +1,9 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; +import fox.spiteful.forbidden.Forbidden; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; @@ -7,12 +11,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import thaumcraft.api.IRepairable; -import fox.spiteful.forbidden.Config; -import fox.spiteful.forbidden.Forbidden; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemTaintPickaxe extends ItemPickaxe implements IRepairable { public IIcon icon; @@ -39,6 +37,8 @@ public class ItemTaintPickaxe extends ItemPickaxe implements IRepairable { @Override public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { - return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) ? true : super.getIsRepairable(stack, stack2); + return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) + ? true + : super.getIsRepairable(stack, stack2); } } diff --git a/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintShovel.java b/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintShovel.java index 9631540..13dc007 100644 --- a/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintShovel.java +++ b/src/main/java/fox/spiteful/forbidden/items/tools/ItemTaintShovel.java @@ -1,5 +1,8 @@ package fox.spiteful.forbidden.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.blocks.ForbiddenBlocks; import net.minecraft.block.Block; @@ -12,85 +15,92 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import thaumcraft.api.IRepairable; - -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.common.Thaumcraft; import thaumcraft.common.config.ConfigBlocks; -public class ItemTaintShovel extends ItemSpade implements IRepairable -{ +public class ItemTaintShovel extends ItemSpade implements IRepairable { public IIcon icon; - public ItemTaintShovel(ToolMaterial enumtoolmaterial) - { + public ItemTaintShovel(ToolMaterial enumtoolmaterial) { super(enumtoolmaterial); this.setCreativeTab(Forbidden.tab); this.setHarvestLevel("shovel", 3); } @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ir) - { + public void registerIcons(IIconRegister ir) { this.icon = ir.registerIcon("forbidden:taintshovel"); } @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { + public IIcon getIconFromDamage(int par1) { return this.icon; } - public EnumRarity getRarity(ItemStack itemstack) - { + public EnumRarity getRarity(ItemStack itemstack) { return EnumRarity.rare; } - public boolean getIsRepairable(ItemStack stack, ItemStack stack2) - { - return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) ? true : super.getIsRepairable(stack, stack2); + public boolean getIsRepairable(ItemStack stack, ItemStack stack2) { + return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) + ? true + : super.getIsRepairable(stack, stack2); } @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (ForgeHooks.isToolEffective(stack, block, meta) || - (block.getMaterial() == Config.taintMaterial && block != ForbiddenBlocks.taintLog && block != ForbiddenBlocks.taintPlanks - && block != ForbiddenBlocks.taintStone)) - { + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (ForgeHooks.isToolEffective(stack, block, meta) + || (block.getMaterial() == Config.taintMaterial + && block != ForbiddenBlocks.taintLog + && block != ForbiddenBlocks.taintPlanks + && block != ForbiddenBlocks.taintStone)) { return efficiencyOnProperMaterial; } return func_150893_a(stack, block); } - + @Override - public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) { + public boolean onItemUse( + ItemStack itemstack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { int purified = 0; - for(int ex = x - 5;ex < x + 6;ex++){ - for(int wy = y - 4;wy < y + 5;wy++){ - for(int zee = z - 5;zee < z + 6;zee++){ + for (int ex = x - 5; ex < x + 6; ex++) { + for (int wy = y - 4; wy < y + 5; wy++) { + for (int zee = z - 5; zee < z + 6; zee++) { Block target = world.getBlock(ex, wy, zee); - if(target != null && (target == ConfigBlocks.blockFluxGoo || target == ConfigBlocks.blockFluxGas)){ + if (target != null + && (target == ConfigBlocks.blockFluxGoo || target == ConfigBlocks.blockFluxGas)) { purified++; world.setBlockToAir(ex, wy, zee); float d1 = ((float) ex + world.rand.nextFloat()); float d2 = ((float) wy + world.rand.nextFloat()); float d0 = ((float) zee + world.rand.nextFloat()); - Thaumcraft.proxy.nodeBolt(world, (float)player.posX, (float)player.posY, (float)player.posZ, d1, d2, d0); + Thaumcraft.proxy.nodeBolt( + world, (float) player.posX, (float) player.posY, (float) player.posZ, d1, d2, d0); } } } } - if(purified > 0){ + if (purified > 0) { itemstack.damageItem(Math.min(purified, 15), player); player.swingItem(); - world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F); + world.playSoundEffect( + (double) x + 0.5D, + (double) y + 0.5D, + (double) z + 0.5D, + "thaumcraft:wandfail", + 0.2F, + 0.2F + world.rand.nextFloat() * 0.2F); return true; - } - else - return super.onItemUse(itemstack, player, world, x, y, z, side, par8, par9, par10); + } else return super.onItemUse(itemstack, player, world, x, y, z, side, par8, par9, par10); } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/BloodStaffUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/BloodStaffUpdate.java index 21d8731..3b4ccdc 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/BloodStaffUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/BloodStaffUpdate.java @@ -1,88 +1,73 @@ package fox.spiteful.forbidden.items.wands; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import fox.spiteful.forbidden.Config; +import fox.spiteful.forbidden.compat.Compat; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -import fox.spiteful.forbidden.compat.Compat; public class BloodStaffUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); - public void onUpdate(ItemStack itemstack, EntityPlayer player) - { - if(Compat.bm && Config.crossWand && player.ticksExisted % 25 == 0) - { - try - { - if(!checkHotbar(itemstack, player)) - return; - + public void onUpdate(ItemStack itemstack, EntityPlayer player) { + if (Compat.bm && Config.crossWand && player.ticksExisted % 25 == 0) { + try { + if (!checkHotbar(itemstack, player)) return; + SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); - + int cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical")) - cost = Config.bloodvis - 1; - else - cost = Config.bloodvis; + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("alchemical")) cost = Config.bloodvis - 1; + else cost = Config.bloodvis; cost = Math.max(0, cost); - for(int x = 0;x < primals.length;x++) - { - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) - { + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if(player.capabilities.isCreativeMode) - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - else if(syphonHealth(player)) - { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - return; - } - else + if (player.capabilities.isCreativeMode) + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + else if (syphonHealth(player)) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); return; + } else return; } } - - } - catch(Exception e) - { + + } catch (Exception e) { return; } } - } - - public boolean syphonHealth(EntityPlayer player){ - if(player.getHealth() > 3){ + + public boolean syphonHealth(EntityPlayer player) { + if (player.getHealth() > 3) { player.setHealth(player.getHealth() - 3); return true; - } - else if(player.getHealth() > 0){ + } else if (player.getHealth() > 0) { player.func_110142_aN().func_94547_a(new DamageSource("blooderp"), 3, 3); player.setHealth(0); player.onDeath(new DamageSource("blooderp")); return true; - } - else - return false; + } else return false; } - - private boolean checkHotbar(ItemStack stack, EntityPlayer player){ - for(int x = 0; x < 9; ++x){ + + private boolean checkHotbar(ItemStack stack, EntityPlayer player) { + for (int x = 0; x < 9; ++x) { ItemStack item = player.inventory.getStackInSlot(x); - if(item == stack) - return true; + if (item == stack) return true; } return false; } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/BloodWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/BloodWandUpdate.java index 2624e26..74436a8 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/BloodWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/BloodWandUpdate.java @@ -1,5 +1,6 @@ package fox.spiteful.forbidden.items.wands; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.compat.Compat; import net.minecraft.entity.player.EntityPlayer; @@ -7,65 +8,51 @@ import net.minecraft.item.ItemStack; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; public class BloodWandUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); - public void onUpdate(ItemStack itemstack, EntityPlayer player) - { - if(Compat.bm && Config.crossWand && player.ticksExisted % 100 == 0) - { - try - { + public void onUpdate(ItemStack itemstack, EntityPlayer player) { + if (Compat.bm && Config.crossWand && player.ticksExisted % 100 == 0) { + try { SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); int cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical")) - cost = Config.bloodvis - 1; - else - cost = Config.bloodvis; + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("alchemical")) cost = Config.bloodvis - 1; + else cost = Config.bloodvis; cost = Math.max(0, cost); - - for(int x = 0;x < primals.length;x++) - { - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) - { + + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if(player.capabilities.isCreativeMode) - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - else if(syphonHealth(player)) - { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - return; - } - else + if (player.capabilities.isCreativeMode) + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + else if (syphonHealth(player)) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); return; + } else return; } } - - } - catch(Throwable e) - { + + } catch (Throwable e) { return; } } - } - - public boolean syphonHealth(EntityPlayer player) - { - if(player.getHealth() > 6) - { + + public boolean syphonHealth(EntityPlayer player) { + if (player.getHealth() > 6) { player.setHealth(player.getHealth() - 3); return true; - } - else - return false; + } else return false; } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/CreativeWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/CreativeWandUpdate.java index ea20aa9..5ca8fab 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/CreativeWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/CreativeWandUpdate.java @@ -12,8 +12,15 @@ public class CreativeWandUpdate implements IWandRodOnUpdate { public void onUpdate(ItemStack itemstack, EntityPlayer player) { for (int x = 0; x < primals.length; x++) { - if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) { - ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]), true); + if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) + < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) { + ((ItemWandCasting) itemstack.getItem()) + .addVis( + itemstack, + primals[x], + ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]), + true); } } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/DarkWandCap.java b/src/main/java/fox/spiteful/forbidden/items/wands/DarkWandCap.java index 8be7376..0c8a57c 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/DarkWandCap.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/DarkWandCap.java @@ -1,7 +1,6 @@ package fox.spiteful.forbidden.items.wands; import java.util.List; - import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import thaumcraft.api.aspects.Aspect; @@ -10,9 +9,9 @@ import thaumcraft.api.wands.WandCap; /** * This class is used to keep the material information for the various caps. It * is also used to generate the wand recipes ingame. - * + * * @author Azanor - * + * */ public class DarkWandCap extends WandCap { public DarkWandCap(String tag, float discount, ItemStack item, int craftCost, ResourceLocation skin) { @@ -20,7 +19,14 @@ public class DarkWandCap extends WandCap { setTexture(skin); } - public DarkWandCap(String tag, float discount, List specialAspects, float discountSpecial, ItemStack item, int craftCost, ResourceLocation skin) { + public DarkWandCap( + String tag, + float discount, + List specialAspects, + float discountSpecial, + ItemStack item, + int craftCost, + ResourceLocation skin) { super(tag, discount, specialAspects, discountSpecial, item, craftCost); setTexture(skin); } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/InfernalWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/InfernalWandUpdate.java index 25203db..4202602 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/InfernalWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/InfernalWandUpdate.java @@ -12,28 +12,27 @@ public class InfernalWandUpdate implements IWandRodOnUpdate { Aspect primals[] = {Aspect.ORDER, Aspect.ENTROPY, Aspect.AIR, Aspect.EARTH, Aspect.WATER}; public void onUpdate(ItemStack itemstack, EntityPlayer player) { - if(player.ticksExisted % 100 == 0){ - if(player.worldObj.provider.dimensionId == -1){ - for(int x = 0;x < primals.length;x++){ - if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + if (player.ticksExisted % 100 == 0) { + if (player.worldObj.provider.dimensionId == -1) { + for (int x = 0; x < primals.length; x++) { + if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) + < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) / 10) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); } } } - - if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, Aspect.FIRE) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 5) { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true); + + if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, Aspect.FIRE) + < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) / 5) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true); } } - - if(player.isBurning()) - player.extinguish(); - - if(player.isPotionActive(Potion.wither.id)) { - if(player.worldObj.isRemote) - player.removePotionEffectClient(Potion.wither.id); - else - player.removePotionEffect(Potion.wither.id); + + if (player.isBurning()) player.extinguish(); + + if (player.isPotionActive(Potion.wither.id)) { + if (player.worldObj.isRemote) player.removePotionEffectClient(Potion.wither.id); + else player.removePotionEffect(Potion.wither.id); } } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ItemFocusBlink.java b/src/main/java/fox/spiteful/forbidden/items/wands/ItemFocusBlink.java index cb8aeb8..22ca8c6 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ItemFocusBlink.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ItemFocusBlink.java @@ -6,6 +6,7 @@ import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.DarkAspects; import fox.spiteful.forbidden.Forbidden; import fox.spiteful.forbidden.items.ForbiddenItems; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.IMob; @@ -20,8 +21,6 @@ import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.lib.utils.BlockUtils; -import java.util.List; - public class ItemFocusBlink extends ItemFocusBasic { private IIcon icon; @@ -29,75 +28,128 @@ public class ItemFocusBlink extends ItemFocusBasic { AspectList visCost = (new AspectList()).add(Aspect.ENTROPY, 300); AspectList fireCost = (new AspectList()).add(Aspect.ENTROPY, 300).add(Aspect.FIRE, 100); AspectList switchCost = (new AspectList()).add(Aspect.ENTROPY, 300).add(Aspect.ORDER, 100); - FocusUpgradeType hellfire = ForbiddenItems.getUpgrade(Config.hellfireUpgradeID, new ResourceLocation("forbidden", "textures/misc/hellfire.png"), "forbidden.upgrade.hellfire.name", "forbidden.upgrade.hellfire.text", (new AspectList()).add(DarkAspects.NETHER, 1)); - FocusUpgradeType pandemonium = ForbiddenItems.getUpgrade(Config.pandemoniumUpgradeID, new ResourceLocation("forbidden", "textures/misc/pandemonium.png"), "forbidden.upgrade.pandemonium.name", "forbidden.upgrade.pandemonium.text", (new AspectList()).add(Aspect.DARKNESS, 1)); + FocusUpgradeType hellfire = ForbiddenItems.getUpgrade( + Config.hellfireUpgradeID, + new ResourceLocation("forbidden", "textures/misc/hellfire.png"), + "forbidden.upgrade.hellfire.name", + "forbidden.upgrade.hellfire.text", + (new AspectList()).add(DarkAspects.NETHER, 1)); + FocusUpgradeType pandemonium = ForbiddenItems.getUpgrade( + Config.pandemoniumUpgradeID, + new ResourceLocation("forbidden", "textures/misc/pandemonium.png"), + "forbidden.upgrade.pandemonium.name", + "forbidden.upgrade.pandemonium.text", + (new AspectList()).add(Aspect.DARKNESS, 1)); - public ItemFocusBlink(){ + public ItemFocusBlink() { super(); setCreativeTab(Forbidden.tab); } @Override - public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition wut) { - MovingObjectPosition mop = BlockUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)), + public ItemStack onFocusRightClick( + ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition wut) { + MovingObjectPosition mop = BlockUtils.getTargetBlock( + world, + (player.prevPosX + (player.posX - player.prevPosX)), (player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset), (player.prevPosZ + (player.posZ - player.prevPosZ)), (player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)), - (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), false, 128.0); - if(mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1){ - ItemWandCasting wand = (ItemWandCasting)itemstack.getItem(); - if(wand.consumeAllVis(itemstack, player, getVisCost(itemstack), false, false)){ + (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), + false, + 128.0); + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if (wand.consumeAllVis(itemstack, player, getVisCost(itemstack), false, false)) { double ex = mop.hitVec.xCoord; double wy = mop.hitVec.yCoord; double zee = mop.hitVec.zCoord; - switch(mop.sideHit){ - case 0: wy -= 2.0; + switch (mop.sideHit) { + case 0: + wy -= 2.0; break; - case 1: break; - case 2: zee -= 0.5; + case 1: break; - case 3: zee += 0.5; + case 2: + zee -= 0.5; break; - case 4: ex -= 0.5; + case 3: + zee += 0.5; break; - case 5: ex += 0.5; + case 4: + ex -= 0.5; + break; + case 5: + ex += 0.5; break; } - world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0); - for (int k = 0; k < 8; ++k) - { - world.spawnParticle("smoke", player.posX + (world.rand.nextDouble() - 0.5D) * (double)player.width, player.posY + world.rand.nextDouble() * (double)player.height - 0.25D, player.posZ + (world.rand.nextDouble() - 0.5D) * (double)player.width, 0, 0, 0); + world.playAuxSFXAtEntity( + (EntityPlayer) null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0); + for (int k = 0; k < 8; ++k) { + world.spawnParticle( + "smoke", + player.posX + (world.rand.nextDouble() - 0.5D) * (double) player.width, + player.posY + world.rand.nextDouble() * (double) player.height - 0.25D, + player.posZ + (world.rand.nextDouble() - 0.5D) * (double) player.width, + 0, + 0, + 0); } double range = 3.0 + 1.5 * wand.getFocusEnlarge(itemstack); - if(this.isUpgradedWith(wand.getFocusItem(itemstack), hellfire)) { - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(ex - range, wy - range, zee - range, ex + range, wy + range, zee + range)); + if (this.isUpgradedWith(wand.getFocusItem(itemstack), hellfire)) { + List entities = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + ex - range, wy - range, zee - range, ex + range, wy + range, zee + range)); for (EntityLivingBase entity : entities) { - if(entity == player) - continue; + if (entity == player) continue; for (int k = 0; k < 8; ++k) { - world.spawnParticle("flame", entity.posX + (world.rand.nextDouble() - 0.5D) * (double) entity.width, entity.posY + world.rand.nextDouble() * (double) entity.height - 0.25D, entity.posZ + (world.rand.nextDouble() - 0.5D) * (double) entity.width, 0, 0, 0); + world.spawnParticle( + "flame", + entity.posX + (world.rand.nextDouble() - 0.5D) * (double) entity.width, + entity.posY + world.rand.nextDouble() * (double) entity.height - 0.25D, + entity.posZ + (world.rand.nextDouble() - 0.5D) * (double) entity.width, + 0, + 0, + 0); } int potency = wand.getFocusPotency(itemstack); - entity.attackEntityFrom((new EntityDamageSource("fireball", player)).setFireDamage(), 3 + 3 * potency); + entity.attackEntityFrom( + (new EntityDamageSource("fireball", player)).setFireDamage(), 3 + 3 * potency); entity.setFire(3 + 3 * potency); } - } - else if(this.isUpgradedWith(wand.getFocusItem(itemstack), pandemonium)){ - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(ex - range, wy - range, zee - range, ex + range, wy + range, zee + range)); + } else if (this.isUpgradedWith(wand.getFocusItem(itemstack), pandemonium)) { + List entities = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + ex - range, wy - range, zee - range, ex + range, wy + range, zee + range)); for (EntityLivingBase entity : entities) { - if(!(entity instanceof IMob)) - continue; + if (!(entity instanceof IMob)) continue; for (int k = 0; k < 8; ++k) { - world.spawnParticle("smoke", entity.posX + (world.rand.nextDouble() - 0.5D) * (double) entity.width, entity.posY + world.rand.nextDouble() * (double) entity.height - 0.25D, entity.posZ + (world.rand.nextDouble() - 0.5D) * (double) entity.width, 0, 0, 0); + world.spawnParticle( + "smoke", + entity.posX + (world.rand.nextDouble() - 0.5D) * (double) entity.width, + entity.posY + world.rand.nextDouble() * (double) entity.height - 0.25D, + entity.posZ + (world.rand.nextDouble() - 0.5D) * (double) entity.width, + 0, + 0, + 0); } entity.setPositionAndUpdate(player.posX, player.posY, player.posZ); } } player.setPositionAndUpdate(ex, wy, zee); - world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)player.posX, (int)player.posY, (int)player.posZ, 0); - for (int k = 0; k < 8; ++k) - { - world.spawnParticle("flame", player.posX + (world.rand.nextDouble() - 0.5D) * (double)player.width, player.posY + world.rand.nextDouble() * (double)player.height - 0.25D, player.posZ + (world.rand.nextDouble() - 0.5D) * (double)player.width, 0, 0, 0); + world.playAuxSFXAtEntity( + (EntityPlayer) null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0); + for (int k = 0; k < 8; ++k) { + world.spawnParticle( + "flame", + player.posX + (world.rand.nextDouble() - 0.5D) * (double) player.width, + player.posY + world.rand.nextDouble() * (double) player.height - 0.25D, + player.posZ + (world.rand.nextDouble() - 0.5D) * (double) player.width, + 0, + 0, + 0); } wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false); player.swingItem(); @@ -123,7 +175,7 @@ public class ItemFocusBlink extends ItemFocusBasic { } @Override - public int getFocusColor(ItemStack item){ + public int getFocusColor(ItemStack item) { return 0x909090; } @@ -133,13 +185,15 @@ public class ItemFocusBlink extends ItemFocusBasic { } @Override - public AspectList getVisCost(ItemStack item){ - return this.isUpgradedWith(item, hellfire) ? fireCost : this.isUpgradedWith(item, pandemonium) ? switchCost : visCost; + public AspectList getVisCost(ItemStack item) { + return this.isUpgradedWith(item, hellfire) + ? fireCost + : this.isUpgradedWith(item, pandemonium) ? switchCost : visCost; } @Override - public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack item, int rank){ - switch(rank){ + public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack item, int rank) { + switch (rank) { case 1: return new FocusUpgradeType[] {FocusUpgradeType.frugal}; case 2: @@ -147,12 +201,13 @@ public class ItemFocusBlink extends ItemFocusBasic { case 3: case 4: case 5: - if(this.isUpgradedWith(item, hellfire)) - return new FocusUpgradeType[] {FocusUpgradeType.potency, FocusUpgradeType.frugal, FocusUpgradeType.enlarge}; - else if(this.isUpgradedWith(item, pandemonium)) + if (this.isUpgradedWith(item, hellfire)) + return new FocusUpgradeType[] { + FocusUpgradeType.potency, FocusUpgradeType.frugal, FocusUpgradeType.enlarge + }; + else if (this.isUpgradedWith(item, pandemonium)) return new FocusUpgradeType[] {FocusUpgradeType.frugal, FocusUpgradeType.enlarge}; - else - return new FocusUpgradeType[] {FocusUpgradeType.frugal}; + else return new FocusUpgradeType[] {FocusUpgradeType.frugal}; default: return null; } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCaps.java b/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCaps.java index f1dfeba..96868a9 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCaps.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCaps.java @@ -1,27 +1,19 @@ package fox.spiteful.forbidden.items.wands; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Forbidden; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemWandCaps extends Item { public final String[] types = { - "alchemical", - "vinteum", - "terrasteel", - "manasteel", - "manasteel_inert", - "elementium", - "elementium_inert" + "alchemical", "vinteum", "terrasteel", "manasteel", "manasteel_inert", "elementium", "elementium_inert" }; public IIcon[] icon; @@ -36,8 +28,7 @@ public class ItemWandCaps extends Item { @Override public void registerIcons(IIconRegister ir) { icon = new IIcon[types.length]; - for(int x = 0; x < types.length; x++) - this.icon[x] = ir.registerIcon("forbidden:wand_cap_" + types[x]); + for (int x = 0; x < types.length; x++) this.icon[x] = ir.registerIcon("forbidden:wand_cap_" + types[x]); } @SideOnly(Side.CLIENT) @@ -49,7 +40,7 @@ public class ItemWandCaps extends Item { @SideOnly(Side.CLIENT) @Override public void getSubItems(Item item, CreativeTabs xCreativeTabs, List list) { - for(int x = 0; x < types.length; x++){ + for (int x = 0; x < types.length; x++) { list.add(new ItemStack(this, 1, x)); } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCores.java b/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCores.java index f2fe05b..67523cf 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCores.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ItemWandCores.java @@ -1,15 +1,16 @@ package fox.spiteful.forbidden.items.wands; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.Forbidden; +import fox.spiteful.forbidden.compat.Compat; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import thaumcraft.api.ItemApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.WandCap; @@ -17,28 +18,24 @@ import thaumcraft.api.wands.WandRod; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.wands.ItemWandCasting; -import fox.spiteful.forbidden.compat.Compat; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class ItemWandCores extends Item { public final String[] types = { - "tainted", - "infernal", - "soul", - "blood", - "witchwood", - "profane", - "blood_inert", - "livingwood", - "livingwood_inert", - "blood_staff", - "witchwood_staff", - "dreamwood", - "dreamwood_inert", - "dreamwood_staff" }; + "tainted", + "infernal", + "soul", + "blood", + "witchwood", + "profane", + "blood_inert", + "livingwood", + "livingwood_inert", + "blood_staff", + "witchwood_staff", + "dreamwood", + "dreamwood_inert", + "dreamwood_staff" + }; public IIcon[] icon; public ItemWandCores() { @@ -52,8 +49,7 @@ public class ItemWandCores extends Item { @Override public void registerIcons(IIconRegister ir) { icon = new IIcon[types.length]; - for (int x = 0; x < types.length; x++) - this.icon[x] = ir.registerIcon("forbidden:wand_rod_" + types[x]); + for (int x = 0; x < types.length; x++) this.icon[x] = ir.registerIcon("forbidden:wand_rod_" + types[x]); } @SideOnly(Side.CLIENT) @@ -88,7 +84,16 @@ public class ItemWandCores extends Item { wand = new ItemStack(ConfigItems.itemWandCasting, 1, 36); ((ItemWandCasting) wand.getItem()).setCap(wand, (WandCap) WandCap.caps.get("iron")); ((ItemWandCasting) wand.getItem()).setRod(wand, (WandRod) WandRod.rods.get("profane")); - ((ItemWandCasting) wand.getItem()).storeAllVis(wand, new AspectList().add(Aspect.FIRE, 5000).add(Aspect.WATER, 5000).add(Aspect.EARTH, 5000).add(Aspect.AIR, 5000).add(Aspect.ORDER, 5000).add(Aspect.ENTROPY, 5000)); + ((ItemWandCasting) wand.getItem()) + .storeAllVis( + wand, + new AspectList() + .add(Aspect.FIRE, 5000) + .add(Aspect.WATER, 5000) + .add(Aspect.EARTH, 5000) + .add(Aspect.AIR, 5000) + .add(Aspect.ORDER, 5000) + .add(Aspect.ENTROPY, 5000)); list.add(wand); if (Compat.bm && Config.crossWand) { wand = new ItemStack(ConfigItems.itemWandCasting, 1, 84); diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ManaStaffUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/ManaStaffUpdate.java index f03e502..6fc7edd 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ManaStaffUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ManaStaffUpdate.java @@ -15,40 +15,35 @@ public class ManaStaffUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); public void onUpdate(ItemStack itemstack, EntityPlayer player) { - if(Compat.am2 && Config.crossWand) - { - if(player.ticksExisted % 40 == 0){ - - try - { + if (Compat.am2 && Config.crossWand) { + if (player.ticksExisted % 40 == 0) { + + try { IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player); - + float cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum")) - cost = 0.5F; - else - cost = 1.0F; - - if(prop == null || prop.getCurrentMana() <= 0) - return; - - - for(int x = 0;x < primals.length;x++){ - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) { + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("vinteum")) cost = 0.5F; + else cost = 1.0F; + + if (prop == null || prop.getCurrentMana() <= 0) return; + + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if(prop.getCurrentMana() > cost * deficit) - { + if (prop.getCurrentMana() > cost * deficit) { prop.setCurrentMana(prop.getCurrentMana() - cost * deficit); - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); } } } - } - catch(Throwable e){} + } catch (Throwable e) { + } } - } - } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ManaWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/ManaWandUpdate.java index f16a5c2..6c4ee59 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ManaWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ManaWandUpdate.java @@ -3,12 +3,11 @@ package fox.spiteful.forbidden.items.wands; import am2.api.ArsMagicaApi; import am2.api.IExtendedProperties; import fox.spiteful.forbidden.Config; +import fox.spiteful.forbidden.compat.Compat; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; - -import fox.spiteful.forbidden.compat.Compat; import thaumcraft.common.items.wands.ItemWandCasting; public class ManaWandUpdate implements IWandRodOnUpdate { @@ -16,40 +15,35 @@ public class ManaWandUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); public void onUpdate(ItemStack itemstack, EntityPlayer player) { - if(Compat.am2 && Config.crossWand) - { - if(player.ticksExisted % 100 == 0){ - - try - { + if (Compat.am2 && Config.crossWand) { + if (player.ticksExisted % 100 == 0) { + + try { IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player); - + float cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum")) - cost = 0.8F; - else - cost = 1.4F; - - if(prop == null || prop.getCurrentMana() <= 0) - return; - - - for(int x = 0;x < primals.length;x++){ - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) { + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("vinteum")) cost = 0.8F; + else cost = 1.4F; + + if (prop == null || prop.getCurrentMana() <= 0) return; + + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if(prop.getCurrentMana() > cost * deficit) - { + if (prop.getCurrentMana() > cost * deficit) { prop.setCurrentMana(prop.getCurrentMana() - cost * deficit); - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); } } } + } catch (Throwable e) { } - catch(Throwable e){} } - } - } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/ProfaneWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/ProfaneWandUpdate.java index 4697ea5..9633128 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/ProfaneWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/ProfaneWandUpdate.java @@ -15,34 +15,38 @@ public class ProfaneWandUpdate implements IWandRodOnUpdate { public void onUpdate(ItemStack itemstack, EntityPlayer player) { - if(player.ticksExisted % 20 == 0){ + if (player.ticksExisted % 20 == 0) { NBTTagCompound tag = itemstack.getTagCompound(); - if(!tag.hasKey("contract")){ + if (!tag.hasKey("contract")) { Thaumcraft.proxy.getResearchManager().completeResearch(player, "ROD_profane"); tag.setInteger("contract", 25000); - } - else if(tag.getInteger("contract") <= 0) - return; + } else if (tag.getInteger("contract") <= 0) return; - for(int x = 0;x < primals.length && tag.getInteger("contract") > 0;x++){ - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) { + for (int x = 0; x < primals.length && tag.getInteger("contract") > 0; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { int restore = Math.min(tag.getInteger("contract"), deficit); - ((ItemWandCasting)itemstack.getItem()).addRealVis(itemstack, primals[x], restore, true); + ((ItemWandCasting) itemstack.getItem()).addRealVis(itemstack, primals[x], restore, true); tag.setInteger("contract", tag.getInteger("contract") - restore); - if(player.worldObj.rand.nextInt(2501) < restore) - Thaumcraft.addStickyWarpToPlayer(player, 1); + if (player.worldObj.rand.nextInt(2501) < restore) Thaumcraft.addStickyWarpToPlayer(player, 1); } } - if(tag.getInteger("contract") <= 0) { - ((ItemWandCasting)itemstack.getItem()).setRod(itemstack, WandRod.rods.get("profaned")); + if (tag.getInteger("contract") <= 0) { + ((ItemWandCasting) itemstack.getItem()).setRod(itemstack, WandRod.rods.get("profaned")); Thaumcraft.addStickyWarpToPlayer(player, 1); - player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + (double)(player.height / 2.0F), player.posZ, 0.0D, 0.0D, 0.0D); + player.worldObj.spawnParticle( + "largeexplode", + player.posX, + player.posY + (double) (player.height / 2.0F), + player.posZ, + 0.0D, + 0.0D, + 0.0D); } itemstack.setTagCompound(tag); } - } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/TaintedWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/TaintedWandUpdate.java index 2f657cf..d7a8785 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/TaintedWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/TaintedWandUpdate.java @@ -6,20 +6,20 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; -import fox.spiteful.forbidden.Config; - public class TaintedWandUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); public void onUpdate(ItemStack itemstack, EntityPlayer player) { - if(player.ticksExisted % 100 == 0 && player.worldObj.getBiomeGenForCoords((int)player.posX, (int)player.posZ).biomeID == thaumcraft.common.config.Config.biomeTaintID){ - for(int x = 0;x < primals.length;x++){ - if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + if (player.ticksExisted % 100 == 0 + && player.worldObj.getBiomeGenForCoords((int) player.posX, (int) player.posZ).biomeID + == thaumcraft.common.config.Config.biomeTaintID) { + for (int x = 0; x < primals.length; x++) { + if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) + < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) / 10) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); } } } - } } diff --git a/src/main/java/fox/spiteful/forbidden/items/wands/YandereWandUpdate.java b/src/main/java/fox/spiteful/forbidden/items/wands/YandereWandUpdate.java index b4a74f8..6ba41ca 100644 --- a/src/main/java/fox/spiteful/forbidden/items/wands/YandereWandUpdate.java +++ b/src/main/java/fox/spiteful/forbidden/items/wands/YandereWandUpdate.java @@ -1,65 +1,55 @@ package fox.spiteful.forbidden.items.wands; import fox.spiteful.forbidden.Config; -import fox.spiteful.forbidden.LogHandler; +import fox.spiteful.forbidden.compat.Compat; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import org.apache.logging.log4j.Level; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; import vazkii.botania.api.mana.ManaItemHandler; -import fox.spiteful.forbidden.compat.Compat; - public class YandereWandUpdate implements IWandRodOnUpdate { Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]); - - public void onUpdate(ItemStack itemstack, EntityPlayer player) - { - if(Compat.botan && Config.crossWand && player.ticksExisted % 40 == 0 && checkHotbar(itemstack, player)) - { - try - { + + public void onUpdate(ItemStack itemstack, EntityPlayer player) { + if (Compat.botan && Config.crossWand && player.ticksExisted % 40 == 0 && checkHotbar(itemstack, player)) { + try { int cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("manasteel") - ||((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("elementium")) - cost = Config.manavis - 2; - else - cost = Config.manavis; + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("manasteel") + || ((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("elementium")) cost = Config.manavis - 2; + else cost = Config.manavis; cost = Math.max(0, cost); - - for(int x = 0;x < primals.length;x++) - { - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if(deficit > 0) - { + + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if(ManaItemHandler.requestManaExact(itemstack, player, cost * deficit, true)) - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + if (ManaItemHandler.requestManaExact(itemstack, player, cost * deficit, true)) + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); } } - - } - catch(Throwable e) - { + + } catch (Throwable e) { return; } } - } - private boolean checkHotbar(ItemStack stack, EntityPlayer player) - { - for(int x = 0; x < 9; ++x) - { + private boolean checkHotbar(ItemStack stack, EntityPlayer player) { + for (int x = 0; x < 9; ++x) { ItemStack item = player.inventory.getStackInSlot(x); - if(item == stack) - return true; + if (item == stack) return true; } return false; } - } diff --git a/src/main/java/fox/spiteful/forbidden/potions/DarkPotions.java b/src/main/java/fox/spiteful/forbidden/potions/DarkPotions.java index 0d032bd..85172ff 100644 --- a/src/main/java/fox/spiteful/forbidden/potions/DarkPotions.java +++ b/src/main/java/fox/spiteful/forbidden/potions/DarkPotions.java @@ -2,19 +2,18 @@ package fox.spiteful.forbidden.potions; import fox.spiteful.forbidden.Config; import fox.spiteful.forbidden.compat.Compat; -import net.minecraft.potion.Potion; -import net.minecraft.util.ResourceLocation; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import net.minecraft.potion.Potion; +import net.minecraft.util.ResourceLocation; public class DarkPotions { public static final ResourceLocation icons = new ResourceLocation("forbidden", "textures/misc/potions.png"); public static Potion bloodSeal; public static Potion dragonwrack; - public static void alchemize(){ - if(Potion.potionTypes.length < 256) { + public static void alchemize() { + if (Potion.potionTypes.length < 256) { Potion[] potionTypes = null; for (Field f : Potion.class.getDeclaredFields()) { f.setAccessible(true); @@ -35,7 +34,6 @@ public class DarkPotions { } } - if(Compat.bm) - bloodSeal = new PotionBloodSeal(Config.bloodSealPotionID); + if (Compat.bm) bloodSeal = new PotionBloodSeal(Config.bloodSealPotionID); } } diff --git a/src/main/java/fox/spiteful/forbidden/potions/PotionBloodSeal.java b/src/main/java/fox/spiteful/forbidden/potions/PotionBloodSeal.java index b31c797..bccc912 100644 --- a/src/main/java/fox/spiteful/forbidden/potions/PotionBloodSeal.java +++ b/src/main/java/fox/spiteful/forbidden/potions/PotionBloodSeal.java @@ -6,7 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.potion.Potion; public class PotionBloodSeal extends Potion { - public PotionBloodSeal(int id){ + public PotionBloodSeal(int id) { super(id, true, 0xAC1919); this.setPotionName("potion.blood_seal"); this.setIconIndex(4, 0); diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileBloodthorn.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileBloodthorn.java index d20e659..252a8a8 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/SubTileBloodthorn.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileBloodthorn.java @@ -11,11 +11,10 @@ * * File Created @ [May 15, 2014, 4:47:41 PM (GMT)] */ - package fox.spiteful.forbidden.tiles; +import java.util.List; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -25,45 +24,59 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; -import java.util.List; - public class SubTileBloodthorn extends SubTileFunctional { public static LexiconEntry lexicon; @Override public void onUpdate() { super.onUpdate(); - if(redstoneSignal > 0) - return; + if (redstoneSignal > 0) return; final int range = 6; final int cost = 40; - List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); - for(EntityLivingBase entity : entities) { - if(!(entity instanceof EntityPlayer) && entity.getActivePotionEffect(Potion.weakness) == null && mana >= cost && !entity.worldObj.isRemote) { + List entities = supertile + .getWorldObj() + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + supertile.xCoord - range, + supertile.yCoord - range, + supertile.zCoord - range, + supertile.xCoord + range, + supertile.yCoord + range, + supertile.zCoord + range)); + for (EntityLivingBase entity : entities) { + if (!(entity instanceof EntityPlayer) + && entity.getActivePotionEffect(Potion.weakness) == null + && mana >= cost + && !entity.worldObj.isRemote) { entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2)); mana -= cost; } } } + @Override public boolean acceptsRedstone() { return true; } + @Override public int getColor() { return 0x7D0600; } + @Override public int getMaxMana() { return 360; } + @Override public LexiconEntry getEntry() { return lexicon; } @Override - public IIcon getIcon(){ + public IIcon getIcon() { return BotaniaAPI.getSignatureForName("bloodthorn").getIconForStack(null); } -} \ No newline at end of file +} diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java index 4b1fdb4..6bd2f76 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java @@ -1,6 +1,5 @@ package fox.spiteful.forbidden.tiles; -import fox.spiteful.forbidden.compat.DarkSignature; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -19,41 +18,45 @@ public class SubTileEuclidaisy extends SubTileFunctional { public static LexiconEntry lexicon; @Override - public void onUpdate(){ + public void onUpdate() { super.onUpdate(); - if(redstoneSignal > 0) - return; + if (redstoneSignal > 0) return; - if(mana >= cost && !supertile.getWorldObj().isRemote && this.ticksExisted % 400 == 0) { - Thaumcraft.proxy.burst(supertile.getWorldObj(), (double)supertile.xCoord + 0.5D, (double)supertile.yCoord + 0.5D, (double)supertile.zCoord + 0.5D, 1.0F); + if (mana >= cost && !supertile.getWorldObj().isRemote && this.ticksExisted % 400 == 0) { + Thaumcraft.proxy.burst( + supertile.getWorldObj(), + (double) supertile.xCoord + 0.5D, + (double) supertile.yCoord + 0.5D, + (double) supertile.zCoord + 0.5D, + 1.0F); AspectList aspect; - if(supertile.getWorldObj().rand.nextInt(10) < 4) - aspect = (new AspectList()).add(Aspect.AURA, 2); + if (supertile.getWorldObj().rand.nextInt(10) < 4) aspect = (new AspectList()).add(Aspect.AURA, 2); else { Aspect[] aspects = Aspect.aspects.values().toArray(new Aspect[0]); - aspect = (new AspectList()).add(aspects[supertile.getWorldObj().rand.nextInt(aspects.length)], 2); + aspect = (new AspectList()) + .add(aspects[supertile.getWorldObj().rand.nextInt(aspects.length)], 2); } ItemStack ess = new ItemStack(ConfigItems.itemWispEssence); - ((ItemWispEssence)ess.getItem()).setAspects(ess, aspect); + ((ItemWispEssence) ess.getItem()).setAspects(ess, aspect); dropItem(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, ess); mana -= cost; sync(); } } - public void dropItem(World world, int x, int y, int z, ItemStack item){ + public void dropItem(World world, int x, int y, int z, ItemStack item) { float f = 0.7F; - double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, item); + double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, item); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); } @Override - public int getColor(){ + public int getColor() { return 0xFF8CFF; } @@ -68,12 +71,12 @@ public class SubTileEuclidaisy extends SubTileFunctional { } @Override - public LexiconEntry getEntry(){ + public LexiconEntry getEntry() { return lexicon; } @Override - public IIcon getIcon(){ + public IIcon getIcon() { return BotaniaAPI.getSignatureForName("euclidaisy").getIconForStack(null); } } diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java index 4fac440..4709c7d 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java @@ -9,7 +9,6 @@ * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) * */ - package fox.spiteful.forbidden.tiles; import net.minecraft.block.Block; @@ -21,8 +20,6 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileGenerating; -import java.util.Random; - public class SubTileTainthistle extends SubTileGenerating { private static final String TAG_BURN_TIME = "burnTime"; @@ -34,7 +31,7 @@ public class SubTileTainthistle extends SubTileGenerating { public void onUpdate() { super.onUpdate(); boolean didSomething = false; - if(this.ticksExisted % 80 == 0) { + if (this.ticksExisted % 80 == 0) { if (!supertile.getWorldObj().isRemote) { for (int ex = supertile.xCoord - range; ex <= supertile.xCoord + range; ex++) { for (int wy = supertile.yCoord - range; wy <= supertile.yCoord + range; wy++) { @@ -55,9 +52,8 @@ public class SubTileTainthistle extends SubTileGenerating { } } } - if(burnTime > 0){ - if(supertile.getWorldObj().rand.nextInt(8) == 0) - doBurnParticles(); + if (burnTime > 0) { + if (supertile.getWorldObj().rand.nextInt(8) == 0) doBurnParticles(); burnTime--; } } @@ -68,16 +64,25 @@ public class SubTileTainthistle extends SubTileGenerating { } public void doBurnParticles() { - Thaumcraft.proxy.reservoirBubble(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, 0x4D00FF); + Thaumcraft.proxy.reservoirBubble( + supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, 0x4D00FF); } - public boolean isFlux(int x, int y, int z){ + public boolean isFlux(int x, int y, int z) { Block target = supertile.getWorldObj().getBlock(x, y, z); return target == ConfigBlocks.blockFluxGas || target == ConfigBlocks.blockFluxGoo; } public void playSound() { - supertile.getWorldObj().playSoundEffect(supertile.xCoord, supertile.yCoord, supertile.zCoord, "random.drink", 0.05F, 0.5F + (float) Math.random() * 0.5F); + supertile + .getWorldObj() + .playSoundEffect( + supertile.xCoord, + supertile.yCoord, + supertile.zCoord, + "random.drink", + 0.05F, + 0.5F + (float) Math.random() * 0.5F); } @Override @@ -123,8 +128,7 @@ public class SubTileTainthistle extends SubTileGenerating { } @Override - public IIcon getIcon(){ + public IIcon getIcon() { return BotaniaAPI.getSignatureForName("tainthistle").getIconForStack(null); } - } diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java index b4a991b..bef907f 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java @@ -1,6 +1,6 @@ package fox.spiteful.forbidden.tiles; -import fox.spiteful.forbidden.compat.DarkSignature; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.AxisAlignedBB; @@ -14,48 +14,62 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; -import java.util.List; - public class SubTileWhisperweed extends SubTileFunctional { private static final int cost = 6000; - private final static int range = 3; + private static final int range = 3; public static LexiconEntry lexicon; @Override - public void onUpdate(){ + public void onUpdate() { super.onUpdate(); - if(redstoneSignal > 0) - return; + if (redstoneSignal > 0) return; - if(!supertile.getWorldObj().isRemote && mana >= cost && this.ticksExisted % 300 == 0) { - List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range + 1, supertile.yCoord + range + 1, supertile.zCoord + range + 1)); - if(players.size() > 0) { + if (!supertile.getWorldObj().isRemote && mana >= cost && this.ticksExisted % 300 == 0) { + List players = supertile + .getWorldObj() + .getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + supertile.xCoord - range, + supertile.yCoord - range, + supertile.zCoord - range, + supertile.xCoord + range + 1, + supertile.yCoord + range + 1, + supertile.zCoord + range + 1)); + if (players.size() > 0) { EntityPlayer player = players.get(supertile.getWorldObj().rand.nextInt(players.size())); int amt = 1 + player.worldObj.rand.nextInt(3); - if(player.worldObj.rand.nextInt(10) < 2){ + if (player.worldObj.rand.nextInt(10) < 2) { amt += 1 + player.worldObj.rand.nextInt(3); Thaumcraft.addWarpToPlayer(player, 1 + player.worldObj.rand.nextInt(5), true); } - for(int a = 0; a < amt; ++a) { + for (int a = 0; a < amt; ++a) { Aspect aspect; - if(player.worldObj.rand.nextInt(25) > 2) - aspect = (Aspect)Aspect.getPrimalAspects().get(player.worldObj.rand.nextInt(6)); + if (player.worldObj.rand.nextInt(25) > 2) + aspect = (Aspect) Aspect.getPrimalAspects().get(player.worldObj.rand.nextInt(6)); else - aspect = (Aspect)Aspect.getCompoundAspects().get(player.worldObj.rand.nextInt(Aspect.getCompoundAspects().size())); - Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, (short)1); - PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), (short)1, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP)player); + aspect = (Aspect) Aspect.getCompoundAspects() + .get(player.worldObj.rand.nextInt( + Aspect.getCompoundAspects().size())); + Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, (short) 1); + PacketHandler.INSTANCE.sendTo( + new PacketAspectPool( + aspect.getTag(), + (short) 1, + Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor( + player.getCommandSenderName(), aspect))), + (EntityPlayerMP) player); ResearchManager.scheduleSave(player); } mana -= cost; } - } } @Override - public int getColor(){ + public int getColor() { return 0x745380; } @@ -70,12 +84,12 @@ public class SubTileWhisperweed extends SubTileFunctional { } @Override - public LexiconEntry getEntry(){ + public LexiconEntry getEntry() { return lexicon; } @Override - public IIcon getIcon(){ + public IIcon getIcon() { return BotaniaAPI.getSignatureForName("whisperweed").getIconForStack(null); } } diff --git a/src/main/java/fox/spiteful/forbidden/tiles/TileEntityWrathCage.java b/src/main/java/fox/spiteful/forbidden/tiles/TileEntityWrathCage.java index be9b633..c766ccb 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/TileEntityWrathCage.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/TileEntityWrathCage.java @@ -1,5 +1,7 @@ package fox.spiteful.forbidden.tiles; +import fox.spiteful.forbidden.Config; +import fox.spiteful.forbidden.DarkAspects; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -12,12 +14,7 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.aspects.IEssentiaTransport; -import fox.spiteful.forbidden.Config; -import fox.spiteful.forbidden.DarkAspects; - - -public class TileEntityWrathCage extends TileEntity implements IAspectContainer, IEssentiaTransport -{ +public class TileEntityWrathCage extends TileEntity implements IAspectContainer, IEssentiaTransport { private final WrathSpawnerLogic spawnLogic = new WrathSpawnerLogic(this); public int wrath = 0; public int sloth = 0; @@ -29,8 +26,7 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, /** * Reads a tile entity from NBT. */ - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.spawnLogic.readFromNBT(par1NBTTagCompound); this.wrath = par1NBTTagCompound.getShort("Wrath"); @@ -44,24 +40,23 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, /** * Writes a tile entity to NBT. */ - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); this.spawnLogic.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setShort("Wrath", (short)this.wrath); - par1NBTTagCompound.setShort("Sloth", (short)this.sloth); - par1NBTTagCompound.setShort("Special", (short)this.special); + par1NBTTagCompound.setShort("Wrath", (short) this.wrath); + par1NBTTagCompound.setShort("Sloth", (short) this.sloth); + par1NBTTagCompound.setShort("Special", (short) this.special); par1NBTTagCompound.setByte("Mode", this.mode); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { readFromNBT(pkt.func_148857_g()); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - + @Override - public Packet getDescriptionPacket() { + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound); @@ -72,39 +67,47 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * ticks and creates a new spawn inside its implementation. */ @Override - public void updateEntity() - { - if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + public void updateEntity() { + if (!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { this.spawnLogic.updateSpawner(); } - - if(Config.wrathCost > 0 && spawnLogic.isMobSet() && !(special >= 64 || wrath >= 64 || sloth >= 64)) - drawEssentia(); - + + if (Config.wrathCost > 0 && spawnLogic.isMobSet() && !(special >= 64 || wrath >= 64 || sloth >= 64)) + drawEssentia(); + super.updateEntity(); } - - void drawEssentia() - { - for(int x = 0;x < ForgeDirection.VALID_DIRECTIONS.length;x++){ + + void drawEssentia() { + for (int x = 0; x < ForgeDirection.VALID_DIRECTIONS.length; x++) { ForgeDirection current = ForgeDirection.VALID_DIRECTIONS[x]; TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, current); - if(te != null) { - IEssentiaTransport ic = (IEssentiaTransport)te; - if(ic.canOutputTo(current.getOpposite()) && special < 64 //THE DIRECTION HERE MAY BE WRONG SPITEFULFOXY SO CHECK IT - && ic.getEssentiaType(current.getOpposite()) == aspect && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(aspect, 1, current.getOpposite()) == 1) { + if (te != null) { + IEssentiaTransport ic = (IEssentiaTransport) te; + if (ic.canOutputTo(current.getOpposite()) + && special < 64 // THE DIRECTION HERE MAY BE WRONG SPITEFULFOXY SO CHECK IT + && ic.getEssentiaType(current.getOpposite()) == aspect + && ic.getEssentiaAmount(current.getOpposite()) > 0 + && ic.takeEssentia(aspect, 1, current.getOpposite()) == 1) { special++; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); return; - } - else if(ic.canOutputTo(current.getOpposite()) && wrath < 64 && special < Config.wrathCost - && ic.getEssentiaType(current.getOpposite()) == DarkAspects.WRATH && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(DarkAspects.WRATH, 1, current.getOpposite()) == 1) { + } else if (ic.canOutputTo(current.getOpposite()) + && wrath < 64 + && special < Config.wrathCost + && ic.getEssentiaType(current.getOpposite()) == DarkAspects.WRATH + && ic.getEssentiaAmount(current.getOpposite()) > 0 + && ic.takeEssentia(DarkAspects.WRATH, 1, current.getOpposite()) == 1) { wrath++; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); return; - } - else if(ic.canOutputTo(current.getOpposite()) && sloth < 64 && special < Config.wrathCost && wrath < Config.wrathCost - && ic.getEssentiaType(current.getOpposite()) == DarkAspects.SLOTH && ic.getEssentiaAmount(current.getOpposite()) > 0 && ic.takeEssentia(DarkAspects.SLOTH, 1, current.getOpposite()) == 1) { + } else if (ic.canOutputTo(current.getOpposite()) + && sloth < 64 + && special < Config.wrathCost + && wrath < Config.wrathCost + && ic.getEssentiaType(current.getOpposite()) == DarkAspects.SLOTH + && ic.getEssentiaAmount(current.getOpposite()) > 0 + && ic.takeEssentia(DarkAspects.SLOTH, 1, current.getOpposite()) == 1) { sloth++; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); return; @@ -112,86 +115,66 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, } } } - + public void checkAspect() { - if(aspect != spawnLogic.getAspect()) - special = 0; + if (aspect != spawnLogic.getAspect()) special = 0; aspect = spawnLogic.getAspect(); } - + /** * Called when a client event is received with the event number and argument, see World.sendClientEvent */ - public boolean receiveClientEvent(int par1, int x) - { + public boolean receiveClientEvent(int par1, int x) { return this.spawnLogic.setDelayToMin(par1) ? true : super.receiveClientEvent(par1, x); } /** * Returns the spawner logic associated with this spawner */ - public WrathSpawnerLogic getSpawnerLogic() - { + public WrathSpawnerLogic getSpawnerLogic() { return this.spawnLogic; } - - public AspectList getAspects() - { + + public AspectList getAspects() { AspectList list = new AspectList(); - if(Config.wrathCost > 0 && spawnLogic.isMobSet()) - { - if(mode == 0) - list.add(aspect, special); - else if(mode == 1) - list.add(DarkAspects.WRATH, wrath); - else - list.add(DarkAspects.SLOTH, sloth); + if (Config.wrathCost > 0 && spawnLogic.isMobSet()) { + if (mode == 0) list.add(aspect, special); + else if (mode == 1) list.add(DarkAspects.WRATH, wrath); + else list.add(DarkAspects.SLOTH, sloth); } return list; } - - public void setAspects(AspectList aspects) - { - - } - + + public void setAspects(AspectList aspects) {} + /** * This method is used to determine of a specific aspect can be added to this container. * @param tag * @return true or false */ - public boolean doesContainerAccept(Aspect tag) - { - if(Config.wrathCost <= 0) - return false; - else - return (tag == DarkAspects.WRATH || tag == DarkAspects.SLOTH || tag == aspect); + public boolean doesContainerAccept(Aspect tag) { + if (Config.wrathCost <= 0) return false; + else return (tag == DarkAspects.WRATH || tag == DarkAspects.SLOTH || tag == aspect); } - + /** * This method is used to add a certain amount of an aspect to the tile entity. * @param tag * @param amount * @return the amount of aspect left over that could not be added. */ - public int addToContainer(Aspect tag, int amount) - { - if(Config.wrathCost <= 0) - return amount; - if(tag == DarkAspects.WRATH){ + public int addToContainer(Aspect tag, int amount) { + if (Config.wrathCost <= 0) return amount; + if (tag == DarkAspects.WRATH) { wrath += amount; return 0; - } - else if(tag == DarkAspects.SLOTH){ + } else if (tag == DarkAspects.SLOTH) { sloth += amount; return 0; - } - else if(tag == aspect){ + } else if (tag == aspect) { special += amount; return 0; - } - else - return amount; + } else return amount; } /** @@ -200,8 +183,7 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * @param amount * @return true if that amount of aspect was available and was removed */ - public boolean takeFromContainer(Aspect tag, int amount) - { + public boolean takeFromContainer(Aspect tag, int amount) { return false; } @@ -211,16 +193,11 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * @param amount * @return */ - public boolean doesContainerContainAmount(Aspect tag, int amount) - { - if(tag == DarkAspects.WRATH) - return wrath >= amount; - else if(tag == DarkAspects.SLOTH) - return sloth >= amount; - else if(tag == aspect) - return special >= amount; - else - return false; + public boolean doesContainerContainAmount(Aspect tag, int amount) { + if (tag == DarkAspects.WRATH) return wrath >= amount; + else if (tag == DarkAspects.SLOTH) return sloth >= amount; + else if (tag == aspect) return special >= amount; + else return false; } /** @@ -228,55 +205,45 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * @param tag * @return the amount of that aspect found */ - public int containerContains(Aspect tag) - { - if(tag == DarkAspects.WRATH) - return wrath; - else if(tag == DarkAspects.SLOTH) - return sloth; - else if(tag == aspect) - return special; - else - return 0; + public int containerContains(Aspect tag) { + if (tag == DarkAspects.WRATH) return wrath; + else if (tag == DarkAspects.SLOTH) return sloth; + else if (tag == aspect) return special; + else return 0; } - + /** * Checks if the tile entity contains all the listed aspects and their amounts * @param ot the ObjectTags object that contains the aspects and their amounts. * @return - * + * * Going away in the next major patch */ @Deprecated - public boolean doesContainerContain(AspectList ot) - { + public boolean doesContainerContain(AspectList ot) { return false; } - + /** * removes a bunch of different aspects and amounts from the tile entity. * @param ot the ObjectTags object that contains the aspects and their amounts. * @return true if all the aspects and their amounts were available and successfully removed - * + * * Going away in the next major patch */ @Deprecated - public boolean takeFromContainer(AspectList ot) - { + public boolean takeFromContainer(AspectList ot) { return false; } - + /** * Is this tile able to connect to other vis users/sources on the specified side? * @param face * @return */ - public boolean isConnectable(ForgeDirection face) - { - if(Config.wrathCost > 0) - return true; - else - return false; + public boolean isConnectable(ForgeDirection face) { + if (Config.wrathCost > 0) return true; + else return false; } /** @@ -284,8 +251,7 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * @param face * @return */ - public boolean canInputFrom(ForgeDirection face) - { + public boolean canInputFrom(ForgeDirection face) { return true; } @@ -294,8 +260,7 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * @param face * @return */ - public boolean canOutputTo(ForgeDirection face) - { + public boolean canOutputTo(ForgeDirection face) { return false; } @@ -303,131 +268,105 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * Sets the amount of suction this block will apply * @param suction */ - public void setSuction(Aspect aspect, int amount) - { - - } + public void setSuction(Aspect aspect, int amount) {} - //** - //* Returns the amount of suction this block is applying. - //* @param loc - //* the location from where the suction is being checked - //* @return - //*/ - //public AspectList getSuction(ForgeDirection face) - //{ - //AspectList list = new AspectList(); - //if(Config.wrathCost <= 0) - //return list; - //if(special < 64) - //list.add(aspect, 256); - //if(special < Config.wrathCost && wrath < 64) - //list.add(DarkAspects.WRATH, 256); - //if(special < Config.wrathCost && wrath < Config.wrathCost && sloth < 64) - //list.add(DarkAspects.SLOTH, 256); - - //return list; - //} + // ** + // * Returns the amount of suction this block is applying. + // * @param loc + // * the location from where the suction is being checked + // * @return + // */ + // public AspectList getSuction(ForgeDirection face) + // { + // AspectList list = new AspectList(); + // if(Config.wrathCost <= 0) + // return list; + // if(special < 64) + // list.add(aspect, 256); + // if(special < Config.wrathCost && wrath < 64) + // list.add(DarkAspects.WRATH, 256); + // if(special < Config.wrathCost && wrath < Config.wrathCost && sloth < 64) + // list.add(DarkAspects.SLOTH, 256); + + // return list; + // } /** - * Returns the type of suction this block is applying. + * Returns the type of suction this block is applying. * @param loc * the location from where the suction is being checked * @return * a return type of null indicates the suction is untyped and the first thing available will be drawn */ - public Aspect getSuctionType(ForgeDirection face) - { - if(Config.wrathCost <= 0) - return null; - if(mode == 0) - return aspect; - else if(mode == 1) - return DarkAspects.WRATH; - else - return DarkAspects.SLOTH; + public Aspect getSuctionType(ForgeDirection face) { + if (Config.wrathCost <= 0) return null; + if (mode == 0) return aspect; + else if (mode == 1) return DarkAspects.WRATH; + else return DarkAspects.SLOTH; } - + /** - * Returns the strength of suction this block is applying. + * Returns the strength of suction this block is applying. * @param loc * the location from where the suction is being checked * @return */ - public int getSuctionAmount(ForgeDirection face) - { - if(Config.wrathCost > 0) - return 256; - else - return 0; + public int getSuctionAmount(ForgeDirection face) { + if (Config.wrathCost > 0) return 256; + else return 0; } - + /** * remove the specified amount of vis from this transport tile * @param suction * @return how much was actually taken */ - public int takeEssentia(Aspect aspect, int amount, ForgeDirection dir) - { + public int takeEssentia(Aspect aspect, int amount, ForgeDirection dir) { return 0; } - + /** * add the specified amount of vis to this transport tile * @return how much was actually added */ - public int addEssentia(Aspect inp, int amount, ForgeDirection dir) - { - if(inp == aspect) - { + public int addEssentia(Aspect inp, int amount, ForgeDirection dir) { + if (inp == aspect) { special += Math.min(amount, 64); return Math.min(amount, 64); - } - else if(inp == DarkAspects.WRATH) - { + } else if (inp == DarkAspects.WRATH) { wrath += Math.min(amount, 64); return Math.min(amount, 64); - } - else if(inp == DarkAspects.SLOTH) - { + } else if (inp == DarkAspects.SLOTH) { sloth += Math.min(amount, 64); return Math.min(amount, 64); - } - else - return amount; + } else return amount; } - + /** * What type of essentia this contains * @param face * @return */ - public Aspect getEssentiaType(ForgeDirection face) - { + public Aspect getEssentiaType(ForgeDirection face) { return getSuctionType(face); } - + /** * How much essentia this block contains * @param face * @return */ - public int getEssentiaAmount(ForgeDirection face) - { - if(mode == 0) - return special; - else if(mode == 1) - return wrath; - else - return sloth; + public int getEssentiaAmount(ForgeDirection face) { + if (mode == 0) return special; + else if (mode == 1) return wrath; + else return sloth; } /** * Essentia will not be drawn from this container unless the suction exceeds this amount. * @return the amount */ - public int getMinimumSuction() - { + public int getMinimumSuction() { return 9000; } @@ -436,8 +375,7 @@ public class TileEntityWrathCage extends TileEntity implements IAspectContainer, * Used by jars and alembics that have smaller than normal hitboxes * @return */ - public boolean renderExtendedTube() - { + public boolean renderExtendedTube() { return false; } } diff --git a/src/main/java/fox/spiteful/forbidden/tiles/WrathSpawnerLogic.java b/src/main/java/fox/spiteful/forbidden/tiles/WrathSpawnerLogic.java index f4237da..643a863 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/WrathSpawnerLogic.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/WrathSpawnerLogic.java @@ -1,5 +1,8 @@ package fox.spiteful.forbidden.tiles; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.forbidden.Config; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; @@ -12,11 +15,6 @@ import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.Thaumcraft; -import fox.spiteful.forbidden.Config; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class WrathSpawnerLogic { /** The mob spawner we deal with */ final TileEntityWrathCage mobSpawnerEntity; @@ -25,6 +23,7 @@ public class WrathSpawnerLogic { /** The delay to spawn. */ public int spawnDelay = 20; + private String mobID = "Pig"; Aspect aspect = Aspect.GREED; private boolean slothful = false; @@ -37,6 +36,7 @@ public class WrathSpawnerLogic { /** A counter for spawn tries. */ private int spawnCount = 3; + private Entity renderEntity; private int maxNearbyEntities = 6; @@ -63,10 +63,8 @@ public class WrathSpawnerLogic { public void setMobID(String par1Str) { this.mobID = par1Str; - if (Config.spawnerMobs.containsKey(mobID)) - aspect = Config.spawnerMobs.get(mobID); - else - aspect = Aspect.GREED; + if (Config.spawnerMobs.containsKey(mobID)) aspect = Config.spawnerMobs.get(mobID); + else aspect = Aspect.GREED; } public void mobIsSet(boolean inp) { @@ -78,7 +76,15 @@ public class WrathSpawnerLogic { } public void updateSpawnerBlock(int par1) { - this.mobSpawnerEntity.getWorldObj().addBlockEvent(this.mobSpawnerEntity.xCoord, this.mobSpawnerEntity.yCoord, this.mobSpawnerEntity.zCoord, Blocks.mob_spawner, par1, 0); + this.mobSpawnerEntity + .getWorldObj() + .addBlockEvent( + this.mobSpawnerEntity.xCoord, + this.mobSpawnerEntity.yCoord, + this.mobSpawnerEntity.zCoord, + Blocks.mob_spawner, + par1, + 0); } public World getSpawnerWorld() { @@ -98,15 +104,17 @@ public class WrathSpawnerLogic { } public void updateSpawner() { - if (!mobSet) - return; + if (!mobSet) return; double d0; if (this.getSpawnerWorld().isRemote && (fuel > 0 || Config.wrathCost <= 0)) { - double d1 = (double) ((float) this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); - double d2 = (double) ((float) this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); - d0 = (double) ((float) this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); + double d1 = (double) + ((float) this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); + double d2 = (double) + ((float) this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); + d0 = (double) + ((float) this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); // this.getSpawnerWorld().spawnParticle("smoke", d1, d2, d0, 0.0D, // 0.0D, 0.0D); // this.getSpawnerWorld().spawnParticle("flame", d1, d2, d0, 0.0D, @@ -118,7 +126,8 @@ public class WrathSpawnerLogic { } this.field_98284_d = this.field_98287_c; - this.field_98287_c = (this.field_98287_c + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + this.field_98287_c = + (this.field_98287_c + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; } else if (Config.wrathCage) { if (Config.wrathCost > 0 && fuel <= 0) { if (mobSpawnerEntity.special >= Config.wrathCost) { @@ -143,8 +152,7 @@ public class WrathSpawnerLogic { this.updateDelay(); } - if (fuel <= 0 && Config.wrathCost > 0) - return; + if (fuel <= 0 && Config.wrathCost > 0) return; if (this.spawnDelay > 0) { --this.spawnDelay; @@ -158,19 +166,42 @@ public class WrathSpawnerLogic { return; } - //int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getAABBPool().getAABB((double) this.getSpawnerX(), (double) this.getSpawnerY(), (double) this.getSpawnerZ(), (double) (this.getSpawnerX() + 1), (double) (this.getSpawnerY() + 1), (double) (this.getSpawnerZ() + 1)).expand((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size(); - int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getBoundingBox((double)this.getSpawnerX(), (double)this.getSpawnerY(), (double)this.getSpawnerZ(), (double)(this.getSpawnerX() + 1), (double)(this.getSpawnerY() + 1), (double)(this.getSpawnerZ() + 1)).expand((double)(this.spawnRange * 2), 4.0D, (double)(this.spawnRange * 2))).size(); + // int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), + // AxisAlignedBB.getAABBPool().getAABB((double) this.getSpawnerX(), (double) this.getSpawnerY(), + // (double) this.getSpawnerZ(), (double) (this.getSpawnerX() + 1), (double) (this.getSpawnerY() + 1), + // (double) (this.getSpawnerZ() + 1)).expand((double) (this.spawnRange * 2), 4.0D, (double) + // (this.spawnRange * 2))).size(); + int j = this.getSpawnerWorld() + .getEntitiesWithinAABB( + entity.getClass(), + AxisAlignedBB.getBoundingBox( + (double) this.getSpawnerX(), + (double) this.getSpawnerY(), + (double) this.getSpawnerZ(), + (double) (this.getSpawnerX() + 1), + (double) (this.getSpawnerY() + 1), + (double) (this.getSpawnerZ() + 1)) + .expand((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))) + .size(); if (j >= this.maxNearbyEntities) { this.updateDelay(); return; } - d0 = (double) this.getSpawnerX() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange; - double d3 = (double) (this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1); - double d4 = (double) this.getSpawnerZ() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange; + d0 = (double) this.getSpawnerX() + + (this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) + * (double) this.spawnRange; + double d3 = (double) + (this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1); + double d4 = (double) this.getSpawnerZ() + + (this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) + * (double) this.spawnRange; EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null; - entity.setLocationAndAngles(d0, d3, d4, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); + entity.setLocationAndAngles( + d0, d3, d4, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); if ( // entityliving == null || @@ -178,7 +209,8 @@ public class WrathSpawnerLogic { // entityliving.getCanSpawnHere()) { this.spawnMob(entity); - this.getSpawnerWorld().playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); + this.getSpawnerWorld() + .playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); if (entityliving != null) { entityliving.spawnExplosionParticle(); @@ -186,10 +218,8 @@ public class WrathSpawnerLogic { } this.updateDelay(); - } else if (entityliving != null) - entityliving.isDead = true; + } else if (entityliving != null) entityliving.isDead = true; } - } } @@ -198,7 +228,11 @@ public class WrathSpawnerLogic { * entity. */ public boolean entityCanSpawn(EntityLiving entity) { - return entity.worldObj.checkNoEntityCollision(entity.boundingBox) && entity.worldObj.getCollidingBoundingBoxes(entity, entity.boundingBox).isEmpty() && !entity.worldObj.isAnyLiquid(entity.boundingBox); + return entity.worldObj.checkNoEntityCollision(entity.boundingBox) + && entity.worldObj + .getCollidingBoundingBoxes(entity, entity.boundingBox) + .isEmpty() + && !entity.worldObj.isAnyLiquid(entity.boundingBox); } private void updateDelay() { @@ -209,18 +243,15 @@ public class WrathSpawnerLogic { this.spawnDelay = this.minSpawnDelay + this.getSpawnerWorld().rand.nextInt(i); } - if (slothful) - spawnDelay += 200; + if (slothful) spawnDelay += 200; this.updateSpawnerBlock(1); } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { mobID = par1NBTTagCompound.getString("EntityId"); - if (Config.spawnerMobs.containsKey(mobID)) - aspect = Config.spawnerMobs.get(mobID); - else - aspect = Aspect.GREED; + if (Config.spawnerMobs.containsKey(mobID)) aspect = Config.spawnerMobs.get(mobID); + else aspect = Aspect.GREED; mobSet = par1NBTTagCompound.getBoolean("MobSet"); slothful = par1NBTTagCompound.getBoolean("Slothful"); this.fuel = par1NBTTagCompound.getShort("Fuel"); @@ -259,7 +290,6 @@ public class WrathSpawnerLogic { // par1NBTTagCompound.setShort("SpawnCount", (short)this.spawnCount); par1NBTTagCompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities); par1NBTTagCompound.setShort("SpawnRange", (short) this.spawnRange); - } public Entity spawnMob(Entity par1Entity) { @@ -293,5 +323,4 @@ public class WrathSpawnerLogic { return this.renderEntity; } - }