From 22488a28aeb279f4f0d41038ebd92d236e86ffbb Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Wed, 12 Feb 2025 17:36:44 +0100 Subject: [PATCH] CI: Check for trailing spaces and (missing) newlines at the end of the file fixes #737 --- assets/cubyz/biomes/beach.zig.zon | 4 ++-- assets/cubyz/biomes/bush_lands.zig.zon | 4 ++-- assets/cubyz/biomes/bush_mountains.zig.zon | 6 +++--- assets/cubyz/biomes/cave/cave.zig.zon | 2 +- assets/cubyz/biomes/cave/lava_cave.zig.zon | 1 - assets/cubyz/biomes/cave/marble_cave.zig.zon | 2 +- .../cubyz/biomes/cave/stalagmite_cave.zig.zon | 4 ++-- .../cubyz/biomes/cave/void/void_roots.zig.zon | 2 +- assets/cubyz/biomes/cold_ocean.zig.zon | 2 +- assets/cubyz/biomes/flatland.zig.zon | 2 +- assets/cubyz/biomes/glacier.zig.zon | 4 ++-- assets/cubyz/biomes/glass_forest.zig.zon | 6 +++--- assets/cubyz/biomes/grassland.zig.zon | 6 +++--- assets/cubyz/biomes/island_shelf.zig.zon | 2 +- assets/cubyz/biomes/jungle(TODO).zig.zon | 6 +++--- assets/cubyz/biomes/modern_art.zig.zon | 6 +++--- assets/cubyz/biomes/mountains.zig.zon | 6 +++--- assets/cubyz/biomes/ocean.zig.zon | 6 +++--- assets/cubyz/biomes/ocean_shelf.zig.zon | 4 ++-- assets/cubyz/biomes/peak.zig.zon | 4 ++-- assets/cubyz/biomes/rainbow_forest.zig.zon | 6 +++--- assets/cubyz/biomes/rocky_grassland.zig.zon | 8 ++++---- assets/cubyz/biomes/taiga.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/base.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/peak.zig.zon | 2 +- .../cubyz/biomes/tall_mountain/slope1.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/slope2.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/slope3.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/slope4.zig.zon | 4 ++-- .../cubyz/biomes/tall_mountain/slope5.zig.zon | 2 +- .../cubyz/biomes/tall_mountain/slope6.zig.zon | 2 +- assets/cubyz/biomes/thicket.zig.zon | 6 +++--- assets/cubyz/biomes/volcano/base.zig.zon | 4 ++-- assets/cubyz/biomes/volcano/peak.zig.zon | 2 +- assets/cubyz/biomes/volcano/slope1.zig.zon | 4 ++-- assets/cubyz/biomes/volcano/slope2.zig.zon | 4 ++-- assets/cubyz/biomes/volcano/slope3.zig.zon | 4 ++-- assets/cubyz/biomes/volcano/slope4.zig.zon | 4 ++-- assets/cubyz/biomes/volcano/slope5.zig.zon | 2 +- assets/cubyz/biomes/volcano/slope6.zig.zon | 2 +- assets/cubyz/biomes/warm_ocean.zig.zon | 6 +++--- assets/cubyz/biomes/wetlands/base.zig.zon | 2 +- assets/cubyz/blocks/chalk/_defaults.zig.zon | 2 +- assets/cubyz/blocks/daisies.zig.zon | 2 +- assets/cubyz/blocks/dead_leaf_pile.zig.zon | 4 ++-- assets/cubyz/blocks/fog/_defaults.zig.zon | 2 +- .../blocks/glow_crystal/_defaults.zig.zon | 2 +- assets/cubyz/blocks/ivy.zig.zon | 6 +++--- assets/cubyz/blocks/mahogany_planks.zig.zon | 2 +- assets/cubyz/blocks/pine_planks.zig.zon | 2 +- assets/cubyz/blocks/red_leaf_pile.zig.zon | 2 +- assets/cubyz/blocks/yellow_leaf_pile.zig.zon | 2 +- .../shaders/animation_pre_processing.glsl | 2 +- assets/cubyz/shaders/background/fragment.fs | 4 ++-- assets/cubyz/shaders/background/vertex.vs | 2 +- .../bloom/color_extractor_downsample.fs | 2 +- .../bloom/color_extractor_downsample.vs | 2 +- assets/cubyz/shaders/bloom/first_pass.fs | 2 +- assets/cubyz/shaders/bloom/first_pass.vs | 2 +- assets/cubyz/shaders/bloom/second_pass.fs | 2 +- assets/cubyz/shaders/bloom/second_pass.vs | 2 +- assets/cubyz/shaders/chunks/chunk_vertex.vs | 2 +- .../shaders/chunks/occlusionTestFragment.fs | 2 +- .../shaders/chunks/occlusionTestVertex.vs | 1 - assets/cubyz/shaders/deferred_render_pass.fs | 2 +- assets/cubyz/shaders/deferred_render_pass.vs | 2 +- assets/cubyz/shaders/entity_vertex.vs | 2 +- assets/cubyz/shaders/fake_reflection.fs | 10 +++++----- assets/cubyz/shaders/fake_reflection.vs | 2 +- assets/cubyz/shaders/graphics/Circle.fs | 4 ++-- assets/cubyz/shaders/graphics/Circle.vs | 11 +++++----- assets/cubyz/shaders/graphics/Image.fs | 4 ++-- assets/cubyz/shaders/graphics/Image.vs | 9 ++++----- assets/cubyz/shaders/graphics/Line.fs | 4 ++-- assets/cubyz/shaders/graphics/Line.vs | 9 ++++----- assets/cubyz/shaders/graphics/Rect.fs | 4 ++-- assets/cubyz/shaders/graphics/Rect.vs | 9 ++++----- assets/cubyz/shaders/graphics/RectBorder.fs | 4 ++-- assets/cubyz/shaders/graphics/RectBorder.vs | 9 ++++----- assets/cubyz/shaders/graphics/Text.fs | 5 ++--- assets/cubyz/shaders/graphics/Text.vs | 9 ++++----- assets/cubyz/shaders/graphics/graph.fs | 2 +- assets/cubyz/shaders/graphics/graph.vs | 6 +++--- assets/cubyz/shaders/item_drop.fs | 14 ++++++------- assets/cubyz/shaders/item_drop.vs | 8 ++++---- assets/cubyz/shaders/item_texture_post.fs | 2 +- assets/cubyz/shaders/item_texture_post.vs | 2 +- assets/cubyz/shaders/ui/button.fs | 4 ++-- assets/cubyz/shaders/ui/button.vs | 9 ++++----- assets/cubyz/shaders/ui/window_border.fs | 4 ++-- assets/cubyz/shaders/ui/window_border.vs | 9 ++++----- src/Inventory.zig | 16 +++++++-------- src/assets.zig | 8 ++++---- src/audio.zig | 4 +--- src/blocks.zig | 12 +++++------ src/chunk.zig | 8 ++++---- src/entity.zig | 8 ++++---- src/files.zig | 2 +- src/formatter/format.zig | 8 +++++++- src/game.zig | 18 ++++++++--------- src/graphics.zig | 20 +++++++++---------- src/gui/components/Button.zig | 2 +- src/gui/components/CheckBox.zig | 2 +- src/gui/components/ContinuousSlider.zig | 2 +- src/gui/components/DiscreteSlider.zig | 2 +- src/gui/components/HorizontalList.zig | 2 +- src/gui/components/Icon.zig | 2 +- src/gui/components/ItemSlot.zig | 2 +- src/gui/components/Label.zig | 2 +- src/gui/components/MutexComponent.zig | 2 +- src/gui/components/ScrollBar.zig | 2 +- src/gui/components/TextInput.zig | 2 +- src/gui/gui_component.zig | 2 +- src/gui/windows/creative_inventory.zig | 2 +- src/gui/windows/crosshair.zig | 2 +- src/gui/windows/debug_network.zig | 2 +- src/gui/windows/debug_network_advanced.zig | 2 +- src/gui/windows/delete_world_confirmation.zig | 2 +- src/gui/windows/gpu_performance_measuring.zig | 2 +- src/gui/windows/inventory_crafting.zig | 2 +- src/gui/windows/invite.zig | 2 +- src/gui/windows/main.zig | 2 +- src/gui/windows/multiplayer.zig | 2 +- src/gui/windows/pause.zig | 2 +- src/gui/windows/pause_gear.zig | 2 +- src/gui/windows/performance_graph.zig | 2 +- src/gui/windows/save_creation.zig | 4 ++-- src/gui/windows/save_selection.zig | 8 ++++---- src/gui/windows/sound.zig | 2 +- src/itemdrop.zig | 2 +- src/items.zig | 12 +++++------ src/json.zig | 2 +- src/models.zig | 18 ++++++++--------- src/network.zig | 8 ++++---- src/random.zig | 2 +- src/renderer.zig | 6 +++--- src/renderer/mesh_storage.zig | 4 ++-- src/rotation.zig | 2 +- src/server/command/_command.zig | 2 +- src/server/command/_list.zig | 2 +- src/server/command/gamemode.zig | 2 +- src/server/command/help.zig | 2 +- src/server/command/invite.zig | 2 +- src/server/command/kill.zig | 2 +- src/server/command/time.zig | 2 +- src/server/command/tp.zig | 2 +- src/server/server.zig | 4 ++-- src/server/storage.zig | 2 +- src/server/terrain/CaveBiomeMap.zig | 4 ++-- src/server/terrain/CaveMap.zig | 2 +- src/server/terrain/ClimateMap.zig | 4 ++-- src/server/terrain/LightMap.zig | 4 ++-- src/server/terrain/StructureMap.zig | 2 +- src/server/terrain/SurfaceMap.zig | 6 +++--- src/server/terrain/biomes.zig | 8 ++++---- .../cavebiomegen/RandomBiomeDistribution.zig | 2 +- src/server/terrain/cavebiomegen/_list.zig | 2 +- .../terrain/cavegen/FractalCaveGenerator.zig | 4 ++-- .../terrain/cavegen/NoiseCaveGenerator.zig | 2 +- src/server/terrain/cavegen/_list.zig | 2 +- src/server/terrain/chunkgen/OreGenerator.zig | 2 +- .../terrain/chunkgen/StructureGenerator.zig | 2 +- src/server/terrain/chunkgen/_list.zig | 2 +- .../terrain/climategen/NoiseBasedVoronoi.zig | 4 ++-- src/server/terrain/climategen/_list.zig | 2 +- src/server/terrain/mapgen/MapGenV1.zig | 4 ++-- src/server/terrain/mapgen/_list.zig | 2 +- src/server/terrain/noise/BlueNoise.zig | 2 +- .../terrain/noise/CachedFractalNoise.zig | 2 +- .../terrain/noise/CachedFractalNoise3D.zig | 2 +- src/server/terrain/noise/FractalNoise.zig | 2 +- src/server/terrain/noise/FractalNoise3D.zig | 2 +- src/server/terrain/noise/PerlinNoise.zig | 4 ++-- .../noise/RandomlyWeightedFractalNoise.zig | 2 +- src/server/terrain/noise/ValueNoise.zig | 2 +- .../terrain/simple_structures/FallenTree.zig | 2 +- .../terrain/simple_structures/FlowerPatch.zig | 2 +- .../terrain/simple_structures/GroundPatch.zig | 2 +- .../simple_structures/SimpleTreeModel.zig | 4 ++-- .../simple_structures/SimpleVegetation.zig | 2 +- .../terrain/simple_structures/_list.zig | 2 +- .../structuremapgen/SimpleStructureGen.zig | 2 +- src/server/terrain/structuremapgen/_list.zig | 2 +- src/server/terrain/terrain.zig | 2 +- src/server/world.zig | 18 ++++++++--------- src/utils.zig | 2 +- src/utils/file_monitor.zig | 4 ++-- src/utils/list.zig | 10 +++++----- src/zon.zig | 4 ++-- 189 files changed, 373 insertions(+), 382 deletions(-) diff --git a/assets/cubyz/biomes/beach.zig.zon b/assets/cubyz/biomes/beach.zig.zon index 4dd5b415..87e560a0 100644 --- a/assets/cubyz/biomes/beach.zig.zon +++ b/assets/cubyz/biomes/beach.zig.zon @@ -8,11 +8,11 @@ .chance = 0, .interpolation = .linear, - + .hills = 5, .music = "cubyz:tides", - + .ground_structure = .{ "2 to 4 cubyz:sand", }, diff --git a/assets/cubyz/biomes/bush_lands.zig.zon b/assets/cubyz/biomes/bush_lands.zig.zon index 0d2d541f..26c5f886 100644 --- a/assets/cubyz/biomes/bush_lands.zig.zon +++ b/assets/cubyz/biomes/bush_lands.zig.zon @@ -4,11 +4,11 @@ }, .minHeight = 24, .maxHeight = 60, - + .roughness = 20, .hills = 10, .rivers = true, - + .music = "cubyz:sunrise", .ground_structure = .{ diff --git a/assets/cubyz/biomes/bush_mountains.zig.zon b/assets/cubyz/biomes/bush_mountains.zig.zon index b80dd820..4db4da6f 100644 --- a/assets/cubyz/biomes/bush_mountains.zig.zon +++ b/assets/cubyz/biomes/bush_mountains.zig.zon @@ -4,12 +4,12 @@ }, .minHeight = 80, .maxHeight = 256, - + .roughness = 10, .mountains = 100, - + .rivers = true, - + .ground_structure = .{ "0 to 1 cubyz:grass", "0 to 1 cubyz:gravel", diff --git a/assets/cubyz/biomes/cave/cave.zig.zon b/assets/cubyz/biomes/cave/cave.zig.zon index b73a2a7b..f880c638 100644 --- a/assets/cubyz/biomes/cave/cave.zig.zon +++ b/assets/cubyz/biomes/cave/cave.zig.zon @@ -25,7 +25,7 @@ .chance = 0.048, .size = 3, .size_variation = 6, - }, + }, .{ .id = "cubyz:boulder", .chance = 0.016, diff --git a/assets/cubyz/biomes/cave/lava_cave.zig.zon b/assets/cubyz/biomes/cave/lava_cave.zig.zon index 143e7a9d..6ed145f3 100644 --- a/assets/cubyz/biomes/cave/lava_cave.zig.zon +++ b/assets/cubyz/biomes/cave/lava_cave.zig.zon @@ -39,7 +39,6 @@ .size_variation = 6, }, .{ - .id = "cubyz:ground_patch", .block = "cubyz:lava", .chance = 0.064, diff --git a/assets/cubyz/biomes/cave/marble_cave.zig.zon b/assets/cubyz/biomes/cave/marble_cave.zig.zon index 3f6a2eb9..010b8933 100644 --- a/assets/cubyz/biomes/cave/marble_cave.zig.zon +++ b/assets/cubyz/biomes/cave/marble_cave.zig.zon @@ -14,7 +14,7 @@ .chance = 0.112, .size = 4, .size_variation = 10, - }, + }, .{ .id = "cubyz:ground_patch", .block = "cubyz:water", diff --git a/assets/cubyz/biomes/cave/stalagmite_cave.zig.zon b/assets/cubyz/biomes/cave/stalagmite_cave.zig.zon index f179d8a5..4dd64887 100644 --- a/assets/cubyz/biomes/cave/stalagmite_cave.zig.zon +++ b/assets/cubyz/biomes/cave/stalagmite_cave.zig.zon @@ -18,14 +18,14 @@ .chance = 0.48, .size = 4, .size_variation = 6, - }, + }, .{ .id = "cubyz:stalagmite", .block = "cubyz:limestone", .chance = 0.08, .size = 8, .size_variation = 12, - }, + }, .{ .id = "cubyz:ground_patch", .block = "cubyz:limestone", diff --git a/assets/cubyz/biomes/cave/void/void_roots.zig.zon b/assets/cubyz/biomes/cave/void/void_roots.zig.zon index b8bea1db..b169b827 100644 --- a/assets/cubyz/biomes/cave/void/void_roots.zig.zon +++ b/assets/cubyz/biomes/cave/void/void_roots.zig.zon @@ -39,7 +39,7 @@ .chance = 0.048, .size = 3, .size_variation = 6, - }, + }, .{ .id = "cubyz:boulder", .chance = 0.016, diff --git a/assets/cubyz/biomes/cold_ocean.zig.zon b/assets/cubyz/biomes/cold_ocean.zig.zon index b739bb93..16414162 100644 --- a/assets/cubyz/biomes/cold_ocean.zig.zon +++ b/assets/cubyz/biomes/cold_ocean.zig.zon @@ -7,7 +7,7 @@ .minHeight = -100, .maxHeight = -22, .radius = 500, - + .roughness = 20, .hills = 10, diff --git a/assets/cubyz/biomes/flatland.zig.zon b/assets/cubyz/biomes/flatland.zig.zon index c8eb0a14..fef3e885 100644 --- a/assets/cubyz/biomes/flatland.zig.zon +++ b/assets/cubyz/biomes/flatland.zig.zon @@ -5,7 +5,7 @@ .maxHeight = 40, .validPlayerSpawn = true, - + .ground_structure = .{ "cubyz:grass", "2 cubyz:soil", diff --git a/assets/cubyz/biomes/glacier.zig.zon b/assets/cubyz/biomes/glacier.zig.zon index f1e4577d..443ee021 100644 --- a/assets/cubyz/biomes/glacier.zig.zon +++ b/assets/cubyz/biomes/glacier.zig.zon @@ -4,11 +4,11 @@ }, .minHeight = 80, .maxHeight = 256, - + .roughness = 50, .mountains = 50, .hills = 50, - + .ground_structure = .{ "3 to 5 cubyz:snow", "4 cubyz:frost", diff --git a/assets/cubyz/biomes/glass_forest.zig.zon b/assets/cubyz/biomes/glass_forest.zig.zon index 0da87711..897ef407 100644 --- a/assets/cubyz/biomes/glass_forest.zig.zon +++ b/assets/cubyz/biomes/glass_forest.zig.zon @@ -4,14 +4,14 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, - + .music = "cubyz:mana-two-part-2", .validPlayerSpawn = false, - + .ground_structure = .{ }, .structures = .{ diff --git a/assets/cubyz/biomes/grassland.zig.zon b/assets/cubyz/biomes/grassland.zig.zon index cc76762f..6e51333e 100644 --- a/assets/cubyz/biomes/grassland.zig.zon +++ b/assets/cubyz/biomes/grassland.zig.zon @@ -3,14 +3,14 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 1, .hills = 5, - + .music = "cubyz:sunrise", .validPlayerSpawn = true, - + .ground_structure = .{ "cubyz:grass", "2 to 3 cubyz:soil", diff --git a/assets/cubyz/biomes/island_shelf.zig.zon b/assets/cubyz/biomes/island_shelf.zig.zon index c332b3e6..523dde27 100644 --- a/assets/cubyz/biomes/island_shelf.zig.zon +++ b/assets/cubyz/biomes/island_shelf.zig.zon @@ -9,7 +9,7 @@ .music = "cubyz:Sincerely", .radius = 64, - + .ground_structure = .{ "3 to 4 cubyz:stone", "1 to 2 cubyz:sandstone", diff --git a/assets/cubyz/biomes/jungle(TODO).zig.zon b/assets/cubyz/biomes/jungle(TODO).zig.zon index 95973bd9..8ede7315 100644 --- a/assets/cubyz/biomes/jungle(TODO).zig.zon +++ b/assets/cubyz/biomes/jungle(TODO).zig.zon @@ -5,14 +5,14 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, - + .music = "cubyz:leaves", .validPlayerSpawn = true, - + .ground_structure = .{ "cubyz:grass", }, diff --git a/assets/cubyz/biomes/modern_art.zig.zon b/assets/cubyz/biomes/modern_art.zig.zon index 5f5f8bd0..b003a912 100644 --- a/assets/cubyz/biomes/modern_art.zig.zon +++ b/assets/cubyz/biomes/modern_art.zig.zon @@ -4,14 +4,14 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, - + .music = "cubyz:mana-two-part-2", .validPlayerSpawn = false, - + .ground_structure = .{ }, .stoneBlock = "cubyz:chalk/white", diff --git a/assets/cubyz/biomes/mountains.zig.zon b/assets/cubyz/biomes/mountains.zig.zon index b1d68b89..9b7d7837 100644 --- a/assets/cubyz/biomes/mountains.zig.zon +++ b/assets/cubyz/biomes/mountains.zig.zon @@ -5,12 +5,12 @@ .radius = 400, .minHeight = 60, .maxHeight = 256, - + .roughness = 10, .mountains = 100, - + .rivers = true, - + .ground_structure = .{ "cubyz:grass", "1 to 2 cubyz:soil", diff --git a/assets/cubyz/biomes/ocean.zig.zon b/assets/cubyz/biomes/ocean.zig.zon index 81acbb99..a5eb79b5 100644 --- a/assets/cubyz/biomes/ocean.zig.zon +++ b/assets/cubyz/biomes/ocean.zig.zon @@ -5,14 +5,14 @@ .radius = 500, .minHeight = -100, .maxHeight = -22, - + .roughness = 15, .hills = 15, - + .rivers = true, .music = "cubyz:under_the_water_sky", - + .ground_structure = .{ "2 to 3 cubyz:gravel", }, diff --git a/assets/cubyz/biomes/ocean_shelf.zig.zon b/assets/cubyz/biomes/ocean_shelf.zig.zon index 09e56b6a..b44f19a8 100644 --- a/assets/cubyz/biomes/ocean_shelf.zig.zon +++ b/assets/cubyz/biomes/ocean_shelf.zig.zon @@ -8,11 +8,11 @@ .chance = 0, .interpolation = .linear, - + .hills = 10, .music = "cubyz:tides", - + .ground_structure = .{ "2 to 4 cubyz:sand", }, diff --git a/assets/cubyz/biomes/peak.zig.zon b/assets/cubyz/biomes/peak.zig.zon index 52138bbb..808504c8 100644 --- a/assets/cubyz/biomes/peak.zig.zon +++ b/assets/cubyz/biomes/peak.zig.zon @@ -4,9 +4,9 @@ }, .minHeight = 120, .maxHeight = 256, - + .mountains = 125, - + .music = "cubyz:DarkTimes", .ground_structure = .{ diff --git a/assets/cubyz/biomes/rainbow_forest.zig.zon b/assets/cubyz/biomes/rainbow_forest.zig.zon index 31821874..9632425c 100644 --- a/assets/cubyz/biomes/rainbow_forest.zig.zon +++ b/assets/cubyz/biomes/rainbow_forest.zig.zon @@ -4,16 +4,16 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, .chance = 0.01, - + .music = "cubyz:leaves", .validPlayerSpawn = true, - + .ground_structure = .{ "cubyz:grass", "2 to 3 cubyz:soil", diff --git a/assets/cubyz/biomes/rocky_grassland.zig.zon b/assets/cubyz/biomes/rocky_grassland.zig.zon index 0491adb8..db6c08a9 100644 --- a/assets/cubyz/biomes/rocky_grassland.zig.zon +++ b/assets/cubyz/biomes/rocky_grassland.zig.zon @@ -4,11 +4,11 @@ .chance = 0.04, .minHeight = 20, .maxHeight = 40, - + .mountains = 30, - + .music = "cubyz:sunrise", - + .ground_structure = .{ "cubyz:grass", "0 to 1 cubyz:soil", @@ -32,4 +32,4 @@ .size_variance = 4, }, }, -} \ No newline at end of file +} diff --git a/assets/cubyz/biomes/taiga.zig.zon b/assets/cubyz/biomes/taiga.zig.zon index 064d6762..cc50b05a 100644 --- a/assets/cubyz/biomes/taiga.zig.zon +++ b/assets/cubyz/biomes/taiga.zig.zon @@ -4,12 +4,12 @@ }, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, .validPlayerSpawn = true, - + .ground_structure = .{ "0 to 1 cubyz:grass", "2 to 3 cubyz:soil", diff --git a/assets/cubyz/biomes/tall_mountain/base.zig.zon b/assets/cubyz/biomes/tall_mountain/base.zig.zon index d583a49f..92ffd92a 100644 --- a/assets/cubyz/biomes/tall_mountain/base.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/base.zig.zon @@ -5,12 +5,12 @@ .radius = 320, .minHeight = 128, .maxHeight = 128, - + .interpolation = .linear, .mountains = 150, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/peak.zig.zon b/assets/cubyz/biomes/tall_mountain/peak.zig.zon index 6b53b94a..f8054fe1 100644 --- a/assets/cubyz/biomes/tall_mountain/peak.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/peak.zig.zon @@ -9,7 +9,7 @@ .interpolation = .linear, .mountains = 30, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope1.zig.zon b/assets/cubyz/biomes/tall_mountain/slope1.zig.zon index 82b31c98..8d459bf6 100644 --- a/assets/cubyz/biomes/tall_mountain/slope1.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope1.zig.zon @@ -5,12 +5,12 @@ .radius = 280, .minHeight = 256, .maxHeight = 256, - + .interpolation = .linear, .mountains = 75, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope2.zig.zon b/assets/cubyz/biomes/tall_mountain/slope2.zig.zon index 3712d8de..c7d50ed5 100644 --- a/assets/cubyz/biomes/tall_mountain/slope2.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope2.zig.zon @@ -5,11 +5,11 @@ .radius = 240, .minHeight = 384, .maxHeight = 384, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope3.zig.zon b/assets/cubyz/biomes/tall_mountain/slope3.zig.zon index f9e9b226..751dee63 100644 --- a/assets/cubyz/biomes/tall_mountain/slope3.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope3.zig.zon @@ -5,11 +5,11 @@ .radius = 200, .minHeight = 480, .maxHeight = 480, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope4.zig.zon b/assets/cubyz/biomes/tall_mountain/slope4.zig.zon index 400fb5d7..9c47e5ef 100644 --- a/assets/cubyz/biomes/tall_mountain/slope4.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope4.zig.zon @@ -5,11 +5,11 @@ .radius = 160, .minHeight = 576, .maxHeight = 576, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope5.zig.zon b/assets/cubyz/biomes/tall_mountain/slope5.zig.zon index 8789d8ea..c50e0eda 100644 --- a/assets/cubyz/biomes/tall_mountain/slope5.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope5.zig.zon @@ -8,7 +8,7 @@ .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/tall_mountain/slope6.zig.zon b/assets/cubyz/biomes/tall_mountain/slope6.zig.zon index cc2f766e..79579095 100644 --- a/assets/cubyz/biomes/tall_mountain/slope6.zig.zon +++ b/assets/cubyz/biomes/tall_mountain/slope6.zig.zon @@ -8,7 +8,7 @@ .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/thicket.zig.zon b/assets/cubyz/biomes/thicket.zig.zon index 33c9488f..17569952 100644 --- a/assets/cubyz/biomes/thicket.zig.zon +++ b/assets/cubyz/biomes/thicket.zig.zon @@ -6,14 +6,14 @@ .radius = 32, .minHeight = 22, .maxHeight = 40, - + .roughness = 10, .hills = 10, - + .music = "cubyz:leaves", .validPlayerSpawn = true, - + .ground_structure = .{ "cubyz:grass", "2 to 3 cubyz:soil", diff --git a/assets/cubyz/biomes/volcano/base.zig.zon b/assets/cubyz/biomes/volcano/base.zig.zon index 27aa8184..6678d084 100644 --- a/assets/cubyz/biomes/volcano/base.zig.zon +++ b/assets/cubyz/biomes/volcano/base.zig.zon @@ -5,12 +5,12 @@ .radius = 320, .minHeight = 128, .maxHeight = 128, - + .interpolation = .linear, .mountains = 150, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/peak.zig.zon b/assets/cubyz/biomes/volcano/peak.zig.zon index 22fbea3e..2dbb229b 100644 --- a/assets/cubyz/biomes/volcano/peak.zig.zon +++ b/assets/cubyz/biomes/volcano/peak.zig.zon @@ -8,7 +8,7 @@ .interpolation = .smooth, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope1.zig.zon b/assets/cubyz/biomes/volcano/slope1.zig.zon index 5fc3a6fe..b0f89528 100644 --- a/assets/cubyz/biomes/volcano/slope1.zig.zon +++ b/assets/cubyz/biomes/volcano/slope1.zig.zon @@ -5,12 +5,12 @@ .radius = 260, .minHeight = 256, .maxHeight = 256, - + .interpolation = .linear, .mountains = 75, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope2.zig.zon b/assets/cubyz/biomes/volcano/slope2.zig.zon index 4c0a2c52..74a09f2f 100644 --- a/assets/cubyz/biomes/volcano/slope2.zig.zon +++ b/assets/cubyz/biomes/volcano/slope2.zig.zon @@ -6,11 +6,11 @@ .minHeight = 384, .maxHeight = 384, .mountains = 50, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope3.zig.zon b/assets/cubyz/biomes/volcano/slope3.zig.zon index 653e349d..d459eb26 100644 --- a/assets/cubyz/biomes/volcano/slope3.zig.zon +++ b/assets/cubyz/biomes/volcano/slope3.zig.zon @@ -7,11 +7,11 @@ .maxHeight = 480, .roughness = 50, .mountains = 50, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope4.zig.zon b/assets/cubyz/biomes/volcano/slope4.zig.zon index de2dae90..9bd2f279 100644 --- a/assets/cubyz/biomes/volcano/slope4.zig.zon +++ b/assets/cubyz/biomes/volcano/slope4.zig.zon @@ -7,11 +7,11 @@ .maxHeight = 576, .roughness = 100, .mountains = 100, - + .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope5.zig.zon b/assets/cubyz/biomes/volcano/slope5.zig.zon index 262c7869..53545cde 100644 --- a/assets/cubyz/biomes/volcano/slope5.zig.zon +++ b/assets/cubyz/biomes/volcano/slope5.zig.zon @@ -10,7 +10,7 @@ .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/volcano/slope6.zig.zon b/assets/cubyz/biomes/volcano/slope6.zig.zon index d85d7e2e..088c645d 100644 --- a/assets/cubyz/biomes/volcano/slope6.zig.zon +++ b/assets/cubyz/biomes/volcano/slope6.zig.zon @@ -10,7 +10,7 @@ .interpolation = .linear, .chance = 0, - + .music = "cubyz:out_of_breath", .parentBiomes = .{ diff --git a/assets/cubyz/biomes/warm_ocean.zig.zon b/assets/cubyz/biomes/warm_ocean.zig.zon index 94e61f27..e7d3be02 100644 --- a/assets/cubyz/biomes/warm_ocean.zig.zon +++ b/assets/cubyz/biomes/warm_ocean.zig.zon @@ -6,17 +6,17 @@ .radius = 500, .minHeight = -100, .maxHeight = -22, - + .roughness = 10, .hills = 20, .music = "cubyz:tides", - + .ground_structure = .{ "2 to 4 cubyz:sand", }, .stoneBlock = "cubyz:sandstone", - + .structures = .{ .{ .id = "cubyz:ground_patch", diff --git a/assets/cubyz/biomes/wetlands/base.zig.zon b/assets/cubyz/biomes/wetlands/base.zig.zon index ce23e67b..01709b09 100644 --- a/assets/cubyz/biomes/wetlands/base.zig.zon +++ b/assets/cubyz/biomes/wetlands/base.zig.zon @@ -38,4 +38,4 @@ .branched = false, }, }, -} \ No newline at end of file +} diff --git a/assets/cubyz/blocks/chalk/_defaults.zig.zon b/assets/cubyz/blocks/chalk/_defaults.zig.zon index 3ded5be8..c237ddf0 100644 --- a/assets/cubyz/blocks/chalk/_defaults.zig.zon +++ b/assets/cubyz/blocks/chalk/_defaults.zig.zon @@ -6,4 +6,4 @@ }, .model = "cubyz:cube", .rotation = .stairs, -} \ No newline at end of file +} diff --git a/assets/cubyz/blocks/daisies.zig.zon b/assets/cubyz/blocks/daisies.zig.zon index dc8adc62..6011bee8 100644 --- a/assets/cubyz/blocks/daisies.zig.zon +++ b/assets/cubyz/blocks/daisies.zig.zon @@ -7,7 +7,7 @@ .degradable = true, .collide = false, .alwaysViewThrough = true, - .absorbedLight = 0x121012, + .absorbedLight = 0x121012, .model = "cubyz:plane", .rotation = .carpet, .texture = "cubyz:daisies", diff --git a/assets/cubyz/blocks/dead_leaf_pile.zig.zon b/assets/cubyz/blocks/dead_leaf_pile.zig.zon index 98b6a526..6210a9d9 100644 --- a/assets/cubyz/blocks/dead_leaf_pile.zig.zon +++ b/assets/cubyz/blocks/dead_leaf_pile.zig.zon @@ -5,11 +5,11 @@ .degradable = true, .collide = false, .alwaysViewThrough = true, - .absorbedLight = 0x000000, + .absorbedLight = 0x000000, .model = "cubyz:plane", .rotation = .carpet, .texture = "cubyz:dead_leaf_pile", - .item= .{ + .item = .{ .texture = "dead_leaf_pile.png", }, .lodReplacement = "cubyz:air", diff --git a/assets/cubyz/blocks/fog/_defaults.zig.zon b/assets/cubyz/blocks/fog/_defaults.zig.zon index e96635b1..14ffcc07 100644 --- a/assets/cubyz/blocks/fog/_defaults.zig.zon +++ b/assets/cubyz/blocks/fog/_defaults.zig.zon @@ -9,4 +9,4 @@ .collide = false, .model = "cubyz:cube", -} \ No newline at end of file +} diff --git a/assets/cubyz/blocks/glow_crystal/_defaults.zig.zon b/assets/cubyz/blocks/glow_crystal/_defaults.zig.zon index 144b7535..e5f4d7be 100644 --- a/assets/cubyz/blocks/glow_crystal/_defaults.zig.zon +++ b/assets/cubyz/blocks/glow_crystal/_defaults.zig.zon @@ -5,4 +5,4 @@ .{.items = .{.auto}}, }, .model = "cubyz:cube", -} \ No newline at end of file +} diff --git a/assets/cubyz/blocks/ivy.zig.zon b/assets/cubyz/blocks/ivy.zig.zon index 0477d697..1a675a7b 100644 --- a/assets/cubyz/blocks/ivy.zig.zon +++ b/assets/cubyz/blocks/ivy.zig.zon @@ -7,12 +7,12 @@ .degradable = true, .collide = false, .alwaysViewThrough = true, - .absorbedLight = 0x121012, + .absorbedLight = 0x121012, .model = "cubyz:plane", .rotation = .carpet, .texture = "cubyz:ivy", - .item= .{ + .item = .{ .texture = "ivy.png", - }, + }, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/mahogany_planks.zig.zon b/assets/cubyz/blocks/mahogany_planks.zig.zon index 3de94dc6..3afd1724 100644 --- a/assets/cubyz/blocks/mahogany_planks.zig.zon +++ b/assets/cubyz/blocks/mahogany_planks.zig.zon @@ -12,7 +12,7 @@ }, }, }, - + .drops = .{ .{.items = .{.auto}}, }, diff --git a/assets/cubyz/blocks/pine_planks.zig.zon b/assets/cubyz/blocks/pine_planks.zig.zon index 78844c70..767517a8 100644 --- a/assets/cubyz/blocks/pine_planks.zig.zon +++ b/assets/cubyz/blocks/pine_planks.zig.zon @@ -12,7 +12,7 @@ }, }, }, - + .drops = .{ .{.items = .{.auto}}, }, diff --git a/assets/cubyz/blocks/red_leaf_pile.zig.zon b/assets/cubyz/blocks/red_leaf_pile.zig.zon index 3d88a492..b811fea4 100644 --- a/assets/cubyz/blocks/red_leaf_pile.zig.zon +++ b/assets/cubyz/blocks/red_leaf_pile.zig.zon @@ -7,7 +7,7 @@ .degradable = true, .collide = false, .alwaysViewThrough = true, - .absorbedLight = 0x000000, + .absorbedLight = 0x000000, .model = "cubyz:plane", .rotation = .carpet, .texture = "cubyz:red_leaf_pile", diff --git a/assets/cubyz/blocks/yellow_leaf_pile.zig.zon b/assets/cubyz/blocks/yellow_leaf_pile.zig.zon index c47f0f87..a91d75e6 100644 --- a/assets/cubyz/blocks/yellow_leaf_pile.zig.zon +++ b/assets/cubyz/blocks/yellow_leaf_pile.zig.zon @@ -7,7 +7,7 @@ .degradable = true, .collide = false, .alwaysViewThrough = true, - .absorbedLight = 0x000000, + .absorbedLight = 0x000000, .model = "cubyz:plane", .rotation = .carpet, .texture = "cubyz:yellow_leaf_pile", diff --git a/assets/cubyz/shaders/animation_pre_processing.glsl b/assets/cubyz/shaders/animation_pre_processing.glsl index e6112afc..00d43ed5 100644 --- a/assets/cubyz/shaders/animation_pre_processing.glsl +++ b/assets/cubyz/shaders/animation_pre_processing.glsl @@ -24,4 +24,4 @@ void main() { uint textureIndex = gl_GlobalInvocationID.x; if(textureIndex >= size) return; animatedTexture[textureIndex] = animation[textureIndex].startFrame + time / animation[textureIndex].time % animation[textureIndex].frames; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/background/fragment.fs b/assets/cubyz/shaders/background/fragment.fs index 4c2736d7..53b72ec9 100644 --- a/assets/cubyz/shaders/background/fragment.fs +++ b/assets/cubyz/shaders/background/fragment.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 fragColor; @@ -8,4 +8,4 @@ uniform sampler2D image; void main() { fragColor = texture(image, outTexCoords); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/background/vertex.vs b/assets/cubyz/shaders/background/vertex.vs index 478574b8..f217c19d 100644 --- a/assets/cubyz/shaders/background/vertex.vs +++ b/assets/cubyz/shaders/background/vertex.vs @@ -12,4 +12,4 @@ void main() { gl_Position = projectionMatrix*viewMatrix*vec4(vertexPos, 1); outTexCoords = texCoords*vec2(1, -1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/color_extractor_downsample.fs b/assets/cubyz/shaders/bloom/color_extractor_downsample.fs index 70356215..914db900 100644 --- a/assets/cubyz/shaders/bloom/color_extractor_downsample.fs +++ b/assets/cubyz/shaders/bloom/color_extractor_downsample.fs @@ -103,4 +103,4 @@ void main() { vec3 bufferData = linearSample(ivec2(texCoords)); float bloomFactor = max(max(bufferData.x, max(bufferData.y, bufferData.z)) - 1.0, 0); fragColor = vec4(bufferData*bloomFactor, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/color_extractor_downsample.vs b/assets/cubyz/shaders/bloom/color_extractor_downsample.vs index fc68574f..b99896a5 100644 --- a/assets/cubyz/shaders/bloom/color_extractor_downsample.vs +++ b/assets/cubyz/shaders/bloom/color_extractor_downsample.vs @@ -17,4 +17,4 @@ void main() { normalizedTexCoords = inTexCoords; texCoords = inTexCoords*textureSize(color, 0) - 0.25; gl_Position = vec4(position, 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/first_pass.fs b/assets/cubyz/shaders/bloom/first_pass.fs index 110ef5a9..c3ccb593 100644 --- a/assets/cubyz/shaders/bloom/first_pass.fs +++ b/assets/cubyz/shaders/bloom/first_pass.fs @@ -35,4 +35,4 @@ void main() { result += texture(color, texCoords - vec2(tex_offset.x * i, 0.0)).rgb * weights[i]; } fragColor = vec4(result, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/first_pass.vs b/assets/cubyz/shaders/bloom/first_pass.vs index ef5ed408..0ede31c2 100644 --- a/assets/cubyz/shaders/bloom/first_pass.vs +++ b/assets/cubyz/shaders/bloom/first_pass.vs @@ -7,4 +7,4 @@ out vec2 texCoords; void main() { texCoords = inTexCoords; gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/second_pass.fs b/assets/cubyz/shaders/bloom/second_pass.fs index 2b720eb3..255d40e0 100644 --- a/assets/cubyz/shaders/bloom/second_pass.fs +++ b/assets/cubyz/shaders/bloom/second_pass.fs @@ -16,4 +16,4 @@ void main() { result += texture(color, texCoords - vec2(0, tex_offset.y * i)).rgb * weights[i]; } fragColor = vec4(result, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/bloom/second_pass.vs b/assets/cubyz/shaders/bloom/second_pass.vs index 80e8c588..2bbe120b 100644 --- a/assets/cubyz/shaders/bloom/second_pass.vs +++ b/assets/cubyz/shaders/bloom/second_pass.vs @@ -7,4 +7,4 @@ out vec2 texCoords; void main() { texCoords = inTexCoords; gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/chunks/chunk_vertex.vs b/assets/cubyz/shaders/chunks/chunk_vertex.vs index a915415e..c1ed110b 100644 --- a/assets/cubyz/shaders/chunks/chunk_vertex.vs +++ b/assets/cubyz/shaders/chunks/chunk_vertex.vs @@ -97,7 +97,7 @@ void main() { ); normal = quads[quadIndex].normal; - + position += quads[quadIndex].corners[vertexID]; position *= voxelSize; position += modelPosition; diff --git a/assets/cubyz/shaders/chunks/occlusionTestFragment.fs b/assets/cubyz/shaders/chunks/occlusionTestFragment.fs index 30b42ca7..afab9fb6 100644 --- a/assets/cubyz/shaders/chunks/occlusionTestFragment.fs +++ b/assets/cubyz/shaders/chunks/occlusionTestFragment.fs @@ -25,4 +25,4 @@ layout(std430, binding = 6) buffer _chunks void main() { chunks[chunkID].visibilityState = 1; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/chunks/occlusionTestVertex.vs b/assets/cubyz/shaders/chunks/occlusionTestVertex.vs index 14c6f384..31f1d92d 100644 --- a/assets/cubyz/shaders/chunks/occlusionTestVertex.vs +++ b/assets/cubyz/shaders/chunks/occlusionTestVertex.vs @@ -75,4 +75,3 @@ void main() { vec3 vertexPosition = modelPosition + (vertexBuffer[vertexID]*chunks[chunkID].maxPos.xyz + (1 - vertexBuffer[vertexID])*chunks[chunkID].minPos.xyz)*chunks[chunkID].voxelSize; gl_Position = projectionMatrix*viewMatrix*vec4(vertexPosition, 1); } - diff --git a/assets/cubyz/shaders/deferred_render_pass.fs b/assets/cubyz/shaders/deferred_render_pass.fs index f35924a0..0c8eb8a5 100644 --- a/assets/cubyz/shaders/deferred_render_pass.fs +++ b/assets/cubyz/shaders/deferred_render_pass.fs @@ -88,4 +88,4 @@ void main() { fragColor.rgb = applyFrontfaceFog(fogDistance, fog.color, fragColor.rgb); float maxColor = max(1.0, max(fragColor.r, max(fragColor.g, fragColor.b))); fragColor.rgb = fragColor.rgb/maxColor; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/deferred_render_pass.vs b/assets/cubyz/shaders/deferred_render_pass.vs index 14b90e3e..a8f83321 100644 --- a/assets/cubyz/shaders/deferred_render_pass.vs +++ b/assets/cubyz/shaders/deferred_render_pass.vs @@ -13,4 +13,4 @@ void main() { direction = (invViewMatrix * vec4(position.x*tanXY.x, 1, position.y*tanXY.y, 0)).xyz; texCoords = inTexCoords; gl_Position = vec4(position, 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/entity_vertex.vs b/assets/cubyz/shaders/entity_vertex.vs index 6ce1eeae..7878603a 100644 --- a/assets/cubyz/shaders/entity_vertex.vs +++ b/assets/cubyz/shaders/entity_vertex.vs @@ -40,7 +40,7 @@ void main() { int vertexID = gl_VertexID & 3; normal = quads[faceID].normal; - + vec3 position = quads[faceID].corners[vertexID]; vec4 mvPos = viewMatrix*vec4(position, 1); diff --git a/assets/cubyz/shaders/fake_reflection.fs b/assets/cubyz/shaders/fake_reflection.fs index 7c814d2d..b631860b 100644 --- a/assets/cubyz/shaders/fake_reflection.fs +++ b/assets/cubyz/shaders/fake_reflection.fs @@ -30,7 +30,7 @@ float snoise(vec3 v) { vec3 i1 = min(g.xyz, l.zxy); vec3 i2 = max(g.xyz, l.zxy); - // x0 = x0 - 0. + 0.0 * C + // x0 = x0 - 0. + 0.0 * C vec3 x1 = x0 - i1 + 1.0*C.xxx; vec3 x2 = x0 - i2 + 2.0*C.xxx; vec3 x3 = x0 - 1. + 3.0*C.xxx; @@ -38,13 +38,13 @@ float snoise(vec3 v) { // Get gradients: ivec3 rand = random3to3(ivec3(i)); vec3 p0 = vec3(rand); - + rand = random3to3((ivec3(i + i1))); vec3 p1 = vec3(rand); - + rand = random3to3((ivec3(i + i2))); vec3 p2 = vec3(rand); - + rand = random3to3((ivec3(i + 1))); vec3 p3 = vec3(rand); @@ -59,4 +59,4 @@ void main() { position = position.x*rightVector + position.y*upVector + position.z*normalVector; position *= frequency; fragColor = vec4(vec3(snoise(position)*0.5 + 0.5), 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/fake_reflection.vs b/assets/cubyz/shaders/fake_reflection.vs index 51920ce8..725d87f7 100644 --- a/assets/cubyz/shaders/fake_reflection.vs +++ b/assets/cubyz/shaders/fake_reflection.vs @@ -9,4 +9,4 @@ uniform float reflectionMapSize; void main() { coords = vec3((inTexCoords*2 - vec2(1, 1))*(reflectionMapSize + 1)/reflectionMapSize, 1); gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Circle.fs b/assets/cubyz/shaders/graphics/Circle.fs index 26d3144c..5ce637ac 100644 --- a/assets/cubyz/shaders/graphics/Circle.fs +++ b/assets/cubyz/shaders/graphics/Circle.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -16,4 +16,4 @@ void main(){ float alpha = linearstep(1+delta, 1-delta, distSqr); frag_color = color; frag_color.a *= alpha; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Circle.vs b/assets/cubyz/shaders/graphics/Circle.vs index 7750993c..80d712db 100644 --- a/assets/cubyz/shaders/graphics/Circle.vs +++ b/assets/cubyz/shaders/graphics/Circle.vs @@ -15,15 +15,14 @@ uniform int circleColor; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (center + vertex_pos*radius)/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + color = vec4((circleColor & 0xff0000)>>16, (circleColor & 0xff00)>>8, circleColor & 0xff, (circleColor>>24) & 255)/255.0; - + unitPosition = vertex_pos; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Image.fs b/assets/cubyz/shaders/graphics/Image.fs index 51840172..b2e522e3 100644 --- a/assets/cubyz/shaders/graphics/Image.fs +++ b/assets/cubyz/shaders/graphics/Image.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; uniform sampler2D image; @@ -8,4 +8,4 @@ in vec2 uv; void main() { frag_color = texture(image, uv) * fColor; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Image.vs b/assets/cubyz/shaders/graphics/Image.vs index fc57adde..2cb80eed 100644 --- a/assets/cubyz/shaders/graphics/Image.vs +++ b/assets/cubyz/shaders/graphics/Image.vs @@ -15,14 +15,13 @@ uniform vec2 uvDim; uniform int color; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vec2(vertex_pos.x*size.x, size.y - vertex_pos.y*size.y))/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0; uv = uvOffset + vertex_pos*uvDim; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Line.fs b/assets/cubyz/shaders/graphics/Line.fs index feb40e64..df1e6f51 100644 --- a/assets/cubyz/shaders/graphics/Line.fs +++ b/assets/cubyz/shaders/graphics/Line.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -8,4 +8,4 @@ uniform sampler2D texture_sampler; void main() { frag_color = color; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Line.vs b/assets/cubyz/shaders/graphics/Line.vs index befa8dad..f5708695 100644 --- a/assets/cubyz/shaders/graphics/Line.vs +++ b/assets/cubyz/shaders/graphics/Line.vs @@ -14,13 +14,12 @@ uniform int lineColor; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vertex_pos*direction)/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + color = vec4((lineColor & 0xff0000)>>16, (lineColor & 0xff00)>>8, lineColor & 0xff, (lineColor>>24) & 255)/255.0; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Rect.fs b/assets/cubyz/shaders/graphics/Rect.fs index 64dcc011..0bcc6342 100644 --- a/assets/cubyz/shaders/graphics/Rect.fs +++ b/assets/cubyz/shaders/graphics/Rect.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -6,4 +6,4 @@ flat in vec4 color; void main(){ frag_color = color; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Rect.vs b/assets/cubyz/shaders/graphics/Rect.vs index 415e9e89..70565f1c 100644 --- a/assets/cubyz/shaders/graphics/Rect.vs +++ b/assets/cubyz/shaders/graphics/Rect.vs @@ -14,13 +14,12 @@ uniform int rectColor; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vertex_pos*size)/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + color = vec4((rectColor & 0xff0000)>>16, (rectColor & 0xff00)>>8, rectColor & 0xff, (rectColor>>24) & 255)/255.0;; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/RectBorder.fs b/assets/cubyz/shaders/graphics/RectBorder.fs index 64dcc011..0bcc6342 100644 --- a/assets/cubyz/shaders/graphics/RectBorder.fs +++ b/assets/cubyz/shaders/graphics/RectBorder.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -6,4 +6,4 @@ flat in vec4 color; void main(){ frag_color = color; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/RectBorder.vs b/assets/cubyz/shaders/graphics/RectBorder.vs index 4c156c37..10511586 100644 --- a/assets/cubyz/shaders/graphics/RectBorder.vs +++ b/assets/cubyz/shaders/graphics/RectBorder.vs @@ -15,13 +15,12 @@ uniform int rectColor; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vertex_pos.xy*size + vertex_pos.zw*lineWidth)/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + color = vec4((rectColor & 0xff0000)>>16, (rectColor & 0xff00)>>8, rectColor & 0xff, (rectColor>>24) & 255)/255.0;; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Text.fs b/assets/cubyz/shaders/graphics/Text.fs index 06d5c4d1..55763498 100644 --- a/assets/cubyz/shaders/graphics/Text.fs +++ b/assets/cubyz/shaders/graphics/Text.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -19,7 +19,6 @@ vec2 convert2Proportional(vec2 original, vec2 full){ return vec2(original.x/full.x, original.y/full.y); } - void main() { vec4 texture_rect_percentage = vec4(convert2Proportional(texture_rect.xy, fontSize), convert2Proportional(texture_rect.zw, fontSize)); vec2 texture_position = vec2( @@ -37,4 +36,4 @@ void main() { frag_color = color*texture(texture_sampler, texture_position).r; } -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/Text.vs b/assets/cubyz/shaders/graphics/Text.vs index 2ec68569..0619c666 100644 --- a/assets/cubyz/shaders/graphics/Text.vs +++ b/assets/cubyz/shaders/graphics/Text.vs @@ -20,7 +20,6 @@ vec2 convert2Proportional(vec2 original, vec2 full) { return vec2(original.x/full.x, original.y/full.y); } - void main() { vec2 vertex_pos = face_pos*vec2(1, -1); vec2 position_percentage = convert2Proportional(floor(offset), scene); @@ -28,13 +27,13 @@ void main() { if ((fontEffects & 0x02000000) != 0) { // italic vertex_pos.x += vertex_pos.y/texture_rect.z; } - + //convert glyph coords to opengl coords vec4 rect = vec4(position_percentage, size_percentage); - + vec2 position = vec2(rect.x+vertex_pos.x*rect.z, -rect.y+vertex_pos.y*rect.w)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); frag_face_pos = face_pos; color = vec4(vec3((fontEffects & 0xff0000)>>16, (fontEffects & 0xff00)>>8, fontEffects & 0xff)/255.0, alpha); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/graph.fs b/assets/cubyz/shaders/graphics/graph.fs index dbbd81d1..4ba19ab3 100644 --- a/assets/cubyz/shaders/graphics/graph.fs +++ b/assets/cubyz/shaders/graphics/graph.fs @@ -6,4 +6,4 @@ uniform vec3 lineColor; void main() { frag_color = vec4(lineColor, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/graphics/graph.vs b/assets/cubyz/shaders/graphics/graph.vs index 0abebc4e..65654579 100644 --- a/assets/cubyz/shaders/graphics/graph.vs +++ b/assets/cubyz/shaders/graphics/graph.vs @@ -18,8 +18,8 @@ void main() { float y = -data[(gl_VertexID+offset)%points]; // Convert to opengl coordinates: vec2 position_percentage = (start + dimension*vec2(x/points, y))/screen; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2 + vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/item_drop.fs b/assets/cubyz/shaders/item_drop.fs index 5e50e32a..29900a83 100644 --- a/assets/cubyz/shaders/item_drop.fs +++ b/assets/cubyz/shaders/item_drop.fs @@ -117,14 +117,14 @@ void mainItemDrop() { if(direction.x == 0) tMax.x = 1.0/0.0; if(direction.y == 0) tMax.y = 1.0/0.0; if(direction.z == 0) tMax.z = 1.0/0.0; - + uvec3 voxelPosition = uvec3(floor(startPosition)); int lastNormal = faceNormalIndex; uint block = getVoxel(voxelPosition); float total_tMax = 0; - + uvec3 sizeMask = upper - 1; - + while(block == 0) { if(tMax.x < tMax.y) { if(tMax.x < tMax.z) { @@ -170,14 +170,14 @@ void mainItemDrop() { block = getVoxel(voxelPosition); } if(block == 0) discard; - + vec3 modifiedCameraSpacePos = cameraSpacePos*(1 + total_tMax*sizeScale*length(direction)/length(cameraSpacePos)); vec4 projection = projectionMatrix*vec4(modifiedCameraSpacePos, 1); float depth = projection.z/projection.w; gl_FragDepth = ((gl_DepthRange.diff * depth) + gl_DepthRange.near + gl_DepthRange.far)/2.0; - - - + + + fragColor = decodeColor(block); fragColor.a = 1; // No transparency supported! fragColor = fragColor*vec4(ambientLight*normalVariations[lastNormal], 1); diff --git a/assets/cubyz/shaders/item_drop.vs b/assets/cubyz/shaders/item_drop.vs index 30080be1..a8dd87ab 100644 --- a/assets/cubyz/shaders/item_drop.vs +++ b/assets/cubyz/shaders/item_drop.vs @@ -56,7 +56,7 @@ const int[24] positions = int[24]( 0x010, 0x001, 0x011, - + 0x001, 0x011, 0x101, @@ -105,11 +105,11 @@ void main() { textureIndex = -1; } voxelModel = voxelModelIndex; - - + + vec4 worldSpace = modelMatrix*vec4(pos, 1); direction = (transpose(mat3(modelMatrix))*worldSpace.xyz).xyz; - + vec4 cameraSpace = viewMatrix*worldSpace; gl_Position = projectionMatrix*cameraSpace; cameraSpacePos = cameraSpace.xyz; diff --git a/assets/cubyz/shaders/item_texture_post.fs b/assets/cubyz/shaders/item_texture_post.fs index 863b9a0d..723e5dfc 100644 --- a/assets/cubyz/shaders/item_texture_post.fs +++ b/assets/cubyz/shaders/item_texture_post.fs @@ -14,4 +14,4 @@ void main() { } float maxColor = max(1.0, max(fragColor.r, max(fragColor.g, fragColor.b))); fragColor.rgb = fragColor.rgb/maxColor; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/item_texture_post.vs b/assets/cubyz/shaders/item_texture_post.vs index ef5ed408..0ede31c2 100644 --- a/assets/cubyz/shaders/item_texture_post.vs +++ b/assets/cubyz/shaders/item_texture_post.vs @@ -7,4 +7,4 @@ out vec2 texCoords; void main() { texCoords = inTexCoords; gl_Position = vec4(inTexCoords*2 - vec2(1, 1), 0, 1); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/ui/button.fs b/assets/cubyz/shaders/ui/button.fs index 07f78927..cdbab463 100644 --- a/assets/cubyz/shaders/ui/button.fs +++ b/assets/cubyz/shaders/ui/button.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; uniform sampler2D image; @@ -12,4 +12,4 @@ void main() { frag_color = texture(image, (gl_FragCoord.xy - startCoord)/(2*scale)/textureSize(image, 0)); frag_color.a *= fColor.a; frag_color.rgb += fColor.rgb; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/ui/button.vs b/assets/cubyz/shaders/ui/button.vs index 7cc2fa57..8a543e79 100644 --- a/assets/cubyz/shaders/ui/button.vs +++ b/assets/cubyz/shaders/ui/button.vs @@ -13,15 +13,14 @@ uniform vec2 screen; uniform int color; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vertex_pos*size)/screen; startCoord.x = start.x; startCoord.y = screen.y - start.y; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0; -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/ui/window_border.fs b/assets/cubyz/shaders/ui/window_border.fs index 5411049f..0d9dfa1f 100644 --- a/assets/cubyz/shaders/ui/window_border.fs +++ b/assets/cubyz/shaders/ui/window_border.fs @@ -1,4 +1,4 @@ -#version 330 +#version 330 layout (location=0) out vec4 frag_color; @@ -16,4 +16,4 @@ void main() { float reducedDistance = distanceToBorder.x*distanceToBorder.y/(distanceToBorder.x + distanceToBorder.y); // Inspired by the reduced mass from physics, to give a sort of curvy look to the outline. float opacity = max(1 - reducedDistance, 0); frag_color = fColor*vec4(1, 1, 1, opacity); -} \ No newline at end of file +} diff --git a/assets/cubyz/shaders/ui/window_border.vs b/assets/cubyz/shaders/ui/window_border.vs index 33d80ad8..82325467 100644 --- a/assets/cubyz/shaders/ui/window_border.vs +++ b/assets/cubyz/shaders/ui/window_border.vs @@ -14,17 +14,16 @@ uniform vec2 screen; uniform int color; void main() { - // Convert to opengl coordinates: vec2 position_percentage = (start + vertex_pos*size)/screen; startCoord.x = start.x; startCoord.y = screen.y - start.y - size.y; endCoord.x = start.x + size.x; endCoord.y = screen.y - start.y; - + vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1); - + gl_Position = vec4(position, 0, 1); - + fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0; -} \ No newline at end of file +} diff --git a/src/Inventory.zig b/src/Inventory.zig index d45c1a7b..694546fa 100644 --- a/src/Inventory.zig +++ b/src/Inventory.zig @@ -262,7 +262,7 @@ pub const Sync = struct { // MARK: Sync for(command.syncOperations.items) |op| { const syncData = op.serialize(main.stackAllocator); defer main.stackAllocator.free(syncData); - + const users = op.getUsers(main.stackAllocator); defer main.stackAllocator.free(users); @@ -324,7 +324,7 @@ pub const Sync = struct { // MARK: Sync const path = std.fmt.allocPrint(main.stackAllocator.allocator, "saves/{s}/players/{s}.zig.zon", .{main.server.world.?.name, hashedName}) catch unreachable; defer main.stackAllocator.free(path); - + const playerData = main.files.readToZon(main.stackAllocator, path) catch .null; defer playerData.deinit(main.stackAllocator); @@ -581,7 +581,7 @@ pub const Command = struct { // MARK: Command return error.Invalid; } create.inv.ref().amount += create.amount; - + create.inv.inv.update(); }, .delete => |delete| { @@ -592,7 +592,7 @@ pub const Command = struct { // MARK: Command if (delete.inv.ref().amount == 0) { delete.inv.ref().item = null; } - + delete.inv.inv.update(); }, .useDurability => |durability| { @@ -601,7 +601,7 @@ pub const Command = struct { // MARK: Command durability.inv.ref().item = null; durability.inv.ref().amount = 0; } - + durability.inv.inv.update(); }, .health => |health| { @@ -1515,7 +1515,7 @@ pub const Command = struct { // MARK: Command if(self.inv.type == .workbench) items = self.inv._items[0..25]; for(items, 0..) |stack, slot| { if(stack.item == null) continue; - + cmd.executeBaseOperation(allocator, .{.delete = .{ .source = .{.inv = self.inv, .slot = @intCast(slot)}, .amount = stack.amount, @@ -1548,7 +1548,7 @@ pub const Command = struct { // MARK: Command const stack = self.source.ref(); const costOfChange = if(gamemode != .creative) self.oldBlock.canBeChangedInto(self.newBlock, stack.*) else .yes; - + // Check if we can change it: if(!switch(costOfChange) { .no => false, @@ -1886,4 +1886,4 @@ pub fn loadFromZon(self: Inventory, zon: ZonElement) void { stack.amount = stackZon.get(u16, "amount", 0); } } -} \ No newline at end of file +} diff --git a/src/assets.zig b/src/assets.zig index 5a84e451..6ac3f8d0 100644 --- a/src/assets.zig +++ b/src/assets.zig @@ -56,9 +56,9 @@ pub fn readAllZonFilesInAddons(externalAllocator: NeverFailingAllocator, addons: defer defaultsArena.deinit(); const defaultsArenaAllocator = defaultsArena.allocator(); - + var defaultMap = std.StringHashMap(ZonElement).init(defaultsArenaAllocator.allocator); - + var walker = dir.walk(main.stackAllocator.allocator) catch unreachable; defer walker.deinit(); @@ -100,7 +100,7 @@ pub fn readAllZonFilesInAddons(externalAllocator: NeverFailingAllocator, addons: std.log.err("Failed to read default file: {s}", .{@errorName(err)}); break :blk .null; }; - + result.value_ptr.* = default; } @@ -186,7 +186,7 @@ pub fn readAssets(externalAllocator: NeverFailingAllocator, assetPath: []const u defer addons.deinit(); var addonNames = main.List([]const u8).init(main.stackAllocator); defer addonNames.deinit(); - + { // Find all the sub-directories to the assets folder. var dir = std.fs.cwd().openDir(assetPath, .{.iterate = true}) catch |err| { std.log.err("Can't open asset path {s}: {s}", .{assetPath, @errorName(err)}); diff --git a/src/audio.zig b/src/audio.zig index 00981248..48036538 100644 --- a/src/audio.zig +++ b/src/audio.zig @@ -131,7 +131,7 @@ const MusicLoadTask = struct { .clean = @ptrCast(&clean), .taskType = .misc, }; - + pub fn schedule(musicId: []const u8) void { const task = main.globalAllocator.create(MusicLoadTask); task.* = MusicLoadTask { @@ -331,5 +331,3 @@ fn patestCallback( addMusic(buffer); return 0; } - - diff --git a/src/blocks.zig b/src/blocks.zig index 92610c70..b4700e5a 100644 --- a/src/blocks.zig +++ b/src/blocks.zig @@ -222,7 +222,7 @@ pub fn parseBlock(data: []const u8) Block { blockData = std.fmt.parseInt(u16, data[pos + 1..], 0) catch |err| blk: { std.log.err("Error while parsing block data of '{s}': {s}", .{data, @errorName(err)}); break :blk null; - }; + }; } if(reverseIndices.get(id)) |resultType| { var result: Block = .{.typ = resultType, .data = 0}; @@ -312,20 +312,20 @@ pub const Block = packed struct { // MARK: Block pub inline fn absorption(self: Block) u32 { return _absorption[self.typ]; } - + /// GUI that is opened on click. pub inline fn gui(self: Block) []u8 { return _gui[self.typ]; } - + pub inline fn mode(self: Block) *RotationMode { return _mode[self.typ]; } - + pub inline fn lodReplacement(self: Block) u16 { return _lodReplacement[self.typ]; } - + pub inline fn opaqueVariant(self: Block) u16 { return _opaqueVariant[self.typ]; } @@ -676,7 +676,7 @@ pub const meshes = struct { // MARK: meshes } animationSSBO = SSBO.initStatic(AnimationData, animation.items); animationSSBO.?.bind(0); - + animatedTextureSSBO = SSBO.initStaticSize(u32, animation.items.len); animatedTextureSSBO.?.bind(1); fogSSBO = SSBO.initStatic(FogData, textureFogData.items); diff --git a/src/chunk.zig b/src/chunk.zig index 9f8cfe73..1fef76cb 100644 --- a/src/chunk.zig +++ b/src/chunk.zig @@ -148,7 +148,7 @@ pub const ChunkPosition = struct { // MARK: ChunkPosition wy: i32, wz: i32, voxelSize: u31, - + pub fn hashCode(self: ChunkPosition) u32 { const shift: u5 = @truncate(@min(@ctz(self.wx), @ctz(self.wy), @ctz(self.wz))); return (((@as(u32, @bitCast(self.wx)) >> shift) *% 31 +% (@as(u32, @bitCast(self.wy)) >> shift)) *% 31 +% (@as(u32, @bitCast(self.wz)) >> shift)) *% 31 +% self.voxelSize; // TODO: Can I use one of zigs standard hash functions? @@ -447,7 +447,7 @@ pub const ServerChunk = struct { // MARK: ServerChunk self.mutex.lock(); defer self.mutex.unlock(); main.utils.assertLocked(&other.mutex); - + var x: u31 = 0; while(x < chunkSize/2): (x += 1) { var y: u31 = 0; @@ -472,7 +472,7 @@ pub const ServerChunk = struct { // MARK: ServerChunk neighborCount[i] = 0; continue; // I don't care about air blocks. } - + var count: u31 = 0; for(Neighbor.iterable) |n| { const nx = x*2 + dx + n.relX(); @@ -562,4 +562,4 @@ pub const ServerChunk = struct { // MARK: ServerChunk } } } -}; \ No newline at end of file +}; diff --git a/src/entity.zig b/src/entity.zig index 8154ed8f..cfacf1fe 100644 --- a/src/entity.zig +++ b/src/entity.zig @@ -23,7 +23,7 @@ pub const ClientEntity = struct { width: f64, height: f64, - + pos: Vec3d = undefined, rot: Vec3f = undefined, @@ -94,7 +94,7 @@ pub const ClientEntityManager = struct { pub fn init() void { entities = .init(); shader = graphics.Shader.initAndGetUniforms("assets/cubyz/shaders/entity_vertex.vs", "assets/cubyz/shaders/entity_fragment.fs", "", &uniforms); - + modelTexture = main.graphics.Texture.initFromFile("assets/cubyz/entity/textures/snail_player.png"); const modelFile = main.files.read(main.stackAllocator, "assets/cubyz/entity/models/snail_player.obj") catch |err| blk: { std.log.err("Error while reading player model: {s}", .{@errorName(err)}); @@ -150,7 +150,7 @@ pub const ClientEntityManager = struct { if(projectedPos[2] < 0) continue; const xCenter = (1 + projectedPos[0]/projectedPos[3])*@as(f32, @floatFromInt(main.Window.width/2)); const yCenter = (1 - projectedPos[1]/projectedPos[3])*@as(f32, @floatFromInt(main.Window.height/2)); - + graphics.draw.setColor(0xff000000); var buf = graphics.TextBuffer.init(main.stackAllocator, ent.name, .{.color = 0}, false, .center); defer buf.deinit(); @@ -251,4 +251,4 @@ pub const ClientEntityManager = struct { } } } -}; \ No newline at end of file +}; diff --git a/src/files.zig b/src/files.zig index c93577c6..e6b4f5b3 100644 --- a/src/files.zig +++ b/src/files.zig @@ -137,4 +137,4 @@ pub const Dir = struct { file.close(); return true; } -}; \ No newline at end of file +}; diff --git a/src/formatter/format.zig b/src/formatter/format.zig index 0fecc2a0..26ad6204 100644 --- a/src/formatter/format.zig +++ b/src/formatter/format.zig @@ -8,7 +8,7 @@ var failed: bool = false; fn printError(msg: []const u8, filePath: []const u8, data: []const u8, charIndex: usize) void { var lineStart: usize = 0; var lineNumber: usize = 1; - var lineEnd: usize = 0; + var lineEnd: usize = data.len; for(data[0..charIndex], 0..) |c, i| { if(c == '\n') { lineStart = i + 1; @@ -47,6 +47,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void { switch(c) { '\n' => { lineStart = true; + if(i != 0 and (data[i - 1] == ' ' or data[i - 1] == '\t')) { + printError("Line contains trailing whitespaces. Please remove them.", filePath, data, i - 1); + } }, '\r' => { printError("Incorrect line ending \\r. Please configure your editor to use LF instead CRLF.", filePath, data, i); @@ -62,6 +65,9 @@ fn checkFile(dir: std.fs.Dir, filePath: []const u8) !void { } } } + if(data.len != 0 and data[data.len - 1] != '\n' or (data.len > 2 and data[data.len - 2] == '\n')) { + printError("File should end with a single empty line", filePath, data, data.len - 1); + } } fn checkDirectory(dir: std.fs.Dir) !void { diff --git a/src/game.zig b/src/game.zig index 166e21f4..31679578 100644 --- a/src/game.zig +++ b/src/game.zig @@ -316,7 +316,7 @@ pub const collision = struct { const min = std.math.clamp(vec.xy(blockBox.min), vec.xy(boundingBox.min), vec.xy(boundingBox.max)); const area = (max[0] - min[0]) * (max[1] - min[1]); - + if (block.collide()) { totalArea += area; friction += area * @as(f64, @floatCast(block.friction())); @@ -324,7 +324,7 @@ pub const collision = struct { } } } - + if (totalArea == 0) { return defaultFriction; } @@ -385,7 +385,7 @@ pub const DamageType = enum(u8) { heal = 0, // For when you are adding health kill = 1, fall = 2, - + pub fn sendMessage(self: DamageType, name: []const u8) void { switch (self) { .heal => main.server.sendMessage("{s}§#ffffff was healed", .{name}), @@ -519,7 +519,7 @@ pub const Player = struct { // MARK: Player Player.super.vel = .{0, 0, 0}; Player.super.health = Player.super.maxHealth; - + Player.eyeVel = .{0, 0, 0}; Player.eyeCoyote = 0; Player.eyeStep = .{false, false, false}; @@ -784,7 +784,7 @@ pub fn update(deltaTime: f64) void { // MARK: update() const right = Vec3d{-forward[1], forward[0], 0}; var movementDir: Vec3d = .{0, 0, 0}; var movementSpeed: f64 = 0; - + if(main.Window.grabbed) { const walkingSpeed: f64 = if (Player.crouching) 2 else 4; if(KeyBoard.key("forward").value > 0.0) { @@ -886,11 +886,11 @@ pub fn update(deltaTime: f64) void { // MARK: update() const smoothPerc = Player.crouchPerc * Player.crouchPerc * (3 - 2 * Player.crouchPerc); const newOuterBox = (Player.crouchingBoundingBoxExtent - Player.standingBoundingBoxExtent) * @as(Vec3d, @splat(smoothPerc)) + Player.standingBoundingBoxExtent; - + Player.super.pos += newOuterBox - Player.outerBoundingBoxExtent; - + Player.outerBoundingBoxExtent = newOuterBox; - + Player.outerBoundingBox = .{ .min = -Player.outerBoundingBoxExtent, .max = Player.outerBoundingBoxExtent, @@ -1035,7 +1035,7 @@ pub fn update(deltaTime: f64) void { // MARK: update() steppingHeight = @min(steppingHeight, Player.eyePos[2] - Player.eyeBox.min[2]); const slipLimit = 0.25 * Player.currentFriction; - + const xMovement = collision.collideOrStep(.client, .x, move[0], Player.super.pos, hitBox, steppingHeight); Player.super.pos += xMovement; if (KeyBoard.key("crouch").pressed and Player.onGround and @abs(Player.super.vel[0]) < slipLimit) { diff --git a/src/graphics.zig b/src/graphics.zig index 620589c8..a72ccff4 100644 --- a/src/graphics.zig +++ b/src/graphics.zig @@ -287,7 +287,7 @@ pub const draw = struct { // MARK: draw c.glBindVertexArray(lineVAO); c.glDrawArrays(c.GL_LINE_STRIP, 0, 2); } - + // ---------------------------------------------------------------------------- // MARK: drawRect() // Draw rect can use the same shader as drawline, because it essentially draws lines. @@ -333,7 +333,7 @@ pub const draw = struct { // MARK: draw c.glBindVertexArray(lineVAO); c.glDrawArrays(c.GL_LINE_LOOP, 0, 5); } - + // ---------------------------------------------------------------------------- // MARK: fillCircle() var circleUniforms: struct { @@ -386,7 +386,7 @@ pub const draw = struct { // MARK: draw c.glBindVertexArray(circleVAO); c.glDrawArrays(c.GL_TRIANGLE_STRIP, 0, 4); } - + // ---------------------------------------------------------------------------- // MARK: drawImage() // Luckily the vao of the regular rect can used. @@ -1185,7 +1185,7 @@ pub fn deinit() void { pub const Shader = struct { // MARK: Shader id: c_uint, - + fn addShader(self: *const Shader, filename: []const u8, defines: []const u8, shader_stage: c_uint) !void { const source = main.files.read(main.stackAllocator, filename) catch |err| { std.log.err("Couldn't read shader file: {s}", .{filename}); @@ -1198,10 +1198,10 @@ pub const Shader = struct { // MARK: Shader const versionLineEnd = if(std.mem.indexOfScalar(u8, source, '\n')) |len| len + 1 else 0; const versionLine = source[0..versionLineEnd]; const sourceLines = source[versionLineEnd..]; - + const sourceLen: [3]c_int = .{@intCast(versionLine.len), @intCast(defines.len), @intCast(sourceLines.len)}; c.glShaderSource(shader, 3, &[3][*c]const u8{versionLine.ptr, defines.ptr, sourceLines.ptr}, &sourceLen); - + c.glCompileShader(shader); var success: c_int = undefined; @@ -1232,7 +1232,7 @@ pub const Shader = struct { // MARK: Shader return error.FailedLinking; } } - + pub fn init(vertex: []const u8, fragment: []const u8, defines: []const u8) Shader { const shader = Shader{.id = c.glCreateProgram()}; shader.addShader(vertex, defines, c.GL_VERTEX_SHADER) catch return shader; @@ -1240,7 +1240,7 @@ pub const Shader = struct { // MARK: Shader shader.link() catch return shader; return shader; } - + pub fn initAndGetUniforms(vertex: []const u8, fragment: []const u8, defines: []const u8, ptrToUniformStruct: anytype) Shader { const self = Shader.init(vertex, fragment, defines); inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).@"struct".fields) |field| { @@ -1662,7 +1662,7 @@ pub const TextureArray = struct { // MARK: TextureArray for(lodBuffer, 0..) |*buffer, i| { buffer.* = arena.allocator().alloc(Color, (maxWidth >> @intCast(i))*(maxHeight >> @intCast(i))); } - + for(images, 0..) |image, i| { // Fill the buffer using nearest sampling. Probably not the best solutions for all textures, but that's what happens when someone doesn't use power of 2 textures... for(0..maxWidth) |x| { @@ -2123,4 +2123,4 @@ pub fn generateBlockTexture(blockType: u16) Texture { c.glViewport(0, 0, main.Window.width, main.Window.height); c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA); return texture; -} \ No newline at end of file +} diff --git a/src/gui/components/Button.zig b/src/gui/components/Button.zig index 31d57b5a..d19c555c 100644 --- a/src/gui/components/Button.zig +++ b/src/gui/components/Button.zig @@ -164,4 +164,4 @@ pub fn render(self: *Button, mousePosition: Vec2f) void { const textPos = self.pos + self.size/@as(Vec2f, @splat(2.0)) - self.child.size()/@as(Vec2f, @splat(2.0)); self.child.mutPos().* = textPos; self.child.render(mousePosition - self.pos); -} \ No newline at end of file +} diff --git a/src/gui/components/CheckBox.zig b/src/gui/components/CheckBox.zig index b6160f58..b30c3de1 100644 --- a/src/gui/components/CheckBox.zig +++ b/src/gui/components/CheckBox.zig @@ -120,4 +120,4 @@ pub fn render(self: *CheckBox, mousePosition: Vec2f) void { const textPos = self.pos + Vec2f{boxSize/2, 0} + self.size/@as(Vec2f, @splat(2.0)) - self.label.size/@as(Vec2f, @splat(2.0)); self.label.pos = textPos; self.label.render(mousePosition - textPos); -} \ No newline at end of file +} diff --git a/src/gui/components/ContinuousSlider.zig b/src/gui/components/ContinuousSlider.zig index 453f4314..eecbce31 100644 --- a/src/gui/components/ContinuousSlider.zig +++ b/src/gui/components/ContinuousSlider.zig @@ -144,4 +144,4 @@ pub fn render(self: *ContinuousSlider, mousePosition: Vec2f) void { const oldTranslation = draw.setTranslation(self.pos); defer draw.restoreTranslation(oldTranslation); self.button.render(mousePosition - self.pos); -} \ No newline at end of file +} diff --git a/src/gui/components/DiscreteSlider.zig b/src/gui/components/DiscreteSlider.zig index 6701424e..08f92ca4 100644 --- a/src/gui/components/DiscreteSlider.zig +++ b/src/gui/components/DiscreteSlider.zig @@ -157,4 +157,4 @@ pub fn render(self: *DiscreteSlider, mousePosition: Vec2f) void { const oldTranslation = draw.setTranslation(self.pos); defer draw.restoreTranslation(oldTranslation); self.button.render(mousePosition - self.pos); -} \ No newline at end of file +} diff --git a/src/gui/components/HorizontalList.zig b/src/gui/components/HorizontalList.zig index b791b364..45b7b65e 100644 --- a/src/gui/components/HorizontalList.zig +++ b/src/gui/components/HorizontalList.zig @@ -114,4 +114,4 @@ pub fn mainButtonReleased(self: *HorizontalList, mousePosition: Vec2f) void { for(self.children.items) |*child| { child.mainButtonReleased(mousePosition - self.pos); } -} \ No newline at end of file +} diff --git a/src/gui/components/Icon.zig b/src/gui/components/Icon.zig index 0551da43..15f5bb22 100644 --- a/src/gui/components/Icon.zig +++ b/src/gui/components/Icon.zig @@ -51,4 +51,4 @@ pub fn render(self: *Icon, _: Vec2f) void { } draw.setColor(0xffffffff); self.texture.render(self.pos, self.size); -} \ No newline at end of file +} diff --git a/src/gui/components/ItemSlot.zig b/src/gui/components/ItemSlot.zig index 2eae836e..273f3e1a 100644 --- a/src/gui/components/ItemSlot.zig +++ b/src/gui/components/ItemSlot.zig @@ -153,4 +153,4 @@ pub fn render(self: *ItemSlot, _: Vec2f) void { draw.rect(self.pos, self.size); } } -} \ No newline at end of file +} diff --git a/src/gui/components/Label.zig b/src/gui/components/Label.zig index 16a6430a..d0fe74fd 100644 --- a/src/gui/components/Label.zig +++ b/src/gui/components/Label.zig @@ -51,4 +51,4 @@ pub fn updateText(self: *Label, newText: []const u8) void { pub fn render(self: *Label, _: Vec2f) void { draw.setColor(@as(u32, @intFromFloat(self.alpha*255)) << 24); self.text.render(self.pos[0], self.pos[1], fontSize); -} \ No newline at end of file +} diff --git a/src/gui/components/MutexComponent.zig b/src/gui/components/MutexComponent.zig index 75c1ba55..7222a34f 100644 --- a/src/gui/components/MutexComponent.zig +++ b/src/gui/components/MutexComponent.zig @@ -75,4 +75,4 @@ pub fn mainButtonReleased(self: *MutexComponent, mousePosition: Vec2f) void { self.mutex.lock(); defer self.mutex.unlock(); self.child.mainButtonReleased(mousePosition); -} \ No newline at end of file +} diff --git a/src/gui/components/ScrollBar.zig b/src/gui/components/ScrollBar.zig index 78a464b8..6daba139 100644 --- a/src/gui/components/ScrollBar.zig +++ b/src/gui/components/ScrollBar.zig @@ -111,4 +111,4 @@ pub fn render(self: *ScrollBar, mousePosition: Vec2f) void { const oldTranslation = draw.setTranslation(self.pos); defer draw.restoreTranslation(oldTranslation); self.button.render(mousePosition - self.pos); -} \ No newline at end of file +} diff --git a/src/gui/components/TextInput.zig b/src/gui/components/TextInput.zig index fb6d7eef..9a277f85 100644 --- a/src/gui/components/TextInput.zig +++ b/src/gui/components/TextInput.zig @@ -491,4 +491,4 @@ pub fn render(self: *TextInput, mousePosition: Vec2f) void { draw.setColor(0xff000000); draw.line(cursorPos, cursorPos + Vec2f{0, 16}); } -} \ No newline at end of file +} diff --git a/src/gui/gui_component.zig b/src/gui/gui_component.zig index fc738d34..7dbbf61b 100644 --- a/src/gui/gui_component.zig +++ b/src/gui/gui_component.zig @@ -128,4 +128,4 @@ pub const GuiComponent = union(enum) { pub fn contains(_pos: Vec2f, _size: Vec2f, point: Vec2f) bool { return @reduce(.And, point >= _pos) and @reduce(.And, point < _pos + _size); } -}; \ No newline at end of file +}; diff --git a/src/gui/windows/creative_inventory.zig b/src/gui/windows/creative_inventory.zig index 9f7b8ab4..604d1d0e 100644 --- a/src/gui/windows/creative_inventory.zig +++ b/src/gui/windows/creative_inventory.zig @@ -74,4 +74,4 @@ pub fn onClose() void { } items.deinit(); inventory.deinit(main.globalAllocator); -} \ No newline at end of file +} diff --git a/src/gui/windows/crosshair.zig b/src/gui/windows/crosshair.zig index d8151003..b83569f5 100644 --- a/src/gui/windows/crosshair.zig +++ b/src/gui/windows/crosshair.zig @@ -34,4 +34,4 @@ pub fn render() void { texture.bindTo(0); graphics.draw.setColor(0xffffffff); graphics.draw.boundImage(.{0, 0}, .{size, size}); -} \ No newline at end of file +} diff --git a/src/gui/windows/debug_network.zig b/src/gui/windows/debug_network.zig index 3b812546..b0f128de 100644 --- a/src/gui/windows/debug_network.zig +++ b/src/gui/windows/debug_network.zig @@ -50,4 +50,4 @@ pub fn render() void { window.size[1] = y; window.updateWindowPosition(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/debug_network_advanced.zig b/src/gui/windows/debug_network_advanced.zig index 4fe8486d..8b4ce392 100644 --- a/src/gui/windows/debug_network_advanced.zig +++ b/src/gui/windows/debug_network_advanced.zig @@ -67,4 +67,4 @@ pub fn render() void { window.size[1] = y; window.updateWindowPosition(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/delete_world_confirmation.zig b/src/gui/windows/delete_world_confirmation.zig index e398c246..9e89a254 100644 --- a/src/gui/windows/delete_world_confirmation.zig +++ b/src/gui/windows/delete_world_confirmation.zig @@ -55,4 +55,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/gpu_performance_measuring.zig b/src/gui/windows/gpu_performance_measuring.zig index 1860b565..40b2c41d 100644 --- a/src/gui/windows/gpu_performance_measuring.zig +++ b/src/gui/windows/gpu_performance_measuring.zig @@ -106,4 +106,4 @@ pub fn render() void { y += 8; } draw.print("Total: {} µs", .{@divTrunc(sum, 1000)}, 0, 0, 8, .left); -} \ No newline at end of file +} diff --git a/src/gui/windows/inventory_crafting.zig b/src/gui/windows/inventory_crafting.zig index a8633bd4..9ba82a4d 100644 --- a/src/gui/windows/inventory_crafting.zig +++ b/src/gui/windows/inventory_crafting.zig @@ -159,4 +159,4 @@ pub fn onClose() void { pub fn update() void { refresh(); -} \ No newline at end of file +} diff --git a/src/gui/windows/invite.zig b/src/gui/windows/invite.zig index 7fc21781..d21d865f 100644 --- a/src/gui/windows/invite.zig +++ b/src/gui/windows/invite.zig @@ -102,4 +102,4 @@ pub fn update() void { gotIpAddress.store(false, .monotonic); ipAddressLabel.updateText(ipAddress); } -} \ No newline at end of file +} diff --git a/src/gui/windows/main.zig b/src/gui/windows/main.zig index 4412241e..b3ad7cdd 100644 --- a/src/gui/windows/main.zig +++ b/src/gui/windows/main.zig @@ -35,4 +35,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/multiplayer.zig b/src/gui/windows/multiplayer.zig index d51c9414..72f6601b 100644 --- a/src/gui/windows/multiplayer.zig +++ b/src/gui/windows/multiplayer.zig @@ -132,4 +132,4 @@ pub fn update() void { gotIpAddress.store(false, .monotonic); ipAddressLabel.updateText(ipAddress); } -} \ No newline at end of file +} diff --git a/src/gui/windows/pause.zig b/src/gui/windows/pause.zig index 3a72ef60..b417898b 100644 --- a/src/gui/windows/pause.zig +++ b/src/gui/windows/pause.zig @@ -36,4 +36,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/pause_gear.zig b/src/gui/windows/pause_gear.zig index eb9e2784..003013c3 100644 --- a/src/gui/windows/pause_gear.zig +++ b/src/gui/windows/pause_gear.zig @@ -59,4 +59,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/performance_graph.zig b/src/gui/windows/performance_graph.zig index eaf8e7f6..ad149d5f 100644 --- a/src/gui/windows/performance_graph.zig +++ b/src/gui/windows/performance_graph.zig @@ -79,4 +79,4 @@ pub fn render() void { ssbo.bufferData(f32, &lastFrameTime); ssbo.bind(5); graphics.c.glDrawArrays(graphics.c.GL_LINE_STRIP, 0, lastFrameTime.len); -} \ No newline at end of file +} diff --git a/src/gui/windows/save_creation.zig b/src/gui/windows/save_creation.zig index 4f0a356b..789eefaf 100644 --- a/src/gui/windows/save_creation.zig +++ b/src/gui/windows/save_creation.zig @@ -82,7 +82,7 @@ fn flawedCreateWorld() !void { gamerules.put("default_gamemode", @tagName(gamemode)); gamerules.put("cheats", allowCheats); - + try main.files.writeZon(gamerulePath, gamerules); } { // Make assets subfolder @@ -127,4 +127,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/save_selection.zig b/src/gui/windows/save_selection.zig index 691ee398..8d6083fa 100644 --- a/src/gui/windows/save_selection.zig +++ b/src/gui/windows/save_selection.zig @@ -87,7 +87,7 @@ fn openFolder(namePtr: usize) void { const path = std.fmt.allocPrint(main.stackAllocator.allocator, "saves/{s}", .{name}) catch unreachable; defer main.stackAllocator.free(path); - + main.files.openDirInWindow(path); } @@ -152,7 +152,7 @@ pub fn onOpen() void { defer main.stackAllocator.free(decodedName); const name = buttonNameArena.allocator().dupeZ(u8, entry.name); // Null terminate, so we can later recover the string from just the pointer. const buttonName = std.fmt.allocPrint(buttonNameArena.allocator().allocator, "{s}", .{decodedName}) catch unreachable; - + row.add(Button.initText(.{0, 0}, 128, buttonName, .{.callback = &openWorldWrap, .arg = @intFromPtr(name.ptr)})); row.add(Button.initIcon(.{8, 0}, .{16, 16}, fileExplorerIcon, false, .{.callback = &openFolder, .arg = @intFromPtr(name.ptr)})); row.add(Button.initIcon(.{8, 0}, .{16, 16}, deleteIcon, false, .{.callback = &deleteWorld, .arg = @intFromPtr(name.ptr)})); @@ -161,7 +161,7 @@ pub fn onOpen() void { } } } - + list.finish(.center); window.rootComponent = list.toComponent(); window.contentSize = window.rootComponent.?.pos() + window.rootComponent.?.size() + @as(Vec2f, @splat(padding)); @@ -173,4 +173,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/gui/windows/sound.zig b/src/gui/windows/sound.zig index dd8d5399..f1261c5f 100644 --- a/src/gui/windows/sound.zig +++ b/src/gui/windows/sound.zig @@ -53,4 +53,4 @@ pub fn onClose() void { if(window.rootComponent) |*comp| { comp.deinit(); } -} \ No newline at end of file +} diff --git a/src/itemdrop.zig b/src/itemdrop.zig index a7784b54..4deb27a6 100644 --- a/src/itemdrop.zig +++ b/src/itemdrop.zig @@ -716,4 +716,4 @@ pub const ItemDropRenderer = struct { // MARK: ItemDropRenderer } } } -}; \ No newline at end of file +}; diff --git a/src/items.zig b/src/items.zig index 9e54755e..83db93c8 100644 --- a/src/items.zig +++ b/src/items.zig @@ -157,7 +157,7 @@ const TextureGenerator = struct { // MARK: TextureGenerator 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, }; - + /// Contains the material(s) of a single pixel and tries to avoid multiple materials. const PixelData = struct { maxNeighbors: u8 = 0, @@ -389,7 +389,7 @@ const TextureGenerator = struct { // MARK: TextureGenerator if(hasDifferentItems) { heightMap[x][y] -= 1; } - + // Take into account further neighbors with lower priority: dx = -2; while(dx <= 1) : (dx += 1) { @@ -423,7 +423,7 @@ const TextureGenerator = struct { // MARK: TextureGenerator } } } - + var seed: u64 = tool.seed; random.scrambleSeed(&seed); @@ -999,7 +999,7 @@ pub const Tool = struct { // MARK: Tool } return self.texture.?; } - + fn getTooltip(self: *Tool) []const u8 { self.tooltip.clearRetainingCapacity(); self.tooltip.writer().print( @@ -1054,9 +1054,7 @@ pub const Item = union(enum) { // MARK: Item pub fn deinit(self: Item) void { switch(self) { - .baseItem => { - - }, + .baseItem => {}, .tool => |_tool| { _tool.deinit(); }, diff --git a/src/json.zig b/src/json.zig index 5cfbf5f9..4c9d55aa 100644 --- a/src/json.zig +++ b/src/json.zig @@ -774,4 +774,4 @@ test "element parsing" { try std.testing.expectEqual(JsonElement{.JsonInt=1}, result.JsonArray.items[1]); try std.testing.expectEqual(JsonElement{.JsonFloat=17.1}, result.JsonArray.items[2]); result.free(allocator); -} \ No newline at end of file +} diff --git a/src/models.zig b/src/models.zig index e7f350f2..157ae23e 100644 --- a/src/models.zig +++ b/src/models.zig @@ -164,12 +164,12 @@ pub const Model = struct { return modelIndex; } - + fn addVert(vert: Vec3f, vertList: *main.List(Vec3f)) usize { const ind = for (vertList.*.items, 0..) |vertex, index| { if (std.meta.eql(vertex, vert)) break index; } else vertList.*.items.len; - + if (ind == vertList.*.items.len) { vertList.*.append(vert); } @@ -188,7 +188,7 @@ pub const Model = struct { } minUv = @floor(minUv); quad.textureSlot = @as(u32, @intFromFloat(minUv[1])) * 4 + @as(u32, @intFromFloat(minUv[0])); - + if (minUv[0] < 0 or minUv[0] > 4 or minUv[1] < 0 or minUv[1] > 4) { std.log.err("Uv value for model is outside of 0-1 range", .{}); } @@ -226,15 +226,15 @@ pub const Model = struct { }) |lineUntrimmed| { if (lineUntrimmed.len < 3) continue; - + var line = lineUntrimmed; if (line[line.len - 1] == '\r') { line = line[0..line.len - 1]; } - + if (line[0] == '#') continue; - + if (std.mem.eql(u8, line[0..2], "v ")) { var coordsIter = std.mem.splitScalar(u8, line[2..], ' '); var coords: Vec3f = undefined; @@ -303,7 +303,7 @@ pub const Model = struct { for (tris.items) |face| { const normal: Vec3f = normals.items[face.normal]; - + const uvA: Vec2f = uvs.items[face.uvs[0]]; const uvB: Vec2f = uvs.items[face.uvs[2]]; const uvC: Vec2f = uvs.items[face.uvs[1]]; @@ -332,7 +332,7 @@ pub const Model = struct { const cornerB: Vec3f = vertices.items[face.vertex[0]]; const cornerC: Vec3f = vertices.items[face.vertex[2]]; const cornerD: Vec3f = vertices.items[face.vertex[3]]; - + quadInfos.append(.{ .normal = normal, .corners = .{cornerA, cornerB, cornerC, cornerD}, @@ -556,4 +556,4 @@ pub fn deinit() void { quads.deinit(); extraQuadInfos.deinit(); quadDeduplication.deinit(); -} \ No newline at end of file +} diff --git a/src/network.zig b/src/network.zig index 3ae33aa1..9597a952 100644 --- a/src/network.zig +++ b/src/network.zig @@ -507,7 +507,7 @@ pub const ConnectionManager = struct { // MARK: ConnectionManager pub fn removeConnection(self: *ConnectionManager, conn: *Connection) void { self.mutex.lock(); defer self.mutex.unlock(); - + for(self.connections.items, 0..) |other, i| { if(other == conn) { _ = self.connections.swapRemove(i); @@ -519,7 +519,7 @@ pub const ConnectionManager = struct { // MARK: ConnectionManager fn onReceive(self: *ConnectionManager, data: []const u8, source: Address) void { std.debug.assert(self.threadId == std.Thread.getCurrentId()); self.mutex.lock(); - + for(self.connections.items) |conn| { if(conn.remoteAddress.ip == source.ip) { if(conn.bruteforcingPort) { @@ -670,7 +670,7 @@ pub const Protocols = struct { zonObject.put("spawn", main.server.world.?.spawn); zonObject.put("blockPalette", main.server.world.?.blockPalette.save(main.stackAllocator)); zonObject.put("biomePalette", main.server.world.?.biomePalette.save(main.stackAllocator)); - + const outData = zonObject.toStringEfficient(main.stackAllocator, &[1]u8{stepServerData}); defer main.stackAllocator.free(outData); conn.sendImportant(id, outData); @@ -1758,7 +1758,7 @@ const ProtocolTask = struct { .clean = @ptrCast(&clean), .taskType = .misc, }; - + pub fn schedule(conn: *Connection, protocol: u8, data: []const u8) void { const task = main.globalAllocator.create(ProtocolTask); task.* = ProtocolTask { diff --git a/src/random.zig b/src/random.zig index 26561c53..38199e19 100644 --- a/src/random.zig +++ b/src/random.zig @@ -117,4 +117,4 @@ pub fn initSeed2D(worldSeed: u64, pos: Vec2i) u64 { const fac = Vec2i {11248723, 105436839}; const seed = @reduce(.Xor, fac *% pos); return @as(u32, @bitCast(seed)) ^ worldSeed; -} \ No newline at end of file +} diff --git a/src/renderer.zig b/src/renderer.zig index ce9e9605..700cc517 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -185,7 +185,7 @@ pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPo gpu_performance_measuring.startQuery(.animation); blocks.meshes.preProcessAnimationData(time); gpu_performance_measuring.stopQuery(); - + // Update the uniforms. The uniforms are needed to render the replacement meshes. chunk_meshing.bindShaderAndUniforms(game.projectionMatrix, ambientLight, playerPos); @@ -256,7 +256,7 @@ pub fn renderWorld(world: *World, ambientLight: Vec3f, skyColor: Vec3f, playerPo worldFrameBuffer.bindTexture(c.GL_TEXTURE3); const playerBlock = mesh_storage.getBlockFromAnyLod(@intFromFloat(@floor(playerPos[0])), @intFromFloat(@floor(playerPos[1])), @intFromFloat(@floor(playerPos[2]))); - + if(settings.bloom) { Bloom.render(lastWidth, lastHeight, playerBlock, playerPos, game.camera.viewMatrix); } else { @@ -555,7 +555,7 @@ pub const MenuBackGround = struct { updateViewport(size, size, 90.0); main.settings.resolutionScale = oldResolutionScale; defer updateViewport(Window.width, Window.height, settings.fov); - + var buffer: graphics.FrameBuffer = undefined; buffer.init(true, c.GL_NEAREST, c.GL_REPEAT); defer buffer.deinit(); diff --git a/src/renderer/mesh_storage.zig b/src/renderer/mesh_storage.zig index 93ea9e1b..5161d1fe 100644 --- a/src/renderer/mesh_storage.zig +++ b/src/renderer/mesh_storage.zig @@ -346,7 +346,7 @@ fn freeOldMeshes(olderPx: i32, olderPy: i32, olderPz: i32, olderRD: u16) void { for(zValues[0..zValuesLen]) |z| { const zIndex = @divExact(z, size) & storageMask; const index = (xIndex*storageSize + yIndex)*storageSize + zIndex; - + const node = &storageLists[_lod][@intCast(index)]; node.mutex.lock(); const oldMesh = node.mesh; @@ -412,7 +412,7 @@ fn freeOldMeshes(olderPx: i32, olderPy: i32, olderPz: i32, olderRD: u16) void { for(yValues[0..yValuesLen]) |y| { const yIndex = @divExact(y, size) & storageMask; const index = xIndex*storageSize + yIndex; - + const mapPointer = &mapStorageLists[_lod][@intCast(index)]; mutex.lock(); const oldMap = mapPointer.*; diff --git a/src/rotation.zig b/src/rotation.zig index ea802917..eda74fe7 100644 --- a/src/rotation.zig +++ b/src/rotation.zig @@ -1003,4 +1003,4 @@ pub fn register(comptime Mode: type) void { } } rotationModes.putNoClobber(Mode.id, result) catch unreachable; -} \ No newline at end of file +} diff --git a/src/server/command/_command.zig b/src/server/command/_command.zig index 7c32b208..0f8c10b7 100644 --- a/src/server/command/_command.zig +++ b/src/server/command/_command.zig @@ -38,4 +38,4 @@ pub fn execute(msg: []const u8, source: *User) void { } else { source.sendMessage("#ff0000Unrecognized Command \"{s}\"", .{command}); } -} \ No newline at end of file +} diff --git a/src/server/command/_list.zig b/src/server/command/_list.zig index 1a5770bc..5f92b631 100644 --- a/src/server/command/_list.zig +++ b/src/server/command/_list.zig @@ -6,4 +6,4 @@ pub const help = @import("help.zig"); pub const invite = @import("invite.zig"); pub const kill = @import("kill.zig"); pub const time = @import("time.zig"); -pub const tp = @import("tp.zig"); \ No newline at end of file +pub const tp = @import("tp.zig"); diff --git a/src/server/command/gamemode.zig b/src/server/command/gamemode.zig index e5adc3e3..5cb7611f 100644 --- a/src/server/command/gamemode.zig +++ b/src/server/command/gamemode.zig @@ -19,4 +19,4 @@ pub fn execute(args: []const u8, source: *User) void { source.sendMessage("#ff0000Invalid argument for command /gamemode. Must be 'survival' or 'creative'.", .{}); return; } -} \ No newline at end of file +} diff --git a/src/server/command/help.zig b/src/server/command/help.zig index fefe6e59..114a6d02 100644 --- a/src/server/command/help.zig +++ b/src/server/command/help.zig @@ -41,4 +41,4 @@ pub fn execute(args: []const u8, source: *User) void { } if(msg.items[msg.items.len - 1] == '\n') _ = msg.pop(); source.sendMessage("{s}", .{msg.items}); -} \ No newline at end of file +} diff --git a/src/server/command/invite.zig b/src/server/command/invite.zig index 15569467..85b53075 100644 --- a/src/server/command/invite.zig +++ b/src/server/command/invite.zig @@ -22,4 +22,4 @@ pub fn execute(args: []const u8, source: *User) void { return; } source.sendMessage("#ff0000Too few arguments for command /invite", .{}); -} \ No newline at end of file +} diff --git a/src/server/command/kill.zig b/src/server/command/kill.zig index 48dacfa8..083ad608 100644 --- a/src/server/command/kill.zig +++ b/src/server/command/kill.zig @@ -12,4 +12,4 @@ pub fn execute(args: []const u8, source: *User) void { return; } main.items.Inventory.Sync.addHealth(-std.math.floatMax(f32), .kill, .server, source.id); -} \ No newline at end of file +} diff --git a/src/server/command/time.zig b/src/server/command/time.zig index 73242975..a3e33f45 100644 --- a/src/server/command/time.zig +++ b/src/server/command/time.zig @@ -35,4 +35,4 @@ pub fn execute(args: []const u8, source: *User) void { return; } source.sendMessage("#ffff00{}", .{main.server.world.?.gameTime}); -} \ No newline at end of file +} diff --git a/src/server/command/tp.zig b/src/server/command/tp.zig index b5adac8e..19da3a39 100644 --- a/src/server/command/tp.zig +++ b/src/server/command/tp.zig @@ -95,4 +95,4 @@ pub fn execute(args: []const u8, source: *User) void { y = std.math.clamp(y.?, -1e9, 1e9); z = std.math.clamp(z.?, -1e9, 1e9); main.network.Protocols.genericUpdate.sendTPCoordinates(source.conn, .{x.?, y.?, z.?}); -} \ No newline at end of file +} diff --git a/src/server/server.zig b/src/server/server.zig index dfb3c3c2..ec89c2ec 100644 --- a/src/server/server.zig +++ b/src/server/server.zig @@ -70,7 +70,7 @@ pub const User = struct { // MARK: User pub fn deinit(self: *User) void { std.debug.assert(self.refCount.load(.monotonic) == 0); - + world.?.savePlayer(self) catch |err| { std.log.err("Failed to save player: {s}", .{@errorName(err)}); return; @@ -503,4 +503,4 @@ pub fn sendMessage(comptime fmt: []const u8, args: anytype) void { const msg = std.fmt.allocPrint(main.stackAllocator.allocator, fmt, args) catch unreachable; defer main.stackAllocator.free(msg); sendRawMessage(msg); -} \ No newline at end of file +} diff --git a/src/server/storage.zig b/src/server/storage.zig index 5683e819..c5c9ee0e 100644 --- a/src/server/storage.zig +++ b/src/server/storage.zig @@ -367,4 +367,4 @@ pub const ChunkCompression = struct { // MARK: ChunkCompression }, } } -}; \ No newline at end of file +}; diff --git a/src/server/terrain/CaveBiomeMap.zig b/src/server/terrain/CaveBiomeMap.zig index eb50bf45..e40afb4a 100644 --- a/src/server/terrain/CaveBiomeMap.zig +++ b/src/server/terrain/CaveBiomeMap.zig @@ -406,7 +406,7 @@ pub const InterpolatableCaveBiomeMapView = struct { // MARK: InterpolatableCaveB fn getGridPointFromPrerotated(rotatedPos: Vec3i, map: *u1) Vec3i { var gridPoint = rotatedPos +% @as(Vec3i, @splat(CaveBiomeMapFragment.caveBiomeSize/2)) & @as(Vec3i, @splat(~@as(i32, CaveBiomeMapFragment.caveBiomeMask))); - + const distance = rotatedPos -% gridPoint; const totalDistance = @reduce(.Add, @abs(distance)); if(totalDistance > CaveBiomeMapFragment.caveBiomeSize*3/4) { @@ -612,4 +612,4 @@ fn getOrGenerateFragmentAndIncreaseRefCount(_wx: i32, _wy: i32, _wz: i32) *CaveB }; const result = cache.findOrCreate(compare, cacheInit, CaveBiomeMapFragment.increaseRefCount); return result; -} \ No newline at end of file +} diff --git a/src/server/terrain/CaveMap.zig b/src/server/terrain/CaveMap.zig index 7824af06..eadc1531 100644 --- a/src/server/terrain/CaveMap.zig +++ b/src/server/terrain/CaveMap.zig @@ -342,4 +342,4 @@ fn getOrGenerateFragmentAndIncreaseRefCount(wx: i32, wy: i32, wz: i32, voxelSize }; const result = cache.findOrCreate(compare, cacheInit, CaveMapFragment.increaseRefCount); return result; -} \ No newline at end of file +} diff --git a/src/server/terrain/ClimateMap.zig b/src/server/terrain/ClimateMap.zig index 43058526..2706db55 100644 --- a/src/server/terrain/ClimateMap.zig +++ b/src/server/terrain/ClimateMap.zig @@ -47,7 +47,7 @@ pub const ClimateMapFragment = struct { pos: ClimateMapFragmentPosition, map: [mapEntrysSize][mapEntrysSize]BiomeSample = undefined, - + refCount: Atomic(u16) = .init(0), pub fn init(self: *ClimateMapFragment, wx: i32, wy: i32) void { @@ -171,4 +171,4 @@ pub fn getBiomeMap(allocator: NeverFailingAllocator, wx: i32, wy: i32, width: u3 } } return map; -} \ No newline at end of file +} diff --git a/src/server/terrain/LightMap.zig b/src/server/terrain/LightMap.zig index 5eecb57b..1a26c5d4 100644 --- a/src/server/terrain/LightMap.zig +++ b/src/server/terrain/LightMap.zig @@ -19,7 +19,7 @@ pub const LightMapFragment = struct { startHeight: [mapSize*mapSize]i16 = undefined, pos: MapFragmentPosition, - + refCount: Atomic(u16) = .init(0), pub fn init(self: *LightMapFragment, wx: i32, wy: i32, voxelSize: u31) void { @@ -82,4 +82,4 @@ pub fn getOrGenerateFragmentAndIncreaseRefCount(wx: i32, wy: i32, voxelSize: u31 ); const result = cache.findOrCreate(compare, cacheInit, LightMapFragment.increaseRefCount); return result; -} \ No newline at end of file +} diff --git a/src/server/terrain/StructureMap.zig b/src/server/terrain/StructureMap.zig index f25003c4..641837bb 100644 --- a/src/server/terrain/StructureMap.zig +++ b/src/server/terrain/StructureMap.zig @@ -217,4 +217,4 @@ pub fn getOrGenerateFragmentAndIncreaseRefCount(wx: i32, wy: i32, wz: i32, voxel }; const result = cache.findOrCreate(compare, cacheInit, StructureMapFragment.increaseRefCount); return result; -} \ No newline at end of file +} diff --git a/src/server/terrain/SurfaceMap.zig b/src/server/terrain/SurfaceMap.zig index 77748c80..cf943b7f 100644 --- a/src/server/terrain/SurfaceMap.zig +++ b/src/server/terrain/SurfaceMap.zig @@ -71,7 +71,7 @@ pub const MapFragment = struct { // MARK: MapFragment pos: MapFragmentPosition, wasStored: Atomic(bool) = .init(false), - + refCount: Atomic(u16) = .init(0), pub fn init(self: *MapFragment, wx: i32, wy: i32, voxelSize: u31) void { @@ -104,7 +104,7 @@ pub const MapFragment = struct { // MARK: MapFragment const yIndex = wy>>self.pos.voxelSizeShift & mapMask; return self.heightMap[@intCast(xIndex)][@intCast(yIndex)]; } - + const StorageHeader = struct { const minSupportedVersion: u8 = 0; const activeVersion: u8 = 1; @@ -189,7 +189,7 @@ pub const MapFragment = struct { // MARK: MapFragment } const compressedData = main.utils.Compression.deflate(main.stackAllocator, rawData, .fast); defer main.stackAllocator.free(compressedData); - + const fullData = main.stackAllocator.alloc(u8, compressedData.len + @sizeOf(StorageHeader)); defer main.stackAllocator.free(fullData); const header: StorageHeader = .{ diff --git a/src/server/terrain/biomes.zig b/src/server/terrain/biomes.zig index 7b5ecd5f..fdd4c64b 100644 --- a/src/server/terrain/biomes.zig +++ b/src/server/terrain/biomes.zig @@ -93,7 +93,7 @@ const Stripe = struct { // MARK: Stripe } const block: main.blocks.Block = blocks.parseBlock(parameters.get([]const u8, "block", "")); - + var minDistance: f64 = 0; var maxDistance: f64 = 0; if (parameters.object.get("distance")) |dist| { @@ -201,7 +201,7 @@ fn u32ToVec3(color: u32) Vec3f { const r = @as(f32, @floatFromInt((color >> 16) & 0xFF)) / 255.0; const g = @as(f32, @floatFromInt((color >> 8) & 0xFF)) / 255.0; const b = @as(f32, @floatFromInt(color & 0xFF)) / 255.0; - + return .{ r, g, b }; } @@ -347,7 +347,7 @@ pub const Biome = struct { // MARK: Biome } self.structure = BlockStructure.init(main.globalAllocator, zon.getChild("ground_structure")); - + const structures = zon.getChild("structures"); var vegetation = main.ListUnmanaged(SimpleStructureModel){}; var totalChance: f32 = 0; @@ -760,4 +760,4 @@ pub fn getBiomeCheckSum(seed: u64) u64 { result ^= biome.getCheckSum(); } return result; -} \ No newline at end of file +} diff --git a/src/server/terrain/cavebiomegen/RandomBiomeDistribution.zig b/src/server/terrain/cavebiomegen/RandomBiomeDistribution.zig index cadd486d..099e6341 100644 --- a/src/server/terrain/cavebiomegen/RandomBiomeDistribution.zig +++ b/src/server/terrain/cavebiomegen/RandomBiomeDistribution.zig @@ -81,4 +81,4 @@ pub fn generate(map: *CaveBiomeMapFragment, worldSeed: u64) void { } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/cavebiomegen/_list.zig b/src/server/terrain/cavebiomegen/_list.zig index cfc23ee1..4868497d 100644 --- a/src/server/terrain/cavebiomegen/_list.zig +++ b/src/server/terrain/cavebiomegen/_list.zig @@ -1,3 +1,3 @@ -pub const RandomBiomeDistribution = @import("RandomBiomeDistribution.zig"); \ No newline at end of file +pub const RandomBiomeDistribution = @import("RandomBiomeDistribution.zig"); diff --git a/src/server/terrain/cavegen/FractalCaveGenerator.zig b/src/server/terrain/cavegen/FractalCaveGenerator.zig index 405350d3..0506329b 100644 --- a/src/server/terrain/cavegen/FractalCaveGenerator.zig +++ b/src/server/terrain/cavegen/FractalCaveGenerator.zig @@ -44,7 +44,7 @@ const maxCaveDensity = 1.0/32.0; pub fn generate(map: *CaveMapFragment, worldSeed: u64) void { if(map.pos.voxelSize > 2) return; - + const biomeMap: InterpolatableCaveBiomeMapView = InterpolatableCaveBiomeMapView.init(main.stackAllocator, map.pos, CaveMapFragment.width*map.pos.voxelSize, CaveMapFragment.width*map.pos.voxelSize + maxCaveHeight*3); defer biomeMap.deinit(); // Generate caves from all nearby chunks: @@ -306,4 +306,4 @@ fn considerCoordinates(wx: i32, wy: i32, wz: i32, map: *CaveMapFragment, biomeMa caveLength*random.nextFloatSigned(seed)/4, }, startRadius, endRadius, @floatFromInt(Vec3i{wx -% map.pos.wx, wy -% map.pos.wy, wz -% map.pos.wz}), initialBranchLength, 0.1, true, true); } -} \ No newline at end of file +} diff --git a/src/server/terrain/cavegen/NoiseCaveGenerator.zig b/src/server/terrain/cavegen/NoiseCaveGenerator.zig index 4eca97ba..d52b8ee1 100644 --- a/src/server/terrain/cavegen/NoiseCaveGenerator.zig +++ b/src/server/terrain/cavegen/NoiseCaveGenerator.zig @@ -119,4 +119,4 @@ pub fn generate(map: *CaveMapFragment, worldSeed: u64) void { } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/cavegen/_list.zig b/src/server/terrain/cavegen/_list.zig index b827cf38..f406ff67 100644 --- a/src/server/terrain/cavegen/_list.zig +++ b/src/server/terrain/cavegen/_list.zig @@ -2,4 +2,4 @@ pub const FractalCaveGenerator = @import("FractalCaveGenerator.zig"); pub const NoiseCaveGenerator = @import("NoiseCaveGenerator.zig"); -pub const SurfaceGenerator = @import("SurfaceGenerator.zig"); \ No newline at end of file +pub const SurfaceGenerator = @import("SurfaceGenerator.zig"); diff --git a/src/server/terrain/chunkgen/OreGenerator.zig b/src/server/terrain/chunkgen/OreGenerator.zig index 99f8f58e..81b1dedb 100644 --- a/src/server/terrain/chunkgen/OreGenerator.zig +++ b/src/server/terrain/chunkgen/OreGenerator.zig @@ -115,4 +115,4 @@ fn considerCoordinates(ore: *const main.blocks.Ore, relX: f32, relY: f32, relZ: } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/chunkgen/StructureGenerator.zig b/src/server/terrain/chunkgen/StructureGenerator.zig index 8bd8f8ce..33753d84 100644 --- a/src/server/terrain/chunkgen/StructureGenerator.zig +++ b/src/server/terrain/chunkgen/StructureGenerator.zig @@ -31,4 +31,4 @@ pub fn generate(_: u64, chunk: *main.chunk.ServerChunk, caveMap: CaveMap.CaveMap const structureMap = terrain.StructureMap.getOrGenerateFragmentAndIncreaseRefCount(chunk.super.pos.wx, chunk.super.pos.wy, chunk.super.pos.wz, chunk.super.pos.voxelSize); defer structureMap.decreaseRefCount(); structureMap.generateStructuresInChunk(chunk, caveMap); -} \ No newline at end of file +} diff --git a/src/server/terrain/chunkgen/_list.zig b/src/server/terrain/chunkgen/_list.zig index a51b8435..a8a86428 100644 --- a/src/server/terrain/chunkgen/_list.zig +++ b/src/server/terrain/chunkgen/_list.zig @@ -3,4 +3,4 @@ pub const CrystalGenerator = @import("CrystalGenerator.zig"); pub const OreGenerator = @import("OreGenerator.zig"); pub const TerrainGenerator = @import("TerrainGenerator.zig"); -pub const StructureGenerator = @import("StructureGenerator.zig"); \ No newline at end of file +pub const StructureGenerator = @import("StructureGenerator.zig"); diff --git a/src/server/terrain/climategen/NoiseBasedVoronoi.zig b/src/server/terrain/climategen/NoiseBasedVoronoi.zig index 6883591d..2d846c6a 100644 --- a/src/server/terrain/climategen/NoiseBasedVoronoi.zig +++ b/src/server/terrain/climategen/NoiseBasedVoronoi.zig @@ -185,7 +185,7 @@ const Chunk = struct { const GenerationStructure = struct { chunks: Array2D(*Chunk) = undefined, // Implemented as slices into the original array! - + pub fn init(allocator: NeverFailingAllocator, wx: i32, wy: i32, width: u31, height: u31, tree: *TreeNode, worldSeed: u64) GenerationStructure { const self: GenerationStructure = .{ .chunks = Array2D(*Chunk).init(allocator, 4 + @divExact(width, chunkSize), 4 + @divExact(height, chunkSize)), @@ -402,4 +402,4 @@ const GenerationStructure = struct { addSubBiomesOf(biomePoint, map, &extraBiomes, map.pos.wx, map.pos.wy, width, height, worldSeed); } } -}; \ No newline at end of file +}; diff --git a/src/server/terrain/climategen/_list.zig b/src/server/terrain/climategen/_list.zig index 79a07e13..62db6268 100644 --- a/src/server/terrain/climategen/_list.zig +++ b/src/server/terrain/climategen/_list.zig @@ -1,3 +1,3 @@ -pub const NoiseBasedVoronoi = @import("NoiseBasedVoronoi.zig"); \ No newline at end of file +pub const NoiseBasedVoronoi = @import("NoiseBasedVoronoi.zig"); diff --git a/src/server/terrain/mapgen/MapGenV1.zig b/src/server/terrain/mapgen/MapGenV1.zig index d5b454b1..c36f825f 100644 --- a/src/server/terrain/mapgen/MapGenV1.zig +++ b/src/server/terrain/mapgen/MapGenV1.zig @@ -58,7 +58,7 @@ pub fn generateMapFragment(map: *MapFragment, worldSeed: u64) void { var seed = random.initSeed2D(worldSeed, .{map.pos.wx, map.pos.wy}); random.scrambleSeed(&seed); seed ^= seed >> 16; - + const xOffsetMap = Array2D(f32).init(main.stackAllocator, scaledSize, scaledSize); defer xOffsetMap.deinit(main.stackAllocator); const yOffsetMap = Array2D(f32).init(main.stackAllocator, scaledSize, scaledSize); @@ -165,4 +165,4 @@ pub fn generateMapFragment(map: *MapFragment, worldSeed: u64) void { map.biomeMap[x][y] = biomePoint.biome; } } -} \ No newline at end of file +} diff --git a/src/server/terrain/mapgen/_list.zig b/src/server/terrain/mapgen/_list.zig index 2df3b200..c4dfe1e2 100644 --- a/src/server/terrain/mapgen/_list.zig +++ b/src/server/terrain/mapgen/_list.zig @@ -1,2 +1,2 @@ -pub const MapGenV1 = @import("MapGenV1.zig"); \ No newline at end of file +pub const MapGenV1 = @import("MapGenV1.zig"); diff --git a/src/server/terrain/noise/BlueNoise.zig b/src/server/terrain/noise/BlueNoise.zig index 2e2ba459..9c44b38f 100644 --- a/src/server/terrain/noise/BlueNoise.zig +++ b/src/server/terrain/noise/BlueNoise.zig @@ -83,4 +83,4 @@ pub fn getRegionData(allocator: NeverFailingAllocator, x: i32, y: i32, width: u3 } } return result.toOwnedSlice(allocator); -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/CachedFractalNoise.zig b/src/server/terrain/noise/CachedFractalNoise.zig index 6bdf977d..0703b1ea 100644 --- a/src/server/terrain/noise/CachedFractalNoise.zig +++ b/src/server/terrain/noise/CachedFractalNoise.zig @@ -92,4 +92,4 @@ pub fn getValue(self: CachedFractalNoise, wx: i32, wy: i32) f32 { const x: u31 = @intCast((wx -% self.pos.wx) >> self.pos.voxelSizeShift); const y: u31 = @intCast((wy -% self.pos.wy) >> self.pos.voxelSizeShift); return self._getValue(x, y) - @as(f32, @floatFromInt(self.scale)); -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/CachedFractalNoise3D.zig b/src/server/terrain/noise/CachedFractalNoise3D.zig index c22d9b14..563b8ea5 100644 --- a/src/server/terrain/noise/CachedFractalNoise3D.zig +++ b/src/server/terrain/noise/CachedFractalNoise3D.zig @@ -125,4 +125,4 @@ pub fn getValue(self: CachedFractalNoise3D, wx: i32, wy: i32, wz: i32) f32 { const y: u31 = @intCast((wy -% self.pos.wy) >> self.voxelShift); const z: u31 = @intCast((wz -% self.pos.wz) >> self.voxelShift); return self._getValue(x, y, z) - @as(f32, @floatFromInt(self.scale)); -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/FractalNoise.zig b/src/server/terrain/noise/FractalNoise.zig index 3741421b..fe0733da 100644 --- a/src/server/terrain/noise/FractalNoise.zig +++ b/src/server/terrain/noise/FractalNoise.zig @@ -101,4 +101,4 @@ pub fn generateSparseFractalTerrain(wx: i32, wy: i32, scale: u31, worldSeed: u64 generateFractalTerrain(scaledWx +% x0, scaledWy +% y0, x0, y0, @min(map.width-x0, scaledScale), @min(map.height-y0, scaledScale), scaledScale, worldSeed, map, maxResolution); } } -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/FractalNoise3D.zig b/src/server/terrain/noise/FractalNoise3D.zig index a67af2cc..e8c651b4 100644 --- a/src/server/terrain/noise/FractalNoise3D.zig +++ b/src/server/terrain/noise/FractalNoise3D.zig @@ -137,4 +137,4 @@ fn generateInitializedFractalTerrain(wx: i32, wy: i32, wz: i32, startingScale: u } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/PerlinNoise.zig b/src/server/terrain/noise/PerlinNoise.zig index d4d6debb..b1010976 100644 --- a/src/server/terrain/noise/PerlinNoise.zig +++ b/src/server/terrain/noise/PerlinNoise.zig @@ -75,7 +75,7 @@ const Context = struct { const n = lerp(n0, n1, sx); return n*@sqrt(2.0); } - + // Calculate all grid points that will be needed to prevent double calculating them. fn calculateGridPoints(self: *Context, allocator: NeverFailingAllocator, x: i32, y: i32, _width: u31, _height: u31, scale: u31) void { // Create one gridpoint more, just in case... @@ -190,4 +190,4 @@ pub fn generateSmoothNoise(allocator: NeverFailingAllocator, x: i32, y: i32, wid fac *= reductionFactor; } return map; -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig b/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig index aa567b64..790bb82e 100644 --- a/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig +++ b/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig @@ -107,4 +107,4 @@ pub fn generateSparseFractalTerrain(wx: i32, wy: i32, scale: u31, worldSeed: u64 generateFractalTerrain(scaledWx +% x0, scaledWy +% y0, x0, y0, @min(map.width-x0, scaledScale), @min(map.height-y0, scaledScale), scaledScale, worldSeed, map, maxResolution); } } -} \ No newline at end of file +} diff --git a/src/server/terrain/noise/ValueNoise.zig b/src/server/terrain/noise/ValueNoise.zig index 587eaba9..ddf7c353 100644 --- a/src/server/terrain/noise/ValueNoise.zig +++ b/src/server/terrain/noise/ValueNoise.zig @@ -95,4 +95,4 @@ pub fn percentile(ratio: f32) f32 { if(index >= percentileTable.len-1) return 1; const offset = (scaledToList - @as(f32, @floatFromInt(index))); return (1 - offset)*percentileTable[index] + offset*percentileTable[index + 1]; -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/FallenTree.zig b/src/server/terrain/simple_structures/FallenTree.zig index 0d12b899..5b55cbed 100644 --- a/src/server/terrain/simple_structures/FallenTree.zig +++ b/src/server/terrain/simple_structures/FallenTree.zig @@ -108,4 +108,4 @@ pub fn generate(self: *FallenTree, x: i32, y: i32, z: i32, chunk: *main.chunk.Se generateStump(self, x, y, z, chunk); generateFallen(self, x, y, z, height - 2, chunk, caveMap, seed); -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/FlowerPatch.zig b/src/server/terrain/simple_structures/FlowerPatch.zig index 2234d6b2..95dd2654 100644 --- a/src/server/terrain/simple_structures/FlowerPatch.zig +++ b/src/server/terrain/simple_structures/FlowerPatch.zig @@ -81,4 +81,4 @@ pub fn generate(self: *FlowerPatch, x: i32, y: i32, z: i32, chunk: *main.chunk.S } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/GroundPatch.zig b/src/server/terrain/simple_structures/GroundPatch.zig index 038092e1..10ca1877 100644 --- a/src/server/terrain/simple_structures/GroundPatch.zig +++ b/src/server/terrain/simple_structures/GroundPatch.zig @@ -86,4 +86,4 @@ pub fn generate(self: *GroundPatch, x: i32, y: i32, z: i32, chunk: *main.chunk.S } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/SimpleTreeModel.zig b/src/server/terrain/simple_structures/SimpleTreeModel.zig index e0ea88c2..a3edacab 100644 --- a/src/server/terrain/simple_structures/SimpleTreeModel.zig +++ b/src/server/terrain/simple_structures/SimpleTreeModel.zig @@ -99,7 +99,7 @@ pub fn generate(self: *SimpleTreeModel, x: i32, y: i32, z: i32, chunk: *main.chu return; if(z > chunk.super.width) return; - + if(chunk.super.pos.voxelSize >= 16) { // Ensures that even at lowest resolution some leaves are rendered for smaller trees. if(chunk.liesInChunk(x, y, z)) { @@ -152,4 +152,4 @@ pub fn generate(self: *SimpleTreeModel, x: i32, y: i32, z: i32, chunk: *main.chu } }, } -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/SimpleVegetation.zig b/src/server/terrain/simple_structures/SimpleVegetation.zig index c748246a..233a438a 100644 --- a/src/server/terrain/simple_structures/SimpleVegetation.zig +++ b/src/server/terrain/simple_structures/SimpleVegetation.zig @@ -49,4 +49,4 @@ pub fn generate(self: *SimpleVegetation, x: i32, y: i32, z: i32, chunk: *main.ch } } } -} \ No newline at end of file +} diff --git a/src/server/terrain/simple_structures/_list.zig b/src/server/terrain/simple_structures/_list.zig index 8a09a667..af1d0a17 100644 --- a/src/server/terrain/simple_structures/_list.zig +++ b/src/server/terrain/simple_structures/_list.zig @@ -6,4 +6,4 @@ pub const FlowerPatch = @import("FlowerPatch.zig"); pub const GroundPatch = @import("GroundPatch.zig"); pub const SimpleTreeModel = @import("SimpleTreeModel.zig"); pub const SimpleVegetation = @import("SimpleVegetation.zig"); -pub const Stalagmite = @import("Stalagmite.zig"); \ No newline at end of file +pub const Stalagmite = @import("Stalagmite.zig"); diff --git a/src/server/terrain/structuremapgen/SimpleStructureGen.zig b/src/server/terrain/structuremapgen/SimpleStructureGen.zig index 7f354736..ddeb44fb 100644 --- a/src/server/terrain/structuremapgen/SimpleStructureGen.zig +++ b/src/server/terrain/structuremapgen/SimpleStructureGen.zig @@ -178,5 +178,5 @@ const SimpleStructure = struct { }, } self.model.generate(px, py, relZ, chunk, caveMap, &seed, isCeiling); -} + } }; diff --git a/src/server/terrain/structuremapgen/_list.zig b/src/server/terrain/structuremapgen/_list.zig index 4106b7ae..f61ecc2b 100644 --- a/src/server/terrain/structuremapgen/_list.zig +++ b/src/server/terrain/structuremapgen/_list.zig @@ -1,2 +1,2 @@ -pub const SimpleStructureGen = @import("SimpleStructureGen.zig"); \ No newline at end of file +pub const SimpleStructureGen = @import("SimpleStructureGen.zig"); diff --git a/src/server/terrain/terrain.zig b/src/server/terrain/terrain.zig index b65ab8fb..eaba81bd 100644 --- a/src/server/terrain/terrain.zig +++ b/src/server/terrain/terrain.zig @@ -171,4 +171,4 @@ pub fn deinit() void { ClimateMap.deinit(); SurfaceMap.deinit(); LightMap.deinit(); -} \ No newline at end of file +} diff --git a/src/server/world.zig b/src/server/world.zig index 304d5b41..3aff528f 100644 --- a/src/server/world.zig +++ b/src/server/world.zig @@ -139,7 +139,7 @@ const ChunkManager = struct { // MARK: ChunkManager .clean = @ptrCast(&clean), .taskType = .chunkgen, }; - + pub fn scheduleAndDecreaseRefCount(pos: ChunkPosition, source: Source) void { const task = main.globalAllocator.create(ChunkLoadTask); task.* = ChunkLoadTask { @@ -199,7 +199,7 @@ const ChunkManager = struct { // MARK: ChunkManager .clean = @ptrCast(&clean), .taskType = .misc, }; - + pub fn scheduleAndDecreaseRefCount(pos: terrain.SurfaceMap.MapFragmentPosition, source: ?*User) void { const task = main.globalAllocator.create(LightMapLoadTask); task.* = LightMapLoadTask { @@ -532,7 +532,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld try files.writeZon(try std.fmt.bufPrint(&buf, "saves/{s}/biome_palette.zig.zon", .{name}), self.biomePalette.save(arenaAllocator)); var gamerules = files.readToZon(arenaAllocator, try std.fmt.bufPrint(&buf, "saves/{s}/gamerules.zig.zon", .{name})) catch ZonElement.initObject(arenaAllocator); - + self.defaultGamemode = std.meta.stringToEnum(main.game.Gamemode, gamerules.get([]const u8, "default_gamemode", "creative")) orelse .creative; self.allowCheats = gamerules.get(bool, "cheats", true); @@ -576,7 +576,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld .clean = @ptrCast(&clean), .taskType = .chunkgen, }; - + pub fn schedule(pos: ChunkPosition, storeMaps: bool) void { const task = main.globalAllocator.create(RegenerateLODTask); task.* = .{ @@ -806,12 +806,12 @@ pub const ServerWorld = struct { // MARK: ServerWorld playerZon.deinit(main.stackAllocator); playerZon = ZonElement.initObject(main.stackAllocator); } - + playerZon.put("name", user.name); - + playerZon.put("entity", user.player.save(main.stackAllocator)); playerZon.put("gamemode", @tagName(user.gamemode.load(.monotonic))); - + { main.items.Inventory.Sync.ServerSide.mutex.lock(); defer main.items.Inventory.Sync.ServerSide.mutex.unlock(); @@ -835,7 +835,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld pub fn saveAllPlayers(self: *ServerWorld) !void { const userList = server.getUserListAndIncreaseRefCount(main.stackAllocator); defer server.freeUserListAndDecreaseRefCount(main.stackAllocator, userList); - + for (userList) |user| { try savePlayer(self, user); } @@ -844,7 +844,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld pub fn forceSave(self: *ServerWorld) !void { // TODO: Save chunks and player data try self.wio.saveWorldData(); - + try self.saveAllPlayers(); const itemDropZon = self.itemDropManager.store(main.stackAllocator); diff --git a/src/utils.zig b/src/utils.zig index 2cf6038d..44fb2119 100644 --- a/src/utils.zig +++ b/src/utils.zig @@ -649,7 +649,7 @@ pub const ErrorHandlingAllocator = struct { // MARK: ErrorHandlingAllocator } }; -/// An allocator interface signaling that you can use +/// An allocator interface signaling that you can use pub const NeverFailingAllocator = struct { // MARK: NeverFailingAllocator allocator: Allocator, IAssertThatTheProvidedAllocatorCantFail: void, diff --git a/src/utils/file_monitor.zig b/src/utils/file_monitor.zig index 0baf5ee8..5b64a5a7 100644 --- a/src/utils/file_monitor.zig +++ b/src/utils/file_monitor.zig @@ -136,7 +136,7 @@ const LinuxImpl = struct { // MARK: LinuxImpl while(offset < available) { const eventPtr: *const c.inotify_event = @alignCast(@ptrCast(events.ptr[offset..])); defer offset += @sizeOf(c.inotify_event) + eventPtr.len; - + const callback = callbacks.get(eventPtr.wd) orelse continue; if(eventPtr.mask & c.IN_ISDIR != 0) callback.needsUpdate = true; _ = triggeredCallbacks.getOrPut(callback) catch unreachable; @@ -281,7 +281,7 @@ const WindowsImpl = struct { // MARK: WindowsImpl if(handle == std.os.windows.INVALID_HANDLE_VALUE) { std.log.err("Got error while creating notification handler for path {s}: {}", .{path, std.os.windows.kernel32.GetLastError()}); } - + const callbackInfo = main.globalAllocator.create(DirectoryInfo); callbackInfo.* = .{ .callback = callback, diff --git a/src/utils/list.zig b/src/utils/list.zig index 2f9c481f..ccd46904 100644 --- a/src/utils/list.zig +++ b/src/utils/list.zig @@ -18,13 +18,13 @@ pub fn List(comptime T: type) type { items: []T = &.{}, capacity: usize = 0, allocator: NeverFailingAllocator, - + pub fn init(allocator: NeverFailingAllocator) @This() { return .{ .allocator = allocator, }; } - + pub fn initCapacity(allocator: NeverFailingAllocator, capacity: usize) @This() { return .{ .items = allocator.alloc(T, capacity)[0..0], @@ -231,7 +231,7 @@ pub fn ListUnmanaged(comptime T: type) type { return struct { items: []T = &.{}, capacity: usize = 0, - + pub fn initCapacity(allocator: NeverFailingAllocator, capacity: usize) @This() { return .{ .items = allocator.alloc(T, capacity)[0..0], @@ -425,7 +425,7 @@ pub fn ListUnmanaged(comptime T: type) type { pub fn writer(self: *@This()) Writer { return .{ .context = self }; } - + fn appendWrite(self: *@This(), m: []const u8) !usize { self.appendSlice(m); return m.len; @@ -480,7 +480,7 @@ pub fn VirtualList(T: type, maxSize: u32) type { mem: [*]align(pageSize) T, len: u32, committedCapacity: u32, - + pub fn init() @This() { return .{ .mem = @ptrCast(reserveMemory(maxSizeBytes)), diff --git a/src/zon.zig b/src/zon.zig index 95b8a2a6..40aee9dc 100644 --- a/src/zon.zig +++ b/src/zon.zig @@ -84,7 +84,7 @@ pub const ZonElement = union(enum) { // MARK: Zon for (0..array.items.len) |i| { out.array.append(array.items[i].clone(allocator)); } - + break :blk out; }, .object => |object| blk: { @@ -916,4 +916,4 @@ test "element parsing" { try std.testing.expectEqual(ZonElement{.int=1}, result.array.items[1]); try std.testing.expectEqual(ZonElement{.float=17.1}, result.array.items[2]); result.deinit(allocator); -} \ No newline at end of file +}