Jump to content

Lithanarianaren

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Lithanarianaren

  1. Just tested the method - entity.xOld equals to entity.getX() no matter the speed for some reason, same with other axes, still heals while moving. Happens on both sides.
  2. Oh, they are called like this now. Thanks!
  3. Hello everyone. I am trying to make a status effect that heals you when you stand still on the ground. For this I have to somehow extract the speed the entity is currently moving with and check if it's zero. The closest thing to that I have been able to find is the getDeltaMovement() method, but for some reason it returns zero on the x and z axis regardless of the actual velocity of the entity. Here is the code I use for the effect application. @Override public void applyEffectTick(@NotNull LivingEntity entity, int amplifier){ if (!entity.level.isClientSide) { if (entity.getHealth() < entity.getMaxHealth()) { Vec3 movement = entity.getDeltaMovement(); System.out.println(movement); if (movement.x == 0.0D && entity.isOnGround() && movement.z == 0.0D) { entity.heal(1.0F); } } } } Also, getDeltaMovement() method seems to return non-zero values on the client side when moving, but you cannot heal on the client side. I have seen some posts about getting the position of the entity in the previous tick to determine its velocity, but I have not found any methods to do so. What I can do to determine an entity's velocity or just if it is standing still or not?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.