Skip to content

Commit

Permalink
Fix Freezing being infinitely stackable
Browse files Browse the repository at this point in the history
Fixes #51
  • Loading branch information
Dariensg committed Jun 29, 2023
1 parent 334763f commit 1ae5949
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void MM_setEnchantsOnCreation(EntityType entityType, LivingEntity shoote
private void MM_dealArrowEnchants(EntityHitResult hitResult, CallbackInfo ci) {
if (this.freezingLevel > 0) {
if (hitResult.getEntity() instanceof LivingEntity livingEntity && !livingEntity.level.isClientSide()) {
livingEntity.setTicksFrozen(livingEntity.getTicksFrozen() + livingEntity.getTicksRequiredToFreeze() + 120 * this.freezingLevel);
livingEntity.setTicksFrozen(Math.max(livingEntity.getTicksFrozen(), livingEntity.getTicksRequiredToFreeze() + 120 * this.freezingLevel));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void MM_calculateEnchantEffects(Entity targetEntity, CallbackInfo ci, fl

private void applyFreezingEffects(Entity targetEntity, int level) {
if (targetEntity instanceof LivingEntity livingTarget && !livingTarget.level.isClientSide()) {
livingTarget.setTicksFrozen(livingTarget.getTicksFrozen() + livingTarget.getTicksRequiredToFreeze() + 120 * level);
livingTarget.setTicksFrozen(Math.max(livingTarget.getTicksFrozen(), livingTarget.getTicksRequiredToFreeze() + 120 * level));
}
}

Expand Down

0 comments on commit 1ae5949

Please sign in to comment.