New crops

This commit is contained in:
2026-10-10 15:28:20 -03:00
parent 373d9f83e5
commit 6dc85ff17e
65 changed files with 478 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
{
"format_version": 1,
"block": {
"id": "bworld:beetroots",
"textures": {
"crop": "bworld:beetroot_stage_0"
},
"model": "engine:crop",
"variants": {
"age=0": {
"textures": {
"crop": "bworld:beetroot_stage_0"
}
},
"age=1": {
"textures": {
"crop": "bworld:beetroot_stage_1"
}
},
"age=2": {
"textures": {
"crop": "bworld:beetroot_stage_2"
}
},
"age=3": {
"textures": {
"crop": "bworld:beetroot_stage_3"
}
},
"age=4": {
"textures": {
"crop": "bworld:beetroot_stage_4"
}
},
"age=5": {
"textures": {
"crop": "bworld:beetroot_stage_5"
}
},
"age=6": {
"textures": {
"crop": "bworld:beetroot_stage_6"
}
},
"age=7": {
"textures": {
"crop": "bworld:beetroot_stage_7"
}
}
},
"render_layer": "cutout",
"collision": false,
"mining": {
"toughness": 0
},
"loot_table": "bworld:blocks/beetroots",
"item": false,
"place_on": [
"bworld:hoed_dirt"
],
"states": [
{
"name": "age",
"bits": 3,
"default": 0
}
],
"components": {
"bworld:crop": {
"days": 6,
"stages": 8,
"fertilizer": "bworld:bone_meal",
"seasons": [
"spring",
"autumn"
]
}
}
}
}
+82
View File
@@ -0,0 +1,82 @@
{
"format_version": 1,
"block": {
"id": "bworld:cotton",
"textures": {
"cross": "bworld:cotton_stage_0"
},
"model": "engine:cross",
"variants": {
"age=0": {
"textures": {
"cross": "bworld:cotton_stage_0"
}
},
"age=1": {
"textures": {
"cross": "bworld:cotton_stage_1"
}
},
"age=2": {
"textures": {
"cross": "bworld:cotton_stage_2"
}
},
"age=3": {
"textures": {
"cross": "bworld:cotton_stage_3"
}
},
"age=4": {
"textures": {
"cross": "bworld:cotton_stage_4"
}
},
"age=5": {
"textures": {
"cross": "bworld:cotton_stage_5"
}
},
"age=6": {
"textures": {
"cross": "bworld:cotton_stage_6"
}
},
"age=7": {
"textures": {
"cross": "bworld:cotton_stage_7"
}
}
},
"render_layer": "cutout",
"collision": false,
"mining": {
"toughness": 0
},
"loot_table": "bworld:blocks/cotton",
"item": false,
"place_on": [
"bworld:hoed_dirt"
],
"states": [
{
"name": "age",
"bits": 3,
"default": 0
}
],
"components": {
"bworld:crop": {
"days": 10,
"stages": 8,
"fertilizer": "bworld:bone_meal",
"regrow_days": 3,
"harvest": "bworld:harvest/cotton",
"seasons": [
"summer",
"autumn"
]
}
}
}
}
+71
View File
@@ -0,0 +1,71 @@
{
"format_version": 1,
"block": {
"id": "bworld:strawberries",
"textures": {
"cross": "bworld:strawberry_stage_0"
},
"model": "engine:cross",
"variants": {
"age=0": {
"textures": {
"cross": "bworld:strawberry_stage_0"
}
},
"age=1": {
"textures": {
"cross": "bworld:strawberry_stage_1"
}
},
"age=2": {
"textures": {
"cross": "bworld:strawberry_stage_2"
}
},
"age=3": {
"textures": {
"cross": "bworld:strawberry_stage_3"
}
},
"age=4": {
"textures": {
"cross": "bworld:strawberry_stage_4"
}
},
"age=5": {
"textures": {
"cross": "bworld:strawberry_stage_5"
}
}
},
"render_layer": "cutout",
"collision": false,
"mining": {
"toughness": 0
},
"loot_table": "bworld:blocks/strawberries",
"item": false,
"place_on": [
"bworld:hoed_dirt"
],
"states": [
{
"name": "age",
"bits": 3,
"default": 0
}
],
"components": {
"bworld:crop": {
"days": 8,
"stages": 6,
"fertilizer": "bworld:bone_meal",
"regrow_days": 4,
"harvest": "bworld:harvest/strawberries",
"seasons": [
"spring"
]
}
}
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"format_version": 1,
"item": {
"id": "bworld:beetroot",
"texture": "bworld:beetroot",
"food": {
"nutrition": 1,
"saturation_modifier": 0.6
},
"places": "bworld:beetroots",
"base_sell_value": 25
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"format_version": 1,
"item": {
"id": "bworld:cotton",
"texture": "bworld:cotton",
"base_sell_value": 15
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"format_version": 1,
"item": {
"id": "bworld:cotton_seeds",
"texture": "bworld:cotton_seed",
"places": "bworld:cotton"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"format_version": 1,
"item": {
"id": "bworld:strawberry",
"texture": "bworld:strawberry",
"food": {
"nutrition": 2,
"saturation_modifier": 0.3
},
"base_sell_value": 30
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"format_version": 1,
"item": {
"id": "bworld:strawberry_seeds",
"texture": "bworld:strawberry_seed",
"places": "bworld:strawberries"
}
}
@@ -0,0 +1,39 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:beetroot"
}
]
},
{
"conditions": [
{
"condition": "block_state",
"states": {
"age": 7
}
}
],
"entries": [
{
"item": "bworld:beetroot",
"functions": [
{
"function": "set_count",
"count": {
"n": 3,
"p": 0.5714
},
"add": true
}
]
}
]
}
]
}
}
@@ -0,0 +1,61 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:cotton",
"conditions": [
{
"condition": "block_state",
"states": {
"age": 7
}
}
]
},
{
"item": "bworld:cotton_seeds",
"conditions": [
{
"condition": "inverted",
"term": {
"condition": "block_state",
"states": {
"age": 7
}
}
}
]
}
]
},
{
"conditions": [
{
"condition": "block_state",
"states": {
"age": 7
}
}
],
"entries": [
{
"item": "bworld:cotton_seeds",
"functions": [
{
"function": "set_count",
"count": {
"n": 3,
"p": 0.5714
},
"add": true
}
]
}
]
}
]
}
}
@@ -0,0 +1,29 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:strawberry_seeds"
}
]
},
{
"conditions": [
{
"condition": "block_state",
"states": {
"age": 5
}
}
],
"entries": [
{
"item": "bworld:strawberry"
}
]
}
]
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:cotton",
"count": {
"min": 1,
"max": 2
}
}
]
}
]
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{
"item": "bworld:strawberry",
"count": {
"min": 1,
"max": 3
}
}
]
}
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

+31
View File
@@ -275,3 +275,34 @@ Deno.test("a two block crop dies whole, its top going without dropping anything"
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
assertEquals(t.game.item_entities(), []);
});
Deno.test("beetroots, cotton and strawberries grow, and strawberries and cotton are picked and grow back", async () => {
const t = await setup();
// beetroots and strawberries grow in spring
assertEquals(grow(t, 0, "bworld:beetroots", 6), [1, 2, 3, 4, 5, 7]);
const strawberries = grow(t, 1, "bworld:strawberries", 8);
assertEquals(strawberries.at(-2), 4, "not grown a day early");
assertEquals(strawberries.at(-1), 5);
t.use(1, 101, 0);
const picked = t.game.item_entities().map((e) => e.item.to_data());
assertEquals(picked.map((item) => item.id), ["bworld:strawberry"]);
assertEquals(t.state(1, 101, 0, "age"), 2, "back to a young bush");
// cotton grows in summer, which starts on day 50
t.game.set_time(49 * CYCLE_TICKS);
t.game.tick();
assertEquals(grow(t, 2, "bworld:cotton", 10), [0, 1, 2, 2, 3, 4, 4, 5, 6, 7]);
// picked like strawberries, it grows back in 3 days
t.use(2, 101, 0);
const cotton = t.game.item_entities().map((e) => e.item.to_data()).filter((item) => item.id === "bworld:cotton");
assertEquals(cotton.length, 1);
assert(cotton[0].count >= 1 && cotton[0].count <= 2);
assertEquals(t.state(2, 101, 0, "age"), 4, "back to a young plant");
assertEquals(t.game.world.get_block_id(2, 101, 0), "bworld:cotton", "the plant stays");
for (let day = 0; day < 3; day++) {
t.game.set_block_state(2, 100, 0, 1);
t.next_morning();
}
assertEquals(t.state(2, 101, 0, "age"), 7);
});