diff --git a/src/main/java/com/minelittlepony/unicopia/UTags.java b/src/main/java/com/minelittlepony/unicopia/UTags.java index 92f1473a..233e0d57 100644 --- a/src/main/java/com/minelittlepony/unicopia/UTags.java +++ b/src/main/java/com/minelittlepony/unicopia/UTags.java @@ -43,6 +43,7 @@ public interface UTags { TagKey PINEAPPLE_EFFECTS = effect("pineapple_effects"); TagKey BREAKS_SUNGLASSES = damage("breaks_sunglasses"); + TagKey SPELLBOOK_IMMUNE_TO = damage("spellbook_immune_to"); TagKey HAS_NO_ATMOSPHERE = dimension("has_no_atmosphere"); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/SpellbookEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/SpellbookEntity.java index ef53262d..1d40b374 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/SpellbookEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/SpellbookEntity.java @@ -1,6 +1,7 @@ package com.minelittlepony.unicopia.entity; import com.minelittlepony.unicopia.EquinePredicates; +import com.minelittlepony.unicopia.UTags; import com.minelittlepony.unicopia.container.SpellbookScreenHandler; import com.minelittlepony.unicopia.container.SpellbookState; import com.minelittlepony.unicopia.entity.player.MeteorlogicalUtil; @@ -234,6 +235,16 @@ public class SpellbookEntity extends MobEntity { return ActionResult.PASS; } + @Override + public boolean isImmuneToExplosion() { + return true; + } + + @Override + public boolean isInvulnerableTo(DamageSource damageSource) { + return super.isInvulnerableTo(damageSource) || damageSource.isIn(UTags.SPELLBOOK_IMMUNE_TO); + } + @Override public void readCustomDataFromNbt(NbtCompound compound) { super.readCustomDataFromNbt(compound); diff --git a/src/main/resources/data/unicopia/tags/damage_type/spellbook_immune_to.json b/src/main/resources/data/unicopia/tags/damage_type/spellbook_immune_to.json new file mode 100644 index 00000000..f270bd7e --- /dev/null +++ b/src/main/resources/data/unicopia/tags/damage_type/spellbook_immune_to.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "#minecraft:is_fall", + "#minecraft:is_freezing", + "#minecraft:is_lightning", + "#minecraft:is_projectile", + "unicopia:zap", + "unicopia:love_draining", + "unicopia:life_draining", + "unicopia:rainboom", + "unicopia:sun", + "unicopia:sunlight", + "unicopia:smash" + ] +}