clientcommands icon indicating copy to clipboard operation
clientcommands copied to clipboard

[Suggestion] `/clayout`

Open barraIhsan opened this issue 4 years ago • 2 comments

Requirement

  • Not in spectator mode

Syntax

/clayout (create|edit) block <x> <y> <z> <item_slot> <name> /clayout (create|edit) entity <entity> <item_slot> <name> /clayout (delete|preview) <name> /clayout load <name> [--drop-new-item] /clayout list

Arguments

item_slot

Must be a string notation that refers to certain slots in the inventory.

Slot Valid slot_child && slot_number
armor
armor.slot_child head, chest, legs, feet
weapon
weapon.slot_child mainhand, offhand
container
container.slot_child 0 - 53
enderchest
enderchest.slot_child
hotbar
hotbar.slot_child
inventory
inventory.slot_child
horse
horse.slot_child saddle, chest, armor, 0 - 14
~~villager~~
~~vilalger.slot_child~~ ~~0 - 7~~

name

Optional. The name of the layout

Description

create : Create a new layout from the items in item_slot edit : Edits a layout, replacing items in the layout with the items in item_slot delete : Deletes an existing layout. preview : Displays a item_slot with the items contained in the layout. load : Load a layout, new item (an item that not in the layout) will be ignored load --drop-new-item : Load a layout, new item (an item that not in the layout) will be dropped

Data

The data will be stored at .minecraft\config\clientcommands\layout.dat (Its also has the dat_old version for backup). And the structure looks like this (SNBT Format, Just like group.dat and kits.dat) :

{
	"DataVersion": <data_version>,
	"Layout": {
		"<name>": [
			{
				"source": "<item_slot>",
				"Slot": <slot_number>,
				"id": "<namespace>:<item_id>",
				"Count": <item_count>b,
				"tag": {
					<item_tag> (if exist)
				}
			}
		]
	}
}

What is the source for? It's for displaying the preview

Preview Layout

Click to see the preview layout

Temp Rule

There is also a new temp rule called createLayoutBeforeDeath. It will create a new layout (If index 0 exist, then the index is 1, etc.) death_armor_<index> death_weapon_<index> death_inventory_<index> death_hotbar_<index> before you die. So you can load them after you pick up all the items to organize back your inventory.

Usage + Video Example

You can create a layout and then load them. For example, you can create the layout before death. And after picking up all the items, you can load the layout to organize back your inventory.

Video Example (If you see this, I not yet record an updated video, it should be /clayout create entity @p inventory test instead of /clayout create @p inventory test

https://user-images.githubusercontent.com/57800056/137707651-b2010d78-0166-4ae8-bae8-d6580c4f2a85.mp4

Note: If you load a layout, it will take an item from your armor, weapon, inventory and hotbar

barraIhsan avatar Oct 18 '21 10:10 barraIhsan

So this is similar to the ckit command but it takes the items out of your inventory and rearranges them?

xpple avatar Nov 05 '21 11:11 xpple

yes, it is gonna useful for survival. So you don't have to layout your inventory back

barraIhsan avatar Nov 05 '21 22:11 barraIhsan