Skip to content

Commit

Permalink
Incorporate bypass enchantments into damage source predicate
Browse files Browse the repository at this point in the history
Seems that flag got added in 1.19.2, and all enchantments use it as part of their condition. Means reasonably we want it in the can protect condition
  • Loading branch information
KnightMiner committed Apr 28, 2024
1 parent 0d68292 commit 64cdcca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/slimeknights/mantle/Mantle.java
Expand Up @@ -164,6 +164,7 @@ private void register(RegisterEvent event) {
DamageSourcePredicate.LOADER.register(getResource("damage_helmet"), DamageSourcePredicate.DAMAGE_HELMET.getLoader());
DamageSourcePredicate.LOADER.register(getResource("bypass_invulnerable"), DamageSourcePredicate.BYPASS_INVULNERABLE.getLoader());
DamageSourcePredicate.LOADER.register(getResource("bypass_magic"), DamageSourcePredicate.BYPASS_MAGIC.getLoader());
DamageSourcePredicate.LOADER.register(getResource("bypass_enchantments"), DamageSourcePredicate.BYPASS_ENCHANTMENTS.getLoader());
DamageSourcePredicate.LOADER.register(getResource("fire"), DamageSourcePredicate.FIRE.getLoader());
DamageSourcePredicate.LOADER.register(getResource("magic"), DamageSourcePredicate.MAGIC.getLoader());
DamageSourcePredicate.LOADER.register(getResource("fall"), DamageSourcePredicate.FALL.getLoader());
Expand Down
Expand Up @@ -27,12 +27,13 @@ public interface DamageSourcePredicate extends IJsonPredicate<DamageSource> {
DamageSourcePredicate DAMAGE_HELMET = simple(DamageSource::isDamageHelmet);
DamageSourcePredicate BYPASS_INVULNERABLE = simple(DamageSource::isBypassInvul);
DamageSourcePredicate BYPASS_MAGIC = simple(DamageSource::isBypassMagic);
DamageSourcePredicate BYPASS_ENCHANTMENTS = simple(DamageSource::isBypassEnchantments);
DamageSourcePredicate FIRE = simple(DamageSource::isFire);
DamageSourcePredicate MAGIC = simple(DamageSource::isMagic);
DamageSourcePredicate FALL = simple(DamageSource::isFall);

/** Damage that protection works against */
DamageSourcePredicate CAN_PROTECT = simple(source -> !source.isBypassMagic() && !source.isBypassInvul());
DamageSourcePredicate CAN_PROTECT = simple(source -> !source.isBypassMagic() && !source.isBypassEnchantments() && !source.isBypassInvul());
/** Custom concept: damage dealt by non-projectile entities */
DamageSourcePredicate MELEE = simple(source -> {
if (source.isProjectile()) {
Expand Down

0 comments on commit 64cdcca

Please sign in to comment.