#(l3technosm) How to give item with can_place_on set?

47 messages · Page 1 of 1 (latest)

light cradle
#

What is the proper Denizen way of doing this comment

- execute as_server "give <player.name> minecraft:campfire[minecraft:can_place_on={blocks:'gravel'}]"

sly jewelBOT
#

(l3technosm) How to give item with can_place_on set?

sly jewelBOT
#

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.

versed rain
#

!m can_place_on

drifting monolithBOT
# versed rain !m can_place_on

Sets the materials this item can be placed on while in adventure mode.
Leave empty to remove this property.

Object

ItemTag

Input

ListTag(MaterialTag)

Tags

<ItemTag.can_place_on> Returns a list of materials this item can be placed on while in adventure mode, if any.

rich night
#
  1. 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

drifting monolithBOT
# rich night !c give
Group

item

Syntax

give [<item>|...] (quantity:<#>) (unlimit_stack_size) (to:<inventory>) (slot:<slot>) (allowed_slots:<slot-matcher>) (ignore_leftovers)

Short Description

Gives the player an item or xp.

Description

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...

light cradle
#

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.

rich night
# drifting monolith
  1. 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]

light cradle
#

give item:campfire[can_place_on=gravel] super thank you!

rich night
#

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

drifting monolithBOT
# rich night !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

...

Group

Script Container System

rich night
#

If you have any other questions, feel free to ask here. Otherwise,

eager skyBOT
#
Thread Closing Reminder

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

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
rich night
#

Both of these worked for me, could you run a debug so I can see if there was some kind of internal issue?

#

!debug

drifting monolithBOT
# rich night !debug
Info: 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!

light cradle
rich night
#

Do you have a components_patch category in there also?

light cradle
#

I also tried running the give command directly with this debug session: https://paste.denizenscript.com/View/133317

#

Do you have a components_patch category in there also?
I do not understand the question.

rich night
drifting monolithBOT
# rich night !logcheck https://paste.denizenscript.com/View/133317
Server Version

CraftBukkit version 4480-Spigot-e339edc-a6012a1 (MC: 1.21.5)

Plugin Version(s)

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)

Checked For

@rich night

UUID Version

0 (:triangular_flag_on_post: Hacked or Invalid ID)

Java Version

24 :warning: - Only Java versions 21 or 17 are fully supported (or 8 for legacy Minecraft)

Other Noteworthy Plugin(s)

WorldGuard: 7.0.13+82fdc65

Problematic Plugin(s)

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)

Possibly Relevant Plugin(s)

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.

rich night
#

Could you try updating to the latest denizen dev build to see if this fixes it?

#

!update denizen

drifting monolithBOT
light cradle
#

Trying that now.

rich night
#

Doesn't look like it worked, correct?

light cradle
#

Correct, same results.

#

I am in adventure mode.

#

Note: my steps for testing:

  1. gamemode adventure
  2. denizen commands per your recommendation: give campfire2 and I also try the command as a oneshot: give campfire[can_place_on=gravel]
  3. Attempt to place either campfire on gravel.
  4. Run the vanilla command from the original post
  5. 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.

rich night
#

It may be a weird 1.21.5 bug, I'll mark it as one until a dev can come and and clarify

eager skyBOT
#
Changed to Bug

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.

light cradle
#

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)

red leaf
#

Should be fixed ref #commit-log message

eager skyBOT
#
Thread Closing Reminder

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