"stone_shovel": {
"input": ["none", "cobblestone", "none", "none", "stick", "none", "none", "stick", "none"],
"count": 131
+ },
+ "snow_block": {
+ "input": ["snowball", "snowball", "none", "snowball", "snowball", "none", "none", "none", "none"],
+ "count": 1
}
}
\ No newline at end of file
"tool_level": 0,
"tool_type": "axe"
},
+ "planks_spruce": {
+ "hp": 180,
+ "drop": "planks_spruce",
+ "texture": "planks_spruce",
+ "tool_level": 0,
+ "tool_type": "axe"
+ },
"sapling_oak": {
"collision": false,
"transparent": true,
"texture": "sapling_oak",
"hp": 0
},
+ "sapling_spruce": {
+ "collision": false,
+ "transparent": true,
+ "block_required": true,
+ "drop": "sapling_spruce",
+ "texture": "sapling_spruce",
+ "hp": 0
+ },
"bedrock": {
"drop": "bedrock",
"texture": "bedrock"
"tool_type": "shears",
"tint": "#5AC557"
},
+ "log_spruce": {
+ "hp": 180,
+ "drop": "log_spruce",
+ "texture": "log_spruce",
+ "tool_level": 0,
+ "tool_type": "axe"
+ },
+ "leaves_spruce": {
+ "hp": 21,
+ "drop": "leaves_spruce",
+ "texture": "leaves_spruce",
+ "tool_level": 1,
+ "tool_type": "shears",
+ "tint": "#486D4E"
+ },
"sponge": {
"hp": 54,
"drop": "sponge",
"tool_level": 0,
"tool_type": "axe"
},
+ "spruce_slab_bottom": {
+ "top": 8,
+ "sprite_top": 8,
+ "hp": 180,
+ "transparent": true,
+ "drop": "spruce_slab",
+ "meta": "slab",
+ "texture": "planks_spruce",
+ "full_block": "planks_spruce",
+ "other_part": "spruce_slab_top",
+ "tool_level": 0,
+ "tool_type": "axe"
+ },
+ "spruce_slab_top": {
+ "bottom": 8,
+ "sprite_bottom": 8,
+ "hp": 180,
+ "transparent": true,
+ "drop": "spruce_slab",
+ "meta": "slab",
+ "texture": "planks_spruce",
+ "full_block": "planks_spruce",
+ "other_part": "spruce_slab_bottom",
+ "tool_level": 0,
+ "tool_type": "axe"
+ },
"cobblestone_slab_bottom": {
"top": 8,
"sprite_top": 8,
"texture": "obsidian",
"tool_level": 4,
"tool_type": "pickaxe"
+ },
+ "snow": {
+ "top": 14,
+ "sprite_top": 14,
+ "collision": false,
+ "transparent": true,
+ "drop": "snowball",
+ "texture": "snow",
+ "hp": 6,
+ "tool_level": 1,
+ "tool_type": "shovel",
+ "block_required": true
+ },
+ "snow_block": {
+ "collision": true,
+ "transparent": true,
+ "drop": "snowball",
+ "drop_count": 4,
+ "texture": "snow",
+ "hp": 60,
+ "tool_level": 1,
+ "tool_type": "shovel"
}
},
"items": {
"type": "block",
"texture": "sapling_oak"
},
- "bedrock": {
- "name": "Bedrock",
+ "planks_spruce": {
+ "name": "Spruce Planks",
"type": "block",
- "texture": "bedrock"
+ "texture": "planks_spruce"
},
- "water": {
- "name": "Water",
+ "sapling_spruce": {
+ "name": "Spruce Sapling",
"type": "block",
- "texture": "water"
+ "texture": "sapling_spruce"
},
- "lava": {
- "name": "Lava",
+ "bedrock": {
+ "name": "Bedrock",
"type": "block",
- "texture": "lava"
+ "texture": "bedrock"
},
"sand": {
"name": "Sand",
"type": "block",
"texture": "leaves_oak"
},
+ "log_spruce": {
+ "name": "Spruce",
+ "type": "block",
+ "texture": "log_spruce"
+ },
+ "leaves_spruce": {
+ "name": "Spruce Leaves",
+ "type": "block",
+ "texture": "leaves_spruce"
+ },
"glass": {
"name": "Glass",
"type": "block",
"top_slab_block": "oak_slab_top",
"bottom_slab_block": "oak_slab_bottom"
},
+ "spruce_slab": {
+ "name": "Spruce Slab",
+ "type": "slab",
+ "texture": "spruce_slab",
+ "top_slab_block": "spruce_slab_top",
+ "bottom_slab_block": "spruce_slab_bottom"
+ },
"cobblestone_slab": {
"name": "Cobblestone Slab",
"type": "slab",
"type": "block",
"texture": "obsidian"
},
+ "snow_block": {
+ "name": "Snow Block",
+ "type": "block",
+ "texture": "snow"
+ },
"stick": {
"name": "Stick",
"texture": "stick"
"origin_x": 0.25,
"action_key": "use_lava_bucket",
"max_stack": 1
+ },
+ "snowball": {
+ "name": "Snowball",
+ "texture": "snowball",
+ "max_stack": 16
}
}
}
override fun update(x: Int, y: Int) {
val blockOnTop = gameWorld.getForeMap(x, y - 1)
- if (blockOnTop.collision || blockOnTop.isFluid()) {
- gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("dirt"))
+
+ val makesDirt = blockOnTop.params.hasCollision || blockOnTop.isFluid()
+
+ when {
+ makesDirt -> gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("dirt"))
+ blockOnTop.params.key == "snow" -> gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("grass_snowed"))
}
}
override fun update(x: Int, y: Int) {
val blockOnTop = gameWorld.getForeMap(x, y - 1)
- if (blockOnTop.collision || blockOnTop.isFluid()) {
- gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("dirt"))
+ val makesDirt = blockOnTop.params.hasCollision || blockOnTop.isFluid()
+
+ when {
+ makesDirt -> gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("dirt"))
+ blockOnTop.params.key != "snow" -> gameWorld.setForeMap(x, y, mGameItemsHolder.getBlock("grass"))
}
}
endIndex = size - 1
)
- _items[0] = item.toInventoryItem()
+ _items[0] = item.toInventoryItem(item.params.maxStack)
}
}
\ No newline at end of file
val bedrock = gameItemsHolder.getBlock("bedrock")
val dirt = gameItemsHolder.getBlock("dirt")
val stone = gameItemsHolder.getBlock("stone")
+ val snow = gameItemsHolder.getBlock("snow")
foreMap[x][surfaceHeight] = grass
foreMap[x][config.height - 1] = bedrock
backMap[x][surfaceHeight] = grass
backMap[x][config.height - 1] = bedrock
+ if (surfaceHeight - 1 < config.seaLevel) {
+ foreMap[x][surfaceHeight - 1] = snow
+ }
+
for (y in min(surfaceHeight + 1, config.seaLevel) ..< config.height - 1) {
if (y <= surfaceHeight) {
backMap[x][y] = dirt
}
backMap[x][y] = foreMap[x][y]
}
+
+ val plant = random.nextInt(100)
+ if (surfaceHeight < config.seaLevel) {
+ if (plant < 10) {
+ generateSpruce(x)
+ }
+ }
}
private fun plainsBiome(x: Int) {
}
}
+ private fun generateSpruce(x: Int) {
+ val log = gameItemsHolder.getBlock("log_spruce")
+ val leaves = gameItemsHolder.getBlock("leaves_spruce")
+ val h = heights[x] - 1
+ val treeH = random.nextInt(7, 9)
+ val height = max(0, h - treeH)
+
+ val top = height - 1
+ if (top >= 0) {
+ foreMap[x][top] = leaves
+ backMap[x][top] = leaves
+ }
+
+ for (x1 in max(0, x - 1) .. min(config.width - 1, x + 1)) {
+ val y = height
+ foreMap[x1][y] = leaves
+ backMap[x1][y] = leaves
+ }
+
+ for (y in 1..2) {
+ for (x1 in max(0, x - y) .. min(config.width - 1, x + y)) {
+ foreMap[x1][height + 1 + y] = leaves
+ backMap[x1][height + 1 + y] = leaves
+ }
+ }
+
+ for (y in h downTo height) {
+ backMap[x][y] = log
+ }
+ }
+
private fun generateTallGrass(x: Int) {
val tallGrass = gameItemsHolder.getBlock(plainsPlants.random(random))
val h = heights[x] - 1