From d125c7ae8074d38c595f996ea83e4f3d908a18ef Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Mon, 30 Sep 2024 23:12:19 -0700 Subject: [PATCH 1/2] short circuit data check if single value palette --- common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java b/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java index ef5f3c27..f18a66c2 100644 --- a/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java +++ b/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java @@ -139,6 +139,7 @@ private BiomeCheckResult checkNewChunkBiomePalette(LevelChunk chunk, boolean che var palette = biomesPaletteContainer.data.palette(); boolean paletteContainsPlains = palette.maybeHas(PaletteNewChunks::isPlainsBiome); if (paletteContainsPlains && checkData) { + if (palette.getSize() == 1) return PLAINS_PRESENT; var storage = biomesPaletteContainer.data.storage(); presentStateIdsBuf.clear(); storage.getAll(presentStateIdsBuf::add); From dcac811d6d3edc8976daf3dbcc3a6b3272500dd9 Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Tue, 1 Oct 2024 02:35:22 -0700 Subject: [PATCH 2/2] MM24.5.0 --- .../client/MixinBuiltInInfoDisplays.java | 10 +-- .../mixin/client/MixinClientEvents.java | 16 ----- .../xaeroplus/mixin/client/MixinGuiMap.java | 2 +- .../mixin/client/MixinGuiWaypoints.java | 8 +-- ...MixinMinimapElementMapRendererHandler.java | 43 ++++++++++++ ...nMinimapElementOverMapRendererHandler.java | 64 ------------------ .../MixinMinimapElementRendererHandler.java | 15 +++-- .../mixin/client/MixinMinimapFBORenderer.java | 13 ++-- .../mixin/client/MixinMinimapRenderer.java | 67 ++++++------------- .../client/MixinMinimapWorldStateUpdater.java | 11 +-- .../client/MixinWaypointSharingHandler.java | 22 ++---- .../client/MixinWaypointsIngameRenderer.java | 25 +++---- .../src/main/resources/xaeroplus.mixins.json | 2 +- settings.gradle.kts | 6 +- 14 files changed, 121 insertions(+), 183 deletions(-) create mode 100644 common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementMapRendererHandler.java delete mode 100644 common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementOverMapRendererHandler.java diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinBuiltInInfoDisplays.java b/common/src/main/java/xaeroplus/mixin/client/MixinBuiltInInfoDisplays.java index 5d891627..e374ee10 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinBuiltInInfoDisplays.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinBuiltInInfoDisplays.java @@ -7,8 +7,8 @@ import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import xaero.common.minimap.info.BuiltInInfoDisplays; -import xaero.common.minimap.info.render.compile.InfoDisplayCompiler; +import xaero.hud.minimap.info.BuiltInInfoDisplays; +import xaero.hud.minimap.info.render.compile.InfoDisplayCompiler; import xaero.hud.minimap.world.MinimapWorld; import xaeroplus.settings.Settings; import xaeroplus.util.ChunkUtils; @@ -18,13 +18,13 @@ public class MixinBuiltInInfoDisplays { @WrapOperation(method = "lambda$static$13", at = @At( value = "INVOKE", - target = "Lxaero/common/minimap/info/render/compile/InfoDisplayCompiler;addWords(ILjava/lang/String;)V")) - private static void hideAutoSubworldInfoWhenOwAutoWaypointsEnabled(final InfoDisplayCompiler instance, final int lineWidth, final String text, final Operation original, + target = "Lxaero/hud/minimap/info/render/compile/InfoDisplayCompiler;addWords(Ljava/lang/String;)V")) + private static void hideAutoSubworldInfoWhenOwAutoWaypointsEnabled(final InfoDisplayCompiler instance, final String words, final Operation original, @Local(name = "currentWorld") MinimapWorld currentWorld) { if (Settings.REGISTRY.owAutoWaypointDimension.get()) { ResourceKey actualDimension = ChunkUtils.getActualDimension(); if (actualDimension == Level.NETHER && currentWorld.getDimId() == Level.OVERWORLD) return; } - original.call(instance, lineWidth, text); + original.call(instance, words); } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinClientEvents.java b/common/src/main/java/xaeroplus/mixin/client/MixinClientEvents.java index 2d3c8699..39daabef 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinClientEvents.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinClientEvents.java @@ -1,7 +1,5 @@ package xaeroplus.mixin.client; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.authlib.GameProfile; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; @@ -10,8 +8,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import xaero.common.events.ClientEvents; -import xaero.common.minimap.waypoints.WaypointSharingHandler; -import xaeroplus.XaeroPlus; import xaeroplus.settings.Settings; @Mixin(value = ClientEvents.class, remap = false) @@ -33,16 +29,4 @@ public void onPlayerChatReceived(final ChatType.Bound chatType, final Component cir.setReturnValue(false); // false will show the raw message in chat to the player } } - - @WrapOperation(method = "handleChatMessage", at = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/waypoints/WaypointSharingHandler;onWaypointReceived(Ljava/lang/String;Ljava/lang/String;)V" - )) - public void preventInvalidWpFormattingCrash(final WaypointSharingHandler instance, final String playerName, final String textString, final Operation original) { - try { - original.call(instance, playerName, textString); - } catch (final Exception e) { - XaeroPlus.LOGGER.info("Caught exception in waypoint sharing handler: ", e); - } - } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java b/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java index 8a51ddbb..0f76197b 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java @@ -569,7 +569,7 @@ public void onAction(Screen screen) { } if (Settings.REGISTRY.disableWaypointSharing.get()) { - cir.getReturnValue().removeIf(option -> ((AccessorRightClickOption) option).getName().equals("xaeroplus.gui.xaero_right_click_map_share_location")); + cir.getReturnValue().removeIf(option -> ((AccessorRightClickOption) option).getName().equals("gui.xaero_right_click_map_share_location")); } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinGuiWaypoints.java b/common/src/main/java/xaeroplus/mixin/client/MixinGuiWaypoints.java index dc145f84..c6ea2391 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinGuiWaypoints.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinGuiWaypoints.java @@ -145,7 +145,7 @@ private void updateSearch() { */ @Overwrite private void updateSortedList() { - WaypointsSort sortType = this.displayedWorld.getContainer().getRoot().getSortType(); + WaypointsSort sortType = this.displayedWorld.getRootConfig().getSortType(); Iterable waypointsList = this.displayedWorld.getCurrentWaypointSet().getWaypoints(); GuiWaypoints.distanceDivided = this.session.getDimensionHelper().getDimensionDivision(this.displayedWorld); Camera camera = this.minecraft.gameRenderer.getMainCamera(); @@ -176,9 +176,9 @@ private List sortWaypoints(final List waypointsList, Waypoin switch (sortType) { case NONE -> {} case ANGLE -> sortVal = -w.getComparisonAngleCos(camera, GuiWaypoints.distanceDivided); - case COLOR -> sortVal = w.getColor(); + case COLOR -> sortVal = w.getWaypointColor(); case NAME -> sortVal = w.getComparisonName(); - case SYMBOL -> sortVal = w.getSymbol(); + case SYMBOL -> sortVal = w.getInitials(); case DISTANCE -> sortVal = w.getComparisonDistance(camera, GuiWaypoints.distanceDivided); } sortableKeys.add(new KeySortableByOther<>(w, sortVal)); @@ -187,7 +187,7 @@ private List sortWaypoints(final List waypointsList, Waypoin for (KeySortableByOther k : sortableKeys) { waypointsSorted.add(k.getKey()); } - if (this.displayedWorld.getContainer().getRoot().isSortReversed()) { + if (this.displayedWorld.getContainer().getRootConfig().isSortReversed()) { Collections.reverse(waypointsSorted); } return waypointsSorted; diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementMapRendererHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementMapRendererHandler.java new file mode 100644 index 00000000..69f801e3 --- /dev/null +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementMapRendererHandler.java @@ -0,0 +1,43 @@ +package xaeroplus.mixin.client; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.MultiBufferSource; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import xaero.common.minimap.render.radar.element.RadarRenderContext; +import xaero.common.minimap.render.radar.element.RadarRenderer; +import xaero.hud.HudSession; +import xaero.hud.minimap.element.render.MinimapElementRenderInfo; +import xaero.hud.minimap.element.render.MinimapElementRenderer; +import xaero.hud.minimap.element.render.map.MinimapElementMapRendererHandler; +import xaeroplus.Globals; + +@Mixin(value = MinimapElementMapRendererHandler.class, remap = false) +public class MixinMinimapElementMapRendererHandler { + + @Redirect(method = "transformAndRenderForRenderer", at = @At( + value = "INVOKE", + target = "Lxaero/hud/minimap/element/render/MinimapElementRenderer;renderElement(Ljava/lang/Object;ZZDFDDLxaero/hud/minimap/element/render/MinimapElementRenderInfo;Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;)Z" + ), remap = true) // $REMAP + public boolean redirectRenderElement(final MinimapElementRenderer instance, + final Object element, + final boolean highlit, + final boolean outOfBounds, + final double optionalDepth, + final float optionalScale, + final double partialX, + final double partialY, + final MinimapElementRenderInfo minimapElementRenderInfo, + final GuiGraphics guiGraphics, + final MultiBufferSource.BufferSource bufferSource) { + if (instance instanceof RadarRenderer) { + ((RadarRenderContext) instance.getContext()).nameScale = HudSession.getCurrentSession().getHudMod().getSettings().getDotNameScale(); + return instance.renderElement(element, highlit, outOfBounds, optionalDepth, + optionalScale * Globals.minimapScaleMultiplier, + partialX, partialY, minimapElementRenderInfo, guiGraphics, bufferSource); + } else { + return instance.renderElement(element, highlit, outOfBounds, optionalDepth, optionalScale, partialX, partialY, minimapElementRenderInfo, guiGraphics, bufferSource); + } + } +} diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementOverMapRendererHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementOverMapRendererHandler.java deleted file mode 100644 index 918a63af..00000000 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementOverMapRendererHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -package xaeroplus.mixin.client; - -import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; -import xaero.common.minimap.element.render.MinimapElementRenderer; -import xaero.common.minimap.element.render.over.MinimapElementOverMapRendererHandler; -import xaero.common.minimap.render.MinimapRendererHelper; -import xaero.common.minimap.render.radar.element.RadarRenderContext; -import xaero.common.minimap.render.radar.element.RadarRenderer; -import xaero.hud.HudSession; -import xaeroplus.Globals; - -@Mixin(value = MinimapElementOverMapRendererHandler.class, remap = false) -public class MixinMinimapElementOverMapRendererHandler { - - @Redirect(method = "transformAndRenderForRenderer", at = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/element/render/MinimapElementRenderer;renderElement(IZZLnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/gui/Font;Lcom/mojang/blaze3d/pipeline/RenderTarget;Lxaero/common/minimap/render/MinimapRendererHelper;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/player/Player;DDDIDFLjava/lang/Object;DDZF)Z" - ), remap = true) // $REMAP - public boolean redirectRenderElement(final MinimapElementRenderer instance, - final int location, - final boolean highlit, - final boolean outOfBounds, - final GuiGraphics drawContext, - final MultiBufferSource.BufferSource immediate, - final Font fontRenderer, - final RenderTarget framebuffer, - final MinimapRendererHelper minimapRendererHelper, - final Entity renderEntity, - final Player entityPlayer, - final double renderX, - final double renderY, - final double renderZ, - final int elementIndex, - final double optionalDepth, - final float optionalScale, - final Object e, - final double partialX, - final double partialY, - final boolean cave, - final float partialTicks) { - if (instance instanceof RadarRenderer) { - ((RadarRenderContext) instance.getContext()).nameScale = HudSession.getCurrentSession().getHudMod().getSettings().getDotNameScale(); - return instance.renderElement(location, highlit, outOfBounds, drawContext, immediate, fontRenderer, - framebuffer, minimapRendererHelper, renderEntity, entityPlayer, renderX, renderY, renderZ, - elementIndex, optionalDepth, - optionalScale / Globals.minimapScaleMultiplier, - e, partialX, partialY, cave, partialTicks); - } else { - return instance.renderElement(location, highlit, outOfBounds, drawContext, immediate, fontRenderer, - framebuffer, minimapRendererHelper, renderEntity, entityPlayer, renderX, renderY, renderZ, - elementIndex, optionalDepth, - optionalScale, - e, partialX, partialY, cave, partialTicks); - } - } -} diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java index f14096fb..cd8c9480 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java @@ -4,24 +4,27 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import net.minecraft.client.renderer.MultiBufferSource; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import xaero.common.minimap.element.render.MinimapElementRenderer; -import xaero.common.minimap.element.render.MinimapElementRendererHandler; +import xaero.common.graphics.renderer.multitexture.MultiTextureRenderTypeRendererProvider; import xaero.common.minimap.render.radar.element.RadarRenderContext; +import xaero.hud.minimap.element.render.MinimapElementRenderInfo; +import xaero.hud.minimap.element.render.MinimapElementRenderer; +import xaero.hud.minimap.element.render.MinimapElementRendererHandler; import xaeroplus.feature.extensions.IScreenRadarRenderContext; @Mixin(value = MinimapElementRendererHandler.class, remap = false) public class MixinMinimapElementRendererHandler { @WrapOperation(method = "renderForRenderer", at = @At( value = "INVOKE", - target = "Lxaero/common/minimap/element/render/MinimapElementRenderer;shouldRender(I)Z" + target = "Lxaero/hud/minimap/element/render/MinimapElementRenderer;preRender(Lxaero/hud/minimap/element/render/MinimapElementRenderInfo;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lxaero/common/graphics/renderer/multitexture/MultiTextureRenderTypeRendererProvider;)V" )) - public boolean captureRenderContext(final MinimapElementRenderer instance, final int i, final Operation original, - @Local(name = "context") LocalRef contextRef) { + public void captureRenderContext(final MinimapElementRenderer instance, final MinimapElementRenderInfo minimapElementRenderInfo, final MultiBufferSource.BufferSource bufferSource, final MultiTextureRenderTypeRendererProvider multiTextureRenderTypeRendererProvider, final Operation original, + @Local(name = "context") LocalRef contextRef) { if (contextRef.get() instanceof RadarRenderContext) { ((IScreenRadarRenderContext) contextRef.get()).setIsWorldMap(false); } - return original.call(instance, i); + original.call(instance, minimapElementRenderInfo, bufferSource, multiTextureRenderTypeRendererProvider); } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java index 7ebf3003..73eff8fb 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java @@ -13,6 +13,7 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.*; @@ -28,12 +29,12 @@ import xaero.common.minimap.render.MinimapFBORenderer; import xaero.common.minimap.render.MinimapRenderer; import xaero.common.minimap.render.MinimapRendererHelper; -import xaero.common.minimap.waypoints.render.CompassRenderer; import xaero.common.minimap.waypoints.render.WaypointsGuiRenderer; import xaero.common.misc.OptimizedMath; import xaero.hud.minimap.BuiltInHudModules; import xaero.hud.minimap.Minimap; import xaero.hud.minimap.MinimapLogs; +import xaero.hud.minimap.compass.render.CompassRenderer; import xaero.hud.minimap.module.MinimapSession; import xaeroplus.Globals; import xaeroplus.feature.extensions.CustomMinimapFBORenderer; @@ -78,9 +79,9 @@ public void reloadMapFrameBuffers() { @ModifyArg(method = "renderChunks", at = @At( value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapFBORenderer;renderChunksToFBO(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/entity/Entity;DDDDIIFFIZZZIDDZZLxaero/common/graphics/CustomVertexConsumers;)V" + target = "Lxaero/common/minimap/render/MinimapFBORenderer;renderChunksToFBO(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;DDIIFFIZZZIDDZZLxaero/common/graphics/CustomVertexConsumers;)V" ), - index = 10, + index = 9, remap = true) // $REMAP public int modifyViewW(final int viewW) { return viewW * Globals.minimapScaleMultiplier; @@ -90,7 +91,7 @@ public int modifyViewW(final int viewW) { value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;pose()Lcom/mojang/blaze3d/vertex/PoseStack;" ), remap = true) - public void modifyScaledSize(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final double playerX, final double playerZ, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, + public void modifyScaledSize(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final Vec3 renderPos, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, @Share("scaledSize") LocalIntRef scaledSize) { int s = 256 * Globals.minimapScaleMultiplier * Globals.minimapSizeMultiplier; if (Globals.minimapSizeMultiplier > 1) { @@ -140,7 +141,7 @@ public float modifyChunkGridLineWidth(final float original) { target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endBatch()V", ordinal = 0 ), remap = true) - public void drawRenderDistanceSquare(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final double playerX, final double playerZ, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, + public void drawRenderDistanceSquare(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final Vec3 renderPos, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, @Local(name = "xFloored") int xFloored, @Local(name = "zFloored") int zFloored, @Local(name = "renderTypeBuffers") MultiBufferSource.BufferSource renderTypeBuffers, @@ -218,7 +219,7 @@ public void correctPreRotationTranslationForSizeMult(final PoseStack instance, f target = "Lxaero/common/graphics/ImprovedFramebuffer;bindRead()V" ) ), remap = true) - public void correctPostRotationTranslationForSizeMult(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final double playerX, final double playerZ, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, + public void correctPostRotationTranslationForSizeMult(final MinimapSession minimapSession, final GuiGraphics guiGraphics, final MinimapProcessor minimap, final Player player, final Entity renderEntity, final Vec3 renderPos, final double playerDimDiv, final double mapDimensionScale, final int bufferSize, final int viewW, final float sizeFix, final float partial, final int level, final boolean retryIfError, final boolean useWorldMap, final boolean lockedNorth, final int shape, final double ps, final double pc, final boolean cave, final boolean circle, final CustomVertexConsumers cvc, final CallbackInfo ci, @Local(name = "halfWView") float halfWView, @Local(name = "shaderMatrixStack") PoseStack shaderMatrixStack) { float sizeMultTranslation = (halfWView / Globals.minimapSizeMultiplier) * (Globals.minimapSizeMultiplier - 1); diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapRenderer.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapRenderer.java index c340eca2..ad2f2a7d 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapRenderer.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapRenderer.java @@ -1,11 +1,11 @@ package xaeroplus.mixin.client; import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.*; @@ -14,13 +14,12 @@ import xaero.common.graphics.CustomVertexConsumers; import xaero.common.graphics.renderer.multitexture.MultiTextureRenderTypeRendererProvider; import xaero.common.minimap.MinimapProcessor; -import xaero.common.minimap.element.render.over.MinimapElementOverMapRendererHandler; import xaero.common.minimap.radar.MinimapRadar; import xaero.common.minimap.render.MinimapFBORenderer; import xaero.common.minimap.render.MinimapRenderer; -import xaero.common.minimap.render.MinimapRendererHelper; import xaero.common.settings.ModSettings; import xaero.hud.minimap.Minimap; +import xaero.hud.minimap.element.render.over.MinimapElementOverMapRendererHandler; import xaero.hud.minimap.module.MinimapSession; import xaeroplus.Globals; import xaeroplus.feature.extensions.CustomMinimapFBORenderer; @@ -65,7 +64,7 @@ public void renderMinimap( slice = @Slice( from = @At( value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;DDDDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" + target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;Lnet/minecraft/world/phys/Vec3;DDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" ) ) ) @@ -86,7 +85,7 @@ public int modifyMinimapSizeConstantI(final int constant) { slice = @Slice( from = @At( value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;DDDDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" + target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;Lnet/minecraft/world/phys/Vec3;DDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" ) ) ) @@ -107,7 +106,7 @@ public float modifyMinimapSizeConstantF(final float constant) { slice = @Slice( from = @At( value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;DDDDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" + target = "Lxaero/common/minimap/render/MinimapRenderer;renderChunks(Lxaero/hud/minimap/module/MinimapSession;Lnet/minecraft/client/gui/GuiGraphics;Lxaero/common/minimap/MinimapProcessor;Lnet/minecraft/world/phys/Vec3;DDIIFFIZZIDDZZLxaero/common/settings/ModSettings;Lxaero/common/graphics/CustomVertexConsumers;)V" ) ) ) @@ -121,15 +120,13 @@ public float modifyMinimapSizeConstantFCircle(final float constant) { @Redirect(method = "renderMinimap", at = @At( value = "INVOKE", - target = "Lxaero/common/minimap/element/render/over/MinimapElementOverMapRendererHandler;render(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/player/Player;DDDDDDDZFLcom/mojang/blaze3d/pipeline/RenderTarget;Lxaero/common/IXaeroMinimap;Lxaero/common/minimap/render/MinimapRendererHelper;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/gui/Font;Lxaero/common/graphics/renderer/multitexture/MultiTextureRenderTypeRendererProvider;IIIIZF)V"), + target = "Lxaero/hud/minimap/element/render/over/MinimapElementOverMapRendererHandler;render(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/phys/Vec3;DDDDZFLcom/mojang/blaze3d/pipeline/RenderTarget;Lxaero/common/graphics/renderer/multitexture/MultiTextureRenderTypeRendererProvider;)V"), remap = true) // $REMAP public void editOvermapRender(final MinimapElementOverMapRendererHandler instance, final GuiGraphics guiGraphics, - final Entity renderEntity, + final Entity entity, final Player player, - final double renderX, - final double renderY, - final double renderZ, + final Vec3 renderPos, final double playerDimDiv, final double ps, final double pc, @@ -137,46 +134,24 @@ public void editOvermapRender(final MinimapElementOverMapRendererHandler instanc final boolean cave, final float partialTicks, final RenderTarget framebuffer, - final IXaeroMinimap modMain, - final MinimapRendererHelper helper, - final MultiBufferSource.BufferSource renderTypeBuffers, - final Font font, - final MultiTextureRenderTypeRendererProvider multiTextureRenderTypeRenderers, - final int specW, - final int specH, - final int halfViewW, - final int halfViewH, - final boolean circle, - final float minimapScale + final MultiTextureRenderTypeRendererProvider multiTextureRenderTypeRenderers ) { if (this.minimap.usingFBO()) { zoom = (zoom / Globals.minimapScaleMultiplier) * Globals.minimapSizeMultiplier; } instance.render( - guiGraphics, - renderEntity, - player, - renderX, - renderY, - renderZ, - playerDimDiv, - ps, - pc, - zoom, - cave, - partialTicks, - framebuffer, - modMain, - helper, - renderTypeBuffers, - font, - multiTextureRenderTypeRenderers, - specW, - specH, - halfViewW, - halfViewH, - circle, - minimapScale + guiGraphics, + entity, + player, + renderPos, + playerDimDiv, + ps, + pc, + zoom, + cave, + partialTicks, + framebuffer, + multiTextureRenderTypeRenderers ); } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapWorldStateUpdater.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapWorldStateUpdater.java index b6c8669a..aa7bf106 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapWorldStateUpdater.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapWorldStateUpdater.java @@ -6,7 +6,9 @@ import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -25,14 +27,15 @@ @Mixin(value = MinimapWorldStateUpdater.class, remap = false) public abstract class MixinMinimapWorldStateUpdater { + @Final @Shadow private MinimapSession session; + @Final @Shadow private ClientPacketListener connection; @Unique private ResourceKey currentDim = OVERWORLD; - @WrapOperation(method = "update", at = @At( + @WrapOperation(method = "update()V", at = @At( value = "INVOKE", target = "Lxaero/hud/minimap/world/state/MinimapWorldState;setAutoWorldPath(Lxaero/hud/path/XaeroPath;)V" )) public void preferOverworldWpSetCustomPathOnDimUpdate(final MinimapWorldState instance, final XaeroPath autoWorldPath, final Operation original, - @Local(argsOnly = true) MinimapSession session, @Local(name = "oldAutoWorldPath") XaeroPath oldAutoWorldPath, @Local(name = "potentialAutoWorldNode") String potentialAutoWorldNode) { original.call(instance, autoWorldPath); @@ -48,8 +51,8 @@ public void preferOverworldWpSetCustomPathOnDimUpdate(final MinimapWorldState in currentDim = ChunkUtils.getActualDimension(); } - @Inject(method = "getAutoRootContainerPath", at = @At("HEAD"), cancellable = true) - public void customDataFolderResolve(final int version, final ClientPacketListener connection, final MinimapSession session, final CallbackInfoReturnable cir) { + @Inject(method = "getAutoRootContainerPath(I)Lxaero/hud/path/XaeroPath;", at = @At("HEAD"), cancellable = true) + public void customDataFolderResolve(final int version, final CallbackInfoReturnable cir) { var customCir = new CallbackInfoReturnable("a", true); DataFolderResolveUtil.resolveDataFolder(connection, customCir); if (customCir.isCancelled()) { diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinWaypointSharingHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinWaypointSharingHandler.java index 7d848b05..076271d0 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinWaypointSharingHandler.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinWaypointSharingHandler.java @@ -7,17 +7,16 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import xaero.common.minimap.waypoints.Waypoint; -import xaero.common.minimap.waypoints.WaypointSharingHandler; +import xaero.hud.minimap.waypoint.WaypointSharingHandler; import xaero.hud.minimap.world.MinimapWorld; import xaeroplus.settings.Settings; @Mixin(value = WaypointSharingHandler.class, remap = false) public class MixinWaypointSharingHandler { - @Shadow private Waypoint w; + @Shadow private Waypoint sharedWaypoint; @Inject(method = "shareWaypoint(Lnet/minecraft/client/gui/screens/Screen;Lxaero/common/minimap/waypoints/Waypoint;Lxaero/hud/minimap/world/MinimapWorld;)V", at = @At("HEAD"), @@ -29,22 +28,15 @@ public void shareWaypoint(final Screen parent, final Waypoint w, final MinimapWo } } - @Inject(method = "confirmResult", at = @At( + @Inject(method = "onShareConfirmationResult", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/Minecraft;getInstance()Lnet/minecraft/client/Minecraft;", - ordinal = 0), - slice = @Slice( - from = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/waypoints/WaypointSharingHandler;removeFormatting(Ljava/lang/String;)Ljava/lang/String;", - ordinal = 0 - ) - ), - remap = true) + target = "Lnet/minecraft/client/gui/components/ChatComponent;addRecentChat(Ljava/lang/String;)V", + ordinal = 0 + ), remap = true) public void mutateWaypointSharingText(final boolean confirm, final CallbackInfo ci, @Local(name = "message") LocalRef containerIdRef) { if (Settings.REGISTRY.plainWaypointSharing.get()) { - containerIdRef.set(w.getName() + " [" + w.getX() + ", " + (w.isYIncluded() ? (w.getY() + ", ") : "") + w.getZ() + "]"); + containerIdRef.set(sharedWaypoint.getName() + " [" + sharedWaypoint.getX() + ", " + (sharedWaypoint.isYIncluded() ? (sharedWaypoint.getY() + ", ") : "") + sharedWaypoint.getZ() + "]"); } } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinWaypointsIngameRenderer.java b/common/src/main/java/xaeroplus/mixin/client/MixinWaypointsIngameRenderer.java index cecc37b2..e9e2f977 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinWaypointsIngameRenderer.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinWaypointsIngameRenderer.java @@ -31,11 +31,11 @@ import xaero.common.minimap.MinimapProcessor; import xaero.common.minimap.render.MinimapRendererHelper; import xaero.common.minimap.waypoints.Waypoint; -import xaero.common.minimap.waypoints.render.WaypointFilterParams; +import xaero.common.minimap.waypoints.WaypointVisibilityType; import xaero.common.minimap.waypoints.render.WaypointsIngameRenderer; -import xaero.common.settings.ModSettings; import xaero.hud.minimap.BuiltInHudModules; import xaero.hud.minimap.module.MinimapSession; +import xaero.hud.minimap.waypoint.render.WaypointFilterParams; import xaeroplus.feature.extensions.CustomWaypointsIngameRenderer; import xaeroplus.settings.Settings; import xaeroplus.util.ChunkUtils; @@ -59,19 +59,19 @@ public class MixinWaypointsIngameRenderer implements CustomWaypointsIngameRender @Unique final Predicate beaconViewFilter = (w) -> { boolean deathpoints = filterParams.deathpoints; if (!w.isDisabled() - && w.getVisibilityType() != 2 - && w.getVisibilityType() != 3 - && (w.getWaypointType() != 1 && w.getWaypointType() != 2 || deathpoints)) { - double offX = (double)w.getX(filterParams.dimDiv) - filterParams.cameraX + 0.5; - double offZ = (double)w.getZ(filterParams.dimDiv) - filterParams.cameraZ + 0.5; + && w.getVisibility() != WaypointVisibilityType.WORLD_MAP_LOCAL + && w.getVisibility() != WaypointVisibilityType.WORLD_MAP_GLOBAL + && (!w.getPurpose().isDeath() || deathpoints)) { + double offX = (double)w.getX(filterParams.dimDiv) - filterParams.cameraPos.x + 0.5; + double offZ = (double)w.getZ(filterParams.dimDiv) - filterParams.cameraPos.z + 0.5; double distanceScale = filterParams.dimensionScaleDistance ? Minecraft.getInstance().level.dimensionType().coordinateScale() : 1.0; double unscaledDistance2D = Math.sqrt(offX * offX + offZ * offZ); double distance2D = unscaledDistance2D * distanceScale; double waypointsDistance = filterParams.waypointsDistance; double waypointsDistanceMin = filterParams.waypointsDistanceMin; - return w.isOneoffDestination() + return w.isDestination() || ( - w.getWaypointType() == 1 + w.getPurpose().isDeath() || w.isGlobal() || w.isTemporary() && filterParams.temporaryWaypointsGlobal || waypointsDistance == 0.0 @@ -85,7 +85,7 @@ public class MixinWaypointsIngameRenderer implements CustomWaypointsIngameRender @Inject(method = "render", at = @At( value = "INVOKE", - target = "Lxaero/common/minimap/waypoints/render/WaypointDeleter;begin()V" + target = "Lxaero/hud/minimap/waypoint/render/WaypointDeleter;begin()V" )) public void preferOwWaypointsRemoveSubworldText(final MinimapSession session, final float partial, final MinimapProcessor minimap, final Matrix4f waypointsProjection, final Matrix4f worldModelView, final CallbackInfo ci, @Local(name = "subworldName") LocalRef subWorldNameRef) { @@ -134,7 +134,7 @@ public void renderWaypointBeacon(final Waypoint waypoint, final double dimDiv, f final double z = waypointVec.z - viewZ; final double y = -100; if (!frustum.isVisible(new AABB(waypointVec.x-1, -100, waypointVec.z-1, waypointVec.x+1, 500, waypointVec.z+1))) return; - final int color = ModSettings.COLORS[waypoint.getColor()]; + final int color = waypoint.getWaypointColor().getHex(); final MultiBufferSource.BufferSource entityVertexConsumers = mc.renderBuffers().bufferSource(); final long time = mc.level.getGameTime(); matrixStack.pushPose(); @@ -192,7 +192,8 @@ public long getEtaSecondsToReachWaypoint(Waypoint waypoint) { final Vec3 playerVec = mc.player.position(); MinimapSession minimapSession = BuiltInHudModules.MINIMAP.getCurrentSession(); if (minimapSession == null) return 0; - double dimDiv = minimapSession.getDimensionHelper().getDimensionDivision(minimapSession.getWorldManager().getCurrentWorld()); int wpX = waypoint.getX(dimDiv); + double dimDiv = minimapSession.getDimensionHelper().getDimensionDivision(minimapSession.getWorldManager().getCurrentWorld()); + int wpX = waypoint.getX(dimDiv); int wpZ = waypoint.getZ(dimDiv); double directionX = wpX - playerVec.x; double directionZ = wpZ - playerVec.z; diff --git a/common/src/main/resources/xaeroplus.mixins.json b/common/src/main/resources/xaeroplus.mixins.json index 33e69a21..b03dbd93 100644 --- a/common/src/main/resources/xaeroplus.mixins.json +++ b/common/src/main/resources/xaeroplus.mixins.json @@ -44,7 +44,7 @@ "MixinMapWorld", "MixinMapWriter", "MixinMinimap", - "MixinMinimapElementOverMapRendererHandler", + "MixinMinimapElementMapRendererHandler", "MixinMinimapElementRendererHandler", "MixinMinimapFBORenderer", "MixinMinimapModSettings", diff --git a/settings.gradle.kts b/settings.gradle.kts index 48efb038..56182211 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,7 @@ pluginManagement { } } gradle.extra.apply { - set("mod_version", "2.24.1") + set("mod_version", "2.24.2") set("maven_group", "xaeroplus") set("archives_base_name", "XaeroPlus") set("minecraft_version", "1.20.1") @@ -17,9 +17,9 @@ gradle.extra.apply { set("fabric_api_version", "0.92.2+1.20.1") set("forge_loader_version", "47.3.5") set("worldmap_version_fabric", "1.39.0") - set("minimap_version_fabric", "24.4.0") + set("minimap_version_fabric", "24.5.0") set("worldmap_version_forge", "1.39.0") - set("minimap_version_forge", "24.4.0") + set("minimap_version_forge", "24.5.0") } dependencyResolutionManagement {