Skip to content

Commit

Permalink
MM24.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Sep 3, 2024
1 parent 2633ca7 commit bcca221
Show file tree
Hide file tree
Showing 24 changed files with 206 additions and 436 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/1.12.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
WORLDMAP_VERSION: "1.39.0"
MINIMAP_VERSION: "24.3.0"
MINIMAP_VERSION: "24.4.1"
MINECRAFT_VERSION: "1.12.2"
MINECRAFT_VERSION_SHORT: "1.12"
MOD_LOADER: "Forge"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

env:
WORLDMAP_VERSION: "1.39.0"
MINIMAP_VERSION: "24.3.0"
MINIMAP_VERSION: "24.4.1"
MINECRAFT_VERSION: "1.12.2"
MINECRAFT_VERSION_SHORT: "1.12"
MOD_LOADER: "Forge"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ dependencies {
jarLibs 'org.xerial:sqlite-jdbc:3.45.0.0'

implementation(fg.deobf("maven.modrinth:xaeros-world-map:1.39.0_Forge_1.12"))
implementation(fg.deobf("maven.modrinth:xaeros-minimap:24.3.0_Forge_1.12"))
implementation(fg.deobf("maven.modrinth:xaeros-minimap:24.4.1_Forge_1.12"))
implementation(fg.deobf('cabaletta:baritone-deobf-unoptimized-mcp-dev:1.2')).setChanging(true)
compileOnly(fg.deobf("curse.maven:waystones-245755:2859589"))

Expand Down
16 changes: 13 additions & 3 deletions src/main/java/xaeroplus/event/ForgeEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@

import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
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.settings.XaeroPlusSettingRegistry;
import xaeroplus.util.CustomWaypointsIngameRenderer;

public class ForgeEventHandler {
int errorCount = 0;
@SubscribeEvent
public void onRenderWorldLastEvent(final RenderWorldLastEvent event) {
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, event.getContext(), event.getPartialTicks());
} catch (final Exception e) {
if (errorCount++ < 2) {
Expand Down
55 changes: 0 additions & 55 deletions src/main/java/xaeroplus/mixin/client/MixinGuiAddWaypoint.java

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/java/xaeroplus/mixin/client/MixinGuiWaypoint.java

This file was deleted.

44 changes: 23 additions & 21 deletions src/main/java/xaeroplus/mixin/client/MixinGuiWaypoints.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
import xaero.common.gui.MySmallButton;
import xaero.common.gui.ScreenBase;
import xaero.common.minimap.waypoints.Waypoint;
import xaero.common.minimap.waypoints.WaypointWorld;
import xaero.common.minimap.waypoints.WaypointsManager;
import xaero.common.minimap.waypoints.WaypointsSort;
import xaero.common.misc.KeySortableByOther;
import xaero.hud.minimap.module.MinimapSession;
import xaero.hud.minimap.world.MinimapWorld;
import xaero.hud.minimap.world.MinimapWorldManager;
import xaeroplus.util.Globals;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.concurrent.ConcurrentSkipListSet;

import static java.util.Objects.isNull;

Expand All @@ -39,14 +40,12 @@ public class MixinGuiWaypoints extends ScreenBase {

private final int TOGGLE_ALL_ID = 69;
private final int SEARCH_ID = 70;
@Shadow
private WaypointWorld displayedWorld;
@Shadow
private ArrayList<Waypoint> waypointsSorted;
@Shadow
private WaypointsManager waypointsManager;
@Shadow
private boolean buttonClicked;
@Shadow private MinimapWorld displayedWorld;
@Shadow private ArrayList<Waypoint> waypointsSorted;
@Shadow private MinimapSession session;
@Shadow private MinimapWorldManager manager;
@Shadow private boolean buttonClicked;
@Shadow private ConcurrentSkipListSet<Integer> selectedListSet;
private GuiTextField searchField;

protected MixinGuiWaypoints(IXaeroMinimap modMain, GuiScreen parent, GuiScreen escape) {
Expand Down Expand Up @@ -118,6 +117,7 @@ private void updateSearch() {
String newValue = this.searchField.getText();
if (!Objects.equal(Globals.waypointsSearchFilter, newValue)) {
Globals.waypointsSearchFilter = this.searchField.getText();
selectedListSet.clear();
updateSortedList();
}
}
Expand All @@ -129,9 +129,9 @@ private void updateSearch() {
*/
@Overwrite
private void updateSortedList() {
WaypointsSort sortType = this.displayedWorld.getContainer().getRootContainer().getSortType();
ArrayList<Waypoint> waypointsList = this.displayedWorld.getCurrentSet().getList();
GuiWaypoints.distanceDivided = this.waypointsManager.getDimensionDivision(this.displayedWorld.getContainer().getKey());
WaypointsSort sortType = this.displayedWorld.getContainer().getRoot().getSortType();
Iterable<Waypoint> waypointsList = this.displayedWorld.getCurrentWaypointSet().getWaypoints();
GuiWaypoints.distanceDivided = this.session.getDimensionHelper().getDimensionDivision(this.displayedWorld);
Entity renderViewEntity = Minecraft.getMinecraft().getRenderViewEntity();
Vec3d cameraPos = isNull(renderViewEntity)
? ActiveRenderInfo.getCameraPosition()
Expand All @@ -141,12 +141,14 @@ private void updateSortedList() {
lookVector = lookVector.scale(-1.0);
}

final List<Waypoint> disabledWaypoints = waypointsList.stream()
.filter(Waypoint::isDisabled)
.collect(Collectors.toList());
final List<Waypoint> enabledWaypoints = waypointsList.stream()
.filter(waypoint -> !waypoint.isDisabled())
.collect(Collectors.toList());
final List<Waypoint> disabledWaypoints = new ArrayList<>();
final List<Waypoint> enabledWaypoints = new ArrayList<>();
for (Waypoint w : waypointsList) {
if (w.isDisabled())
disabledWaypoints.add(w);
else
enabledWaypoints.add(w);
}
if (!java.util.Objects.equals(Globals.waypointsSearchFilter, "")) {
enabledWaypoints.removeIf(waypoint -> !waypoint.getName().toLowerCase().contains(Globals.waypointsSearchFilter.toLowerCase()));
disabledWaypoints.removeIf(waypoint -> !waypoint.getName().toLowerCase().contains(Globals.waypointsSearchFilter.toLowerCase()));
Expand Down Expand Up @@ -190,7 +192,7 @@ private List<Waypoint> sortWaypoints(final List<Waypoint> waypointsList, Waypoin
for(KeySortableByOther<Waypoint> k : sortableKeys) {
waypointsSorted.add(k.getKey());
}
if (this.displayedWorld.getContainer().getRootContainer().isSortReversed()) {
if (this.displayedWorld.getContainer().getRoot().isSortReversed()) {
Collections.reverse(waypointsSorted);
}
return waypointsSorted;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/xaeroplus/mixin/client/MixinGuiWaypointsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import xaero.common.IXaeroMinimap;
import xaero.common.gui.GuiWaypoints;
import xaero.common.minimap.waypoints.Waypoint;
import xaero.common.minimap.waypoints.WaypointsManager;
import xaero.hud.minimap.world.MinimapWorld;
import xaeroplus.XaeroPlus;
import xaeroplus.settings.XaeroPlusSettingRegistry;
import xaeroplus.util.Globals;
Expand Down Expand Up @@ -47,11 +47,11 @@ public ArrayList<Waypoint> getSearchFilteredWaypointList() {
filteredWaypoints.add(w);
}
}
final Field waypointsManagerField = thisGuiWaypoints.getClass().getDeclaredField("waypointsManager");
waypointsManagerField.setAccessible(true);
final WaypointsManager waypointsManagerValue = (WaypointsManager) waypointsManagerField.get(thisGuiWaypoints);
if (waypointsManagerValue.getServerWaypoints() != null) {
for(Waypoint w : waypointsManagerValue.getServerWaypoints()) {
final Field displayedWorldField = thisGuiWaypoints.getClass().getDeclaredField("displayedWorld");
displayedWorldField.setAccessible(true);
final MinimapWorld minimapWorld = (MinimapWorld) displayedWorldField.get(thisGuiWaypoints);
if (minimapWorld.getContainer().getServerWaypointManager() != null) {
for(Waypoint w : minimapWorld.getContainer().getServerWaypointManager().getWaypoints()) {
if (w.getName().toLowerCase().contains(Globals.waypointsSearchFilter.toLowerCase())) {
filteredWaypoints.add(w);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,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.util.Globals;

@Mixin(value = MinimapElementOverMapRendererHandler.class, remap = false)
Expand Down Expand Up @@ -42,7 +42,7 @@ public boolean redirectRenderElement(final MinimapElementRenderer instance,
final float partialTicks,
final ScaledResolution scaledResolution) {
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, fontRenderer,
framebuffer, minimapRendererHelper, renderEntity, entityPlayer, renderX, renderY, renderZ,
elementIndex, optionalDepth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import xaero.common.IXaeroMinimap;
import xaero.common.XaeroMinimapSession;
import xaero.common.effect.Effects;
import xaero.common.graphics.ImprovedFramebuffer;
import xaero.common.minimap.MinimapProcessor;
Expand All @@ -33,8 +32,10 @@
import xaero.common.misc.OptimizedMath;
import xaero.common.settings.ModSettings;
import xaero.hud.compat.mods.ImmediatelyFastHelper;
import xaero.hud.minimap.BuiltInHudModules;
import xaero.hud.minimap.Minimap;
import xaero.hud.minimap.MinimapLogs;
import xaero.hud.minimap.module.MinimapSession;
import xaeroplus.settings.XaeroPlusSettingRegistry;
import xaeroplus.util.ColorHelper;
import xaeroplus.util.CustomMinimapFBORenderer;
Expand Down Expand Up @@ -91,7 +92,7 @@ public void loadFrameBuffer(MinimapProcessor minimapProcessor) {

@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 All @@ -113,7 +114,7 @@ public void reloadMapFrameBuffers() {
*/
@Overwrite
public void renderChunksToFBO(
XaeroMinimapSession minimapSession,
MinimapSession minimapSession,
MinimapProcessor minimap,
EntityPlayer player,
Entity renderEntity,
Expand Down Expand Up @@ -200,7 +201,7 @@ public void renderChunksToFBO(
int loadedMapChunkX = minimap.getMinimapWriter().getLoadedMapChunkX();
int loadedMapChunkZ = minimap.getMinimapWriter().getLoadedMapChunkZ();
int loadedWidth = minimap.getMinimapWriter().getLoadedBlocks().length;
boolean slimeChunks = this.modMain.getSettings().getSlimeChunks(minimapSession.getWaypointsManager());
boolean slimeChunks = this.modMain.getSettings().getSlimeChunks(minimapSession);
minX = Math.max(minX, loadedMapChunkX);
minZ = Math.max(minZ, loadedMapChunkZ);
maxX = Math.min(maxX, loadedMapChunkX + loadedWidth - 1);
Expand Down
Loading

0 comments on commit bcca221

Please sign in to comment.