From 983931e6270375812930f2737e8f70131b5c4a71 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Tue, 11 Nov 2014 09:59:04 +0100 Subject: [PATCH] add option to use facade blacklist as whitelist, happens to close #1914 --- common/buildcraft/BuildCraftTransport.java | 6 +++++- common/buildcraft/transport/ItemFacade.java | 16 +++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index 49c78692..2eedffd0 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -150,7 +150,8 @@ public class BuildCraftTransport extends BuildCraftMod { public static BuildCraftTransport instance; public static float pipeDurability; - public static int pipeFluidsBaseFlowRate; + public static int pipeFluidsBaseFlowRate; + public static boolean facadeTreatBlacklistAsWhitelist; public static BlockGenericPipe genericPipeBlock; public static BlockFilteredBuffer filteredBufferBlock; @@ -352,6 +353,9 @@ public class BuildCraftTransport extends BuildCraftMod { facadeBlacklistProp.comment = "Blocks listed here will not have facades created. The format is modid:blockname.\nFor mods with a | character, the value needs to be surrounded with quotes."; facadeBlacklist = facadeBlacklistProp.getStringList(); + Property facadeAsWhitelist = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "facade.treatBlacklistAsWhitelist", false); + facadeTreatBlacklistAsWhitelist = facadeAsWhitelist.getBoolean(); + pipeWaterproof = new ItemBuildCraft(); pipeWaterproof.setUnlocalizedName("pipeWaterproof"); diff --git a/common/buildcraft/transport/ItemFacade.java b/common/buildcraft/transport/ItemFacade.java index b1927c9c..d939a0e1 100644 --- a/common/buildcraft/transport/ItemFacade.java +++ b/common/buildcraft/transport/ItemFacade.java @@ -288,19 +288,21 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem { return true; } - for (String blacklistedBlock : BuildCraftTransport.facadeBlacklist) { - if (blockName.equals(JavaTools.stripSurroundingQuotes(blacklistedBlock))) { - return true; - } - } - + // Blocks blacklisted by mods should always be treated as blacklisted for (String blacklistedBlock : blacklistedFacades) { if (blockName.equals(blacklistedBlock)) { return true; } } - return false; + // Blocks blacklisted by config should depend on the config settings + for (String blacklistedBlock : BuildCraftTransport.facadeBlacklist) { + if (blockName.equals(JavaTools.stripSurroundingQuotes(blacklistedBlock))) { + return true ^ BuildCraftTransport.facadeTreatBlacklistAsWhitelist; + } + } + + return false ^ BuildCraftTransport.facadeTreatBlacklistAsWhitelist; } private static boolean isBlockValidForFacade(Block block) {