Water Mobs wont sink anymore (starfish problem)

Started by ninjawizard1234 on

Topic category: Help with modding (Java Edition)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Water Mobs wont sink anymore (starfish problem)

Mobs that walk on the ocean floor like lobsters and starfishes, how we do them now? i use to set them as regualar (non-water entities) but those wont spawn anymore on the ocean now, so the question remains; how to make water mobs to spawn and SINK to the floor (not swim) - i already removed the swim goal and its still floating just below the water surface, it wont sink to the floor :(

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mcreator 2023 btw (java 1.17…
Tue, 11/21/2023 - 21:35

Mcreator 2023 btw (java 1.17 minecraft 1.20.1)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
guys if someone need this, i…
Thu, 11/23/2023 - 00:55

guys if someone need this, i manage to make it work by simple removing the entire water-move code part, after that i just set the speed to 1 (walk speed) and let swim speed 0.1 (if u want a faster ocean-floor only entity change there), 

just remove this entire part (begin of the file):

this.setPathfindingMalus(BlockPathTypes.WATER, 0);

this.moveControl = new MoveControl(this) {
@Override
public void tick() {
if (StarfishPinkEntity.this.isInWater())
StarfishPinkEntity.this.setDeltaMovement(StarfishPinkEntity.this.getDeltaMovement().add(0, 0.005, 0));
if (this.operation == MoveControl.Operation.MOVE_TO && !StarfishPinkEntity.this.getNavigation().isDone()) {
double dx = this.wantedX - StarfishPinkEntity.this.getX();
double dy = this.wantedY - StarfishPinkEntity.this.getY();
double dz = this.wantedZ - StarfishPinkEntity.this.getZ();
float f = (float) (Mth.atan2(dz, dx) * (double) (180 / Math.PI)) - 90;
float f1 = (float) (this.speedModifier * StarfishPinkEntity.this.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
StarfishPinkEntity.this.setYRot(this.rotlerp(StarfishPinkEntity.this.getYRot(), f, 10));
StarfishPinkEntity.this.yBodyRot = StarfishPinkEntity.this.getYRot();
StarfishPinkEntity.this.yHeadRot = StarfishPinkEntity.this.getYRot();
if (StarfishPinkEntity.this.isInWater()) {
StarfishPinkEntity.this.setSpeed((float) StarfishPinkEntity.this.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
float f2 = -(float) (Mth.atan2(dy, (float) Math.sqrt(dx * dx + dz * dz)) * (180 / Math.PI));
f2 = Mth.clamp(Mth.wrapDegrees(f2), -85, 85);
StarfishPinkEntity.this.setXRot(this.rotlerp(StarfishPinkEntity.this.getXRot(), f2, 5));
float f3 = Mth.cos(StarfishPinkEntity.this.getXRot() * (float) (Math.PI / 180.0));
StarfishPinkEntity.this.setZza(f3 * f1);
StarfishPinkEntity.this.setYya((float) (f1 * dy));
} else {
StarfishPinkEntity.this.setSpeed(f1 * 0.05F);
}
} else {
StarfishPinkEntity.this.setSpeed(0);
StarfishPinkEntity.this.setYya(0);
StarfishPinkEntity.this.setZza(0);
}
}
};