#Preventing certain items from being put in containers

1 messages · Page 1 of 1 (latest)

stuck raft
#

Hello!
As the title says im trying to prevent certain items from being put in a container but unfortunately all of the methods i tried just let me put an item in the container and not take it out instead. If anyone knows a way to block an item from being put there in the first place please let me know

remote fern
#

im honestly not sure if its possible

lucid needle
remote fern
lucid needle
remote fern
lucid needle
remote fern
#

yea

#

i think that would be the best way

stuck raft
#

Alright ill try that tomorrow but i hoped there would be an easier way😭 😭 🙏

#

This seems like a very useful feature

#

Thanks guys

tepid ruinBOT
# stuck raft Thanks guys

Consider increasing someone's reputation with </reputation increase:1458495875985969212> if you found them to be helpful!

stuck raft
#

Ill let you know if it works

cedar obsidian
#

Look for click types or click actions whatever its called to check for shift click pr hotkey in

#

Also you might have to cancel the drop event for these items as i think hoppers were a headache

#

But idk you can give it a try

stuck raft
#

its prisoners vs guards so all players have adventure mode and cant place anny hoppers

#

and theres none on the map

stuck raft
# cedar obsidian Look for click types or click actions whatever its called to check for shift cli...

``on inventory click:
if event-inventory is not player's inventory:

    if click type is shift+lmb:
        set {_item} to clicked slot
        if {_item} is enchanted with curse of vanishing:
            set clicked slot to air
            send "&c&lDont put COV items in containers!" to player         
    else:
        set {_item} to cursor slot of player  
        if {_item} is enchanted with curse of vanishing:
            set cursor item of player to air # <--- this doesnt work
            send "&c&lDont put COV items in containers!" to player ``
#

this is what i currently have

#

it works pretty well outside of set cursor item of player to air not working and on shift+lmb it doesnt delete the item when its placed in the container but when the player tries to take it out of it

#

if you know any alternatives to set cursor item of player to air please let me know

cedar obsidian
#

Pretty sure ive only seen cursor slot not cursor item, but if thats also on the docs should work too

karmic mulch
#

this is how i handle this issue, most likely better ways, but this works for me

karmic mulch
karmic mulch
# stuck raft Ill try this later

here is the updated fix, also note this requires you to have a boolean nbt tag set on the item to deny it from being able to be moved

stuck raft
#

i gave up on checking when the item is put in a container and just decided to check when the players are taking it out

#

if event-inventory is not player's inventory: if group of player is not "appl" or "owner" or "coowner" or "community-manager" or "head-builder" or "sr.mod" or "dev" or "mod" or "builder": if click type is number key or shift+lmb: set {_item} to clicked slot if {_item} is enchanted with curse of vanishing: set clicked slot to air sendMessage(player, "<#FF8282>You can't put items with curse of vanishing in containers.") play sound "entity.villager.no" with pitch 0.6 to player else: set {_item} to clicked slot if {_item} is enchanted with curse of vanishing: set clicked slot to air sendMessage(player, "<#FF8282>You can't put items with curse of vanishing in containers.") play sound "entity.villager.no" with pitch 0.6 to player

#

ill try your version and if it works ill be glad to use it if you dont mind

karmic mulch
#

and yes you're free to use it

stuck raft
karmic mulch
#

multiple items have these tags so that's an all around workaround that affects all items how i want

stuck raft
#

I will probably modify your code because i only need them to not be transferable