#NPC bug when holding item/when using command /replaceitem
1 messages · Page 1 of 1 (latest)
"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
The problem might be with the model file — maybe try adjusting rightarm/rightitem?
in minecraft:equippable?
In the entity's model file. Do you have a picture of the blockbench file?
Or try removing "minecraft:equippable" and testing it out
here the video
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.
ohh, I see then
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.
not really
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?
Maybe I'll fix it later, because I'm still busy with other things.
I hope everything works out well for you.
I want to ask, what is in the "controller.animation.is_stackable_block" Is it mandatory to fill in the JSON file?
Oh, I see. That part is just for aligning the entity like a block. Let me share the code below.
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.
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.
does the behavior file have to be the same as this one?
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.
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?
here
I think the problem is that the rightitem is missing under the rightarm. You need to have a rightitem folder inside the ""rightarm folder.""
The folder alone should be sufficient — you can try deleting the block part underneath it and see if that helps.\
oohh, IT WORKS
thank you!!
You're welcome.
You can now change where the item appears by repositioning that folder. Feel free to adjust it to suit your model 😄
can i get the script? im currently making an entity similar to an item frame and id like to use it :]
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?
i can try! by the way, is there a way in blockbench to see how the items will be positioned? im trying to adjust the placement of the item but its not working
Can you show me a screenshot of the blockbench for the entity?
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.
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