Merge pull request #3 from Ugachaga/patch-2

Added Blacklist config for Focus of Dislocation
This commit is contained in:
Martin Robertz authored and KryptonCaptain committed 2017-04-08 21:21:47 +10:00
1 parent 973299fab8
commit 906b93e16e
2 files changed
+16 -3

No files matched your search

@@ -45,6 +45,7 @@ public final class ConfigHandler {
public static int endDimensionID = 1;
public static int bedrockDimensionID = 19;
public static String[] forbiddenDimensions;
public static String[] blockBlacklist;
public static boolean enableCake = true;
public static boolean enableFire = true;
@@ -76,6 +77,10 @@ public final class ConfigHandler {
forbiddenDimensions = config.getStringList("Forbidden Dimensions", Configuration.CATEGORY_GENERAL, new String[]{""}, "Disallow Bottomless Pouch inventory for certain dimension ID's");
Property propBlockBlacklist = config.get(Configuration.CATEGORY_GENERAL, "Focus of Dislocation Blacklist", new String[]{"avaritiaddons:CompressedChest", "avaritiaddons:InfinityChest"});
propBlockBlacklist.comment = "These blocks will be disallowed for Focus of Dislocation";
blockBlacklist = propBlockBlacklist.getStringList();
Property propEnableKami = config.get(Configuration.CATEGORY_GENERAL, "kami.forceenabled", true);
propEnableKami.comment = "Set to true to enable all kami stuff (note, either this OR the kami mod file will work)";
enableKami = Loader.isModLoaded("ThaumicTinkererKami") || propEnableKami.getBoolean(true);
@@ -38,6 +38,7 @@ import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumic.tinkerer.client.core.helper.IconHelper;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.core.helper.ItemNBTHelper;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.lib.LibResearch;
@@ -74,6 +75,15 @@ public class ItemFocusDislocation extends ItemModFocus {
ornament = IconHelper.forItem(par1IconRegister, this, "Orn");
}
private static boolean isBlockAllowed (Block block) {
String currentBlock = Block.blockRegistry.getNameForObject(block);
for (String blacklistedBlock : ConfigHandler.blockBlacklist) {
if (currentBlock.equals(blacklistedBlock))
return false;
}
return true;
}
@Override
public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) {
if (mop == null)
@@ -123,7 +133,7 @@ public class ItemFocusDislocation extends ItemModFocus {
}
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
}
} else if (!blacklist.contains(block) && !ThaumcraftApi.portableHoleBlackList.contains(block) && block != null && block.getBlockHardness(world, mop.blockX, mop.blockY, mop.blockZ) != -1F && wand.consumeAllVis(itemstack, player, getCost(tile), true, false)) {
} else if (!blacklist.contains(block) && isBlockAllowed(block) && !ThaumcraftApi.portableHoleBlackList.contains(block) && block != null && block.getBlockHardness(world, mop.blockX, mop.blockY, mop.blockZ) != -1F && wand.consumeAllVis(itemstack, player, getCost(tile), true, false)) {
if (!world.isRemote) {
world.removeTileEntity(mop.blockX, mop.blockY, mop.blockZ);
world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.air, 0, 1 | 2);
@@ -246,11 +256,9 @@ public class ItemFocusDislocation extends ItemModFocus {
return visUsage;
}
static {
blacklist.add(Blocks.piston_extension);
blacklist.add(Blocks.piston_head);
}
@Override