Melon and pumpkin
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:melon",
|
||||
"textures": {
|
||||
"top": "bworld:melon_top",
|
||||
"bottom": "bworld:melon_bottom",
|
||||
"side": "bworld:melon_side"
|
||||
},
|
||||
"mining": {
|
||||
"toughness": 1.5,
|
||||
"tool": "axe"
|
||||
},
|
||||
"loot_table": "bworld:blocks/melon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:melon_plant",
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_0"
|
||||
},
|
||||
"model": "engine:crop",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_3"
|
||||
}
|
||||
},
|
||||
"age=4": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_4"
|
||||
}
|
||||
},
|
||||
"age=5": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_5"
|
||||
}
|
||||
},
|
||||
"age=6": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_6"
|
||||
}
|
||||
},
|
||||
"age=7": {
|
||||
"textures": {
|
||||
"crop": "bworld:melon_stage_7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"drops": "bworld:melon_seeds",
|
||||
"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",
|
||||
"ripe": "bworld:melon",
|
||||
"seasons": [
|
||||
"summer"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:pumpkin",
|
||||
"textures": {
|
||||
"top": "bworld:pumpkin_top",
|
||||
"bottom": "bworld:pumpkin_bottom",
|
||||
"side": "bworld:pumpkin_side"
|
||||
},
|
||||
"mining": {
|
||||
"toughness": 1.5,
|
||||
"tool": "axe"
|
||||
},
|
||||
"drops": "bworld:pumpkin"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "bworld:pumpkin_plant",
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_0"
|
||||
},
|
||||
"model": "engine:crop",
|
||||
"variants": {
|
||||
"age=0": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_0"
|
||||
}
|
||||
},
|
||||
"age=1": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_1"
|
||||
}
|
||||
},
|
||||
"age=2": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_2"
|
||||
}
|
||||
},
|
||||
"age=3": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_3"
|
||||
}
|
||||
},
|
||||
"age=4": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_4"
|
||||
}
|
||||
},
|
||||
"age=5": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_5"
|
||||
}
|
||||
},
|
||||
"age=6": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_6"
|
||||
}
|
||||
},
|
||||
"age=7": {
|
||||
"textures": {
|
||||
"crop": "bworld:pumpkin_stage_7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
},
|
||||
"drops": "bworld:pumpkin_seeds",
|
||||
"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",
|
||||
"ripe": "bworld:pumpkin",
|
||||
"seasons": [
|
||||
"autumn"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:melon",
|
||||
"base_sell_value": 60
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:melon_seeds",
|
||||
"texture": "bworld:melon_seed",
|
||||
"places": "bworld:melon_plant"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:melon_slice",
|
||||
"texture": "bworld:melon",
|
||||
"food": {
|
||||
"nutrition": 2,
|
||||
"saturation_modifier": 0.3
|
||||
},
|
||||
"base_sell_value": 10
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:pumpkin",
|
||||
"base_sell_value": 80
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"item": {
|
||||
"id": "bworld:pumpkin_seeds",
|
||||
"texture": "bworld:melon_seed",
|
||||
"places": "bworld:pumpkin_plant"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"loot_table": {
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"item": "bworld:melon_slice",
|
||||
"count": {
|
||||
"min": 3,
|
||||
"max": 7
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": [
|
||||
"I"
|
||||
],
|
||||
"key": {
|
||||
"I": "bworld:melon_slice"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:melon_seeds",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "shaped",
|
||||
"pattern": [
|
||||
"I"
|
||||
],
|
||||
"key": {
|
||||
"I": "bworld:pumpkin"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:pumpkin_seeds",
|
||||
"count": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -360,6 +360,9 @@ interface CropParams {
|
||||
upper?: { block: string; stages: number; supporting_age: number };
|
||||
// what the spot becomes when it's broken, like water where rice was
|
||||
leaves?: string;
|
||||
// the block it turns into the morning it's fully grown, like a pumpkin. its stages come before that, the last one
|
||||
// the day before
|
||||
ripe?: string;
|
||||
// the seasons it grows in. a morning in any other season turns it into a dead bush. every season when not set
|
||||
seasons?: Season[];
|
||||
}
|
||||
@@ -428,7 +431,8 @@ function register_farming(ctx: ServerContext) {
|
||||
|
||||
// the stage for how many days it has grown: evenly spread, fully grown on the last day
|
||||
const stage_for = (params: CropParams, days: number) => {
|
||||
const stages = params.stages + (params.upper?.stages ?? 0);
|
||||
// becoming the ripe block is a stage too, the last
|
||||
const stages = params.stages + (params.upper?.stages ?? 0) + (params.ripe ? 1 : 0);
|
||||
return Math.min(stages - 1, Math.floor(days * (stages - 1) / params.days));
|
||||
};
|
||||
|
||||
@@ -443,6 +447,10 @@ function register_farming(ctx: ServerContext) {
|
||||
|
||||
// shows the stage for days, growing or taking away the top block for two block crops
|
||||
const set_days = (block: BlockRef, params: CropParams, days: number) => {
|
||||
if (params.ripe && days >= params.days) {
|
||||
ctx.world.set_block(block.x, block.y, block.z, params.ripe);
|
||||
return;
|
||||
}
|
||||
block.data = { ...block.data, days };
|
||||
const stage = stage_for(params, days);
|
||||
const upper = params.upper;
|
||||
|
||||
Reference in New Issue
Block a user