From c7a91d3e194c75548288bdd96d95045dd2efbf0d Mon Sep 17 00:00:00 2001 From: KnightMiner Date: Sun, 24 Nov 2019 02:16:17 -0600 Subject: [PATCH] Clean up config Disable some things for now until I decide how to reimplement them --- .../inspirations/Inspirations.java | 14 +- .../building/InspirationsBuilding.java | 14 +- .../inspirations/common/Config.java | 383 +++--------------- .../common/data/ConfigEnabledCondition.java | 17 +- .../inspirations/recipes/RecipesEvents.java | 13 +- .../inspirations/shared/SharedEvents.java | 3 +- .../tools/item/RedstoneArrowItem.java | 7 +- .../tweaks/InspirationsTweaks.java | 21 +- .../inspirations/tweaks/TweaksEvents.java | 2 + .../utility/InspirationsUtility.java | 13 +- .../recipes/tools/redstone_charger.json | 2 +- 11 files changed, 113 insertions(+), 376 deletions(-) diff --git a/src/main/java/knightminer/inspirations/Inspirations.java b/src/main/java/knightminer/inspirations/Inspirations.java index b0572eb3..51b05c11 100644 --- a/src/main/java/knightminer/inspirations/Inspirations.java +++ b/src/main/java/knightminer/inspirations/Inspirations.java @@ -53,15 +53,15 @@ public class Inspirations { public Inspirations() { pulseManager = new PulseManager(Config.pulseConfig); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); + ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SPEC); log.info("Loading replacements config file..."); CommentedFileConfig repl_config = CommentedFileConfig .builder(FMLPaths.CONFIGDIR.get().resolve(modID + "-replacements.toml")) - .sync(). - preserveInsertionOrder(). - writingMode(WritingMode.REPLACE). - build(); + .sync() + .preserveInsertionOrder() + .writingMode(WritingMode.REPLACE) + .build(); repl_config.load(); repl_config.save(); Config.SPEC_OVERRIDE.setConfig(repl_config); @@ -87,8 +87,8 @@ public Inspirations() { public void configChanged(final ModConfig.ModConfigEvent configEvent) { configLoaded = true; - InspirationsRegistry.setConfig("biggerCauldron", Config.enableBiggerCauldron()); - InspirationsRegistry.setConfig("expensiveCauldronBrewing", Config.expensiveCauldronBrewing()); + //InspirationsRegistry.setConfig("biggerCauldron", Config.enableBiggerCauldron()); + //InspirationsRegistry.setConfig("expensiveCauldronBrewing", Config.expensiveCauldronBrewing()); InspirationsRegistry.setBookKeywords(Arrays .stream(Config.bookKeywords.get().split(",")) .map(String::trim) diff --git a/src/main/java/knightminer/inspirations/building/InspirationsBuilding.java b/src/main/java/knightminer/inspirations/building/InspirationsBuilding.java index ecbf67bd..24de565c 100644 --- a/src/main/java/knightminer/inspirations/building/InspirationsBuilding.java +++ b/src/main/java/knightminer/inspirations/building/InspirationsBuilding.java @@ -255,13 +255,13 @@ public static void loadLoad(LootTableLoadEvent event) { @SubscribeEvent public void init(FMLCommonSetupEvent event) { - if(Config.enableFlowers.get() && Config.enableCauldronDyeing()) { -// InspirationsRegistry.addCauldronRecipe(new DyeCauldronRecipe( -// new ItemStack(flower_rose), -// DyeColor.CYAN, -// new ItemStack(flower_cyan)) -// ); - } + /*if(Config.enableFlowers.get() && Config.enableCauldronDyeing()) { + InspirationsRegistry.addCauldronRecipe(new DyeCauldronRecipe( + new ItemStack(flower_rose), + DyeColor.CYAN, + new ItemStack(flower_cyan)) + ); + }*/ MinecraftForge.EVENT_BUS.register(BuildingEvents.class); } diff --git a/src/main/java/knightminer/inspirations/common/Config.java b/src/main/java/knightminer/inspirations/common/Config.java index 8a5114ff..8f2ceb93 100644 --- a/src/main/java/knightminer/inspirations/common/Config.java +++ b/src/main/java/knightminer/inspirations/common/Config.java @@ -1,19 +1,8 @@ package knightminer.inspirations.common; -import knightminer.inspirations.Inspirations; -import knightminer.inspirations.library.InspirationsRegistry; -import knightminer.inspirations.library.util.RecipeUtil; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeConfigSpec; import slimeknights.mantle.pulsar.config.PulsarConfig; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - import static net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import static net.minecraftforge.common.ForgeConfigSpec.Builder; import static net.minecraftforge.common.ForgeConfigSpec.ConfigValue; @@ -26,6 +15,7 @@ public class Config { public static PulsarConfig pulseConfig = new PulsarConfig("inspirationsModules", "Modules"); + // TODO: add client config public static Builder BUILDER; public static ForgeConfigSpec SPEC; public static Builder BUILDER_OVERRIDE; @@ -56,21 +46,9 @@ public static boolean enableColoredBooks() { public static ConfigValue bookKeywords; private static String bookKeywordsDefault = "almanac, atlas, book, catalogue, concordance, dictionary, directory, encyclopedia, guide, journal, lexicon, manual, thesaurus, tome"; - public static ConfigValue> bookOverrides; - private static List bookOverridesDefault = Arrays.asList( - "defiledlands:book_wyrm_raw->false", - "defiledlands:book_wyrm_cooked->false", - "defiledlands:book_wyrm_scale->false", - "defiledlands:book_wyrm_scale_golden->false", - "defiledlands:book_wyrm_analyzer->false", - "minecraft:enchanted_book->2.5", - "quark:ancient_tome->3.0", - "theoneprobe:probenote->1.0" - ); // utility public static BooleanValue enableTorchLever; - public static BooleanValue enableRedstoneTorchLever; private static BooleanValue enableRedstoneBook; public static BooleanValue enableBricksButton; public static BooleanValue enableCarpetedTrapdoor; @@ -78,9 +56,9 @@ public static boolean enableColoredBooks() { public static BooleanValue enableCollector; public static BooleanValue enablePipe; public static BooleanValue pipeUpwards; - public static BooleanValue enableDispenserFluidTanks; - public static BooleanValue milkSquids; - public static IntValue milkSquidCooldown; + //public static BooleanValue enableDispenserFluidTanks; + //public static BooleanValue milkSquids; + //public static IntValue milkSquidCooldown; public static boolean enableRedstoneBook() { return enableRedstoneBook.get() && enableBookshelf.get(); } @@ -171,11 +149,6 @@ public static boolean cauldronTipArrows() { return cauldronTipArrows.get() && enableCauldronPotions(); } - // cauldron - recipes - private static String[] cauldronRecipes = { - "minecraft:sticky_piston->minecraft:piston" - }; - // cauldron - fluid containers private static BooleanValue enableCauldronDispenser; public static boolean enableCauldronDispenser() { @@ -183,68 +156,15 @@ public static boolean enableCauldronDispenser() { } // anvil smashing public static BooleanValue enableAnvilSmashing; - private static String[] anvilSmashing = { - "# Stone", - "minecraft:stone:0->minecraft:cobblestone", - "minecraft:stonebrick->minecraft:cobblestone", - "minecraft:stonebrick:1->minecraft:mossy_cobblestone", - "minecraft:cobblestone->minecraft:gravel", - "minecraft:stone:2->minecraft:stone:1", - "minecraft:stone:4->minecraft:stone:3", - "minecraft:stone:6->minecraft:stone:5", - - "# Sandstone", - "minecraft:sandstone->minecraft:sand:0", - "minecraft:red_sandstone->minecraft:sand:1", - - "# Ice", - "minecraft:packed_ice->minecraft:ice", - "minecraft:ice", - "minecraft:frosted_ice", - - "# Plants", - "minecraft:brown_mushroom_block", - "minecraft:red_mushroom_block", - "minecraft:leaves", - "minecraft:leaves2", - "minecraft:melon_block", - "minecraft:pumpkin", - "minecraft:lit_pumpkin", - - "# Concrete", - "minecraft:concrete:0->minecraft:concrete_powder:0", - "minecraft:concrete:1->minecraft:concrete_powder:1", - "minecraft:concrete:2->minecraft:concrete_powder:2", - "minecraft:concrete:3->minecraft:concrete_powder:3", - "minecraft:concrete:4->minecraft:concrete_powder:4", - "minecraft:concrete:5->minecraft:concrete_powder:5", - "minecraft:concrete:6->minecraft:concrete_powder:6", - "minecraft:concrete:7->minecraft:concrete_powder:7", - "minecraft:concrete:8->minecraft:concrete_powder:8", - "minecraft:concrete:9->minecraft:concrete_powder:9", - "minecraft:concrete:10->minecraft:concrete_powder:10", - "minecraft:concrete:11->minecraft:concrete_powder:11", - "minecraft:concrete:12->minecraft:concrete_powder:12", - "minecraft:concrete:13->minecraft:concrete_powder:13", - "minecraft:concrete:14->minecraft:concrete_powder:14", - "minecraft:concrete:15->minecraft:concrete_powder:15", - - "# Misc", - "minecraft:planks->inspirations:mulch:0", - "minecraft:prismarine:1->minecraft:prismarine:0", - "minecraft:end_bricks->minecraft:end_stone", - "minecraft:monster_egg" - }; - // tools public static BooleanValue enableLock; - public static BooleanValue enableRedstoneCharge; + public static BooleanValue enableRedstoneCharger; public static BooleanValue enableChargedArrow; public static BooleanValue harvestHangingVines; public static BooleanValue shearsReclaimMelons; public static BooleanValue enableNorthCompass; - public static BooleanValue renameVanillaCompass; + //public static BooleanValue renameVanillaCompass; public static BooleanValue enableBarometer; public static BooleanValue enablePhotometer; @@ -298,14 +218,14 @@ public static boolean brewHeartbeet() { // seeds public static BooleanValue enableMoreSeeds; - private static BooleanValue addGrassDrops; - private static BooleanValue nerfCarrotPotatoDrops; - public static boolean addGrassDrops() { - return addGrassDrops.get() && enableMoreSeeds.get(); - } - public static boolean nerfCarrotPotatoDrops() { - return nerfCarrotPotatoDrops.get() && enableMoreSeeds.get(); - } +// private static BooleanValue addGrassDrops; +// private static BooleanValue nerfCarrotPotatoDrops; +// public static boolean addGrassDrops() { +// return addGrassDrops.get() && enableMoreSeeds.get(); +// } +// public static boolean nerfCarrotPotatoDrops() { +// return nerfCarrotPotatoDrops.get() && enableMoreSeeds.get(); +// } // bonemeal public static BooleanValue bonemealMushrooms; public static BooleanValue bonemealDeadBush; @@ -315,14 +235,6 @@ public static boolean nerfCarrotPotatoDrops() { public static BooleanValue caveSpiderDrops; public static BooleanValue skeletonSkull; - private static String[] milkContainersDefault = { - "ceramics:clay_bucket", - "minecraft:bowl", // mushroom stew from mooshrooms - "minecraft:bucket", - "simplytea:teapot" - }; - public static Set milkContainers; - static { BUILDER = new Builder(); BUILDER_OVERRIDE = new Builder(); @@ -343,9 +255,11 @@ private static void configure(Builder builder, Builder builder_override) { // bookshelves enableBookshelf = builder .comment("Enables the bookshelf: a decorative block to display books") + .worldRestart() .define("bookshelf.enable", true); enableColoredBooks = builder .comment("Enables colored books: basically colored versions of the vanilla book to decorate bookshelves") + .worldRestart() .define("bookshelf.coloredBooks", true ); bookshelvesBoostEnchanting = builder @@ -421,16 +335,12 @@ private static void configure(Builder builder, Builder builder_override) { .define("torchLever", true); // bricks button + /* enableBricksButton = builder .comment("Enables button blocks disguised as a full bricks or nether bricks block") .worldRestart() .define("bricksButton", true); - - // redstone torch lever - enableRedstoneTorchLever = builder - .comment("Enables the redstone torch lever: a lever that toggles its state when the block it's on gets powered") - .worldRestart() - .define("redstoneTorchLever", true); + */ // carpeted trapdoor enableCarpetedTrapdoor = builder @@ -457,18 +367,20 @@ private static void configure(Builder builder, Builder builder_override) { .define("pipe.enable", true); pipeUpwards = builder .comment("Allows pipes to output upwards. This removes a limitation on not being able to pipe items up without dropper elevators, but should be balanced alongside modded pipes.") - .worldRestart() .define("pipe.upwards", true); // dispenser fluid containers + /* enableDispenserFluidTanks = builder .comment("Allows dispensers to fill and empty fluid tanks using fluid containers") .worldRestart() .define("dispenserFluidTanks", true); + */ } builder.pop(); // recipes + /* builder.push("recipes"); { // anvil smashing @@ -555,14 +467,15 @@ private static void configure(Builder builder, Builder builder_override) { builder.pop(); } builder.pop(); + */ builder.push("tools"); { // redstone charge - enableRedstoneCharge = builder + enableRedstoneCharger = builder .comment("Enables the redstone charger: a quick pulse created with a flint and steel like item") .worldRestart() - .define("redstoneCharge", true); + .define("redstoneCharger", true); enableChargedArrow = builder .comment("Enables the charged arrow: places a redstone pulse where it lands") @@ -590,10 +503,12 @@ private static void configure(Builder builder, Builder builder_override) { .comment("Enables the north compass: a cheaper compass that always points north. Intended to either allow packs to replace the compass or as an alternative for F3 navigation") .worldRestart() .define("northCompass.enable", true); + /* renameVanillaCompass = builder .comment("Renames the vanilla compass to 'origin compass' to help clarify the difference between the two compasses.") .worldRestart() .define("northCompass.renameVanilla", true); + */ // barometer enableBarometer = builder @@ -614,9 +529,11 @@ private static void configure(Builder builder, Builder builder_override) { .define("waypointCompass.enable", true); dyeWaypointCompass = builder .comment("If true, waypoint compasses can be dyed all vanilla colors") + .worldRestart() .define("waypointCompass.dye", true); craftWaypointCompass = builder .comment("If true, waypoint compasses can be crafted using iron and a blaze rod. If false, they are obtained by using a vanilla compass on a beacon.") + .worldRestart() .define("waypointCompass.craft", true); waypointCompassAdvTooltip = builder .comment("If true, waypoint compasses show the position target in the advanced item tooltip. Disable for packs that disable coordinates.") @@ -626,24 +543,31 @@ private static void configure(Builder builder, Builder builder_override) { .define("waypointCompass.crossDimension", true); copyWaypointCompass = builder .comment("If true, you can copy the position of one waypoint compass to another in a crafting table, similarly to maps or compasses") + .worldRestart() .define("waypointCompass.copy", true); + // TODO: consider a way to allow the registry sub, but still have these props set by the server // enchantments moreShieldEnchantments = builder_override .comment("If true, shields can now be enchanted with enchantments such as protection, fire aspect, knockback, and thorns. This requires replacing these enchantments.") + .worldRestart() .define("enchantments.moreShield", true); shieldEnchantmentTable = builder_override .comment("If true, shields can be enchanted in an enchantment table. Does not support modded shields as it requires a registry substitution") + .worldRestart() .define("enchantments.shieldTable", true); fixShieldTooltip = builder .comment("If true, fixes the tooltip on shield items so it looks better with both patterns and enchantments") - .define("fixShieldTooltip", true); + .worldRestart() + .define("enchantments.fixShieldTooltip", true); axeWeaponEnchants = builder_override .comment("If true, axes will be able to be enchanted with weapon enchants such as looting, fire aspect, and knockback") + .worldRestart() .define("enchantments.axeWeapon", true); axeEnchantmentTable = builder_override .comment("If true, axes can receive available weapon enchantments at the enchantment table") + .worldRestart() .define("enchantments.axeTable", true); } builder.pop(); @@ -658,6 +582,7 @@ private static void configure(Builder builder, Builder builder_override) { // fitted carpets enableFittedCarpets = builder_override .comment("Replace carpet blocks, allowing them to fit to stairs below them.") + .worldRestart() .define("fittedCarpets", true); // bonemeal @@ -679,10 +604,13 @@ private static void configure(Builder builder, Builder builder_override) { // heartroot enableHeartbeet = builder .comment("Enables heartbeets: a rare drop from beetroots which can be eaten to restore a bit of health") + .worldRestart() .define("heartbeet.enable", true); brewHeartbeet = builder .comment("Allows heartbeets to be used as an alternative to ghast tears in making potions of regeneration") + .worldRestart() .define("heartbeet.brewRegeneration", true); // && enableHeartbeet; + // TODO: move to loot tables heartbeetChance = builder .comment("Chance of a heartbeet to drop instead of a normal drop. Formula is two 1 in [chance] chances for it to drop each harvest") .defineInRange("heartbeet.chance", 75, 10, 1000); @@ -690,11 +618,13 @@ private static void configure(Builder builder, Builder builder_override) { // dispensers place anvils dispensersPlaceAnvils = builder .comment("Dispensers will place anvils instead of dropping them. Plays well with anvil smashing.") + .worldRestart() .define("dispensersPlaceAnvils", true); // better cauldron item betterCauldronItem = builder .comment("Replaces the flat cauldron sprite with the 3D cauldron block model") + .worldRestart() .define("betterCauldronItemModel", true); // colored enchanted book ribbons @@ -706,6 +636,7 @@ private static void configure(Builder builder, Builder builder_override) { // colored fireworks coloredFireworkItems = builder .comment("Colors the fireworks item based on the colors of the stars") + .worldRestart() .define("coloredFireworkItems", true); // lilypad fall breaking @@ -716,9 +647,11 @@ private static void configure(Builder builder, Builder builder_override) { // stackable alternative recipes unstackableRecipeAlts = builder .comment("Adds stackable recipes to some vanilla or Inspriations items that require unstackable items to craft") + .worldRestart() .define("unstackableRecipeAlts", true); // seeds + /* enableMoreSeeds = builder .comment("Adds seeds for additional vanilla plants, including cactus, sugar cane, carrots, and potatoes.") .worldRestart() @@ -729,6 +662,7 @@ private static void configure(Builder builder, Builder builder_override) { nerfCarrotPotatoDrops = builder .comment("Makes carrots and potatoes drop their respective seed if not fully grown") .define("moreSeeds.nerfCarrotPotatoDrops", true); + */ // milk cooldown milkCooldown = builder @@ -737,214 +671,31 @@ private static void configure(Builder builder, Builder builder_override) { milkCooldownTime = builder .comment("Delay in seconds after milking a cow before it can be milked again.") .defineInRange("milkCooldown.time", 600, 1, Short.MAX_VALUE); - customPortalColor = builder - .comment( "Allows the portal color to be changed by placing colored blocks under the portal. Any block that tints a beacon beam will work for the color.") - .define("customPortalColor", true); - } - builder.pop(); - - // milk squids - milkSquids = builder - .comment("Allows milking squids with a glass bottle to get black dyed water.") - .define("tweaks.milkSquids.enable", true); - milkSquidCooldown = builder - .comment("Delay in seconds after milking a squid before it can be milked again.") - .defineInRange("tweaks.milkSquids.cooldown", 300, 1, Short.MAX_VALUE); - - - // drops - caveSpiderDrops = builder - .comment("If true, cave spiders will rarely drop webs, giving them an advantage to farm over regular spiders") - .define("caveSpiderWeb", true); - skeletonSkull = builder - .comment("If true, skeletons will rarely drop their skull for consistency with wither skeletons. Does not affect creeper or zombie heads.") - .define("skeletonSkull", true); - - // building -// Property property = configFile.get("building.bookshelf", "bookOverrides", bookOverrides, -// "List of itemstacks to override book behavior. Format is modid:name[:meta][->enchantingPower].\nUnset meta will default wildcard.\n0 is a valid enchanting power, if unset uses default. Set to 'false' to mark something as not a book."); -// bookOverrides = property.getStringList(); -// processBookOverrides(bookOverrides); - - // anvil smashing - // skip the helper method so the defaults are not put in the comment -// configFile.moveProperty("tweaks.anvilSmashing", "recipes.anvilSmashing", "smashing"); -// anvilSmashing = configFile.get("recipes.anvilSmashing", "smashing", anvilSmashing, -// "List of blocks to add to anvil smashing. Format is modid:input[:meta][->modid:output[:meta]]. If the output is excluded, it will default to air (breaking the block). If the meta is excluded, it will check all states for input and use the default for output").getStringList(); -// processAnvilSmashing(anvilSmashing); - - // cauldron uses -// configFile.moveProperty("recipes.cauldronRecipes", "recipes", "recipes.cauldron"); -// cauldronRecipes = configFile.get("recipes.cauldron", "recipes", cauldronRecipes, -// "List of recipes to add to the cauldron on right click. Format is (modid:input:meta|oreString)->modid:output:meta[->isBoiling]. If isBoiling is excluded, it defaults to false.").getStringList(); -// processCauldronRecipes(cauldronRecipes); - - } - - /** - * Updates a config file from a bunch of colons to the new -> format - * @param line Old line - * @param t True string - * @param f False string - * @return New line - */ - private static String updateConfig(String line, String t, String f) { - String[] parts = line.split(":"); - switch(parts.length) { - // 'modid:name' -> 'modid:name->1.5 - case 2: - return line + "->" + t; - // 'modid:name:meta' -> 'modid:name:meta->7 - case 3: - // if meta -1, remove as wildcard is just none now - if(parts[2].equals("-1")) { - return String.format("%s:%s->%s", parts[0], parts[1], t); - } - return line + "->" + t; - case 4: - // first, determine power - String power = "false".equals(parts[3]) ? f : t; - // if meta -1, remove as wildcard is just none now - if(parts[2].equals("-1")) { - return String.format("%s:%s->%s", parts[0], parts[1], power); - } - return String.format("%s:%s:%s->%s", parts[0], parts[1], parts[2], power); - } - return line; - } - - /** - * Parses the book overrides from the string array - * @param overrides Input string array - */ - private static void processBookOverrides(String[] overrides) { - if(!enableBookshelf.get()) { - return; - } - - String[] parts; - // simply look through each entry - for(String override : overrides) { - // skip blank lines - if("".equals(override) || override.startsWith("#")) { - continue; - } - - parts = override.split("->"); - if(parts.length > 2) { - Inspirations.log.error("Invalid book override {}: must be in format modid:name[:meta][->power]. ", override); - continue; - } - - // finally, parse the isBook boolean. Pretty lazy here, just check if its not the string false - float power = defaultEnchantingPower.get().floatValue(); - if (parts.length > 1) { - try { - power = Float.parseFloat(parts[1]); - } catch(NumberFormatException e) { - if (parts[1].equals("false")) { - power = -1; - } else { - Inspirations.log.error("Invalid book override {}: power must be a number. ", override); - continue; - } - } - } - // normalize not a book - if (power < 0) { - power = -1; - } - final float enchPower = power; - RecipeUtil.forStackInString(parts[0], stack -> InspirationsRegistry.registerBook(stack.getItem(), enchPower)); - } - } - - /** - * Parses the anvil smashing array into the registry - * @param transformations Input array - */ - private static void processAnvilSmashing(String[] transformations) { - if(!enableAnvilSmashing.get()) { - return; - } - - for(String transformation : transformations) { - // skip blank lines - if("".equals(transformation) || transformation.startsWith("#")) { - continue; - } - - // first, ensure we have the right number of inputs - // it should be 1 for plain old smashing or two for a transformation - String[] transformParts = transformation.split("->"); - if(transformParts.length > 2 || transformParts.length < 1) { - Inspirations.log.error("Invalid anvil smashing {}: must be in the format of modid:input[:meta][->modid:output[:meta]]", transformation); - continue; - } + // milk squids + /* + milkSquids = builder + .comment("Allows milking squids with a glass bottle to get black dyed water.") + .define("milkSquids.enable", true); + milkSquidCooldown = builder + .comment("Delay in seconds after milking a squid before it can be milked again.") + .defineInRange("milkSquids.cooldown", 300, 1, Short.MAX_VALUE); - // if the length is 1, this is block breaking, so use air for the output - BlockState output; - if(transformParts.length == 1) { - output = Blocks.AIR.getDefaultState(); - } else { - output = RecipeUtil.getBlockStateFromString(transformParts[1]); - if (output == null) { - Inspirations.log.info("Skipping anvil smashing {}: unable to find output {}", transformation, transformParts[1]); - continue; - } - } - - RecipeUtil.forBlockInString(transformParts[0], - state -> InspirationsRegistry.registerAnvilSmashing(state, output), - block -> InspirationsRegistry.registerAnvilSmashing(block, output)); - } - } - - /** - * Processes the simple cauldron recipes from the config - * @param cauldronRecipes List of recipe strings - */ - private static void processCauldronRecipes(String[] cauldronRecipes) { - if(!enableCauldronRecipes()) { - return; - } - - for(String recipe : cauldronRecipes) { - // skip blank lines - if("".equals(recipe) || recipe.startsWith("#")) { - continue; - } - - String[] parts = recipe.split("->"); - if(parts.length < 2 || parts.length > 3) { - Inspirations.log.error("Invalid cauldron recipe {}: must be in format input->output[->isBoiling]", recipe); - continue; - } - - // input - ItemStack input = null; - if(parts[0].contains(":")) { - input = RecipeUtil.getItemStackFromString(parts[0], true); - if(input.isEmpty()) { - continue; - } - } + */ - // output - ItemStack output = RecipeUtil.getItemStackFromString(parts[1], false); - if(output.isEmpty()) { - continue; - } + // portal color + customPortalColor = builder + .comment( "Allows the portal color to be changed by placing colored blocks under the portal. Any block that tints a beacon beam will work for the color.") + .define("customPortalColor", true); - // add recipe - Boolean boiling = parts.length > 2 ? parts[2].equals("true") : null; - // if the input is empty, we are using an oreString - if(input == null) { -// InspirationsRegistry.addCauldronRecipe(parts[0], output, boiling); - } else { -// InspirationsRegistry.addCauldronRecipe(input, output, boiling); - } + // drops + caveSpiderDrops = builder + .comment("If true, cave spiders will rarely drop webs, giving them an advantage to farm over regular spiders") + .define("caveSpiderWeb", true); + skeletonSkull = builder + .comment("If true, skeletons will rarely drop their skull for consistency with wither skeletons. Does not affect creeper or zombie heads.") + .define("skeletonSkull", true); } + builder.pop(); } } diff --git a/src/main/java/knightminer/inspirations/common/data/ConfigEnabledCondition.java b/src/main/java/knightminer/inspirations/common/data/ConfigEnabledCondition.java index 53e1556e..4de556f5 100644 --- a/src/main/java/knightminer/inspirations/common/data/ConfigEnabledCondition.java +++ b/src/main/java/knightminer/inspirations/common/data/ConfigEnabledCondition.java @@ -105,12 +105,11 @@ private static void add(String prop, ForgeConfigSpec.BooleanValue option) { add("rope", Config.enableRope); // utility - add("bricks_button", Config.enableBricksButton); + add("bricks_button", ()->false/*TODO: Config.enableBricksButton*/); add("carpeted_trapdoor", Config.enableCarpetedTrapdoor); add("collector", Config.enableCollector); add("pipe", Config.enablePipe); add("redstone_book", Config::enableRedstoneBook); - add("redstone_torch_lever", Config.enableRedstoneTorchLever); add("torch_lever", Config.enableTorchLever); // tools @@ -122,19 +121,19 @@ private static void add(String prop, ForgeConfigSpec.BooleanValue option) { add("lock", Config.enableLock); add("north_compass", Config.enableNorthCompass); add("photometer", Config.enablePhotometer); - add("redstone_charge", Config.enableRedstoneCharge); + add("redstone_charger", Config.enableRedstoneCharger); // tweaks - add("more_seeds", Config.enableMoreSeeds); + add("more_seeds", ()->false/* TODO: Config.enableMoreSeeds */); add("unstackable_alts", Config.unstackableRecipeAlts); add("skeleton_skull", Config.skeletonSkull); add("cave_spider_web", Config.caveSpiderDrops); // recipes - add("cauldron_dyeing", Config::enableCauldronDyeing); - add("cauldron_fluids", Config::enableCauldronFluids); - add("cauldron_potions", Config::enableCauldronPotions); - add("extra_dyed_bottle_recipes", Config::extraBottleRecipes); - add("patch_vanilla_dye_recipes", Config::patchVanillaDyeRecipes); + add("cauldron_dyeing", ()->false/* TODO: Config::enableCauldronDyeing */); + add("cauldron_fluids", ()->false/* TODO: Config::enableCauldronFluids */); + add("cauldron_potions", ()->false/* TODO: Config::enableCauldronPotions */); + add("extra_dyed_bottle_recipes", ()->false/* TODO: Config::extraBottleRecipes */); + add("patch_vanilla_dye_recipes", ()->false/* TODO: Config::patchVanillaDyeRecipes */); } } diff --git a/src/main/java/knightminer/inspirations/recipes/RecipesEvents.java b/src/main/java/knightminer/inspirations/recipes/RecipesEvents.java index 3c3c9a50..9f88331a 100644 --- a/src/main/java/knightminer/inspirations/recipes/RecipesEvents.java +++ b/src/main/java/knightminer/inspirations/recipes/RecipesEvents.java @@ -1,28 +1,17 @@ package knightminer.inspirations.recipes; import knightminer.inspirations.common.Config; -import knightminer.inspirations.common.network.InspirationsNetwork; -import knightminer.inspirations.common.network.MilkablePacket; import knightminer.inspirations.library.InspirationsRegistry; import knightminer.inspirations.recipes.tileentity.CauldronTileEntity; -import knightminer.inspirations.shared.SharedEvents; import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.SquidEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResultType; -import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract; import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.items.ItemHandlerHelper; public class RecipesEvents { @@ -60,6 +49,7 @@ public static void clickCauldron(RightClickBlock event) { } } + /* TODO: bottle does not exist @SubscribeEvent public static void milkSquid(EntityInteract event) { if(!Config.milkSquids.get()) { @@ -99,4 +89,5 @@ public static void milkSquid(EntityInteract event) { } } } + */ } diff --git a/src/main/java/knightminer/inspirations/shared/SharedEvents.java b/src/main/java/knightminer/inspirations/shared/SharedEvents.java index ceebf56c..4c3a4ba2 100644 --- a/src/main/java/knightminer/inspirations/shared/SharedEvents.java +++ b/src/main/java/knightminer/inspirations/shared/SharedEvents.java @@ -5,7 +5,6 @@ import knightminer.inspirations.common.network.MilkablePacket; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.CowEntity; -import net.minecraft.entity.passive.SquidEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; @@ -23,7 +22,7 @@ public static void updateMilkCooldown(LivingUpdateEvent event) { // runs for both adult cows and squids, based on config if ((Config.milkCooldown.get() && entity instanceof CowEntity && !entity.isChild()) - || (Config.milkSquids.get() && entity instanceof SquidEntity)) { + /*|| (Config.milkSquids.get() && entity instanceof SquidEntity)*/) { // if not already cooled down, cool down CompoundNBT tags = entity.getPersistentData(); diff --git a/src/main/java/knightminer/inspirations/tools/item/RedstoneArrowItem.java b/src/main/java/knightminer/inspirations/tools/item/RedstoneArrowItem.java index ca8b054d..63dafdfe 100644 --- a/src/main/java/knightminer/inspirations/tools/item/RedstoneArrowItem.java +++ b/src/main/java/knightminer/inspirations/tools/item/RedstoneArrowItem.java @@ -1,10 +1,7 @@ package knightminer.inspirations.tools.item; -import javax.annotation.Nonnull; - import knightminer.inspirations.common.Config; import knightminer.inspirations.common.IHidable; -import knightminer.inspirations.tools.InspirationsTools; import knightminer.inspirations.tools.entity.RedstoneArrow; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -15,6 +12,8 @@ import net.minecraft.util.NonNullList; import net.minecraft.world.World; +import javax.annotation.Nonnull; + public class RedstoneArrowItem extends ArrowItem implements IHidable { public RedstoneArrowItem(Properties builder) { @@ -34,7 +33,7 @@ public boolean isInfinite(ItemStack stack, ItemStack bow, PlayerEntity player) { @Override public boolean isEnabled() { - return Config.enableRedstoneCharge.get(); + return Config.enableRedstoneCharger.get(); } @Override diff --git a/src/main/java/knightminer/inspirations/tweaks/InspirationsTweaks.java b/src/main/java/knightminer/inspirations/tweaks/InspirationsTweaks.java index ccf38619..f7939e62 100644 --- a/src/main/java/knightminer/inspirations/tweaks/InspirationsTweaks.java +++ b/src/main/java/knightminer/inspirations/tweaks/InspirationsTweaks.java @@ -2,13 +2,9 @@ import knightminer.inspirations.common.Config; import knightminer.inspirations.common.PulseBase; -import knightminer.inspirations.common.item.HidableBlockItem; import knightminer.inspirations.common.item.HidableItem; -import knightminer.inspirations.tweaks.block.BlockSugarCaneCrop; -import knightminer.inspirations.tweaks.block.CactusCropBlock; import knightminer.inspirations.tweaks.block.FittedCarpetBlock; import knightminer.inspirations.tweaks.block.FlatCarpetBlock; -import knightminer.inspirations.tweaks.item.SeedItem; import knightminer.inspirations.tweaks.recipe.NormalBrewingRecipe; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -32,7 +28,6 @@ import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.PlantType; import net.minecraftforge.common.brewing.BrewingRecipeRegistry; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent.Register; @@ -59,7 +54,7 @@ public class InspirationsTweaks extends PulseBase { public static Item carrotSeeds; public static Item sugarCaneSeeds; public static Item cactusSeeds; - public static Item silverfishPowder; + //public static Item silverfishPowder; public static Item heartbeet; @@ -85,8 +80,8 @@ public void registerBlocks(Register event) { registerCarpet(r, DyeColor.BLACK, Blocks.BLACK_CARPET); - cactusCrop = register(r, new CactusCropBlock(), "cactus_crop"); - sugarCaneCrop = register(r, new BlockSugarCaneCrop(), "sugar_cane_crop"); + //cactusCrop = register(r, new CactusCropBlock(), "cactus_crop"); + //sugarCaneCrop = register(r, new BlockSugarCaneCrop(), "sugar_cane_crop"); } private void registerCarpet(IForgeRegistry r, DyeColor color, Block origCarpet) { @@ -109,6 +104,7 @@ public void registerItem(Register event) { Item.BLOCK_TO_ITEM.put(fitCarpets[carpet.getColor().getId()], item); } + /* cactusSeeds = registerItem(r, new HidableBlockItem( InspirationsTweaks.cactusCrop, new Item.Properties().group(ItemGroup.FOOD) @@ -121,16 +117,17 @@ public void registerItem(Register event) { carrotSeeds = registerItem(r, new SeedItem((CropsBlock) Blocks.CARROTS, PlantType.Crop), "carrot_seeds"); potatoSeeds = registerItem(r, new SeedItem((CropsBlock) Blocks.POTATOES, PlantType.Crop), "potato_seeds"); + */ heartbeet = registerItem(r, new HidableItem( new Item.Properties().group(ItemGroup.FOOD).food( new Food.Builder().hunger(2).saturation(2.4f).effect(new EffectInstance(Effects.REGENERATION, 100), 1).build()), Config.enableHeartbeet::get ), "heartbeet"); - silverfishPowder = registerItem(r, new HidableItem( - new Item.Properties().group(ItemGroup.BREWING), - () -> false // TODO: Make this have a purpose... - ), "silverfish_powder"); +// silverfishPowder = registerItem(r, new HidableItem( +// new Item.Properties().group(ItemGroup.BREWING), +// () -> false // TODO: Make this have a purpose... +// ), "silverfish_powder"); } @SubscribeEvent diff --git a/src/main/java/knightminer/inspirations/tweaks/TweaksEvents.java b/src/main/java/knightminer/inspirations/tweaks/TweaksEvents.java index 9b37111f..476ece00 100644 --- a/src/main/java/knightminer/inspirations/tweaks/TweaksEvents.java +++ b/src/main/java/knightminer/inspirations/tweaks/TweaksEvents.java @@ -232,6 +232,7 @@ public static void dropHeartbeet(HarvestDropsEvent event) { } } + /* TODO: reconsider feature @SubscribeEvent public static void dropCarrotsPotatos(HarvestDropsEvent event) { if(!Config.nerfCarrotPotatoDrops()) { @@ -249,6 +250,7 @@ public static void dropCarrotsPotatos(HarvestDropsEvent event) { event.getDrops().clear(); event.getDrops().add(new ItemStack(block == Blocks.CARROTS ? InspirationsTweaks.carrotSeeds : InspirationsTweaks.potatoSeeds)); } + */ @SubscribeEvent(priority = EventPriority.LOW) public static void onFall(LivingFallEvent event) { diff --git a/src/main/java/knightminer/inspirations/utility/InspirationsUtility.java b/src/main/java/knightminer/inspirations/utility/InspirationsUtility.java index d7b315dc..64d68b0c 100644 --- a/src/main/java/knightminer/inspirations/utility/InspirationsUtility.java +++ b/src/main/java/knightminer/inspirations/utility/InspirationsUtility.java @@ -2,7 +2,6 @@ import knightminer.inspirations.common.PulseBase; -import knightminer.inspirations.utility.block.BricksButtonBlock; import knightminer.inspirations.utility.block.CarpetedPressurePlateBlock; import knightminer.inspirations.utility.block.CarpetedTrapdoorBlock; import knightminer.inspirations.utility.block.CollectorBlock; @@ -42,8 +41,8 @@ public class InspirationsUtility extends PulseBase { // blocks public static Block torchLeverWall; public static Block torchLeverFloor; - public static Block bricksButton; - public static Block netherBricksButton; + //public static Block bricksButton; + //public static Block netherBricksButton; public static Block[] carpetedTrapdoors = new Block[16]; public static Block[] carpetedPressurePlates = new Block[16]; public static Block collector; @@ -65,8 +64,8 @@ public void registerBlocks(Register event) { torchLeverFloor = registerBlock(r, new TorchLevelBlock(), "torch_lever"); torchLeverWall = registerBlock(r, new TorchLeverWallBlock(), "wall_torch_lever"); - bricksButton = registerBlock(r, new BricksButtonBlock(BricksButtonBlock.BRICK_BUTTON), "bricks_button"); - netherBricksButton = registerBlock(r, new BricksButtonBlock(BricksButtonBlock.NETHER_BUTTON), "nether_bricks_button"); + //bricksButton = registerBlock(r, new BricksButtonBlock(BricksButtonBlock.BRICK_BUTTON), "bricks_button"); + //netherBricksButton = registerBlock(r, new BricksButtonBlock(BricksButtonBlock.NETHER_BUTTON), "nether_bricks_button"); for(DyeColor color : DyeColor.values()) { carpetedTrapdoors[color.getId()] = registerBlock(r, new CarpetedTrapdoorBlock(color), color.getName() + "_carpeted_trapdoor"); @@ -103,8 +102,8 @@ public void registerItems(Register event) { // itemblocks register(r, new TorchLeverItem(), "torch_lever"); - registerBlockItem(r, bricksButton, ItemGroup.REDSTONE); - registerBlockItem(r, netherBricksButton, ItemGroup.REDSTONE); + //registerBlockItem(r, bricksButton, ItemGroup.REDSTONE); + //registerBlockItem(r, netherBricksButton, ItemGroup.REDSTONE); for(Block trapdoor : carpetedTrapdoors) { registerBlockItem(r, trapdoor, ItemGroup.REDSTONE); } diff --git a/src/main/resources/data/inspirations/recipes/tools/redstone_charger.json b/src/main/resources/data/inspirations/recipes/tools/redstone_charger.json index 32c1e98f..826278de 100644 --- a/src/main/resources/data/inspirations/recipes/tools/redstone_charger.json +++ b/src/main/resources/data/inspirations/recipes/tools/redstone_charger.json @@ -6,7 +6,7 @@ }, { "type": "inspirations:config", - "prop": "redstone_charge" + "prop": "redstone_charger" } ], "type": "minecraft:crafting_shapeless",