Skip to content

Commit

Permalink
Fix freezing client/server desync
Browse files Browse the repository at this point in the history
Fixes #48
Fixes #44
  • Loading branch information
Dariensg committed Jun 26, 2023
1 parent 5f9c1c0 commit 1ec582f
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 @@ -52,7 +52,7 @@ private void MM_setEnchantsOnCreation(EntityType entityType, LivingEntity shoote
@Inject(method = "onHitEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/AbstractArrow;doPostHurtEffects(Lnet/minecraft/world/entity/LivingEntity;)V"))
private void MM_dealArrowEnchants(EntityHitResult hitResult, CallbackInfo ci) {
if (this.freezingLevel > 0) {
if (hitResult.getEntity() instanceof LivingEntity livingEntity) {
if (hitResult.getEntity() instanceof LivingEntity livingEntity && !livingEntity.level.isClientSide()) {
livingEntity.setTicksFrozen(livingEntity.getTicksFrozen() + livingEntity.getTicksRequiredToFreeze() + 120 * this.freezingLevel);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void MM_calculateEnchantEffects(Entity targetEntity, CallbackInfo ci, fl
}

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

0 comments on commit 1ec582f

Please sign in to comment.