#How do i make my item only placeable on specific blocks?

1 messages · Page 1 of 1 (latest)

indigo owl
#

on join:
give player lever

#

I want to make the lever placeable for example on a dirt block but i have no idea how

amber coral
#

First you can just do on join give player lever

indigo owl
#

No? I don't wanna give all players a lever only the player who joined

amber coral
#

Ik...

#

Player is the event player no need for event player

indigo owl
#

oh i'll just change it ig

amber coral
#

Also try the on place event

indigo owl
#

It's gotta work with adventure mode

amber coral
#

Then maybe

#

Do a right clicl event and if the clicked block is dirt and player is holding lever it places a lever at the location

indigo owl
#

on right-click with lever:
if right-clicked block is dirt:
place lever at location
else:
cancel event

#

Uh what

full tartan
#

like the can be placed on or can break?

indigo owl
full tartan
#

and you still arent using code blocks

#

```code here```

amber coral
#

d/d

indigo owl
#

I'll just use console

amber coral
full tartan
#

a google search yielded this:/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["stone"]}} /give @p diamond_block 1 0 {"minecraft:can_place_on":{"blocks":["stone"]}}i guess use skbee and NBT to apply them

indigo owl
#

make console execute command "give %player% stone{CanPlaceOn:["minecraft:grass","minecraft:dirt"]}"

#

i tried this but it didn't work for some weird reason?

full tartan
#

umm

#

because thats not how NBT works

indigo owl
#

I don't know 😭

full tartan
#

you literally skipped half the syntax

#

i would use skbee though

#

console commands are a crude shortcut

indigo owl
#

I already have skbee but i have no idea to how to use nbts

#

still gives an error

full tartan
#

cause you have quotes in the command

full tartan
spare aspen
# indigo owl I already have skbee but i have no idea to how to use nbts

You don't need console cmds for nbt if you have skbee
give player lever with nbt from "insert nbt here"

Also, any text within quotations is a string. When you want quotations inside the string (quotations within quotations), you need to double the quotations inside the quotations.
Quotations.
Example:
I want to broadcast this string with quotation marks inside of it.
broadcast "the npc said, "poo""
Doubling the quotation marks in the string:
broadcast "the npc said, ""poo"""
Notice the outer quotations are not doubled

full tartan
#

you need to double " % #

spare aspen
#

That too

magic mauve
magic mauve