Last active
October 25, 2023 06:33
-
-
Save szdytom/258f4ce93445a062f0d4488bafca4b0d to your computer and use it in GitHub Desktop.
A Minecraft scarpet script that allow to operator shulker boxes without placing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__config() -> { | |
'scope' -> 'global', | |
}; | |
global_shulker_boxes = { | |
'shulker_box', | |
'white_shulker_box', | |
'orange_shulker_box', | |
'magenta_shulker_box', | |
'light_blue_shulker_box', | |
'yellow_shulker_box', | |
'lime_shulker_box', | |
'pink_shulker_box', | |
'gray_shulker_box', | |
'light_gray_shulker_box', | |
'cyan_shulker_box', | |
'purple_shulker_box', | |
'blue_shulker_box', | |
'brown_shulker_box', | |
'green_shulker_box', | |
'red_shulker_box', | |
'black_shulker_box' | |
}; | |
__on_player_uses_item(myself, item, hand) -> ( | |
if(hand == 'mainhand' && has(global_shulker_boxes, str(item:0)), ( | |
sslot = query(myself, 'selected_slot'); | |
itemtags = item:2; | |
itemname = item:0; | |
itemSet = [false]; | |
scr = create_screen(myself, 'shulker_box', item_display_name(item) | |
, _(outer(itemtags), outer(itemname), outer(sslot), outer(itemSet) | |
, scr, me, action, data) -> ( | |
if(action == 'close' || (action == 'slot_update' && itemSet:0), ( | |
if(itemtags == null, itemtags = nbt('{}')); | |
put(itemtags, 'BlockEntityTag.Items', '[]'); | |
cnt = 0; | |
c_for(i = 0, i < 27, i += 1, ( | |
c = inventory_get(scr, i); | |
if(c != null, ( | |
inbt = nbt(str('{Slot: %db, Count: %db, id: "%s"}', i, c:1, c:0)); | |
if(c:2 != null, put(inbt, 'tag', c:2)); | |
put(itemtags, 'BlockEntityTag.Items', inbt, cnt); | |
cnt += 1; | |
)) | |
)); | |
inventory_set(me, sslot, 1, itemname, itemtags); | |
//if(query(me, 'health') <= 0, drop_item(me, sslot)) | |
)); | |
if(has(global_shulker_boxes, inventory_get(scr, data:'slot'):0), | |
return('cancel'); | |
); | |
)); | |
shulker_inv = itemtags:'BlockEntityTag.Items'; | |
if(shulker_inv != null, ( | |
c_for(i = 0, has(shulker_inv, '['+i+']'), i += 1, ( | |
shulker_i = shulker_inv:('['+i+']'); | |
inventory_set(scr, shulker_i:'Slot', shulker_i:'Count' | |
, shulker_i:'id', shulker_i:'tag'); | |
)) | |
)); | |
itemSet:0 = true; | |
)); | |
null | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment