Started by
gustavowizard123
on
Topic category: Help with Minecraft modding (Java Edition)
i need to know 3 things about water mobs:
1) How to change their underwater speed
2)How to make a water entity walk on land too (i set both swim and walk goals but it wont move on land)
3)How to make a water mob sufocate in land? like drowning code but reverse
PS - i could not find those on vanilla files
@Override
public void tick() {
if (CustomEntity.this.areEyesInFluid(FluidTags.WATER))
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();
dy = dy / (double) MathHelper.sqrt(dx * dx + dy * dy + dz * dz);
CustomEntity.this.rotationYaw = this.limitAngle(CustomEntity.this.rotationYaw,
(float) (MathHelper.atan2(dz, dx) * (double) (180 / (float) Math.PI)) - 90, 90);
CustomEntity.this.renderYawOffset = CustomEntity.this.rotationYaw;
CustomEntity.this.setAIMoveSpeed(MathHelper.lerp(0.125f, CustomEntity.this.getAIMoveSpeed(),
(float) (this.speed * CustomEntity.this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getValue())));
CustomEntity.this.setMotion(CustomEntity.this.getMotion().add(0, CustomEntity.this.getAIMoveSpeed() * dy * 0.1, 0));
} else {
CustomEntity.this.setAIMoveSpeed(0F);
}
}
};
this.navigator = new SwimmerPathNavigator(this, this.world);
}
Thanks in advance.
i know the speed thing must be somewhere on the code above, or im wrong?
i mean the speed the mob swim