diff --git a/common/src/main/java/xaeroplus/feature/extensions/IScreenRadarRenderContext.java b/common/src/main/java/xaeroplus/feature/extensions/IScreenRadarRenderContext.java deleted file mode 100644 index 53a0c8d4..00000000 --- a/common/src/main/java/xaeroplus/feature/extensions/IScreenRadarRenderContext.java +++ /dev/null @@ -1,8 +0,0 @@ -package xaeroplus.feature.extensions; - -public interface IScreenRadarRenderContext { - - boolean isWorldMap(); - - void setIsWorldMap(boolean isWorldMap); -} diff --git a/common/src/main/java/xaeroplus/feature/render/highlights/ChunkHighlightDatabase.java b/common/src/main/java/xaeroplus/feature/render/highlights/ChunkHighlightDatabase.java index c16008ba..72fb1837 100644 --- a/common/src/main/java/xaeroplus/feature/render/highlights/ChunkHighlightDatabase.java +++ b/common/src/main/java/xaeroplus/feature/render/highlights/ChunkHighlightDatabase.java @@ -65,10 +65,6 @@ private void createMetadataTable() { private void createHighlightsTableIfNotExists(ResourceKey dimension) { try (var statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE IF NOT EXISTS \"" + getTableName(dimension) + "\" (x INTEGER, z INTEGER, foundTime INTEGER)"); - - // cleanup oopsie typo in 2.15 v0 to v1 migration - statement.executeUpdate("DROP INDEX IF EXISTS \"unique_xz" + getTableName(dimension) + "\""); - statement.executeUpdate("CREATE UNIQUE INDEX IF NOT EXISTS \"unique_xz_" + getTableName(dimension) + "\" ON \"" + getTableName(dimension) + "\" (x, z)"); } catch (Exception e) { XaeroPlus.LOGGER.error("Error creating highlights table for db: {} in dimension: {}", databaseName, dimension.location()); diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMapElementRenderHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinMapElementRenderHandler.java deleted file mode 100644 index 84f63501..00000000 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMapElementRenderHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package xaeroplus.mixin.client; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalRef; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import xaero.common.minimap.render.radar.element.RadarRenderContext; -import xaero.map.element.MapElementRenderHandler; -import xaero.map.element.MapElementRenderer; -import xaeroplus.feature.extensions.IScreenRadarRenderContext; - -@Mixin(value = MapElementRenderHandler.class, remap = false) -public class MixinMapElementRenderHandler { - @WrapOperation(method = "renderWithRenderer", at = @At( - value = "INVOKE", - target = "Lxaero/map/element/MapElementRenderer;shouldBeDimScaled()Z" - )) - public boolean captureRenderContextType(final MapElementRenderer instance, final Operation original, - @Local(name = "context") LocalRef contextRef) { - if (contextRef.get() instanceof RadarRenderContext) { - ((IScreenRadarRenderContext) contextRef.get()).setIsWorldMap(true); - } - return original.call(instance); - } -} diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java deleted file mode 100644 index 650b81ca..00000000 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapElementRendererHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package xaeroplus.mixin.client; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -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.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/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" - ), remap = true) // $REMAP - 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); - } - original.call(instance, minimapElementRenderInfo, bufferSource, multiTextureRenderTypeRendererProvider); - } -} diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderContext.java b/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderContext.java deleted file mode 100644 index 4a3b682b..00000000 --- a/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderContext.java +++ /dev/null @@ -1,21 +0,0 @@ -package xaeroplus.mixin.client; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import xaero.common.minimap.render.radar.element.RadarRenderContext; -import xaeroplus.feature.extensions.IScreenRadarRenderContext; - -@Mixin(value = RadarRenderContext.class, remap = false) -public class MixinRadarRenderContext implements IScreenRadarRenderContext { - @Unique private boolean isWorldMap = false; - - @Override - public boolean isWorldMap() { - return isWorldMap; - } - - @Override - public void setIsWorldMap(final boolean isWorldMap) { - this.isWorldMap = isWorldMap; - } -} diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderProvider.java b/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderProvider.java index 706199bc..68b373e8 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderProvider.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinRadarRenderProvider.java @@ -4,46 +4,28 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Mixin; -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.callback.CallbackInfoReturnable; -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 xaero.hud.minimap.element.render.MinimapElementRenderLocation; import xaeroplus.settings.Settings; -import java.util.Objects; - @Mixin(value = RadarRenderProvider.class, remap = false) public class MixinRadarRenderProvider { - - @Shadow - private MinimapRadarList currentList; - - @Inject(method = "setupContextAndGetNext(ILxaero/common/minimap/render/radar/element/RadarRenderContext;)Lnet/minecraft/world/entity/Entity;", at = @At( + @Inject(method = "setupContextAndGetNext(Lxaero/hud/minimap/element/render/MinimapElementRenderLocation;Lxaero/common/minimap/render/radar/element/RadarRenderContext;)Lnet/minecraft/world/entity/Entity;", at = @At( value = "RETURN" ), remap = true) // $REMAP - public void setupContextAndGetNextInject(final int location, final RadarRenderContext context, final CallbackInfoReturnable cir) { + public void forceEntityRadarRenderSettings(final MinimapElementRenderLocation location, final RadarRenderContext context, final CallbackInfoReturnable cir) { final Entity e = cir.getReturnValue(); - if (e instanceof Player) { - if (!Objects.equals(e, Minecraft.getInstance().player)) { - if (Settings.REGISTRY.alwaysRenderPlayerIconOnRadar.get()) { - context.icon = true; - } - if (Settings.REGISTRY.alwaysRenderPlayerWithNameOnRadar.get()) { - context.name = true; - } - } + if (!(e instanceof Player)) return; + if (e == Minecraft.getInstance().player) return; + if (Settings.REGISTRY.alwaysRenderPlayerIconOnRadar.get()) { + context.icon = true; } - - if (!((IScreenRadarRenderContext) (Object) context).isWorldMap()) { - context.nameScale = HudSession.getCurrentSession().getHudMod().getSettings().getDotNameScale() * Globals.minimapScaleMultiplier / Globals.minimapSizeMultiplier; - context.iconScale = this.currentList.getCategory().getSettingValue(EntityRadarCategorySettings.ICON_SCALE) * Globals.minimapScaleMultiplier / Globals.minimapSizeMultiplier; + if (Settings.REGISTRY.alwaysRenderPlayerWithNameOnRadar.get()) { + context.name = true; } } } diff --git a/common/src/main/resources/xaeroplus.mixins.json b/common/src/main/resources/xaeroplus.mixins.json index b03dbd93..17f167ff 100644 --- a/common/src/main/resources/xaeroplus.mixins.json +++ b/common/src/main/resources/xaeroplus.mixins.json @@ -36,7 +36,6 @@ "MixinImprovedFramebuffer", "MixinKeyEventHandler", "MixinLeveledRegion", - "MixinMapElementRenderHandler", "MixinMapPixel", "MixinMapProcessor", "MixinMapSaveLoad", @@ -45,7 +44,6 @@ "MixinMapWriter", "MixinMinimap", "MixinMinimapElementMapRendererHandler", - "MixinMinimapElementRendererHandler", "MixinMinimapFBORenderer", "MixinMinimapModSettings", "MixinMinimapOption", @@ -57,7 +55,6 @@ "MixinModClientEvents", "MixinOverlay", "MixinPatreon", - "MixinRadarRenderContext", "MixinRadarRenderProvider", "MixinSupportXaeroMinimap", "MixinSupportXaeroWorldmap", diff --git a/settings.gradle.kts b/settings.gradle.kts index 8b1bb1ff..6a6a89ef 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,7 @@ pluginManagement { } } gradle.extra.apply { - set("mod_version", "2.24.4") + set("mod_version", "2.24.5") set("minecraft_version", "1.20.4") set("parchment_version", "2024.02.25") set("worldmap_version_fabric", "1.39.0")