Skip to content

Commit

Permalink
no longer stuck in block when swim stoped
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 18, 2023
1 parent 3e7ac8f commit e13f14c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public void setSwimming(boolean p_20274_) {
} else if (!p_20274_ && this.swimming) {
this.heightOffset = 1.62f;
this.setSize(0.6F, 1.8F);
float center = this.bbWidth / 2.0f;
float heightOfMob = this.bbHeight;
this.bb.setBounds(x - (double) center, y - (double) this.heightOffset + (double) this.ySlideOffset, z - (double) center, x + (double) center, y - (double) this.heightOffset + (double) this.ySlideOffset + (double) heightOfMob, z + (double) center);
this.setPos(this.x, this.y + 1.2F, this.z);
}
this.swimming = p_20274_;
}
Expand Down Expand Up @@ -86,7 +84,9 @@ public void onLivingUpdate(CallbackInfo ci) {
}

if ((block instanceof BlockFluid || block == null) && this.isSwimming() && this.isInWater() && this.moveForward == 0 && this.moveStrafing == 0) {
this.setSwimming(false);
if (this.swimAmount >= 1F) {
this.setSwimming(false);
}
}
this.updateSwimAmount();
}
Expand Down

0 comments on commit e13f14c

Please sign in to comment.