Skip to content

Commit

Permalink
Merge branch '1.20.1' into 1.19.4
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementOverMapRendererHandler.java
#	common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java
#	common/src/main/java/xaeroplus/mixin/client/MixinMinimapRenderer.java
#	settings.gradle.kts
  • Loading branch information
rfresh2 committed Oct 1, 2024
2 parents 79564e7 + dcac811 commit 680d563
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Void> 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<Void> original,
@Local(name = "currentWorld") MinimapWorld currentWorld) {
if (Settings.REGISTRY.owAutoWaypointDimension.get()) {
ResourceKey<Level> actualDimension = ChunkUtils.getActualDimension();
if (actualDimension == Level.NETHER && currentWorld.getDimId() == Level.OVERWORLD) return;
}
original.call(instance, lineWidth, text);
original.call(instance, words);
}
}
16 changes: 0 additions & 16 deletions common/src/main/java/xaeroplus/mixin/client/MixinClientEvents.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
Expand All @@ -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<Void> original) {
try {
original.call(instance, playerName, textString);
} catch (final Exception e) {
XaeroPlus.LOGGER.info("Caught exception in waypoint sharing handler: ", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,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"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void updateSearch() {
*/
@Overwrite
private void updateSortedList() {
WaypointsSort sortType = this.displayedWorld.getContainer().getRoot().getSortType();
WaypointsSort sortType = this.displayedWorld.getRootConfig().getSortType();
Iterable<Waypoint> waypointsList = this.displayedWorld.getCurrentWaypointSet().getWaypoints();
GuiWaypoints.distanceDivided = this.session.getDimensionHelper().getDimensionDivision(this.displayedWorld);
Camera camera = this.minecraft.gameRenderer.getMainCamera();
Expand Down Expand Up @@ -177,9 +177,9 @@ private List<Waypoint> sortWaypoints(final List<Waypoint> 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));
Expand All @@ -188,7 +188,7 @@ private List<Waypoint> sortWaypoints(final List<Waypoint> waypointsList, Waypoin
for (KeySortableByOther<Waypoint> k : sortableKeys) {
waypointsSorted.add(k.getKey());
}
if (this.displayedWorld.getContainer().getRoot().isSortReversed()) {
if (this.displayedWorld.getContainer().getRootConfig().isSortReversed()) {
Collections.reverse(waypointsSorted);
}
return waypointsSorted;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package xaeroplus.mixin.client;

import com.mojang.blaze3d.vertex.PoseStack;
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;Lcom/mojang/blaze3d/vertex/PoseStack;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 PoseStack matrixStack,
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, matrixStack, bufferSource);
} else {
return instance.renderElement(element, highlit, outOfBounds, optionalDepth, optionalScale, partialX, partialY, minimapElementRenderInfo, matrixStack, bufferSource);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> original,
@Local(name = "context") LocalRef<Object> contextRef) {
public void captureRenderContext(final MinimapElementRenderer instance, final MinimapElementRenderInfo minimapElementRenderInfo, final MultiBufferSource.BufferSource bufferSource, final MultiTextureRenderTypeRendererProvider multiTextureRenderTypeRendererProvider, final Operation<Void> original,
@Local(name = "context") LocalRef<Object> contextRef) {
if (contextRef.get() instanceof RadarRenderContext) {
((IScreenRadarRenderContext) contextRef.get()).setIsWorldMap(false);
}
return original.call(instance, i);
original.call(instance, minimapElementRenderInfo, bufferSource, multiTextureRenderTypeRendererProvider);
}
}
Loading

0 comments on commit 680d563

Please sign in to comment.