Add dimension whitelist option for evil wizard spawning and restrict numbers to 1 per chunk, closes #26

This commit is contained in:
Electroblob
2018-06-03 22:22:18 +01:00
parent 5ba92e5de5
commit 9b5e5a871c
4 changed files with 27 additions and 0 deletions
@@ -121,6 +121,8 @@ public final class Settings {
public double playerDamageScale = 1.0f;
/** <b>[Server-only]</b> Global damage scaling factor for all npc magic damage. */
public double npcDamageScale = 1.0f;
/** <b>[Server-only]</b> List of dimension ids in which evil wizards can spawn. */
public int[] evilWizardDimensions = {0};
// Commands (these don't need synchronising since typing a command always queries the server).
/**
@@ -506,6 +508,12 @@ public final class Settings {
// Converts all strings in the list to a ResourceLocation.
mindControlTargetsBlacklist = Arrays.stream(property.getStringList()).map(s -> new ResourceLocation(s.toLowerCase(Locale.ROOT).trim())).toArray(ResourceLocation[]::new);
propOrder.add(property.getName());
property = config.get(Configuration.CATEGORY_GENERAL, "evilWizardDimensions", new int[]{0},
"List of dimension ids in which evil wizards can spawn.");
property.setLanguageKey("config." + Wizardry.MODID + ".evil_wizard_dimensions");
property.setRequiresMcRestart(true);
evilWizardDimensions = property.getIntList();
propOrder.add(property.getName());
config.setCategoryPropertyOrder(Configuration.CATEGORY_GENERAL, propOrder);
@@ -265,6 +265,21 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
(NBTTagInt tag) -> Spell.get(tag.getInt()));
this.hasTower = nbt.getBoolean("hasTower");
}
@Override
public int getMaxSpawnedInChunk(){
return 1;
}
@Override
public boolean getCanSpawnHere(){
// Evil wizards can only spawn in the specified dimensions
for(int id : Wizardry.settings.evilWizardDimensions){
if(this.dimension == id) return super.getCanSpawnHere();
}
return false;
}
@Override
protected boolean canDespawn(){
@@ -698,6 +698,7 @@ 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.evil_wizard_dimensions=Evil Wizard Dimensions
config.ebwizardry.mobs_immune_to_fire=Mobs Immune To Fire
config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice
@@ -733,6 +734,7 @@ config.ebwizardry.discoverspell_command_name.tooltip=The name of the /discoversp
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.evil_wizard_dimensions.tooltip=List of dimension ids in which evil wizards can spawn.
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).
@@ -698,6 +698,7 @@ 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.evil_wizard_dimensions=Evil Wizard Dimensions
config.ebwizardry.mobs_immune_to_fire=Mobs Immune To Fire
config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice
@@ -733,6 +734,7 @@ config.ebwizardry.discoverspell_command_name.tooltip=The name of the /discoversp
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.evil_wizard_dimensions.tooltip=List of dimension ids in which evil wizards can spawn.
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).