From 75b97cf4f9155a92eaf7cb623d1ec36f3906cfd0 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Tue, 27 Oct 2015 18:45:54 +0100 Subject: [PATCH] Extract the boss-heart-drop blacklist into the config. Closes #1787 --- src/main/java/tconstruct/armor/TinkerArmorEvents.java | 8 ++++++-- src/main/java/tconstruct/util/config/PHConstruct.java | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/armor/TinkerArmorEvents.java b/src/main/java/tconstruct/armor/TinkerArmorEvents.java index 8ba122b19cc..cdf50d0ced1 100644 --- a/src/main/java/tconstruct/armor/TinkerArmorEvents.java +++ b/src/main/java/tconstruct/armor/TinkerArmorEvents.java @@ -17,9 +17,12 @@ import tconstruct.armor.player.ArmorExtended; import tconstruct.armor.player.TPlayerStats; import tconstruct.library.modifier.IModifyable; +import tconstruct.util.config.PHConstruct; import tconstruct.util.network.ArmourGuiSyncPacket; import tconstruct.world.entity.BlueSlime; +import java.util.Locale; + public class TinkerArmorEvents { @@ -43,8 +46,9 @@ public void onLivingDrop (LivingDropsEvent event) if (event.entityLiving instanceof IBossDisplayData) { String entityName = event.entityLiving.getClass().getSimpleName().toLowerCase(); - if (entityName.contains("entitynpc") || entityName.contains("entitycustomnpc")) - return; + for(String name : PHConstruct.heartDropBlacklist) + if (name.toLowerCase(Locale.US).equals(entityName)) + return; int count = event.entityLiving instanceof EntityDragon ? 5 : 1; for (int i = 0; i < count; i++) diff --git a/src/main/java/tconstruct/util/config/PHConstruct.java b/src/main/java/tconstruct/util/config/PHConstruct.java index e6dfd59b578..7b2a2f1b11c 100644 --- a/src/main/java/tconstruct/util/config/PHConstruct.java +++ b/src/main/java/tconstruct/util/config/PHConstruct.java @@ -210,6 +210,7 @@ public static void initProps (File location) meltableVillagers = config.get("Experimental", "Allow villagers to be melted down for emeralds", true).getBoolean(true); minimalTextures = config.get("Experimental", "Minimal Textures", false).getBoolean(false); extraBlockUpdates = config.get("Experimental", "Send additional block updates when using AOE tools", true,"This fixes very fast tools sometimes resulting in ghost blocks, but causes a bit more network traffic. Should be fine in theory.").getBoolean(true); + heartDropBlacklist = config.get("Experimental", "YellowHeartDropBlacklist", new String[] {"entitynpc", "entitycustomnpc"}, "Entity classes listed here will not drop yellow hearts. The values are the actual class names in lowercase.").getStringList(); /* Save the configuration file only if it has changed */ if (config.hasChanged()) @@ -390,5 +391,5 @@ public static void initProps (File location) public static boolean meltableVillagers; public static boolean minimalTextures; public static boolean extraBlockUpdates; - + public static String[] heartDropBlacklist; }