diff --git a/1.12/gradle.properties b/1.12/gradle.properties index 0c49c36..43126e0 100644 --- a/1.12/gradle.properties +++ b/1.12/gradle.properties @@ -4,4 +4,4 @@ org.gradle.jvmargs=-Xmx8G version_minecraft=1.12.2 version_forge=14.23.5.2768 version_jei=4.10.0.198 -version_engineersdecor=1.0.8-b1 +version_engineersdecor=1.0.8-b2 diff --git a/1.12/meta/update.json b/1.12/meta/update.json index c320396..7d4a67f 100644 --- a/1.12/meta/update.json +++ b/1.12/meta/update.json @@ -1,6 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "1.12.2": { + "1.0.8-b2": "[F] Config opt-out fixed (thx IronPiston for the report #30).\n[A] Added opt-out config for detailed including/excluding of features (using registry name wildcard matching).", "1.0.8-b1": "[A] Added \"Factory area\" sign.\n[M] Electrical furnace recipe changed (hoppers to conveyors).\n[A] Opt-out config options added.\n[F] Lang file fixes for en_us (Angela, PR#29).", "1.0.7": "[R] Release based on v1.0.7-b2. Release-to-release changes: * Factory dropper added. * Defense system warning sign added. * Warning sign backgrounds adapted. * Standalone recipes added. * Lang files updated.\n[A] Added standalone recipes for signs, factory dropper, and electrical furnace.\n[M] Adapted \"Caution\" sign backgrounds to the yellow defense system warning background.", "1.0.7-b2": "[A] Added Defense System Warning sign (design by J. Carver).\n[M] Factory dropper non-experimental now. GUI click area tuning. \"Fast drop\" symbol replaced from arrow to dog icon (thx overchoice for that icon).\n[M] Lang files updated.", @@ -42,6 +43,6 @@ }, "promos": { "1.12.2-recommended": "1.0.7", - "1.12.2-latest": "1.0.8-b1" + "1.12.2-latest": "1.0.8-b2" } } \ No newline at end of file diff --git a/1.12/readme.md b/1.12/readme.md index 6048e63..c8ed268 100644 --- a/1.12/readme.md +++ b/1.12/readme.md @@ -10,6 +10,10 @@ Mod sources for Minecraft version 1.12.2. ---- ## Revision history + - v1.0.8-b2 [F] Config opt-out fixed (thx IronPiston for the report #30). + [A] Added opt-out config for detailed including/excluding + of features (using registry name wildcard matching). + - v1.0.8-b1 [A] Added "Factory area" sign. [M] Electrical furnace recipe changed (hoppers to conveyors). [A] Opt-out config options added. diff --git a/1.12/src/main/java/wile/engineersdecor/ModEngineersDecor.java b/1.12/src/main/java/wile/engineersdecor/ModEngineersDecor.java index 141bd39..87a9e35 100644 --- a/1.12/src/main/java/wile/engineersdecor/ModEngineersDecor.java +++ b/1.12/src/main/java/wile/engineersdecor/ModEngineersDecor.java @@ -97,6 +97,7 @@ public class ModEngineersDecor proxy.preInit(event); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); Networking.init(); + ModConfig.onPreInit(); } @Mod.EventHandler diff --git a/1.12/src/main/java/wile/engineersdecor/blocks/ModBlocks.java b/1.12/src/main/java/wile/engineersdecor/blocks/ModBlocks.java index d9a4d01..bf05ea3 100644 --- a/1.12/src/main/java/wile/engineersdecor/blocks/ModBlocks.java +++ b/1.12/src/main/java/wile/engineersdecor/blocks/ModBlocks.java @@ -435,7 +435,8 @@ public class ModBlocks ++num_block_registrations_skipped_noie; continue; } - if((woor) && (ModConfig.isOptedOut((Block)e)) && (e!=SIGN_MODLOGO)) { + if((woor) && (e != SIGN_MODLOGO) && (ModConfig.isOptedOut((Block)e))) { + ModEngineersDecor.logger.info("Registration opt-out: " + ((Block) e).getRegistryName().getPath()); ++num_block_registrations_skipped; continue; } diff --git a/1.12/src/main/java/wile/engineersdecor/detail/ModConfig.java b/1.12/src/main/java/wile/engineersdecor/detail/ModConfig.java index 1cf5e69..9b2c77d 100644 --- a/1.12/src/main/java/wile/engineersdecor/detail/ModConfig.java +++ b/1.12/src/main/java/wile/engineersdecor/detail/ModConfig.java @@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import javax.annotation.Nullable; +import java.util.ArrayList; @Config(modid = ModEngineersDecor.MODID) @Config.LangKey("engineersdecor.config.title") @@ -30,6 +31,26 @@ public class ModConfig public static final SettingsOptouts optout = new SettingsOptouts(); public static final class SettingsOptouts { + @Config.Comment({"Opt-out any block by its registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. You must match the whole name, " + + "means maybe add '*' also at the begin and end. Example: '*wood*,*steel*' " + + "excludes everything that has 'wood' or 'steel' in the registry name. " + + "The matching result is also traced in the log file. " + }) + @Config.Name("Pattern excludes") + @Config.RequiresMcRestart + public String excludes = ""; + + @Config.Comment({"Prevent blocks from being opt'ed by registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. Evaluated before all other opt-out checks. " + + "You must match the whole name, means maybe add '*' also at the begin and end. Example: " + + "'*wood*,*steel*' includes everything that has 'wood' or 'steel' in the registry name." + + "The matching result is also traced in the log file." + }) + @Config.Name("Pattern includes") + @Config.RequiresMcRestart + public String includes = ""; + @Config.Comment({"Disable clinker bricks and derived blocks."}) @Config.Name("Without clinker bricks") @Config.RequiresMcRestart @@ -80,7 +101,7 @@ public class ModConfig @Config.RequiresMcRestart public boolean without_electrical_furnace = false; - @Config.Comment({"Disable treated wood table, stool, windowsill, pole, etc."}) + @Config.Comment({"Disable treated wood table, stool, windowsill, etc."}) @Config.Name("Without tr. wood furniture") @Config.RequiresMcRestart public boolean without_treated_wood_furniture = false; @@ -145,6 +166,16 @@ public class ModConfig @Config.Name("Without slab slices") @Config.RequiresMcRestart public boolean without_halfslabs = false; + + @Config.Comment({"Disable poles of any material."}) + @Config.Name("Without poles") + @Config.RequiresMcRestart + public boolean without_poles = false; + + @Config.Comment({"Disable horizontal supports like the double-T support."}) + @Config.Name("Without h. supports") + @Config.RequiresMcRestart + public boolean without_hsupports = false; } @Config.Comment({ @@ -290,9 +321,16 @@ public class ModConfig } @SuppressWarnings("unused") - public static final void onPostInit(FMLPostInitializationEvent event) + public static final void onPreInit() { apply(); } + @SuppressWarnings("unused") + public static final void onPostInit(FMLPostInitializationEvent event) + { for(Block e:ModBlocks.getRegisteredBlocks()) ModConfig.isOptedOut(e, true); } + + private static final ArrayList includes_ = new ArrayList(); + private static final ArrayList excludes_ = new ArrayList(); + public static final boolean isWithoutOptOutRegistration() { return (zmisc!=null) && (zmisc.without_optout_registration); } @@ -300,37 +338,62 @@ public class ModConfig { return (zmisc==null) || (zmisc.without_recipes); } public static final boolean isOptedOut(final @Nullable Block block) + { return isOptedOut(block, false); } + + public static final boolean isOptedOut(final @Nullable Block block, boolean with_log_details) { if((block == null) || (optout==null)) return true; if(block == ModBlocks.SIGN_MODLOGO) return true; if((!zmisc.with_experimental) && (block instanceof ModAuxiliaries.IExperimentalFeature)) return true; final String rn = block.getRegistryName().getPath(); - if(optout.without_clinker_bricks && rn.startsWith("clinker_brick_")) return true; + // Force-include/exclude pattern matching + try { + for(String e:includes_) { + if(rn.matches(e)) { + if(with_log_details) ModEngineersDecor.logger.info("Optout force include: " + rn); + return false; + } + } + for(String e:excludes_) { + if(rn.matches(e)) { + if(with_log_details) ModEngineersDecor.logger.info("Optout force exclude: " + rn); + return true; + } + } + } catch(Throwable ex) { + ModEngineersDecor.logger.error("optout include pattern failed, disabling."); + includes_.clear(); + excludes_.clear(); + } + // Early non-opt out type based evaluation + if(block instanceof BlockDecorCraftingTable) return optout.without_crafting_table; + if(block instanceof BlockDecorFurnaceElectrical) return optout.without_electrical_furnace; + if((block instanceof BlockDecorFurnace) && (!(block instanceof BlockDecorFurnaceElectrical))) return optout.without_lab_furnace; + if(block instanceof BlockDecorPassiveFluidAccumulator) return optout.without_passive_fluid_accumulator; + if(block instanceof BlockDecorWasteIncinerator) return optout.without_waste_incinerator; + if(block instanceof BlockDecorDropper) return optout.without_factory_dropper; + if(block instanceof BlockDecorHalfSlab) return optout.without_halfslabs; + if(block instanceof BlockDecorLadder) return optout.without_ladders; + if(block instanceof BlockDecorWindow) return optout.without_windows; + if(block instanceof BlockDecorPipeValve) return optout.without_valves; + if(block instanceof BlockDecorHorizontalSupport) return optout.without_hsupports; + // Type based evaluation where later filters may match, too + if(optout.without_stairs && (block instanceof BlockDecorStairs)) return true; + if(optout.without_walls && (block instanceof BlockDecorWall)) return true; + if(optout.without_poles && (block instanceof BlockDecorStraightPole)) return true; + // String matching based evaluation + if(optout.without_clinker_bricks && (rn.startsWith("clinker_brick_")) || (rn.startsWith("clinker_brick_stained_"))) return true; if(optout.without_slag_bricks && rn.startsWith("slag_brick_")) return true; if(optout.without_rebar_concrete && rn.startsWith("rebar_concrete")) return true; if(optout.without_ie_concrete_wall && rn.startsWith("concrete_wall")) return true; if(optout.without_panzer_glass && rn.startsWith("panzerglass_")) return true; - if(optout.without_crafting_table && (block instanceof BlockDecorCraftingTable)) return true; - if(optout.without_lab_furnace && ((block instanceof BlockDecorFurnace)) && (!(block instanceof BlockDecorFurnaceElectrical))) return true; - if(optout.without_electrical_furnace && (block instanceof BlockDecorFurnaceElectrical)) return true; - if(optout.without_passive_fluid_accumulator && (block instanceof BlockDecorPassiveFluidAccumulator)) return true; - if(optout.without_waste_incinerator && (block instanceof BlockDecorWasteIncinerator)) return true; - if(optout.without_factory_dropper && (block instanceof BlockDecorDropper)) return true; - if(optout.without_halfslabs && (block instanceof BlockDecorHalfSlab)) return true; - if(optout.without_windows && rn.endsWith("_window")) return true; if(optout.without_light_sources && rn.endsWith("_light")) return true; - if(optout.without_ladders && (block instanceof BlockDecorLadder)) return true; if(optout.without_sign_plates && rn.startsWith("sign_")) return true; - if(optout.without_walls && rn.endsWith("_wall")) return true; - if(optout.without_stairs && rn.endsWith("_stairs")) return true; - if(optout.without_valves && rn.contains("_pipe_valve")) return true; if(optout.without_treated_wood_furniture) { if(block instanceof BlockDecorChair) return true; - if(rn.equals("treated_wood_pole")) return true; if(rn.equals("treated_wood_table")) return true; if(rn.equals("treated_wood_stool")) return true; if(rn.equals("treated_wood_windowsill")) return true; - if(rn.equals("treated_wood_window")) return true; } return false; } @@ -351,6 +414,26 @@ public class ModConfig BlockDecorCraftingTable.on_config(optout.without_crafting_table_history, false, tweaks.with_crafting_quickmove_buttons); BlockDecorPipeValve.on_config(tweaks.pipevalve_max_flowrate, tweaks.pipevalve_redstone_slope); BlockDecorFurnaceElectrical.BTileEntity.on_config(tweaks.e_furnace_speed_percent, tweaks.e_furnace_power_consumption); + { + optout.includes = optout.includes.toLowerCase().replaceAll(ModEngineersDecor.MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + if(!optout.includes.isEmpty()) ModEngineersDecor.logger.info("Pattern includes: '" + optout.includes + "'"); + String[] incl = optout.includes.split(","); + includes_.clear(); + for(int i=0; i< incl.length; ++i) { + incl[i] = incl[i].replaceAll("[*]", ".*?"); + if(!incl[i].isEmpty()) includes_.add(incl[i]); + } + } + { + optout.excludes = optout.excludes.toLowerCase().replaceAll(ModEngineersDecor.MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + if(!optout.excludes.isEmpty()) ModEngineersDecor.logger.info("Pattern excludes: '" + optout.excludes + "'"); + String[] excl = optout.excludes.split(","); + excludes_.clear(); + for(int i=0; i< excl.length; ++i) { + excl[i] = excl[i].replaceAll("[*]", ".*?"); + if(!excl[i].isEmpty()) excludes_.add(excl[i]); + } + } } } diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture0.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture0.png index 9edb948..25fac1a 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture0.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture0.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture1.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture1.png index 0b868fd..6d7324f 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture1.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture1.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture2.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture2.png index 47d34ec..82ca51b 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture2.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture2.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture3.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture3.png index 89dfa23..1f17330 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture3.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture3.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture4.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture4.png index e1804d4..8c59908 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture4.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture4.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture5.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture5.png index da1056c..68f5af5 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture5.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture5.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture6.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture6.png index 7833843..d1f059c 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture6.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture6.png differ diff --git a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture7.png b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture7.png index f9196e7..8b6ab7e 100644 Binary files a/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture7.png and b/1.12/src/main/resources/assets/engineersdecor/textures/blocks/clinker_brick/clinker_brick_stained_texture7.png differ diff --git a/meta/update.json b/meta/update.json index a15e809..ba9c9fc 100644 --- a/meta/update.json +++ b/meta/update.json @@ -1,6 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "1.12.2": { + "1.0.8-b2": "[F] Config opt-out fixed (thx IronPiston for the report #30).\n[A] Added opt-out config for detailed including/excluding of features (using registry name wildcard matching).", "1.0.8-b1": "[A] Added \"Factory area\" sign.\n[M] Electrical furnace recipe changed (hoppers to conveyors).\n[A] Opt-out config options added.\n[F] Lang file fixes for en_us (Angela, PR#29).", "1.0.7": "[R] Release based on v1.0.7-b2. Release-to-release changes: * Factory dropper added. * Defense system warning sign added. * Warning sign backgrounds adapted. * Standalone recipes added. * Lang files updated.\n[A] Added standalone recipes for signs, factory dropper, and electrical furnace.\n[M] Adapted \"Caution\" sign backgrounds to the yellow defense system warning background.", "1.0.7-b2": "[A] Added Defense System Warning sign (design by J. Carver).\n[M] Factory dropper non-experimental now. GUI click area tuning. \"Fast drop\" symbol replaced from arrow to dog icon (thx overchoice for that icon).\n[M] Lang files updated.", @@ -55,7 +56,7 @@ }, "promos": { "1.12.2-recommended": "1.0.7", - "1.12.2-latest": "1.0.8-b1", + "1.12.2-latest": "1.0.8-b2", "1.13.2-recommended": "", "1.13.2-latest": "1.0.7-b3" }