add option to use facade blacklist as whitelist, happens to close #1914

This commit is contained in:
Adrian Siekierka 2014-11-11 09:59:04 +01:00
parent 051036848a
commit 983931e627
2 changed files with 14 additions and 8 deletions

View file

@ -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");

View file

@ -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) {