From 23b950d5b83fddd0cabe78891efd21d99ae89933 Mon Sep 17 00:00:00 2001 From: Yong Jun Date: Mon, 7 Apr 2025 22:23:46 +0100 Subject: [PATCH] add Immune to magic damage config option (#887) * added more config * Update src/main/java/electroblob/wizardry/Settings.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/main/java/electroblob/wizardry/Settings.java | 12 ++++++++++++ src/main/resources/assets/ebwizardry/lang/en_gb.lang | 2 ++ src/main/resources/assets/ebwizardry/lang/en_us.lang | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index b36b0594..e6559349 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -1371,6 +1371,18 @@ public final class Settings { } propOrder.add(property.getName()); + property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToMagic", new String[]{}, + "List of names of entities that are immune to magic, in addition to the defaults. Add mod creatures to this list if you want them to be immune to magic damage and they aren't already. SoundLoopSpellEntity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard)."); + property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_magic"); + property.setRequiresMcRestart(true); + // Wizardry.proxy.setToEntityNameEntry(property); + // Converts all strings in the list to lower case, to ignore case sensitivity, and trims them. + for(int i = 0; i < property.getStringList().length; i++){ + property.getStringList()[i] = property.getStringList()[i].toLowerCase(Locale.ROOT).trim(); + MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])), + DamageType.MAGIC); + } + propOrder.add(property.getName()); property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToWither", new String[]{}, "List of names of entities that are immune to wither effects, in addition to the defaults. Add mod creatures to this list if you want them to be immune to withering magic and they aren't already. SoundLoopSpellEntity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard)."); property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_wither"); diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index 88e9f180..eb711243 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -1731,6 +1731,8 @@ config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice 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). config.ebwizardry.mobs_immune_to_lightning=Mobs Immune To Lightning config.ebwizardry.mobs_immune_to_lightning.tooltip=List of names of entities that are immune to lightning, in addition to the defaults. Add mod creatures to this list if you want them to be immune to lightning 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_magic=Mobs Immune To Magic +config.ebwizardry.mobs_immune_to_magic.tooltip=List of names of entities that are immune to magic, in addition to the defaults. Add mod creatures to this list if you want them to be immune to magic damage 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_wither=Mobs Immune To Wither config.ebwizardry.mobs_immune_to_wither.tooltip=List of names of entities that are immune to wither effects, in addition to the defaults. Add mod creatures to this list if you want them to be immune to withering 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_poison=Mobs Immune To Poison diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 5cfc7bd5..640395ab 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -1784,6 +1784,8 @@ config.ebwizardry.mobs_immune_to_ice=Mobs Immune To Ice 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). config.ebwizardry.mobs_immune_to_lightning=Mobs Immune To Lightning config.ebwizardry.mobs_immune_to_lightning.tooltip=List of names of entities that are immune to lightning, in addition to the defaults. Add mod creatures to this list if you want them to be immune to lightning 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_magic=Mobs Immune To Magic +config.ebwizardry.mobs_immune_to_magic.tooltip=List of names of entities that are immune to magic, in addition to the defaults. Add mod creatures to this list if you want them to be immune to magic damage 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_wither=Mobs Immune To Wither config.ebwizardry.mobs_immune_to_wither.tooltip=List of names of entities that are immune to wither effects, in addition to the defaults. Add mod creatures to this list if you want them to be immune to withering 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_poison=Mobs Immune To Poison