Move farmers delight to bworld
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:cabbages",
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage0"
|
||||
},
|
||||
"model": "engine:cross",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage3"
|
||||
}
|
||||
},
|
||||
"age=4": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage4"
|
||||
}
|
||||
},
|
||||
"age=5": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage5"
|
||||
}
|
||||
},
|
||||
"age=6": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage6"
|
||||
}
|
||||
},
|
||||
"age=7": {
|
||||
"textures": {
|
||||
"cross": "bworld:cabbages_stage7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"loot_table": "bworld:blocks/cabbages",
|
||||
"item": false,
|
||||
"place_on": [
|
||||
"bworld:hoed_dirt"
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"name": "age",
|
||||
"bits": 3,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 12,
|
||||
"stages": 8,
|
||||
"fertilizer": "bworld:bone_meal",
|
||||
"seasons": [
|
||||
"spring",
|
||||
"autumn"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:cooking_pot",
|
||||
"model": "bworld:cooking_pot",
|
||||
"textures": {
|
||||
"side": "bworld:cooking_pot_side",
|
||||
"top": "bworld:cooking_pot_top",
|
||||
"bottom": "bworld:cooking_pot_bottom",
|
||||
"parts": "bworld:cooking_pot_parts"
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"shape": [[2, 0, 2, 14, 10, 14]],
|
||||
"mining": {
|
||||
"toughness": 2,
|
||||
"tool": "pickaxe"
|
||||
},
|
||||
"drops": "bworld:cooking_pot",
|
||||
"item": false,
|
||||
"interactive": true,
|
||||
"components": {
|
||||
"bworld:cooking_pot": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:cutting_board",
|
||||
"model": "bworld:cutting_board",
|
||||
"textures": {
|
||||
"main": "bworld:cutting_board"
|
||||
},
|
||||
"variants": {
|
||||
"facing=1": { "y": 90 },
|
||||
"facing=2": { "y": 180 },
|
||||
"facing=3": { "y": 270 }
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"shape": [[1, 0, 1, 15, 1, 15]],
|
||||
"mining": {
|
||||
"toughness": 2,
|
||||
"tool": "axe"
|
||||
},
|
||||
"drops": "bworld:cutting_board",
|
||||
"interactive": true,
|
||||
"item_display": { "surface": 1 },
|
||||
"states": [
|
||||
{
|
||||
"name": "facing",
|
||||
"bits": 2,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:cutting_board": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:onions",
|
||||
"textures": {
|
||||
"crop": "bworld:onions_stage0"
|
||||
},
|
||||
"model": "engine:crop",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"crop": "bworld:onions_stage0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"crop": "bworld:onions_stage1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"crop": "bworld:onions_stage2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"crop": "bworld:onions_stage3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"loot_table": "bworld:blocks/onions",
|
||||
"item": false,
|
||||
"place_on": [
|
||||
"bworld:hoed_dirt"
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"name": "age",
|
||||
"bits": 2,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 4,
|
||||
"stages": 4,
|
||||
"fertilizer": "bworld:bone_meal",
|
||||
"seasons": [
|
||||
"spring",
|
||||
"summer"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:rice",
|
||||
"textures": {
|
||||
"cross": "bworld:rice_stage0"
|
||||
},
|
||||
"model": "engine:cross",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_stage0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_stage1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_stage2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_stage3"
|
||||
}
|
||||
},
|
||||
"age=4": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_supporting"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"waterlogged_only": true,
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"loot_table": "bworld:blocks/rice",
|
||||
"item": false,
|
||||
"place_on": [
|
||||
"bworld:dirt",
|
||||
"bworld:grass",
|
||||
"bworld:hoed_dirt"
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"name": "age",
|
||||
"bits": 3,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"place_in": [
|
||||
"bworld:water"
|
||||
],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 6,
|
||||
"stages": 4,
|
||||
"fertilizer": "bworld:bone_meal",
|
||||
"water": "always",
|
||||
"upper": {
|
||||
"block": "bworld:rice_panicles",
|
||||
"stages": 4,
|
||||
"supporting_age": 4
|
||||
},
|
||||
"leaves": "bworld:water",
|
||||
"seasons": [
|
||||
"spring",
|
||||
"summer",
|
||||
"autumn"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:rice_panicles",
|
||||
"textures": {
|
||||
"cross": "bworld:rice_panicles_stage0"
|
||||
},
|
||||
"model": "engine:cross",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_panicles_stage0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_panicles_stage1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_panicles_stage2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"cross": "bworld:rice_panicles_stage3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"loot_table": "bworld:blocks/rice_panicles",
|
||||
"item": false,
|
||||
"place_on": [
|
||||
"bworld:rice"
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"name": "age",
|
||||
"bits": 2,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:crop_top": {
|
||||
"stages": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:stove",
|
||||
"textures": {
|
||||
"top": "bworld:stove_top",
|
||||
"bottom": "bworld:stove_bottom",
|
||||
"front": "bworld:stove_front",
|
||||
"side": "bworld:stove_side"
|
||||
},
|
||||
"variants": {
|
||||
"facing=1": { "y": 90 },
|
||||
"facing=2": { "y": 180 },
|
||||
"facing=3": { "y": 270 },
|
||||
"lit=1": {
|
||||
"textures": {
|
||||
"top": "bworld:stove_top_on",
|
||||
"bottom": "bworld:stove_bottom",
|
||||
"front": "bworld:stove_front_on",
|
||||
"side": "bworld:stove_side"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mining": {
|
||||
"toughness": 2,
|
||||
"tool": "pickaxe",
|
||||
"requires_tool": true
|
||||
},
|
||||
"drops": "bworld:stove",
|
||||
"states": [
|
||||
{
|
||||
"name": "lit",
|
||||
"bits": 1,
|
||||
"default": 1
|
||||
},
|
||||
{
|
||||
"name": "facing",
|
||||
"bits": 2,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:stove": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:tomatoes",
|
||||
"textures": {
|
||||
"cross": "bworld:budding_tomatoes_stage0"
|
||||
},
|
||||
"model": "engine:cross",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"cross": "bworld:budding_tomatoes_stage0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"cross": "bworld:budding_tomatoes_stage1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"cross": "bworld:budding_tomatoes_stage2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"cross": "bworld:budding_tomatoes_stage3"
|
||||
}
|
||||
},
|
||||
"age=4": {
|
||||
"textures": {
|
||||
"cross": "bworld:tomatoes_stage0"
|
||||
}
|
||||
},
|
||||
"age=5": {
|
||||
"textures": {
|
||||
"cross": "bworld:tomatoes_stage1"
|
||||
}
|
||||
},
|
||||
"age=6": {
|
||||
"textures": {
|
||||
"cross": "bworld:tomatoes_stage2"
|
||||
}
|
||||
},
|
||||
"age=7": {
|
||||
"textures": {
|
||||
"cross": "bworld:tomatoes_stage3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"loot_table": "bworld:blocks/tomatoes",
|
||||
"item": false,
|
||||
"place_on": [
|
||||
"bworld:hoed_dirt"
|
||||
],
|
||||
"states": [
|
||||
{
|
||||
"name": "age",
|
||||
"bits": 3,
|
||||
"default": 0
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"bworld:crop": {
|
||||
"days": 11,
|
||||
"stages": 8,
|
||||
"fertilizer": "bworld:bone_meal",
|
||||
"regrow_days": 4,
|
||||
"harvest": "bworld:harvest/tomatoes",
|
||||
"seasons": [
|
||||
"summer"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cabbage",
|
||||
"texture": "bworld:cabbage",
|
||||
"food": {
|
||||
"nutrition": 2,
|
||||
"saturation_modifier": 0.4
|
||||
},
|
||||
"base_sell_value": 35,
|
||||
"components": {
|
||||
"bworld:juiceable": { "juice": 500, "color": "#7ab244" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cabbage_leaf",
|
||||
"texture": "bworld:cabbage_leaf",
|
||||
"food": {
|
||||
"nutrition": 1,
|
||||
"saturation_modifier": 0.4
|
||||
},
|
||||
"base_sell_value": 18
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cabbage_rolls",
|
||||
"texture": "bworld:cabbage_rolls",
|
||||
"food": {
|
||||
"nutrition": 5,
|
||||
"saturation_modifier": 0.5
|
||||
},
|
||||
"base_sell_value": 50
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cabbage_seeds",
|
||||
"texture": "bworld:cabbage_seeds",
|
||||
"places": "bworld:cabbages"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cod_slice",
|
||||
"texture": "bworld:cod_slice",
|
||||
"food": {
|
||||
"nutrition": 1,
|
||||
"saturation_modifier": 0.1
|
||||
},
|
||||
"base_sell_value": 15
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cooked_rice",
|
||||
"texture": "bworld:cooked_rice",
|
||||
"max_stack": 16,
|
||||
"food": {
|
||||
"nutrition": 6,
|
||||
"saturation_modifier": 0.4,
|
||||
"returns": "bworld:bowl"
|
||||
},
|
||||
"base_sell_value": 46
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cooking_pot",
|
||||
"texture": "bworld:cooking_pot",
|
||||
"places": "bworld:cooking_pot",
|
||||
"max_stack": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:copper_knife",
|
||||
"texture": "bworld:copper_knife",
|
||||
"tool": {
|
||||
"type": "knife",
|
||||
"tier": 1,
|
||||
"speed": 3.5,
|
||||
"durability": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:gold_knife",
|
||||
"texture": "bworld:gold_knife",
|
||||
"tool": {
|
||||
"type": "knife",
|
||||
"tier": 0,
|
||||
"speed": 6,
|
||||
"durability": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:iron_knife",
|
||||
"texture": "bworld:iron_knife",
|
||||
"tool": {
|
||||
"type": "knife",
|
||||
"tier": 2,
|
||||
"speed": 4,
|
||||
"durability": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:onion",
|
||||
"texture": "bworld:onion",
|
||||
"places": "bworld:onions",
|
||||
"food": {
|
||||
"nutrition": 2,
|
||||
"saturation_modifier": 0.4
|
||||
},
|
||||
"base_sell_value": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:rice",
|
||||
"texture": "bworld:rice",
|
||||
"places": "bworld:rice",
|
||||
"base_sell_value": 13
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:rice_panicle",
|
||||
"texture": "bworld:rice_panicle",
|
||||
"base_sell_value": 10
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:salmon_slice",
|
||||
"texture": "bworld:salmon_slice",
|
||||
"food": {
|
||||
"nutrition": 1,
|
||||
"saturation_modifier": 0.1
|
||||
},
|
||||
"base_sell_value": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:stone_knife",
|
||||
"texture": "bworld:stone_knife",
|
||||
"tool": {
|
||||
"type": "knife",
|
||||
"tier": 1,
|
||||
"speed": 3,
|
||||
"durability": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:tomato",
|
||||
"texture": "bworld:tomato",
|
||||
"food": {
|
||||
"nutrition": 1,
|
||||
"saturation_modifier": 0.3
|
||||
},
|
||||
"base_sell_value": 15,
|
||||
"components": {
|
||||
"bworld:juiceable": { "juice": 250, "color": "#c0341f" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:tomato_sauce",
|
||||
"texture": "bworld:tomato_sauce",
|
||||
"food": {
|
||||
"nutrition": 4,
|
||||
"saturation_modifier": 0.4,
|
||||
"returns": "bworld:bowl"
|
||||
},
|
||||
"base_sell_value": 33
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:tomato_seeds",
|
||||
"texture": "bworld:tomato_seeds",
|
||||
"places": "bworld:tomatoes"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:wood_knife",
|
||||
"texture": "bworld:wood_knife",
|
||||
"tool": {
|
||||
"type": "knife",
|
||||
"tier": 0,
|
||||
"speed": 2,
|
||||
"durability": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:cabbage",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 7
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"item": "bworld:cabbage_seeds",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "inverted",
|
||||
"term": {
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 7
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:cabbage_seeds",
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_count",
|
||||
"count": {
|
||||
"n": 3,
|
||||
"p": 0.5714
|
||||
},
|
||||
"add": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:onion"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:onion",
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_count",
|
||||
"count": {
|
||||
"n": 3,
|
||||
"p": 0.5714
|
||||
},
|
||||
"add": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:rice"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:rice_panicle"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:tomato_seeds"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "block_state",
|
||||
"states": {
|
||||
"age": 7
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:tomato"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:tomato",
|
||||
"count": {
|
||||
"min": 1,
|
||||
"max": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"model": {
|
||||
"id": "bworld:cooking_pot",
|
||||
"textures": {
|
||||
"side": "bworld:cooking_pot_side",
|
||||
"top": "bworld:cooking_pot_top",
|
||||
"bottom": "bworld:cooking_pot_bottom",
|
||||
"parts": "bworld:cooking_pot_parts"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [2, 0, 2],
|
||||
"to": [14, 10, 14],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#side",
|
||||
"uv": [2, 6, 14, 16]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#side",
|
||||
"uv": [2, 6, 14, 16]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#side",
|
||||
"uv": [2, 6, 14, 16]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#side",
|
||||
"uv": [2, 6, 14, 16]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#top",
|
||||
"uv": [2, 2, 14, 14]
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#bottom",
|
||||
"uv": [2, 2, 14, 14],
|
||||
"cullface": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7, 3, 7],
|
||||
"to": [9, 15, 9],
|
||||
"rotation": {
|
||||
"angle": -22.5,
|
||||
"axis": "z",
|
||||
"origin": [8, 3, 8]
|
||||
},
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#parts",
|
||||
"uv": [2, 2, 0, 14]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#parts",
|
||||
"uv": [0, 2, 2, 14]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#parts",
|
||||
"uv": [2, 2, 0, 14]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#parts",
|
||||
"uv": [0, 2, 2, 14]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#parts",
|
||||
"uv": [0, 0, 2, 2]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 7, 5],
|
||||
"to": [16, 9, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#parts",
|
||||
"uv": [10, 0, 12, 2]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 2, 10, 4],
|
||||
"cullface": "east"
|
||||
},
|
||||
"south": {
|
||||
"texture": "#parts",
|
||||
"uv": [2, 0, 4, 2]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 0, 10, 2],
|
||||
"rotation": 90
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 2, 10, 4],
|
||||
"rotation": 90
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 7, 5],
|
||||
"to": [2, 9, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#parts",
|
||||
"uv": [2, 0, 4, 2]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#parts",
|
||||
"uv": [10, 0, 12, 2]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 2, 10, 4],
|
||||
"cullface": "west"
|
||||
},
|
||||
"top": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 0, 10, 2],
|
||||
"rotation": 270
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#parts",
|
||||
"uv": [4, 2, 10, 4],
|
||||
"rotation": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"model": {
|
||||
"id": "bworld:cutting_board",
|
||||
"textures": {
|
||||
"main": "bworld:cutting_board"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [1, 0, 1],
|
||||
"to": [12, 1, 15],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 12, 16]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 15, 16]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 12, 16]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 15, 16]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 1, 12, 15]
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 1, 12, 15],
|
||||
"cullface": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [13, 0, 1],
|
||||
"to": [15, 1, 15],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 3, 16]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 15, 16]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#main",
|
||||
"uv": [13, 15, 15, 16]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#main",
|
||||
"uv": [1, 15, 15, 16]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#main",
|
||||
"uv": [13, 1, 15, 15]
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#main",
|
||||
"uv": [13, 1, 15, 15],
|
||||
"cullface": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [12, 0, 1],
|
||||
"to": [13, 1, 6],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#main",
|
||||
"uv": [3, 15, 4, 16]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 15, 13, 16]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 1, 13, 6]
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 10, 13, 15],
|
||||
"cullface": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [12, 0, 10],
|
||||
"to": [13, 1, 15],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#main",
|
||||
"uv": [3, 15, 4, 16]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 15, 13, 16]
|
||||
},
|
||||
"top": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 10, 13, 15]
|
||||
},
|
||||
"bottom": {
|
||||
"texture": "#main",
|
||||
"uv": [12, 1, 13, 6],
|
||||
"cullface": "bottom"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cooking",
|
||||
"ingredients": [
|
||||
"bworld:cabbage",
|
||||
["bworld:carrot", "bworld:potato", "bworld:onion", "bworld:tomato"]
|
||||
],
|
||||
"result": { "id": "bworld:cabbage_rolls", "count": 1 },
|
||||
"cook_time": 100
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cooking",
|
||||
"ingredients": ["bworld:rice"],
|
||||
"result": { "id": "bworld:cooked_rice", "count": 1 },
|
||||
"container": "bworld:bowl",
|
||||
"cook_time": 100
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cooking",
|
||||
"ingredients": ["bworld:tomato", "bworld:tomato"],
|
||||
"result": { "id": "bworld:tomato_sauce", "count": 1 },
|
||||
"container": "bworld:bowl",
|
||||
"cook_time": 100
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": ["iSi", "i i", "iii"],
|
||||
"key": { "i": "bworld:iron_ingot", "S": "bworld:stick" },
|
||||
"result": { "id": "bworld:cooking_pot", "count": 1 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": [
|
||||
"SPP",
|
||||
"SPP"
|
||||
],
|
||||
"key": {
|
||||
"S": "bworld:stick",
|
||||
"P": "#bworld:planks"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:cutting_board",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": ["iii", "B B", "BCB"],
|
||||
"key": { "i": "bworld:iron_ingot", "B": "bworld:stone", "C": "bworld:coal" },
|
||||
"result": { "id": "bworld:stove", "count": 1 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": [
|
||||
"P",
|
||||
"S"
|
||||
],
|
||||
"key": {
|
||||
"P": "#bworld:planks",
|
||||
"S": "bworld:stick"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:wood_knife",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cutting",
|
||||
"ingredients": ["bworld:cabbage"],
|
||||
"tool": "knife",
|
||||
"result": [{ "id": "bworld:cabbage_leaf", "count": 2 }]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cutting",
|
||||
"ingredients": ["bworld:cod"],
|
||||
"tool": "knife",
|
||||
"result": [{ "id": "bworld:cod_slice", "count": 2 }, { "id": "bworld:bone_meal", "count": 1 }]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "bworld:cutting",
|
||||
"ingredients": ["bworld:salmon"],
|
||||
"tool": "knife",
|
||||
"result": [{ "id": "bworld:salmon_slice", "count": 2 }, { "id": "bworld:bone_meal", "count": 1 }]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "smithing",
|
||||
"tool": "bworld:stone_knife",
|
||||
"material": {
|
||||
"id": "bworld:copper_ingot",
|
||||
"count": 5
|
||||
},
|
||||
"result": "bworld:copper_knife"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "smithing",
|
||||
"tool": "bworld:iron_knife",
|
||||
"material": {
|
||||
"id": "bworld:gold_ingot",
|
||||
"count": 5
|
||||
},
|
||||
"result": "bworld:gold_knife"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "smithing",
|
||||
"tool": "bworld:copper_knife",
|
||||
"material": {
|
||||
"id": "bworld:iron_ingot",
|
||||
"count": 5
|
||||
},
|
||||
"result": "bworld:iron_knife"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "smithing",
|
||||
"tool": "bworld:wood_knife",
|
||||
"material": {
|
||||
"id": "bworld:stone",
|
||||
"count": 5
|
||||
},
|
||||
"result": "bworld:stone_knife"
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,22 @@ export function setup(ctx: ClientContext) {
|
||||
ctx.ui.register_menu_screen("bworld:stonecutter", (menu) => stonecutter_screen(ctx, menu));
|
||||
ctx.ui.register_menu_screen("bworld:fishing_minigame", fishing_minigame_screen);
|
||||
ctx.render.register_visual("bworld:juicer", juicer_visual);
|
||||
|
||||
ctx.ui.register_menu_screen("bworld:cooking_pot", (menu) => ({
|
||||
width: WIDTH,
|
||||
height: HEIGHT,
|
||||
on_render_background(g) {
|
||||
g.panel(0, 0, WIDTH, HEIGHT);
|
||||
// lit under the ingredients while something heats the pot, the arrow fills as the meal cooks
|
||||
g.progress("bworld:fire_empty", "bworld:fire_full", 47, 53, 18, 18, menu.data.heated, "up");
|
||||
const { progress, progress_max } = menu.data;
|
||||
g.progress("bworld:arrow_empty", "bworld:arrow_full", 95, 25, 18, 18, progress / progress_max);
|
||||
},
|
||||
on_render_labels(g) {
|
||||
g.text(menu.title, 8, 6);
|
||||
g.text("Inventory", 8, 73);
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
// the middle of the bottom copy of what's in the juicer, just over its floor, and how much higher each next one is
|
||||
|
||||
@@ -0,0 +1,385 @@
|
||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// farmer's delight's kitchen. the stove is a heat source, like its StoveBlock. the cooking pot, like its
|
||||
// CookingPotBlockEntity, cooks its recipes while something hot is under it, keeps the meal, and serves it into the
|
||||
// container the meal needs (a bowl), or straight out when it needs none. the cutting board, like its
|
||||
// CuttingBoardBlockEntity, holds a stack of anything and cuts it one at a time with the right tool
|
||||
|
||||
import type { BlockRef, Container, ItemStack, ServerContext } from "bworld/server";
|
||||
|
||||
// stove
|
||||
|
||||
// what lights an unlit stove, used up. the java mod's are flint and steel and fire charges, which bworld doesn't have
|
||||
const STOVE_FUEL = "bworld:coal";
|
||||
// what puts it out: any shovel, like the java mod (a water bucket too, once there are buckets)
|
||||
const STOVE_EXTINGUISHER_TOOL = "shovel";
|
||||
// standing on a lit stove hurts, like a magma block: 1 health every 10 ticks
|
||||
const STOVE_BURN_DAMAGE = 1;
|
||||
const STOVE_BURN_TICKS = 10;
|
||||
|
||||
export function register_stove(ctx: ServerContext) {
|
||||
const lit = (block: BlockRef) => ctx.world.get_state(block.x, block.y, block.z, "lit") === 1;
|
||||
const set_lit = (block: BlockRef, value: boolean) =>
|
||||
ctx.world.set_state(block.x, block.y, block.z, "lit", value ? 1 : 0);
|
||||
|
||||
ctx.components.register_block("bworld:stove", {
|
||||
// placed lit, like the java mod. block data so it ticks, to burn whoever stands on it
|
||||
on_create(block) {
|
||||
block.data ??= {};
|
||||
},
|
||||
on_interact(block, _params, player) {
|
||||
const held = player.inventory.get(player.selected_slot);
|
||||
if (!held) return false;
|
||||
if (lit(block)) {
|
||||
if (ctx.items.tool(held.id) !== STOVE_EXTINGUISHER_TOOL) return false;
|
||||
set_lit(block, false);
|
||||
return true;
|
||||
}
|
||||
if (held.id !== STOVE_FUEL) return false;
|
||||
held.count -= 1;
|
||||
set_lit(block, true);
|
||||
return true;
|
||||
},
|
||||
on_tick(block) {
|
||||
if (ctx.system.current_tick % STOVE_BURN_TICKS !== 0 || !lit(block)) return;
|
||||
for (const player of ctx.players.all()) {
|
||||
const { x, y, z } = player.position;
|
||||
if (Math.floor(x) === block.x && Math.floor(z) === block.z && Math.abs(y - (block.y + 1)) < 0.01) {
|
||||
player.damage(STOVE_BURN_DAMAGE, "hot_floor");
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// cooking pot
|
||||
|
||||
// slots 0-5 are the ingredients, 6 the meal waiting to be served, 7 containers for it, 8 the served meal
|
||||
const INGREDIENT_SLOTS = 6;
|
||||
const MEAL_SLOT = 6;
|
||||
const CONTAINER_SLOT = 7;
|
||||
const OUTPUT_SLOT = 8;
|
||||
const POT_SIZE = 9;
|
||||
// ticks, for recipes that don't say
|
||||
const DEFAULT_COOK_TIME = 200;
|
||||
|
||||
// what's under the pot that heats it, and the state that has to be 1 for it to, like minecraft's heat_sources tag
|
||||
const HEAT_SOURCES: Record<string, string | undefined> = {
|
||||
"bworld:furnace": "lit",
|
||||
"bworld:stove": "lit",
|
||||
};
|
||||
|
||||
// a bworld:cooking recipe: the ingredients in any slots. in the json each is an item id or #tag, or a list of
|
||||
// those any of which will do. here each is every item that will do
|
||||
interface CookingRecipe {
|
||||
ingredients: string[][];
|
||||
result: { id: string; count: number };
|
||||
// what the meal is served in, like a bowl. without it the meal comes out as soon as it's cooked
|
||||
container?: string;
|
||||
cook_time: number;
|
||||
}
|
||||
|
||||
interface PotData {
|
||||
container: string;
|
||||
// ticks, counting up to cook_time_total
|
||||
cook_time: number;
|
||||
cook_time_total: number;
|
||||
// what the meal in the meal slot is served in, "" for nothing
|
||||
meal_container: string;
|
||||
}
|
||||
|
||||
// an ingredient: an item, or a #tag of items any of which will do
|
||||
function item_or_tag(ctx: ServerContext, where: string, id: unknown) {
|
||||
if (typeof id === "string" && id.startsWith("#")) {
|
||||
if (!ctx.tags.exists("items", id)) throw new Error(`${where}: there's no item tag ${id}`);
|
||||
} else if (typeof id !== "string" || !ctx.items.exists(id)) {
|
||||
throw new Error(`${where}: there's no item ${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
// checked when the server starts, so a broken recipe is a load error naming it
|
||||
function load_recipes(ctx: ServerContext): CookingRecipe[] {
|
||||
return ctx.recipes.list("bworld:cooking").map((json, i) => {
|
||||
const where = `bworld:cooking recipe ${i + 1} (${json.result?.id ?? "no result"})`;
|
||||
const item = (id: unknown) => {
|
||||
if (typeof id !== "string" || !ctx.items.exists(id)) throw new Error(`${where}: there's no item ${id}`);
|
||||
return id;
|
||||
};
|
||||
const ingredients = json.ingredients;
|
||||
if (!Array.isArray(ingredients) || ingredients.length < 1 || ingredients.length > INGREDIENT_SLOTS) {
|
||||
throw new Error(`${where}: ingredients must be 1 to ${INGREDIENT_SLOTS} items`);
|
||||
}
|
||||
for (const ingredient of ingredients) {
|
||||
if (Array.isArray(ingredient)) {
|
||||
if (ingredient.length === 0) throw new Error(`${where}: an ingredient's list of items is empty`);
|
||||
ingredient.forEach((id) => item_or_tag(ctx, where, id));
|
||||
} else {
|
||||
item_or_tag(ctx, where, ingredient);
|
||||
}
|
||||
}
|
||||
item(json.result?.id);
|
||||
if (!Number.isInteger(json.result.count) || json.result.count < 1) {
|
||||
throw new Error(`${where}: result.count must be a positive whole number`);
|
||||
}
|
||||
if (json.container !== undefined) item(json.container);
|
||||
const cook_time = json.cook_time ?? DEFAULT_COOK_TIME;
|
||||
if (!Number.isInteger(cook_time) || cook_time < 1) {
|
||||
throw new Error(`${where}: cook_time must be positive ticks`);
|
||||
}
|
||||
return {
|
||||
ingredients: ingredients.map((ingredient: string | string[]) => ctx.tags.expand(ingredient)),
|
||||
result: json.result,
|
||||
container: json.container,
|
||||
cook_time,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// the recipe whose ingredients are exactly what's in the ingredient slots, one item from each, in any order
|
||||
function find_recipe(recipes: CookingRecipe[], container: Container): CookingRecipe | undefined {
|
||||
const items: string[] = [];
|
||||
for (let slot = 0; slot < INGREDIENT_SLOTS; slot++) {
|
||||
const item = container.get(slot);
|
||||
if (item) items.push(item.id);
|
||||
}
|
||||
if (items.length === 0) return undefined;
|
||||
return recipes.find((recipe) => recipe.ingredients.length === items.length && matches(recipe.ingredients, items));
|
||||
}
|
||||
|
||||
// pairs every ingredient with a different item, trying each way round, like a shapeless recipe
|
||||
function matches(ingredients: string[][], items: string[], used = new Set<number>()): boolean {
|
||||
if (ingredients.length === 0) return true;
|
||||
const [first, ...rest] = ingredients;
|
||||
const fits = (id: string) => first.includes(id);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (used.has(i) || !fits(items[i])) continue;
|
||||
used.add(i);
|
||||
if (matches(rest, items, used)) return true;
|
||||
used.delete(i);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function register_cooking_pot(ctx: ServerContext) {
|
||||
const recipes = load_recipes(ctx);
|
||||
|
||||
const pot_data = (block: BlockRef): PotData => {
|
||||
const existing = block.data?.container && ctx.containers.get(block.data.container);
|
||||
const container = existing || ctx.containers.create(POT_SIZE);
|
||||
block.data = { cook_time: 0, cook_time_total: 0, meal_container: "", ...block.data, container: container.id };
|
||||
return block.data;
|
||||
};
|
||||
|
||||
const is_heated = (block: BlockRef) => {
|
||||
const below = ctx.world.get_block(block.x, block.y - 1, block.z);
|
||||
if (!below || !(below in HEAT_SOURCES)) return false;
|
||||
const state = HEAT_SOURCES[below];
|
||||
return state === undefined || ctx.world.get_state(block.x, block.y - 1, block.z, state) === 1;
|
||||
};
|
||||
|
||||
// like the java mod's CookingPotMenu, in gui pixels: the ingredients in 2 rows of 3, the meal, and the containers
|
||||
// and served meal under it. the screen is in scripts/client.ts
|
||||
const menu_type = ctx.menus.register<BlockRef>("bworld:cooking_pot", (menu, block) => {
|
||||
const container = ctx.containers.get(pot_data(block).container)!;
|
||||
menu.title = "Cooking Pot";
|
||||
for (let slot = 0; slot < INGREDIENT_SLOTS; slot++) {
|
||||
menu.add_slot(container, slot, { x: 29 + (slot % 3) * 18, y: 16 + Math.floor(slot / 3) * 18 });
|
||||
}
|
||||
// the meal stays in the pot until it's served
|
||||
menu.add_slot(container, MEAL_SLOT, { x: 122, y: 25, output_only: true, on_take: () => false });
|
||||
menu.add_slot(container, CONTAINER_SLOT, { x: 90, y: 52 });
|
||||
menu.add_slot(container, OUTPUT_SLOT, { x: 122, y: 52, output_only: true });
|
||||
menu.add_player_inventory(7, 84);
|
||||
menu.add_data("progress", () => (block.data as PotData | undefined)?.cook_time ?? 0);
|
||||
menu.add_data("progress_max", () => (block.data as PotData | undefined)?.cook_time_total ?? 0);
|
||||
menu.add_data("heated", () => is_heated(block) ? 1 : 0);
|
||||
menu.still_valid_near(block);
|
||||
});
|
||||
|
||||
// there's room in the meal slot for what it makes
|
||||
const can_cook = (container: Container, recipe: CookingRecipe) => {
|
||||
const meal = container.get(MEAL_SLOT);
|
||||
if (!meal) return true;
|
||||
return meal.id === recipe.result.id && meal.count + recipe.result.count <= ctx.items.max_stack(meal.id);
|
||||
};
|
||||
|
||||
const cook = (data: PotData, container: Container, recipe: CookingRecipe) => {
|
||||
const meal = container.get(MEAL_SLOT);
|
||||
if (meal) {
|
||||
meal.count += recipe.result.count;
|
||||
} else {
|
||||
container.set(MEAL_SLOT, { ...recipe.result });
|
||||
}
|
||||
data.meal_container = recipe.container ?? "";
|
||||
for (let slot = 0; slot < INGREDIENT_SLOTS; slot++) {
|
||||
const item = container.get(slot);
|
||||
if (item) item.count -= 1;
|
||||
}
|
||||
};
|
||||
|
||||
// the meal goes to the output, into its containers when it needs them, as much as fits
|
||||
const serve = (data: PotData, container: Container) => {
|
||||
const meal = container.get(MEAL_SLOT);
|
||||
if (!meal) {
|
||||
data.meal_container = "";
|
||||
return;
|
||||
}
|
||||
const output = container.get(OUTPUT_SLOT);
|
||||
if (output && output.id !== meal.id) return;
|
||||
const room = ctx.items.max_stack(meal.id) - (output?.count ?? 0);
|
||||
let count = Math.min(meal.count, room);
|
||||
const bowls = container.get(CONTAINER_SLOT);
|
||||
if (data.meal_container) {
|
||||
count = bowls?.id === data.meal_container ? Math.min(count, bowls.count) : 0;
|
||||
}
|
||||
if (count <= 0) return;
|
||||
if (data.meal_container) bowls!.count -= count;
|
||||
if (output) {
|
||||
output.count += count;
|
||||
} else {
|
||||
container.set(OUTPUT_SLOT, { id: meal.id, count });
|
||||
}
|
||||
meal.count -= count;
|
||||
};
|
||||
|
||||
ctx.components.register_block("bworld:cooking_pot", {
|
||||
on_create(block) {
|
||||
pot_data(block);
|
||||
},
|
||||
on_interact(block, _params, player) {
|
||||
const data = pot_data(block);
|
||||
const container = ctx.containers.get(data.container)!;
|
||||
|
||||
// holding what the meal is served in serves one straight into the hand, like the java mod
|
||||
const meal = container.get(MEAL_SLOT);
|
||||
const held = player.inventory.get(player.selected_slot);
|
||||
if (meal && data.meal_container && held?.id === data.meal_container) {
|
||||
held.count -= 1;
|
||||
meal.count -= 1;
|
||||
player.give_item(meal.id, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
menu_type.open(player, block);
|
||||
return true;
|
||||
},
|
||||
on_break(block) {
|
||||
const container = block.data?.container && ctx.containers.get(block.data.container);
|
||||
if (!container) return;
|
||||
for (let slot = 0; slot < container.size; slot++) {
|
||||
const item = container.get(slot);
|
||||
if (item) ctx.world.drop_item(block.x, block.y, block.z, item);
|
||||
}
|
||||
ctx.containers.delete(container.id);
|
||||
},
|
||||
on_tick(block) {
|
||||
const data = pot_data(block);
|
||||
const container = ctx.containers.get(data.container)!;
|
||||
const heated = is_heated(block);
|
||||
const recipe = heated ? find_recipe(recipes, container) : undefined;
|
||||
|
||||
if (recipe && can_cook(container, recipe)) {
|
||||
data.cook_time_total = recipe.cook_time;
|
||||
data.cook_time += 1;
|
||||
if (data.cook_time >= recipe.cook_time) {
|
||||
data.cook_time = 0;
|
||||
cook(data, container, recipe);
|
||||
}
|
||||
} else {
|
||||
// cools off, losing progress slowly
|
||||
data.cook_time = Math.max(0, data.cook_time - 2);
|
||||
}
|
||||
serve(data, container);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// cutting board
|
||||
|
||||
// a bworld:cutting recipe, like the java mod's: one ingredient (an item, or a list any of which will do), the
|
||||
// tool type that cuts it, and everything one of it is cut into
|
||||
interface CuttingRecipe {
|
||||
ingredient: string[];
|
||||
tool: string;
|
||||
result: { id: string; count: number }[];
|
||||
}
|
||||
|
||||
// checked when the server starts, like the cooking pot's
|
||||
function load_cutting_recipes(ctx: ServerContext): CuttingRecipe[] {
|
||||
return ctx.recipes.list("bworld:cutting").map((json, i) => {
|
||||
const where = `bworld:cutting recipe ${i + 1} (${json.ingredients?.[0] ?? "no ingredient"})`;
|
||||
const item = (id: unknown) => {
|
||||
if (typeof id !== "string" || !ctx.items.exists(id)) throw new Error(`${where}: there's no item ${id}`);
|
||||
return id;
|
||||
};
|
||||
if (!Array.isArray(json.ingredients) || json.ingredients.length !== 1) {
|
||||
throw new Error(`${where}: ingredients must be one item, or one list of items any of which will do`);
|
||||
}
|
||||
const choice = [json.ingredients[0]].flat();
|
||||
if (choice.length === 0) throw new Error(`${where}: the ingredient's list of items is empty`);
|
||||
choice.forEach((id) => item_or_tag(ctx, where, id));
|
||||
const ingredient = ctx.tags.expand(choice);
|
||||
if (typeof json.tool !== "string") throw new Error(`${where}: tool must be a tool type, like "knife"`);
|
||||
if (!Array.isArray(json.result) || json.result.length === 0) {
|
||||
throw new Error(`${where}: result must be a list of { id, count }`);
|
||||
}
|
||||
for (const result of json.result) {
|
||||
item(result?.id);
|
||||
if (!Number.isInteger(result.count) || result.count < 1) {
|
||||
throw new Error(`${where}: every result's count must be a positive whole number`);
|
||||
}
|
||||
}
|
||||
return { ingredient, tool: json.tool, result: json.result };
|
||||
});
|
||||
}
|
||||
|
||||
// like the java mod's CuttingBoardBlock and CuttingBoardBlockEntity. what's on the board is the item it shows
|
||||
// (set_block_item), so the client draws it, like its CuttingBoardRenderer
|
||||
export function register_cutting_board(ctx: ServerContext) {
|
||||
const recipes = load_cutting_recipes(ctx);
|
||||
const on_board = (block: BlockRef) => ctx.world.get_block_item(block.x, block.y, block.z);
|
||||
const set_on_board = (block: BlockRef, item: ItemStack | undefined) =>
|
||||
ctx.world.set_block_item(block.x, block.y, block.z, item);
|
||||
|
||||
ctx.components.register_block("bworld:cutting_board", {
|
||||
on_interact(block, _params, player) {
|
||||
const held = player.inventory.get(player.selected_slot);
|
||||
const item = on_board(block);
|
||||
|
||||
// an empty hand takes everything back
|
||||
if (!held) {
|
||||
if (!item) return false;
|
||||
set_on_board(block, undefined);
|
||||
player.give_item(item.id, item.count, item.data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// anything goes on, as much of it as fits, like canAddItem and addItem. a knife on an empty board too
|
||||
const room = !item
|
||||
? ctx.items.max_stack(held.id)
|
||||
: item.id === held.id && JSON.stringify(item.data) === JSON.stringify(held.data)
|
||||
? ctx.items.max_stack(item.id) - item.count
|
||||
: 0;
|
||||
if (room > 0) {
|
||||
const count = Math.min(room, held.count);
|
||||
set_on_board(block, { id: held.id, count: (item?.count ?? 0) + count, data: held.data });
|
||||
held.count -= count;
|
||||
return true;
|
||||
}
|
||||
|
||||
// anything else is a tool for cutting one of what's on it, like processStoredItemUsingTool
|
||||
const recipe = item && recipes.find((recipe) => recipe.ingredient.includes(item.id));
|
||||
if (item && recipe && ctx.items.tool(held.id) === recipe.tool) {
|
||||
for (const result of recipe.result) ctx.world.drop_item(block.x, block.y, block.z, { ...result });
|
||||
set_on_board(block, item.count > 1 ? { ...item, count: item.count - 1 } : undefined);
|
||||
}
|
||||
// like the java mod, the click is used up either way, nothing gets placed or eaten
|
||||
return true;
|
||||
},
|
||||
on_break(block) {
|
||||
const item = on_board(block);
|
||||
if (item) ctx.world.drop_item(block.x, block.y, block.z, item);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { register_verdigris } from "./verdigris/server.ts";
|
||||
import { type JuiceableParams, JUICER_CAPACITY, JUICER_PRESSES } from "./shared.ts";
|
||||
import { juicing_for, juicing_recipes } from "./juicing.ts";
|
||||
import { fermentable_recipes } from "./fermenting.ts";
|
||||
import { register_cooking_pot, register_cutting_board, register_stove } from "./cooking.ts";
|
||||
|
||||
export function setup(ctx: ServerContext) {
|
||||
register_hoeable(ctx);
|
||||
@@ -33,6 +34,9 @@ export function setup(ctx: ServerContext) {
|
||||
register_effects(ctx);
|
||||
register_growable_block(ctx);
|
||||
register_verdigris(ctx);
|
||||
register_stove(ctx);
|
||||
register_cooking_pot(ctx);
|
||||
register_cutting_board(ctx);
|
||||
}
|
||||
|
||||
// right clicking with a type of tool turns the block into another, like any hoe on grass
|
||||
@@ -279,7 +283,7 @@ function register_furnace(ctx: ServerContext) {
|
||||
}
|
||||
}
|
||||
|
||||
// burning, so it heats what's on top, like farmer's delight's cooking pot
|
||||
// burning, so it heats what's on top, like the cooking pot
|
||||
const lit = data.fuel > 0 ? 1 : 0;
|
||||
if (ctx.world.get_state(block.x, block.y, block.z, "lit") !== lit) {
|
||||
ctx.world.set_state(block.x, block.y, block.z, "lit", lit);
|
||||
|
||||
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 207 B |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 386 B |
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 318 B |
|
After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 295 B |
|
After Width: | Height: | Size: 311 B |
|
After Width: | Height: | Size: 377 B |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 497 B |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 428 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 270 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 383 B |
|
After Width: | Height: | Size: 298 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 284 B |
|
After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 394 B |
|
After Width: | Height: | Size: 174 B |
|
After Width: | Height: | Size: 296 B |
|
After Width: | Height: | Size: 433 B |