Added a spellbook_immune_to damage typ tag

This commit is contained in:
Sollace 2023-08-11 00:51:05 +01:00
parent f7b1fc6d62
commit 8f737e1607
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 28 additions and 0 deletions

View file

@ -43,6 +43,7 @@ public interface UTags {
TagKey<StatusEffect> PINEAPPLE_EFFECTS = effect("pineapple_effects"); TagKey<StatusEffect> PINEAPPLE_EFFECTS = effect("pineapple_effects");
TagKey<DamageType> BREAKS_SUNGLASSES = damage("breaks_sunglasses"); TagKey<DamageType> BREAKS_SUNGLASSES = damage("breaks_sunglasses");
TagKey<DamageType> SPELLBOOK_IMMUNE_TO = damage("spellbook_immune_to");
TagKey<DimensionType> HAS_NO_ATMOSPHERE = dimension("has_no_atmosphere"); TagKey<DimensionType> HAS_NO_ATMOSPHERE = dimension("has_no_atmosphere");

View file

@ -1,6 +1,7 @@
package com.minelittlepony.unicopia.entity; package com.minelittlepony.unicopia.entity;
import com.minelittlepony.unicopia.EquinePredicates; import com.minelittlepony.unicopia.EquinePredicates;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.container.SpellbookScreenHandler; import com.minelittlepony.unicopia.container.SpellbookScreenHandler;
import com.minelittlepony.unicopia.container.SpellbookState; import com.minelittlepony.unicopia.container.SpellbookState;
import com.minelittlepony.unicopia.entity.player.MeteorlogicalUtil; import com.minelittlepony.unicopia.entity.player.MeteorlogicalUtil;
@ -234,6 +235,16 @@ public class SpellbookEntity extends MobEntity {
return ActionResult.PASS; 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 @Override
public void readCustomDataFromNbt(NbtCompound compound) { public void readCustomDataFromNbt(NbtCompound compound) {
super.readCustomDataFromNbt(compound); super.readCustomDataFromNbt(compound);

View file

@ -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"
]
}