SOLVED: Water Entities Sinking Bug/Help

Started by ViperousDeer on

Topic category: Troubleshooting, bugs, and solutions

Last seen on 01:07, 21. Nov 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
SOLVED: Water Entities Sinking Bug/Help
Wed, 12/22/2021 - 10:41 (edited)

EDIT: SOLVED in update 2021.3 for MC 1.17

My aquatic creatures will stop moving and slowly sink through the water to the ground, then just sit there. These are the conditions I've tested and witnessed it happen under:

-Spawning a dolphin near them or a dolphin swimming into range of them (within about 10ish blocks, more or less)

-If they're spawned/chase/swim around a depth of 5-6 blocks below sea-level (about coordinate height blocks 58-59 or deeper) (this only happens on regular maps--not Super-Flat worlds)

 

Other Notes:

-My aggressive water entities will snap out of this frozen state if they target a player, but nothing else snaps them out of it.
-I've tested presence (like dolphin) with ALL other mobs (vanilla and my mod, excluding testing the Ender Dragon), no others cause this.

I don't know if this is a bug or some setting I'm unaware of. Hours of trying to solve this, researching, and playing with settings did not fix it, so here I am

Edited by ViperousDeer on Wed, 12/22/2021 - 10:41
Last seen on 18:25, 23. Jun 2024
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
what version of mcreator you…
Sat, 09/04/2021 - 18:32

what version of mcreator you are using?

 

Last seen on 01:07, 21. Nov 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry, 2021.2
Fri, 09/17/2021 - 16:04

Sorry, 2021.2

Last seen on 00:46, 1. Aug 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im also working on this…
Sat, 11/20/2021 - 21:45

im also working on this combining the 2021.1  swim code with 2021.2 swim code  cause the 2021 made it so they would always move but this aloud them to leap out of the water and just rocket across the land so im adding the setmovevertical to the older one and its land if statements but first i need to did up the older 2021.1 swim lines

 

Last seen on 00:46, 1. Aug 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
but this 2021.2 did fix one…
Sat, 11/20/2021 - 21:51

but this 2021.2 did fix one problem with a lot of aquatic designers we can no make crabs and other sea clawers work right

 

Last seen on 01:35, 23. Dec 2021
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I believe you have to add in…
Sun, 11/21/2021 - 20:20

I believe you have to add in an ai block for both flying and swimming around randomly, and then change their speed to at least 1. And make sure to make them a flying entity as well as a water entity.

Last seen on 00:46, 1. Aug 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
whelp i tried a few ways of…
Sun, 11/21/2021 - 21:18

whelp i tried a few ways of merging the code which both of them reject each other in smaller ways 

Last seen on 00:46, 1. Aug 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
public void tick() {        …
Mon, 11/22/2021 - 18:32

public void tick() {
                    if (CustomEntity.this.isInWater())
                        CustomEntity.this.setMotion(CustomEntity.this.getMotion().add(0, 0.005 , 0));
                    if (this.action == MovementController.Action.MOVE_TO && !CustomEntity.this.getNavigator().noPath()) {
                        double dx = this.posX - CustomEntity.this.getPosX();
                        double dy = this.posY - CustomEntity.this.getPosY();
                        double dz = this.posZ - CustomEntity.this.getPosZ();
                        float f = (float) (MathHelper.atan2(dz, dx) * (double) (180 / Math.PI)) - 90;
                        float f1 = (float) (this.speed * CustomEntity.this.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
                        CustomEntity.this.rotationYaw = this.limitAngle(CustomEntity.this.rotationYaw, f, 10);
                        CustomEntity.this.renderYawOffset = CustomEntity.this.rotationYaw;
                        CustomEntity.this.rotationYawHead = CustomEntity.this.rotationYaw;
                        if (CustomEntity.this.isInWater()) {
                            CustomEntity.this.setAIMoveSpeed((float) CustomEntity.this.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
                            float f2 = -(float) (MathHelper.atan2(dy, MathHelper.sqrt(dx * dx + dz * dz)) * (180F / Math.PI));
                            f2 = MathHelper.clamp(MathHelper.wrapDegrees(f2), -85, 85);
                            CustomEntity.this.rotationPitch = this.limitAngle(CustomEntity.this.rotationPitch, f2, 5);
                            float f3 = MathHelper.cos(CustomEntity.this.rotationPitch * (float) (Math.PI / 180.0));
                            CustomEntity.this.setMoveForward(1F);
                            CustomEntity.this.setMoveVertical((float) (f1 * dy));
                        } else {
                            CustomEntity.this.setAIMoveSpeed(f1 + 1);
                            CustomEntity.this.setMoveForward(f1 + 2);

                        }
                    } else {
                        CustomEntity.this.setAIMoveSpeed(0);
                        CustomEntity.this.setMoveVertical(0);
                        CustomEntity.this.setMoveForward(0);
                    }
                }
            };

got it working 2021.3 but this line should fix it.  it should also work in .2 
CustomEntity.this.setMoveForward(f1 + 2);

 CustomEntity.this.setMotion(CustomEntity.this.getMotion().add(0, 0.005 , 0)); 

Last seen on 00:46, 1. Aug 2023
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the speed of the mod depends…
Mon, 11/22/2021 - 18:39

the speed of the mod depends  on this not default  setups (f1 + 2); you can change the + to * for multiplcation or just change the 2 still stops but not as much since its forced to move 

 

Last seen on 01:07, 21. Nov 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@nick I tested your theory…
Mon, 12/06/2021 - 07:44

@nick I tested your theory but it didn't fix it, and ontop of that it made my aggressive mobs skyrocket into the air and then get stuck maybe thirty blocks above the water and they'd just sit there frozen.

@kapo I'm not a coder so I couldn't quite follow along (though I tried). I'll have my boyfriend read this over as he knows code, but personally I have no idea what I'd even do with the code you showed me.

So as of right now I'm still having this issue. As an update from last time, with my aggressive water mob, I added other things that it attacks other than just players, and it'll snap out of its frozen state to attack them as well, but afterwards it inevitably swims to 58-59 height block and freezes/sinks. Still searching for a solution.

Last seen on 01:07, 21. Nov 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
SOLVED Update 2021.3 for…
Wed, 12/22/2021 - 10:40

SOLVED
Update 2021.3 for version 1.17 fixed this bug (: