diff --git a/assets/cubyz/biomes/beach.json b/assets/cubyz/biomes/beach.json new file mode 100644 index 00000000..27601548 --- /dev/null +++ b/assets/cubyz/biomes/beach.json @@ -0,0 +1,13 @@ +{ + "chance" : 0, + "type" : "WARM_OCEAN", + "minHeight" : -4, + "maxHeight" : 6, + + "music" : "Sincerely", + + "ground_structure" : [ + "3 to 4 cubyz:sand", + "1 to 2 cubyz:sandstone" + ] +} diff --git a/assets/cubyz/biomes/bush_lands.json b/assets/cubyz/biomes/bush_lands.json new file mode 100644 index 00000000..5cdf022d --- /dev/null +++ b/assets/cubyz/biomes/bush_lands.json @@ -0,0 +1,37 @@ +{ + "type" : "SHRUBLAND", + "minHeight" : 4, + "maxHeight" : 60, + + "roughness" : 20, + "hills" : 10, + "rivers" : true, + + "music" : "sunrise", + + "ground_structure" : [ + "cubyz:grass", + "2 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.01, + "type" : "bush", + "height" : 4, + "height_variation" : 6 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:soil", + "chance" : 0.001, + "width" : 12, + "variation" : 4, + "depth" : 2, + "smoothness" : 0.2 + } + ] +} diff --git a/assets/cubyz/biomes/bush_mountains.json b/assets/cubyz/biomes/bush_mountains.json new file mode 100644 index 00000000..586ea04d --- /dev/null +++ b/assets/cubyz/biomes/bush_mountains.json @@ -0,0 +1,46 @@ +{ + "type" : "MOUNTAIN_GRASSLAND", + "minHeight" : 60, + "maxHeight" : 256, + + "roughness" : 10, + "mountains" : 100, + + "rivers" : true, + + "ground_structure" : [ + "0 to 1 cubyz:grass", + "0 to 1 cubyz:gravel", + "0 to 1 cubyz:cobblestone" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.01, + "type" : "round", + "height" : 4, + "height_variation" : 1 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:gravel", + "chance" : 0.003, + "width" : 6, + "variation" : 2, + "depth" : 3, + "smoothness" : 0.8 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:snow", + "chance" : 0.002, + "width" : 6, + "variation" : 2, + "depth" : 3, + "smoothness" : 0.8 + } + ] +} diff --git a/assets/cubyz/biomes/cave/cave.json b/assets/cubyz/biomes/cave/cave.json new file mode 100644 index 00000000..0eed8a5b --- /dev/null +++ b/assets/cubyz/biomes/cave/cave.json @@ -0,0 +1,27 @@ +{ + "type" : "CAVE", + "maxHeight" : 0, + + "music" : "heart-of-the-beast", + + "ground_structure" : [ + "0 to 1 cubyz:gravel", + "cubyz:stone" + ], + "structures" : [ + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:cobblestone", + "size" : 5, + "size_variance" : 3 + }, + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:stone", + "size" : 4, + "size_variance" : 2 + } + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/cave/crystal.json b/assets/cubyz/biomes/cave/crystal.json new file mode 100644 index 00000000..202968de --- /dev/null +++ b/assets/cubyz/biomes/cave/crystal.json @@ -0,0 +1,28 @@ +{ + "type" : "CAVE", + "maxHeight" : -512, + + "chance" : 0.2, + + "caves" : 0.0, + "crystals" : 32, + + "music" : "mana-two-part-2", + "stoneBlock" : "cubyz:stone", + "structures" : [ + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:cobblestone", + "size" : 5, + "size_variance" : 3 + }, + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:stone", + "size" : 4, + "size_variance" : 2 + } + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/cave/crystal_forest.json b/assets/cubyz/biomes/cave/crystal_forest.json new file mode 100644 index 00000000..944ab51c --- /dev/null +++ b/assets/cubyz/biomes/cave/crystal_forest.json @@ -0,0 +1,29 @@ +{ + "type" : "CAVE", + "maxHeight" : -512, + + "chance" : 0.01, + + "caves" : 0.0, + "crystals" : 32, + + "music" : "leaves", + + "stoneBlock" : "cubyz:stone", + "ground_structure" : [ + "cubyz:grass", + "2 to 3 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.02, + "type" : "round", + "height" : 4, + "height_variation" : 2 + } + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/cave/sky.json b/assets/cubyz/biomes/cave/sky.json new file mode 100644 index 00000000..fd86baff --- /dev/null +++ b/assets/cubyz/biomes/cave/sky.json @@ -0,0 +1,8 @@ +{ + "type" : "CAVE", + "minHeight" : 0, + + "music" : "GymnopedieNo1", + + "ground_structure" : [], +} \ No newline at end of file diff --git a/assets/cubyz/biomes/cave/stone_forest.json b/assets/cubyz/biomes/cave/stone_forest.json new file mode 100644 index 00000000..50ac24f3 --- /dev/null +++ b/assets/cubyz/biomes/cave/stone_forest.json @@ -0,0 +1,57 @@ +{ + "type" : "CAVE", + + "chance" : 0.01, + + "caves" : -0.4, + + "music" : "heart-of-the-beast", + + "ground_structure" : [ + "0 to 1 cubyz:gravel", + "cubyz:stone" + ], + "structures" : [ + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:cobblestone", + "size" : 5, + "size_variance" : 3 + }, + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:stone", + "size" : 4, + "size_variance" : 2 + } + { + "id" : "cubyz:simple_vegetation", + "chance" : 0.0001, + "block" : "cubyz:workbench", + "height" : 1, + "height_variation" : 0, + }, + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:cobblestone", + "log" : "cubyz:stone", + "top" : "cubyz:stone", + "chance" : 0.01, + "type" : "round", + "height" : 3, + "height_variation" : 2 + }, + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:stone", + "log" : "cubyz:stone", + "top" : "cubyz:stone", + "chance" : 0.03, + "type" : "round", + "height" : 3, + "height_variation" : 2 + } + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/cold_ocean.json b/assets/cubyz/biomes/cold_ocean.json new file mode 100644 index 00000000..cb95d43c --- /dev/null +++ b/assets/cubyz/biomes/cold_ocean.json @@ -0,0 +1,34 @@ +{ + "type" : "ARCTIC_OCEAN", + "minHeight" : -100, + "maxHeight" : -2, + + "roughness" : 20, + "hills" : 10, + + "music" : "under_the_water_sky", + + "ground_structure" : [ + "1 to 2 cubyz:cobblestone" + ], + "structures" : [ + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:mossy_cobblestone", + "chance" : 0.004, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:gravel", + "chance" : 0.002, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + } + ] +} diff --git a/assets/cubyz/biomes/desert.json b/assets/cubyz/biomes/desert.json new file mode 100644 index 00000000..f8c25356 --- /dev/null +++ b/assets/cubyz/biomes/desert.json @@ -0,0 +1,23 @@ +{ + "type" : "DESERT", + "minHeight" : 2, + "maxHeight" : 40, + + "hills" : 20, + + "music" : "EasternThought", + + "ground_structure" : [ + "3 to 4 cubyz:sand" + ], + "structures" : [ + { + "id" : "cubyz:simple_vegetation", + "block" : "cubyz:cactus", + "chance" : 0.01, + "height" : 2, + "height_variation" : 3 + } + ], + "stoneBlock" : "cubyz:sandstone" +} diff --git a/assets/cubyz/biomes/flatland.json b/assets/cubyz/biomes/flatland.json new file mode 100644 index 00000000..6c2b2439 --- /dev/null +++ b/assets/cubyz/biomes/flatland.json @@ -0,0 +1,13 @@ +{ + "chance" : 0, + "type" : "GRASSLAND", + "minHeight" : 24, + "maxHeight" : 40, + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "cubyz:grass", + "2 cubyz:soil" + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/forest.json b/assets/cubyz/biomes/forest.json new file mode 100644 index 00000000..af777f9e --- /dev/null +++ b/assets/cubyz/biomes/forest.json @@ -0,0 +1,29 @@ +{ + "type" : "FOREST", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 10, + "hills" : 10, + + "music" : "leaves", + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "cubyz:grass", + "2 to 3 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.05, + "type" : "round", + "height" : 6, + "height_variation" : 3 + } + ] +} diff --git a/assets/cubyz/biomes/glacier.json b/assets/cubyz/biomes/glacier.json new file mode 100644 index 00000000..8e8589e2 --- /dev/null +++ b/assets/cubyz/biomes/glacier.json @@ -0,0 +1,15 @@ +{ + "type" : "GLACIER", + "minHeight" : 60, + "maxHeight" : 256, + + "roughness" : 50, + "mountains" : 50, + "hills" : 50, + + "ground_structure" : [ + "3 to 5 cubyz:snow", + "2 to 3 cubyz:ice" + ], + "stoneBlock" : "cubyz:ice" +} diff --git a/assets/cubyz/biomes/grassland.json b/assets/cubyz/biomes/grassland.json new file mode 100644 index 00000000..2e93400a --- /dev/null +++ b/assets/cubyz/biomes/grassland.json @@ -0,0 +1,36 @@ +{ + "type" : "GRASSLAND", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 1, + "hills" : 5, + + "music" : "sunrise", + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "cubyz:grass", + "2 to 3 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.001, + "type" : "round", + "height" : 6, + "height_variation" : 3 + }, + { + "id" : "cubyz:boulder", + "chance" : 0.00001, + "block" : "cubyz:stone", + "size" : 5, + "size_variance" : 1 + } + ] +} diff --git a/assets/cubyz/biomes/gravel_beach.json b/assets/cubyz/biomes/gravel_beach.json new file mode 100644 index 00000000..0a080f0e --- /dev/null +++ b/assets/cubyz/biomes/gravel_beach.json @@ -0,0 +1,23 @@ +{ + "chance" : 0, + "type" : "OCEAN", + "minHeight" : -4, + "maxHeight" : 6, + + "music" : "GymnopedieNo1", + + "ground_structure" : [ + "2 to 3 cubyz:gravel" + ], + "structures" : [ + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:mossy_cobblestone", + "chance" : 0.001, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.5 + } + ] +} diff --git a/assets/cubyz/biomes/jungle(TODO).json b/assets/cubyz/biomes/jungle(TODO).json new file mode 100644 index 00000000..1720f504 --- /dev/null +++ b/assets/cubyz/biomes/jungle(TODO).json @@ -0,0 +1,30 @@ +{ + "type" : "RAINFOREST", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 10, + "hills" : 10, + + "music" : "leaves", + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "cubyz:grass" + ], + "stoneBlock" : "cubyz:soil", + + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.05, + "type" : "round", + "height" : 6, + "height_variation" : 3 + } + ] +} diff --git a/assets/cubyz/biomes/mountains.json b/assets/cubyz/biomes/mountains.json new file mode 100644 index 00000000..f2fde0cb --- /dev/null +++ b/assets/cubyz/biomes/mountains.json @@ -0,0 +1,27 @@ +{ + "type" : "MOUNTAIN_FOREST", + "minHeight" : 20, + "maxHeight" : 256, + + "roughness" : 10, + "mountains" : 100, + + "rivers" : true, + + "ground_structure" : [ + "cubyz:grass", + "1 to 2 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.05, + "type" : "round", + "height" : 3, + "height_variation" : 3 + } + ] +} diff --git a/assets/cubyz/biomes/ocean.json b/assets/cubyz/biomes/ocean.json new file mode 100644 index 00000000..be57bea8 --- /dev/null +++ b/assets/cubyz/biomes/ocean.json @@ -0,0 +1,36 @@ +{ + "type" : "OCEAN", + "minHeight" : -100, + "maxHeight" : -2, + + "roughness" : 15, + "hills" : 15, + + "rivers" : true, + + "music" : "under_the_water_sky", + + "ground_structure" : [ + "2 to 3 cubyz:gravel" + ], + "structures" : [ + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:mossy_cobblestone", + "chance" : 0.004, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:sand", + "chance" : 0.002, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + } + ] +} diff --git a/assets/cubyz/biomes/peak.json b/assets/cubyz/biomes/peak.json new file mode 100644 index 00000000..7914c21e --- /dev/null +++ b/assets/cubyz/biomes/peak.json @@ -0,0 +1,15 @@ +{ + "type" : "PEAK", + "minHeight" : 120, + "maxHeight" : 256, + + "mountains" : 150, + + "music" : "DarkTimes", + + "ground_structure" : [ + "1 to 2 cubyz:snow", + "0 to 1 cubyz:ice", + "0 to 2 cubyz:cobblestone" + ] +} diff --git a/assets/cubyz/biomes/rocky_beach.json b/assets/cubyz/biomes/rocky_beach.json new file mode 100644 index 00000000..e5425742 --- /dev/null +++ b/assets/cubyz/biomes/rocky_beach.json @@ -0,0 +1,32 @@ +{ + "chance" : 0, + "type" : "ARCTIC_OCEAN", + "minHeight" : -4, + "maxHeight" : 6, + + "music" : "GymnopedieNo1", + + "ground_structure" : [ + "2 to 3 cubyz:cobblestone" + ], + "structures" : [ + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:mossy_cobblestone", + "chance" : 0.004, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + }, + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:gravel", + "chance" : 0.002, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + } + ] +} diff --git a/assets/cubyz/biomes/rocky_grassland.json b/assets/cubyz/biomes/rocky_grassland.json new file mode 100644 index 00000000..7ccb33b6 --- /dev/null +++ b/assets/cubyz/biomes/rocky_grassland.json @@ -0,0 +1,34 @@ +{ + "chance" : 0.04, + "type" : "GRASSLAND", + "minHeight" : 10, + "maxHeight" : 40, + + "mountains" : 30, + + "music" : "sunrise", + + "ground_structure" : [ + "cubyz:grass", + "0 to 1 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.001, + "type" : "round", + "height" : 6, + "height_variation" : 3 + }, + { + "id" : "cubyz:boulder", + "chance" : 0.001, + "block" : "cubyz:cobblestone", + "size" : 5, + "size_variance" : 4 + } + ] +} \ No newline at end of file diff --git a/assets/cubyz/biomes/swamp.json b/assets/cubyz/biomes/swamp.json new file mode 100644 index 00000000..15290e0c --- /dev/null +++ b/assets/cubyz/biomes/swamp.json @@ -0,0 +1,30 @@ +{ + "type" : "SWAMP", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 2, + "hills" : 2, + + "music" : "leaves", + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "0 to 1 cubyz:grass", + "0 to 1 cubyz:water", + "2 to 3 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.05, + "type" : "round", + "height" : 6, + "height_variation" : 3 + } + ] +} diff --git a/assets/cubyz/biomes/taiga.json b/assets/cubyz/biomes/taiga.json new file mode 100644 index 00000000..625b2973 --- /dev/null +++ b/assets/cubyz/biomes/taiga.json @@ -0,0 +1,27 @@ +{ + "type" : "TAIGA", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 10, + "hills" : 10, + + "validPlayerSpawn" : true, + + "ground_structure" : [ + "0 to 1 cubyz:grass", + "2 to 3 cubyz:soil" + ], + "structures" : [ + { + "id" : "cubyz:simple_tree", + "leaves" : "cubyz:oak_leaves", + "log" : "cubyz:oak_log", + "top" : "cubyz:oak_top", + "chance" : 0.05, + "type" : "pyramid", + "height" : 8, + "height_variation" : 5 + } + ] +} diff --git a/assets/cubyz/biomes/tundra.json b/assets/cubyz/biomes/tundra.json new file mode 100644 index 00000000..fc894dfa --- /dev/null +++ b/assets/cubyz/biomes/tundra.json @@ -0,0 +1,14 @@ +{ + "type" : "TUNDRA", + "minHeight" : 2, + "maxHeight" : 40, + + "roughness" : 10, + "hills" : 15, + "mountains" : 20, + + "ground_structure" : [ + "0 to 1 cubyz:grass", + "0 to 1 cubyz:gravel" + ] +} diff --git a/assets/cubyz/biomes/warm_ocean.json b/assets/cubyz/biomes/warm_ocean.json new file mode 100644 index 00000000..6e3d0bea --- /dev/null +++ b/assets/cubyz/biomes/warm_ocean.json @@ -0,0 +1,25 @@ +{ + "type" : "WARM_OCEAN", + "minHeight" : -100, + "maxHeight" : -2, + + "roughness" : 10, + "hills" : 20, + + "music" : "GymnopedieNo1", + + "ground_structure" : [ + "2 to 4 cubyz:sand" + ], + "structures" : [ + { + "id" : "cubyz:ground_patch", + "block" : "cubyz:gravel", + "chance" : 0.002, + "width" : 6, + "variation" : 2, + "depth" : 2, + "smoothness" : 0.2 + } + ] +} diff --git a/assets/cubyz/blocks/air.json b/assets/cubyz/blocks/air.json new file mode 100644 index 00000000..d8636fe3 --- /dev/null +++ b/assets/cubyz/blocks/air.json @@ -0,0 +1,20 @@ +{ + "class" : "air", + "breakingPower" : 0, + "hardness" : 4, + + "absorbtion" : 0, + + "transparent" : true, + "lightingTransparent" : true, + "viewThrough" : true, + "solid" : false, + "rotation" : "cubyz:no_rotation", + "degradable" : true, + "hasItem" : false, + + + + "drops" : [], + "model" : "" +} \ No newline at end of file diff --git a/assets/cubyz/blocks/cactus.json b/assets/cubyz/blocks/cactus.json new file mode 100644 index 00000000..a8e96de7 --- /dev/null +++ b/assets/cubyz/blocks/cactus.json @@ -0,0 +1,9 @@ +{ + "class" : "leaf", + "hardness" : 4, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:cactus" +} diff --git a/assets/cubyz/blocks/coal_ore.json b/assets/cubyz/blocks/coal_ore.json new file mode 100644 index 00000000..8d079de7 --- /dev/null +++ b/assets/cubyz/blocks/coal_ore.json @@ -0,0 +1,19 @@ +{ + "class" : "stone", + "hardness" : 40, + "breakingPower" : 1, + "ore" : { + "veins" : 10, + "size" : 100, + "height" : 128, + "density" : 0.5, + "sources" : [ + "cubyz:stone" + ] + }, + "drops" : [ + "cubyz:coal" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:coal_ore" +} diff --git a/assets/cubyz/blocks/cobblestone.json b/assets/cubyz/blocks/cobblestone.json new file mode 100644 index 00000000..1f84929f --- /dev/null +++ b/assets/cubyz/blocks/cobblestone.json @@ -0,0 +1,30 @@ +{ + "class" : "stone", + "hardness" : 25, + "item" : { + "material" : { + "density" : 1.0, + "resistance" : 1.0, + "power" : 0.4, + "roughness" : 1.0, + "colors" : [ + 0xff222222, 0xff444444, 0xff666666, 0xff888888, 0xffaaaaaa + ] + } + }, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:cobblestone", + + "rotation" : "cubyz:multi_texture", + "multi_texture_variants" : [ + { + "texture" : "cubyz:cobblestone" + }, + { + "texture" : "cubyz:cobblestone_1" + } + ] +} diff --git a/assets/cubyz/blocks/diamond_ore.json b/assets/cubyz/blocks/diamond_ore.json new file mode 100644 index 00000000..442150e2 --- /dev/null +++ b/assets/cubyz/blocks/diamond_ore.json @@ -0,0 +1,19 @@ +{ + "class" : "stone", + "hardness" : 80, + "breakingPower" : 10, + "ore" : { + "veins" : 1, + "size" : 10, + "height" : -100, + "density" : 0.1, + "sources" : [ + "cubyz:stone" + ] + }, + "drops" : [ + "cubyz:diamond" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:diamond_ore" +} diff --git a/assets/cubyz/blocks/glow_crystal/black.json b/assets/cubyz/blocks/glow_crystal/black.json new file mode 100644 index 00000000..aa0716c6 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/black.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x111111, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/black" +} diff --git a/assets/cubyz/blocks/glow_crystal/blue.json b/assets/cubyz/blocks/glow_crystal/blue.json new file mode 100644 index 00000000..64d7afcf --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/blue.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x0000ff, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/blue" +} diff --git a/assets/cubyz/blocks/glow_crystal/brown.json b/assets/cubyz/blocks/glow_crystal/brown.json new file mode 100644 index 00000000..16c7a309 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/brown.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x804000, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/brown" +} diff --git a/assets/cubyz/blocks/glow_crystal/cyan.json b/assets/cubyz/blocks/glow_crystal/cyan.json new file mode 100644 index 00000000..0978a59c --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/cyan.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x00ffb0, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/cyan" +} diff --git a/assets/cubyz/blocks/glow_crystal/dark_gray.json b/assets/cubyz/blocks/glow_crystal/dark_gray.json new file mode 100644 index 00000000..6778b6b7 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/dark_gray.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x444444, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/dark_gray" +} diff --git a/assets/cubyz/blocks/glow_crystal/dark_green.json b/assets/cubyz/blocks/glow_crystal/dark_green.json new file mode 100644 index 00000000..f19d3b88 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/dark_green.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x008000, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/dark_green" +} diff --git a/assets/cubyz/blocks/glow_crystal/dark_red.json b/assets/cubyz/blocks/glow_crystal/dark_red.json new file mode 100644 index 00000000..f9659fec --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/dark_red.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x800000, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/dark_red" +} diff --git a/assets/cubyz/blocks/glow_crystal/gray.json b/assets/cubyz/blocks/glow_crystal/gray.json new file mode 100644 index 00000000..b4e5d2ed --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/gray.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x808080, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/gray" +} diff --git a/assets/cubyz/blocks/glow_crystal/green.json b/assets/cubyz/blocks/glow_crystal/green.json new file mode 100644 index 00000000..aa5c5f53 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/green.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x00ff00, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/green" +} diff --git a/assets/cubyz/blocks/glow_crystal/light_blue.json b/assets/cubyz/blocks/glow_crystal/light_blue.json new file mode 100644 index 00000000..fb96211f --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/light_blue.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x4040ff, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/light_blue" +} diff --git a/assets/cubyz/blocks/glow_crystal/orange.json b/assets/cubyz/blocks/glow_crystal/orange.json new file mode 100644 index 00000000..88a68908 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/orange.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0xff8000, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/orange" +} diff --git a/assets/cubyz/blocks/glow_crystal/purple.json b/assets/cubyz/blocks/glow_crystal/purple.json new file mode 100644 index 00000000..c0301b70 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/purple.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0xff00ff, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/purple" +} diff --git a/assets/cubyz/blocks/glow_crystal/red.json b/assets/cubyz/blocks/glow_crystal/red.json new file mode 100644 index 00000000..a72a6017 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/red.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0xff0000, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/red" +} diff --git a/assets/cubyz/blocks/glow_crystal/violet.json b/assets/cubyz/blocks/glow_crystal/violet.json new file mode 100644 index 00000000..1b618145 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/violet.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0x8000ff, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/violet" +} diff --git a/assets/cubyz/blocks/glow_crystal/white.json b/assets/cubyz/blocks/glow_crystal/white.json new file mode 100644 index 00000000..1ff7df12 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/white.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0xffffff, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/white" +} diff --git a/assets/cubyz/blocks/glow_crystal/yellow.json b/assets/cubyz/blocks/glow_crystal/yellow.json new file mode 100644 index 00000000..474b0b26 --- /dev/null +++ b/assets/cubyz/blocks/glow_crystal/yellow.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 2, + "drops" : [ + "none" + ], + "emittedLight" : 0xffff00, + "model" : "cubyz:block.obj", + "texture" : "cubyz:glow_crystal/yellow" +} diff --git a/assets/cubyz/blocks/grass.json b/assets/cubyz/blocks/grass.json new file mode 100644 index 00000000..14784261 --- /dev/null +++ b/assets/cubyz/blocks/grass.json @@ -0,0 +1,11 @@ +{ + "class" : "sand", + "hardness" : 6, + "drops" : [ + "cubyz:soil" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:grass_side", + "texture_top" : "cubyz:grass_top", + "texture_bottom" : "cubyz:soil" +} diff --git a/assets/cubyz/blocks/gravel.json b/assets/cubyz/blocks/gravel.json new file mode 100644 index 00000000..14b62bfa --- /dev/null +++ b/assets/cubyz/blocks/gravel.json @@ -0,0 +1,9 @@ +{ + "class" : "sand", + "hardness" : 11, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:gravel" +} diff --git a/assets/cubyz/blocks/ice.json b/assets/cubyz/blocks/ice.json new file mode 100644 index 00000000..b443c7a3 --- /dev/null +++ b/assets/cubyz/blocks/ice.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 10, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:ice", + "blockEntity" : "cubyz.modding.base.MeltableBlockEntity" +} diff --git a/assets/cubyz/blocks/iron_ore.json b/assets/cubyz/blocks/iron_ore.json new file mode 100644 index 00000000..dfe8820f --- /dev/null +++ b/assets/cubyz/blocks/iron_ore.json @@ -0,0 +1,19 @@ +{ + "class" : "stone", + "hardness" : 60, + "breakingPower" : 5, + "ore" : { + "veins" : 4, + "size" : 20, + "height" : 20, + "density" : 0.25, + "sources" : [ + "cubyz:stone" + ] + }, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:iron_ore" +} diff --git a/assets/cubyz/blocks/mossy_cobblestone.json b/assets/cubyz/blocks/mossy_cobblestone.json new file mode 100644 index 00000000..c3fc466e --- /dev/null +++ b/assets/cubyz/blocks/mossy_cobblestone.json @@ -0,0 +1,19 @@ +{ + "class" : "stone", + "hardness" : 25, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:mossy_cobblestone", + + "rotation" : "cubyz:multi_texture", + "multi_texture_variants" : [ + { + "texture" : "cubyz:mossy_cobblestone" + }, + { + "texture" : "cubyz:mossy_cobblestone_1" + } + ] +} diff --git a/assets/cubyz/blocks/oak_fence.json b/assets/cubyz/blocks/oak_fence.json new file mode 100644 index 00000000..c54b1cf5 --- /dev/null +++ b/assets/cubyz/blocks/oak_fence.json @@ -0,0 +1,10 @@ +{ + "class" : "wood", + "hardness" : 7, + "drops" : [ + "auto" + ], + "rotation" : "cubyz:fence", + "model" : "cubyz:fence.obj", + "texture" : "cubyz:oak_planks" +} diff --git a/assets/cubyz/blocks/oak_leaves.json b/assets/cubyz/blocks/oak_leaves.json new file mode 100644 index 00000000..c99b3a26 --- /dev/null +++ b/assets/cubyz/blocks/oak_leaves.json @@ -0,0 +1,13 @@ +{ + "class" : "leaf", + "hardness" : 0.4, + "drops" : [ + "auto", + "0.1 cubyz:apple" + ], + "degradable" : true, + "viewThrough" : true, + "absorbedLight" : 0x0f100010, + "model" : "cubyz:block.obj", + "texture" : "cubyz:oak_leaves_transparent" +} diff --git a/assets/cubyz/blocks/oak_log.json b/assets/cubyz/blocks/oak_log.json new file mode 100644 index 00000000..ff716df8 --- /dev/null +++ b/assets/cubyz/blocks/oak_log.json @@ -0,0 +1,12 @@ +{ + "class" : "wood", + "hardness" : 8, + "drops" : [ + "auto" + ], + "rotation" : "cubyz:log", + "model" : "cubyz:block.obj", + "texture" : "cubyz:oak_log_side", + "texture_top" : "cubyz:oak_log_rings_top", + "texture_bottom" : "cubyz:oak_log_rings_bottom" +} diff --git a/assets/cubyz/blocks/oak_planks.json b/assets/cubyz/blocks/oak_planks.json new file mode 100644 index 00000000..1bf4357a --- /dev/null +++ b/assets/cubyz/blocks/oak_planks.json @@ -0,0 +1,9 @@ +{ + "class" : "wood", + "hardness" : 7, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:oak_planks" +} diff --git a/assets/cubyz/blocks/oak_top.json b/assets/cubyz/blocks/oak_top.json new file mode 100644 index 00000000..6257197b --- /dev/null +++ b/assets/cubyz/blocks/oak_top.json @@ -0,0 +1,12 @@ +{ + "class" : "wood", + "hardness" : 8, + "drops" : [ + "auto" + ], + "rotation" : "cubyz:log", + "model" : "cubyz:block.obj", + "texture" : "cubyz:oak_log_side", + "texture_top" : "cubyz:oak_log_top", + "texture_bottom" : "cubyz:oak_log_rings_bottom", +} diff --git a/assets/cubyz/blocks/sand.json b/assets/cubyz/blocks/sand.json new file mode 100644 index 00000000..7d866e3f --- /dev/null +++ b/assets/cubyz/blocks/sand.json @@ -0,0 +1,10 @@ +{ + "class" : "sand", + "hardness" : 5, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture_top" : "cubyz:sand", + "texture" : "cubyz:sand_side" +} diff --git a/assets/cubyz/blocks/sandstone.json b/assets/cubyz/blocks/sandstone.json new file mode 100644 index 00000000..fe6ee3c5 --- /dev/null +++ b/assets/cubyz/blocks/sandstone.json @@ -0,0 +1,9 @@ +{ + "class": "stone", + "hardness": 12, + "drops": [ + "auto" + ], + "model": "cubyz:block.obj", + "texture": "cubyz:sandstone" +} \ No newline at end of file diff --git a/assets/cubyz/blocks/snow.json b/assets/cubyz/blocks/snow.json new file mode 100644 index 00000000..bef607ad --- /dev/null +++ b/assets/cubyz/blocks/snow.json @@ -0,0 +1,11 @@ +{ + "class" : "sand", + "hardness" : 6.5, + "drops" : [ + "auto" + ], + "rotation" : "cubyz:stackable", + "model" : "cubyz:block.obj", + "texture" : "cubyz:snow", + "blockEntity" : "cubyz.modding.base.MeltableBlockEntity" +} diff --git a/assets/cubyz/blocks/soil.json b/assets/cubyz/blocks/soil.json new file mode 100644 index 00000000..3d9a3564 --- /dev/null +++ b/assets/cubyz/blocks/soil.json @@ -0,0 +1,9 @@ +{ + "class" : "sand", + "hardness" : 5.5, + "drops" : [ + "auto" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:soil" +} diff --git a/assets/cubyz/blocks/stone.json b/assets/cubyz/blocks/stone.json new file mode 100644 index 00000000..2cbd56a7 --- /dev/null +++ b/assets/cubyz/blocks/stone.json @@ -0,0 +1,10 @@ +{ + "class" : "stone", + "hardness" : 25, + "breakingPower" : 1, + "drops" : [ + "cubyz:cobblestone" + ], + "model" : "cubyz:block.obj", + "texture" : "cubyz:stone" +} diff --git a/assets/cubyz/blocks/textures/cactus.png b/assets/cubyz/blocks/textures/cactus.png new file mode 100644 index 00000000..360ad338 Binary files /dev/null and b/assets/cubyz/blocks/textures/cactus.png differ diff --git a/assets/cubyz/blocks/textures/coal_ore.png b/assets/cubyz/blocks/textures/coal_ore.png new file mode 100644 index 00000000..a6cb20cb Binary files /dev/null and b/assets/cubyz/blocks/textures/coal_ore.png differ diff --git a/assets/cubyz/blocks/textures/cobblestone.png b/assets/cubyz/blocks/textures/cobblestone.png new file mode 100644 index 00000000..131e5510 Binary files /dev/null and b/assets/cubyz/blocks/textures/cobblestone.png differ diff --git a/assets/cubyz/blocks/textures/cobblestone_1.png b/assets/cubyz/blocks/textures/cobblestone_1.png new file mode 100644 index 00000000..48b8d08e Binary files /dev/null and b/assets/cubyz/blocks/textures/cobblestone_1.png differ diff --git a/assets/cubyz/blocks/textures/crystal_template_0.png b/assets/cubyz/blocks/textures/crystal_template_0.png new file mode 100644 index 00000000..0869a37f Binary files /dev/null and b/assets/cubyz/blocks/textures/crystal_template_0.png differ diff --git a/assets/cubyz/blocks/textures/cyrstal_0.png b/assets/cubyz/blocks/textures/cyrstal_0.png new file mode 100644 index 00000000..1d020551 Binary files /dev/null and b/assets/cubyz/blocks/textures/cyrstal_0.png differ diff --git a/assets/cubyz/blocks/textures/diamond_ore.png b/assets/cubyz/blocks/textures/diamond_ore.png new file mode 100644 index 00000000..2db629d4 Binary files /dev/null and b/assets/cubyz/blocks/textures/diamond_ore.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/black.png b/assets/cubyz/blocks/textures/glow_crystal/black.png new file mode 100644 index 00000000..4769d645 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/black.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/blue.png b/assets/cubyz/blocks/textures/glow_crystal/blue.png new file mode 100644 index 00000000..78a429ed Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/blue.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/blue.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/blue.png_emission.png new file mode 100644 index 00000000..4f8a91a6 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/blue.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/brown.png b/assets/cubyz/blocks/textures/glow_crystal/brown.png new file mode 100644 index 00000000..37cc14a0 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/brown.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/brown.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/brown.png_emission.png new file mode 100644 index 00000000..c5bfd3e0 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/brown.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/cyan.png b/assets/cubyz/blocks/textures/glow_crystal/cyan.png new file mode 100644 index 00000000..a5ba8fa0 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/cyan.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/cyan.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/cyan.png_emission.png new file mode 100644 index 00000000..cbc56b2e Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/cyan.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/dark_gray.png b/assets/cubyz/blocks/textures/glow_crystal/dark_gray.png new file mode 100644 index 00000000..5551065a Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/dark_gray.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/dark_green.png b/assets/cubyz/blocks/textures/glow_crystal/dark_green.png new file mode 100644 index 00000000..30886c51 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/dark_green.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/dark_green.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/dark_green.png_emission.png new file mode 100644 index 00000000..aa235d36 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/dark_green.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/dark_red.png b/assets/cubyz/blocks/textures/glow_crystal/dark_red.png new file mode 100644 index 00000000..76f97faf Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/dark_red.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/dark_red.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/dark_red.png_emission.png new file mode 100644 index 00000000..89810e1e Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/dark_red.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/gray.png b/assets/cubyz/blocks/textures/glow_crystal/gray.png new file mode 100644 index 00000000..a24a74a5 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/gray.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/green.png b/assets/cubyz/blocks/textures/glow_crystal/green.png new file mode 100644 index 00000000..b2cc50e1 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/green.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/green.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/green.png_emission.png new file mode 100644 index 00000000..f2293e27 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/green.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/light_blue.png b/assets/cubyz/blocks/textures/glow_crystal/light_blue.png new file mode 100644 index 00000000..1671f400 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/light_blue.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/light_blue.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/light_blue.png_emission.png new file mode 100644 index 00000000..e0ba074e Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/light_blue.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/orange.png b/assets/cubyz/blocks/textures/glow_crystal/orange.png new file mode 100644 index 00000000..3a19ec24 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/orange.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/orange.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/orange.png_emission.png new file mode 100644 index 00000000..d92a2d2d Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/orange.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/purple.png b/assets/cubyz/blocks/textures/glow_crystal/purple.png new file mode 100644 index 00000000..53ec574a Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/purple.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/purple.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/purple.png_emission.png new file mode 100644 index 00000000..8df6eba7 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/purple.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/red.png b/assets/cubyz/blocks/textures/glow_crystal/red.png new file mode 100644 index 00000000..832b7f95 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/red.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/red.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/red.png_emission.png new file mode 100644 index 00000000..c4f41017 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/red.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/violet.png b/assets/cubyz/blocks/textures/glow_crystal/violet.png new file mode 100644 index 00000000..e0b41c77 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/violet.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/violet.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/violet.png_emission.png new file mode 100644 index 00000000..b50cc171 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/violet.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/white.png b/assets/cubyz/blocks/textures/glow_crystal/white.png new file mode 100644 index 00000000..a4ff1bed Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/white.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/white.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/white.png_emission.png new file mode 100644 index 00000000..e9003b6e Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/white.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/yellow.png b/assets/cubyz/blocks/textures/glow_crystal/yellow.png new file mode 100644 index 00000000..3f3031d1 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/yellow.png differ diff --git a/assets/cubyz/blocks/textures/glow_crystal/yellow.png_emission.png b/assets/cubyz/blocks/textures/glow_crystal/yellow.png_emission.png new file mode 100644 index 00000000..f8196fe0 Binary files /dev/null and b/assets/cubyz/blocks/textures/glow_crystal/yellow.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/grass_side.png b/assets/cubyz/blocks/textures/grass_side.png new file mode 100644 index 00000000..0533f3cb Binary files /dev/null and b/assets/cubyz/blocks/textures/grass_side.png differ diff --git a/assets/cubyz/blocks/textures/grass_top.png b/assets/cubyz/blocks/textures/grass_top.png new file mode 100644 index 00000000..448ba287 Binary files /dev/null and b/assets/cubyz/blocks/textures/grass_top.png differ diff --git a/assets/cubyz/blocks/textures/gravel.png b/assets/cubyz/blocks/textures/gravel.png new file mode 100644 index 00000000..f735f2a4 Binary files /dev/null and b/assets/cubyz/blocks/textures/gravel.png differ diff --git a/assets/cubyz/blocks/textures/ice.png b/assets/cubyz/blocks/textures/ice.png new file mode 100644 index 00000000..98df0f74 Binary files /dev/null and b/assets/cubyz/blocks/textures/ice.png differ diff --git a/assets/cubyz/blocks/textures/iron_ore.png b/assets/cubyz/blocks/textures/iron_ore.png new file mode 100644 index 00000000..cfec6696 Binary files /dev/null and b/assets/cubyz/blocks/textures/iron_ore.png differ diff --git a/assets/cubyz/blocks/textures/lava.png b/assets/cubyz/blocks/textures/lava.png new file mode 100644 index 00000000..d9ae79e3 Binary files /dev/null and b/assets/cubyz/blocks/textures/lava.png differ diff --git a/assets/cubyz/blocks/textures/mossy_cobblestone.png b/assets/cubyz/blocks/textures/mossy_cobblestone.png new file mode 100644 index 00000000..814b2965 Binary files /dev/null and b/assets/cubyz/blocks/textures/mossy_cobblestone.png differ diff --git a/assets/cubyz/blocks/textures/mossy_cobblestone_1.png b/assets/cubyz/blocks/textures/mossy_cobblestone_1.png new file mode 100644 index 00000000..5a0d9ad3 Binary files /dev/null and b/assets/cubyz/blocks/textures/mossy_cobblestone_1.png differ diff --git a/assets/cubyz/blocks/textures/oak_leaves.png b/assets/cubyz/blocks/textures/oak_leaves.png new file mode 100644 index 00000000..91d8d8bf Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_leaves.png differ diff --git a/assets/cubyz/blocks/textures/oak_leaves_transparent.png b/assets/cubyz/blocks/textures/oak_leaves_transparent.png new file mode 100644 index 00000000..548c3f43 Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_leaves_transparent.png differ diff --git a/assets/cubyz/blocks/textures/oak_log_rings_bottom.png b/assets/cubyz/blocks/textures/oak_log_rings_bottom.png new file mode 100644 index 00000000..577e909f Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_log_rings_bottom.png differ diff --git a/assets/cubyz/blocks/textures/oak_log_rings_top.png b/assets/cubyz/blocks/textures/oak_log_rings_top.png new file mode 100644 index 00000000..0621050a Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_log_rings_top.png differ diff --git a/assets/cubyz/blocks/textures/oak_log_side.png b/assets/cubyz/blocks/textures/oak_log_side.png new file mode 100644 index 00000000..d9cfeedf Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_log_side.png differ diff --git a/assets/cubyz/blocks/textures/oak_log_top.png b/assets/cubyz/blocks/textures/oak_log_top.png new file mode 100644 index 00000000..117b2139 Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_log_top.png differ diff --git a/assets/cubyz/blocks/textures/oak_planks.png b/assets/cubyz/blocks/textures/oak_planks.png new file mode 100644 index 00000000..828fee43 Binary files /dev/null and b/assets/cubyz/blocks/textures/oak_planks.png differ diff --git a/assets/cubyz/blocks/textures/sand.png b/assets/cubyz/blocks/textures/sand.png new file mode 100644 index 00000000..d06123ed Binary files /dev/null and b/assets/cubyz/blocks/textures/sand.png differ diff --git a/assets/cubyz/blocks/textures/sand_side.png b/assets/cubyz/blocks/textures/sand_side.png new file mode 100644 index 00000000..bcb3ddd1 Binary files /dev/null and b/assets/cubyz/blocks/textures/sand_side.png differ diff --git a/assets/cubyz/blocks/textures/sandstone.png b/assets/cubyz/blocks/textures/sandstone.png new file mode 100644 index 00000000..0a801c04 Binary files /dev/null and b/assets/cubyz/blocks/textures/sandstone.png differ diff --git a/assets/cubyz/blocks/textures/snow.png b/assets/cubyz/blocks/textures/snow.png new file mode 100644 index 00000000..2cbe14a3 Binary files /dev/null and b/assets/cubyz/blocks/textures/snow.png differ diff --git a/assets/cubyz/blocks/textures/soil.png b/assets/cubyz/blocks/textures/soil.png new file mode 100644 index 00000000..b4690515 Binary files /dev/null and b/assets/cubyz/blocks/textures/soil.png differ diff --git a/assets/cubyz/blocks/textures/stone.png b/assets/cubyz/blocks/textures/stone.png new file mode 100644 index 00000000..443b6e6e Binary files /dev/null and b/assets/cubyz/blocks/textures/stone.png differ diff --git a/assets/cubyz/blocks/textures/torch.png b/assets/cubyz/blocks/textures/torch.png new file mode 100644 index 00000000..39c6c81d Binary files /dev/null and b/assets/cubyz/blocks/textures/torch.png differ diff --git a/assets/cubyz/blocks/textures/torch.png_emission.png b/assets/cubyz/blocks/textures/torch.png_emission.png new file mode 100644 index 00000000..74806330 Binary files /dev/null and b/assets/cubyz/blocks/textures/torch.png_emission.png differ diff --git a/assets/cubyz/blocks/textures/undefined.png b/assets/cubyz/blocks/textures/undefined.png new file mode 100644 index 00000000..0bb9704e Binary files /dev/null and b/assets/cubyz/blocks/textures/undefined.png differ diff --git a/assets/cubyz/blocks/textures/water.png b/assets/cubyz/blocks/textures/water.png new file mode 100644 index 00000000..5ec2b04c Binary files /dev/null and b/assets/cubyz/blocks/textures/water.png differ diff --git a/assets/cubyz/blocks/textures/water_1.png b/assets/cubyz/blocks/textures/water_1.png new file mode 100644 index 00000000..1413176a Binary files /dev/null and b/assets/cubyz/blocks/textures/water_1.png differ diff --git a/assets/cubyz/blocks/textures/water_2.png b/assets/cubyz/blocks/textures/water_2.png new file mode 100644 index 00000000..f1c0edc6 Binary files /dev/null and b/assets/cubyz/blocks/textures/water_2.png differ diff --git a/assets/cubyz/blocks/textures/workbench_side.png b/assets/cubyz/blocks/textures/workbench_side.png new file mode 100644 index 00000000..2af40d2c Binary files /dev/null and b/assets/cubyz/blocks/textures/workbench_side.png differ diff --git a/assets/cubyz/blocks/textures/workbench_top.png b/assets/cubyz/blocks/textures/workbench_top.png new file mode 100644 index 00000000..1df3a360 Binary files /dev/null and b/assets/cubyz/blocks/textures/workbench_top.png differ diff --git a/assets/cubyz/blocks/torch.json b/assets/cubyz/blocks/torch.json new file mode 100644 index 00000000..2205e794 --- /dev/null +++ b/assets/cubyz/blocks/torch.json @@ -0,0 +1,13 @@ +{ + "class" : "wood", + "hardness" : 0.3, + "drops" : [ + "auto" + ], + "solid" : false, + "emittedLight" : 0x00a09080, + "viewThrough" : true, + "rotation" : "cubyz:torch", + "model" : "cubyz:torch.obj", + "texture" : "cubyz:torch" +} diff --git a/assets/cubyz/blocks/water.json b/assets/cubyz/blocks/water.json new file mode 100644 index 00000000..0afe1fd2 --- /dev/null +++ b/assets/cubyz/blocks/water.json @@ -0,0 +1,19 @@ +{ + "class" : "fluid", + "drops" : [ + "auto" + ], + "selectable" : false, + "solid" : false, + "transparent" : true, + "absorbedLight" : 0x17171100, + "model" : "cubyz:block.obj", + "texture" : { + "time" : 500, + "textures": [ + "cubyz:water", + "cubyz:water_1", + "cubyz:water_2" + ] + } +} diff --git a/assets/cubyz/blocks/workbench.json b/assets/cubyz/blocks/workbench.json new file mode 100644 index 00000000..21a67b9e --- /dev/null +++ b/assets/cubyz/blocks/workbench.json @@ -0,0 +1,12 @@ +{ + "class" : "wood", + "hardness" : 7.5, + "drops" : [ + "auto" + ], + "GUI" : "cubyz:workbench", + "model" : "cubyz:block.obj", + "texture" : "cubyz:workbench_side", + "texture_top" : "cubyz:workbench_top", + "texture_bottom" : "cubyz:workbench_top" +} diff --git a/assets/cubyz/items/apple.json b/assets/cubyz/items/apple.json new file mode 100644 index 00000000..7ff32b1a --- /dev/null +++ b/assets/cubyz/items/apple.json @@ -0,0 +1,5 @@ +{ + "texture" : "food/apple.png", + "translationId" : "item.cubyz.apple.name", + "food" : 4 +} \ No newline at end of file diff --git a/assets/cubyz/items/coal.json b/assets/cubyz/items/coal.json new file mode 100644 index 00000000..b92b3667 --- /dev/null +++ b/assets/cubyz/items/coal.json @@ -0,0 +1,3 @@ +{ + "texture" : "materials/coal.png" +} \ No newline at end of file diff --git a/assets/cubyz/items/diamond.json b/assets/cubyz/items/diamond.json new file mode 100644 index 00000000..8be497f9 --- /dev/null +++ b/assets/cubyz/items/diamond.json @@ -0,0 +1,12 @@ +{ + "texture" : "materials/diamond.png", + "material" : { + "density" : 1.0, + "resistance" : 1.0, + "power" : 1.0, + "roughness" : 0.3, + "colors" : [ + 0xff4a9494, 0xff53a5a5, 0xff59b3b3, 0xff59bbbb, 0xff7dcbcb + ] + } +} \ No newline at end of file diff --git a/assets/cubyz/items/raw_meat.json b/assets/cubyz/items/raw_meat.json new file mode 100644 index 00000000..3c58fb89 --- /dev/null +++ b/assets/cubyz/items/raw_meat.json @@ -0,0 +1,5 @@ +{ + "texture" : "food/raw_meat.png", + "translationId" : "item.cubyz.raw_meat.name", + "food" : 3 +} \ No newline at end of file diff --git a/assets/cubyz/items/stick.json b/assets/cubyz/items/stick.json new file mode 100644 index 00000000..78cb9da0 --- /dev/null +++ b/assets/cubyz/items/stick.json @@ -0,0 +1,14 @@ +{ + "texture" : "materials/stick.png", + "translationId" : "item.cubyz.stick.name", + + "material" : { + "density" : 1.0, + "resistance" : 1.0, + "power" : 0.2, + "roughness" : 0.7, + "colors" : [ + 0xff522e05, 0xff502c03, 0xff553204, 0xff67400e, 0xff784a12 + ] + } +} \ No newline at end of file diff --git a/assets/cubyz/items/textures/food/apple.png b/assets/cubyz/items/textures/food/apple.png new file mode 100644 index 00000000..c4360a39 Binary files /dev/null and b/assets/cubyz/items/textures/food/apple.png differ diff --git a/assets/cubyz/items/textures/food/raw_meat.png b/assets/cubyz/items/textures/food/raw_meat.png new file mode 100644 index 00000000..d7780ba4 Binary files /dev/null and b/assets/cubyz/items/textures/food/raw_meat.png differ diff --git a/assets/cubyz/items/textures/materials/coal.png b/assets/cubyz/items/textures/materials/coal.png new file mode 100644 index 00000000..fdaaa23a Binary files /dev/null and b/assets/cubyz/items/textures/materials/coal.png differ diff --git a/assets/cubyz/items/textures/materials/crystal(was used for template generation).png b/assets/cubyz/items/textures/materials/crystal(was used for template generation).png new file mode 100644 index 00000000..556454aa Binary files /dev/null and b/assets/cubyz/items/textures/materials/crystal(was used for template generation).png differ diff --git a/assets/cubyz/items/textures/materials/diamond.png b/assets/cubyz/items/textures/materials/diamond.png new file mode 100644 index 00000000..354385ab Binary files /dev/null and b/assets/cubyz/items/textures/materials/diamond.png differ diff --git a/assets/cubyz/items/textures/materials/stick.png b/assets/cubyz/items/textures/materials/stick.png new file mode 100644 index 00000000..21174089 Binary files /dev/null and b/assets/cubyz/items/textures/materials/stick.png differ diff --git a/assets/cubyz/items/textures/materials/templates/crystal1.png b/assets/cubyz/items/textures/materials/templates/crystal1.png new file mode 100644 index 00000000..c13c90cc Binary files /dev/null and b/assets/cubyz/items/textures/materials/templates/crystal1.png differ diff --git a/assets/cubyz/items/textures/materials/templates/gem1.png b/assets/cubyz/items/textures/materials/templates/gem1.png new file mode 100644 index 00000000..df4de983 Binary files /dev/null and b/assets/cubyz/items/textures/materials/templates/gem1.png differ diff --git a/assets/cubyz/items/textures/parts/stone_axe_head.png b/assets/cubyz/items/textures/parts/stone_axe_head.png new file mode 100644 index 00000000..b62b4848 Binary files /dev/null and b/assets/cubyz/items/textures/parts/stone_axe_head.png differ diff --git a/assets/cubyz/items/textures/parts/stone_binding.png b/assets/cubyz/items/textures/parts/stone_binding.png new file mode 100644 index 00000000..4657efd1 Binary files /dev/null and b/assets/cubyz/items/textures/parts/stone_binding.png differ diff --git a/assets/cubyz/items/textures/parts/stone_handle.png b/assets/cubyz/items/textures/parts/stone_handle.png new file mode 100644 index 00000000..cda9a896 Binary files /dev/null and b/assets/cubyz/items/textures/parts/stone_handle.png differ diff --git a/assets/cubyz/items/textures/parts/stone_pickaxe_head.png b/assets/cubyz/items/textures/parts/stone_pickaxe_head.png new file mode 100644 index 00000000..62b4177d Binary files /dev/null and b/assets/cubyz/items/textures/parts/stone_pickaxe_head.png differ diff --git a/assets/cubyz/items/textures/parts/stone_shovel_head.png b/assets/cubyz/items/textures/parts/stone_shovel_head.png new file mode 100644 index 00000000..17a38717 Binary files /dev/null and b/assets/cubyz/items/textures/parts/stone_shovel_head.png differ diff --git a/assets/cubyz/items/textures/parts/sword/stone_binding.png b/assets/cubyz/items/textures/parts/sword/stone_binding.png new file mode 100644 index 00000000..ce40ca05 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/stone_binding.png differ diff --git a/assets/cubyz/items/textures/parts/sword/stone_handle.png b/assets/cubyz/items/textures/parts/sword/stone_handle.png new file mode 100644 index 00000000..807636f8 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/stone_handle.png differ diff --git a/assets/cubyz/items/textures/parts/sword/stone_sword_head.png b/assets/cubyz/items/textures/parts/sword/stone_sword_head.png new file mode 100644 index 00000000..e62b861d Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/stone_sword_head.png differ diff --git a/assets/cubyz/items/textures/parts/sword/template_binding.png b/assets/cubyz/items/textures/parts/sword/template_binding.png new file mode 100644 index 00000000..8761d78b Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/template_binding.png differ diff --git a/assets/cubyz/items/textures/parts/sword/template_handle.png b/assets/cubyz/items/textures/parts/sword/template_handle.png new file mode 100644 index 00000000..279048d9 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/template_handle.png differ diff --git a/assets/cubyz/items/textures/parts/sword/template_sword_head.png b/assets/cubyz/items/textures/parts/sword/template_sword_head.png new file mode 100644 index 00000000..347ff5f7 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/template_sword_head.png differ diff --git a/assets/cubyz/items/textures/parts/sword/wood_binding.png b/assets/cubyz/items/textures/parts/sword/wood_binding.png new file mode 100644 index 00000000..e3e236ae Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/wood_binding.png differ diff --git a/assets/cubyz/items/textures/parts/sword/wood_handle.png b/assets/cubyz/items/textures/parts/sword/wood_handle.png new file mode 100644 index 00000000..746ad132 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/wood_handle.png differ diff --git a/assets/cubyz/items/textures/parts/sword/wood_sword_head.png b/assets/cubyz/items/textures/parts/sword/wood_sword_head.png new file mode 100644 index 00000000..75abf759 Binary files /dev/null and b/assets/cubyz/items/textures/parts/sword/wood_sword_head.png differ diff --git a/assets/cubyz/items/textures/parts/template_axe_head.png b/assets/cubyz/items/textures/parts/template_axe_head.png new file mode 100644 index 00000000..0ceab50e Binary files /dev/null and b/assets/cubyz/items/textures/parts/template_axe_head.png differ diff --git a/assets/cubyz/items/textures/parts/template_binding.png b/assets/cubyz/items/textures/parts/template_binding.png new file mode 100644 index 00000000..4f1ae3e0 Binary files /dev/null and b/assets/cubyz/items/textures/parts/template_binding.png differ diff --git a/assets/cubyz/items/textures/parts/template_handle.png b/assets/cubyz/items/textures/parts/template_handle.png new file mode 100644 index 00000000..5177b1d6 Binary files /dev/null and b/assets/cubyz/items/textures/parts/template_handle.png differ diff --git a/assets/cubyz/items/textures/parts/template_pickaxe_head.png b/assets/cubyz/items/textures/parts/template_pickaxe_head.png new file mode 100644 index 00000000..12c6b755 Binary files /dev/null and b/assets/cubyz/items/textures/parts/template_pickaxe_head.png differ diff --git a/assets/cubyz/items/textures/parts/template_shovel_head.png b/assets/cubyz/items/textures/parts/template_shovel_head.png new file mode 100644 index 00000000..fea77a89 Binary files /dev/null and b/assets/cubyz/items/textures/parts/template_shovel_head.png differ diff --git a/assets/cubyz/items/textures/parts/wood_axe_head.png b/assets/cubyz/items/textures/parts/wood_axe_head.png new file mode 100644 index 00000000..69295893 Binary files /dev/null and b/assets/cubyz/items/textures/parts/wood_axe_head.png differ diff --git a/assets/cubyz/items/textures/parts/wood_binding.png b/assets/cubyz/items/textures/parts/wood_binding.png new file mode 100644 index 00000000..f3107a95 Binary files /dev/null and b/assets/cubyz/items/textures/parts/wood_binding.png differ diff --git a/assets/cubyz/items/textures/parts/wood_handle.png b/assets/cubyz/items/textures/parts/wood_handle.png new file mode 100644 index 00000000..a8f952b9 Binary files /dev/null and b/assets/cubyz/items/textures/parts/wood_handle.png differ diff --git a/assets/cubyz/items/textures/parts/wood_pickaxe_head.png b/assets/cubyz/items/textures/parts/wood_pickaxe_head.png new file mode 100644 index 00000000..e682c78d Binary files /dev/null and b/assets/cubyz/items/textures/parts/wood_pickaxe_head.png differ diff --git a/assets/cubyz/items/textures/parts/wood_shovel_head.png b/assets/cubyz/items/textures/parts/wood_shovel_head.png new file mode 100644 index 00000000..a106b9b8 Binary files /dev/null and b/assets/cubyz/items/textures/parts/wood_shovel_head.png differ diff --git a/assets/cubyz/items/textures/special/debug_stick.png b/assets/cubyz/items/textures/special/debug_stick.png new file mode 100644 index 00000000..289ad7d4 Binary files /dev/null and b/assets/cubyz/items/textures/special/debug_stick.png differ diff --git a/assets/cubyz/recipes/wood_recipes b/assets/cubyz/recipes/wood_recipes new file mode 100644 index 00000000..a3294c30 --- /dev/null +++ b/assets/cubyz/recipes/wood_recipes @@ -0,0 +1,33 @@ +L = cubyz:oak_log +T = cubyz:oak_top +P = cubyz:oak_planks +S = cubyz:stick +C = cubyz:coal + +shapeless +L +result 4*P + +shapeless +T +result 3*P + +shaped +P P +P P +result cubyz:workbench + +shaped +P +P +result 4*S + +shaped +C +S +result 8*cubyz:torch + +shaped +S P S +S P S +result 6*cubyz:oak_fence \ No newline at end of file diff --git a/src/assets.zig b/src/assets.zig new file mode 100644 index 00000000..b7d4cffc --- /dev/null +++ b/src/assets.zig @@ -0,0 +1,492 @@ +const std = @import("std"); +const Allocator = std.mem.Allocator; + +const json = @import("json.zig"); +const JsonElement = json.JsonElement; +const blocks_zig = @import("blocks.zig"); + +var arena: std.heap.ArenaAllocator = undefined; +var arenaAllocator: Allocator = undefined; +var commonBlocks: std.StringHashMap(JsonElement) = undefined; +var commonBiomes: std.StringHashMap(JsonElement) = undefined; +var commonRecipes: std.ArrayList([]const u8) = undefined; + +/// Reads json files recursively from all subfolders. +pub fn readAllJsonFilesInAddons(externalAllocator: Allocator, addons: std.ArrayList(std.fs.Dir), addonNames: std.ArrayList([]const u8), subPath: []const u8, output: *std.StringHashMap(JsonElement)) !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer if(gpa.deinit()) { + @panic("Memory leak"); + }; + var internalAllocator = gpa.allocator(); + for(addons.items) |addon, addonIndex| { + var dir: std.fs.IterableDir = addon.openIterableDir(subPath, .{}) catch |err| { + if(err == error.FileNotFound) continue; + return err; + }; + defer dir.close(); + + var walker = try dir.walk(internalAllocator); + defer walker.deinit(); + + while(try walker.next()) |entry| { + if(entry.kind == .File and std.ascii.endsWithIgnoreCase(entry.basename, ".json")) { + const folderName = addonNames.items[addonIndex]; + var id: []u8 = try externalAllocator.alloc(u8, folderName.len + 1 + entry.basename.len - 5); + std.mem.copy(u8, id[0..], folderName); + id[folderName.len] = ':'; + std.mem.copy(u8, id[folderName.len+1..], entry.basename[0..entry.basename.len-5]); + + std.log.info("ID: {s}", .{id}); + var file = try dir.dir.openFile(entry.path, .{}); + defer file.close(); + const string = try file.readToEndAlloc(internalAllocator, std.math.maxInt(usize)); + defer internalAllocator.free(string); + try output.put(id, json.parseFromString(externalAllocator, string)); + } + } + } +} + +pub fn readAssets(externalAllocator: Allocator, temporaryAllocator: Allocator, assetPath: []const u8, blocks: *std.StringHashMap(JsonElement), biomes: *std.StringHashMap(JsonElement)) !void { + var addons = std.ArrayList(std.fs.Dir).init(temporaryAllocator); + defer addons.deinit(); + var addonNames = std.ArrayList([]const u8).init(temporaryAllocator); + defer addonNames.deinit(); + + { // Find all the sub-directories to the assets folder. + var dir = try std.fs.cwd().openIterableDir(assetPath, .{}); + defer dir.close(); + var iterator = dir.iterate(); + while(try iterator.next()) |addon| { + if(addon.kind == .Directory) { + try addons.append(try dir.dir.openDir(addon.name, .{})); + try addonNames.append(try temporaryAllocator.dupe(u8, addon.name)); + } + } + } + defer for(addons.items) |*dir, idx| { + dir.close(); + temporaryAllocator.free(addonNames.items[idx]); + }; + + try readAllJsonFilesInAddons(externalAllocator, addons, addonNames, "blocks", blocks); + try readAllJsonFilesInAddons(externalAllocator, addons, addonNames, "biomes", biomes); +} + +pub fn init() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpaAllocator = gpa.allocator(); + defer if(gpa.deinit()) { + @panic("Memory leak"); + }; + + arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + arenaAllocator = arena.allocator(); + commonBlocks = std.StringHashMap(JsonElement).init(arenaAllocator); + commonBiomes = std.StringHashMap(JsonElement).init(arenaAllocator); + commonRecipes = std.ArrayList([]const u8).init(arenaAllocator); + + try readAssets(arenaAllocator, gpaAllocator, "assets/", &commonBlocks, &commonBiomes); +} + +pub fn registerBlock(id: []const u8, info: JsonElement) !void { + try blocks_zig.register(id, info); // TODO: Modded block registries + +// TODO: +// // Ores: +// JsonObject oreProperties = json.getObject("ore"); +// if (oreProperties != null) { +// // Extract the ids: +// String[] oreIDs = oreProperties.getArrayNoNull("sources").getStrings(); +// float veins = oreProperties.getFloat("veins", 0); +// float size = oreProperties.getFloat("size", 0); +// int height = oreProperties.getInt("height", 0); +// float density = oreProperties.getFloat("density", 0.5f); +// Ore ore = new Ore(block, new int[oreIDs.length], height, veins, size, density); +// ores.add(ore); +// oreRegistry.register(ore); +// oreContainers.add(oreIDs); +// } +// TODO: +// // Block drops: +// String[] blockDrops = json.getArrayNoNull("drops").getStrings(); +// ItemBlock self = null; +// if(json.getBool("hasItem", true)) { +// self = new ItemBlock(block, json.getObjectOrNew("item")); +// items.add(self); // Add each block as an item, so it gets displayed in the creative inventory. +// } +// for (String blockDrop : blockDrops) { +// blockDrop = blockDrop.trim(); +// String[] data = blockDrop.split("\\s+"); +// float amount = 1; +// String name = data[0]; +// if (data.length == 2) { +// amount = Float.parseFloat(data[0]); +// name = data[1]; +// } +// if (name.equals("auto")) { +// if(self == null) { +// Logger.error("Block "+id+" tried to drop itself(\"auto\"), but hasItem is false."); +// } else { +// Blocks.addBlockDrop(block, new BlockDrop(self, amount)); +// } +// } else if (!name.equals("none")) { +// missingDropsBlock.add(block); +// missingDropsAmount.add(amount); +// missingDropsItem.add(name); +// } +// } +} + +pub fn loadWorldAssets(assetFolder: []const u8) !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + var gpaAllocator = gpa.allocator(); + defer if(gpa.deinit()) { + @panic("Memory leak"); + }; + + var blocks = try commonBlocks.cloneWithAllocator(gpaAllocator); + defer blocks.clearAndFree(); + var biomes = try commonBiomes.cloneWithAllocator(gpaAllocator); + defer biomes.clearAndFree(); + + try readAssets(arenaAllocator, gpaAllocator, assetFolder, &blocks, &biomes); + + var block: u32 = 0; + // TODO: +// for(; block < palette.size(); block++) { +// Resource id = palette.getResource(block); +// JsonObject json = perWorldBlocks.remove(id); +// if(json == null) { +// Logger.error("Missing block: " + id + ". Replacing it with default block."); +// json = new JsonObject(); +// } +// registerBlock(block, id, json, registries, oreRegistry); +// } + var iterator = commonBlocks.iterator(); + while(iterator.next()) |entry| { + try registerBlock(entry.key_ptr.*, entry.value_ptr.*); + block += 1; +// TODO: +// palette.addResource(entry.getKey()); + } +// +// public void registerBlocks(Registry registries, NoIDRegistry oreRegistry, BlockPalette palette) { +// HashMap perWorldBlocks = new HashMap<>(commonBlocks); +// readAllJsonObjects("blocks", (json, id) -> { +// perWorldBlocks.put(id, json); +// }); +// int block = 0; +// for(Map.Entry entry : perWorldBlocks.entrySet()) { +// registerBlock(block, entry.getKey(), entry.getValue(), registries, oreRegistry); +// block++; +// } +// } +} + +pub fn deinit() void { + arena.deinit(); +} + + +//TODO: +// public static final ArrayList addons = new ArrayList<>(); +// private static final ArrayList items = new ArrayList<>(); +// +// // Used to fetch block drops that aren't loaded during block loading. +// private static final IntSimpleList missingDropsBlock = new IntSimpleList(); +// private static final ArrayList missingDropsItem = new ArrayList<>(); +// private static final ArrayList missingDropsAmount = new ArrayList<>(); +// +// private static final ArrayList ores = new ArrayList<>(); +// private static final ArrayList oreContainers = new ArrayList<>(); +// +// private static String assetPath; +// +// @Override +// public void init() { +// init(CubyzRegistries.ITEM_REGISTRY); +// } +// public void init(Registry itemRegistry) { +// if(Constants.getGameSide() == Side.CLIENT) { +// ResourcePack pack = new ResourcePack(); +// pack.name = "Add-Ons Resource Pack"; // used for path like: testaddon/models/thing.json +// pack.path = new File("assets"); +// ResourceManager.packs.add(pack); +// for (File addon : AddonsMod.addons) { +// pack = new ResourcePack(); +// pack.name = "Add-On: " + Utilities.capitalize(addon.getName()); // used for languages like: lang/en_US.lang +// pack.path = addon; +// ResourceManager.packs.add(pack); +// } +// } +// registerMissingStuff(itemRegistry); +// readRecipes(commonRecipes); +// } +// +// public void registerItems(Registry registry, String texturePathPrefix) { +// readAllJsonObjects("items", (json, id) -> { +// Item item; +// if (json.map.containsKey("food")) { +// item = new Consumable(id, json); +// } else { +// item = new Item(id, json); +// } +// item.setTexture(texturePathPrefix + id.getMod() + "/items/textures/" + json.getString("texture", "default.png")); +// registry.register(item); +// }); +// // Register the block items: +// registry.registerAll(items); +// } +// +// @Override +// public void registerItems(Registry registry) { +// registerItems(registry, "assets/"); +// } +// +// public void readBlocks() { +// readAllJsonObjects("blocks", (json, id) -> { +// commonBlocks.put(id, json); +// }); +// } +// +// private void registerBlock(int block, Resource id, JsonObject json, Registry registries, NoIDRegistry oreRegistry) { +// for(DataOrientedRegistry reg : registries.registered(new DataOrientedRegistry[0])) { +// reg.register(assetPath, id, json); +// } +// +// // Ores: +// JsonObject oreProperties = json.getObject("ore"); +// if (oreProperties != null) { +// // Extract the ids: +// String[] oreIDs = oreProperties.getArrayNoNull("sources").getStrings(); +// float veins = oreProperties.getFloat("veins", 0); +// float size = oreProperties.getFloat("size", 0); +// int height = oreProperties.getInt("height", 0); +// float density = oreProperties.getFloat("density", 0.5f); +// Ore ore = new Ore(block, new int[oreIDs.length], height, veins, size, density); +// ores.add(ore); +// oreRegistry.register(ore); +// oreContainers.add(oreIDs); +// } +// +// // Block drops: +// String[] blockDrops = json.getArrayNoNull("drops").getStrings(); +// ItemBlock self = null; +// if(json.getBool("hasItem", true)) { +// self = new ItemBlock(block, json.getObjectOrNew("item")); +// items.add(self); // Add each block as an item, so it gets displayed in the creative inventory. +// } +// for (String blockDrop : blockDrops) { +// blockDrop = blockDrop.trim(); +// String[] data = blockDrop.split("\\s+"); +// float amount = 1; +// String name = data[0]; +// if (data.length == 2) { +// amount = Float.parseFloat(data[0]); +// name = data[1]; +// } +// if (name.equals("auto")) { +// if(self == null) { +// Logger.error("Block "+id+" tried to drop itself(\"auto\"), but hasItem is false."); +// } else { +// Blocks.addBlockDrop(block, new BlockDrop(self, amount)); +// } +// } else if (!name.equals("none")) { +// missingDropsBlock.add(block); +// missingDropsAmount.add(amount); +// missingDropsItem.add(name); +// } +// } +// +// // block entities: +// if (json.has("blockEntity")) { +// try { +// Blocks.setBlockEntity(block, Class.forName(json.getString("blockEntity", "")).asSubclass(BlockEntity.class)); +// } catch (ClassNotFoundException e) { +// Logger.error(e); +// } +// } +// } +// +// public void registerBlocks(Registry registries, NoIDRegistry oreRegistry, BlockPalette palette) { +// HashMap perWorldBlocks = new HashMap<>(commonBlocks); +// readAllJsonObjects("blocks", (json, id) -> { +// perWorldBlocks.put(id, json); +// }); +// int block = 0; +// for(; block < palette.size(); block++) { +// Resource id = palette.getResource(block); +// JsonObject json = perWorldBlocks.remove(id); +// if(json == null) { +// Logger.error("Missing block: " + id + ". Replacing it with default block."); +// json = new JsonObject(); +// } +// registerBlock(block, id, json, registries, oreRegistry); +// } +// for(Map.Entry entry : perWorldBlocks.entrySet()) { +// palette.addResource(entry.getKey()); +// registerBlock(block, entry.getKey(), entry.getValue(), registries, oreRegistry); +// block++; +// } +// } +// +// +// public void registerBiomes(BiomeRegistry reg) { +// commonBiomes.forEach((id, json) -> { +// Biome biome = new Biome(id, json); +// reg.register(biome); +// }); +// readAllJsonObjects("biomes", (json, id) -> { +// Biome biome = new Biome(id, json); +// reg.register(biome); +// }); +// } +// +// /** +// * Takes care of all missing references. +// */ +// public void registerMissingStuff(Registry itemRegistry) { +// for(int i = 0; i < missingDropsBlock.size; i++) { +// Blocks.addBlockDrop(missingDropsBlock.array[i], new BlockDrop(itemRegistry.getByID(missingDropsItem.get(i)), missingDropsAmount.get(i))); +// } +// for(int i = 0; i < ores.size(); i++) { +// for(int j = 0; j < oreContainers.get(i).length; j++) { +// ores.get(i).sources[j] = Blocks.getByID(oreContainers.get(i)[j]); +// if (ores.get(i).sources[j] == 0) { +// Logger.error("Couldn't find source block "+oreContainers.get(i)[j]+" for ore "+Blocks.id(ores.get(i).block)); +// } +// } +// } +// ores.clear(); +// oreContainers.clear(); +// missingDropsBlock.clear(); +// missingDropsItem.clear(); +// missingDropsAmount.clear(); +// } +// +// public void readRecipes(ArrayList recipesList) { +// SimpleList lines = new SimpleList<>(new String[1024]); +// for (File addon : addons) { +// File recipes = new File(addon, "recipes"); +// if (recipes.exists()) { +// for (File file : recipes.listFiles()) { +// if (file.isDirectory()) continue; +// lines.clear(); +// try { +// BufferedReader buf = new BufferedReader(new FileReader(file, StandardCharsets.UTF_8)); +// String line; +// while ((line = buf.readLine())!= null) { +// line = line.replaceAll("//.*", ""); // Ignore comments with "//". +// line = line.trim(); // Remove whitespaces before and after the word starts. +// if (line.isEmpty()) continue; +// lines.add(line); +// } +// buf.close(); +// } catch(IOException e) { +// Logger.error(e); +// } +// recipesList.add(lines.toArray()); +// } +// } +// } +// } +// +// private void registerRecipe(String[] recipe, NoIDRegistry recipeRegistry, Registry itemRegistry) { +// HashMap shortCuts = new HashMap<>(); +// ArrayList items = new ArrayList<>(); +// IntSimpleList itemsPerRow = new IntSimpleList(8); +// boolean shaped = false; +// boolean startedRecipe = false; +// for(int i = 0; i < recipe.length; i++) { +// String line = recipe[i]; +// // shortcuts: +// if (line.contains("=")) { +// String[] parts = line.split("="); +// Item item = itemRegistry.getByID(parts[1].replaceAll("\\s", "")); +// if (item == null) { +// Logger.warning("Skipping unknown item \"" + parts[1].replaceAll("\\s", "") + "\" in recipe parsing."); +// } else { +// shortCuts.put(parts[0].replaceAll("\\s", ""), itemRegistry.getByID(parts[1].replaceAll("\\s", ""))); // Remove all whitespaces, wherever they might be. Not necessarily the most robust way, but it should work. +// } +// } else if (line.startsWith("shaped")) { +// // Start of a shaped pattern +// shaped = true; +// startedRecipe = true; +// items.clear(); +// itemsPerRow.clear(); +// } else if (line.startsWith("shapeless")) { +// // Start of a shapeless pattern +// shaped = false; +// startedRecipe = true; +// items.clear(); +// itemsPerRow.clear(); +// } else if (line.startsWith("result") && startedRecipe && !itemsPerRow.isEmpty()) { +// // Parse the result, which is made up of `amount*shortcut`. +// startedRecipe = false; +// String result = line.substring(6).replaceAll("\\s", ""); // Remove "result" and all space-likes. +// int number = 1; +// if (result.contains("*")) { +// String[] parts = result.split("\\*"); +// result = parts[1]; +// number = Integer.parseInt(parts[0]); +// } +// Item item; +// if (shortCuts.containsKey(result)) { +// item = shortCuts.get(result); +// } else { +// item = itemRegistry.getByID(result); +// } +// if (item == null) { +// Logger.warning("Skipping recipe with unknown item \"" + result + "\" in recipe parsing."); +// } else { +// if (shaped) { +// int x = CubyzMath.max(itemsPerRow); +// int y = itemsPerRow.size; +// Item[] array = new Item[x*y]; +// int index = 0; +// for(int iy = 0; iy < itemsPerRow.size; iy++) { +// for(int ix = 0; ix < itemsPerRow.array[iy]; ix++) { +// array[iy*x + ix] = items.get(index); +// index++; +// } +// } +// recipeRegistry.register(new Recipe(x, y, array, number, item)); +// } else { +// recipeRegistry.register(new Recipe(items.toArray(new Item[0]), number, item)); +// } +// } +// } else if (startedRecipe) { +// // Parse the actual recipe: +// String[] words = line.split("\\s+"); // Split into sections that are divided by any number of whitespace characters. +// itemsPerRow.add(words.length); +// for(int j = 0; j < words.length; j++) { +// Item item; +// if (words[j].equals("0")) { +// item = null; +// } else if (shortCuts.containsKey(words[j])) { +// item = shortCuts.get(words[j]); +// } else { +// item = itemRegistry.getByID(words[j]); +// if (item == null) { +// startedRecipe = false; // Skip unknown recipes. +// Logger.warning("Skipping recipe with unknown item \"" + words[j] + "\" in recipe parsing."); +// } +// } +// items.add(item); +// } +// } +// } +// } +// +// public void registerRecipes(NoIDRegistry recipeRegistry, Registry itemRegistry) { +// for(String[] recipe : commonRecipes) { +// registerRecipe(recipe, recipeRegistry, itemRegistry); +// } +// ArrayList worldSpecificRecipes = new ArrayList<>(); +// readRecipes(worldSpecificRecipes); +// for(String[] recipe : worldSpecificRecipes) { +// registerRecipe(recipe, recipeRegistry, itemRegistry); +// } +// } +//} \ No newline at end of file diff --git a/src/blocks.zig b/src/blocks.zig new file mode 100644 index 00000000..7a9f6dd5 --- /dev/null +++ b/src/blocks.zig @@ -0,0 +1,179 @@ +const std = @import("std"); + +const JsonElement = @import("json.zig").JsonElement; + +pub const BlockClass = enum(u8) { + wood, + stone, + sand, + unbreakable, + leaf, + fluid, + air +}; + +var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); +var allocator = arena.allocator(); + +pub const MaxBLockCount: usize = 65536; // 16 bit limit + +pub const BlockDrop = u0; // TODO! +pub const RotationMode = u0; // TODO! + +var _lightingTransparent: [MaxBLockCount]bool = undefined; +var _transparent: [MaxBLockCount]bool = undefined; +var _id: [MaxBLockCount][]u8 = undefined; +/// Time in seconds to break this block by hand. +var _hardness: [MaxBLockCount]f32 = undefined; +/// Minimum pickaxe/axe/shovel power required. +var _breakingPower: [MaxBLockCount]f32 = undefined; +var _solid: [MaxBLockCount]bool = undefined; +var _selectable: [MaxBLockCount]bool = undefined; +var _blockDrops: [MaxBLockCount][]BlockDrop = undefined; +/// Meaning undegradable parts of trees or other structures can grow through this block. +var _degradable: [MaxBLockCount]bool = undefined; +var _viewThrough: [MaxBLockCount]bool = undefined; +var _blockClass: [MaxBLockCount]BlockClass = undefined; +var _light: [MaxBLockCount]u32 = undefined; +/// How much light this block absorbs if it is transparent +var _absorption: [MaxBLockCount]u32 = undefined; +/// GUI that is opened on click. +var _gui: [MaxBLockCount][]u8 = undefined; +var _mode: [MaxBLockCount]RotationMode = undefined; + +var reverseIndices = std.StringHashMap(u16).init(arena.allocator()); + +var size: u32 = 0; + +pub fn register(id: []const u8, json: JsonElement) !void { + if(reverseIndices.contains(id)) { + std.log.warn("Registered block with id {s} twice!", .{id}); + } + _id[size] = try allocator.dupe(u8, id); + try reverseIndices.put(_id[size], @intCast(u16, size)); +// TODO: +// _mode[size] = CubyzRegistries.ROTATION_MODE_REGISTRY.getByID(json.getString("rotation", "cubyz:no_rotation")); +// _blockDrops[size] = new BlockDrop[0]; + _breakingPower[size] = json.get(f32, "breakingPower", 0); + _hardness[size] = json.get(f32, "hardness", 1); + + var blockClassString = json.get([]const u8, "class", "stone"); + _blockClass[size] = .stone; + inline for(@typeInfo(BlockClass).Enum.fields) |field| { + if(std.mem.eql(u8, blockClassString, field.name)) { + _blockClass[size] = @field(BlockClass, field.name); + } + } + _light[size] = json.get(u32, "emittedLight", 0); + _absorption[size] = json.get(u32, "absorbedLight", 0); + _lightingTransparent[size] = json.getChild("absorbedLight") != .JsonNull; + _degradable[size] = json.get(bool, "degradable", false); + _selectable[size] = json.get(bool, "selectable", true); + _solid[size] = json.get(bool, "solid", true); + _gui[size] = try allocator.dupe(u8, json.get([]const u8, "GUI", "")); + _transparent[size] = json.get(bool, "transparent", false); + _viewThrough[size] = json.get(bool, "viewThrough", false) or _transparent[size]; + + size += 1; +} + +pub fn reset() void { + size = 0; + // TODO: Use arena.reset() instead. + arena.deinit(); + arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + reverseIndices = std.StringHashMap([]const u8).init(arena); +} + +pub fn getByID(id: []const u8) u16 { + if(reverseIndices.get(id)) |result| { + return result; + } else { + std.log.warn("Couldn't find block {s}. Replacing it with air...", .{id}); + return 0; + } +} + +pub const Block = struct { + typ: u16, + data: u16, + pub fn lightingTransparent(self: Block) bool { + return _lightingTransparent[self.typ]; + } + + pub fn transparent(self: Block) bool { + return _transparent[self.typ]; + } + + pub fn id(self: Block) []u8 { + return _id[self.typ]; + } + + /// Time in seconds to break this block by hand. + pub fn hardness(self: Block) f32 { + return _hardness[self.typ]; + } + + /// Minimum pickaxe/axe/shovel power required. + pub fn breakingPower(self: Block) f32 { + return _breakingPower[self.typ]; + } + + pub fn solid(self: Block) bool { + return _solid[self.typ]; + } + + pub fn selectable(self: Block) bool { + return _selectable[self.typ]; + } + + pub fn blockDrops(self: Block) []BlockDrop { + return _blockDrops[self.typ]; + } + + /// Meaning undegradable parts of trees or other structures can grow through this block. + pub fn degradable(self: Block) bool { + return _degradable[self.typ]; + } + + pub fn viewThrough(self: Block) bool { + return _viewThrough[self.typ]; + } + + pub fn blockClass(self: Block) BlockClass { + return _blockClass[self.typ]; + } + + pub fn light(self: Block) u32 { + return _light[self.typ]; + } + + /// How much light this block absorbs if it is transparent. + pub fn absorption(self: Block) u32 { + return _absorption[self.typ]; + } + + /// GUI that is opened on click. + pub fn gui(self: Block) []u8 { + return _gui[self.typ]; + } + + pub fn mode(self: Block) RotationMode { + return _mode[self.typ]; + } + +// TODO: +// /** +// * Fires the blocks on click event(usually nothing or GUI opening). +// * @param world +// * @param pos +// * @return if the block did something on click. +// */ +// public static boolean onClick(int block, World world, Vector3i pos) { +// if (gui[block & TYPE_MASK] != null) { +// GameLauncher.logic.openGUI("cubyz:workbench", new Inventory(26)); // TODO: Care about the inventory. +// return true; +// } +// return false; +// } +}; diff --git a/src/json.zig b/src/json.zig index 4fc311d6..3296b5bc 100644 --- a/src/json.zig +++ b/src/json.zig @@ -54,7 +54,7 @@ pub const JsonElement = union(JsonType) { switch(@typeInfo(_type)) { .Int => { switch(self.*) { - JsonType.JsonInt => return std.math.cast(_type, self.JsonInt) catch replacement, + JsonType.JsonInt => return std.math.cast(_type, self.JsonInt) orelse replacement, JsonType.JsonFloat => return std.math.lossyCast(_type, std.math.round(self.JsonFloat)), else => return replacement, } @@ -344,7 +344,7 @@ const Parser = struct { } var lineEnd: u32 = i; std.log.warn("Error in line {}: {s}", .{lineNumber, msg}); - std.log.warn("{s}", .{chars[lineStart..lineEnd-lineStart]}); + std.log.warn("{s}", .{chars[lineStart..lineEnd]}); // Mark the position: var message: [512]u8 = undefined; i = lineStart; @@ -394,7 +394,7 @@ const Parser = struct { } else if(chars[index.*+1] != 'a' or chars[index.*+2] != 'l' or chars[index.*+3] != 's' or chars[index.*+4] != 'e') { try printError(chars, index.*, "Unknown expression, interpreting as false."); } - index.* += 4; + index.* += 5; return JsonElement{.JsonBool=false}; }, 'n' => { // Value can only be null. diff --git a/src/main.zig b/src/main.zig index ed048a06..27469fbe 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,5 +1,6 @@ const std = @import("std"); +const assets = @import("assets.zig"); const graphics = @import("graphics.zig"); const Vec2f = @import("vec.zig").Vec2f; @@ -13,13 +14,10 @@ var logFile: std.fs.File = undefined; pub fn log( comptime level: std.log.Level, - comptime scope: @Type(.EnumLiteral), + comptime _: @Type(.EnumLiteral), comptime format: []const u8, args: anytype, ) void { - if(scope != .default) { - @compileError("Scopes are not supported."); - } const color = comptime switch (level) { std.log.Level.err => "\x1b[31m", std.log.Level.info => "", @@ -138,6 +136,11 @@ pub fn main() !void { graphics.init(); defer graphics.deinit(); + try assets.init(); + defer assets.deinit(); + + try assets.loadWorldAssets("saves"); + c.glEnable(c.GL_CULL_FACE); c.glCullFace(c.GL_BACK); c.glEnable(c.GL_BLEND); @@ -170,8 +173,6 @@ pub fn main() !void { graphics.Draw.line(Vec2f{.x = 0, .y = 0}, Vec2f{.x = 1920, .y = 1080}); } } - - std.log.info("Hello zig.", .{}); } test "abc" {