Mcreator 2020.3 Water Entity walk on land

Started by gustavowizard123 on Mon, 06/22/2020 - 06:30

Topic category: Help with modding (Java Edition)

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Mcreator 2020.3 Water Entity walk on land
Mon, 06/22/2020 - 06:30

hey guys im trying to make my lobsters and starfishes to walk on land.. i guess its on this part right?

 

public CustomEntity(EntityType<CustomEntity> type, World world) {
			super(type, world);
			experienceValue = 60;
			setNoAI(false);
			this.moveController = new MovementController(this) {
				@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(0);
					}
				}
			};
			this.navigator = new SwimmerPathNavigator(this, this.world);
		}

 

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i tried to look the turtle…
Sun, 06/28/2020 - 22:38

i tried to look the turtle code (since it walks on land and swim on water), but i could not assimilate anything, i was trying to do it by adding some code on this part:

} else {

CustomEntity.this.setAIMoveSpeed(0); }