- cameron-gagnon
- plusls
- LoupDuQc
+- OroArmor
import com.irtimaled.bbor.client.events.*;
import com.irtimaled.bbor.client.gui.LoadSavesScreen;
import com.irtimaled.bbor.client.gui.SettingsScreen;
+import com.irtimaled.bbor.client.interop.FlowerForestHelper;
import com.irtimaled.bbor.client.keyboard.Key;
import com.irtimaled.bbor.client.keyboard.KeyListener;
import com.irtimaled.bbor.client.providers.*;
protected void setSeed(long seed) {
super.setSeed(seed);
SlimeChunkProvider.setSeed(seed);
+ FlowerForestHelper.setSeed(seed);
}
@Override
registerRenderer(BoundingBoxSpawnableBlocks.class, new SpawnableBlocksRenderer());
registerRenderer(BoundingBoxLine.class, new LineRenderer());
registerRenderer(BoundingBoxSphere.class, new SphereRenderer());
+ registerRenderer(BoundingBoxFlowerForest.class, new FlowerForestRenderer());
registerProvider(new SlimeChunkProvider());
registerProvider(new WorldSpawnProvider());
registerProvider(new SpawnableBlocksProvider());
registerProvider(new CustomLineProvider());
registerProvider(new CustomSphereProvider());
+ registerProvider(new FlowerForestProvider());
}
public static <T extends AbstractBoundingBox> void registerProvider(IBoundingBoxProvider<T> provider) {
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.JungleTemple, ConfigManager.drawJungleTemples, ConfigManager.colorJungleTemples);
registerType(BoundingBoxType.DesertTemple, ConfigManager.drawDesertTemples, ConfigManager.colorDesertTemples);
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<HexColor> colorWorldSpawn;
public static Setting<HexColor> colorLazySpawnChunks;
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;
+ public static Setting<HexColor> colorFlowerForestAzureBluet;
+ public static Setting<HexColor> colorFlowerForestRedTulip;
+ public static Setting<HexColor> colorFlowerForestOrangeTulip;
+ public static Setting<HexColor> colorFlowerForestWhiteTulip;
+ public static Setting<HexColor> colorFlowerForestPinkTulip;
+ public static Setting<HexColor> colorFlowerForestOxeyeDaisy;
+ public static Setting<HexColor> colorFlowerForestCornflower;
+ public static Setting<HexColor> colorFlowerForestLilyOfTheValley;
public static Setting<HexColor> buttonOnOverlay;
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.");
+
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.");
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");
+ colorFlowerForestAzureBluet = setup(config, "colors", "colorFlowerForestAzureBluet", HexColor.from("#d3d3d3"), "Color of Flower Forest Azure Bluet");
+ colorFlowerForestRedTulip = setup(config, "colors", "colorFlowerForestRedTulip", HexColor.from("#ff0000"), "Color of Flower Forest Red Tulip");
+ colorFlowerForestOrangeTulip = setup(config, "colors", "colorFlowerForestOrangeTulip", HexColor.from("#ff681f"), "Color of Flower Forest Orange Tulip");
+ colorFlowerForestWhiteTulip = setup(config, "colors", "colorFlowerForestWhiteTulip", HexColor.from("#d3d3d3"), "Color of Flower Forest White Tulip");
+ colorFlowerForestPinkTulip = setup(config, "colors", "colorFlowerForestPinkTulip", HexColor.from("#ff69b4"), "Color of Flower Forest Pink Tulip");
+ colorFlowerForestOxeyeDaisy = setup(config, "colors", "colorFlowerForestOxeyeDaisy", HexColor.from("#d3d3d3"), "Color of Flower Forest Oxeye Daisy");
+ colorFlowerForestCornflower = setup(config, "colors", "colorFlowerForestCornflower", HexColor.from("#0000ff"), "Color of Flower Forest Cornflower");
+ colorFlowerForestLilyOfTheValley = setup(config, "colors", "colorFlowerForestLilyOfTheValley", HexColor.from("#ffffff"), "Color of Flower Forest Lily Of The Valley");
config.save();
}
.addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
.addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
.addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
+ .section(I18n.format("bbor.features.flowerForests"),
+ width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
+ width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.flowerForestsRenderDistance)
+ .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
+ .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
+ .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
.section(I18n.format("bbor.features.mobSpawners"),
width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
width -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
--- /dev/null
+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 net.minecraft.block.BlockState;
+import net.minecraft.block.Blocks;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.biome.Biomes;
+import net.minecraft.world.gen.feature.DecoratedFeatureConfig;
+import net.minecraft.world.gen.feature.FlowersFeature;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+public class FlowerForestHelper {
+ private static final Random random = new Random();
+
+ private static final Map<BlockState, Setting<HexColor>> flowerColorMap = new HashMap<>();
+ private static final FlowersFeature flowersFeature;
+
+ static {
+ flowerColorMap.put(Blocks.DANDELION.getDefaultState(), ConfigManager.colorFlowerForestDandelion);
+ flowerColorMap.put(Blocks.POPPY.getDefaultState(), ConfigManager.colorFlowerForestPoppy);
+ flowerColorMap.put(Blocks.ALLIUM.getDefaultState(), ConfigManager.colorFlowerForestAllium);
+ flowerColorMap.put(Blocks.AZURE_BLUET.getDefaultState(), ConfigManager.colorFlowerForestAzureBluet);
+ flowerColorMap.put(Blocks.RED_TULIP.getDefaultState(), ConfigManager.colorFlowerForestRedTulip);
+ flowerColorMap.put(Blocks.ORANGE_TULIP.getDefaultState(), ConfigManager.colorFlowerForestOrangeTulip);
+ flowerColorMap.put(Blocks.WHITE_TULIP.getDefaultState(), ConfigManager.colorFlowerForestWhiteTulip);
+ flowerColorMap.put(Blocks.PINK_TULIP.getDefaultState(), ConfigManager.colorFlowerForestPinkTulip);
+ 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);
+
+ DecoratedFeatureConfig config = (DecoratedFeatureConfig) Biomes.FLOWER_FOREST.getFlowers().get(0).config;
+ flowersFeature = (FlowersFeature) config.feature.feature;
+ }
+
+ public static Setting<HexColor> getFlowerColorAtPos(Coords coords) {
+ int x = coords.getX();
+ int z = coords.getZ();
+ BlockState blockState = flowersFeature.getRandomFlower(random, new BlockPos(x, coords.getY(), z));
+ return flowerColorMap.get(blockState);
+ }
+
+ public static void setSeed(long seed) {
+ random.setSeed(seed);
+ }
+
+ public static boolean canGrowFlower(int x, int y, int z) {
+ return Minecraft.getInstance().world.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.GRASS_BLOCK;
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.client.models;
+
+import com.irtimaled.bbor.client.config.ColorHelper;
+import com.irtimaled.bbor.client.config.HexColor;
+import com.irtimaled.bbor.client.config.Setting;
+import com.irtimaled.bbor.common.BoundingBoxType;
+import com.irtimaled.bbor.common.models.AbstractBoundingBox;
+import com.irtimaled.bbor.common.models.Coords;
+
+import java.awt.*;
+
+public class BoundingBoxFlowerForest extends AbstractBoundingBox {
+ private final Coords coords;
+ private final Setting<HexColor> colorSetting;
+
+ public BoundingBoxFlowerForest(Coords coords, Setting<HexColor> colorSetting) {
+ super(BoundingBoxType.FlowerForest);
+ this.coords = coords;
+ this.colorSetting = colorSetting;
+ }
+
+ @Override
+ public Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ) {
+ return coords.getX() >= minX && coords.getZ() >= minZ && coords.getX() <= maxX && coords.getZ() <= maxZ;
+ }
+
+ public Color getColor() {
+ return ColorHelper.getColor(colorSetting);
+ }
+
+ public Coords getCoords() {
+ return coords;
+ }
+
+ @Override
+ public double getDistanceX(double x) {
+ return x - coords.getX();
+ }
+
+ @Override
+ public double getDistanceY(double y) {
+ return y - coords.getY();
+ }
+
+ @Override
+ public double getDistanceZ(double z) {
+ return z - coords.getZ();
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.client.providers;
+
+import com.irtimaled.bbor.client.Player;
+import com.irtimaled.bbor.client.config.BoundingBoxTypeHelper;
+import com.irtimaled.bbor.client.config.ConfigManager;
+import com.irtimaled.bbor.client.interop.BiomeBorderHelper;
+import com.irtimaled.bbor.client.interop.FlowerForestHelper;
+import com.irtimaled.bbor.client.models.BoundingBoxFlowerForest;
+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.util.registry.Registry;
+import net.minecraft.world.biome.Biomes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class FlowerForestProvider implements IBoundingBoxProvider<BoundingBoxFlowerForest> {
+ public static final int FLOWER_FOREST_BIOME_ID = Registry.BIOME.getId(Biomes.FLOWER_FOREST);
+ private static Coords lastPlayerCoords = null;
+ private static Integer lastRenderDistance = null;
+ private static Map<Coords, BoundingBoxFlowerForest> lastBoundingBoxes = new HashMap<>();
+
+ @Override
+ public boolean canProvide(DimensionId dimensionId) {
+ return BoundingBoxTypeHelper.shouldRender(BoundingBoxType.FlowerForest);
+ }
+
+ @Override
+ public Iterable<BoundingBoxFlowerForest> get(DimensionId dimensionId) {
+ Coords playerCoords = Player.getCoords();
+ Integer renderDistance = ConfigManager.flowerForestsRenderDistance.get();
+ if (!playerCoords.equals(lastPlayerCoords) || !renderDistance.equals(lastRenderDistance)) {
+ lastPlayerCoords = playerCoords;
+ lastRenderDistance = renderDistance;
+ lastBoundingBoxes = getBoundingBoxes();
+ }
+ return lastBoundingBoxes.values();
+ }
+
+ public static void clear() {
+ lastBoundingBoxes = new HashMap<>();
+ lastPlayerCoords = null;
+ }
+
+ private Map<Coords, BoundingBoxFlowerForest> getBoundingBoxes() {
+ int renderDistance = lastRenderDistance;
+ Coords playerCoords = lastPlayerCoords;
+
+ int width = MathHelper.floor(Math.pow(2, 2 + renderDistance));
+
+ int blockX = playerCoords.getX();
+ int minX = blockX - width;
+ int maxX = blockX + width;
+
+ int blockZ = playerCoords.getZ();
+ int minZ = blockZ - width;
+ int maxZ = blockZ + width;
+
+ Map<Coords, BoundingBoxFlowerForest> boundingBoxes = new HashMap<>();
+ for (int x = minX; x <= maxX; x++) {
+ for (int z = minZ; z <= maxZ; z++) {
+ int biomeId = BiomeBorderHelper.getBiomeId(x, 255, z);
+ if (biomeId == FLOWER_FOREST_BIOME_ID) {
+ int y = getMaxYForPos(x, playerCoords.getY() + 1, z);
+ if (y == 0) {
+ continue;
+ }
+ Coords coords = new Coords(x, y + 1, z);
+ BoundingBoxFlowerForest boundingBox = lastBoundingBoxes.containsKey(coords)
+ ? lastBoundingBoxes.get(coords)
+ : new BoundingBoxFlowerForest(coords, FlowerForestHelper.getFlowerColorAtPos(coords));
+ boundingBoxes.put(coords, boundingBox);
+ }
+ }
+ }
+ return boundingBoxes;
+ }
+
+ private static int getMaxYForPos(int x, int y, int z) {
+ while (y > 0) {
+ if (FlowerForestHelper.canGrowFlower(x, y, z)) return y;
+ y--;
+ }
+ return 0;
+ }
+}
}
void renderFilledFaces(OffsetPoint min, OffsetPoint max, Color color) {
+ renderFilledFaces(min, max, color, 30);
+ }
+
+ void renderFilledFaces(OffsetPoint min, OffsetPoint max, Color color, int alpha) {
if (!ConfigManager.fill.get()) return;
RenderHelper.polygonModeFill();
RenderHelper.enableBlend();
- renderFaces(min, max, color, 30, Renderer::startQuads);
+ renderFaces(min, max, color, alpha, Renderer::startQuads);
RenderHelper.disableBlend();
RenderHelper.enablePolygonOffsetLine();
RenderHelper.polygonOffsetMinusOne();
--- /dev/null
+package com.irtimaled.bbor.client.renderers;
+
+import com.irtimaled.bbor.client.models.BoundingBoxFlowerForest;
+import com.irtimaled.bbor.common.models.Coords;
+
+public class FlowerForestRenderer extends AbstractRenderer<BoundingBoxFlowerForest> {
+ @Override
+ public void render(BoundingBoxFlowerForest boundingBox) {
+ Coords coords = boundingBox.getCoords();
+ int x = coords.getX();
+ int y = coords.getY();
+ int z = coords.getZ();
+ renderFilledFaces(new OffsetPoint(x, y + 0.01d, z),
+ new OffsetPoint(x + 1, y + 0.01d, z + 1),
+ boundingBox.getColor(), 127);
+ }
+}
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 JungleTemple = register("Jungle_Pyramid");
public static final BoundingBoxType DesertTemple = register("Desert_Pyramid");
"bbor.features.spawningSpheres": "Spawning Spheres",
"bbor.features.spawnableBlocks": "Spawnable Blocks",
"bbor.features.biomeBorders": "Biome Borders",
+ "bbor.features.flowerForests": "Flower Forests",
"bbor.sections.beaconsAndConduits": "Beacons & Conduits",
"bbor.features.beacons": "Beacons",