From 7d442f2f77d4243d6ecd3ab2c23e154f9703bc4c Mon Sep 17 00:00:00 2001 From: baguchan Date: Thu, 16 Nov 2023 16:12:19 +0900 Subject: [PATCH] fixed weird move and even touch water. you can swim! --- .../baguchan/better_with_aquatic/mixin/EntityPlayerMixin.java | 3 +-- .../better_with_aquatic/mixin/client/KeyboardInputMixin.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/baguchan/better_with_aquatic/mixin/EntityPlayerMixin.java b/src/main/java/baguchan/better_with_aquatic/mixin/EntityPlayerMixin.java index b549b65..f7c8cdb 100644 --- a/src/main/java/baguchan/better_with_aquatic/mixin/EntityPlayerMixin.java +++ b/src/main/java/baguchan/better_with_aquatic/mixin/EntityPlayerMixin.java @@ -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); @@ -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_; } diff --git a/src/main/java/baguchan/better_with_aquatic/mixin/client/KeyboardInputMixin.java b/src/main/java/baguchan/better_with_aquatic/mixin/client/KeyboardInputMixin.java index 344f9f6..f13a1c6 100644 --- a/src/main/java/baguchan/better_with_aquatic/mixin/client/KeyboardInputMixin.java +++ b/src/main/java/baguchan/better_with_aquatic/mixin/client/KeyboardInputMixin.java @@ -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; @@ -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()) {