-
-
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.
Improved 'vegetation_overhaul' function
- Added more block types for saplings to land on. - Added sounds for each type of block. - Added Azalea saplings and crops. - Items will not be planted if player is near 3 block radius. - Fixed items being deleted out of nothing. Maybe a implementation until the end of this release is to add a chance for the sapling to be planted. It should be different from crops and should be configurable.
- Loading branch information
SimplyCEO
committed
Jun 3, 2024
1 parent
158fce0
commit c0ff43c
Showing
10 changed files
with
182 additions
and
12 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
datapack/data/hss/functions/environment/vegetation_overhaul/crop.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,33 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/crop §floaded." | ||
|
||
# Init variables | ||
scoreboard players set vo_crop_id count 0 | ||
|
||
# Get item stack count and remove 1 | ||
execute store result score @s count run data get entity @s Item.Count | ||
scoreboard players remove @s count 1 | ||
|
||
# Identify the compatible block and the crop | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:wheat_seeds"}}] run scoreboard players set vo_crop_id count 1 | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:pumpkin_seeds"}}] run scoreboard players set vo_crop_id count 2 | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:melon_seeds"}}] run scoreboard players set vo_crop_id count 3 | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:beetroot_seeds"}}] run scoreboard players set vo_crop_id count 4 | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:potato"}}] run scoreboard players set vo_crop_id count 5 | ||
execute if block ~ ~ ~ minecraft:farmland if entity @s[nbt={Item:{id:"minecraft:carrot"}}] run scoreboard players set vo_crop_id count 6 | ||
execute if block ~ ~ ~ minecraft:soul_sand if entity @s[nbt={Item:{id:"minecraft:nether_wart"}}] run scoreboard players set vo_crop_id count 7 | ||
|
||
# Filter crops and handle events | ||
execute unless block ~ ~1 ~ #minecraft:crops if score vo_crop_id count matches 1..6 run function hss:environment/vegetation_overhaul/plant/crop_normal | ||
execute unless block ~ ~1 ~ minecraft:nether_wart if score vo_crop_id count matches 7 run function hss:environment/vegetation_overhaul/plant/crop_underworld | ||
|
||
# Free from memory | ||
scoreboard players reset @s count | ||
scoreboard players reset vo_crop_id count |
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
20 changes: 20 additions & 0 deletions
20
datapack/data/hss/functions/environment/vegetation_overhaul/plant/crop_normal.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,20 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/plant/crop_normal §floaded." | ||
|
||
# Handle stack only if crop block is already set | ||
execute run function hss:environment/vegetation_overhaul/stack/crop_normal | ||
|
||
# Spawn sapling block | ||
execute if score vo_crop_id count matches 1 run setblock ~ ~1 ~ minecraft:wheat | ||
execute if score vo_crop_id count matches 2 run setblock ~ ~1 ~ minecraft:pumpkin_stem | ||
execute if score vo_crop_id count matches 3 run setblock ~ ~1 ~ minecraft:melon_stem | ||
execute if score vo_crop_id count matches 4 run setblock ~ ~1 ~ minecraft:beetroots | ||
execute if score vo_crop_id count matches 5 run setblock ~ ~1 ~ minecraft:potatoes | ||
execute if score vo_crop_id count matches 6 run setblock ~ ~1 ~ minecraft:carrots |
16 changes: 16 additions & 0 deletions
16
datapack/data/hss/functions/environment/vegetation_overhaul/plant/crop_underworld.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 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/plant/crop_underworld §floaded." | ||
|
||
# Handle stack only if crop block is already set | ||
execute run function hss:environment/vegetation_overhaul/stack/crop_underworld | ||
|
||
# Spawn sapling block | ||
execute if score vo_crop_id count matches 7 run setblock ~ ~1 ~ minecraft:nether_wart | ||
|
22 changes: 22 additions & 0 deletions
22
datapack/data/hss/functions/environment/vegetation_overhaul/plant/sapling.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,22 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/plant/sapling §floaded." | ||
|
||
# Handle stack only if sapling block is already set | ||
execute run function hss:environment/vegetation_overhaul/stack/sapling | ||
|
||
# Spawn sapling block | ||
execute if score vo_sapling_id count matches 1 run setblock ~ ~ ~ minecraft:oak_sapling | ||
execute if score vo_sapling_id count matches 2 run setblock ~ ~ ~ minecraft:spruce_sapling | ||
execute if score vo_sapling_id count matches 3 run setblock ~ ~ ~ minecraft:birch_sapling | ||
execute if score vo_sapling_id count matches 4 run setblock ~ ~ ~ minecraft:jungle_sapling | ||
execute if score vo_sapling_id count matches 5 run setblock ~ ~ ~ minecraft:acacia_sapling | ||
execute if score vo_sapling_id count matches 6 run setblock ~ ~ ~ minecraft:dark_oak_sapling | ||
execute if score vo_sapling_id count matches 7 run setblock ~ ~ ~ minecraft:azalea | ||
execute if score vo_sapling_id count matches 8 run setblock ~ ~ ~ minecraft:flowering_azalea |
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
15 changes: 15 additions & 0 deletions
15
datapack/data/hss/functions/environment/vegetation_overhaul/stack/crop_normal.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,15 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/stack/crop_normal §floaded." | ||
|
||
# Apply sound | ||
playsound minecraft:block.azalea_leaves.step block @a ~ ~ ~ | ||
|
||
# Handle stack only if crop block is already set | ||
execute store result entity @s Item.Count int 1 run scoreboard players get @s count |
15 changes: 15 additions & 0 deletions
15
datapack/data/hss/functions/environment/vegetation_overhaul/stack/crop_underworld.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,15 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/stack/crop_underworld §floaded." | ||
|
||
# Apply sound | ||
playsound minecraft:block.wet_grass.step block @a ~ ~ ~ | ||
|
||
# Handle stack only if crop block is already set | ||
execute store result entity @s Item.Count int 1 run scoreboard players get @s count |
31 changes: 31 additions & 0 deletions
31
datapack/data/hss/functions/environment/vegetation_overhaul/stack/sapling.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,31 @@ | ||
# This script file is owned by SimplyCEO, from repository: | ||
# https://github.com/SimplyCEO/HardSurvivalStrategie | ||
# | ||
# You are allowed to translate, adapt, alter, transform, modify, or arrange it | ||
# according with the OSL-3.0 license. | ||
# | ||
# Thanks for playing! | ||
|
||
execute as @e[type=minecraft:player,scores={debug=1}] run tellraw @s "[§2§lENVIRONMENT§f] Function §9hss:environment/vegetation_overhaul/stack/sapling §floaded." | ||
|
||
# Init variables | ||
scoreboard players set vo_block_id count 0 | ||
|
||
# Detect block | ||
execute if block ~ ~-1 ~ minecraft:grass_block run scoreboard players set vo_block_id count 1 | ||
execute if block ~ ~-1 ~ minecraft:moss_block run scoreboard players set vo_block_id count 1 | ||
execute if block ~ ~-1 ~ minecraft:podzol run scoreboard players set vo_block_id count 2 | ||
execute if block ~ ~-1 ~ minecraft:rooted_dirt run scoreboard players set vo_block_id count 2 | ||
execute if block ~ ~-1 ~ minecraft:mycelium run scoreboard players set vo_block_id count 3 | ||
|
||
# Apply sound | ||
execute if score vo_block_id count matches 0 run playsound minecraft:block.composter.fill block @a ~ ~ ~ | ||
execute if score vo_block_id count matches 1 run playsound minecraft:block.grass.step block @a ~ ~ ~ | ||
execute if score vo_block_id count matches 2 run playsound minecraft:block.azalea_leaves.step block @a ~ ~ ~ | ||
execute if score vo_block_id count matches 3 run playsound minecraft:block.azalea.step block @a ~ ~ ~ | ||
|
||
# Handle stack only if sapling block is already set | ||
execute store result entity @s Item.Count int 1 run scoreboard players get @s count | ||
|
||
# Free from memory | ||
scoreboard players reset vo_block_id count |
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,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:farmland", | ||
"minecraft:soul_sand" | ||
] | ||
} |