Is the player moving? #110
Unanswered
Squander12
asked this question in
Q&A
Replies: 1 comment
-
Why not simply check if the position has changed from the previous positions fields? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Yes, it's me again. But I have a little problem.
I wanted to add the mechanic of destroying shoes when I move.
`@Override
public void moveEntityWithHeading(float moveStrafing, float moveForward) {
ItemStack boots = inventory.armorInventory[0];
if(boots != null && boots.getItem() == Item.windBoots) {
if(moveStrafing != 0 || moveForward != 0) {
if(ticksExisted % 80 == 0) {
boots.damageItem(1, this);
addChatMessage("Client: " + boots.getItemDamage());
`public void moveEntityWithHeading(float moveStrafing, float moveForward) {
ItemStack boots = inventory.armorInventory[0];
if(boots != null && boots.getItem() == Item.windBoots) {
if(moveStrafing != 0 || moveForward != 0) {
if(ticksExisted % 80 == 0) {
boots.damageItem(1, this);
addChatMessages("Server: " + boots.getItemDamage());
The code comes from the EntityPlayer class, it is the same on the server and client. However, there is a small problem. On the server, moveStrafing and moveForward are always zero. So is there any other way to check if the player is not moving?
Beta Was this translation helpful? Give feedback.
All reactions