Add dimension whitelist option for evil wizard spawning and restrict numbers to 1 per chunk, closes #26
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user