I need a command that will give a player in adventure mode a slab that is infinite and can be placed on a certain block.
For example, when a player in gamemode 2 places a slab on the desired block, the block will stay in their inventory. I don't want to have a repeating command constantly giving them slabs or stacks of 64. I want just the one slab to be infinate. Sorry i can't explain well
Such a thing doesn't exist, most certainly not in vanilla. See: when in creative its not so much the items which are "infinite" but more so the gamemode which the player is using that doesn't use up any items upon placing. Your only option here is to rely on commandblocks.
It didn't work. I kept giving me stacks of slabs which the max can be 1. I am making a map that includes the player to pick a wooden slab (of all types) and when they place it on the CanPlaceOn block, it stays with them (infinite)
What do you know... I stand corrected on my first post: this whole thing can easily be achieved in a function (so without any commandblocks)
I was looking for a way to resolve the issue of players using the offhand, which is tricky because you'd need the command chain to fork a bit: so test if a player has slabs in his offhand and if so replace those, but if not continue with what I have above. Not easily done with command blocks but somewhat easily done with functions (more or less).
Then the above hit me: my command structure already made this code independent
Create a new directory in data/functions, I suggest something like "infslab". Then add 3 files:
And there you go. Infinite slabs, fully independent of any command block. But... with the small caveat that if players start placing slabs using their offhand then they'll be able to duplicate those slabs.
I suppose you could counteract this by telling your players that they should only place those slabs using the offhand, then change the code above accordingly (change mainhand into offhand). It might even add an extra challenge because players would have to carefully read in order not to get stuck in your game.
Food for thought?
Sorry for the horrible layout above, I tried, but this forum editor is pretty much the worst there is and someone I seriously wonder why I even bother.