hurtAndBreak not working properly on curios item #355
-
Hi,
When looking at the console while flying you can clearly see the same damage value being printed every 200 ticks and when it does update the damage eventually, it happens at random times and flying ends immediately. Please help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Where is your I'd advise changing your |
Beta Was this translation helpful? Give feedback.
Where is your
ticksPassed
being stored? If it's somewhere where both the client and server threads are able to access it, then you may be suffering from a concurrency issue where the client thread is processing information that the server needs before the server can access it.I'd advise changing your
ticksPassed
logic to instead check against the player's tick count,player.tickCount % 200 == 0
. In addition, check either!livingEntity.level().isClientSide()
orlivingEntity instanceof ServerPlayer
to only run it on the server thread.