]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
1.18.2-rc1
authorishland <ishlandmc@yeah.net>
Sun, 27 Feb 2022 05:39:55 +0000 (13:39 +0800)
committerishland <ishlandmc@yeah.net>
Sun, 27 Feb 2022 05:39:55 +0000 (13:39 +0800)
24 files changed:
build.gradle
gradle.properties
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/ControlList.java
src/main/java/com/irtimaled/bbor/client/gui/ControlListSection.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
src/main/java/com/irtimaled/bbor/client/interop/BiomeBorderHelper.java
src/main/java/com/irtimaled/bbor/client/interop/FlowerForestHelper.java
src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java
src/main/java/com/irtimaled/bbor/client/interop/SpawnableBlocksHelper.java
src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java
src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
src/main/java/com/irtimaled/bbor/common/StructureProcessor.java
src/main/java/com/irtimaled/bbor/common/events/StructuresLoaded.java
src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java
src/main/java/com/irtimaled/bbor/mixin/access/IBiome.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java [deleted file]
src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java
src/main/java/com/irtimaled/bbor/mixin/client/MixinMinecraft.java
src/main/java/com/irtimaled/bbor/mixin/resource/MixinResourcePackManager.java
src/main/resources/bbor.accesswidener
src/main/resources/bbor.mixins.json
src/main/resources/fabric.mod.json

index b0e66d06ee05de6de9c9a80853bde04076f948c2..4f6e5c99f7e74dcc7771d9dbff977a4459cc341c 100644 (file)
@@ -40,8 +40,8 @@ tasks.withType(JavaCompile).configureEach {
 
 dependencies {
     minecraft 'com.mojang:minecraft:' + project.mcVersion
-    mappings 'net.fabricmc:yarn:' + project.mcVersion + '+build.22:v2'
-    modImplementation 'net.fabricmc:fabric-loader:0.12.12'
+    mappings 'net.fabricmc:yarn:' + project.mcVersion + '+build.2:v2'
+    modImplementation 'net.fabricmc:fabric-loader:0.13.3'
 }
 
 loom {
index 428708c131f8d4a8d5a0668534626402a635f1a4..e0e30b186d772ac6c664a1289e28f1ae162f40c1 100644 (file)
@@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx4G
 name=bbor
 buildVersion=2.4
 # leave a space to reduce merge conflicts on version change
-mcVersion=1.18.1
+mcVersion=1.18.2-rc1
index d22d71b995f594771acd5f57a96d3ee666c64f96..4d6d5ed4f2a80ee5333049747342875de5d99604 100644 (file)
@@ -1,15 +1,16 @@
 package com.irtimaled.bbor.client.config;
 
 import com.irtimaled.bbor.common.BoundingBoxType;
+import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
 
 import java.awt.*;
-import java.util.HashMap;
 import java.util.Map;
 
 public class BoundingBoxTypeHelper {
-    private static final Map<String, BoundingBoxTypeSettings> structureTypeMap = new HashMap<>();
+    private static final Map<String, BoundingBoxTypeSettings> structureTypeMap = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
 
-    private static void registerType(BoundingBoxType type, Setting<Boolean> shouldRender, Setting<HexColor> color) {
+    public static void registerType(BoundingBoxType type, Setting<Boolean> shouldRender, Setting<HexColor> color) {
         structureTypeMap.put(type.getName(), new BoundingBoxTypeSettings(shouldRender, color));
     }
 
@@ -28,24 +29,24 @@ public class BoundingBoxTypeHelper {
         registerType(BoundingBoxType.FlowerForest, ConfigManager.drawFlowerForests, null);
         registerType(BoundingBoxType.BedrockCeiling, ConfigManager.drawBedrockCeilingBlocks, ConfigManager.colorBedrockCeilingBlocks);
 
-        registerType(BoundingBoxType.JungleTemple, ConfigManager.drawJungleTemples, ConfigManager.colorJungleTemples);
-        registerType(BoundingBoxType.DesertTemple, ConfigManager.drawDesertTemples, ConfigManager.colorDesertTemples);
-        registerType(BoundingBoxType.WitchHut, ConfigManager.drawWitchHuts, ConfigManager.colorWitchHuts);
-        registerType(BoundingBoxType.OceanMonument, ConfigManager.drawOceanMonuments, ConfigManager.colorOceanMonuments);
-        registerType(BoundingBoxType.Shipwreck, ConfigManager.drawShipwrecks, ConfigManager.colorShipwrecks);
-        registerType(BoundingBoxType.OceanRuin, ConfigManager.drawOceanRuins, ConfigManager.colorOceanRuins);
-        registerType(BoundingBoxType.BuriedTreasure, ConfigManager.drawBuriedTreasure, ConfigManager.colorBuriedTreasure);
-        registerType(BoundingBoxType.Stronghold, ConfigManager.drawStrongholds, ConfigManager.colorStrongholds);
-        registerType(BoundingBoxType.MineShaft, ConfigManager.drawMineShafts, ConfigManager.colorMineShafts);
-        registerType(BoundingBoxType.NetherFortress, ConfigManager.drawNetherFortresses, ConfigManager.colorNetherFortresses);
-        registerType(BoundingBoxType.EndCity, ConfigManager.drawEndCities, ConfigManager.colorEndCities);
-        registerType(BoundingBoxType.Mansion, ConfigManager.drawMansions, ConfigManager.colorMansions);
-        registerType(BoundingBoxType.Igloo, ConfigManager.drawIgloos, ConfigManager.colorIgloos);
-        registerType(BoundingBoxType.PillagerOutpost, ConfigManager.drawPillagerOutposts, ConfigManager.colorPillagerOutposts);
-        registerType(BoundingBoxType.Village, ConfigManager.drawVillages, ConfigManager.colorVillages);
-        registerType(BoundingBoxType.NetherFossil, ConfigManager.drawNetherFossils, ConfigManager.colorNetherFossils);
-        registerType(BoundingBoxType.BastionRemnant, ConfigManager.drawBastionRemnants, ConfigManager.colorBastionRemnants);
-        registerType(BoundingBoxType.RuinedPortal, ConfigManager.drawRuinedPortals, ConfigManager.colorRuinedPortals);
+//        registerType(BoundingBoxType.JungleTemple, ConfigManager.drawJungleTemples, ConfigManager.colorJungleTemples);
+//        registerType(BoundingBoxType.DesertTemple, ConfigManager.drawDesertTemples, ConfigManager.colorDesertTemples);
+//        registerType(BoundingBoxType.WitchHut, ConfigManager.drawWitchHuts, ConfigManager.colorWitchHuts);
+//        registerType(BoundingBoxType.OceanMonument, ConfigManager.drawOceanMonuments, ConfigManager.colorOceanMonuments);
+//        registerType(BoundingBoxType.Shipwreck, ConfigManager.drawShipwrecks, ConfigManager.colorShipwrecks);
+//        registerType(BoundingBoxType.OceanRuin, ConfigManager.drawOceanRuins, ConfigManager.colorOceanRuins);
+//        registerType(BoundingBoxType.BuriedTreasure, ConfigManager.drawBuriedTreasure, ConfigManager.colorBuriedTreasure);
+//        registerType(BoundingBoxType.Stronghold, ConfigManager.drawStrongholds, ConfigManager.colorStrongholds);
+//        registerType(BoundingBoxType.MineShaft, ConfigManager.drawMineShafts, ConfigManager.colorMineShafts);
+//        registerType(BoundingBoxType.NetherFortress, ConfigManager.drawNetherFortresses, ConfigManager.colorNetherFortresses);
+//        registerType(BoundingBoxType.EndCity, ConfigManager.drawEndCities, ConfigManager.colorEndCities);
+//        registerType(BoundingBoxType.Mansion, ConfigManager.drawMansions, ConfigManager.colorMansions);
+//        registerType(BoundingBoxType.Igloo, ConfigManager.drawIgloos, ConfigManager.colorIgloos);
+//        registerType(BoundingBoxType.PillagerOutpost, ConfigManager.drawPillagerOutposts, ConfigManager.colorPillagerOutposts);
+//        registerType(BoundingBoxType.Village, ConfigManager.drawVillages, ConfigManager.colorVillages);
+//        registerType(BoundingBoxType.NetherFossil, ConfigManager.drawNetherFossils, ConfigManager.colorNetherFossils);
+//        registerType(BoundingBoxType.BastionRemnant, ConfigManager.drawBastionRemnants, ConfigManager.colorBastionRemnants);
+//        registerType(BoundingBoxType.RuinedPortal, ConfigManager.drawRuinedPortals, ConfigManager.colorRuinedPortals);
     }
 
     public static Setting<Boolean> renderSetting(BoundingBoxType type) {
index 7a53b9c4a291eb7b034b66845506287a64a41d3c..f69d12a29ff61bfa478b566a71f5bba4f9e62b66 100644 (file)
@@ -1,7 +1,12 @@
 package com.irtimaled.bbor.client.config;
 
+import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+
 import java.io.File;
 import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 public class ConfigManager {
@@ -9,14 +14,14 @@ public class ConfigManager {
     private static File configDir;
 
     public static Setting<Boolean> fill;
-    public static Setting<Boolean> drawVillages;
-    public static Setting<Boolean> drawDesertTemples;
-    public static Setting<Boolean> drawJungleTemples;
-    public static Setting<Boolean> drawWitchHuts;
-    public static Setting<Boolean> drawStrongholds;
-    public static Setting<Boolean> drawMineShafts;
-    public static Setting<Boolean> drawNetherFortresses;
-    public static Setting<Boolean> drawOceanMonuments;
+    //    public static Setting<Boolean> drawVillages;
+//    public static Setting<Boolean> drawDesertTemples;
+//    public static Setting<Boolean> drawJungleTemples;
+//    public static Setting<Boolean> drawWitchHuts;
+//    public static Setting<Boolean> drawStrongholds;
+//    public static Setting<Boolean> drawMineShafts;
+//    public static Setting<Boolean> drawNetherFortresses;
+//    public static Setting<Boolean> drawOceanMonuments;
     public static Setting<Boolean> alwaysVisible;
     public static Setting<Boolean> drawSlimeChunks;
     public static Setting<Integer> slimeChunkMaxY;
@@ -24,16 +29,16 @@ public class ConfigManager {
     public static Setting<Boolean> drawWorldSpawn;
     public static Setting<Integer> worldSpawnMaxY;
     public static Setting<Boolean> drawLazySpawnChunks;
-    public static Setting<Boolean> drawEndCities;
-    public static Setting<Boolean> drawMansions;
-    public static Setting<Boolean> drawShipwrecks;
-    public static Setting<Boolean> drawOceanRuins;
-    public static Setting<Boolean> drawBuriedTreasure;
-    public static Setting<Boolean> drawIgloos;
+    //    public static Setting<Boolean> drawEndCities;
+//    public static Setting<Boolean> drawMansions;
+//    public static Setting<Boolean> drawShipwrecks;
+//    public static Setting<Boolean> drawOceanRuins;
+//    public static Setting<Boolean> drawBuriedTreasure;
+//    public static Setting<Boolean> drawIgloos;
     public static Setting<Boolean> drawMobSpawners;
     public static Setting<Boolean> renderMobSpawnerSpawnArea;
     public static Setting<Boolean> renderMobSpawnerActivationLines;
-    public static Setting<Boolean> drawPillagerOutposts;
+    //    public static Setting<Boolean> drawPillagerOutposts;
     public static Setting<Boolean> outerBoxesOnly;
     public static Setting<Boolean> drawAFKSpheres;
     public static Setting<Boolean> renderAFKSpawnableBlocks;
@@ -43,9 +48,9 @@ public class ConfigManager {
     public static Setting<Boolean> renderOnlyCurrentBiome;
     public static Setting<Integer> biomeBordersRenderDistance;
     public static Setting<Integer> biomeBordersMaxY;
-    public static Setting<Boolean> drawNetherFossils;
-    public static Setting<Boolean> drawBastionRemnants;
-    public static Setting<Boolean> drawRuinedPortals;
+    //    public static Setting<Boolean> drawNetherFossils;
+//    public static Setting<Boolean> drawBastionRemnants;
+//    public static Setting<Boolean> drawRuinedPortals;
     public static Setting<Boolean> drawConduits;
     public static Setting<Boolean> renderConduitMobHarmArea;
     public static Setting<Boolean> drawSpawnableBlocks;
@@ -72,24 +77,24 @@ public class ConfigManager {
     public static Setting<HexColor> colorConduits;
     public static Setting<HexColor> colorConduitMobHarmArea;
     public static Setting<HexColor> colorSpawnableBlocks;
-    public static Setting<HexColor> colorJungleTemples;
-    public static Setting<HexColor> colorDesertTemples;
-    public static Setting<HexColor> colorWitchHuts;
-    public static Setting<HexColor> colorOceanMonuments;
-    public static Setting<HexColor> colorShipwrecks;
-    public static Setting<HexColor> colorOceanRuins;
-    public static Setting<HexColor> colorBuriedTreasure;
-    public static Setting<HexColor> colorStrongholds;
-    public static Setting<HexColor> colorMineShafts;
-    public static Setting<HexColor> colorNetherFortresses;
-    public static Setting<HexColor> colorEndCities;
-    public static Setting<HexColor> colorMansions;
-    public static Setting<HexColor> colorIgloos;
-    public static Setting<HexColor> colorPillagerOutposts;
-    public static Setting<HexColor> colorVillages;
-    public static Setting<HexColor> colorNetherFossils;
-    public static Setting<HexColor> colorBastionRemnants;
-    public static Setting<HexColor> colorRuinedPortals;
+//    public static Setting<HexColor> colorJungleTemples;
+//    public static Setting<HexColor> colorDesertTemples;
+//    public static Setting<HexColor> colorWitchHuts;
+//    public static Setting<HexColor> colorOceanMonuments;
+//    public static Setting<HexColor> colorShipwrecks;
+//    public static Setting<HexColor> colorOceanRuins;
+//    public static Setting<HexColor> colorBuriedTreasure;
+//    public static Setting<HexColor> colorStrongholds;
+//    public static Setting<HexColor> colorMineShafts;
+//    public static Setting<HexColor> colorNetherFortresses;
+//    public static Setting<HexColor> colorEndCities;
+//    public static Setting<HexColor> colorMansions;
+//    public static Setting<HexColor> colorIgloos;
+//    public static Setting<HexColor> colorPillagerOutposts;
+//    public static Setting<HexColor> colorVillages;
+//    public static Setting<HexColor> colorNetherFossils;
+//    public static Setting<HexColor> colorBastionRemnants;
+//    public static Setting<HexColor> colorRuinedPortals;
     public static Setting<HexColor> colorFlowerForestDandelion;
     public static Setting<HexColor> colorFlowerForestPoppy;
     public static Setting<HexColor> colorFlowerForestAllium;
@@ -107,10 +112,48 @@ public class ConfigManager {
 
     public static Setting<Integer> fastRender;
 
+    public static Map<String, Setting<Boolean>> structureRenderSettings = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
+    public static Map<String, Setting<HexColor>> structureColorSettings = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
+    private static final Map<String, HexColor> defaultStructureColors = new Object2ObjectOpenHashMap<>();
+
+    static {
+         defaultStructureColors.put("minecraft:fortress", Objects.requireNonNull(HexColor.from("#ff0000")));
+         defaultStructureColors.put("minecraft:village_desert", Objects.requireNonNull(HexColor.from("#800080")));
+         defaultStructureColors.put("minecraft:village_snowy", Objects.requireNonNull(HexColor.from("#800080")));
+         defaultStructureColors.put("minecraft:village_plains", Objects.requireNonNull(HexColor.from("#800080")));
+         defaultStructureColors.put("minecraft:village_savanna", Objects.requireNonNull(HexColor.from("#800080")));
+         defaultStructureColors.put("minecraft:village_taiga", Objects.requireNonNull(HexColor.from("#800080")));
+         defaultStructureColors.put("minecraft:desert_pyramid", Objects.requireNonNull(HexColor.from("#ffc800")));
+         defaultStructureColors.put("minecraft:swamp_hut", Objects.requireNonNull(HexColor.from("#0000ff")));
+         defaultStructureColors.put("minecraft:monument", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:shipwreck", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:shipwreck_beached", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:ocean_ruin_cold", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:ocean_ruin_warm", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:buried_treasure", Objects.requireNonNull(HexColor.from("#00ffff")));
+         defaultStructureColors.put("minecraft:stronghold", Objects.requireNonNull(HexColor.from("#ffff00")));
+         defaultStructureColors.put("minecraft:mineshaft", Objects.requireNonNull(HexColor.from("#c0c0c0")));
+         defaultStructureColors.put("minecraft:end_city", Objects.requireNonNull(HexColor.from("#ff00ff")));
+         defaultStructureColors.put("minecraft:mansion", Objects.requireNonNull(HexColor.from("#8b4513")));
+         defaultStructureColors.put("minecraft:igloo", Objects.requireNonNull(HexColor.from("#ffffff")));
+         defaultStructureColors.put("minecraft:pillager_outpost", Objects.requireNonNull(HexColor.from("#404040")));
+         defaultStructureColors.put("minecraft:nether_fossil", Objects.requireNonNull(HexColor.from("#ffffff")));
+         defaultStructureColors.put("minecraft:bastion_remnant", Objects.requireNonNull(HexColor.from("#c0c0c0")));
+         defaultStructureColors.put("minecraft:ruined_portal", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_desert", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_mountain", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_jungle", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_ocean", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_swamp", Objects.requireNonNull(HexColor.from("#c800ff")));
+         defaultStructureColors.put("minecraft:ruined_portal_nether", Objects.requireNonNull(HexColor.from("#c800ff")));
+    }
+
+    private static Configuration config;
+
     public static void loadConfig() {
         configDir = new File(".", "config");
         configDir.mkdirs();
-        Configuration config = loadConfiguration();
+        config = loadConfiguration();
 
         fill = setup(config, "general", "fill", true, "If set to true the bounding boxes are filled.");
         outerBoxesOnly = setup(config, "general", "outerBoxesOnly", false, "If set to true only the outer bounding boxes are rendered.");
@@ -136,24 +179,24 @@ public class ConfigManager {
 
         drawBedrockCeilingBlocks = setup(config, "bedrockCeiling", "drawBedrockCeilingBlocks", true, "If set to true position with only one layer of bedrock will be drawn.");
 
-        drawVillages = setup(config, "structures", "drawVillages", false, "If set to true village bounding boxes will be drawn.");
-        drawDesertTemples = setup(config, "structures", "drawDesertTemples", true, "If set to true desert temple bounding boxes are drawn.");
-        drawJungleTemples = setup(config, "structures", "drawJungleTemples", true, "If set to true jungle temple bounding boxes are drawn.");
-        drawWitchHuts = setup(config, "structures", "drawWitchHuts", true, "If set to true witch hut bounding boxes are drawn.");
-        drawStrongholds = setup(config, "structures", "drawStrongholds", false, "If set to true stronghold bounding boxes are drawn.");
-        drawMineShafts = setup(config, "structures", "drawMineShafts", false, "If set to true mineshaft bounding boxes are drawn.");
-        drawNetherFortresses = setup(config, "structures", "drawNetherFortresses", true, "If set to true nether fortress bounding boxes are drawn.");
-        drawOceanMonuments = setup(config, "structures", "drawOceanMonuments", true, "If set to true ocean monument bounding boxes are drawn.");
-        drawEndCities = setup(config, "structures", "drawEndCities", true, "If set to true end city bounding boxes will be drawn.");
-        drawMansions = setup(config, "structures", "drawMansions", true, "If set to true woodland mansions will be drawn.");
-        drawIgloos = setup(config, "structures", "drawIgloos", true, "If set to true igloos will be drawn.");
-        drawShipwrecks = setup(config, "structures", "drawShipwrecks", true, "If set to true shipwrecks will be drawn.");
-        drawOceanRuins = setup(config, "structures", "drawOceanRuins", true, "If set to true ocean ruins will be drawn.");
-        drawBuriedTreasure = setup(config, "structures", "drawBuriedTreasures", true, "If set to true buried treasure will be drawn.");
-        drawPillagerOutposts = setup(config, "structures", "drawPillagerOutposts", true, "If set to true pillager outposts will be drawn.");
-        drawNetherFossils = setup(config, "structures", "drawNetherFossils", true, "If set to true nether fossils will be drawn.");
-        drawBastionRemnants = setup(config, "structures", "drawBastionRemnants", true, "If set to true bastion remnants will be drawn.");
-        drawRuinedPortals = setup(config, "structures", "drawRuinedPortals", true, "If set to true ruined portals will be drawn.");
+//        drawVillages = setup(config, "structures", "drawVillages", false, "If set to true village bounding boxes will be drawn.");
+//        drawDesertTemples = setup(config, "structures", "drawDesertTemples", true, "If set to true desert temple bounding boxes are drawn.");
+//        drawJungleTemples = setup(config, "structures", "drawJungleTemples", true, "If set to true jungle temple bounding boxes are drawn.");
+//        drawWitchHuts = setup(config, "structures", "drawWitchHuts", true, "If set to true witch hut bounding boxes are drawn.");
+//        drawStrongholds = setup(config, "structures", "drawStrongholds", false, "If set to true stronghold bounding boxes are drawn.");
+//        drawMineShafts = setup(config, "structures", "drawMineShafts", false, "If set to true mineshaft bounding boxes are drawn.");
+//        drawNetherFortresses = setup(config, "structures", "drawNetherFortresses", true, "If set to true nether fortress bounding boxes are drawn.");
+//        drawOceanMonuments = setup(config, "structures", "drawOceanMonuments", true, "If set to true ocean monument bounding boxes are drawn.");
+//        drawEndCities = setup(config, "structures", "drawEndCities", true, "If set to true end city bounding boxes will be drawn.");
+//        drawMansions = setup(config, "structures", "drawMansions", true, "If set to true woodland mansions will be drawn.");
+//        drawIgloos = setup(config, "structures", "drawIgloos", true, "If set to true igloos will be drawn.");
+//        drawShipwrecks = setup(config, "structures", "drawShipwrecks", true, "If set to true shipwrecks will be drawn.");
+//        drawOceanRuins = setup(config, "structures", "drawOceanRuins", true, "If set to true ocean ruins will be drawn.");
+//        drawBuriedTreasure = setup(config, "structures", "drawBuriedTreasures", true, "If set to true buried treasure will be drawn.");
+//        drawPillagerOutposts = setup(config, "structures", "drawPillagerOutposts", true, "If set to true pillager outposts will be drawn.");
+//        drawNetherFossils = setup(config, "structures", "drawNetherFossils", true, "If set to true nether fossils will be drawn.");
+//        drawBastionRemnants = setup(config, "structures", "drawBastionRemnants", true, "If set to true bastion remnants will be drawn.");
+//        drawRuinedPortals = setup(config, "structures", "drawRuinedPortals", true, "If set to true ruined portals will be drawn.");
 
         drawSlimeChunks = setup(config, "slimeChunks", "drawSlimeChunks", true, "If set to true slime chunks bounding boxes are drawn.");
         slimeChunkMaxY = setup(config, "slimeChunks", "slimeChunkMaxY", -1, "The maximum top of the slime chunk bounding box. If set to -1 it will use the value when activated, if set to 0 it will always track the player's feet.");
@@ -189,24 +232,24 @@ public class ConfigManager {
         colorConduits = setup(config, "colors", "colorConduits", HexColor.from("#00ffff"), "Color of conduit bounding spheres.");
         colorConduitMobHarmArea = setup(config, "colors", "colorConduitMobHarmArea", HexColor.from("#ff7f00"), "Color of conduit mob harm bounding boxes.");
         colorSpawnableBlocks = setup(config, "colors", "colorSpawnableBlocks", HexColor.from("#ff0000"), "Color of spawnable blocks.");
-        colorJungleTemples = setup(config, "colors", "colorJungleTemples", HexColor.from("#006000"), "Color of jungle temple bounding boxes.");
-        colorDesertTemples = setup(config, "colors", "colorDesertTemples", HexColor.from("#ffc800"), "Color of desert temple bounding boxes.");
-        colorWitchHuts = setup(config, "colors", "colorWitchHuts", HexColor.from("#0000ff"), "Color of witch hut bounding boxes.");
-        colorOceanMonuments = setup(config, "colors", "colorOceanMonuments", HexColor.from("#00ffff"), "Color of ocean monument bounding boxes.");
-        colorShipwrecks = setup(config, "colors", "colorShipwrecks", HexColor.from("#00ffff"), "Color of ship wrecks.");
-        colorOceanRuins = setup(config, "colors", "colorOceanRuins", HexColor.from("#00ffff"), "Color of ocean ruins.");
-        colorBuriedTreasure = setup(config, "colors", "colorBuriedTreasure", HexColor.from("#00ffff"), "Color of buried treasure.");
-        colorStrongholds = setup(config, "colors", "colorStrongholds", HexColor.from("#ffff00"), "Color of stronghold bounding boxes.");
-        colorMineShafts = setup(config, "colors", "colorMineShafts", HexColor.from("#c0c0c0"), "Color of mineshaft bounding boxes.");
-        colorNetherFortresses = setup(config, "colors", "colorNetherFortresses", HexColor.from("#ff0000"), "Color of nether fortress bounding boxes.");
-        colorEndCities = setup(config, "colors", "colorEndCities", HexColor.from("#ff00ff"), "Color of end cities.");
-        colorMansions = setup(config, "colors", "colorMansions", HexColor.from("#8b4513"), "Color of woodland mansions.");
-        colorIgloos = setup(config, "colors", "colorIgloos", HexColor.from("#ffffff"), "Color of igloos.");
-        colorPillagerOutposts = setup(config, "colors", "colorPillagerOutposts", HexColor.from("#404040"), "Color of pillager outposts.");
-        colorVillages = setup(config, "colors", "colorVillages", HexColor.from("#800080"), "Color of village bounding boxes.");
-        colorNetherFossils = setup(config, "colors", "colorNetherFossils", HexColor.from("#ffffff"), "Color of nether fossils.");
-        colorBastionRemnants = setup(config, "colors", "colorBastionRemnants", HexColor.from("#c0c0c0"), "Color of bastion remnants.");
-        colorRuinedPortals = setup(config, "colors", "colorRuinedPortals", HexColor.from("#c800ff"), "Color of ruined portals.");
+//        colorJungleTemples = setup(config, "colors", "colorJungleTemples", HexColor.from("#006000"), "Color of jungle temple bounding boxes.");
+//        colorDesertTemples = setup(config, "colors", "colorDesertTemples", HexColor.from("#ffc800"), "Color of desert temple bounding boxes.");
+//        colorWitchHuts = setup(config, "colors", "colorWitchHuts", HexColor.from("#0000ff"), "Color of witch hut bounding boxes.");
+//        colorOceanMonuments = setup(config, "colors", "colorOceanMonuments", HexColor.from("#00ffff"), "Color of ocean monument bounding boxes.");
+//        colorShipwrecks = setup(config, "colors", "colorShipwrecks", HexColor.from("#00ffff"), "Color of ship wrecks.");
+//        colorOceanRuins = setup(config, "colors", "colorOceanRuins", HexColor.from("#00ffff"), "Color of ocean ruins.");
+//        colorBuriedTreasure = setup(config, "colors", "colorBuriedTreasure", HexColor.from("#00ffff"), "Color of buried treasure.");
+//        colorStrongholds = setup(config, "colors", "colorStrongholds", HexColor.from("#ffff00"), "Color of stronghold bounding boxes.");
+//        colorMineShafts = setup(config, "colors", "colorMineShafts", HexColor.from("#c0c0c0"), "Color of mineshaft bounding boxes.");
+//        colorNetherFortresses = setup(config, "colors", "colorNetherFortresses", HexColor.from("#ff0000"), "Color of nether fortress bounding boxes.");
+//        colorEndCities = setup(config, "colors", "colorEndCities", HexColor.from("#ff00ff"), "Color of end cities.");
+//        colorMansions = setup(config, "colors", "colorMansions", HexColor.from("#8b4513"), "Color of woodland mansions.");
+//        colorIgloos = setup(config, "colors", "colorIgloos", HexColor.from("#ffffff"), "Color of igloos.");
+//        colorPillagerOutposts = setup(config, "colors", "colorPillagerOutposts", HexColor.from("#404040"), "Color of pillager outposts.");
+//        colorVillages = setup(config, "colors", "colorVillages", HexColor.from("#800080"), "Color of village bounding boxes.");
+//        colorNetherFossils = setup(config, "colors", "colorNetherFossils", HexColor.from("#ffffff"), "Color of nether fossils.");
+//        colorBastionRemnants = setup(config, "colors", "colorBastionRemnants", HexColor.from("#c0c0c0"), "Color of bastion remnants.");
+//        colorRuinedPortals = setup(config, "colors", "colorRuinedPortals", HexColor.from("#c800ff"), "Color of ruined portals.");
         colorFlowerForestDandelion = setup(config, "colors", "colorFlowerForestDandelion", HexColor.from("#ffff00"), "Color of Flower Forest Dandelion");
         colorFlowerForestPoppy = setup(config, "colors", "colorFlowerForestPoppy", HexColor.from("#ff0000"), "Color of Flower Forest Poppy");
         colorFlowerForestAllium = setup(config, "colors", "colorFlowerForestAllium", HexColor.from("#ff00ff"), "Color of Flower Forest Allium");
@@ -236,6 +279,18 @@ public class ConfigManager {
         config.save();
     }
 
+    public static Setting<Boolean> structureShouldRender(String key) {
+        final Setting<Boolean> setting = structureRenderSettings.put(key, setup(config, "structures", "drawStructure_" + key.replace(':', '_'), true, "If set to true structure %s bounding boxes will be drawn.".formatted(key)));
+        saveConfig();
+        return setting;
+    }
+
+    public static Setting<HexColor> structureColor(String key) {
+        final Setting<HexColor> setting = structureColorSettings.put(key, setup(config, "colors", "colorStructure_" + key.replace(':', '_'), defaultStructureColors.getOrDefault(key, HexColor.from("#ffffff")), "Color if structure %s bounding boxes.".formatted(key)));
+        saveConfig();
+        return setting;
+    }
+
     private static <T> Setting<T> setup(Configuration config, String category, String settingName, T defaultValue, String comment) {
         Setting<T> setting = config.get(category, settingName, defaultValue);
         setting.category = category;
index f27e394c750d2732466008cdb91b10bc141aeb52..ac4f23c75b6640e6a284ce3f9e52e4ad86a193fb 100644 (file)
@@ -311,7 +311,12 @@ public class ControlList extends DrawableHelper implements IControlSet {
     }
 
     ControlList section(String title, CreateControl... createControls) {
-        this.add(new ControlListSection(title, createControls));
+        this.add(new ControlListSection(title, -1, createControls));
+        return this;
+    }
+
+    ControlList section(String title, int columnCount, CreateControl... createControls) {
+        this.add(new ControlListSection(title, columnCount, createControls));
         return this;
     }
 
index 9cab24f5e138ec093edfbac22d3d7b722cfd452c..ca32696c7a2984dc4801cfa888ad2b7f76ece3e7 100644 (file)
@@ -16,12 +16,12 @@ public class ControlListSection extends ControlListEntry implements IControlSet
     private IControl focused;
     private boolean dragging;
 
-    ControlListSection(String title, CreateControl... createControls) {
+    ControlListSection(String title, int columnCount, CreateControl... createControls) {
         this.title = title;
         this.titleHeight = title != null ? TITLE_HEIGHT : 0;
         this.height = titleHeight;
 
-        int columnCount = columnCount();
+        if (columnCount == -1) columnCount = defaultColumnCount();
         int controlWidth = (ControlList.CONTROLS_WIDTH - ((columnCount - 1) * 4)) / columnCount;
 
         int column = 0;
@@ -37,7 +37,7 @@ public class ControlListSection extends ControlListEntry implements IControlSet
         }
     }
 
-    private int columnCount() {
+    private int defaultColumnCount() {
         switch (minecraft.getLanguageManager().getLanguage().getCode()) {
             case "en_au":
             case "en_us":
index f4f3dc1d8e3b0267d039b18095892f215ec515ce..f85c54328dd7a2c67e9086b73a776706d94402e5 100644 (file)
@@ -4,6 +4,7 @@ import com.irtimaled.bbor.client.ClientRenderer;
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.irtimaled.bbor.common.BoundingBoxType;
+import com.irtimaled.bbor.common.StructureProcessor;
 import net.minecraft.SharedConstants;
 import net.minecraft.client.gui.screen.Screen;
 import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
@@ -107,25 +108,17 @@ public class SettingsScreen extends ListScreen {
                 .section(I18n.translate("bbor.features.spawningSpheres"),
                         width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
                         width -> new BoolSettingButton(width, I18n.translate("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
-                .section(I18n.translate("bbor.tabs.structures"),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mansions"), BoundingBoxType.Mansion),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.igloos"), BoundingBoxType.Igloo),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.villages"), BoundingBoxType.Village),
-                        width -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
-                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
-                        width -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
-                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
-                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.endCities"), BoundingBoxType.EndCity));
+                .section(I18n.translate("bbor.tabs.structures"), 2,
+                        generateStructureControls());
         return controlList;
     }
+
+    private CreateControl[] generateStructureControls() {
+        return StructureProcessor.supportedStructureIds
+                .stream()
+                .map(key -> (CreateControl) (width -> new BoundingBoxTypeButton(width, key, BoundingBoxType.getByNameHash(("structure:" + key).hashCode()))))
+                .distinct()
+                .toArray(CreateControl[]::new);
+    }
+
 }
index 5dd29e0a88d4dbecab29183de828a62c595fda94..1434f3a54015586ebb5e819ce624a85d2175c4d4 100644 (file)
@@ -35,7 +35,7 @@ public class BiomeBorderHelper {
         final ClientWorld world = MinecraftClient.getInstance().world;
         return biomeArray.computeIfAbsent(pos.asLong(), key -> {
             assert world != null;
-            return world.getRegistryManager().get(Registry.BIOME_KEY).getRawId(world.getBiome(pos));
+            return world.getRegistryManager().get(Registry.BIOME_KEY).getRawId(world.getBiome(pos).value());
         });
     }
 
index ed1d486dffbf6c5bdc8aa3130788f4f814c13137..f15f4f9ecea57e0ed346c94bb5c59aebb7c87c70 100644 (file)
@@ -4,7 +4,6 @@ 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;
@@ -44,9 +43,9 @@ 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);
-        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();
+        final PlacedFeature placedFeature = VegetationConfiguredFeatures.FLOWER_FLOWER_FOREST.value().config().feature().value();
+        final var configuredFeature = (ConfiguredFeature<SimpleBlockFeatureConfig, SimpleBlockFeature>) placedFeature.feature().value();
+        blockStateProvider = configuredFeature.config().toPlace();
     }
 
     public static Setting<HexColor> getFlowerColorAtPos(Coords coords) {
index c6ab45cc8fa74f2e2b06438ed3510bea90c71762..d8c81438a2b0284becaadeac912dd6a3b9b1ee19 100644 (file)
@@ -21,7 +21,6 @@ import net.minecraft.world.World;
 import net.minecraft.world.dimension.DimensionType;
 import net.minecraft.world.gen.StructureAccessor;
 import net.minecraft.world.gen.chunk.ChunkGenerator;
-import net.minecraft.world.gen.feature.FeatureConfig;
 import net.minecraft.world.level.storage.LevelStorage;
 import net.minecraft.world.storage.RegionBasedStorage;
 
@@ -110,7 +109,7 @@ class NBTStructureLoader {
         NbtCompound structureStarts = loadStructureStarts(chunkX, chunkZ);
         if (structureStarts == null || structureStarts.getSize() == 0) return;
 
-        Map<String, StructureStart<?>> structureStartMap = new HashMap<>();
+        Map<String, StructureStart> structureStartMap = new HashMap<>();
         for (String key : structureStarts.getKeys()) {
             NbtCompound compound = structureStarts.getCompound(key);
             if (compound.contains("BB")) {
@@ -121,7 +120,7 @@ class NBTStructureLoader {
         EventBus.publish(new StructuresLoaded(structureStartMap, dimensionId));
     }
 
-    private static class SimpleStructureStart extends StructureStart<FeatureConfig> {
+    private static class SimpleStructureStart extends StructureStart {
         private final BlockBox parsedBoundingBox;
 
         SimpleStructureStart(NbtCompound compound) {
index 99d3371e3f7fd75eef64970cc2868e8268234adc..6d44fcd1edc2bcd3749020b7f97179610f157f26 100644 (file)
@@ -1,6 +1,7 @@
 package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.common.models.Coords;
+import com.irtimaled.bbor.mixin.access.IBiome;
 import net.minecraft.block.Block;
 import net.minecraft.block.BlockState;
 import net.minecraft.client.MinecraftClient;
@@ -49,9 +50,9 @@ public class SpawnableBlocksHelper {
 
     static boolean isSpawnable(World world, BlockPos pos, BlockState spawnBlockState, BlockState upperBlockState) {
         VoxelShape collisionShape = upperBlockState.getCollisionShape(world, pos);
-        Biome biome = world.getBiome(pos);
-        boolean isNether = biome.getCategory() == Biome.Category.NETHER;
-        return biome.getCategory() != Biome.Category.MUSHROOM &&
+        Biome biome = world.getBiome(pos).value();
+        boolean isNether = ((IBiome) biome).bbor$getCategory() == Biome.Category.NETHER;
+        return ((IBiome) biome).bbor$getCategory() != Biome.Category.MUSHROOM &&
                 spawnBlockState.allowsSpawning(world, pos.down(), isNether ? EntityType.ZOMBIFIED_PIGLIN : entityType) &&
                 !Block.isFaceFullSquare(collisionShape, Direction.UP) &&
                 !upperBlockState.emitsRedstonePower() &&
index aea5916e973628f64f468e0a0e3d0a1631c81969..102c7550781f9ce7adbde4376f61223ed30fa83b 100644 (file)
@@ -97,7 +97,7 @@ public class Renderer {
 
     public void render() {
         if (glMode == VertexFormat.DrawMode.QUADS) {
-            bufferBuilder.setCameraPosition((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ());
+            bufferBuilder.sortFrom((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ());
         }
         tessellator.draw();
         matrixStack.pop();
index 38850f8c4f35e9f1affe9358f6a90511588e27d0..c273d74f8ed2e7dc924866070ebd37dab4ad53c3 100644 (file)
@@ -1,10 +1,13 @@
 package com.irtimaled.bbor.common;
 
+import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+
 import java.util.HashMap;
 import java.util.Map;
 
 public class BoundingBoxType {
-    private static final Map<Integer, BoundingBoxType> structureTypeMap = new HashMap<>();
+    private static final Map<Integer, BoundingBoxType> structureTypeMap = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
 
     public static final BoundingBoxType WorldSpawn = register("World_Spawn");
     public static final BoundingBoxType SpawnChunks = register("Spawn_Chunks");
@@ -20,26 +23,9 @@ public class BoundingBoxType {
     public static final BoundingBoxType FlowerForest = register("Flower Forest");
     public static final BoundingBoxType BedrockCeiling = register("Bedrock Ceiling");
 
-    public static final BoundingBoxType JungleTemple = register("jungle_pyramid");
-    public static final BoundingBoxType DesertTemple = register("desert_pyramid");
-    public static final BoundingBoxType WitchHut = register("swamp_hut");
-    public static final BoundingBoxType OceanMonument = register("monument");
-    public static final BoundingBoxType Shipwreck = register("shipwreck");
-    public static final BoundingBoxType OceanRuin = register("ocean_ruin");
-    public static final BoundingBoxType BuriedTreasure = register("buried_treasure");
-    public static final BoundingBoxType Stronghold = register("stronghold");
-    public static final BoundingBoxType MineShaft = register("mineshaft");
-    public static final BoundingBoxType NetherFortress = register("fortress");
-    public static final BoundingBoxType EndCity = register("endcity");
-    public static final BoundingBoxType Mansion = register("mansion");
-    public static final BoundingBoxType Igloo = register("igloo");
-    public static final BoundingBoxType PillagerOutpost = register("pillager_outpost");
-    public static final BoundingBoxType Village = register("village");
-    public static final BoundingBoxType NetherFossil = register("nether_fossil");
-    public static final BoundingBoxType BastionRemnant = register("bastion_remnant");
-    public static final BoundingBoxType RuinedPortal = register("ruined_portal");
+    public static final Map<String, BoundingBoxType> structures = new HashMap<>();
 
-    private static BoundingBoxType register(String name) {
+    public static BoundingBoxType register(String name) {
         return structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(name));
     }
 
index f1681cec64f5d14e6ed38933224919d68caef74b..de83f67cfa8fe1329573803f87b51652f99b5ed6 100644 (file)
@@ -4,6 +4,10 @@ import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxCuboid;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.mixin.access.IStructureStart;
+import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
+import it.unimi.dsi.fastutil.objects.ObjectSets;
 import net.minecraft.structure.StructurePiece;
 import net.minecraft.structure.StructureStart;
 import net.minecraft.util.math.BlockBox;
@@ -12,11 +16,12 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-class StructureProcessor {
-    private static final Set<BoundingBoxType> supportedStructures = new HashSet<>();
+public class StructureProcessor {
+    private static final Map<String, BoundingBoxType> supportedStructures = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
+    public static final Set<String> supportedStructureIds = ObjectSets.synchronize(new ObjectOpenHashSet<>());
 
-    static void registerSupportedStructure(BoundingBoxType type) {
-        supportedStructures.add(type);
+    public static void registerSupportedStructure(BoundingBoxType type) {
+        supportedStructures.put(type.getName(), type);
     }
 
     StructureProcessor(BoundingBoxCache boundingBoxCache) {
@@ -25,7 +30,7 @@ class StructureProcessor {
 
     private final BoundingBoxCache boundingBoxCache;
 
-    private void addStructures(BoundingBoxType type, StructureStart<?> structureStart) {
+    private void addStructures(BoundingBoxType type, StructureStart structureStart) {
         if (structureStart == null) return;
 
         try {
@@ -52,9 +57,12 @@ class StructureProcessor {
         return BoundingBoxCuboid.from(min, max, type);
     }
 
-    void process(Map<String, StructureStart<?>> structures) {
-        if (structures.size() > 0) {
-            supportedStructures.forEach(type -> addStructures(type, structures.get(type.getName())));
+    void process(Map<String, StructureStart> structures) {
+        for (Map.Entry<String, StructureStart> entry : structures.entrySet()) {
+            final BoundingBoxType type = supportedStructures.get("structure:" + entry.getKey());
+            if (type != null) {
+                addStructures(type, entry.getValue());
+            }
         }
     }
 }
index 32b5016c89f248c7650ea927cbe9c2aa81f7b30c..1d03c50ab9343059d071b3c235c1b6502e841839 100644 (file)
@@ -6,15 +6,15 @@ import net.minecraft.structure.StructureStart;
 import java.util.Map;
 
 public class StructuresLoaded {
-    private final Map<String, StructureStart<?>> structures;
+    private final Map<String, StructureStart> structures;
     private final DimensionId dimensionId;
 
-    public StructuresLoaded(Map<String, StructureStart<?>> structures, DimensionId dimensionId) {
+    public StructuresLoaded(Map<String, StructureStart> structures, DimensionId dimensionId) {
         this.structures = structures;
         this.dimensionId = dimensionId;
     }
 
-    public Map<String, StructureStart<?>> getStructures() {
+    public Map<String, StructureStart> getStructures() {
         return structures;
     }
 
index 321c4c7d2db50a1a995c92c3f0921af27ae5f66b..b2daee13745286a11ae4ed4635a3a7606f510c3c 100644 (file)
@@ -1,8 +1,12 @@
 package com.irtimaled.bbor.common.interop;
 
 import com.irtimaled.bbor.client.ClientRenderer;
+import com.irtimaled.bbor.client.config.BoundingBoxTypeHelper;
+import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.renderers.AbstractRenderer;
+import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.common.StructureProcessor;
 import com.irtimaled.bbor.common.events.PlayerLoggedIn;
 import com.irtimaled.bbor.common.events.PlayerLoggedOut;
 import com.irtimaled.bbor.common.events.PlayerSubscribed;
@@ -19,24 +23,48 @@ import net.minecraft.server.network.ServerPlayNetworkHandler;
 import net.minecraft.server.network.ServerPlayerEntity;
 import net.minecraft.server.world.ServerWorld;
 import net.minecraft.structure.StructureStart;
+import net.minecraft.util.Identifier;
+import net.minecraft.util.registry.Registry;
+import net.minecraft.util.registry.RegistryKey;
+import net.minecraft.world.World;
 import net.minecraft.world.chunk.WorldChunk;
+import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.function.Supplier;
 
 public class CommonInterop {
     public static void chunkLoaded(WorldChunk chunk) {
         DimensionId dimensionId = DimensionId.from(chunk.getWorld().getRegistryKey());
-        Map<String, StructureStart<?>> structures = new HashMap<>();
-        chunk.getStructureStarts().entrySet().forEach(es -> structures.put(es.getKey().getName(), es.getValue()));
+        Map<String, StructureStart> structures = new HashMap<>();
+        final Registry<ConfiguredStructureFeature<?, ?>> structureFeatureRegistry = chunk.getWorld().getRegistryManager().get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY);
+        for (Map.Entry<ConfiguredStructureFeature<?, ?>, StructureStart> es : chunk.getStructureStarts().entrySet()) {
+            final Optional<RegistryKey<ConfiguredStructureFeature<?, ?>>> optional = structureFeatureRegistry.getKey(es.getKey());
+            optional.ifPresent(key -> structures.put(key.getValue().toString(), es.getValue()));
+        }
         if (structures.size() > 0) EventBus.publish(new StructuresLoaded(structures, dimensionId));
     }
 
     public static void loadWorlds(Collection<ServerWorld> worlds) {
         for (ServerWorld world : worlds) {
             loadWorld(world);
+            loadWorldStructures(world);
+        }
+    }
+
+    public static void loadWorldStructures(World world) {
+        final Registry<ConfiguredStructureFeature<?, ?>> structureFeatureRegistry = world.getRegistryManager().get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY);
+        System.out.println("Registring structures: " + Arrays.toString(structureFeatureRegistry.getEntrySet().stream().map(entry -> entry.getKey().getValue().toString()).distinct().toArray(String[]::new)));
+        for (var entry : structureFeatureRegistry.getEntrySet()) {
+            final Identifier value = entry.getKey().getValue();
+            final BoundingBoxType boundingBoxType = BoundingBoxType.register("structure:" + value);
+            StructureProcessor.registerSupportedStructure(boundingBoxType);
+            StructureProcessor.supportedStructureIds.add(value.toString());
+            BoundingBoxTypeHelper.registerType(boundingBoxType, ConfigManager.structureShouldRender(value.toString()), ConfigManager.structureColor(value.toString()));
         }
     }
 
diff --git a/src/main/java/com/irtimaled/bbor/mixin/access/IBiome.java b/src/main/java/com/irtimaled/bbor/mixin/access/IBiome.java
new file mode 100644 (file)
index 0000000..9493c63
--- /dev/null
@@ -0,0 +1,13 @@
+package com.irtimaled.bbor.mixin.access;
+
+import net.minecraft.world.biome.Biome;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(Biome.class)
+public interface IBiome {
+
+    @Accessor("category")
+    Biome.Category bbor$getCategory();
+
+}
diff --git a/src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java b/src/main/java/com/irtimaled/bbor/mixin/access/IPlacedFeature.java
deleted file mode 100644 (file)
index 1fca3d9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-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 fc3691a7d7718635c9d0b310eb0c1e371aa469f2..5333d6e9ced0570b058c851fa236e60806fb08a6 100644 (file)
@@ -15,18 +15,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(GameOptions.class)
 public abstract class MixinGameSettings {
-    @Mutable
-    @Final
-    @Shadow
-    public KeyBinding[] keysAll;
 
     @Shadow
     public abstract void load();
 
+    @Mutable
+    @Shadow @Final public KeyBinding[] allKeys;
+
     @Inject(method = "<init>", at = @At("RETURN"))
     private void init(CallbackInfo ci) {
         ClientProxy.registerKeyBindings();
-        keysAll = ArrayUtils.addAll(keysAll, KeyListener.keyBindings());
+        allKeys = ArrayUtils.addAll(allKeys, KeyListener.keyBindings());
         this.load();
     }
 }
index 5e30839db759930a5efa7b4bfaec7ca2615fe569..dfa2f41a43927366506225643cf9b3855c9f45e4 100644 (file)
@@ -1,8 +1,10 @@
 package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.RunArgs;
+import net.minecraft.client.world.ClientWorld;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
@@ -15,4 +17,9 @@ public abstract class MixinMinecraft {
         new ClientProxy().init();
     }
 
+    @Inject(method = "joinWorld", at = @At("RETURN"))
+    private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
+        CommonInterop.loadWorldStructures(world);
+    }
+
 }
index 5003bff443c0879117f0bde59d9921f6bcbc6abb..94f5e6993e8d5054258d8c19612b59ccde4ab50d 100644 (file)
@@ -35,7 +35,7 @@ public class MixinResourcePackManager {
                 ResourcePackSource.PACK_SOURCE_BUILTIN);
     }
 
-    @Redirect(method = "providePackProfiles", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap;copyOf(Ljava/util/Map;)Lcom/google/common/collect/ImmutableMap;"))
+    @Redirect(method = "providePackProfiles", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap;copyOf(Ljava/util/Map;)Lcom/google/common/collect/ImmutableMap;", remap = false))
     private ImmutableMap<String, ResourcePackProfile> beforeReturn(Map<String, ResourcePackProfile> map) {
         map.put(BBOR, resourcePackProfile);
         return ImmutableMap.copyOf(map);
index 2074ef3175dd30e99d870531e12dc7a7f564a5cb..b836b81a3786b830690085e8a2e50ffd60e3aba0 100644 (file)
@@ -3,3 +3,4 @@ accessWidener v1 named
 accessible    class    net/minecraft/client/world/ClientChunkManager$ClientChunkMap
 
 extendable    class    net/minecraft/structure/StructureStart
+extendable    class    net/minecraft/world/biome/Biome
index b0684b684fb997e6a2aa813424f4a1c4039fcad1..8aee69244df8b42533b87b44d2e03fadab63c8f5 100644 (file)
@@ -6,7 +6,7 @@
   "package": "com.irtimaled.bbor.mixin",
   "mixins": [
     "access.IBeaconBlockEntity",
-    "access.IPlacedFeature",
+    "access.IBiome",
     "access.IStructureStart",
     "client.renderer.MixinDebugHud",
     "client.renderer.MixinWorldRenderer",
index 1c6cd51f9d740401cd16d26c9483823ed5141c38..97257b6fb38d8fa0bc9c530b893ebfde5a30dbdd 100644 (file)
@@ -12,6 +12,6 @@
     "bbor.mixins.json"
   ],
   "depends": {
-    "minecraft": ">=1.18.1"
+    "minecraft": ">=1.18.2-rc.1"
   }
 }