Skip to content

Commit

Permalink
Extract the boss-heart-drop blacklist into the config.
Browse files Browse the repository at this point in the history
Closes #1787
  • Loading branch information
bonii-xx committed Oct 27, 2015
1 parent f5f60ec commit 75b97cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/main/java/tconstruct/armor/TinkerArmorEvents.java
Expand Up @@ -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
{

Expand All @@ -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++)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/util/config/PHConstruct.java
Expand Up @@ -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())
Expand Down Expand Up @@ -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;
}

0 comments on commit 75b97cf

Please sign in to comment.