#(l3technosm) How to give item with can_place_on set?
47 messages · Page 1 of 1 (latest)
(l3technosm) How to give item with can_place_on set?
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
!m can_place_on
Sets the materials this item can be placed on while in adventure mode.
Leave empty to remove this property.
ItemTag
ListTag(MaterialTag)
<ItemTag.can_place_on> Returns a list of materials this item can be placed on while in adventure mode, if any.
- You shouldn't be using "execute" to run default Minecraft commands, as there is usually an option to do that within denizen. In this case,
!c give
item
give [<item>|...] (quantity:<#>) (unlimit_stack_size) (to:<inventory>) (slot:<slot>) (allowed_slots:<slot-matcher>) (ignore_leftovers)
Gives the player an item or xp.
Gives the linked player items.
Optionally specify a slot to put the items into. If the slot is already filled, the next available slot will be used.
If the inventory is full, the items will be dropped on the ground at the inventory's location.
For player inventories, only the storage contents are valid - to equip armor or an offhand item, use !command equip.
Specifying "unlimit_stack_size" will allow an item to stack up to 64. This is useful for stacking items
with a max stack size that...
I am not sure how to weave that into a give command. Perhaps my question is: how do I set a mechanism while using the give command. I also tried making a custom item and giving that custom item. However the can_place_on from the mechanism in the customer item didnt seem to translate thru.
- Mechanisms, like this one, are attached in [] after the item name in the "give" command to apply them
For example: - give stone[can_place_on=stone]
give item:campfire[can_place_on=gravel] super thank you!
If you're using it in an item script, make sure that because it's a mechanism, it's under the "mechanisms" subcategory of that script and not under the item directly
!l item script containers
Item script containers are an easy way to pre-define custom items for use within scripts. Item
scripts work with the ItemTag object, and can be fetched with the Object Fetcher by using the
ItemTag constructor ItemTag_script_name. Example: - drop <player.location> super_dooper_diamond
The following is the format for the container. Except for the 'material' key (and the dScript
required 'type' key), all other keys are optional.
# The name of the item script is the same name that you can use to construct a new
# ItemTag based on this item script. For example, an item script named 'sword_of_swiftness'
# can be referred to as simply 'sword_of_swiftness'.
Item_Script_Name:
type: item
# Must be a valid ItemTag. See 'ItemTag' for more information.
# | All item scripts MUST h
...
Script Container System
If you have any other questions, feel free to ask here. Otherwise,
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@light cradle
Thank you so much for the help. I appreciate it. Note: when I tried the custom item, here is what didnt work:
campfire2:
type: item
material: campfire
mechanisms:
can_place_on: gravel
I also tried can_place_on as a list:
campfire2:
type: item
material: campfire
mechanisms:
can_place_on:
- gravel
Both of these worked for me, could you run a debug so I can see if there was some kind of internal issue?
!debug
If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!
Content of Server Log Paste #133316: Denizen Debug Logs From Where Scouting meets Minecraft BETA TESTING... pasted 2025/05/10 10:20:53 UTC-07:00, Paste length: 2021 characters across 24 lines, Content: `Java Version: 24 Up-time: 11d 20h Denizen Version: Core: 1.91.0-SNAPSHOT (Build 1397), Spigot: 1.3.1-SNAPSHOT (bui...
Do you have a components_patch category in there also?
I also tried running the give command directly with this debug session: https://paste.denizenscript.com/View/133317
Content of Server Log Paste #133317: Denizen Debug Logs From Where Scouting meets Minecraft BETA TESTING... pasted 2025/05/10 10:22:12 UTC-07:00, Paste length: 1750 characters across 23 lines, Content: `Java Version: 24 Up-time: 11d 20h Denizen Version: Core: 1.91.0-SNAPSHOT (Build 1397), Spigot: 1.3.1-SNAPSHOT (bui...
Do you have a components_patch category in there also?
I do not understand the question.
Content of Server Log Paste #133317: Denizen Debug Logs From Where Scouting meets Minecraft BETA TESTING... pasted 2025/05/10 10:22:12 UTC-07:00, Paste length: 1750 characters across 23 lines, Content: `Java Version: 24 Up-time: 11d 20h Denizen Version: Core: 1.91.0-SNAPSHOT (Build 1397), Spigot: 1.3.1-SNAPSHOT (bui...
CraftBukkit version 4480-Spigot-e339edc-a6012a1 (MC: 1.21.5)
Citizens: 2.0.38-SNAPSHOT (build 3780) -- (Outdated build, behind by 12)
Denizen: 1.3.1-SNAPSHOT (build 7154-DEV) -- (:warning:Outdated build, behind by 15)
Depenizen: 2.1.1 (build 874) -- (Outdated build, behind by 6)
@rich night
0 (:triangular_flag_on_post: Hacked or Invalid ID)
24 :warning: - Only Java versions 21 or 17 are fully supported (or 8 for legacy Minecraft)
WorldGuard: 7.0.13+82fdc65
Geyser-Spigot: 2.7.0-SNAPSHOT - Bedrock clients are unsupportable. Please do all testing with a Java Edition client.
floodgate: 2.2.4-SNAPSHOT (b116-0e3163c)
ViaVersion: 5.3.1 - Mixed client vs server versions can sometimes cause packet-related issues.
Multiverse-Core: 4.3.16 - Multi-world configuration plugins may affect NPCs in unexpected ways.
Could you try updating to the latest denizen dev build to see if this fixes it?
!update denizen
Latest Denizen stable release builds are at https://ci.citizensnpcs.co/job/Denizen/. Most users should download the stable release build.
Latest Denizen dev builds are at https://ci.citizensnpcs.co/job/Denizen_Developmental/. Dev builds are for usually for test servers only.
Spigot resource page for Denizen is at https://www.spigotmc.org/resources/denizen.21039/ (do NOT download builds from Spigot).
Trying that now.
Content of Server Log Paste #133318: Denizen Debug Logs From Where Scouting meets Minecraft BETA TESTING... pasted 2025/05/10 10:28:46 UTC-07:00, Paste length: 1735 characters across 23 lines, Content: `Java Version: 24 Up-time: 1m 44s Denizen Version: Core: 1.91.0-SNAPSHOT (Build 1398), Spigot: 1.3.1-SNAPSHOT (buil...
Doesn't look like it worked, correct?
Correct, same results.
I am in adventure mode.
Note: my steps for testing:
- gamemode adventure
- denizen commands per your recommendation: give campfire2 and I also try the command as a oneshot: give campfire[can_place_on=gravel]
- Attempt to place either campfire on gravel.
- Run the vanilla command from the original post
- Attempt to place the vanilla campfire on the gravel.
So far each time 3 fails, and 5 succeeds.
Notes: the campfires are given. They cannot be placed.
I wonder if can_place_on needs to be a list?
after each test, I throw away the campfires for a fresh test.
Shouldn't be, I gave you the exact command I used originally
It may be a weird 1.21.5 bug, I'll mark it as one until a dev can come and and clarify
Thread is now a Bug thread. This indicates a core code bug that a developer must resolved, not an error message or other support topic. Please do not misuse the Bug label. Use </helpthread:1028674284870180883> to switch the thread back to a normal help thread if you are not 100% confident it is a code bug.
I tried the give stone[can_place_on=stone] command from earlier just now, and while in adventure mode, I cannot place on stone (nor any other block)
Should be fixed ref #commit-log message
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@light cradle