From a9af552ad50d7e961e38cb6547a22094c2d8a467 Mon Sep 17 00:00:00 2001 From: Matt Czyr Date: Wed, 1 May 2024 21:16:24 -0400 Subject: [PATCH] Switch to GUI overlay to render compass info on HUD (#180) * Switch to GUI overlay to render compass info on HUD (#163, #168) * Update changelog --- CHANGELOG.md | 4 + gradle.properties | 2 +- .../naturescompass/NaturesCompass.java | 97 --------------- .../client/ClientEventHandler.java | 72 ------------ .../client/NaturesCompassClient.java | 110 ++++++++++++++++++ .../client/NaturesCompassOverlay.java | 73 ++++++++++++ src/main/resources/META-INF/mods.toml | 2 +- 7 files changed, 189 insertions(+), 171 deletions(-) delete mode 100644 src/main/java/com/chaosthedude/naturescompass/client/ClientEventHandler.java create mode 100644 src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassClient.java create mode 100644 src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassOverlay.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 92749e4..c9db110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Version 1.11.5 +#### Forge 1.20.4, 1.20.2 +- Fixed compass HUD info being rendered twice when certain mods are installed + ## Version 1.11.4 #### Forge 1.20.4, 1.20.2 - Fixed clients not being allowed to connect to servers that did not have Nature's Compass installed diff --git a/gradle.properties b/gradle.properties index f2215ab..45c0945 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,7 +48,7 @@ mod_name=Nature's Compass # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=CC BY-NC-SA 4.0 # The mod version. See https://semver.org/ -mod_version=1.20.4-1.11.4-forge +mod_version=1.20.4-1.11.5-forge # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/com/chaosthedude/naturescompass/NaturesCompass.java b/src/main/java/com/chaosthedude/naturescompass/NaturesCompass.java index b3605b0..635930a 100644 --- a/src/main/java/com/chaosthedude/naturescompass/NaturesCompass.java +++ b/src/main/java/com/chaosthedude/naturescompass/NaturesCompass.java @@ -6,38 +6,23 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.chaosthedude.naturescompass.client.ClientEventHandler; import com.chaosthedude.naturescompass.config.ConfigHandler; import com.chaosthedude.naturescompass.items.NaturesCompassItem; import com.chaosthedude.naturescompass.network.CompassSearchPacket; import com.chaosthedude.naturescompass.network.SyncPacket; import com.chaosthedude.naturescompass.network.TeleportPacket; -import com.chaosthedude.naturescompass.util.CompassState; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; -import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.network.Channel; @@ -71,10 +56,6 @@ public NaturesCompass() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preInit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::buildCreativeTabContents); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientInit); - }); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigHandler.GENERAL_SPEC); ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigHandler.CLIENT_SPEC); @@ -106,82 +87,4 @@ public void registerNodes(PermissionGatherEvent.Nodes event) { event.addNodes(TELEPORT_PERMISSION); } - @OnlyIn(Dist.CLIENT) - public void clientInit(FMLClientSetupEvent event) { - MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); - - event.enqueueWork(() -> { - ItemProperties.register(naturesCompass, new ResourceLocation("angle"), new ClampedItemPropertyFunction() { - @OnlyIn(Dist.CLIENT) - private double rotation; - @OnlyIn(Dist.CLIENT) - private double rota; - @OnlyIn(Dist.CLIENT) - private long lastUpdateTick; - - @OnlyIn(Dist.CLIENT) - @Override - public float unclampedCall(ItemStack stack, ClientLevel world, LivingEntity entityLiving, int seed) { - if (entityLiving == null && !stack.isFramed()) { - return 0.0F; - } else { - final boolean entityExists = entityLiving != null; - final Entity entity = (Entity) (entityExists ? entityLiving : stack.getFrame()); - if (world == null && entity.level() instanceof ClientLevel) { - world = (ClientLevel) entity.level(); - } - - double rotation = entityExists ? (double) entity.getYRot() : getFrameRotation((ItemFrame) entity); - rotation = rotation % 360.0D; - double adjusted = Math.PI - ((rotation - 90.0D) * 0.01745329238474369D - getAngle(world, entity, stack)); - - if (entityExists) { - adjusted = wobble(world, adjusted); - } - - final float f = (float) (adjusted / (Math.PI * 2D)); - return Mth.positiveModulo(f, 1.0F); - } - } - - @OnlyIn(Dist.CLIENT) - private double wobble(ClientLevel world, double amount) { - if (world.getGameTime() != lastUpdateTick) { - lastUpdateTick = world.getGameTime(); - double d0 = amount - rotation; - d0 = Mth.positiveModulo(d0 + Math.PI, Math.PI * 2D) - Math.PI; - d0 = Mth.clamp(d0, -1.0D, 1.0D); - rota += d0 * 0.1D; - rota *= 0.8D; - rotation += rota; - } - - return rotation; - } - - @OnlyIn(Dist.CLIENT) - private double getFrameRotation(ItemFrame itemFrame) { - Direction direction = itemFrame.getDirection(); - int i = direction.getAxis().isVertical() ? 90 * direction.getAxisDirection().getStep() : 0; - return (double) Mth.wrapDegrees(180 + direction.get2DDataValue() * 90 + itemFrame.getRotation() * 45 + i); - } - - @OnlyIn(Dist.CLIENT) - private double getAngle(ClientLevel world, Entity entity, ItemStack stack) { - if (stack.getItem() == naturesCompass) { - NaturesCompassItem compassItem = (NaturesCompassItem) stack.getItem(); - BlockPos pos; - if (compassItem.getState(stack) == CompassState.FOUND) { - pos = new BlockPos(compassItem.getFoundBiomeX(stack), 0, compassItem.getFoundBiomeZ(stack)); - } else { - pos = world.getSharedSpawnPos(); - } - return Math.atan2((double) pos.getZ() - entity.position().z(), (double) pos.getX() - entity.position().x()); - } - return 0.0D; - } - }); - }); - } - } diff --git a/src/main/java/com/chaosthedude/naturescompass/client/ClientEventHandler.java b/src/main/java/com/chaosthedude/naturescompass/client/ClientEventHandler.java deleted file mode 100644 index 564046e..0000000 --- a/src/main/java/com/chaosthedude/naturescompass/client/ClientEventHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.chaosthedude.naturescompass.client; - -import com.chaosthedude.naturescompass.config.ConfigHandler; -import com.chaosthedude.naturescompass.items.NaturesCompassItem; -import com.chaosthedude.naturescompass.util.BiomeUtils; -import com.chaosthedude.naturescompass.util.CompassState; -import com.chaosthedude.naturescompass.util.ItemUtils; -import com.chaosthedude.naturescompass.util.RenderUtils; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.ChatScreen; -import net.minecraft.client.resources.language.I18n; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderGuiOverlayEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; - -@OnlyIn(Dist.CLIENT) -public class ClientEventHandler { - - private static final Minecraft mc = Minecraft.getInstance(); - - @SubscribeEvent - public void onRenderTick(RenderGuiOverlayEvent.Post event) { - if (mc.player != null && mc.level != null && !mc.options.hideGui && !mc.getDebugOverlay().showDebugScreen() && (mc.screen == null || (ConfigHandler.CLIENT.displayWithChatOpen.get() && mc.screen instanceof ChatScreen))) { - final Player player = mc.player; - final ItemStack stack = ItemUtils.getHeldNatureCompass(player); - if (stack != null && stack.getItem() instanceof NaturesCompassItem) { - final NaturesCompassItem compass = (NaturesCompassItem) stack.getItem(); - if (compass.getState(stack) == CompassState.SEARCHING) { - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.searching"), 5, 5, 0xAAAAAA, 1); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.radius"), 5, 5, 0xFFFFFF, 6); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), String.valueOf(compass.getSearchRadius(stack)), 5, 5, 0xAAAAAA, 7); - } else if (compass.getState(stack) == CompassState.FOUND) { - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.found"), 5, 5, 0xAAAAAA, 1); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); - - if (compass.shouldDisplayCoordinates(stack)) { - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.coordinates"), 5, 5, 0xFFFFFF, 6); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), compass.getFoundBiomeX(stack) + ", " + compass.getFoundBiomeZ(stack), 5, 5, 0xAAAAAA, 7); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.distance"), 5, 5, 0xFFFFFF, 9); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), String.valueOf(BiomeUtils.getDistanceToBiome(player, compass.getFoundBiomeX(stack), compass.getFoundBiomeZ(stack))), 5, 5, 0xAAAAAA, 10); - } - } else if (compass.getState(stack) == CompassState.NOT_FOUND) { - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.notFound"), 5, 5, 0xAAAAAA, 1); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.radius"), 5, 5, 0xFFFFFF, 6); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), String.valueOf(compass.getSearchRadius(stack)), 5, 5, 0xAAAAAA, 7); - - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), I18n.get("string.naturescompass.samples"), 5, 5, 0xFFFFFF, 9); - RenderUtils.drawConfiguredStringOnHUD(event.getGuiGraphics(), String.valueOf(compass.getSamples(stack)), 5, 5, 0xAAAAAA, 10); - } - } - } - } - -} diff --git a/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassClient.java b/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassClient.java new file mode 100644 index 0000000..df73698 --- /dev/null +++ b/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassClient.java @@ -0,0 +1,110 @@ +package com.chaosthedude.naturescompass.client; + +import com.chaosthedude.naturescompass.NaturesCompass; +import com.chaosthedude.naturescompass.items.NaturesCompassItem; +import com.chaosthedude.naturescompass.util.CompassState; + +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; +import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; + +@Mod.EventBusSubscriber(modid = NaturesCompass.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) +public class NaturesCompassClient { + + @SubscribeEvent + public static void clientInit(FMLClientSetupEvent event) { + event.enqueueWork(() -> { + ItemProperties.register(NaturesCompass.naturesCompass, new ResourceLocation("angle"), new ClampedItemPropertyFunction() { + @OnlyIn(Dist.CLIENT) + private double rotation; + @OnlyIn(Dist.CLIENT) + private double rota; + @OnlyIn(Dist.CLIENT) + private long lastUpdateTick; + + @OnlyIn(Dist.CLIENT) + @Override + public float unclampedCall(ItemStack stack, ClientLevel world, LivingEntity entityLiving, int seed) { + if (entityLiving == null && !stack.isFramed()) { + return 0.0F; + } else { + final boolean entityExists = entityLiving != null; + final Entity entity = (Entity) (entityExists ? entityLiving : stack.getFrame()); + if (world == null && entity.level() instanceof ClientLevel) { + world = (ClientLevel) entity.level(); + } + + double rotation = entityExists ? (double) entity.getYRot() : getFrameRotation((ItemFrame) entity); + rotation = rotation % 360.0D; + double adjusted = Math.PI - ((rotation - 90.0D) * 0.01745329238474369D - getAngle(world, entity, stack)); + + if (entityExists) { + adjusted = wobble(world, adjusted); + } + + final float f = (float) (adjusted / (Math.PI * 2D)); + return Mth.positiveModulo(f, 1.0F); + } + } + + @OnlyIn(Dist.CLIENT) + private double wobble(ClientLevel world, double amount) { + if (world.getGameTime() != lastUpdateTick) { + lastUpdateTick = world.getGameTime(); + double d0 = amount - rotation; + d0 = Mth.positiveModulo(d0 + Math.PI, Math.PI * 2D) - Math.PI; + d0 = Mth.clamp(d0, -1.0D, 1.0D); + rota += d0 * 0.1D; + rota *= 0.8D; + rotation += rota; + } + + return rotation; + } + + @OnlyIn(Dist.CLIENT) + private double getFrameRotation(ItemFrame itemFrame) { + Direction direction = itemFrame.getDirection(); + int i = direction.getAxis().isVertical() ? 90 * direction.getAxisDirection().getStep() : 0; + return (double) Mth.wrapDegrees(180 + direction.get2DDataValue() * 90 + itemFrame.getRotation() * 45 + i); + } + + @OnlyIn(Dist.CLIENT) + private double getAngle(ClientLevel world, Entity entity, ItemStack stack) { + if (stack.getItem() == NaturesCompass.naturesCompass) { + NaturesCompassItem compassItem = (NaturesCompassItem) stack.getItem(); + BlockPos pos; + if (compassItem.getState(stack) == CompassState.FOUND) { + pos = new BlockPos(compassItem.getFoundBiomeX(stack), 0, compassItem.getFoundBiomeZ(stack)); + } else { + pos = world.getSharedSpawnPos(); + } + return Math.atan2((double) pos.getZ() - entity.position().z(), (double) pos.getX() - entity.position().x()); + } + return 0.0D; + } + }); + }); + } + + @SubscribeEvent + public static void registerOverlay(RegisterGuiOverlaysEvent event) { + event.registerAbove(VanillaGuiOverlay.BOSS_EVENT_PROGRESS.id(), "natures_compass", new NaturesCompassOverlay()); + } + +} diff --git a/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassOverlay.java b/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassOverlay.java new file mode 100644 index 0000000..32e9812 --- /dev/null +++ b/src/main/java/com/chaosthedude/naturescompass/client/NaturesCompassOverlay.java @@ -0,0 +1,73 @@ +package com.chaosthedude.naturescompass.client; + +import com.chaosthedude.naturescompass.config.ConfigHandler; +import com.chaosthedude.naturescompass.items.NaturesCompassItem; +import com.chaosthedude.naturescompass.util.BiomeUtils; +import com.chaosthedude.naturescompass.util.CompassState; +import com.chaosthedude.naturescompass.util.ItemUtils; +import com.chaosthedude.naturescompass.util.RenderUtils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.ChatScreen; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.gui.overlay.ForgeGui; +import net.minecraftforge.client.gui.overlay.IGuiOverlay; + +@OnlyIn(Dist.CLIENT) +public class NaturesCompassOverlay implements IGuiOverlay { + + public static final Minecraft mc = Minecraft.getInstance(); + + @Override + public void render(ForgeGui gui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight) { + if (mc.player != null && mc.level != null && !mc.options.hideGui && !mc.getDebugOverlay().showDebugScreen() && (mc.screen == null || (ConfigHandler.CLIENT.displayWithChatOpen.get() && mc.screen instanceof ChatScreen))) { + final Player player = mc.player; + final ItemStack stack = ItemUtils.getHeldNatureCompass(player); + if (stack != null && stack.getItem() instanceof NaturesCompassItem) { + final NaturesCompassItem compass = (NaturesCompassItem) stack.getItem(); + if (compass.getState(stack) == CompassState.SEARCHING) { + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.searching"), 5, 5, 0xAAAAAA, 1); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.radius"), 5, 5, 0xFFFFFF, 6); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, String.valueOf(compass.getSearchRadius(stack)), 5, 5, 0xAAAAAA, 7); + } else if (compass.getState(stack) == CompassState.FOUND) { + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.found"), 5, 5, 0xAAAAAA, 1); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); + + if (compass.shouldDisplayCoordinates(stack)) { + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.coordinates"), 5, 5, 0xFFFFFF, 6); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, compass.getFoundBiomeX(stack) + ", " + compass.getFoundBiomeZ(stack), 5, 5, 0xAAAAAA, 7); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.distance"), 5, 5, 0xFFFFFF, 9); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, String.valueOf(BiomeUtils.getDistanceToBiome(player, compass.getFoundBiomeX(stack), compass.getFoundBiomeZ(stack))), 5, 5, 0xAAAAAA, 10); + } + } else if (compass.getState(stack) == CompassState.NOT_FOUND) { + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.status"), 5, 5, 0xFFFFFF, 0); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.notFound"), 5, 5, 0xAAAAAA, 1); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.biome"), 5, 5, 0xFFFFFF, 3); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, BiomeUtils.getBiomeName(mc.level, compass.getBiomeKey(stack)), 5, 5, 0xAAAAAA, 4); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.radius"), 5, 5, 0xFFFFFF, 6); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, String.valueOf(compass.getSearchRadius(stack)), 5, 5, 0xAAAAAA, 7); + + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, I18n.get("string.naturescompass.samples"), 5, 5, 0xFFFFFF, 9); + RenderUtils.drawConfiguredStringOnHUD(guiGraphics, String.valueOf(compass.getSamples(stack)), 5, 5, 0xAAAAAA, 10); + } + } + } + } + +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 9409263..26eca87 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -5,7 +5,7 @@ license="CC BY-NC-SA 4.0" [[mods]] modId="naturescompass" - version="1.20.4-1.11.4-forge" + version="1.20.4-1.11.5-forge" displayName="Nature's Compass" displayURL="https://github.com/MattCzyr/NaturesCompass" authors="ChaosTheDude"