Skip to content

Commit

Permalink
fixed weird move and even touch water. you can swim!
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 16, 2023
1 parent 7bdf9d0 commit 7d442f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public EntityPlayerMixin(World world) {
}

public void setSwimming(boolean p_20274_) {

if (p_20274_ && !this.swimming) {
this.heightOffset = 0.5f;
this.setSize(0.6F, 0.6F);
Expand All @@ -41,7 +40,7 @@ public void setSwimming(boolean p_20274_) {
this.setSize(0.6F, 1.8F);
float center = this.bbWidth / 2.0f;
float heightOfMob = this.bbHeight;
this.bb.setBounds(x - (double) center, y, z - (double) center, x + (double) center, y + (double) heightOfMob, z + (double) center);
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.swimming = p_20274_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import baguchan.better_with_aquatic.api.ISwiming;
import net.minecraft.client.input.KeyboardInput;
import net.minecraft.client.option.GameSettings;
import net.minecraft.core.block.material.Material;
import net.minecraft.core.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -29,7 +28,7 @@ public class KeyboardInputMixin {
public void tick(EntityPlayer entityplayer, CallbackInfo ci) {

if (entityplayer instanceof ISwiming) {
if (entityplayer.isUnderLiquid(Material.water) && !entityplayer.isSneaking()) {
if (entityplayer.isInWater() && !entityplayer.isSneaking()) {
if (keys[0]) {
if (this.sprintTime < 9 && !this.pressedSprint) {
if (BetterWithAquatic.isEnableSwim()) {
Expand Down

0 comments on commit 7d442f2

Please sign in to comment.