Skip to content

Commit

Permalink
Plant Wax update (v1e)
Browse files Browse the repository at this point in the history
Plant Wax update (v1e)
  • Loading branch information
daenvil authored Dec 15, 2022
2 parents 393bb2e + 3702005 commit aea15c4
Show file tree
Hide file tree
Showing 76 changed files with 847 additions and 149 deletions.
10 changes: 0 additions & 10 deletions datapack/README.md

This file was deleted.

47 changes: 47 additions & 0 deletions datapack/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Daenvil's Vegancraft v1e (Full Datapack) for Minecraft 1.19+

This datapack is a merged version of the following datapacks:

- [Plant-based Foods v1.0.1](https://daenvil.github.io/MCDatapacks/plant-based_foods.html)
- [Omnivorous Pets v1](https://daenvil.github.io/MCDatapacks/omnivorous_pets.html)
- [Acacia Gum v1](https://daenvil.github.io/MCDatapacks/acacia_gum.html)
- [Ethical Textiles v1](https://daenvil.github.io/MCDatapacks/ethical_Textiles.html)
- [Plant Wax v1](https://daenvil.github.io/MCDatapacks/plant_wax.html)

- This datapack was made by Daenvil, its official pages are:

- On my website: https://daenvil.github.io/MCDatapacks/vegancraft.html
- On GitHub: https://www.github.com/daenvil/vegancraft

- If you like my datapacks, please consider leaving a tip at my ko-fi: https://ko-fi.com/daenvilmc

- This version was published on the 15th of December 2022. Check the webpages above for possible updates.

## Installation

- Drop the datapack zip file inside the "datapacks" folder of your world folder (<your minecraft folder>/saves/<your world>/datapacks/).

## Features

You can find the full info on this page: https://daenvil.github.io/MCDatapacks/vegancraft.html

## Legal terms

You are allowed to:

- Download, use, and edit this datapack* for personal use.
- Use this datapack or variations of it in a Minecraft server.
- Publish audiovisual content that uses this datapack or variations of it (e.g. gameplay videos on online platforms), as long as you acknowledge me (Daenvil) as the author of this datapack and provide a link to its GitHub repository (https://www.github.com/daenvil/vegancraft) or to its webpage (https://daenvil.github.io/MCDatapacks/vegancraft.html).
- Share this datapack or variations of it privately (e.g. transferring the files to friends), as long as there is no financial profit involved, the files are not publicly available, and this text file is included with the files you share.

You are not allowed to:

- Publish this datapack or variations of it without explicit permission from me.

*For all legal purposes, "this datapack" refers to all the files (source code, images, and any other) that you downloaded along with this text file, and that are downloadable from its official pages listed above.

--

-Daenvil

https://daenvil.github.io/MCDatapacks/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rewards": {
"function": "dnv.core:triggers/interacted_with_crafting_table"
},
"criteria": {
"crafting_table_interaction": {
"trigger": "minecraft:item_used_on_block",
"conditions": {
"location": {
"block": {
"blocks": ["minecraft:crafting_table"]
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rewards": {
"function": "dnv.core:triggers/interacted_with_furnace"
},
"criteria": {
"crafting_table_interaction": {
"trigger": "minecraft:item_used_on_block",
"conditions": {
"location": {
"block": {
"blocks": ["minecraft:furnace"]
}
}
}
}
}
}
13 changes: 13 additions & 0 deletions datapack/data/dnv.core/advancements/triggers/placed_furnace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"criteria": {
"placed_composter": {
"trigger": "minecraft:placed_block",
"conditions": {
"block": "minecraft:furnace"
}
}
},
"rewards": {
"function": "dnv.core:triggers/placed_furnace"
}
}
7 changes: 7 additions & 0 deletions datapack/data/dnv.core/functions/furnace/1second.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Called by dnv.core:furnace/load or scheduled by itself

scoreboard players set @s[type=marker,tag=dnv.furnace] dnv.cook_time -1
#Update working furnaces:
execute as @e[type=marker,tag=dnv.furnace] at @s if block ~ ~ ~ minecraft:furnace[lit=true] run function dnv.core:furnace/update

schedule function dnv.core:furnace/1second 1s replace
4 changes: 4 additions & 0 deletions datapack/data/dnv.core/functions/furnace/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scoreboard objectives add dnv.found_furnace dummy
scoreboard objectives add dnv.cook_time dummy

function dnv.core:furnace/1second
12 changes: 12 additions & 0 deletions datapack/data/dnv.core/functions/furnace/marker_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Called by function dnv.core:furnace/tick
# @s = Furnace marker
# position = Furnace marker

# If there is not a furnace here, delete the marker:
execute unless block ~ ~ ~ furnace run kill @s

# Handle burn timer:
execute if score @s dnv.cook_time matches 0.. run scoreboard players add @s dnv.cook_time 1

# Check if item completed smelting:
execute if score @s dnv.cook_time matches 200 run function #dnv.core:furnace/cook_timer_complete
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Called through #dnv.core:triggers/interacted_with_furnace by function dnv.core:triggers/interacted_with_furnace
# Called through #dnv.core:triggers/placed_furnace by function dnv.core:triggers/placed_furnace
# Raycast function to find block furnace. Needs to be triggered by something.
# Objective dnv.found_furnace functions as both a tracker of how many steps were done (in negative numbers) and as confirmation of success (1)

scoreboard players set @s dnv.found_furnace 0
execute anchored eyes positioned ^ ^ ^ run function dnv.core:furnace/raycast/find_furnace_line
execute if score @s dnv.found_furnace matches ..-61 anchored eyes positioned ^ ^ ^1 run function dnv.core:furnace/raycast/find_furnace_wide
#execute if score @s dnv.found_furnace matches ..-121 run function dnv.core:furnace/raycast/find_furnace_fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Called by function dnv.core:furnace/raycast/find_furnace or by itself

execute if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
# If not found, repeat function in the next forward step towards where the player is facing:
execute if score @s dnv.found_furnace matches -60..0 run scoreboard players remove @s dnv.found_furnace 1
execute if score @s dnv.found_furnace matches -60..0 positioned ^ ^ ^.1 run function dnv.core:furnace/raycast/find_furnace_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Called by function dnv.core:furnace/raycast/find_furnace(_line/_wide)
# ~ ~ ~ = position of the targeted block

scoreboard players set @s dnv.found_furnace 1

execute align xyz unless entity @e[dx=0,dy=0,dz=0,type=marker,tag=dnv.furnace,limit=1] run summon marker ~0.5 ~0.5 ~0.5 {Tags:["dnv.furnace"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Called by function dnv.core:furnace/raycast/find_furnace or by itself

execute if block ^1 ^ ^ furnace positioned ^1 ^ ^ run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^1 ^ ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^-1 ^ ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^ ^1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^1 ^-1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^1 ^1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^1 ^-1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^-1 ^1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
execute if score @s dnv.found_furnace matches -120..-61 positioned ^-1 ^-1 ^ if block ~ ~ ~ furnace run function dnv.core:furnace/raycast/find_furnace_success
# If not found, repeat function in the next forward step towards where the player is facing:
execute if score @s dnv.found_furnace matches -120..-61 run scoreboard players remove @s dnv.found_furnace 1
execute if score @s dnv.found_furnace matches -120..-61 positioned ^ ^ ^.1 run function dnv.core:furnace/raycast/find_furnace_wide
1 change: 1 addition & 0 deletions datapack/data/dnv.core/functions/furnace/tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute as @e[type=marker,tag=dnv.furnace] at @s run function dnv.core:furnace/marker_tick
6 changes: 6 additions & 0 deletions datapack/data/dnv.core/functions/furnace/update.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Called by function dnv.core:furnace/1second
# @s = Furnace marker
# position = Furnace marker
# Updates the burn timer score every second, this reduces the amount of times the NBT data of the furnace needs to be accessed.

execute store result score @s dnv.cook_time run data get block ~ ~ ~ CookTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
advancement revoke @s only dnv.core:triggers/interacted_with_crafting_table
function #dnv.core:triggers/interacted_with_crafting_table
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
advancement revoke @s only dnv.core:triggers/interacted_with_furnace
function #dnv.core:triggers/interacted_with_furnace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
advancement revoke @s only dnv.core:triggers/placed_furnace
function #dnv.core:triggers/placed_furnace
7 changes: 7 additions & 0 deletions datapack/data/dnv.core/item_modifiers/increase_count.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"function": "minecraft:set_count",
"count": 1,
"add": true
}
]
7 changes: 7 additions & 0 deletions datapack/data/dnv.core/item_modifiers/reduce_count.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"function": "minecraft:set_count",
"count": -1,
"add": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"dnv.plant_wax:furnace/cook_timer_complete"
]
}
4 changes: 4 additions & 0 deletions datapack/data/dnv.core/tags/functions/player_tick.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
{
"id": "dnv.vegancraft:textiles/utility/player_tick",
"required": false
},
{
"id": "dnv.vegancraft:plant_wax/utility/player_tick",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"values": [
{
"id": "dnv.vegancraft:utility/grant_crafting_advancement",
"required": false
},
{
"id": "dnv.vegancraft:plant_wax/utility/update_vcount",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values": [
{
"id": "dnv.vegancraft:utility/grant_crafting_advancement",
"required": false
},
"dnv.core:furnace/raycast/find_furnace"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"dnv.core:furnace/raycast/find_furnace"
]
}
43 changes: 43 additions & 0 deletions datapack/data/dnv.plant_wax/advancements/recipes/bush_wax.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"dnv.plant_wax:bush_wax"
]
},
"criteria": {
"has_the_ingredient": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [{
"items": [
"minecraft:dead_bush"
]
}]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "dnv.plant_wax:bush_wax"
}
},
"has_the_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [{
"items": [
"minecraft:honeycomb"
]
}]
}
}
},
"requirements": [
[
"has_the_ingredient",
"has_the_recipe",
"has_the_item"
]
]
}
43 changes: 43 additions & 0 deletions datapack/data/dnv.plant_wax/advancements/recipes/jungle_wax.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"dnv.plant_wax:jungle_wax"
]
},
"criteria": {
"has_the_ingredient": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [{
"items": [
"minecraft:jungle_leaves"
]
}]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "dnv.plant_wax:jungle_wax"
}
},
"has_the_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [{
"items": [
"minecraft:honeycomb"
]
}]
}
}
},
"requirements": [
[
"has_the_ingredient",
"has_the_recipe",
"has_the_item"
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Called through function tag #dnv.core:furnace/cook_timer_complete by function dnv.core:furnace/marker_tick
# @s = Furnace marker
# position = Furnace marker
# Checks if custom recipes were completed:

# Dead bush
execute if data block ~ ~ ~ {Items:[{Slot:0b,id:"minecraft:dead_bush"}]} run tag @s add dnv.plant_wax.recipe_completed

# Jungle leaves
execute unless entity @s[tag=dnv.plant_wax.recipe_completed] if data block ~ ~ ~ {Items:[{Slot:0b,id:"minecraft:jungle_leaves"}]} run tag @s add dnv.plant_wax.recipe_completed

execute if entity @s[tag=dnv.plant_wax.recipe_completed] run function dnv.plant_wax:furnace/recipe_completed

# Reset cook timer:
scoreboard players set @s dnv.cook_time -1
Loading

0 comments on commit aea15c4

Please sign in to comment.