Skip to content

Commit

Permalink
Moved shield check to fix blocking absorption.
Browse files Browse the repository at this point in the history
  • Loading branch information
LtxProgrammer committed Oct 2, 2024
1 parent 48c17a3 commit d8ce7d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -757,16 +757,17 @@ public boolean tryTransfurTarget(Entity entity) {
TransfurVariant<?> variant = this.getTransfurVariant();

if (entity instanceof LivingEntity livingEntity) {
IAbstractChangedEntity source = IAbstractChangedEntity.forEither(maybeGetUnderlying());
if (tryFuseWithTarget(livingEntity, source, damage))
final var context = getAttackContext();
damage = ProcessTransfur.checkBlocked(livingEntity, damage, context.source);
if (tryFuseWithTarget(livingEntity, context.source, damage))
return true;

if (TransfurVariant.getEntityVariant(livingEntity) == null) {
if (livingEntity instanceof Player player) {
ProcessTransfur.progressPlayerTransfur(player, damage, variant, getAttackContext());
ProcessTransfur.progressPlayerTransfur(player, damage, variant, context);
return true;
} else if (livingEntity.getType().is(ChangedTags.EntityTypes.HUMANOIDS)) {
ProcessTransfur.progressTransfur(livingEntity, damage, variant, getAttackContext());
ProcessTransfur.progressTransfur(livingEntity, damage, variant, context);
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static float getPlayerTransfurProgress(Player player) {
return ext.getTransfurProgress();
}

protected static float checkBlocked(LivingEntity blocker, float amount, IAbstractChangedEntity source) {
public static float checkBlocked(LivingEntity blocker, float amount, IAbstractChangedEntity source) {
if (source == null || amount <= 0.0f)
return amount;

Expand Down Expand Up @@ -126,8 +126,6 @@ public static boolean progressPlayerTransfur(Player player, float amount, Transf
return false;
}

amount = checkBlocked(player, amount, context.source);

if (amount <= 0.0f)
return false;

Expand Down

0 comments on commit d8ce7d0

Please sign in to comment.