Command /replaceitem with commandblocks is bugged
I have a machine that detects if an Item is taken out of a specific slot in the inventory and replace it with the same item soon after it was taken out of the inventory. It is for an Inventory menu that does certain thing when you click/remove items in your Inevtory.
The problem now is that you cannot click the same item twice in a row because it wont fill the slot again. It works perfectly fine when I click different items.
How to reproduce the bug: Build a Commandblock attached to a clock with
/testfor @a[team=Inventorymenu] {Inventory:[{Slot:9b}]}
and attach it to a solid block via comparator. Put a redstone torch on the other side. Place a repeater with 1 tick delay at the torch and attatch another commandblock to it with
/replaceitem entity @a[team=Inventorymenu] slot.inventory.0 golden_apple 1 0 {display:{Name:"Teleport to Admin Launch",Lore:[Destroy item to change setting]}}
then put another repeater down that points at the 2nd commandblock and give it a button to activiate.
If you now put a golden apple in the top left corner of your Inventory and move it to a different slot another apple will spawn in the top left corner. Now take the apple away immediately after it spawns and it wont respawn. The /testfor cmdblock will act like the apple was still there even though it should be updated every few ticks by the clock.
And the even more weird thing is that if you press the button to activate the /replaceitem cmdblock now nothing will happen. No apple. The only solution is to plac an apple manually in the top left to "reload" it I guess.
I made a screenshot to show you how to build the machine.
And please mind that I have a scoreboard team set. This is necessary to reproduce the bug since it doesn't apper without the team filter (team=Inventorymenu). The tester has to be in that team.
I hope I could help and you can fix this ![]()
P.S.
Unfortunately your uoload function didn't work so I uploaded the screenshot to imgur
Environment
Java 1.8.0_31, Windows 7, OptiFine installed , Craftbukkit Server
Created Issue:
Command /replaceitem with commandblocks is bugged
I have a machine that detects if an Item is taken out of a specific slot in the inventory and replace it with the same item soon after it was taken out of the inventory. It is for an Inventory menu that does certain thing when you click/remove items in your Inevtory.
The problem now is that you cannot click the same item twice in a row because it wont fill the slot again. It works perfectly fine when I click different items.
How to reproduce the bug: Build a Commandblock attached to a clock with
/testfor @a[team=Inventorymenu] {Inventory:[
{Slot:9b}]}
and attach it to a solid block via comparator. Put a redstone torch on the other side. Place a repeater with 1 tick delay at the torch and attatch another commandblock to it with
/replaceitem entity @a[team=Inventorymenu] slot.inventory.0 golden_apple 1 0 {display:{Name:"Teleport to Admin Launch",Lore:[Destroy item to change setting]}}
then put another repeater down that points at the 2nd commandblock and give it a button to activiate.
If you now put a golden apple in the top left corner of your Inventory and move it to a different slot another apple will spawn in the top left corner. Now take the apple away immediately after it spawns and it wont respawn. The /testfor cmdblock will act like the apple was still there even though it should be updated every few ticks by the clock.
And the even more weird thing is that if you press the button to activate the /replaceitem cmdblock now nothing will happen. No apple. The only solution is to plac an apple manually in the top left to "reload" it I guess.I made a screenshot to show you how to build the machine.
And please mind that I have a scoreboard team set. This is necessary to reproduce the bug since it doesn't apper without the team filter (team=Inventorymenu). The tester has to be in that team.I hope I could help and you can fix this
P.S.
Unfortunately your uoload function didn't work so I uploaded the screenshot to imgurEnvironment
Java 1.8.0_31, Windows 7, OptiFine installed , Craftbukkit Server
I have a machine that detects if an Item is taken out of a specific slot in the inventory and replace it with the same item soon after it was taken out of the inventory. It is for an Inventory menu that does certain thing when you click/remove items in your Inevtory.
The problem now is that you cannot click the same item twice in a row because it wont fill the slot again. It works perfectly fine when I click different items.
How to reproduce the bug: Build a Commandblock attached to a clock with
/testfor @a[team=Inventorymenu] {Inventory:[
{Slot:9b}]}
and attach it to a solid block via comparator. Put a redstone torch on the other side. Place a repeater with 1 tick delay at the torch and attatch another commandblock to it with
/replaceitem entity @a[team=Inventorymenu] slot.inventory.0 golden_apple 1 0 {display:{Name:"Teleport to Admin Launch",Lore:[Destroy item to change setting]}}
then put another repeater down that points at the 2nd commandblock and give it a button to activiate.
If you now put a golden apple in the top left corner of your Inventory and move it to a different slot another apple will spawn in the top left corner. Now take the apple away immediately after it spawns and it wont respawn. The /testfor cmdblock will act like the apple was still there even though it should be updated every few ticks by the clock.
And the even more weird thing is that if you press the button to activate the /replaceitem cmdblock now nothing will happen. No apple. The only solution is to plac an apple manually in the top left to "reload" it I guess.I made a screenshot to show you how to build the machine.
And please mind that I have a scoreboard team set. This is necessary to reproduce the bug since it doesn't apper without the team filter (team=Inventorymenu). The tester has to be in that team.I hope I could help and you can fix this
P.S.
Unfortunately your uoload function didn't work so I uploaded the screenshot to imgurI have a machine that detects if an Item is taken out of a specific slot in the inventory and replace it with the same item soon after it was taken out of the inventory. It is for an Inventory menu that does certain thing when you click/remove items in your Inevtory.
The problem now is that you cannot click the same item twice in a row because it wont fill the slot again. It works perfectly fine when I click different items.
How to reproduce the bug: Build a Commandblock attached to a clock with
/testfor @a[team=Inventorymenu] {Inventory:[{Slot:9b}]}and attach it to a solid block via comparator. Put a redstone torch on the other side. Place a repeater with 1 tick delay at the torch and attatch another commandblock to it with
/replaceitem entity @a[team=Inventorymenu] slot.inventory.0 golden_apple 1 0 {display:{Name:"Teleport to Admin Launch",Lore:[Destroy item to change setting]}}then put another repeater down that points at the 2nd commandblock and give it a button to activiate.
If you now put a golden apple in the top left corner of your Inventory and move it to a different slot another apple will spawn in the top left corner. Now take the apple away immediately after it spawns and it wont respawn. The /testfor cmdblock will act like the apple was still there even though it should be updated every few ticks by the clock.
And the even more weird thing is that if you press the button to activate the /replaceitem cmdblock now nothing will happen. No apple. The only solution is to plac an apple manually in the top left to "reload" it I guess.I made a screenshot to show you how to build the machine.
And please mind that I have a scoreboard team set. This is necessary to reproduce the bug since it doesn't apper without the team filter (team=Inventorymenu). The tester has to be in that team.I hope I could help and you can fix this
P.S.
Unfortunately your uoload function didn't work so I uploaded the screenshot to imgur
duplicates


I am sorry to say that, but this is probably not a Minecraft bug.
There are some problems with your invention:
How to fix the problems:
Fix: (note that these are example commands)
/scoreboard players set @a[score_Test=0,team=Inventorymenu] Test 1 {Inventory:[{Slot:9b}]}/replaceitem entity @a[score_Test=0,team=Inventorymenu] slot.inventory.0 golden_apple 1 0 {display:{Name:"Teleport to Admin Launch",Lore:[Destroy item to change setting]}}You can of course give the scoreboard objective another name and also let the fillclock face in another direction. The only important thing to know is that the Minecraft always updates from negative to positive coordinates so you have to keep the order of the command blocks.
You could also add a command block after the third one, which does for example:
/tellraw @a[score_Test=0,team=Inventorymenu] {text:"",extra:[{text:"You clicked that "},{text:"golden apple",color:gold,bold:true,hoverEvent:{action:show_item,value:"{id:golden_apple,tag:{display:{Name:Teleport to Admin Launch,Lore:[Destroy item to change setting]}}}"}},{text:"!"}]}I tested it over and over in all variations and it is a bug. Thats why I report it here ^^
The "Attach file" function is in no way broken...
It didn't work for me. Was stuck for ages and had a text saying "stalled"
Maybe this will make more clear what the actual bug is.
I enabeled commandblockoutput and went in a singleplayer world so lag is not an option anymore.
Here you can see, the 1st cmdblock detects that I have an item in the top left slot even though I have none.

As prove that the cmdblock is spamming "Found Ziron5" another screenshot where you can see the notification from the first screenshot.

In this third screensot I presses the button and you can see the block says it placed a golden apple into the 9th slot (top left). But there is still no item...

I am not an expert but I think the game sorta "thinks" the item is still there and therefore does nothing when you want to get that exact item.
Client/server inventory desync. The item is still there, but the client doesn't think it is. Btw, the game runs as a separate server & client even in singleplayer.
I found a workaround to "resychronisize" them. At least is works for my machine. Evertime a slot gets emptyed a commanblock runs
... and it works properly. Maybe thats a way for mojang devs to fix this.
This report is probably invalid. Like I said your clock is too slow, so it can happen, that a player removes the apple, the testfor command detects that, gives the player the apple, but when the player now remove the apple before the clock runs the testfor command again, it still won't find that apple but as the repeater is still off and the torch on, the player won't recieve a new apple...
That doesn't have to do anything with the clock speed besides that I tried it with a 1 tick clock. Just look at the screenshots it is a bug 100% proven or why yould it say it have me an apple and when I took into my inventpry there is none?
Try exiting the world and rejoining. The item will be in the slot. The underlying issue is
MC-29318: If the player modifies their inventory at the same time at something server-side does, the client will miss the update, and the server won't send it out again. Replacing an item in a slot with the same item doesn't trigger a new update, but if the player moves something to that slot, it has to resychronize.Sorry you are probably right Simon mueller. But I would suggest using a fast clock instead