Jump to content

Item Equip animation plays when updating nbt


TheTrueSCP

Recommended Posts

Hello,

i have a strange problem:
if i write a nbt in the inventoryTick method into the item, the item plays the equip anim.
As example:
 

 @Override
    public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pSlotId, boolean pIsSelected) {

        if (pLevel instanceof ServerLevel SL) {


            CompoundTag pCompoundTag = pStack.getOrCreateTag();
            if (pEntity instanceof Player player) {
                pCompoundTag.putFloat("lootdebugs.drills_rot", pEntity.getOnPos().getX());//Debug
                System.out.println(pEntity.getOnPos().getX());
            }
        }

        super.inventoryTick(pStack, pLevel, pEntity, pSlotId, pIsSelected);
    }


When I use this code, the item plays the equip-item animation every time I move in the x direction

Also, I found out that I can't break blocks: the blockbreak animation stops when I move in the x-direction

Can someone help me?
Thanks

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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