diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java
index 9f73ba45..de645185 100644
--- a/src/main/java/electroblob/wizardry/Settings.java
+++ b/src/main/java/electroblob/wizardry/Settings.java
@@ -111,6 +111,11 @@ public final class Settings {
* overriding the defaults and the whitelist.
*/
public String[] summonedCreatureTargetsBlacklist = {"creeper"};
+ /**
+ * [Server-only] List of names of entities which are immune to the mind control spell, in addition to the
+ * defaults.
+ */
+ public String[] mindControlTargetsBlacklist = {};
/** [Server-only] Global damage scaling factor for all player magic damage. */
public double playerDamageScale = 1.0f;
/** [Server-only] Global damage scaling factor for all npc magic damage. */
@@ -497,6 +502,18 @@ public final class Settings {
alliesCommandName = property.getString();
propOrder.add(property.getName());
+ property = config.get(Configuration.CATEGORY_GENERAL, "mindControlTargetsBlacklist", new String[]{},
+ "List of names of entities which cannot be mind controlled, in addition to the defaults. Add creatures to this list if allowing them to be mind-controlled causes problems or could be exploited. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
+ property.setLanguageKey("config." + Wizardry.MODID + ".mind_control_targets_blacklist");
+ property.setRequiresWorldRestart(true);
+ // Wizardry.proxy.setToEntityNameEntry(property);
+ mindControlTargetsBlacklist = property.getStringList();
+ // Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
+ for(int i = 0; i < mindControlTargetsBlacklist.length; i++){
+ mindControlTargetsBlacklist[i] = mindControlTargetsBlacklist[i].toLowerCase(Locale.ROOT).trim();
+ }
+ propOrder.add(property.getName());
+
config.setCategoryPropertyOrder(Configuration.CATEGORY_GENERAL, propOrder);
// Resistances
diff --git a/src/main/java/electroblob/wizardry/spell/MindControl.java b/src/main/java/electroblob/wizardry/spell/MindControl.java
index 3edff448..2b7f5e59 100644
--- a/src/main/java/electroblob/wizardry/spell/MindControl.java
+++ b/src/main/java/electroblob/wizardry/spell/MindControl.java
@@ -1,6 +1,8 @@
package electroblob.wizardry.spell;
+import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
@@ -14,6 +16,7 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.INpc;
@@ -143,7 +146,8 @@ public class MindControl extends Spell {
/** Returns true if the given entity can be mind controlled (i.e. is not a player, npc, evil wizard or boss). */
public static boolean canControl(EntityLivingBase target){
return target instanceof EntityLiving && target.isNonBoss() && !(target instanceof INpc)
- && !(target instanceof EntityEvilWizard);
+ && !(target instanceof EntityEvilWizard) && !Arrays.asList(Wizardry.settings.summonedCreatureTargetsBlacklist)
+ .contains(EntityList.getKey(entity.getClass()).toString().toLowerCase(Locale.ROOT));
}
/**
diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang
index 9fb74efc..376817d1 100644
--- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang
+++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang
@@ -697,6 +697,7 @@ config.ebwizardry.cast_command_name=Cast Spell Command Name
config.ebwizardry.discoverspell_command_name=Discover Spell Command Name
config.ebwizardry.ally_command_name=Set Ally Command Name
config.ebwizardry.allies_command_name=View Allies Command Name
+config.ebwizardry.mind_control_targets_blacklist=Mind Control Targets Blacklist
config.ebwizardry.mobs_immune_to_fire=Mobs Immune To Fire
config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice
@@ -731,6 +732,7 @@ config.ebwizardry.cast_command_name.tooltip=The name of the /cast command. This
config.ebwizardry.discoverspell_command_name.tooltip=The name of the /discoverspell command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /discoverspell you would type /magic instead.
config.ebwizardry.ally_command_name.tooltip=The name of the /ally command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /ally you would type /magic instead.
config.ebwizardry.allies_command_name.tooltip=The name of the /allies command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /allies you would type /magic instead.
+config.ebwizardry.mind_control_targets_blacklist.tooltip=List of names of entities which cannot be mind controlled, in addition to the defaults. Add creatures to this list if allowing them to be mind-controlled causes problems or could be exploited. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry:wizard).
config.ebwizardry.mobs_immune_to_fire.tooltip=List of names of entities that are immune to fire, in addition to the defaults. Add mod creatures to this list if you want them to be immune to fire magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry.wizard).
config.ebwizardry.mobs_immune_to_ice.tooltip=List of names of entities that are immune to ice, in addition to the defaults. Add mod creatures to this list if you want them to be immune to ice magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry.wizard).
diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang
index 41c4080f..f781df6a 100644
--- a/src/main/resources/assets/ebwizardry/lang/en_us.lang
+++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang
@@ -697,6 +697,7 @@ config.ebwizardry.cast_command_name=Cast Spell Command Name
config.ebwizardry.discoverspell_command_name=Discover Spell Command Name
config.ebwizardry.ally_command_name=Set Ally Command Name
config.ebwizardry.allies_command_name=View Allies Command Name
+config.ebwizardry.mind_control_targets_blacklist=Mind Control Targets Blacklist
config.ebwizardry.mobs_immune_to_fire=Mobs Immune To Fire
config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice
@@ -731,6 +732,7 @@ config.ebwizardry.cast_command_name.tooltip=The name of the /cast command. This
config.ebwizardry.discoverspell_command_name.tooltip=The name of the /discoverspell command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /discoverspell you would type /magic instead.
config.ebwizardry.ally_command_name.tooltip=The name of the /ally command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /ally you would type /magic instead.
config.ebwizardry.allies_command_name.tooltip=The name of the /allies command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /allies you would type /magic instead.
+config.ebwizardry.mind_control_targets_blacklist.tooltip=List of names of entities which cannot be mind controlled, in addition to the defaults. Add creatures to this list if allowing them to be mind-controlled causes problems or could be exploited. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry:wizard).
config.ebwizardry.mobs_immune_to_fire.tooltip=List of names of entities that are immune to fire, in addition to the defaults. Add mod creatures to this list if you want them to be immune to fire magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry.wizard).
config.ebwizardry.mobs_immune_to_ice.tooltip=List of names of entities that are immune to ice, in addition to the defaults. Add mod creatures to this list if you want them to be immune to ice magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. ebwizardry.wizard).