#NPC bug when holding item/when using command /replaceitem

1 messages · Page 1 of 1 (latest)

ebon steppe
#

how tp fix this? any idea?

#
  "format_version": "1.16.100",
  "minecraft:entity": {
    "description": {
      "identifier": "pa_ns:steve",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },
    "components": {
      "minecraft:type_family": {
        "family": ["npc", "mob"]
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.975
      },
      "minecraft:health": {
        "value": 1,
        "max": 1
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "cause": "all",
          "deals_damage": false
        }
      },
      "minecraft:fire_immune": true,
      "minecraft:movement": {
        "value": 0
      },
      "minecraft:knockback_resistance": {
        "value": 1
      },
      "minecraft:pushable": {
        "is_pushable": false,
        "is_pushable_by_piston": false
      },
      "minecraft:interact": {
        "interactions": [
          {
            "use_item": false,
            "on_interact": {
              "event": "npc:open_menu",
              "target": "self"
            }
          }
        ]
      },
      "minecraft:nameable": {
        "always_show": true,
        "allow_name_tag_renaming": true
      },
      "minecraft:persistent": {},
      "minecraft:physics": {},
      "minecraft:loot": {
        "table": "loot_tables/empty.json"
      },
      "minecraft:equippable": {
        "slots": [
          {
            "slot": "slot.armor.head",
            "accepted_items": ["*"],
            "drop_chance": 0.0
          },
          {
            "slot": "slot.armor.chest",
            "accepted_items": ["*"],
            "drop_chance": 0.0
          },
          {
            "slot": "slot.armor.legs",
            "accepted_items": ["*"],
            "drop_chance": 0.0
          },
          {
            "slot": "slot.armor.feet",
            "accepted_items": ["*"],
            "drop_chance": 0.0
          },
          {
            "slot":"slot.weapon.mainhand",
            "accepted_items": ["*"],
            "drop_chance": 0.0
          }
        ]
      },
      "minecraft:conditional_bandwidth_optimization": {}
    },
    "events": {
      "npc:open_menu": {
        "run_command": {
          "command": [
            "playsound random.orb @s"
          ]
        }
      },
      "npc:despawn": {
        "add": {
          "component_groups": [
            "npc:despawn"
          ]
        }
      }
    },
    "component_groups": {
      "npc:despawn": {
        "minecraft:instant_despawn": {}
      }
    }
  }
}```
here's behavior from npc
lime dust
#

The problem might be with the model file — maybe try adjusting rightarm/rightitem?

ebon steppe
#

in minecraft:equippable?

lime dust
#

In the entity's model file. Do you have a picture of the blockbench file?

#

Or try removing "minecraft:equippable" and testing it out

ebon steppe
#

wait

ebon steppe
lime dust
#

Is the rightarm/rightitem file correctly included in the Blockbench file? I think the item is supposed to be positioned in the rightitem part.

#

This is the behavior pack file for my entity. Even without the minecraft:equippable component, it still works correctly.

#

I implemented the item equipping using a script with the replaceitem command. I don't think it's directly related right now, but I can share the script if necessary. (The item being visibly equipped is intentional.)

#

I'm using a translator, so I hope my meaning is coming through clearly.

#

My model doesn't have a body section, so the armor doesn't appear when equipped. I wonder if that's related. It seems like the part of the model where the item should be attached—the hand—might be missing.

ebon steppe
#

ohh, I see then

lime dust
# ebon steppe can you send that behavior?

May I ask if the modeling issue has already been resolved? Since this script merely runs the replaceitem command, it does not have any direct connection to the modeling component.

lime dust
#

Even after adding the rightarm/rightitem section to the model file, is the equipped item still not visible?

#

If possible, could you please provide a screenshot of the arm folder section from your model file?

ebon steppe
#

Maybe I'll fix it later, because I'm still busy with other things.

lime dust
#

I hope everything works out well for you.

ebon steppe
lime dust
#

Oh, I see. That part is just for aligning the entity like a block. Let me share the code below.

ebon steppe
#

heres my model

#

I already add "rightitem" in RightArm, so whats next?

lime dust
#

Could you try adding a rightitem folder inside the rightarm folder, just like in the picture I sent you? If possible, please make sure to match the capitalization as well. That might be the cause of the issue.

ebon steppe
#

I already do that

#

so, what's next?

lime dust
#

That should probably make it work. Is it still not working?

#

If it's still not working, it might help to rename baseplate to waist and move the rightarm folder inside it, similar to how it's structured in the official player model.

ebon steppe
lime dust
#

No, I don't think that matters. That behavior pack doesn't include anything related to equipping items.

#

That component only contains basic things like invincibility and health. The entity's appearance is controlled by the resource pack, and in most cases, it's not related to the behavior pack.

ebon steppe
#

oh

#

let me try

#

it doesnt work

lime dust
#

Have you double-checked that the capitalization and names in the model file are exactly correct? You could try putting the arm file inside the waist folder. If possible, could you expand the file structure a bit more and show the waist and arm sections?

ebon steppe
lime dust
#

I think the problem is that the rightitem is missing under the rightarm. You need to have a rightitem folder inside the ""rightarm folder.""

ebon steppe
#

oh

#

like this?

lime dust
#

The folder alone should be sufficient — you can try deleting the block part underneath it and see if that helps.\

ebon steppe
#

oohh, IT WORKS

lime dust
#

Oh, that’s great!

#

👍

ebon steppe
#

thank you!!

lime dust
#

You're welcome.

#

You can now change where the item appears by repositioning that folder. Feel free to adjust it to suit your model 😄

ebon steppe
#

yes sir!

#

thankks a lot, this is very helpful!

ember saddle
lime dust
#

Please change the entity name “codek327:test_block_1x” to your own entity name.

#

Feel free to modify the code as you like.

#

There seems to be a slight problem with the code. When I put in 64 items, they all disappear, and when I take them out again, only one is returned. Could you please fix this part?

ember saddle
lime dust
#

Can you show me a screenshot of the blockbench for the entity?

ember saddle
lime dust
#

I'm sorry... I saw it too late.

lime dust
# ember saddle

Can't see the equipped items even though there is a [rightitem] folder?

#

I'm not sure if the [rightarm] folder is important. I think it will work even if it's not there.

ember saddle
#

it works in game, but i cant get the position right

#

i was wondering if there was a way to position it easily in blockbench

lime dust
#

I'm not sure if this will be helpful, but I'll give you the animation I made.
In this file, I adjusted the position of the item in my hand so that it looks like FMBE.