Forumskeyboard_arrow_right Communities keyboard_arrow_right Redstone

Create Forum Thread
1

Detecting if holding an item stops working after opening inventory

1 emeralds3 replies50 views
created 08/24/2019 10:32 pm by Swanlet
last reply 08/27/2019 4:35 am
So I created an item, and I want to make it so that if you are holding the item, you get one point, there is another command block that removes the point afterwards. so the command that gives the point is


/scoreboard players set @a[nbt={SelectedItem:{id:"minecraft:snowball",Count:1b,tag:{display:{Name:"{\"text\":\"Fox Launcher\",\"color\":\"dark_green\",\"bold\":true}"}}}}] FoxBallT 1

and the command to get the item it detects is

/give @p minecraft:snowball{display:{Name:"{\"text\":\"Fox Launcher\",\"color\":\"dark_green\",\"bold\":true}"}} 1


when holding the item, it works, however randomly, the item stops working, a bunch of things stop the item from being detected, for example, once you open your inventory when you hold the item it will no longer detect your holding it, even tho I did nothing to change it, also if you have a stack of the item it doesn't work which gets annoying. so does anyone know why this glitch is happening

I am using 1.14.3 minecraft
Posted by avatar
Swanlet
Level 3 : Apprentice Miner
1

comment Login or register to post a reply.

3 replies

1
08/26/2019 3:54 am
Level 9 : Apprentice Modder
HoboMaggot
Its because the score is gaining and taking 1 point at the same tick, so its literally like 1-1=0.

A way to fix this is to give yourself a timer which goes up forever but, if reaches a certain tick, initiates other commands. Once you put the item away, it resets that timer.

Also it doesn't detect partly because you put Count=1b, which means its only looking for 1 item.
1
08/26/2019 7:41 am
Level 3 : Apprentice Miner
Swanlet
The count=1B thing works, but all of the important commands are between the one that gives you the point and the one that resets it, and I also removed the command that resets it and it still wasn't working, it seems after opening your inventory the item changes in some way which makes it un detectable
1
08/27/2019 4:35 am
Level 9 : Apprentice Modder
HoboMaggot
Inventory shouldn't work like that, otherwise custom items wouldnt work. Can you give me all (most) commands related with these set of commands?

Also to elaborate, Count=1b makes the command Only Detect 1 item, not a stack!

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome