]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Several fixes
authorishland <ishlandmc@yeah.net>
Sat, 26 Feb 2022 12:51:15 +0000 (20:51 +0800)
committerirtimaled <irtimaled@gmail.com>
Sat, 26 Feb 2022 18:33:12 +0000 (10:33 -0800)
- Reimplemented flower forest rendering
- Slime chunks rendering now respects world min y
- Bedrock ceiling rendering now respects filling toggle in options

16 files changed:
src/main/java/com/irtimaled/bbor/client/ClientRenderer.java
src/main/java/com/irtimaled/bbor/client/config/BoundingBoxTypeHelper.java
src/main/java/com/irtimaled/bbor/client/config/ConfigManager.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
src/main/java/com/irtimaled/bbor/client/interop/FlowerForestHelper.java
src/main/java/com/irtimaled/bbor/client/models/BoundingBoxFlowerForest.java
src/main/java/com/irtimaled/bbor/client/providers/FlowerForestProvider.java
src/main/java/com/irtimaled/bbor/client/providers/SlimeChunkProvider.java
src/main/java/com/irtimaled/bbor/client/renderers/AbstractRenderer.java
src/main/java/com/irtimaled/bbor/client/renderers/BedrockCeilingRenderer.java
src/main/java/com/irtimaled/bbor/client/renderers/FlowerForestRenderer.java
src/main/java/com/irtimaled/bbor/client/renderers/RenderBatch.java
src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java [new file with mode: 0644]
src/main/resources/assets/bbor/lang/en_us.json
src/main/resources/bbor.mixins.json

index 836d0e04fa28e311ef055e9f0a24cb7b1274f912..903b6d256e5859c5d15842a9b0223975ccbff7e3 100644 (file)
@@ -12,6 +12,7 @@ import com.irtimaled.bbor.client.providers.CustomBeaconProvider;
 import com.irtimaled.bbor.client.providers.CustomBoxProvider;
 import com.irtimaled.bbor.client.providers.CustomLineProvider;
 import com.irtimaled.bbor.client.providers.CustomSphereProvider;
+import com.irtimaled.bbor.client.providers.FlowerForestProvider;
 import com.irtimaled.bbor.client.providers.IBoundingBoxProvider;
 import com.irtimaled.bbor.client.providers.ICachingProvider;
 import com.irtimaled.bbor.client.providers.MobSpawnerProvider;
@@ -78,7 +79,7 @@ public class ClientRenderer {
         registerProvider(new SpawnableBlocksProvider());
         registerProvider(new CustomLineProvider());
         registerProvider(new CustomSphereProvider());
-//        registerProvider(new FlowerForestProvider());
+        registerProvider(new FlowerForestProvider());
         registerProvider(new BedrockCeilingProvider());
     }
 
index f06b55358cabc0c1693a3fbb25c1902f49caa141..d22d71b995f594771acd5f57a96d3ee666c64f96 100644 (file)
@@ -25,7 +25,7 @@ public class BoundingBoxTypeHelper {
         registerType(BoundingBoxType.Custom, ConfigManager.drawConduits, ConfigManager.colorCustom);
         registerType(BoundingBoxType.Conduit, ConfigManager.drawConduits, ConfigManager.colorConduits);
         registerType(BoundingBoxType.SpawnableBlocks, ConfigManager.drawSpawnableBlocks, ConfigManager.colorSpawnableBlocks);
-//        registerType(BoundingBoxType.FlowerForest, ConfigManager.drawFlowerForests, null);
+        registerType(BoundingBoxType.FlowerForest, ConfigManager.drawFlowerForests, null);
         registerType(BoundingBoxType.BedrockCeiling, ConfigManager.drawBedrockCeilingBlocks, ConfigManager.colorBedrockCeilingBlocks);
 
         registerType(BoundingBoxType.JungleTemple, ConfigManager.drawJungleTemples, ConfigManager.colorJungleTemples);
index c8ff8689621e54b5493e22212f33516d535d7d4e..7a53b9c4a291eb7b034b66845506287a64a41d3c 100644 (file)
@@ -53,8 +53,8 @@ public class ConfigManager {
     public static Setting<Integer> spawnableBlocksRenderHeight;
     public static Setting<Boolean> invertBoxColorPlayerInside;
     public static Setting<Boolean> renderSphereAsDots;
-//    public static Setting<Boolean> drawFlowerForests;
-//    public static Setting<Integer> flowerForestsRenderDistance;
+    public static Setting<Boolean> drawFlowerForests;
+    public static Setting<Integer> flowerForestsRenderDistance;
     public static Setting<Boolean> drawBedrockCeilingBlocks;
 
     public static Setting<HexColor> colorWorldSpawn;
@@ -131,8 +131,8 @@ public class ConfigManager {
         biomeBordersRenderDistance = setup(config, "biomeBorders", "biomeBordersRenderDistance", 3, "The distance from the player where biome borders will be drawn.");
         biomeBordersMaxY = setup(config, "biomeBorders", "biomeBordersMaxY", -1, "The maximum top of the biome borders. If set to -1 it will use the value when activated, if set to 0 it will always track the players feet.");
 
-//        drawFlowerForests = setup(config, "flowerForests", "drawFlowerForests", true, "If set to true flower forest flower overlays will be drawn.");
-//        flowerForestsRenderDistance = setup(config, "flowerForests", "flowerForestsRenderDistance", 3, "The distance from the player where flower forests will be drawn.");
+        drawFlowerForests = setup(config, "flowerForests", "drawFlowerForests", true, "If set to true flower forest flower overlays will be drawn.");
+        flowerForestsRenderDistance = setup(config, "flowerForests", "flowerForestsRenderDistance", 3, "The distance from the player where flower forests will be drawn.");
 
         drawBedrockCeilingBlocks = setup(config, "bedrockCeiling", "drawBedrockCeilingBlocks", true, "If set to true position with only one layer of bedrock will be drawn.");
 
index 5741b07b8315e3d4857d46e0235ca2a7937bfd8e..405221cfe0995d7ec8a9abd96bf7e2ec524afb98 100644 (file)
@@ -72,12 +72,15 @@ public class SettingsScreen extends ListScreen {
                                 .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
                                 .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
                                 .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
-//                .section(I18n.translate("bbor.features.flowerForests"),
-//                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
-//                        width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.flowerForestsRenderDistance)
-//                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
-//                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
-//                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
+                .section(I18n.translate("bbor.features.flowerForests"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
+                        width -> new IntSettingSlider(width, 1, 6, "bbor.options.distance", ConfigManager.flowerForestsRenderDistance)
+                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
+                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal"))
+                                .addDisplayValue(4, I18n.translate("bbor.options.distance.farther"))
+                                .addDisplayValue(5, I18n.translate("bbor.options.distance.far"))
+                                .addDisplayValue(6, I18n.translate("bbor.options.distance.veryFar")))
                 .section(I18n.translate("bbor.features.bedrockCeilingBlocks"),
                         width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.bedrockCeilingBlocks"), BoundingBoxType.BedrockCeiling))
                 .section(I18n.translate("bbor.features.mobSpawners"),
index 06c5cc890f6dc93ddde67a808b26c976d057b3b4..ed1d486dffbf6c5bdc8aa3130788f4f814c13137 100644 (file)
@@ -1,10 +1,10 @@
-/*
 package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.config.HexColor;
 import com.irtimaled.bbor.client.config.Setting;
 import com.irtimaled.bbor.common.models.Coords;
+import com.irtimaled.bbor.mixin.access.IPlacedFeature;
 import net.minecraft.block.BlockState;
 import net.minecraft.block.Blocks;
 import net.minecraft.client.MinecraftClient;
@@ -13,8 +13,11 @@ import net.minecraft.util.registry.BuiltinRegistries;
 import net.minecraft.world.biome.Biome;
 import net.minecraft.world.biome.BiomeKeys;
 import net.minecraft.world.gen.feature.ConfiguredFeature;
-import net.minecraft.world.gen.feature.FeatureConfig;
-import net.minecraft.world.gen.feature.FlowerFeature;
+import net.minecraft.world.gen.feature.PlacedFeature;
+import net.minecraft.world.gen.feature.SimpleBlockFeature;
+import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig;
+import net.minecraft.world.gen.feature.VegetationConfiguredFeatures;
+import net.minecraft.world.gen.stateprovider.BlockStateProvider;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -24,11 +27,11 @@ public class FlowerForestHelper {
     private static final Random random = new Random();
 
     private static final Map<BlockState, Setting<HexColor>> flowerColorMap = new HashMap<>();
-    private static final FlowerFeature flowersFeature;
-    private static final FeatureConfig flowersConfig;
 
     public static final Biome BIOME = BuiltinRegistries.BIOME.get(BiomeKeys.FLOWER_FOREST);
 
+    private static BlockStateProvider blockStateProvider;
+
     static {
         flowerColorMap.put(Blocks.DANDELION.getDefaultState(), ConfigManager.colorFlowerForestDandelion);
         flowerColorMap.put(Blocks.POPPY.getDefaultState(), ConfigManager.colorFlowerForestPoppy);
@@ -41,15 +44,15 @@ public class FlowerForestHelper {
         flowerColorMap.put(Blocks.OXEYE_DAISY.getDefaultState(), ConfigManager.colorFlowerForestOxeyeDaisy);
         flowerColorMap.put(Blocks.CORNFLOWER.getDefaultState(), ConfigManager.colorFlowerForestCornflower);
         flowerColorMap.put(Blocks.LILY_OF_THE_VALLEY.getDefaultState(), ConfigManager.colorFlowerForestLilyOfTheValley);
-        ConfiguredFeature<?, ?> config = BIOME.getGenerationSettings().getFlowerFeatures().get(0);
-        flowersFeature = (FlowerFeature) config.feature;
-        flowersConfig = config.config;
+        final PlacedFeature placedFeature = VegetationConfiguredFeatures.FLOWER_FLOWER_FOREST.config.feature().get();
+        final ConfiguredFeature<SimpleBlockFeatureConfig, SimpleBlockFeature> configuredFeature = (ConfiguredFeature<SimpleBlockFeatureConfig, SimpleBlockFeature>) ((IPlacedFeature) placedFeature).getFeature().get();
+        blockStateProvider = configuredFeature.getConfig().toPlace();
     }
 
     public static Setting<HexColor> getFlowerColorAtPos(Coords coords) {
         int x = coords.getX();
         int z = coords.getZ();
-        BlockState blockState = flowersFeature.getFlowerState(random, new BlockPos(x, coords.getY(), z), flowersConfig);
+        BlockState blockState = blockStateProvider.getBlockState(random, new BlockPos(x, coords.getY(), z));
         return flowerColorMap.get(blockState);
     }
 
@@ -61,5 +64,3 @@ public class FlowerForestHelper {
         return MinecraftClient.getInstance().world.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.GRASS_BLOCK;
     }
 }
-
- */
\ No newline at end of file
index 3f0abbf75110e8e85c88a4e4b9e611afe1b77126..11d61d03476a6f20a47126a808afd654ac400eea 100644 (file)
@@ -1,4 +1,3 @@
-/*
 package com.irtimaled.bbor.client.models;
 
 import com.irtimaled.bbor.client.RenderCulling;
@@ -64,4 +63,3 @@ public class BoundingBoxFlowerForest extends AbstractBoundingBox {
         return RenderCulling.isVisibleCulling(coords.getX(), coords.getY() + 0.01d, coords.getZ(), coords.getX() + 1, coords.getY(), coords.getZ() + 1);
     }
 }
- */
index dcb4d2b367465c853579f71d90d9477930455c3a..b26745e5c8a56d7f81db9051f6b12d29a678d626 100644 (file)
@@ -1,4 +1,3 @@
-/*
 package com.irtimaled.bbor.client.providers;
 
 import com.irtimaled.bbor.client.Player;
@@ -90,5 +89,3 @@ public class FlowerForestProvider implements IBoundingBoxProvider<BoundingBoxFlo
         return 0;
     }
 }
-
- */
\ No newline at end of file
index 804dab37b29416ccc6bd7cde001925ce04cf5e91..c22b4627316003639bd766816932869dc4f2a8b8 100644 (file)
@@ -8,6 +8,8 @@ import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.world.ClientWorld;
 import net.minecraft.world.gen.random.ChunkRandom;
 
 import java.util.HashSet;
@@ -39,6 +41,13 @@ public class SlimeChunkProvider implements IBoundingBoxProvider<BoundingBoxSlime
     public Iterable<BoundingBoxSlimeChunk> get(DimensionId dimensionId) {
         Set<BoundingBoxSlimeChunk> slimeChunks = new HashSet<>();
         int renderDistanceChunks = ClientInterop.getRenderDistanceChunks();
+        final ClientWorld world = MinecraftClient.getInstance().world;
+        final int minimumY;
+        if (world != null) {
+            minimumY = world.getDimension().getMinimumY();
+        } else {
+            minimumY = 0;
+        }
         int playerChunkX = MathHelper.floor(Player.getX() / CHUNK_SIZE);
         int playerChunkZ = MathHelper.floor(Player.getZ() / CHUNK_SIZE);
         for (int chunkX = playerChunkX - renderDistanceChunks; chunkX <= playerChunkX + renderDistanceChunks; ++chunkX) {
@@ -46,7 +55,7 @@ public class SlimeChunkProvider implements IBoundingBoxProvider<BoundingBoxSlime
                 if (isSlimeChunk(chunkX, chunkZ)) {
                     int chunkXStart = chunkX << 4;
                     int chunkZStart = chunkZ << 4;
-                    Coords minCoords = new Coords(chunkXStart, 1, chunkZStart);
+                    Coords minCoords = new Coords(chunkXStart, minimumY + 1, chunkZStart);
                     Coords maxCoords = new Coords(chunkXStart + 15, 38, chunkZStart + 15);
                     slimeChunks.add(new BoundingBoxSlimeChunk(minCoords, maxCoords));
                 }
index da85517a30d8c5304382990e8987b7737dc2d0d0..94683d7030bc1fc1cecf76b062f941acac89d509 100644 (file)
@@ -29,7 +29,7 @@ public abstract class AbstractRenderer<T extends AbstractBoundingBox> {
     void renderCuboid(MatrixStack matrixStack, OffsetBox bb, Color color, boolean fillOnly, int fillAlpha) {
         matrixStack.push();
 
-        renderCuboid0(matrixStack, bb, color, fillOnly, fillAlpha, false);
+        renderCuboid0(matrixStack, bb.nudge(), color, fillOnly, fillAlpha, false);
 
         matrixStack.pop();
     }
index 22b88b74c569d5c476b804fad95688ca9d88996d..8970e4f24818f48835d54ab222fd5b02bec9846b 100644 (file)
@@ -14,6 +14,6 @@ public class BedrockCeilingRenderer extends AbstractRenderer<BoundingBoxBedrockC
         int z = coords.getZ();
         renderCuboid(matrixStack, new OffsetBox(new OffsetPoint(x, y + 1.01d, z),
                         new OffsetPoint(x + 1, y + 1.01d, z + 1)),
-                BoundingBoxTypeHelper.getColor(boundingBox.getType()), true, 127);
+                BoundingBoxTypeHelper.getColor(boundingBox.getType()), false, 127);
     }
 }
index ef42565a609873b11b45f5482dc91106c994d8dd..81c3e777622e41f7392bea10ecef3ad440c6023c 100644 (file)
@@ -1,4 +1,3 @@
-/*
 package com.irtimaled.bbor.client.renderers;
 
 import com.irtimaled.bbor.client.models.BoundingBoxFlowerForest;
@@ -17,4 +16,3 @@ public class FlowerForestRenderer extends AbstractRenderer<BoundingBoxFlowerFore
                 boundingBox.getColor(), true, 127);
     }
 }
- */
index 22be45e69339928e410110dcf9dd9404bb573fca..0d30a8cff86ab10359da4d89f8aff78361a4368e 100644 (file)
@@ -151,7 +151,7 @@ public class RenderBatch {
     }
 
     public static String debugString() {
-        return String.format("[BBOR] Statistics: Filled faces: %d,%d Lines: %d @ %.2fms", quadMaskedCountLast.get(), quadNonMaskedCountLast.get(), lineCountLast.get(), lastDurationNanos.get() / 1_000_000.0);
+        return String.format("[BBOR] Statistics: Filled faces: %d+%d Lines: %d @ %.2fms", quadMaskedCountLast.get(), quadNonMaskedCountLast.get(), lineCountLast.get(), lastDurationNanos.get() / 1_000_000.0);
     }
 
 }
index eabd102640f92276e37e793e2d83ea6a7b5c4d2a..38850f8c4f35e9f1affe9358f6a90511588e27d0 100644 (file)
@@ -17,7 +17,7 @@ public class BoundingBoxType {
     public static final BoundingBoxType Beacon = register("Beacon");
     public static final BoundingBoxType Conduit = register("Conduit");
     public static final BoundingBoxType SpawnableBlocks = register("Spawnable Blocks");
-//    public static final BoundingBoxType FlowerForest = register("Flower Forest");
+    public static final BoundingBoxType FlowerForest = register("Flower Forest");
     public static final BoundingBoxType BedrockCeiling = register("Bedrock Ceiling");
 
     public static final BoundingBoxType JungleTemple = register("jungle_pyramid");
diff --git a/src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java b/src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java
new file mode 100644 (file)
index 0000000..1fca3d9
--- /dev/null
@@ -0,0 +1,16 @@
+package com.irtimaled.bbor.mixin.access;
+
+import net.minecraft.world.gen.feature.ConfiguredFeature;
+import net.minecraft.world.gen.feature.PlacedFeature;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+import java.util.function.Supplier;
+
+@Mixin(PlacedFeature.class)
+public interface IPlacedFeature {
+
+    @Accessor
+    Supplier<ConfiguredFeature<?, ?>> getFeature();
+
+}
index bdb540389e37f077b54b2060987a96e6a0c3cc3e..d30eaecc44489a64e76c230ec27a84caa26b6bf3 100644 (file)
@@ -22,6 +22,9 @@
   "bbor.options.distance.nearest": "Nearest",
   "bbor.options.distance.nearer": "Nearer",
   "bbor.options.distance.normal": "Normal",
+  "bbor.options.distance.farther": "Farther",
+  "bbor.options.distance.far": "Far",
+  "bbor.options.distance.veryFar": "Very Far",
   "bbor.options.distance.y": "Distance (Y): %s",
   "bbor.options.distance.xz": "Distance (X/Z): %s",
 
index 865a8f1715c9ad48a55d60eb4cfaefb59981e7f7..b0684b684fb997e6a2aa813424f4a1c4039fcad1 100644 (file)
@@ -6,6 +6,7 @@
   "package": "com.irtimaled.bbor.mixin",
   "mixins": [
     "access.IBeaconBlockEntity",
+    "access.IPlacedFeature",
     "access.IStructureStart",
     "client.renderer.MixinDebugHud",
     "client.renderer.MixinWorldRenderer",