1

Detecting if holding an item stops working after opening inventory

Swanlet's Avatar Swanlet8/24/19 10:32 pm
1 emeralds 198 3
8/27/2019 4:35 am
HoboMaggot's Avatar HoboMaggot
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 Swanlet's Avatar
Swanlet
Level 38 : Artisan Miner
10

Create an account or sign in to comment.

3

1
08/26/2019 3:54 am
Level 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
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 38 : Artisan Miner
Swanlet
Swanlet's Avatar
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 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
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

Website

© 2010 - 2024
www.planetminecraft.com

Welcome