1

HELP with designing an inventory space limiter (Minecraft 1.15.2)

Panda Masala's Avatar Panda Masala2/24/22 10:22 pm history
1 emeralds 377 4
3/15/2022 7:45 pm
Panda Masala's Avatar Panda Masala
Hi,

I've been trying to work on a commandblock system (though a datapack could work as well but I'm new to those) that limits a player's inventory slots, but upon obtaining certain items more inventory slots would be unlocked.

My current set-up involves:

Use a non-stackable item (saddle), give them a custom tag, use a command sub-setup that makes players unable to throw items with the custom tag.

This does work- but I was wondering, could anyone help me make it so:
  • The player may not move the saddles to different slots
  • The player can't transfer the saddles to chests or e-chests
I've tried tinkering around with the /replaceitem command, and while this does achieve the slot-locking effect, it comes with some dangerous downsides:
  • When players click on the saddles to change the slot value, the slot updates back to saddle but the saddle the player has clicked on still remains in the player's selection. This allows saddle duping and things get messy from there.
  • When a player has an item already clicked, and then attempts to replace a saddle with another item, that item then gets deleted. I'm making an adventure map with key items that shouldn't ever be deleted.
Anyone have any ideas?
Posted by Panda Masala's Avatar
Panda Masala
Level 34 : Artisan Bear
13

Create an account or sign in to comment.

4

sigstop
03/09/2022 5:39 pm
Level 2 : Apprentice Miner
sigstop's Avatar
Surely you know that you can check if your item is in slot X, by using @a[​nbt={Inventory:[{Slot:Xb,tag:{these_custom_tags_that_you_have:1b}}]}]?
Why don't then clear player from item that would be missing from its slot? (as most probably player would just picked it up/clicked it)
/clear command works (or at least worked) also on items that were held under your cursor, so by using it you can largely reduce dupping.

As for placing some key item that you would like to not override by /replaceitem command I have two sugesstions:
1. Move to more recent versions, where /replaceitem was upgraded to /item, and using it copy precious item to some chest, (in enventory) overide it, and then give it back
2. The same thing as 1. but with /data modify as replacement to moving item by /item
3
Panda Masala
03/14/2022 5:50 pm
Level 34 : Artisan Bear
Panda Masala's Avatar
My issue is that there are too many key items that a player must not clear from their inventory. So I can't do a repeating command that does /replaceitem to make the certain slots permanently locked, or else the item a player swaps with the saddle will be deleted. I would need an if/unless statement for each key item, which is just too much.

The chest thingy you described only works for singleplayer so far as I know, but i need the map to be multiplayer for the sake of playing the final version with a friend of mine.

Also, unfortunately due to an essential datapack only being compatible with 1.15, I can't upgrade the version.

Thank you for the ideas though. I'm still brainstorming ideas on how I can solve this
1
sigstop
03/15/2022 2:51 pm
Level 2 : Apprentice Miner
sigstop's Avatar
Hmmm Im sure if you do the chest thingy inside a function it will be multiplayer compatible, entire backbone one of my maps depends on that, maybe I should ask a friend to make sure it works...

Also, dont fret on creating tedious to write contraptions, always think on how to automate them to just write repeating part once and do some magic to generate billion of them. I cant persuade you for writing a some more sophisticated command generator, but sprite spreadsheets are sufficient. In them just create some columns with data that changes between commands, and use concatenation/text merging function. Then copy column filled with finished commands to function file.

Although its separate issue, does this essential datapack really holds you back? Are you sure you cant rewrite it for newest version, or ask someone for it?
2
Panda Masala
03/15/2022 7:45 pm
Level 34 : Artisan Bear
Panda Masala's Avatar
Wow I never thought of using a spreadsheet to serve as my own customized command generator that's actually a great idea- thanks! Yes, the datapack is really essential because it adds a working gun system that I've mastered and learned how to tinker (I haven't found any gun datapacks that work the way this one does).

The good news though is I was goofing around on a singleplayer server with some inventory commands and I realized I solved my problem with something so ridiculously simple. All I had to do was to give the player maximum slowness and send them a message about their inventory in order to stop them from trying to cheat or reorganize. Thank you though again for the feedback.
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome