Skip to content

Commit

Permalink
Merge branch '1.20.4' into 1.20.6
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/xaeroplus/mixin/client/MixinWaypointsIngameRenderer.java
#	common/src/main/java/xaeroplus/mixin/client/mc/MixinWorldRenderer.java
  • Loading branch information
rfresh2 committed Sep 2, 2024
2 parents 1ebe7d5 + bb171e4 commit 896fa66
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xaeroplus.feature.extensions;

import com.mojang.blaze3d.vertex.PoseStack;
import xaero.common.XaeroMinimapSession;
import xaero.hud.minimap.module.MinimapSession;

public interface CustomWaypointsIngameRenderer {
void renderWaypointBeacons(final XaeroMinimapSession minimapSession, final PoseStack matrixStack, final float tickDelta);
void renderWaypointBeacons(final MinimapSession minimapSession, final PoseStack matrixStack, final float tickDelta);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import xaero.common.XaeroMinimapSession;
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)
Expand Down Expand Up @@ -47,7 +47,7 @@ public boolean redirectRenderElement(final MinimapElementRenderer instance,
final boolean cave,
final float partialTicks) {
if (instance instanceof RadarRenderer) {
((RadarRenderContext) instance.getContext()).nameScale = XaeroMinimapSession.getCurrentSession().getModMain().getSettings().getDotNameScale();
((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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xaero.common.IXaeroMinimap;
import xaero.common.XaeroMinimapSession;
import xaero.common.graphics.CustomRenderTypes;
import xaero.common.graphics.CustomVertexConsumers;
import xaero.common.graphics.ImprovedFramebuffer;
import xaero.common.graphics.shader.MinimapShaders;
import xaero.common.minimap.MinimapInterface;
import xaero.common.minimap.MinimapProcessor;
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.module.MinimapSession;
import xaeroplus.Globals;
Expand All @@ -48,8 +48,8 @@ public abstract class MixinMinimapFBORenderer extends MinimapRenderer implements
@Shadow
private boolean loadedFBO;

public MixinMinimapFBORenderer(final IXaeroMinimap modMain, final Minecraft mc, final WaypointsGuiRenderer waypointsGuiRenderer, final MinimapInterface minimapInterface, final CompassRenderer compassRenderer) {
super(modMain, mc, waypointsGuiRenderer, minimapInterface, compassRenderer);
public MixinMinimapFBORenderer(final IXaeroMinimap modMain, final Minecraft mc, final WaypointsGuiRenderer waypointsGuiRenderer, final Minimap minimap, final CompassRenderer compassRenderer) {
super(modMain, mc, waypointsGuiRenderer, minimap, compassRenderer);
}

@ModifyConstant(method = "loadFrameBuffer", constant = @Constant(intValue = 512))
Expand All @@ -59,7 +59,7 @@ public int overrideFrameBufferSize(int size) {

@Override
public void reloadMapFrameBuffers() {
if (!XaeroMinimapSession.getCurrentSession().getMinimapProcessor().canUseFrameBuffer()) {
if (!BuiltInHudModules.MINIMAP.getCurrentSession().getProcessor().canUseFrameBuffer()) {
MinimapLogs.LOGGER.info("FBO mode not supported! Using minimap safe mode.");
} else {
if (this.scalingFramebuffer != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
package xaeroplus.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import xaero.common.minimap.MinimapInterface;
import xaero.common.HudMod;
import xaero.common.minimap.write.MinimapWriter;
import xaeroplus.Globals;

@Mixin(value = MinimapWriter.class, remap = false)
public class MixinMinimapWriter {

@Shadow private MinimapInterface minimapInterface;

@ModifyConstant(method = "getLoadSide", constant = @Constant(intValue = 9))
public int overrideLoadSide(final int constant) {
if (this.minimapInterface.usingFBO()) {
if (HudMod.INSTANCE.getMinimap().usingFBO()) {
return constant * Globals.minimapScaleMultiplier;
} else {
return constant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import xaero.common.XaeroMinimapSession;
import xaero.common.minimap.radar.MinimapRadarList;
import xaero.common.minimap.radar.category.setting.EntityRadarCategorySettings;
import xaero.common.minimap.render.radar.element.RadarRenderContext;
import xaero.common.minimap.render.radar.element.RadarRenderProvider;
import xaero.hud.HudSession;
import xaeroplus.Globals;
import xaeroplus.feature.extensions.IScreenRadarRenderContext;
import xaeroplus.settings.XaeroPlusSettingRegistry;
Expand Down Expand Up @@ -42,7 +42,7 @@ public void setupContextAndGetNextInject(final int location, final RadarRenderCo
}

if (!((IScreenRadarRenderContext) (Object) context).isWorldMap()) {
context.nameScale = XaeroMinimapSession.getCurrentSession().getModMain().getSettings().getDotNameScale() * Globals.minimapScaleMultiplier / Globals.minimapSizeMultiplier;
context.nameScale = HudSession.getCurrentSession().getHudMod().getSettings().getDotNameScale() * Globals.minimapScaleMultiplier / Globals.minimapSizeMultiplier;
context.iconScale = this.currentList.getCategory().getSettingValue(EntityRadarCategorySettings.ICON_SCALE) * Globals.minimapScaleMultiplier / Globals.minimapSizeMultiplier;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public abstract class MixinSupportXaeroWorldmap {
@Inject(method = "drawMinimap", at = @At(
value = "INVOKE",
target = "Lxaero/common/settings/ModSettings;getSlimeChunks(Lxaero/common/minimap/waypoints/WaypointsManager;)Z"
target = "Lxaero/common/settings/ModSettings;getSlimeChunks(Lxaero/hud/minimap/module/MinimapSession;)Z"
), remap = false)
public void overrideRegionRange(final MinimapSession minimapSession, final PoseStack matrixStack, final MinimapRendererHelper helper, final int xFloored, final int zFloored, final int minViewX, final int minViewZ, final int maxViewX, final int maxViewZ, final boolean zooming, final double zoom, final double mapDimensionScale, final VertexConsumer overlayBufferBuilder, final MultiTextureRenderTypeRendererProvider multiTextureRenderTypeRenderers, final CallbackInfo ci,
@Local(name = "mapX") int mapX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xaero.common.XaeroMinimapSession;
import xaero.common.minimap.MinimapProcessor;
import xaero.common.minimap.render.MinimapRendererHelper;
import xaero.common.minimap.waypoints.Waypoint;
import xaero.common.minimap.waypoints.WaypointsManager;
import xaero.common.minimap.waypoints.render.WaypointFilterParams;
import xaero.common.minimap.waypoints.render.WaypointsIngameRenderer;
import xaero.common.settings.ModSettings;
import xaero.hud.minimap.BuiltInHudModules;
import xaero.hud.minimap.module.MinimapSession;
import xaeroplus.feature.extensions.CustomWaypointsIngameRenderer;
import xaeroplus.settings.XaeroPlusSettingRegistry;
Expand All @@ -56,34 +55,31 @@
public class MixinWaypointsIngameRenderer implements CustomWaypointsIngameRenderer {
@Shadow private List<Waypoint> sortingList;
@Shadow private WaypointFilterParams filterParams;
List<Waypoint> beaconWaypoints = new ArrayList<>();
final Predicate<Waypoint> beaconViewFilter = new Predicate<Waypoint>() {
@Override
public boolean test(final Waypoint 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;
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()
|| (
w.getWaypointType() == 1
|| w.isGlobal()
|| w.isTemporary() && filterParams.temporaryWaypointsGlobal
|| waypointsDistance == 0.0
|| !(distance2D > waypointsDistance)
)
&& (waypointsDistanceMin == 0.0 || !(unscaledDistance2D < waypointsDistanceMin));
} else {
return false;
}
@Unique List<Waypoint> beaconWaypoints = new ArrayList<>();
@Unique final Predicate<Waypoint> 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;
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()
|| (
w.getWaypointType() == 1
|| w.isGlobal()
|| w.isTemporary() && filterParams.temporaryWaypointsGlobal
|| waypointsDistance == 0.0
|| !(distance2D > waypointsDistance)
)
&& (waypointsDistanceMin == 0.0 || !(unscaledDistance2D < waypointsDistanceMin));
} else {
return false;
}
};

Expand All @@ -108,10 +104,8 @@ public void collectBeaconWaypointsList(final PoseStack matrixStack, final PoseSt
}

@Override
public void renderWaypointBeacons(final XaeroMinimapSession minimapSession, final PoseStack matrixStack, final float tickDelta) {
if (!XaeroPlusSettingRegistry.waypointBeacons.getValue()) return;
final WaypointsManager waypointsManager = minimapSession.getWaypointsManager();
double dimDiv = waypointsManager.getDimensionDivision(waypointsManager.getCurrentWorld());
public void renderWaypointBeacons(final MinimapSession minimapSession, final PoseStack matrixStack, final float tickDelta) {
double dimDiv = minimapSession.getDimensionHelper().getDimensionDivision(minimapSession.getWorldManager().getCurrentWorld());
beaconWaypoints.forEach(w -> renderWaypointBeacon(w, dimDiv, tickDelta, matrixStack));
beaconWaypoints.clear();
}
Expand Down Expand Up @@ -196,9 +190,9 @@ public long getEtaSecondsToReachWaypoint(Waypoint waypoint) {
if (mc.level == null || mc.player == null) return 0;
try {
final Vec3 playerVec = mc.player.position();
final WaypointsManager waypointsManager = XaeroMinimapSession.getCurrentSession().getWaypointsManager();
double dimDiv = waypointsManager.getDimensionDivision(waypointsManager.getCurrentWorld());
int wpX = waypoint.getX(dimDiv);
MinimapSession minimapSession = BuiltInHudModules.MINIMAP.getCurrentSession();
if (minimapSession == null) return 0;
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xaero.common.XaeroMinimapSession;
import xaero.common.HudMod;
import xaero.common.minimap.waypoints.render.WaypointsIngameRenderer;
import xaero.hud.minimap.BuiltInHudModules;
import xaero.hud.minimap.Minimap;
import xaero.hud.minimap.module.MinimapSession;
import xaeroplus.XaeroPlus;
import xaeroplus.feature.extensions.CustomWaypointsIngameRenderer;
import xaeroplus.settings.XaeroPlusSettingRegistry;

@Mixin(value = LevelRenderer.class)
public class MixinWorldRenderer {
Expand All @@ -23,10 +27,16 @@ public class MixinWorldRenderer {
@Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;checkPoseStack(Lcom/mojang/blaze3d/vertex/PoseStack;)V", ordinal = 1, shift = At.Shift.AFTER))
public void renderBlockEntitiesInject(final float tickDelta, final long l, final boolean bl, final Camera camera, final GameRenderer gameRenderer, final LightTexture lightTexture, final Matrix4f matrix4f, final Matrix4f matrix4f2, final CallbackInfo ci,
@Local PoseStack poseStack) {
final XaeroMinimapSession minimapSession = XaeroMinimapSession.getCurrentSession();
if (!XaeroPlusSettingRegistry.waypointBeacons.getValue()) return;
HudMod hudMod = HudMod.INSTANCE;
if (hudMod == null) return;
Minimap minimap = hudMod.getMinimap();
if (minimap == null) return;
WaypointsIngameRenderer waypointsIngameRenderer = minimap.getWaypointsIngameRenderer();
if (waypointsIngameRenderer == null) return;
MinimapSession minimapSession = BuiltInHudModules.MINIMAP.getCurrentSession();
if (minimapSession == null) return;
try {
WaypointsIngameRenderer waypointsIngameRenderer = minimapSession.getModMain().getInterfaces().getMinimapInterface().getWaypointsIngameRenderer();
((CustomWaypointsIngameRenderer) waypointsIngameRenderer).renderWaypointBeacons(minimapSession, poseStack, tickDelta);
} catch (final Exception e) {
if (errorCount++ < 2) XaeroPlus.LOGGER.error("Error rendering waypoints", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import baritone.api.utils.interfaces.IGoalRenderPos;
import net.lenni0451.lambdaevents.EventHandler;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import xaero.common.minimap.waypoints.Waypoint;
import xaero.common.misc.OptimizedMath;
import xaero.hud.minimap.BuiltInHudModules;
Expand All @@ -18,7 +17,6 @@
import xaeroplus.util.BaritoneHelper;

public class BaritoneGoalSync extends Module {
final ResourceLocation XP = new ResourceLocation("xaeroplus");

@EventHandler
public void onClientTickEvent(final ClientTickEvent.Post event) {
Expand Down Expand Up @@ -47,7 +45,7 @@ public void onClientTickEvent(final ClientTickEvent.Post event) {
return;
}

// todo: this no longer has no idea about the baritone goal's dimension
// todo: this no longer has any idea about the baritone goal's dimension
// so the dim div will be completely off if the player has a wp set of nether open in the ow and visa versa
final int x = OptimizedMath.myFloor(baritoneGoalBlockPos.getX());
final int z = OptimizedMath.myFloor(baritoneGoalBlockPos.getZ());
Expand Down

0 comments on commit 896fa66

Please sign in to comment.