From d99cf7728896566b25aea0bc970b97f2e4dfe0d5 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Sat, 19 Aug 2017 18:56:50 -0700 Subject: [PATCH] Move config to annotation system All old configs must be deleted for this to work properly. Since the rest of the update is filled with world breaking changes, this should be fine. Also some mapping updates (cherry picked from commit d587a8c) --- build.gradle | 5 +- gradle.properties | 12 +- .../java/WayofTime/bloodmagic/BloodMagic.java | 5 +- .../WayofTime/bloodmagic/ConfigHandler.java | 425 ++++-------------- .../util/helper/PlayerSacrificeHelper.java | 2 +- .../api_impl/BloodMagicBlacklist.java | 17 +- .../api_impl/BloodMagicCorePlugin.java | 91 +++- .../apiv2/IBloodMagicBlacklist.java | 18 +- .../bloodmagic/block/BlockSpectral.java | 2 +- .../client/gui/config/ConfigGui.java | 37 -- .../client/gui/config/ConfigGuiFactory.java | 29 -- .../render/block/RenderItemRoutingNode.java | 2 +- .../provider/DataProviderBloodAltar.java | 28 +- .../entity/ai/EntityAIAttackRangedBow.java | 2 +- .../entity/ai/EntityAIEatAndCorruptBlock.java | 2 +- .../entity/ai/EntityAIFollowOwner.java | 10 +- .../ai/EntityAIGrabEffectsFromOwner.java | 8 +- .../entity/ai/EntityAIPickUpAlly.java | 2 +- .../entity/ai/EntityAIProtectAlly.java | 2 +- .../entity/ai/EntityAIRetreatToHeal.java | 6 +- .../entity/ai/EntityAIStealthRetreat.java | 4 +- .../entity/mob/EntityCorruptedSpider.java | 2 +- .../bloodmagic/entity/mob/EntityMimic.java | 2 +- .../entity/mob/EntitySentientSpecter.java | 2 +- .../entity/projectile/EntityBloodLight.java | 4 +- .../bloodmagic/item/ItemBoundAxe.java | 4 +- .../bloodmagic/item/ItemBoundPickaxe.java | 6 +- .../bloodmagic/item/ItemBoundShovel.java | 2 +- .../bloodmagic/item/ItemBoundTool.java | 4 +- .../item/ItemSacrificialDagger.java | 6 +- .../bloodmagic/item/soul/ItemSentientAxe.java | 4 +- .../bloodmagic/item/soul/ItemSentientBow.java | 5 +- .../item/soul/ItemSentientPickaxe.java | 4 +- .../item/soul/ItemSentientShovel.java | 4 +- .../bloodmagic/item/soul/ItemSoulSnare.java | 2 +- .../meteor/MeteorConfigHandler.java | 4 +- .../bloodmagic/registry/ModRecipes.java | 4 +- .../bloodmagic/registry/ModRituals.java | 71 ++- .../bloodmagic/ritual/RitualExpulsion.java | 2 +- .../ritual/RitualFeatheredKnife.java | 2 +- .../bloodmagic/ritual/RitualForsakenSoul.java | 2 +- .../util/handler/event/ClientHandler.java | 2 +- .../util/handler/event/CraftingHandler.java | 28 +- .../util/handler/event/GenericHandler.java | 4 +- .../handler/event/LivingArmourHandler.java | 2 +- 45 files changed, 320 insertions(+), 561 deletions(-) delete mode 100644 src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGui.java delete mode 100644 src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGuiFactory.java diff --git a/build.gradle b/build.gradle index 14a5a1bb..759d1f9f 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" id 'com.matthewprenger.cursegradle' version '1.0.9' + id 'io.franzbecker.gradle-lombok' version '1.6' id 'maven-publish' } @@ -34,8 +35,8 @@ repositories { dependencies { deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}" - deobfCompile "mcp.mobius.waila:Hwyla:${waila_version}_${mc_version}" - deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}" + deobfCompile "mcp.mobius.waila:Hwyla:${waila_version}" + deobfCompile "info.amerifrance.guideapi:Guide-API:${guideapi_version}" } minecraft { diff --git a/gradle.properties b/gradle.properties index bcf9d97a..6685f593 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ mod_name=BloodMagic package_group=com.wayoftime.bloodmagic mod_version=2.2.0 -mc_version=1.12 -forge_version=14.21.1.2443 +mc_version=1.12.2 +forge_version=14.23.2.2611 curse_id=224791 -mappings_version=snapshot_20170814 +mappings_version=snapshot_20180201 -jei_version=4.7.5.85 -waila_version=1.8.20-B35 -guideapi_version=2.1.4-56 \ No newline at end of file +jei_version=4.8.5.147 +waila_version=1.8.23-B38_1.12 +guideapi_version=1.12-2.1.4-57 \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/BloodMagic.java b/src/main/java/WayofTime/bloodmagic/BloodMagic.java index 4957a1be..badd6928 100644 --- a/src/main/java/WayofTime/bloodmagic/BloodMagic.java +++ b/src/main/java/WayofTime/bloodmagic/BloodMagic.java @@ -33,7 +33,7 @@ import org.apache.commons.lang3.tuple.Pair; import java.io.File; import java.util.List; -@Mod(modid = BloodMagic.MODID, name = BloodMagic.NAME, version = BloodMagic.VERSION, dependencies = BloodMagic.DEPEND, guiFactory = "WayofTime.bloodmagic.client.gui.config.ConfigGuiFactory") +@Mod(modid = BloodMagic.MODID, name = BloodMagic.NAME, version = BloodMagic.VERSION, dependencies = BloodMagic.DEPEND) public class BloodMagic { public static final String MODID = "bloodmagic"; public static final String NAME = "Blood Magic: Alchemical Wizardry"; @@ -73,8 +73,7 @@ public class BloodMagic { @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { - configDir = new File(event.getModConfigurationDirectory(), "BloodMagic"); - ConfigHandler.init(new File(configDir, "BloodMagic.cfg")); + configDir = new File(event.getModConfigurationDirectory(), "bloodmagic"); PLUGINS.addAll(PluginUtil.getPlugins(event.getAsmData())); diff --git a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java index 4ec4c8c6..99867dc1 100644 --- a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java +++ b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java @@ -1,352 +1,115 @@ package WayofTime.bloodmagic; -import WayofTime.bloodmagic.annot.Handler; -import WayofTime.bloodmagic.api.BlockStack; -import WayofTime.bloodmagic.api.BloodMagicAPI; -import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.meteor.MeteorConfigHandler; -import WayofTime.bloodmagic.util.Utils; -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Config; +import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.fml.client.event.ConfigChangedEvent; +import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.oredict.OreDictionary; -import java.io.File; -import java.util.*; - -@Handler +@Config(modid = BloodMagic.MODID, name = BloodMagic.MODID + "/" + BloodMagic.MODID, category = "") +@Mod.EventBusSubscriber public class ConfigHandler { - public static Configuration config; - // Teleposer - public static String[] teleposerBlacklisting; - public static ArrayList teleposerBlacklist = new ArrayList<>(); - public static List teleposerBlacklistEntity; + @Config.Comment({ "Blacklist options for various features" }) + public static ConfigBlacklist blacklist = new ConfigBlacklist(); + @Config.Comment({ "Value modifiers for various features" }) + public static ConfigValues values = new ConfigValues(); + @Config.Comment({ "Toggles for all rituals" }) + public static ConfigRituals rituals = new ConfigRituals(); + @Config.Comment({ "Settings that only pertain to the client" }) + public static ConfigClient client = new ConfigClient(); + @Config.Comment({ "Compatibility settings" }) + public static ConfigCompat compat = new ConfigCompat(); - // Transposition Sigil - public static String[] transpositionBlacklisting; - public static ArrayList transpositionBlacklist = new ArrayList<>(); + public static class ConfigBlacklist { + @Config.Comment({ "Stops listed blocks and entities from being teleposed.", "Use the registry name of the block or entity. Vanilla objects do not require the modid.", "If a block is specified, you can list the variants to only blacklist a given state." }) + public String[] teleposer = { "bedrock", "mob_spawner" }; + @Config.Comment({ "Stops listed blocks from being transposed.", "Use the registry name of the block. Vanilla blocks do not require the modid." }) + public String[] transposer = { "bedrock", "mob_spawner" }; + @Config.Comment({ "Stops the listed entities from being used in the Well of Suffering.", "Use the registry name of the entity. Vanilla entities do not require the modid." }) + public String[] wellOfSuffering = { }; + } - // Well of Suffering Blacklist - public static List wellOfSufferingBlacklist; + public static class ConfigValues { + @Config.Comment({ "Declares the amount of LP gained per HP sacrificed for the given entity.", "Setting the value to 0 will blacklist it.", "Use the registry name of the entity followed by a ';' and then the value you want.", "Vanilla entities do not require the modid." }) + public String[] sacrificialValues = { "villager;100", "slime;15", "enderman;10", "cow;100", "chicken;100", "horse;100", "sheep;100", "wolf;100", "ocelot;100", "pig;100", "rabbit;100" }; + @Config.Comment({ "Amount of LP the Coat of Arms should provide for each damage dealt." }) + @Config.RangeInt(min = 0, max = 100) + public int coatOfArmsConversion = 20; + @Config.Comment({ "Amount of LP the Sacrificial Dagger should provide for each damage dealt." }) + @Config.RangeInt(min = 0, max = 10000) + public int sacrificialDaggerConversion = 100; + @Config.Comment({ "Will rewrite any default meteor types with new versions.", "Disable this if you want any of your changes to stay, or do not want default meteor types regenerated." }) + public boolean shouldResyncMeteors = true; + } - // Blood Altar Sacrificial Values - public static String[] entitySacrificeValuesList; - public static Map entitySacrificeValues = new HashMap<>(); + public static class ConfigRituals { + public boolean ritualAnimalGrowth = true; + public boolean ritualContainment = true; + public boolean ritualCrushing = true; + public boolean ritualExpulsion = true; + public boolean ritualFeatheredKnife = true; + public boolean ritualFullStomach = true; + public boolean ritualGreenGrove = true; + public boolean ritualHarvest = true; + public boolean ritualInterdiction = true; + public boolean ritualJumping = true; + public boolean ritualLava = true; + public boolean ritualMagnetic = true; + public boolean ritualRegeneration = true; + public boolean ritualSpeed = true; + public boolean ritualSuppression = true; + public boolean ritualWater = true; + public boolean ritualWellOfSuffering = true; + public boolean ritualZephyr = true; + public boolean ritualUpgradeRemove = true; + public boolean ritualArmourEvolve = true; + public boolean ritualForsakenSoul = true; + public boolean ritualCrystalHarvest = true; + public boolean ritualPlacer = true; + public boolean ritualFelling = true; + public boolean ritualPump = true; + public boolean ritualAltarBuilder = true; + public boolean ritualPortal = true; + public boolean ritualMeteor = true; + public boolean ritualDowngrade = true; + public ConfigImperfectRituals imperfect = new ConfigImperfectRituals(); + } - // Rituals - public static boolean ritualAnimalGrowth; - public static boolean ritualContainment; - public static boolean ritualCrushing; - public static boolean ritualExpulsion; - public static boolean ritualFeatheredKnife; - public static boolean ritualFullStomach; - public static boolean ritualGreenGrove; - public static boolean ritualHarvest; - public static boolean ritualInterdiction; - public static boolean ritualJumping; - public static boolean ritualLava; - public static boolean ritualMagnetic; - public static boolean ritualRegeneration; - public static boolean ritualSpeed; - public static boolean ritualSuppression; - public static boolean ritualWater; - public static boolean ritualWellOfSuffering; - public static boolean ritualZephyr; - public static boolean ritualUpgradeRemove; - public static boolean ritualArmourEvolve; - public static boolean ritualForsakenSoul; - public static boolean ritualCrystalHarvest; + public static class ConfigImperfectRituals { + public boolean imperfectRitualNight = true; + public boolean imperfectRitualRain = true; + public boolean imperfectRitualResistance = true; + public boolean imperfectRitualZombie = true; + } - public static boolean cobblestoneRitual; - public static boolean placerRitual; - public static boolean fellingRitual; - public static boolean pumpRitual; - public static boolean altarBuilderRitual; - public static boolean portalRitual; - public static boolean meteorRitual; - public static boolean downgradeRitual; + public static class ConfigClient { + @Config.Comment({ "Always render the beams between routing nodes.", "If disabled, the beams will only render while the Node Router is held." }) + public boolean alwaysRenderRoutingLines = false; + @Config.Comment({ "Completely hide spectral blocks from view.", "If disabled, a transparent block will be displayed." }) + public boolean invisibleSpectralBlocks = true; + @Config.Comment({ "When cycling through slots, the Sigil of Holding will skip over empty slots and move to the next occupied one.", "If disabled, it will behave identically to the default hotbar." }) + public boolean sigilHoldingSkipsEmptySlots = false; + } - // Imperfect Rituals - public static boolean imperfectRitualNight; - public static boolean imperfectRitualRain; - public static boolean imperfectRitualResistance; - public static boolean imperfectRitualZombie; + public static class ConfigCompat { + @Config.Comment({ "The display mode to use when looking at a Blood Altar.", "ALWAYS - Always display information.", "SIGIL_HELD - Only display information when a Divination or Seers sigil is held in either hand.", "SIGIL_CONTAINED - Only display information when a Divination or Seers sigil is somewhere in the inventory." }) + public AltarDisplayMode wailaAltarDisplayMode = AltarDisplayMode.SIGIL_HELD; - // Potion ID's - public static int customPotionDrowningID; - public static int customPotionBoostID; - public static int customPotionProjProtID; - public static int customPotionInhibitID; - public static int customPotionFlightID; - public static int customPotionReciprocationID; - public static int customPotionFlameCloakID; - public static int customPotionIceCloakID; - public static int customPotionHeavyHeartID; - public static int customPotionFireFuseID; - public static int customPotionPlanarBindingID; - public static int customPotionSoulFrayID; - public static int customPotionSoulHardenID; - public static int customPotionDeafID; - public static int customPotionFeatherFallID; - public static int customPotionDemonCloakID; - public static int customPotionAmphibianID; - - // Potion toggles - public static boolean customPotionDrowningEnabled; - public static boolean customPotionBoostEnabled; - public static boolean customPotionProjProtEnabled; - public static boolean customPotionInhibitEnabled; - public static boolean customPotionFlightEnabled; - public static boolean customPotionReciprocationEnabled; - public static boolean customPotionFlameCloakEnabled; - public static boolean customPotionIceCloakEnabled; - public static boolean customPotionHeavyHeartEnabled; - public static boolean customPotionFireFuseEnabled; - public static boolean customPotionPlanarBindingEnabled; - public static boolean customPotionSoulFrayEnabled; - public static boolean customPotionSoulHardenEnabled; - public static boolean customPotionDeafEnabled; - public static boolean customPotionFeatherFallEnabled; - public static boolean customPotionDemonCloakEnabled; - public static boolean customPotionAmphibianEnabled; - public static boolean vanillaPotionRegenerationEnabled; - public static boolean vanillaPotionNightVisionEnabled; - public static boolean vanillaPotionFireResistEnabled; - public static boolean vanillaPotionWaterBreathingEnabled; - public static boolean vanillaPotionSpeedEnabled; - public static boolean vanillaPotionHealthEnabled; - public static boolean vanillaPotionPoisonEnabled; - public static boolean vanillaPotionBlindnessEnabled; - public static boolean vanillaPotionWeaknessEnabled; - public static boolean vanillaPotionStrengthEnabled; - public static boolean vanillaPotionJumpBoostEnabled; - public static boolean vanillaPotionSlownessEnabled; - public static boolean vanillaPotionMiningEnabled; - public static boolean vanillaPotionInvisibilityEnabled; - public static boolean vanillaPotionResistanceEnabled; - public static boolean vanillaPotionSaturationEnabled; - public static boolean vanillaPotionHealthBoostEnabled; - public static boolean vanillaPotionAbsorptionEnabled; - - // General - public static int sacrificialPackConversion; - public static int sacrificialDaggerDamage; - public static int sacrificialDaggerConversion; - - // Client - public static boolean alwaysRenderRoutingLines; - public static boolean invisibleSpectralBlocks; - public static boolean sigilHoldingSkipsEmptySlots; - - // Compat - public static int wailaAltarDisplayMode; - public static boolean thaumcraftGogglesUpgrade; - public static boolean ignoreCompressionSpamAddedByCompression; + public enum AltarDisplayMode { + ALWAYS, + SIGIL_HELD, + SIGIL_CONTAINED, + ; + } + } @SubscribeEvent - public void onConfigChanged(ConfigChangedEvent event) { + public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(BloodMagic.MODID)) { - syncConfig(); - MeteorConfigHandler.handleMeteors(false); - } - } - - public static void init(File file) { - config = new Configuration(file); - syncConfig(); - } - - public static void syncConfig() { - String category; - - category = "Item/Block Blacklisting"; - config.addCustomCategoryComment(category, "Allows disabling of specific Blocks/Items.\nNote that using this may result in crashes. Use is not supported."); - config.setCategoryRequiresMcRestart(category, true); - - category = "Teleposer Blacklist"; - config.addCustomCategoryComment(category, "Block blacklisting"); - teleposerBlacklisting = config.getStringList("teleposerBlacklist", category, new String[]{"minecraft:bedrock", "minecraft:mob_spawner"}, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta"); - buildBlacklist(teleposerBlacklisting, teleposerBlacklist); - teleposerBlacklistEntity = Arrays.asList(config.getStringList("teleposerBlacklistEntity", category, new String[]{}, "Entity class names listed here will not be able to be teleposed.")); - - category = "Transposition Sigil Blacklist"; - config.addCustomCategoryComment(category, "Block blacklisting"); - transpositionBlacklisting = config.getStringList("transpositionBlacklist", category, new String[]{"minecraft:bedrock", "minecraft:mob_spawner"}, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta"); - buildBlacklist(transpositionBlacklisting, transpositionBlacklist); - - category = "Well of Suffering Blacklist"; - config.addCustomCategoryComment(category, "Entity blacklisting from WoS"); - wellOfSufferingBlacklist = Arrays.asList(config.getStringList("wellOfSufferingBlacklist", category, new String[]{"EntityArmorStand", "EntitySentientSpecter"}, "Use the class name of the Entity to blacklist it from usage.\nIE: EntityWolf, EntityWitch, etc")); - - category = "Blood Altar Sacrificial Values"; - config.addCustomCategoryComment(category, "Entity Sacrificial Value Settings"); - entitySacrificeValuesList = config.getStringList("entitySacrificeLP:HPValues", category, new String[]{"EntityVillager;100", "EntitySlime;15", "EntityEnderman;10", "EntityCow;100", "EntityChicken;100", "EntityHorse;100", "EntitySheep;100", "EntityWolf;100", "EntityOcelot;100", "EntityPig;100", "EntityRabbit;100", "EntityArmorStand;0", "EntitySentientSpecter;0"}, "Used to edit the amount of LP gained per HP sacrificed for the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerHP"); - buildEntitySacrificeValues(); - - category = "Potions"; - config.addCustomCategoryComment(category, "Potion settings"); - config.addCustomCategoryComment(category + ".id", "Potion ID settings"); - customPotionDrowningID = config.getInt("customPotionDrowningID", category + ".id", 100, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Drowning potion"); - customPotionBoostID = config.getInt("customPotionBoostID", category + ".id", 101, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Boost potion"); - customPotionProjProtID = config.getInt("customPotionProjProtID", category + ".id", 102, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Projectile Protection potion"); - customPotionInhibitID = config.getInt("customPotionInhibitID", category + ".id", 103, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Inhibit potion"); - customPotionFlightID = config.getInt("customPotionFlightID", category + ".id", 104, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Flight potion"); - customPotionReciprocationID = config.getInt("customPotionReciprocationID", category + ".id", 105, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Reciprocation potion"); - customPotionFlameCloakID = config.getInt("customPotionFlameCloakID", category + ".id", 106, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Flame Cloak potion"); - customPotionIceCloakID = config.getInt("customPotionIceCloakID", category + ".id", 107, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Ice Cloak potion"); - customPotionHeavyHeartID = config.getInt("customPotionHeavyHeartID", category + ".id", 108, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Heavy Heart potion"); - customPotionFireFuseID = config.getInt("customPotionFireFuseID", category + ".id", 109, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Fire Fuse potion"); - customPotionPlanarBindingID = config.getInt("customPotionPlanarBindingID", category + ".id", 110, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Planar Binding potion"); - customPotionSoulFrayID = config.getInt("customPotionSoulFrayID", category + ".id", 111, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Soul Fray potion"); - customPotionSoulHardenID = config.getInt("customPotionSoulHardenID", category + ".id", 112, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Soul Harden potion"); - customPotionDeafID = config.getInt("customPotionDeafID", category + ".id", 113, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Deaf potion"); - customPotionFeatherFallID = config.getInt("customPotionFeatherFallID", category + ".id", 114, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Feather Fall potion"); - customPotionDemonCloakID = config.getInt("customPotionDemonCloakID", category + ".id", 115, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Demon Cloak potion"); - customPotionAmphibianID = config.getInt("customPotionAmphibianID", category + ".id", 116, 20, Constants.Misc.POTION_ARRAY_SIZE, "ID of the Amphibian potion"); - - config.addCustomCategoryComment(category + ".toggle", "Toggle potions available in Alchemy"); - customPotionDrowningEnabled = config.getBoolean("customPotionDrowningEnabled", category + ".toggle", true, "Enables the Drowning potion in Alchemy"); - customPotionBoostEnabled = config.getBoolean("customPotionBoostEnabled", category + ".toggle", true, "Enables the Boost potion in Alchemy"); - customPotionProjProtEnabled = config.getBoolean("customPotionProjProtEnabled", category + ".toggle", true, "Enables the Projectile Protection potion in Alchemy"); - customPotionInhibitEnabled = config.getBoolean("customPotionInhibitEnabled", category + ".toggle", true, "Enables the Inhibit potion in Alchemy"); - customPotionFlightEnabled = config.getBoolean("customPotionFlightEnabled", category + ".toggle", true, "Enables the Flight potion in Alchemy"); - customPotionReciprocationEnabled = config.getBoolean("customPotionReciprocationEnabled", category + ".toggle", true, "Enables the Reciprocation potion in Alchemy"); - customPotionFlameCloakEnabled = config.getBoolean("customPotionFlameCloakEnabled", category + ".toggle", true, "Enables the Flame Cloak potion in Alchemy"); - customPotionIceCloakEnabled = config.getBoolean("customPotionIceCloakEnabled", category + ".toggle", true, "Enables the Ice Cloak potion in Alchemy"); - customPotionHeavyHeartEnabled = config.getBoolean("customPotionHeavyHeartEnabled", category + ".toggle", true, "Enables the Heavy Heart potion in Alchemy"); - customPotionFireFuseEnabled = config.getBoolean("customPotionFireFuseEnabled", category + ".toggle", true, "Enables the Fire Fuse potion in Alchemy"); - customPotionPlanarBindingEnabled = config.getBoolean("customPotionPlanarBindingEnabled", category + ".toggle", true, "Enables the Planar Binding potion in Alchemy"); - customPotionSoulFrayEnabled = config.getBoolean("customPotionSoulFrayEnabled", category + ".toggle", true, "Enables the Soul Fray potion in Alchemy"); - customPotionSoulHardenEnabled = config.getBoolean("customPotionSoulHardenEnabled", category + ".toggle", true, "Enables the Soul Harden potion in Alchemy"); - customPotionDeafEnabled = config.getBoolean("customPotionDeafEnabled", category + ".toggle", true, "Enables the Deaf potion in Alchemy"); - customPotionFeatherFallEnabled = config.getBoolean("customPotionFeatherFallEnabled", category + ".toggle", true, "Enables the Feather Fall potion in Alchemy"); - customPotionDemonCloakEnabled = config.getBoolean("customPotionDemonCloakEnabled", category + ".toggle", true, "Enables the Demon Cloak potion in Alchemy"); - customPotionAmphibianEnabled = config.getBoolean("customPotionAmphibianEnabled", category + ".toggle", true, "Enables the Amphibian potion in Alchemy"); - vanillaPotionAbsorptionEnabled = config.getBoolean("vanillaPotionAbsorptionEnabled", category + ".toggle", true, "Enables the Absorption potion in Alchemy"); - vanillaPotionBlindnessEnabled = config.getBoolean("vanillaPotionBlindnessEnabled", category + ".toggle", true, "Enables the Blindness potion in Alchemy"); - vanillaPotionFireResistEnabled = config.getBoolean("vanillaPotionFireResistEnabled", category + ".toggle", true, "Enables the Fire Resistance potion in Alchemy"); - vanillaPotionHealthBoostEnabled = config.getBoolean("vanillaPotionHealthBoostEnabled", category + ".toggle", true, "Enables the Health Boost potion in Alchemy"); - vanillaPotionHealthEnabled = config.getBoolean("vanillaPotionHealthEnabled", category + ".toggle", true, "Enables the Instant Health potion in Alchemy"); - vanillaPotionInvisibilityEnabled = config.getBoolean("vanillaPotionInvisibilityEnabled", category + ".toggle", true, "Enables the Invisibility potion in Alchemy"); - vanillaPotionJumpBoostEnabled = config.getBoolean("vanillaPotionJumpBoostEnabled", category + ".toggle", true, "Enables the Jump Boost potion in Alchemy"); - vanillaPotionMiningEnabled = config.getBoolean("vanillaPotionMiningEnabled", category + ".toggle", true, "Enables the Mining potion in Alchemy"); - vanillaPotionPoisonEnabled = config.getBoolean("vanillaPotionPoisonEnabled", category + ".toggle", true, "Enables the Poison potion in Alchemy"); - vanillaPotionRegenerationEnabled = config.getBoolean("vanillaPotionRegenerationEnabled", category + ".toggle", true, "Enables the Regeneration potion in Alchemy"); - vanillaPotionNightVisionEnabled = config.getBoolean("vanillaPotionNightVisionEnabled", category + ".toggle", true, "Enables the Night Vision potion in Alchemy"); - vanillaPotionResistanceEnabled = config.getBoolean("vanillaPotionResistanceEnabled", category + ".toggle", true, "Enables the Resistance potion in Alchemy"); - vanillaPotionSaturationEnabled = config.getBoolean("vanillaPotionSaturationEnabled", category + ".toggle", true, "Enables the Saturation potion in Alchemy"); - vanillaPotionSlownessEnabled = config.getBoolean("vanillaPotionSlownessEnabled", category + ".toggle", true, "Enables the Slowness potion in Alchemy"); - vanillaPotionSpeedEnabled = config.getBoolean("vanillaPotionSpeedEnabled", category + ".toggle", true, "Enables the Speed potion in Alchemy"); - vanillaPotionStrengthEnabled = config.getBoolean("vanillaPotionStrengthEnabled", category + ".toggle", true, "Enables the Strength potion in Alchemy"); - vanillaPotionWaterBreathingEnabled = config.getBoolean("vanillaPotionWaterBreathingEnabled", category + ".toggle", true, "Enables the Water Breathing potion in Alchemy"); - vanillaPotionWeaknessEnabled = config.getBoolean("vanillaPotionWeaknessEnabled", category + ".toggle", true, "Enables the Weakness potion in Alchemy"); - - category = "Rituals"; - config.addCustomCategoryComment(category, "Ritual toggling"); - config.setCategoryRequiresMcRestart(category, true); - ritualAnimalGrowth = config.get(category, "ritualAnimalGrowth", true).getBoolean(); - ritualContainment = config.get(category, "ritualContainment", true).getBoolean(); - ritualCrushing = config.get(category, "ritualCrushing", true).getBoolean(); - ritualExpulsion = config.get(category, "ritualExpulsion", true).getBoolean(); - ritualFeatheredKnife = config.get(category, "ritualFeatheredKnife", true).getBoolean(); - ritualFullStomach = config.get(category, "ritualFullStomach", true).getBoolean(); - ritualGreenGrove = config.get(category, "ritualGreenGrove", true).getBoolean(); - ritualHarvest = config.get(category, "ritualHarvest", true).getBoolean(); - ritualInterdiction = config.get(category, "ritualInterdiction", true).getBoolean(); - ritualJumping = config.get(category, "ritualJumping", true).getBoolean(); - ritualLava = config.get(category, "ritualLava", true).getBoolean(); - ritualMagnetic = config.get(category, "ritualMagnetic", true).getBoolean(); - ritualRegeneration = config.get(category, "ritualRegeneration", true).getBoolean(); - ritualSpeed = config.get(category, "ritualSpeed", true).getBoolean(); - ritualSuppression = config.get(category, "ritualSuppression", true).getBoolean(); - ritualWater = config.get(category, "ritualWater", true).getBoolean(); - ritualWellOfSuffering = config.get(category, "ritualWellOfSuffering", true).getBoolean(); - ritualZephyr = config.get(category, "ritualZephyr", true).getBoolean(); - ritualUpgradeRemove = config.get(category, "ritualRemove", true).getBoolean(); - ritualArmourEvolve = config.get(category, "ritualArmourEvolve", true).getBoolean(); - ritualForsakenSoul = config.get(category, "ritualForsakenSoul", true).getBoolean(); - ritualCrystalHarvest = config.get(category, "ritualCrystalHarvest", true).getBoolean(); - - cobblestoneRitual = config.get(category, "ritualCobblestone", true).getBoolean(); - placerRitual = config.get(category, "ritualPlacer", true).getBoolean(); - fellingRitual = config.get(category, "ritualFelling", true).getBoolean(); - pumpRitual = config.get(category, "ritualPump", true).getBoolean(); - altarBuilderRitual = config.get(category, "ritualAltarBuilder", true).getBoolean(); - portalRitual = config.get(category, "ritualPortal", true).getBoolean(); - meteorRitual = config.get(category, "ritualMeteor", true).getBoolean(); - downgradeRitual = config.get(category, "ritualDowngrade", true).getBoolean(); - - category = "Rituals.Imperfect"; - imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean(); - imperfectRitualRain = config.get(category, "imperfectRitualRain", true).getBoolean(); - imperfectRitualResistance = config.get(category, "imperfectRitualResistance", true).getBoolean(); - imperfectRitualZombie = config.get(category, "imperfectRitualZombie", true).getBoolean(); - - category = "General"; - config.addCustomCategoryComment(category, "General settings"); - BloodMagicAPI.loggingEnabled = config.getBoolean("enableLogging", category, true, "Allows logging information to the console. Fatal errors will bypass this"); - sacrificialPackConversion = config.getInt("sacrificialPackConversion", category, 20, 0, 100, "Base multiplier for the Coat of Arms. DamageDealt * sacrificialPackConversion"); - sacrificialDaggerDamage = config.getInt("sacrificialDaggerDamage", category, 2, 0, 10000, "Damage done from using the Sacrificial Dagger"); - sacrificialDaggerConversion = config.getInt("sacrificialDaggerConversion", category, 100, 0, 10000, "Amount of LP received per damage point (not heart!)"); - - category = "Client"; - config.addCustomCategoryComment(category, "Client only settings"); - alwaysRenderRoutingLines = config.getBoolean("alwaysRenderRoutingLines", category, false, "Always renders the beams between routing nodes. If false, only renders while a Node Router is being held."); - invisibleSpectralBlocks = config.get(category, "invisibleSpectralBlocks", true, "Spectral Blocks (Used by the Suppression Sigil to store fluids) will not render at all. If false, a see through texture will render. [default: true]").setRequiresMcRestart(true).getBoolean(); - sigilHoldingSkipsEmptySlots = config.getBoolean("sigilHoldingSkipsEmptySlots", category, false, "The Sigil of Holding will skip empty sigil slots if set to true."); - - category = "Compatibility"; - config.addCustomCategoryComment(category, "Compatibility settings"); - wailaAltarDisplayMode = config.getInt("wailaAltarDisplayMode", category + ".waila", 1, 0, 2, "The mode for the Waila display on Blood Altars.\n0 - Always display information\n1 - Only display when Divination/Seer sigil is in hand.\n2 - Only display when Divination/Seer sigil is in inventory"); - thaumcraftGogglesUpgrade = config.getBoolean("thaumcraftGogglesUpgrade", category + ".thaumcraft", true, "Allows the Living Helmet to be upgraded with Goggles of Revealing in an Anvil."); - ignoreCompressionSpamAddedByCompression = config.getBoolean("ignoreCompressionSpamAddedByCompression", category + ".compression", true, "Compression decided to add a storage recipe for every item and block in the game. This will make the Sigil of Compression ignore those recipes so your game will actually load in a decent amount of time."); - - category = "Meteors"; - config.addCustomCategoryComment(category, "Meteor settings"); - - config.save(); - } - - private static void buildBlacklist(String[] blacklisting, List blockBlacklist) { - blockBlacklist.clear(); - - for (String blockSet : blacklisting) { - String[] blockData = blockSet.split(":"); - - Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0], blockData[1])); - int meta = 0; - - if (blockData.length == 3) { - // Check if it's an int, if so, parse it. If not, set meta to 0 - // to avoid crashing. - if (Utils.isInteger(blockData[2])) - meta = Integer.parseInt(blockData[2]); - else if (blockData[2].equals("*")) - meta = OreDictionary.WILDCARD_VALUE; - else - meta = 0; - } - - blockBlacklist.add(new BlockStack(block, meta)); - } - } - - private static void buildEntitySacrificeValues() { - entitySacrificeValues.clear(); - - for (String entityData : entitySacrificeValuesList) { - String[] split = entityData.split(";"); - - int amount = 500; - if (Utils.isInteger(split[1])) - amount = Integer.parseInt(split[1]); - - if (!entitySacrificeValues.containsKey(split[0])) - entitySacrificeValues.put(split[0], amount); + ConfigManager.sync(event.getModID(), Config.Type.INSTANCE); // Sync config values + MeteorConfigHandler.handleMeteors(false); // Reload meteors } } } diff --git a/src/main/java/WayofTime/bloodmagic/api/util/helper/PlayerSacrificeHelper.java b/src/main/java/WayofTime/bloodmagic/api/util/helper/PlayerSacrificeHelper.java index 4691fadc..6c1fdc9d 100644 --- a/src/main/java/WayofTime/bloodmagic/api/util/helper/PlayerSacrificeHelper.java +++ b/src/main/java/WayofTime/bloodmagic/api/util/helper/PlayerSacrificeHelper.java @@ -61,7 +61,7 @@ public class PlayerSacrificeHelper { if (health > maxHealth / 10.0) { float sacrificedHealth = health - maxHealth / 10.0f; - int lpAdded = (int) (sacrificedHealth * ConfigHandler.sacrificialDaggerConversion * getModifier(amount)); + int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion * getModifier(amount)); SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, (int) sacrificedHealth, lpAdded); if (MinecraftForge.EVENT_BUS.post(evt)) diff --git a/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicBlacklist.java b/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicBlacklist.java index 0d448390..b88d64b6 100644 --- a/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicBlacklist.java +++ b/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicBlacklist.java @@ -7,6 +7,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nonnull; import java.util.Set; public class BloodMagicBlacklist implements IBloodMagicBlacklist { @@ -26,49 +27,49 @@ public class BloodMagicBlacklist implements IBloodMagicBlacklist { } @Override - public void addTeleposer(IBlockState state) { + public void addTeleposer(@Nonnull IBlockState state) { if (!teleposer.contains(state)) teleposer.add(state); } @Override - public void addTeleposer(Block block) { + public void addTeleposer(@Nonnull Block block) { for (IBlockState state : block.getBlockState().getValidStates()) addTeleposer(state); } @Override - public void addTeleposer(ResourceLocation entityId) { + public void addTeleposer(@Nonnull ResourceLocation entityId) { if (!teleposerEntities.contains(entityId)) teleposerEntities.add(entityId); } @Override - public void addTransposition(IBlockState state) { + public void addTransposition(@Nonnull IBlockState state) { if (!transposition.contains(state)) transposition.add(state); } @Override - public void addTransposition(Block block) { + public void addTransposition(@Nonnull Block block) { for (IBlockState state : block.getBlockState().getValidStates()) addTransposition(state); } @Override - public void addGreenGrove(IBlockState state) { + public void addGreenGrove(@Nonnull IBlockState state) { if (!greenGrove.contains(state)) greenGrove.add(state); } @Override - public void addGreenGrove(Block block) { + public void addGreenGrove(@Nonnull Block block) { for (IBlockState state : block.getBlockState().getValidStates()) addGreenGrove(state); } @Override - public void addSacrifice(ResourceLocation entityId) { + public void addWellOfSuffering(@Nonnull ResourceLocation entityId) { if (!sacrifice.contains(entityId)) sacrifice.add(entityId); } diff --git a/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicCorePlugin.java b/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicCorePlugin.java index e2800fc6..aab81509 100644 --- a/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicCorePlugin.java +++ b/src/main/java/WayofTime/bloodmagic/api_impl/BloodMagicCorePlugin.java @@ -1,6 +1,7 @@ package WayofTime.bloodmagic.api_impl; import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.api.altar.EnumAltarComponent; import WayofTime.bloodmagic.apiv2.BloodMagicPlugin; import WayofTime.bloodmagic.apiv2.IBloodMagicAPI; @@ -10,8 +11,14 @@ import WayofTime.bloodmagic.block.BlockDecorative; import WayofTime.bloodmagic.block.enums.EnumBloodRune; import WayofTime.bloodmagic.block.enums.EnumDecorative; import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.EntityEntry; +import net.minecraftforge.fml.common.registry.ForgeRegistries; @BloodMagicPlugin public class BloodMagicCorePlugin implements IBloodMagicPlugin { @@ -31,10 +38,13 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin { api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.DEMON_CRYSTAL); api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INVERSION_PILLAR); api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INVERSION_PILLAR); - api.getBlacklist().addSacrifice(new ResourceLocation("armor_stand")); - api.getBlacklist().addSacrifice(new ResourceLocation(BloodMagic.MODID, "sentient_specter")); + api.getBlacklist().addWellOfSuffering(new ResourceLocation("armor_stand")); + api.getBlacklist().addWellOfSuffering(new ResourceLocation(BloodMagic.MODID, "sentient_specter")); - // TODO - Register things from config + api.setSacrificialValue(new ResourceLocation("armor_stand"), 0); + api.setSacrificialValue(new ResourceLocation(BloodMagic.MODID, "sentient_specter"), 0); + + handleConfigValues(api); // Add standard blocks for altar components api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), EnumAltarComponent.GLOWSTONE.name()); @@ -51,4 +61,79 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin { for (EnumBloodRune runeType : EnumBloodRune.values()) api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), EnumAltarComponent.BLOODRUNE.name()); } + + private static void handleConfigValues(IBloodMagicAPI api) { + for (String value : ConfigHandler.values.sacrificialValues) { + String[] split = value.split(";"); + if (split.length != 2) // Not valid format + continue; + + api.setSacrificialValue(new ResourceLocation(split[0]), Integer.parseInt(split[1])); + } + + for (String value : ConfigHandler.blacklist.teleposer) { + EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value)); + if (entityEntry == null) { // It's not an entity (or at least not a valid one), so let's try a block. + String[] blockData = value.split("\\["); + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0])); + if (block == Blocks.AIR || block == null) // Not a valid block either + continue; + + if (blockData.length > 1) { // We have properties listed, so let's build a state. + api.getBlacklist().addTeleposer(parseState(value)); + continue; + } + + api.getBlacklist().addTeleposer(block); + continue; + } + + api.getBlacklist().addTeleposer(entityEntry.getRegistryName()); + } + + for (String value : ConfigHandler.blacklist.transposer) { + String[] blockData = value.split("\\["); + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0])); + if (block == Blocks.AIR || block == null) // Not a valid block + continue; + + if (blockData.length > 1) { // We have properties listed, so let's build a state. + api.getBlacklist().addTeleposer(parseState(value)); + continue; + } + + api.getBlacklist().addTeleposer(block); + } + + for (String value : ConfigHandler.blacklist.wellOfSuffering) { + EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value)); + if (entityEntry == null) // Not a valid entity + continue; + + api.getBlacklist().addWellOfSuffering(entityEntry.getRegistryName()); + } + } + + private static IBlockState parseState(String blockInfo) { + String[] split = blockInfo.split("\\["); + split[1] = split[1].substring(0, split[1].lastIndexOf("]")); // Make sure brackets are removed from state + + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(split[0])); // Find the block + if (block == Blocks.AIR) + return Blocks.AIR.getDefaultState(); // The block is air, so we're looking at invalid data + + BlockStateContainer blockState = block.getBlockState(); + IBlockState returnState = blockState.getBaseState(); + + // Force our values into the state + String[] stateValues = split[1].split(","); // Splits up each value + for (String value : stateValues) { + String[] valueSplit = value.split("="); // Separates property and value + IProperty property = blockState.getProperty(valueSplit[0]); + if (property != null) + returnState = returnState.withProperty(property, (Comparable) property.parseValue(valueSplit[1]).get()); // Force the property into the state + } + + return returnState; + } } diff --git a/src/main/java/WayofTime/bloodmagic/apiv2/IBloodMagicBlacklist.java b/src/main/java/WayofTime/bloodmagic/apiv2/IBloodMagicBlacklist.java index 61caa272..f1f1b0ad 100644 --- a/src/main/java/WayofTime/bloodmagic/apiv2/IBloodMagicBlacklist.java +++ b/src/main/java/WayofTime/bloodmagic/apiv2/IBloodMagicBlacklist.java @@ -4,21 +4,23 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nonnull; + public interface IBloodMagicBlacklist { - void addTeleposer(IBlockState state); + void addTeleposer(@Nonnull IBlockState state); - void addTeleposer(Block block); + void addTeleposer(@Nonnull Block block); - void addTeleposer(ResourceLocation entityId); + void addTeleposer(@Nonnull ResourceLocation entityId); - void addTransposition(IBlockState state); + void addTransposition(@Nonnull IBlockState state); - void addTransposition(Block block); + void addTransposition(@Nonnull Block block); - void addGreenGrove(IBlockState state); + void addGreenGrove(@Nonnull IBlockState state); - void addGreenGrove(Block block); + void addGreenGrove(@Nonnull Block block); - void addSacrifice(ResourceLocation entityId); + void addWellOfSuffering(@Nonnull ResourceLocation entityId); } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java b/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java index 7a001100..6aa45663 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockSpectral.java @@ -68,7 +68,7 @@ public class BlockSpectral extends Block implements IVariantProvider { @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return ConfigHandler.invisibleSpectralBlocks ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL; + return ConfigHandler.client.invisibleSpectralBlocks ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGui.java b/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGui.java deleted file mode 100644 index 9013d8ea..00000000 --- a/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGui.java +++ /dev/null @@ -1,37 +0,0 @@ -package WayofTime.bloodmagic.client.gui.config; - -import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.ConfigHandler; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.fml.client.config.GuiConfig; -import net.minecraftforge.fml.client.config.IConfigElement; - -import java.util.ArrayList; -import java.util.List; - -public class ConfigGui extends GuiConfig { - - public ConfigGui(GuiScreen parentScreen) { - super(parentScreen, getConfigElements(parentScreen), BloodMagic.MODID, false, false, "BloodMagic Configuration"); - } - - @SuppressWarnings("rawtypes") - private static List getConfigElements(GuiScreen parent) { - List list = new ArrayList(); - - // adds sections declared in ConfigHandler. toLowerCase() is used - // because the configuration class automatically does this, so must we. - list.add(new ConfigElement(ConfigHandler.config.getCategory("Potions".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Client".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Compatibility".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Teleposer Blacklist".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Well of Suffering Blacklist".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Item/Block Blacklisting".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("General".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Rituals".toLowerCase()))); - list.add(new ConfigElement(ConfigHandler.config.getCategory("Blood Altar Sacrificial Values".toLowerCase()))); - - return list; - } -} diff --git a/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGuiFactory.java b/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGuiFactory.java deleted file mode 100644 index 2f968574..00000000 --- a/src/main/java/WayofTime/bloodmagic/client/gui/config/ConfigGuiFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -package WayofTime.bloodmagic.client.gui.config; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.fml.client.IModGuiFactory; - -import java.util.Set; - -public class ConfigGuiFactory implements IModGuiFactory { - @Override - public void initialize(Minecraft minecraftInstance) { - - } - - @Override - public boolean hasConfigGui() { - return false; - } - - @Override - public GuiScreen createConfigGui(GuiScreen parentScreen) { - return new ConfigGui(parentScreen); - } - - @Override - public Set runtimeGuiCategories() { - return null; - } -} diff --git a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderItemRoutingNode.java b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderItemRoutingNode.java index 9a94e561..083de767 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderItemRoutingNode.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderItemRoutingNode.java @@ -24,7 +24,7 @@ public class RenderItemRoutingNode extends TileEntitySpecialRenderer connectionList = tileNode.getConnected(); for (BlockPos wantedPos : connectionList) { BlockPos offsetPos = wantedPos.subtract(tileNode.getPos()); diff --git a/src/main/java/WayofTime/bloodmagic/compat/waila/provider/DataProviderBloodAltar.java b/src/main/java/WayofTime/bloodmagic/compat/waila/provider/DataProviderBloodAltar.java index 8affc801..9e3ddf39 100644 --- a/src/main/java/WayofTime/bloodmagic/compat/waila/provider/DataProviderBloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/compat/waila/provider/DataProviderBloodAltar.java @@ -27,16 +27,6 @@ import java.util.List; * in ImLookingAtBlood by Pokefenn. */ public class DataProviderBloodAltar implements IWailaDataProvider { - @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { - return null; - } - - @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return null; - } - @Override public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if (!config.getConfig(Constants.Compat.WAILA_CONFIG_ALTAR)) @@ -45,24 +35,21 @@ public class DataProviderBloodAltar implements IWailaDataProvider { boolean hasSigil = false; boolean hasSeer = false; - switch (ConfigHandler.wailaAltarDisplayMode) { - case 0: { + switch (ConfigHandler.compat.wailaAltarDisplayMode) { + case ALWAYS: { hasSigil = hasSeer = true; break; } - case 1: { + case SIGIL_HELD: { hasSeer = holdingSeerSigil(accessor.getPlayer()); hasSigil = hasSeer || holdingDivinationSigil(accessor.getPlayer()); break; } - case 2: { + case SIGIL_CONTAINED: { hasSeer = hasStack(new ItemStack(RegistrarBloodMagicItems.SIGIL_SEER), accessor.getPlayer()); hasSigil = hasSeer || hasStack(new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION), accessor.getPlayer()); break; } - default: { - break; - } } if (!hasSeer && !hasSigil) @@ -93,11 +80,6 @@ public class DataProviderBloodAltar implements IWailaDataProvider { return currenttip; } - @Override - public List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return null; - } - @Override public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { if (te != null) @@ -127,7 +109,7 @@ public class DataProviderBloodAltar implements IWailaDataProvider { if (player.getHeldItemMainhand().getItem() instanceof ItemSigilDivination) return true; - if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ItemSigilDivination) + if (!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ItemSigilDivination) return true; return false; diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIAttackRangedBow.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIAttackRangedBow.java index 21416e37..f6eb575c 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIAttackRangedBow.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIAttackRangedBow.java @@ -86,7 +86,7 @@ public class EntityAIAttackRangedBow extends EntityAIBase { } if (d0 <= (double) this.maxAttackDistance && this.seeTime >= 20) { - this.entity.getNavigator().clearPathEntity(); + this.entity.getNavigator().clearPath(); ++this.strafingTime; } else { this.entity.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.moveSpeedAmp); diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIEatAndCorruptBlock.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIEatAndCorruptBlock.java index 44337f13..a7718a6b 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIEatAndCorruptBlock.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIEatAndCorruptBlock.java @@ -48,7 +48,7 @@ public class EntityAIEatAndCorruptBlock extends EntityAIBase { public void startExecuting() { this.eatingGrassTimer = 40; this.world.setEntityState(this.grassEaterEntity, (byte) 10); - this.grassEaterEntity.getNavigator().clearPathEntity(); + this.grassEaterEntity.getNavigator().clearPath(); } /** diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIFollowOwner.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIFollowOwner.java index 73d08ea2..cd82198d 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIFollowOwner.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIFollowOwner.java @@ -51,7 +51,7 @@ public class EntityAIFollowOwner extends EntityAIBase { return false; } else if (this.thePet.isStationary()) { return false; - } else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double) (this.minDist * this.minDist)) { + } else if (this.thePet.getDistanceSq(entitylivingbase) < (double) (this.minDist * this.minDist)) { return false; } else { this.theOwner = entitylivingbase; @@ -63,7 +63,7 @@ public class EntityAIFollowOwner extends EntityAIBase { * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { - return !this.petPathfinder.noPath() && this.thePet.getDistanceSqToEntity(this.theOwner) > (double) (this.maxDist * this.maxDist) && !this.thePet.isStationary(); + return !this.petPathfinder.noPath() && this.thePet.getDistanceSq(this.theOwner) > (double) (this.maxDist * this.maxDist) && !this.thePet.isStationary(); } /** @@ -80,7 +80,7 @@ public class EntityAIFollowOwner extends EntityAIBase { */ public void resetTask() { this.theOwner = null; - this.petPathfinder.clearPathEntity(); + this.petPathfinder.clearPath(); this.thePet.setPathPriority(PathNodeType.WATER, this.oldWaterCost); } @@ -102,7 +102,7 @@ public class EntityAIFollowOwner extends EntityAIBase { if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.followSpeed)) { if (!this.thePet.getLeashed()) { - if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) { + if (this.thePet.getDistanceSq(this.theOwner) >= 144.0D) { int i = MathHelper.floor(this.theOwner.posX) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2; int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY); @@ -111,7 +111,7 @@ public class EntityAIFollowOwner extends EntityAIBase { for (int i1 = 0; i1 <= 4; ++i1) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.theWorld.getBlockState(new BlockPos(i + l, k - 1, j + i1)).isTopSolid() && this.isEmptyBlock(new BlockPos(i + l, k, j + i1)) && this.isEmptyBlock(new BlockPos(i + l, k + 1, j + i1))) { this.thePet.setLocationAndAngles((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); - this.petPathfinder.clearPathEntity(); + this.petPathfinder.clearPath(); return; } } diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIGrabEffectsFromOwner.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIGrabEffectsFromOwner.java index 3ff28996..3b42eec1 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIGrabEffectsFromOwner.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIGrabEffectsFromOwner.java @@ -85,7 +85,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase { */ public void resetTask() { this.theOwner = null; - this.petPathfinder.clearPathEntity(); + this.petPathfinder.clearPath(); this.thePet.setPathPriority(PathNodeType.WATER, this.oldWaterCost); } @@ -101,7 +101,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase { public void updateTask() { this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float) this.thePet.getVerticalFaceSpeed()); - if (this.thePet.getDistanceSqToEntity(theOwner) < this.minDist * this.minDist) { + if (this.thePet.getDistanceSq(theOwner) < this.minDist * this.minDist) { if (this.thePet.stealEffectsFromOwner(theOwner)) { return; } @@ -113,7 +113,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase { if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.followSpeed)) { if (!this.thePet.getLeashed()) { - if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) { + if (this.thePet.getDistanceSq(this.theOwner) >= 144.0D) { int i = MathHelper.floor(this.theOwner.posX) - 2; int j = MathHelper.floor(this.theOwner.posZ) - 2; int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY); @@ -122,7 +122,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase { for (int i1 = 0; i1 <= 4; ++i1) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.theWorld.getBlockState(new BlockPos(i + l, k - 1, j + i1)).isTopSolid() && this.isEmptyBlock(new BlockPos(i + l, k, j + i1)) && this.isEmptyBlock(new BlockPos(i + l, k + 1, j + i1))) { this.thePet.setLocationAndAngles((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); - this.petPathfinder.clearPathEntity(); + this.petPathfinder.clearPath(); return; } } diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java index b7e370b4..bb120f4a 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java @@ -91,7 +91,7 @@ public class EntityAIPickUpAlly extends EntityAIBase { * Resets the task */ public void resetTask() { - this.entity.getNavigator().clearPathEntity(); + this.entity.getNavigator().clearPath(); this.pickupTarget = null; } diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIProtectAlly.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIProtectAlly.java index b4012277..d831c487 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIProtectAlly.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIProtectAlly.java @@ -58,7 +58,7 @@ public class EntityAIProtectAlly extends EntityAIBase { public void startExecuting() { this.castTimer = 100; this.world.setEntityState(this.entity, (byte) 53); - this.entity.getNavigator().clearPathEntity(); + this.entity.getNavigator().clearPath(); } /** diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIRetreatToHeal.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIRetreatToHeal.java index f077ac20..137efffa 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIRetreatToHeal.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIRetreatToHeal.java @@ -71,7 +71,7 @@ public class EntityAIRetreatToHeal extends EntityAIBase { if (vec3d == null) { return false; //Nowhere to run, gotta fight! - } else if (this.closestLivingEntity.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) { + } else if (this.closestLivingEntity.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < this.closestLivingEntity.getDistanceSq(this.theEntity)) { return false; //I'll be headed off if I choose this direction. } else { this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3d.x, vec3d.y, vec3d.z); @@ -112,13 +112,13 @@ public class EntityAIRetreatToHeal extends EntityAIBase { @Override public void updateTask() { if (this.closestLivingEntity != null) { - if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D) { + if (this.theEntity.getDistanceSq(this.closestLivingEntity) < 49.0D) { this.theEntity.getNavigator().setSpeed(this.nearSpeed); } else { this.theEntity.getNavigator().setSpeed(this.farSpeed); } - if (this.theEntity.ticksExisted % 20 == 0 && this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) >= safeHealDistance * safeHealDistance) { + if (this.theEntity.ticksExisted % 20 == 0 && this.theEntity.getDistanceSq(this.closestLivingEntity) >= safeHealDistance * safeHealDistance) { healEntity(); return; } diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIStealthRetreat.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIStealthRetreat.java index bf7e5540..51600496 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIStealthRetreat.java +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIStealthRetreat.java @@ -47,7 +47,7 @@ public class EntityAIStealthRetreat extends EntityAIBase { if (vec3d == null) { return false; - } else if (attacked.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < attacked.getDistanceSqToEntity(this.entity)) { + } else if (attacked.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) < attacked.getDistanceSq(this.entity)) { return false; } else { this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3d.x, vec3d.y, vec3d.z); @@ -87,7 +87,7 @@ public class EntityAIStealthRetreat extends EntityAIBase { return; } - if (this.entity.getDistanceSqToEntity(this.entity.getAttackTarget()) < 49.0D) { + if (this.entity.getDistanceSq(this.entity.getAttackTarget()) < 49.0D) { this.entity.getNavigator().setSpeed(this.nearSpeed); } else { this.entity.getNavigator().setSpeed(this.farSpeed); diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java index 5e8c75b0..871bfb50 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java @@ -93,7 +93,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase { super.onUpdate(); if (!this.getEntityWorld().isRemote) { - this.setBesideClimbableBlock(this.isCollidedHorizontally); + this.setBesideClimbableBlock(this.collidedHorizontally); } } diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityMimic.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityMimic.java index 2fdb7dd0..0661115a 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityMimic.java +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityMimic.java @@ -215,7 +215,7 @@ public class EntityMimic extends EntityDemonBase { super.onUpdate(); if (!this.getEntityWorld().isRemote) { - this.setBesideClimbableBlock(this.isCollidedHorizontally); + this.setBesideClimbableBlock(this.collidedHorizontally); } } diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java index 95557f14..084df078 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java @@ -410,7 +410,7 @@ public class EntitySentientSpecter extends EntityDemonBase { double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY; double d2 = target.posZ - this.posZ; double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); - entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin' + entitytippedarrow.shoot(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin' int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this); int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this); entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.getEntityWorld().getDifficulty().getDifficultyId() * 0.11F)); diff --git a/src/main/java/WayofTime/bloodmagic/entity/projectile/EntityBloodLight.java b/src/main/java/WayofTime/bloodmagic/entity/projectile/EntityBloodLight.java index 712a9f98..c596696c 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/projectile/EntityBloodLight.java +++ b/src/main/java/WayofTime/bloodmagic/entity/projectile/EntityBloodLight.java @@ -46,7 +46,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); - this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); + this.shoot(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); } @Override @@ -55,7 +55,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit } @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) { + public void shoot(double var1, double var3, double var5, float var7, float var8) { float var9 = MathHelper.sqrt(var1 * var1 + var3 * var3 + var5 * var5); var1 /= var9; var3 /= var9; diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java index 26831f4c..651a8e91 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundAxe.java @@ -82,8 +82,8 @@ public class ItemBoundAxe extends ItemBoundTool implements IMeshProvider { if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) continue; - if (blockStack.getBlock().getBlockHardness(blockStack.getState(), world, blockPos) != -1.0F) { - float strengthVsBlock = getStrVsBlock(stack, blockStack.getState()); + if (blockStack.getState().getBlockHardness(world, blockPos) != -1.0F) { + float strengthVsBlock = getDestroySpeed(stack, blockStack.getState()); if (strengthVsBlock > 1.1F || blockStack.getBlock() instanceof BlockLeaves && world.canMineBlockBody(player, blockPos)) { if (silkTouch && blockStack.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player)) diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java index bc2c47f3..37076c1e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundPickaxe.java @@ -60,11 +60,11 @@ public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider { } @Override - public float getStrVsBlock(ItemStack stack, IBlockState state) { + public float getDestroySpeed(ItemStack stack, IBlockState state) { if (!getActivated(stack)) return 1.0F; - return state.getMaterial() != Material.IRON && state.getMaterial() != Material.ANVIL && state.getMaterial() != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; + return state.getMaterial() != Material.IRON && state.getMaterial() != Material.ANVIL && state.getMaterial() != Material.ROCK ? super.getDestroySpeed(stack, state) : this.efficiency; } @Override @@ -97,7 +97,7 @@ public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider { continue; if (blockStack.getBlock() != null && blockStack.getBlock().getBlockHardness(blockStack.getState(), world, blockPos) != -1) { - float strengthVsBlock = getStrVsBlock(stack, blockStack.getState()); + float strengthVsBlock = getDestroySpeed(stack, blockStack.getState()); if (strengthVsBlock > 1.1F && world.canMineBlockBody(player, blockPos)) { if (silkTouch && blockStack.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player)) diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java index c122d617..2f2600ec 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundShovel.java @@ -83,7 +83,7 @@ public class ItemBoundShovel extends ItemBoundTool implements IMeshProvider { continue; if (blockStack.getBlock() != null && blockStack.getBlock().getBlockHardness(blockStack.getState(), world, blockPos) != -1) { - float strengthVsBlock = getStrVsBlock(stack, blockStack.getState()); + float strengthVsBlock = getDestroySpeed(stack, blockStack.getState()); if (strengthVsBlock > 1.1F && world.canMineBlockBody(player, blockPos)) { if (silkTouch && blockStack.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player)) diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemBoundTool.java b/src/main/java/WayofTime/bloodmagic/item/ItemBoundTool.java index 0bbcea86..fae76626 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemBoundTool.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemBoundTool.java @@ -63,8 +63,8 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable { } @Override - public float getStrVsBlock(ItemStack stack, IBlockState state) { - return getActivated(stack) ? toolMaterial.getEfficiencyOnProperMaterial() : 1.0F; + public float getDestroySpeed(ItemStack stack, IBlockState state) { + return getActivated(stack) ? toolMaterial.getEfficiency() : 1.0F; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java index ba46d284..1444de0e 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSacrificialDagger.java @@ -98,7 +98,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider { return new ActionResult(EnumActionResult.SUCCESS, stack); } - int lpAdded = ConfigHandler.sacrificialDaggerConversion * ConfigHandler.sacrificialDaggerDamage; + int lpAdded = ConfigHandler.values.sacrificialDaggerConversion * 2; RayTraceResult rayTrace = rayTrace(world, player, false); if (rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK) { @@ -109,14 +109,14 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider { } if (!player.capabilities.isCreativeMode) { - SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, ConfigHandler.sacrificialDaggerDamage, lpAdded); + SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2, lpAdded); if (MinecraftForge.EVENT_BUS.post(evt)) return super.onItemRightClick(world, player, hand); if (evt.shouldDrainHealth) { player.hurtResistantTime = 0; player.attackEntityFrom(BloodMagicAPI.damageSource, 0.001F); - player.setHealth(Math.max(player.getHealth() - ConfigHandler.sacrificialDaggerDamage, 0.0001f)); + player.setHealth(Math.max(player.getHealth() - 2, 0.0001f)); if (player.getHealth() <= 0.001f) { player.onDeath(BloodMagicAPI.damageSource); player.setHealth(0); diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java index c2b82f28..b86fc3ea 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientAxe.java @@ -82,8 +82,8 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP } @Override - public float getStrVsBlock(ItemStack stack, IBlockState state) { - float value = super.getStrVsBlock(stack, state); + public float getDestroySpeed(ItemStack stack, IBlockState state) { + float value = super.getDestroySpeed(stack, state); if (value > 1) { return (float) (value + getDigSpeedOfSword(stack)); } else { diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java index 97b87625..ef658a06 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientBow.java @@ -264,13 +264,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien float newArrowVelocity = velocity * getVelocityOfArrow(stack); EntitySentientArrow entityArrow = new EntitySentientArrow(world, user, type, amount); - entityArrow.setAim(user, user.rotationPitch, user.rotationYaw, 0.0F, newArrowVelocity, 1.0F); double d0 = target.posX - user.posX; double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityArrow.posY; double d2 = target.posZ - user.posZ; double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); - entityArrow.setThrowableHeading(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0); + entityArrow.shoot(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0); if (newArrowVelocity == 0) { world.playSound(null, user.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F); @@ -334,7 +333,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien float newArrowVelocity = arrowVelocity * getVelocityOfArrow(stack); EntitySentientArrow entityArrow = new EntitySentientArrow(world, entityLiving, type, amount); - entityArrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F); + entityArrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F); if (newArrowVelocity == 0) { world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F); diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java index 05c51b19..ca8a0502 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientPickaxe.java @@ -82,8 +82,8 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon } @Override - public float getStrVsBlock(ItemStack stack, IBlockState state) { - float value = super.getStrVsBlock(stack, state); + public float getDestroySpeed(ItemStack stack, IBlockState state) { + float value = super.getDestroySpeed(stack, state); if (value > 1) { return (float) (value + getDigSpeedOfSword(stack)); } else { diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java index 2edd2b73..e86ee440 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientShovel.java @@ -82,8 +82,8 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I } @Override - public float getStrVsBlock(ItemStack stack, IBlockState state) { - float value = super.getStrVsBlock(stack, state); + public float getDestroySpeed(ItemStack stack, IBlockState state) { + float value = super.getDestroySpeed(stack, state); if (value > 1) { return (float) (value + getDigSpeedOfSword(stack)); } else { diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java index e6d76d8c..f422be70 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulSnare.java @@ -44,7 +44,7 @@ public class ItemSoulSnare extends Item implements IVariantProvider { if (!worldIn.isRemote) { EntitySoulSnare snare = new EntitySoulSnare(worldIn, playerIn); - snare.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); + snare.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(snare); } diff --git a/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java b/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java index 1c482c0d..e5aadc77 100644 --- a/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java +++ b/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java @@ -63,7 +63,7 @@ public class MeteorConfigHandler { reader.close(); } - if (checkNewVersion && ConfigHandler.config.getBoolean("resyncOnVersionChange", "Meteors", true, "Should the default meteors be regenerated if the mod has updated them")) { + if (checkNewVersion && ConfigHandler.values.shouldResyncMeteors) { Set discoveredDefaults = Sets.newHashSet(); // Check existing defaults for new version @@ -93,8 +93,6 @@ public class MeteorConfigHandler { } catch (Exception e) { e.printStackTrace(); } - - ConfigHandler.config.save(); } private static List> getDefaultMeteors() { diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 30cde112..6cf39b59 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -1,7 +1,6 @@ package WayofTime.bloodmagic.registry; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.alchemyArray.*; import WayofTime.bloodmagic.api.altar.EnumAltarTier; import WayofTime.bloodmagic.api.compress.CompressionRegistry; @@ -47,6 +46,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.tuple.Pair; @@ -559,7 +559,7 @@ public class ModRecipes { private static void setupDir() { if (RECIPE_DIR == null) { - RECIPE_DIR = ConfigHandler.config.getConfigFile().toPath().resolve("../recipes/").toFile(); + RECIPE_DIR = new File(Loader.instance().getConfigDir(), "bloodmagic/recipes"); } if (!RECIPE_DIR.exists()) { diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java index ad026e23..3d0def9a 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java @@ -42,7 +42,6 @@ public class ModRituals { public static Ritual forsakenSoulRitual; public static Ritual crystalHarvestRitual; - // public static Ritual cobblestoneRitual; public static Ritual placerRitual; public static Ritual fellingRitual; public static Ritual pumpRitual; @@ -60,68 +59,64 @@ public class ModRituals { public static void initRituals() { waterRitual = new RitualWater(); - RitualRegistry.registerRitual(waterRitual, ConfigHandler.ritualWater); + RitualRegistry.registerRitual(waterRitual, ConfigHandler.rituals.ritualWater); lavaRitual = new RitualLava(); - RitualRegistry.registerRitual(lavaRitual, ConfigHandler.ritualLava); + RitualRegistry.registerRitual(lavaRitual, ConfigHandler.rituals.ritualLava); greenGroveRitual = new RitualGreenGrove(); - RitualRegistry.registerRitual(greenGroveRitual, ConfigHandler.ritualGreenGrove); + RitualRegistry.registerRitual(greenGroveRitual, ConfigHandler.rituals.ritualGreenGrove); jumpRitual = new RitualJumping(); - RitualRegistry.registerRitual(jumpRitual, ConfigHandler.ritualJumping); + RitualRegistry.registerRitual(jumpRitual, ConfigHandler.rituals.ritualJumping); sufferingRitual = new RitualWellOfSuffering(); - RitualRegistry.registerRitual(sufferingRitual, ConfigHandler.ritualWellOfSuffering); + RitualRegistry.registerRitual(sufferingRitual, ConfigHandler.rituals.ritualWellOfSuffering); featheredKnifeRitual = new RitualFeatheredKnife(); - RitualRegistry.registerRitual(featheredKnifeRitual, ConfigHandler.ritualFeatheredKnife); + RitualRegistry.registerRitual(featheredKnifeRitual, ConfigHandler.rituals.ritualFeatheredKnife); regenerationRitual = new RitualRegeneration(); - RitualRegistry.registerRitual(regenerationRitual, ConfigHandler.ritualRegeneration); + RitualRegistry.registerRitual(regenerationRitual, ConfigHandler.rituals.ritualRegeneration); animalGrowthRitual = new RitualAnimalGrowth(); - RitualRegistry.registerRitual(animalGrowthRitual, ConfigHandler.ritualAnimalGrowth); + RitualRegistry.registerRitual(animalGrowthRitual, ConfigHandler.rituals.ritualAnimalGrowth); harvestRitual = new RitualHarvest(); - RitualRegistry.registerRitual(harvestRitual, ConfigHandler.ritualHarvest); + RitualRegistry.registerRitual(harvestRitual, ConfigHandler.rituals.ritualHarvest); initHarvestHandlers(); magneticRitual = new RitualMagnetic(); - RitualRegistry.registerRitual(magneticRitual, ConfigHandler.ritualMagnetic); + RitualRegistry.registerRitual(magneticRitual, ConfigHandler.rituals.ritualMagnetic); crushingRitual = new RitualCrushing(); - RitualRegistry.registerRitual(crushingRitual, ConfigHandler.ritualCrushing); + RitualRegistry.registerRitual(crushingRitual, ConfigHandler.rituals.ritualCrushing); stomachRitual = new RitualFullStomach(); - RitualRegistry.registerRitual(stomachRitual, ConfigHandler.ritualFullStomach); + RitualRegistry.registerRitual(stomachRitual, ConfigHandler.rituals.ritualFullStomach); interdictionRitual = new RitualInterdiction(); - RitualRegistry.registerRitual(interdictionRitual, ConfigHandler.ritualInterdiction); + RitualRegistry.registerRitual(interdictionRitual, ConfigHandler.rituals.ritualInterdiction); containmentRitual = new RitualContainment(); - RitualRegistry.registerRitual(containmentRitual, ConfigHandler.ritualContainment); + RitualRegistry.registerRitual(containmentRitual, ConfigHandler.rituals.ritualContainment); speedRitual = new RitualSpeed(); - RitualRegistry.registerRitual(speedRitual, ConfigHandler.ritualSpeed); + RitualRegistry.registerRitual(speedRitual, ConfigHandler.rituals.ritualSpeed); suppressionRitual = new RitualSuppression(); - RitualRegistry.registerRitual(suppressionRitual, ConfigHandler.ritualSuppression); + RitualRegistry.registerRitual(suppressionRitual, ConfigHandler.rituals.ritualSuppression); zephyrRitual = new RitualZephyr(); - RitualRegistry.registerRitual(zephyrRitual, ConfigHandler.ritualZephyr); + RitualRegistry.registerRitual(zephyrRitual, ConfigHandler.rituals.ritualZephyr); expulsionRitual = new RitualExpulsion(); - RitualRegistry.registerRitual(expulsionRitual, ConfigHandler.ritualExpulsion); + RitualRegistry.registerRitual(expulsionRitual, ConfigHandler.rituals.ritualExpulsion); upgradeRemoveRitual = new RitualUpgradeRemove(); - RitualRegistry.registerRitual(upgradeRemoveRitual, ConfigHandler.ritualUpgradeRemove); + RitualRegistry.registerRitual(upgradeRemoveRitual, ConfigHandler.rituals.ritualUpgradeRemove); armourEvolveRitual = new RitualArmourEvolve(); - RitualRegistry.registerRitual(armourEvolveRitual, ConfigHandler.ritualArmourEvolve); + RitualRegistry.registerRitual(armourEvolveRitual, ConfigHandler.rituals.ritualArmourEvolve); forsakenSoulRitual = new RitualForsakenSoul(); - RitualRegistry.registerRitual(forsakenSoulRitual, ConfigHandler.ritualForsakenSoul); + RitualRegistry.registerRitual(forsakenSoulRitual, ConfigHandler.rituals.ritualForsakenSoul); crystalHarvestRitual = new RitualCrystalHarvest(); - RitualRegistry.registerRitual(crystalHarvestRitual, ConfigHandler.ritualCrystalHarvest); - -// cobblestoneRitual = new RitualCobblestone(); -// RitualRegistry.registerRitual(cobblestoneRitual, ConfigHandler.cobblestoneRitual); + RitualRegistry.registerRitual(crystalHarvestRitual, ConfigHandler.rituals.ritualCrystalHarvest); placerRitual = new RitualPlacer(); - RitualRegistry.registerRitual(placerRitual, ConfigHandler.placerRitual); + RitualRegistry.registerRitual(placerRitual, ConfigHandler.rituals.ritualPlacer); fellingRitual = new RitualFelling(); - RitualRegistry.registerRitual(fellingRitual, ConfigHandler.fellingRitual); + RitualRegistry.registerRitual(fellingRitual, ConfigHandler.rituals.ritualFelling); pumpRitual = new RitualPump(); - RitualRegistry.registerRitual(pumpRitual, ConfigHandler.pumpRitual); + RitualRegistry.registerRitual(pumpRitual, ConfigHandler.rituals.ritualPump); altarBuilderRitual = new RitualAltarBuilder(); - RitualRegistry.registerRitual(altarBuilderRitual, ConfigHandler.altarBuilderRitual); + RitualRegistry.registerRitual(altarBuilderRitual, ConfigHandler.rituals.ritualAltarBuilder); portalRitual = new RitualPortal(); - RitualRegistry.registerRitual(portalRitual, ConfigHandler.portalRitual); + RitualRegistry.registerRitual(portalRitual, ConfigHandler.rituals.ritualPortal); meteorRitual = new RitualMeteor(); - RitualRegistry.registerRitual(meteorRitual, ConfigHandler.meteorRitual); - + RitualRegistry.registerRitual(meteorRitual, ConfigHandler.rituals.ritualMeteor); downgradeRitual = new RitualLivingArmourDowngrade(); - RitualRegistry.registerRitual(downgradeRitual, ConfigHandler.downgradeRitual); + RitualRegistry.registerRitual(downgradeRitual, ConfigHandler.rituals.ritualDowngrade); RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 250, 0.5); RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 25, 0.05); @@ -129,13 +124,13 @@ public class ModRituals { public static void initImperfectRituals() { imperfectNight = new ImperfectRitualNight(); - ImperfectRitualRegistry.registerRitual(imperfectNight, ConfigHandler.imperfectRitualNight); + ImperfectRitualRegistry.registerRitual(imperfectNight, ConfigHandler.rituals.imperfect.imperfectRitualNight); imperfectRain = new ImperfectRitualRain(); - ImperfectRitualRegistry.registerRitual(imperfectRain, ConfigHandler.imperfectRitualRain); + ImperfectRitualRegistry.registerRitual(imperfectRain, ConfigHandler.rituals.imperfect.imperfectRitualRain); imperfectResistance = new ImperfectRitualResistance(); - ImperfectRitualRegistry.registerRitual(imperfectResistance, ConfigHandler.imperfectRitualResistance); + ImperfectRitualRegistry.registerRitual(imperfectResistance, ConfigHandler.rituals.imperfect.imperfectRitualResistance); imperfectZombie = new ImperfectRitualZombie(); - ImperfectRitualRegistry.registerRitual(imperfectZombie, ConfigHandler.imperfectRitualZombie); + ImperfectRitualRegistry.registerRitual(imperfectZombie, ConfigHandler.rituals.imperfect.imperfectRitualZombie); } public static void initHarvestHandlers() { diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualExpulsion.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualExpulsion.java index 9cc17048..5c9b254a 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualExpulsion.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualExpulsion.java @@ -136,7 +136,7 @@ public class RitualExpulsion extends Ritual { if (flag1) { moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); - if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox())) { + if (!entityLiving.collided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox())) { flag = true; } } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualFeatheredKnife.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualFeatheredKnife.java index 60dce160..38a5b4fb 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualFeatheredKnife.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualFeatheredKnife.java @@ -152,7 +152,7 @@ public class RitualFeatheredKnife extends Ritual { player.setHealth(health - sacrificedHealth); - tileAltar.sacrificialDaggerCall((int) (ConfigHandler.sacrificialDaggerConversion * lpModifier * sacrificedHealth), false); + tileAltar.sacrificialDaggerCall((int) (ConfigHandler.values.sacrificialDaggerConversion * lpModifier * sacrificedHealth), false); totalEffects++; diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualForsakenSoul.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualForsakenSoul.java index 6f704b07..de8a4a54 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualForsakenSoul.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualForsakenSoul.java @@ -112,7 +112,7 @@ public class RitualForsakenSoul extends Ritual { if (!entity.isEntityAlive()) { int uniqueness = calculateUniqueness(entity); double modifier = 1; - if (entity instanceof EntityAnimal && !entity.isCollided) { + if (entity instanceof EntityAnimal && !((EntityAnimal) entity).collided) { modifier = 4; } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java index c92e1267..8c9aa9ee 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java @@ -311,7 +311,7 @@ public class ClientHandler { public static void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel) { int mode = dWheel; - if (!ConfigHandler.sigilHoldingSkipsEmptySlots) { + if (!ConfigHandler.client.sigilHoldingSkipsEmptySlots) { mode = ItemSigilHolding.getCurrentItemOrdinal(stack); mode = dWheel < 0 ? ItemSigilHolding.next(mode) : ItemSigilHolding.prev(mode); } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java index 366c9c1f..f47c2065 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/CraftingHandler.java @@ -1,7 +1,6 @@ package WayofTime.bloodmagic.util.handler.event; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.annot.Handler; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.event.AltarCraftedEvent; @@ -51,19 +50,20 @@ public class CraftingHandler { // Handles crafting of: Revealing Upgrade Tome, Elytra Upgrade Tome, Combining Upgrade Tomes, Setting Upgrade for Trainer @SubscribeEvent public void onAnvil(AnvilUpdateEvent event) { - if (ConfigHandler.thaumcraftGogglesUpgrade) { - if (event.getLeft().getItem() == RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET && event.getRight().getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.getRight().isItemDamaged()) { - ItemStack output = new ItemStack(RegistrarBloodMagicItems.UPGRADE_TOME); - output = NBTHelper.checkNBT(output); - ItemHelper.LivingUpgrades.setKey(output, BloodMagic.MODID + ".upgrade.revealing"); - ItemHelper.LivingUpgrades.setLevel(output, 1); - event.setCost(1); - - event.setOutput(output); - - return; - } - } + // TODO - Azanor come back :( +// if (ConfigHandler.thaumcraftGogglesUpgrade) { +// if (event.getLeft().getItem() == RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET && event.getRight().getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.getRight().isItemDamaged()) { +// ItemStack output = new ItemStack(RegistrarBloodMagicItems.UPGRADE_TOME); +// output = NBTHelper.checkNBT(output); +// ItemHelper.LivingUpgrades.setKey(output, BloodMagic.MODID + ".upgrade.revealing"); +// ItemHelper.LivingUpgrades.setLevel(output, 1); +// event.setCost(1); +// +// event.setOutput(output); +// +// return; +// } +// } if (event.getLeft().getItem() == RegistrarBloodMagicItems.SIGIL_HOLDING) { if (event.getRight().getItem() == Items.NAME_TAG) { diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java index 74d75c62..3a94876a 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java @@ -186,7 +186,7 @@ public class GenericHandler { boolean shouldSyphon = pack.getStoredLP(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) < pack.CAPACITY; float damageDone = event.getEntityLiving().getHealth() < event.getAmount() ? event.getAmount() - event.getEntityLiving().getHealth() : event.getAmount(); - int totalLP = Math.round(damageDone * ConfigHandler.sacrificialPackConversion); + int totalLP = Math.round(damageDone * ConfigHandler.values.coatOfArmsConversion); if (shouldSyphon) ItemHelper.LPContainer.addLPToItem(player.getItemStackFromSlot(EntityEquipmentSlot.CHEST), totalLP, pack.CAPACITY); @@ -228,7 +228,7 @@ public class GenericHandler { attackTaskMap.put(animal, attackTask); } - if (animal.getAttackTarget() != null && animal.getDistanceSqToEntity(animal.getAttackTarget()) < 4) { + if (animal.getAttackTarget() != null && animal.getDistanceSq(animal.getAttackTarget()) < 4) { animal.getEntityWorld().createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(RegistrarBloodMagic.SACRIFICIAL_LAMB).getAmplifier() * 1.5f, false); targetTaskMap.remove(animal); attackTaskMap.remove(animal); diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java index 903d77e9..5488e7e1 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java @@ -284,7 +284,7 @@ public class LivingArmourHandler { ItemStack arrowStack = new ItemStack(Items.ARROW); ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW)); EntityArrow entityarrow = itemarrow.createArrow(world, arrowStack, player); - entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, velocity * 3.0F, 1.0F); + entityarrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, velocity * 3.0F, 1.0F); float velocityModifier = 0.6f * velocity;