forked from Gamemode4Dev/GM4_Datapacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix: Make destroying custom carts drop the correct item (Gamemode4…
…Dev#951) - fixes liquid minecarts and tunnel bores - ender hopper minecarts seemed to not be affected
- Loading branch information
Showing
8 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
..._minecarts/overlay_26/data/gm4_liquid_minecarts/functions/machine/destroy_cart.mcfunction
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# destroys the liquid_minecart | ||
# @s = liquid_minecart marker | ||
# located at @s | ||
# run from gm4_liquid_minecarts:machine/verify_destroy | ||
|
||
# drop item | ||
scoreboard players set $dropped_item gm4_machine_data 0 | ||
execute as @e[type=item,distance=..3,nbt={Age:0s,Item:{id:"minecraft:minecart",Count:1b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}},limit=1,sort=nearest] at @s run function gm4_liquid_minecarts:machine/destroy_cart/drop_item | ||
|
||
# scan hoppers if no item was broken | ||
execute if score $dropped_item gm4_machine_data matches 0 run function gm4_liquid_minecarts:machine/destroy_cart/scan_hoppers | ||
|
||
# kill marker | ||
kill @s |
39 changes: 39 additions & 0 deletions
39
...erlay_26/data/gm4_liquid_minecarts/functions/machine/destroy_cart/scan_hoppers.mcfunction
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# searches for hoppers with invalid items | ||
# @s = liquid_minecart marker | ||
# located at @s | ||
# run from gm4_liquid_minecarts:machine/destroy_cart | ||
|
||
# find hopper with the invalid item | ||
scoreboard players set $found_item gm4_machine_data 0 | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~00 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~00 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~00 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~00 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~00 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~00 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~00 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~00 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~00 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
|
||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-1 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-1 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-1 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-1 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-1 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-1 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-1 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-1 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-1 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
|
||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-2 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-2 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-2 ~00 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-2 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-2 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-2 ~01 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~00 ~-2 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~01 ~-2 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
execute if score $found_item gm4_machine_data matches 0 positioned ~-1 ~-2 ~-1 if block ~ ~ ~ hopper{Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]} run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper | ||
|
||
# if no hoppers found, find hopper minecarts with the invalid item | ||
execute if score $found_item gm4_machine_data matches 0 as @e[type=hopper_minecart,distance=..3,nbt={Items:[{id:"minecraft:minecart",tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}]}] run function gm4_liquid_minecarts:machine/destroy_cart/update_hopper_minecart |
16 changes: 16 additions & 0 deletions
16
...rlay_26/data/gm4_liquid_minecarts/functions/machine/destroy_cart/update_hopper.mcfunction
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# updates hoppers with invalid items | ||
# @s = liquid_minecart marker | ||
# located at the hopper with an invalid item | ||
# run from gm4_liquid_minecarts:machine/destroy_cart/scan_hoppers | ||
|
||
# replace correct slot with proper item | ||
data modify storage gm4_machines:temp Items set from block ~ ~ ~ Items | ||
execute if data storage gm4_machines:temp Items[{Slot:0b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace block ~ ~ ~ container.0 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:1b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace block ~ ~ ~ container.1 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:2b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace block ~ ~ ~ container.2 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:3b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace block ~ ~ ~ container.3 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:4b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace block ~ ~ ~ container.4 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
|
||
# clean up | ||
data remove storage gm4_machines:temp Items | ||
scoreboard players set $found_item gm4_machine_data 1 |
16 changes: 16 additions & 0 deletions
16
...ata/gm4_liquid_minecarts/functions/machine/destroy_cart/update_hopper_minecart.mcfunction
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# updates hopper minecarts with invalid items | ||
# @s = hopper minecart with invalid item | ||
# located at @s | ||
# run from gm4_liquid_minecarts:machine/destroy_cart/scan_hoppers | ||
|
||
# replace correct slot with proper item | ||
data modify storage gm4_machines:temp Items set from entity @s Items | ||
execute if data storage gm4_machines:temp Items[{Slot:0b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace entity @s container.0 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:1b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace entity @s container.1 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:2b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace entity @s container.2 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:3b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace entity @s container.3 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
execute if data storage gm4_machines:temp Items[{Slot:4b,tag:{display:{Name:'{"text":"Liquid Minecart","italic":false}'}}}] run loot replace entity @s container.4 loot gm4_liquid_minecarts:entities/liquid_minecart | ||
|
||
# clean up | ||
data remove storage gm4_machines:temp Items | ||
scoreboard players set $found_item gm4_machine_data 1 |
16 changes: 16 additions & 0 deletions
16
gm4_tunnel_bores/overlay_26/data/gm4_tunnel_bores/functions/machine/destroy_cart.mcfunction
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# destroys the tunnel_bore | ||
# @s = tunnel_bore marker | ||
# located at @s | ||
# run from gm4_tunnel_bores:machine/verify_destroy | ||
|
||
tag @s add gm4_destroyed_bore_storage | ||
|
||
# drop item | ||
scoreboard players set $dropped_item gm4_machine_data 0 | ||
execute as @e[type=item,distance=..3,nbt={Age:0s,Item:{id:"minecraft:furnace_minecart",Count:1b,tag:{display:{Name:'{"translate":"item.gm4.minecart.bore","fallback":"Minecart with Piston"}'}}}},limit=1,sort=nearest] at @s run function gm4_tunnel_bores:machine/destroy_cart/drop_item | ||
|
||
# scan hoppers if no item was broken | ||
execute if score $dropped_item gm4_machine_data matches 0 run function gm4_tunnel_bores:machine/destroy_cart/scan_hoppers | ||
|
||
# kill marker | ||
kill @s |
Oops, something went wrong.