New crops
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cotton",
|
||||
"texture": "bworld:cotton",
|
||||
"base_sell_value": 15
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:cotton_seeds",
|
||||
"texture": "bworld:cotton_seed",
|
||||
"places": "bworld:cotton"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 161 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 164 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 166 B |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 199 B |
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 272 B |
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 121 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 275 B |
|
After Width: | Height: | Size: 479 B |
|
After Width: | Height: | Size: 461 B |
|
After Width: | Height: | Size: 87 B |
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 212 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 481 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 144 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 220 B |
@@ -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);
|
||||
});
|
||||
|
||||