From b2150f4dc3f8e605c6851d058a7622d0005aad9a Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Sun, 5 Feb 2023 09:03:05 +0100 Subject: [PATCH 1/6] Added IceWolf23's changes --- programs/survival/README.md | 12 +++++++++++- programs/survival/elytra_swap.sc | 17 +++++++++++++++++ programs/survival/mob_display_health.sc | 11 +++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 programs/survival/elytra_swap.sc create mode 100644 programs/survival/mob_display_health.sc diff --git a/programs/survival/README.md b/programs/survival/README.md index eaa5b4c7..e3862c3c 100644 --- a/programs/survival/README.md +++ b/programs/survival/README.md @@ -86,7 +86,11 @@ Various scripts that modify various game elements, often replicating popular mod you have a 1/50 chance of getting a wet sponge. Can be used to make renewable sponge without the use of lightning RNG manipulation, which in 1.14+ is impossible, hence the name easier_renweable_sponge. - + +### [elytra_swap.sc](https://github.com/gnembon/scarpet/blob/master/programs/survival/elytra_swap.sc): +#### By IceWolf23 + By right-clicking with an elytra or any chestplate this script will swap the items + ### [enchanting_table_bottling.sc](https://github.com/gnembon/scarpet/blob/master/programs/survival/enchanting_table_bottling.sc): #### By Firigion Shift right clicking on an enchanting table with an empty glass bottle consumes it and generates a @@ -164,6 +168,11 @@ Various scripts that modify various game elements, often replicating popular mod #### By Gnottero Allows the player to milk sheeps using a bucket. +### [mob_display_health.sc](https://github.com/gnembon/scarpet/blob/master/programs/survival/mob_display_health.sc): +#### By IceWolf23 + When a player hits any entity, the Mob Type is displayed with the remaining life (in HP) in the actionbar + + ### [nether_poi.sc](https://github.com/gnembon/scarpet/blob/master/programs/survival/nether_poi.sc): #### By Firigion When holding an ender eye, all nether portal points of interest will be shown with a marker. @@ -418,4 +427,5 @@ Various scripts that modify various game elements, often replicating popular mod Opsaaaaa Xendergo ch-yx + IceWolf23 (Many more hopefully!) diff --git a/programs/survival/elytra_swap.sc b/programs/survival/elytra_swap.sc new file mode 100644 index 00000000..2bc6469c --- /dev/null +++ b/programs/survival/elytra_swap.sc @@ -0,0 +1,17 @@ +// By right-clicking with an elytra or any chestplate this script will swap the items +// By: IceWolf23 + +global_swappable_items = {'netherite_chestplate','diamond_chestplate','iron_chestplate','golden_chestplate','chainmail_chestplate','leather_chestplate','elytra'}; + + +__on_player_uses_item(player, item_tuple, hand) -> ( + if ( hand == 'mainhand' && (inventory_get(player, 38)) != null, + if ( global_swappable_items:(item_tuple:0) != null, ( + playerArmorDressed = inventory_get(player, 38); + handSlot = query(player, 'selected_slot'); + + inventory_set(player, handSlot, 1, playerArmorDressed:0, playerArmorDressed:2); + inventory_set(player, 38, 1, item_tuple:0, item_tuple:2); + ) + ) +); diff --git a/programs/survival/mob_display_health.sc b/programs/survival/mob_display_health.sc new file mode 100644 index 00000000..2fe447d7 --- /dev/null +++ b/programs/survival/mob_display_health.sc @@ -0,0 +1,11 @@ +// When a player hits any entity, the Mob Type is displayed with the remaining life (in HP) in the actionbar +// By: IceWolf23 + +__on_player_deals_damage(player, amount, entity) -> ( + + entity_hp = entity ~ 'Health'; + _entityHealth = max(0, entity_hp-floor(amount)) + + text_string = (format('w '+entity)+format('g » ')+format('r '+_entityHealth+' ❤')); + display_title(player, 'actionbar', text_string); +); From 64b91f1fc7f61feed0bcb84c4c7d8c87cd4565db Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Sun, 12 Feb 2023 19:18:22 +0100 Subject: [PATCH 2/6] Removing excess brackets --- programs/survival/elytra_swap.sc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/survival/elytra_swap.sc b/programs/survival/elytra_swap.sc index 2bc6469c..f106573d 100644 --- a/programs/survival/elytra_swap.sc +++ b/programs/survival/elytra_swap.sc @@ -5,8 +5,8 @@ global_swappable_items = {'netherite_chestplate','diamond_chestplate','iron_ches __on_player_uses_item(player, item_tuple, hand) -> ( - if ( hand == 'mainhand' && (inventory_get(player, 38)) != null, - if ( global_swappable_items:(item_tuple:0) != null, ( + if ( hand == 'mainhand' && inventory_get(player, 38) != null, + if ( global_swappable_items:(item_tuple:0) != null, playerArmorDressed = inventory_get(player, 38); handSlot = query(player, 'selected_slot'); From 7dde40b81cecbece3b87e7c934b62ca242207b3f Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Sun, 12 Feb 2023 19:20:00 +0100 Subject: [PATCH 3/6] Updating map usage --- programs/survival/elytra_swap.sc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/programs/survival/elytra_swap.sc b/programs/survival/elytra_swap.sc index f106573d..16c3a0e8 100644 --- a/programs/survival/elytra_swap.sc +++ b/programs/survival/elytra_swap.sc @@ -5,13 +5,11 @@ global_swappable_items = {'netherite_chestplate','diamond_chestplate','iron_ches __on_player_uses_item(player, item_tuple, hand) -> ( - if ( hand == 'mainhand' && inventory_get(player, 38) != null, - if ( global_swappable_items:(item_tuple:0) != null, - playerArmorDressed = inventory_get(player, 38); - handSlot = query(player, 'selected_slot'); - - inventory_set(player, handSlot, 1, playerArmorDressed:0, playerArmorDressed:2); - inventory_set(player, 38, 1, item_tuple:0, item_tuple:2); - ) + if ( hand == 'mainhand' && inventory_get(player, 38) != null && has(global_swappable_items, item_tuple:0), + playerArmorDressed = inventory_get(player, 38); + handSlot = query(player, 'selected_slot'); + + inventory_set(player, handSlot, 1, playerArmorDressed:0, playerArmorDressed:2); + inventory_set(player, 38, 1, item_tuple:0, item_tuple:2); ) ); From 5001d8b5876a05077dac5ec0ec523ea218cf7d58 Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Sun, 12 Feb 2023 19:21:20 +0100 Subject: [PATCH 4/6] Added semicolon and fixed tabulation --- programs/survival/mob_display_health.sc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/programs/survival/mob_display_health.sc b/programs/survival/mob_display_health.sc index 2fe447d7..867a30dc 100644 --- a/programs/survival/mob_display_health.sc +++ b/programs/survival/mob_display_health.sc @@ -2,10 +2,9 @@ // By: IceWolf23 __on_player_deals_damage(player, amount, entity) -> ( - - entity_hp = entity ~ 'Health'; - _entityHealth = max(0, entity_hp-floor(amount)) + entity_hp = entity ~ 'Health'; + _entityHealth = max(0, entity_hp-floor(amount)); - text_string = (format('w '+entity)+format('g » ')+format('r '+_entityHealth+' ❤')); - display_title(player, 'actionbar', text_string); + text_string = (format('w '+entity)+format('g » ')+format('r '+_entityHealth+' ❤')); + display_title(player, 'actionbar', text_string); ); From d96aeaf0b080b995ae76dd2409dabf8f8a20c31f Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Sun, 12 Feb 2023 22:08:23 +0100 Subject: [PATCH 5/6] health not Health --- programs/survival/mob_display_health.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/survival/mob_display_health.sc b/programs/survival/mob_display_health.sc index 867a30dc..b657a583 100644 --- a/programs/survival/mob_display_health.sc +++ b/programs/survival/mob_display_health.sc @@ -2,7 +2,7 @@ // By: IceWolf23 __on_player_deals_damage(player, amount, entity) -> ( - entity_hp = entity ~ 'Health'; + entity_hp = entity ~ 'health'; _entityHealth = max(0, entity_hp-floor(amount)); text_string = (format('w '+entity)+format('g » ')+format('r '+_entityHealth+' ❤')); From 13df34e0b292d0df8f8e550a296018dd8089d603 Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Mon, 10 Apr 2023 17:57:45 +0200 Subject: [PATCH 6/6] Updated formatting --- programs/survival/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/survival/README.md b/programs/survival/README.md index 9be23383..51fe5b78 100644 --- a/programs/survival/README.md +++ b/programs/survival/README.md @@ -452,5 +452,5 @@ Various scripts that modify various game elements, often replicating popular mod Xendergo ch-yx Crec0 - IceWolf23 + IceWolf23 (Many more hopefully!)