From 58fbe6c71b8d33174b685fad71fe362fcf8b75ff Mon Sep 17 00:00:00 2001 From: CrazyPants Date: Sat, 30 Aug 2014 14:29:48 +0800 Subject: [PATCH] Added config option to disable capture of bosses in soul vessel. --- src/main/java/crazypants/enderio/config/Config.java | 7 ++++++- src/main/java/crazypants/enderio/item/ItemSoulVessel.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index a712706e..ed0b8181 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -255,6 +255,7 @@ public final class Config { public static String isGasConduitEnabled = "auto"; public static String[] soulVesselBlackList = new String[0]; + public static boolean soulVesselCapturesBosses = false; public static void load(FMLPreInitializationEvent event) { @@ -680,7 +681,11 @@ public final class Config { isGasConduitEnabled = config.getString("isGasConduitEnabled", sectionItems.name, isGasConduitEnabled, "Can be set to 'auto', 'true' or 'false'. When set to auto the gas conduit will only be enabled when Mekanism is installed."); - soulVesselBlackList = config.getStringList("soulVesselBlackList", sectionItems.name, soulVesselBlackList, "Entities listed here will can not be captured in a 'Vessel of Souls'"); + soulVesselBlackList = config.getStringList("soulVesselBlackList", sectionItems.name, soulVesselBlackList, + "Entities listed here will can not be captured in a 'Vessel of Souls'"); + + soulVesselCapturesBosses = config.getBoolean("soulVesselCapturesBosses", sectionItems.name, soulVesselCapturesBosses, + "When set to false, any mob with a 'boss bar' won't be able to be captured in the 'Vessel of Souls'"); } private Config() { diff --git a/src/main/java/crazypants/enderio/item/ItemSoulVessel.java b/src/main/java/crazypants/enderio/item/ItemSoulVessel.java index 10e5ab59..04bd918b 100644 --- a/src/main/java/crazypants/enderio/item/ItemSoulVessel.java +++ b/src/main/java/crazypants/enderio/item/ItemSoulVessel.java @@ -21,6 +21,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -164,6 +165,10 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider { return false; } + if(!Config.soulVesselCapturesBosses && entity instanceof IBossDisplayData) { + return false; + } + NBTTagCompound root = new NBTTagCompound(); root.setString("id", entityId); entity.writeToNBT(root);