diff --git a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/ConfigExpectPlatform.java b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/ConfigExpectPlatform.java index b53272b..5b268a8 100644 --- a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/ConfigExpectPlatform.java +++ b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/ConfigExpectPlatform.java @@ -41,6 +41,11 @@ public static boolean miniRender() { throw new AssertionError(); } + @ExpectPlatform + public static boolean enableScissor() { + throw new AssertionError(); + } + @ExpectPlatform public static Type type() { throw new AssertionError(); diff --git a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/compat/GameRendererMixin.java b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/GameRendererMixin.java similarity index 71% rename from common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/compat/GameRendererMixin.java rename to common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/GameRendererMixin.java index f87ec93..e9f8e2c 100644 --- a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/compat/GameRendererMixin.java +++ b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/GameRendererMixin.java @@ -8,7 +8,7 @@ * https://spdx.org/licenses/OSL-3.0.txt */ -package org.redlance.dima_dencep.mods.rrls.mixins.compat; +package org.redlance.dima_dencep.mods.rrls.mixins; import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform; import org.redlance.dima_dencep.mods.rrls.Rrls; @@ -22,6 +22,7 @@ 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; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -44,14 +45,31 @@ public class GameRendererMixin { Overlay overlay = this.minecraft.overlay; if (OverlayHelper.isRenderingState(overlay)) { - overlay.render(DummyGuiGraphics.INSTANCE, 0, 0, minecraft.getDeltaFrameTime()); + rrls$enableScissor(graphics, () -> + overlay.render(DummyGuiGraphics.INSTANCE, 0, 0, minecraft.getDeltaFrameTime()) + ); if (ConfigExpectPlatform.miniRender()) overlay.rrls$miniRender(graphics); } } catch (RuntimeException ex) { - Rrls.LOGGER.error(ex); + Rrls.LOGGER.error("Failed to draw overlay!", ex); + } + } + + @Unique + private static void rrls$enableScissor(GuiGraphics graphics, Runnable runnable) { + if (ConfigExpectPlatform.enableScissor()) { + graphics.pose().pushPose(); + graphics.enableScissor(0, 0, 0, 0); + + runnable.run(); + + graphics.disableScissor(); + graphics.pose().popPose(); + } else { + runnable.run(); } } } diff --git a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/MinecraftClientMixin.java b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/MinecraftClientMixin.java index 1861b42..cc37e02 100644 --- a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/MinecraftClientMixin.java +++ b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/MinecraftClientMixin.java @@ -44,12 +44,13 @@ public abstract class MinecraftClientMixin { @Inject( method = "", at = @At( - value = "RETURN" + value = "TAIL" ) ) - public void rrls$init(GameConfig args, CallbackInfo ci, @Local(ordinal = 0) Minecraft.GameLoadCookie loadingContext) { - if (ConfigExpectPlatform.forceClose()) - onResourceLoadFinished(loadingContext); + public void rrls$init(GameConfig gameConfig, CallbackInfo ci, @Local(ordinal = 0) Minecraft.GameLoadCookie gameLoadCookie) { + if (ConfigExpectPlatform.forceClose()) { + onResourceLoadFinished(gameLoadCookie); + } } @Inject( @@ -58,16 +59,17 @@ public abstract class MinecraftClientMixin { value = "HEAD" ), cancellable = true - ) // TODO refactor when @WrapMethod - public void rrls$onResourceReloadFailure(Throwable exception, Component resourceName, Minecraft.GameLoadCookie loadingContext, CallbackInfo ci) { + ) + public void rrls$onResourceReloadFailure(Throwable throwable, Component errorMessage, Minecraft.GameLoadCookie gameLoadCookie, CallbackInfo ci) { if (!ConfigExpectPlatform.resetResources()) { - Rrls.LOGGER.error("Caught error loading resourcepacks!", exception); + ci.cancel(); - if (ConfigExpectPlatform.doubleLoad().isLoad()) - reloadResourcePacks(ConfigExpectPlatform.doubleLoad() == DoubleLoad.FORCE_LOAD, loadingContext) - .thenRun(() -> addResourcePackLoadFailToast(resourceName)); + Rrls.LOGGER.error("Caught error loading resourcepacks!", throwable); - ci.cancel(); + if (ConfigExpectPlatform.doubleLoad().isLoad()) { + reloadResourcePacks(ConfigExpectPlatform.doubleLoad() == DoubleLoad.FORCE_LOAD, gameLoadCookie) + .thenRun(() -> addResourcePackLoadFailToast(errorMessage)); + } } } @@ -80,9 +82,10 @@ public abstract class MinecraftClientMixin { ), cancellable = true ) - public void rrls$doubleLoad(Throwable exception, Component resourceName, Minecraft.GameLoadCookie loadingContext, CallbackInfo ci) { - if (!ConfigExpectPlatform.doubleLoad().isLoad()) + public void rrls$doubleLoad(Throwable throwable, Component errorMessage, Minecraft.GameLoadCookie gameLoadCookie, CallbackInfo ci) { + if (!ConfigExpectPlatform.doubleLoad().isLoad()) { ci.cancel(); + } } @ModifyArg( @@ -94,7 +97,7 @@ public abstract class MinecraftClientMixin { ), require = 0 ) - public boolean rrls$doubleLoad(boolean force) { + public boolean rrls$doubleLoad(boolean error) { // always true return ConfigExpectPlatform.doubleLoad() == DoubleLoad.FORCE_LOAD; } diff --git a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/workaround/SimpleReloadInstanceMixin.java b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/workaround/SimpleReloadInstanceMixin.java new file mode 100644 index 0000000..081a5ee --- /dev/null +++ b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/mixins/workaround/SimpleReloadInstanceMixin.java @@ -0,0 +1,77 @@ +/* + * Copyright 2023 - 2024 dima_dencep. + * + * Licensed under the Open Software License, Version 3.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * https://spdx.org/licenses/OSL-3.0.txt + */ + +package org.redlance.dima_dencep.mods.rrls.mixins.workaround; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiSpriteManager; +import net.minecraft.client.gui.font.FontManager; +import net.minecraft.client.resources.SplashManager; +import net.minecraft.client.resources.language.LanguageManager; +import net.minecraft.server.packs.resources.PreparableReloadListener; +import net.minecraft.util.Unit; +import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform; +import org.redlance.dima_dencep.mods.rrls.Rrls; +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 java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.function.BiFunction; + +@Mixin(targets = "net.minecraft.server.packs.resources.SimpleReloadInstance$1") +public class SimpleReloadInstanceMixin { + @Shadow + @Final + PreparableReloadListener val$listener; + + @WrapOperation( + method = "wait", + at = @At( + value = "INVOKE", + target = "Ljava/util/concurrent/CompletableFuture;thenCombine(Ljava/util/concurrent/CompletionStage;Ljava/util/function/BiFunction;)Ljava/util/concurrent/CompletableFuture;" + ) + ) + public CompletableFuture rrls$async(CompletableFuture instance, CompletionStage other, BiFunction fn, Operation> original) { + if (ConfigExpectPlatform.forceClose() && rrls$filterListener()) { + Rrls.LOGGER.info("Skip wait for {}!", val$listener.getName()); + + return CompletableFuture.completedFuture(fn.apply(null, null)); + } + + return original.call(instance, other, fn); + } + + @Unique + private boolean rrls$filterListener() { + if (this.val$listener instanceof FontManager fontManager) { + return !fontManager.fontSets.containsKey(Minecraft.DEFAULT_FONT); + } + + if (this.val$listener instanceof LanguageManager languageManager) { + return languageManager.getLanguages().size() == 1; + } + + if (this.val$listener instanceof SplashManager splashManager) { + return splashManager.splashes.isEmpty(); + } + + if (this.val$listener instanceof GuiSpriteManager spriteManager) { + return spriteManager.textureAtlas.texturesByName.isEmpty(); + } + + return false; + } +} diff --git a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/utils/DummyGuiGraphics.java b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/utils/DummyGuiGraphics.java index 400d2fd..a2afd2a 100644 --- a/common/src/main/java/org/redlance/dima_dencep/mods/rrls/utils/DummyGuiGraphics.java +++ b/common/src/main/java/org/redlance/dima_dencep/mods/rrls/utils/DummyGuiGraphics.java @@ -43,7 +43,7 @@ private DummyGuiGraphics() { @Override @Deprecated - public void drawManaged(Runnable drawCallback) { + public void drawManaged(Runnable runnable) { } @Override @@ -61,23 +61,23 @@ public void flush() { } @Override - public void hLine(int x1, int x2, int y, int color) { + public void hLine(int minX, int maxX, int y, int color) { } @Override - public void hLine(RenderType layer, int x1, int x2, int y, int color) { + public void hLine(RenderType renderType, int minX, int maxX, int y, int color) { } @Override - public void vLine(int x, int y1, int y2, int color) { + public void vLine(int x, int minY, int maxY, int color) { } @Override - public void vLine(RenderType layer, int x, int y1, int y2, int color) { + public void vLine(RenderType renderType, int x, int minY, int maxY, int color) { } @Override - public void enableScissor(int x1, int y1, int x2, int y2) { + public void enableScissor(int minX, int minY, int maxX, int maxY) { } @Override @@ -85,12 +85,12 @@ public void disableScissor() { } @Override - public boolean containsPointInScissor(int i, int j) { + public boolean containsPointInScissor(int x, int y) { return false; } @Override - public void applyScissor(@Nullable ScreenRectangle rect) { + public void applyScissor(@Nullable ScreenRectangle rectangle) { } @Override @@ -98,93 +98,93 @@ public void setColor(float red, float green, float blue, float alpha) { } @Override - public void fill(int x1, int y1, int x2, int y2, int color) { + public void fill(int minX, int minY, int maxX, int maxY, int color) { } @Override - public void fill(int x1, int y1, int x2, int y2, int z, int color) { + public void fill(int minX, int minY, int maxX, int maxY, int z, int color) { } @Override - public void fill(RenderType layer, int x1, int y1, int x2, int y2, int color) { + public void fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int color) { } @Override - public void fill(RenderType layer, int x1, int y1, int x2, int y2, int z, int color) { + public void fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int z, int color) { } @Override - public void fillGradient(int startX, int startY, int endX, int endY, int colorStart, int colorEnd) { + public void fillGradient(int x1, int y1, int x2, int y2, int colorFrom, int colorTo) { } @Override - public void fillGradient(int startX, int startY, int endX, int endY, int z, int colorStart, int colorEnd) { + public void fillGradient(int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo) { } @Override - public void fillGradient(RenderType layer, int startX, int startY, int endX, int endY, int colorStart, int colorEnd, int z) { + public void fillGradient(RenderType renderType, int x1, int y1, int x2, int y2, int colorFrom, int colorTo, int z) { } @Override - public void fillGradient(VertexConsumer vertexConsumer, int startX, int startY, int endX, int endY, int z, int colorStart, int colorEnd) { + public void fillGradient(VertexConsumer consumer, int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo) { } @Override - public void fillRenderType(RenderType renderType, int i, int j, int k, int l, int m) { + public void fillRenderType(RenderType renderType, int x1, int y1, int x2, int y2, int z) { } @Override - public void drawCenteredString(Font textRenderer, String text, int centerX, int y, int color) { + public void drawCenteredString(Font font, String text, int x, int y, int color) { } @Override - public void drawCenteredString(Font textRenderer, Component text, int centerX, int y, int color) { + public void drawCenteredString(Font font, Component text, int x, int y, int color) { } @Override - public void drawCenteredString(Font textRenderer, FormattedCharSequence text, int centerX, int y, int color) { + public void drawCenteredString(Font font, FormattedCharSequence text, int x, int y, int color) { } @Override - public int drawString(Font textRenderer, @Nullable String text, int x, int y, int color) { + public int drawString(Font font, @Nullable String text, int x, int y, int color) { return -1; } @Override - public int drawString(Font textRenderer, @Nullable String text, int x, int y, int color, boolean shadow) { + public int drawString(Font font, @Nullable String text, int x, int y, int color, boolean dropShadow) { return -1; } @Override - public int drawString(Font textRenderer, FormattedCharSequence text, int x, int y, int color) { + public int drawString(Font font, FormattedCharSequence text, int x, int y, int color) { return -1; } @Override - public int drawString(Font textRenderer, FormattedCharSequence text, int x, int y, int color, boolean shadow) { + public int drawString(Font font, FormattedCharSequence text, int x, int y, int color, boolean dropShadow) { return -1; } @Override - public int drawString(Font textRenderer, Component text, int x, int y, int color) { + public int drawString(Font font, Component text, int x, int y, int color) { return -1; } @Override - public int drawString(Font textRenderer, Component text, int x, int y, int color, boolean shadow) { + public int drawString(Font font, Component text, int x, int y, int color, boolean dropShadow) { return -1; } @Override - public void drawWordWrap(Font textRenderer, FormattedText text, int x, int y, int width, int color) { + public void drawWordWrap(Font font, FormattedText text, int x, int y, int lineWidth, int color) { } @Override - public void blit(int x, int y, int z, int width, int height, TextureAtlasSprite sprite) { + public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite) { } @Override - public void blit(int x, int y, int z, int width, int height, TextureAtlasSprite sprite, float red, float green, float blue, float alpha) { + public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite, float red, float green, float blue, float alpha) { } @Override @@ -192,67 +192,67 @@ public void renderOutline(int x, int y, int width, int height, int color) { } @Override - public void blitSprite(ResourceLocation texture, int x, int y, int width, int height) { + public void blitSprite(ResourceLocation sprite, int x, int y, int width, int height) { } @Override - public void blitSprite(ResourceLocation texture, int x, int y, int z, int width, int height) { + public void blitSprite(ResourceLocation sprite, int x, int y, int blitOffset, int width, int height) { } @Override - public void blitSprite(ResourceLocation texture, int i, int j, int k, int l, int x, int y, int width, int height) { + public void blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight) { } @Override - public void blitSprite(ResourceLocation texture, int i, int j, int k, int l, int x, int y, int z, int width, int height) { + public void blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight) { } @Override - public void blitSprite(TextureAtlasSprite sprite, int i, int j, int k, int l, int x, int y, int z, int width, int height) { + public void blitSprite(TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight) { } @Override - public void blitSprite(TextureAtlasSprite sprite, int x, int y, int z, int width, int height) { + public void blitSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height) { } @Override - public void blit(ResourceLocation texture, int x, int y, int u, int v, int width, int height) { + public void blit(ResourceLocation atlasLocation, int x, int y, int uOffset, int vOffset, int uWidth, int vHeight) { } @Override - public void blit(ResourceLocation texture, int x, int y, int z, float u, float v, int width, int height, int textureWidth, int textureHeight) { + public void blit(ResourceLocation atlasLocation, int x, int y, int blitOffset, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight) { } @Override - public void blit(ResourceLocation texture, int x, int y, int width, int height, float u, float v, int regionWidth, int regionHeight, int textureWidth, int textureHeight) { + public void blit(ResourceLocation atlasLocation, int x, int y, int width, int height, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight) { } @Override - public void blit(ResourceLocation texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + public void blit(ResourceLocation atlasLocation, int x, int y, float uOffset, float vOffset, int width, int height, int textureWidth, int textureHeight) { } @Override - public void blit(ResourceLocation texture, int x1, int x2, int y1, int y2, int z, int regionWidth, int regionHeight, float u, float v, int textureWidth, int textureHeight) { + public void blit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, int uWidth, int vHeight, float uOffset, float vOffset, int textureWidth, int textureHeight) { } @Override - public void innerBlit(ResourceLocation texture, int x1, int x2, int y1, int y2, int z, float u1, float u2, float v1, float v2) { + public void innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV) { } @Override - public void innerBlit(ResourceLocation texture, int x1, int x2, int y1, int y2, int z, float u1, float u2, float v1, float v2, float red, float green, float blue, float alpha) { + public void innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV, float red, float green, float blue, float alpha) { } @Override - public void blitNineSlicedSprite(TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int z, int width, int height) { + public void blitNineSlicedSprite(TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int blitOffset, int width, int height) { } @Override - public void blitTiledSprite(TextureAtlasSprite sprite, int x, int y, int z, int width, int height, int i, int j, int tileWidth, int tileHeight, int k, int l) { + public void blitTiledSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height, int uPosition, int vPosition, int spriteWidth, int spriteHeight, int nineSliceWidth, int nineSliceHeight) { } @Override - public void renderItem(ItemStack item, int x, int y) { + public void renderItem(ItemStack stack, int x, int y) { } @Override @@ -260,7 +260,7 @@ public void renderItem(ItemStack stack, int x, int y, int seed) { } @Override - public void renderItem(ItemStack stack, int x, int y, int seed, int z) { + public void renderItem(ItemStack stack, int x, int y, int seed, int guiOffset) { } @Override @@ -276,50 +276,50 @@ public void renderItem(LivingEntity entity, ItemStack stack, int x, int y, int s } @Override - public void renderItem(@Nullable LivingEntity entity, @Nullable Level world, ItemStack stack, int x, int y, int seed) { + public void renderItem(@Nullable LivingEntity entity, @Nullable Level level, ItemStack stack, int x, int y, int seed) { } @Override - public void renderItem(@Nullable LivingEntity entity, @Nullable Level world, ItemStack stack, int x, int y, int seed, int z) { + public void renderItem(@Nullable LivingEntity entity, @Nullable Level level, ItemStack stack, int x, int y, int seed, int guiOffset) { } @Override - public void renderItemDecorations(Font textRenderer, ItemStack stack, int x, int y) { + public void renderItemDecorations(Font font, ItemStack stack, int x, int y) { } @Override - public void renderItemDecorations(Font textRenderer, ItemStack stack, int x, int y, @Nullable String countOverride) { + public void renderItemDecorations(Font font, ItemStack stack, int x, int y, @Nullable String text) { } @Override - public void renderTooltip(Font textRenderer, ItemStack stack, int x, int y) { + public void renderTooltip(Font font, ItemStack stack, int mouseX, int mouseY) { } @Override - public void renderTooltip(Font textRenderer, List text, Optional data, int x, int y) { + public void renderTooltip(Font font, List tooltipLines, Optional visualTooltipComponent, int mouseX, int mouseY) { } @Override - public void renderTooltip(Font textRenderer, Component text, int x, int y) { + public void renderTooltip(Font font, Component text, int mouseX, int mouseY) { } @Override - public void renderComponentTooltip(Font textRenderer, List text, int x, int y) { + public void renderComponentTooltip(Font font, List tooltipLines, int mouseX, int mouseY) { } @Override - public void renderTooltip(Font textRenderer, List text, int x, int y) { + public void renderTooltip(Font font, List tooltipLines, int mouseX, int mouseY) { } @Override - public void renderTooltip(Font textRenderer, List text, ClientTooltipPositioner positioner, int x, int y) { + public void renderTooltip(Font font, List tooltipLines, ClientTooltipPositioner tooltipPositioner, int mouseX, int mouseY) { } @Override - public void renderTooltipInternal(Font textRenderer, List components, int x, int y, ClientTooltipPositioner positioner) { + public void renderTooltipInternal(Font font, List components, int mouseX, int mouseY, ClientTooltipPositioner tooltipPositioner) { } @Override - public void renderComponentHoverEffect(Font textRenderer, @Nullable Style style, int x, int y) { + public void renderComponentHoverEffect(Font font, @Nullable Style style, int mouseX, int mouseY) { } } diff --git a/common/src/main/resources/assets/rrls/lang/en_us.json b/common/src/main/resources/assets/rrls/lang/en_us.json index b37deb8..41cb6a5 100644 --- a/common/src/main/resources/assets/rrls/lang/en_us.json +++ b/common/src/main/resources/assets/rrls/lang/en_us.json @@ -10,6 +10,8 @@ "text.autoconfig.rrls.option.ignoreScreen": "Ignoring uninitialized screen on loading", "text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "MAY CAUSE PROBLEMS", "text.autoconfig.rrls.option.miniRender": "Render a mini (aka hidden) version of the overlay", + "text.autoconfig.rrls.option.enableScissor": "Trim the rendering of the default overlay", + "text.autoconfig.rrls.option.enableScissor.@Tooltip": "Enable this if the window is flooded with color (mostly black)", "text.autoconfig.rrls.option.type": "What will be displayed on reloading", "text.autoconfig.rrls.option.reloadText": "The text that will be displayed if TEXT is selected above", "text.autoconfig.rrls.option.resetResources": "Reset resources when failed load", diff --git a/common/src/main/resources/assets/rrls/lang/ru_ru.json b/common/src/main/resources/assets/rrls/lang/ru_ru.json index 5e34ffe..84f049d 100644 --- a/common/src/main/resources/assets/rrls/lang/ru_ru.json +++ b/common/src/main/resources/assets/rrls/lang/ru_ru.json @@ -9,6 +9,8 @@ "text.autoconfig.rrls.option.ignoreScreen": "Игнорирование неинициализированного экрана при загрузке", "text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "МОЖЕТ ВЫЗВАТЬ ПРОБЛЕМЫ", "text.autoconfig.rrls.option.miniRender": "Отображение мини(скрытой)-версии оверлея", + "text.autoconfig.rrls.option.enableScissor": "Обрезать рендеринг стандартного оверлея", + "text.autoconfig.rrls.option.enableScissor.@Tooltip": "Включите эту опцию, если окно заливается цветом (в основном черным)", "text.autoconfig.rrls.option.type": "Что будет отображаться при перезагрузке", "text.autoconfig.rrls.option.reloadText": "Текст, который будет отображаться, если выше выбран пункт TEXT", "text.autoconfig.rrls.option.resetResources": "Сброс ресурсов при неудачной загрузке", diff --git a/common/src/main/resources/assets/rrls/lang/zh_tw.json b/common/src/main/resources/assets/rrls/lang/zh_tw.json index 06752fd..5ea2118 100644 --- a/common/src/main/resources/assets/rrls/lang/zh_tw.json +++ b/common/src/main/resources/assets/rrls/lang/zh_tw.json @@ -1,22 +1,33 @@ { "text.autoconfig.rrls.title": "移除重新載入畫面|Remove Reloading Screen", + "text.autoconfig.rrls.category.global": "全球", + "text.autoconfig.rrls.category.splash": "閃爍標語的覆蓋層", + "text.autoconfig.rrls.category.other": "其他", + "text.autoconfig.rrls.category.platform": "特定平台", "text.autoconfig.rrls.option.hideType": "將被隱藏的覆蓋層", "text.autoconfig.rrls.option.rgbProgress": "彩色進度條", "text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§c可能會引起癲癇", "text.autoconfig.rrls.option.ignoreScreen": "隱藏載入畫面", "text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "可能會引起問題", "text.autoconfig.rrls.option.miniRender": "資源包(重新)載入進度顯示", + "text.autoconfig.rrls.option.enableScissor": "修剪默認疊加層的渲染效果", + "text.autoconfig.rrls.option.enableScissor.@Tooltip": "如果窗口被顏色淹沒(大部分為黑色),則啟用此功能", "text.autoconfig.rrls.option.type": "在重新載入時會顯示什麼", "text.autoconfig.rrls.option.reloadText": "如果上方選擇為 TEXT,將顯示下列文字。", "text.autoconfig.rrls.option.resetResources": "當載入失敗時重設資源", "text.autoconfig.rrls.option.reInitScreen": "在重新載入後重新初始化目前畫面。", "text.autoconfig.rrls.option.reInitScreen.@Tooltip": "停用此功能可能會在重新載入完成後解決卡住的問題。", + "text.autoconfig.rrls.option.removeOverlayAtEnd": "結束後隱藏覆蓋層", + "text.autoconfig.rrls.option.removeOverlayAtEnd.@Tooltip": "無限 (重新)加載?", "text.autoconfig.rrls.option.earlyPackStatusSend": "提早傳送伺服器資源包狀態", "text.autoconfig.rrls.option.earlyPackStatusSend.@Tooltip[0]": "有些伺服器特別等待玩家載入資源,因此遊戲可能顯示不正確", "text.autoconfig.rrls.option.earlyPackStatusSend.@Tooltip[1]": "例如:重新載入資源時你正在地下,這可能導致顯示異常", "text.autoconfig.rrls.option.animationSpeed": "載入動畫速度", "text.autoconfig.rrls.option.animationSpeed.@Tooltip": "以毫秒為單位", + "text.autoconfig.rrls.option.doubleLoad": "如果發生錯誤,請重新載入資源", "text.autoconfig.rrls.option.forceClose": "隱藏載入覆蓋,即使背後沒有東西", "text.autoconfig.rrls.option.forceClose.@Tooltip": "實際上現在是有的,我已經計畫了很長一段時間的解決方案,但現在在 Minecraft 中已經有一個 :)", + "text.autoconfig.rrls.option.blockOverlay": "完全阻斷覆蓋層的使用", + "text.autoconfig.rrls.option.blockOverlay.@Tooltip": "使用風險自負!", "text.autoconfig.rrls.option.skipForgeOverlay": "用原版替代 (Neo)Forge 載入覆蓋" -} +} \ No newline at end of file diff --git a/common/src/main/resources/rrls.accesswidener b/common/src/main/resources/rrls.accesswidener index 07900e7..5d76381 100644 --- a/common/src/main/resources/rrls.accesswidener +++ b/common/src/main/resources/rrls.accesswidener @@ -31,3 +31,7 @@ accessible field net/minecraft/client/Minecraft overlay Lnet/minecraft/client/gu accessible class net/minecraft/client/resources/server/ServerPackManager$ServerPackData accessible field net/minecraft/client/gui/screens/LoadingOverlay currentProgress F accessible class net/minecraft/client/Minecraft$GameLoadCookie +accessible field net/minecraft/client/gui/font/FontManager fontSets Ljava/util/Map; +accessible field net/minecraft/client/resources/TextureAtlasHolder textureAtlas Lnet/minecraft/client/renderer/texture/TextureAtlas; +accessible field net/minecraft/client/renderer/texture/TextureAtlas texturesByName Ljava/util/Map; +accessible field net/minecraft/client/resources/SplashManager splashes Ljava/util/List; diff --git a/common/src/main/resources/rrls-common.mixins.json b/common/src/main/resources/rrls.mixins.json similarity index 86% rename from common/src/main/resources/rrls-common.mixins.json rename to common/src/main/resources/rrls.mixins.json index 1ef1120..682ad4c 100644 --- a/common/src/main/resources/rrls-common.mixins.json +++ b/common/src/main/resources/rrls.mixins.json @@ -7,11 +7,12 @@ "MinecraftClientMixin", "LoadingOverlayMixin", "TitleScreenMixin", - "compat.GameRendererMixin", + "GameRendererMixin", "compat.RendererKeyboardMouseMixin", "compat.OverlayMixin", "compat.ServerPackManagerMixin", "workaround.GuiGraphicsMixin", + "workaround.SimpleReloadInstanceMixin", "workaround.VertexBufferMixin" ], "injectors": { diff --git a/fabric/src/main/java/org/redlance/dima_dencep/mods/rrls/fabric/ConfigExpectPlatformImpl.java b/fabric/src/main/java/org/redlance/dima_dencep/mods/rrls/fabric/ConfigExpectPlatformImpl.java index 81a8c35..954b071 100644 --- a/fabric/src/main/java/org/redlance/dima_dencep/mods/rrls/fabric/ConfigExpectPlatformImpl.java +++ b/fabric/src/main/java/org/redlance/dima_dencep/mods/rrls/fabric/ConfigExpectPlatformImpl.java @@ -40,6 +40,10 @@ public class ConfigExpectPlatformImpl implements ConfigData { @ConfigEntry.Category("global") public boolean miniRender = true; + @ConfigEntry.Category("global") + @ConfigEntry.Gui.Tooltip + public boolean enableScissor = false; + @ConfigEntry.Category("splash") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) public Type type = Type.PROGRESS; @@ -90,6 +94,10 @@ public static boolean miniRender() { return RrlsFabric.MOD_CONFIG.miniRender; } + public static boolean enableScissor() { + return RrlsFabric.MOD_CONFIG.enableScissor; + } + public static Type type() { return RrlsFabric.MOD_CONFIG.type; } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index d018233..be7a746 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -12,13 +12,15 @@ "nneewwtt", "Madis0", "notlin4", - "Amirhan-Taipovjan", + "oldveseliyschoolnik", "GodGun968", "TheBossMagnus", "LostLuma", "FITFC", "Gazmanovich", - "TheLegendofSaram" + "TheLegendofSaram", + "thesh1xx", + "yichifauzi" ], "contact": { "homepage": "https://curseforge.com/minecraft/mc-mods/rrls", @@ -37,14 +39,12 @@ ] }, "mixins": [ - "rrls.mixins.json", - "rrls-common.mixins.json" + "rrls.mixins.json" ], "depends": { "fabricloader": ">=${project.loader_version}", "minecraft": ">=${project.minecraft_version}", - "cloth-config": ">=${project.cloth_config_version}", - "java": ">=${project.targetCompatibility}" + "cloth-config": ">=${project.cloth_config_version}" }, "conflicts": { "dynamicfps": "*" diff --git a/fabric/src/main/resources/rrls.mixins.json b/fabric/src/main/resources/rrls.mixins.json deleted file mode 100644 index 307ac81..0000000 --- a/fabric/src/main/resources/rrls.mixins.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "org.redlance.dima_dencep.mods.rrls.fabric.mixins", - "compatibilityLevel": "JAVA_21", - "client": [], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/forge/RrlsForge.java b/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/forge/RrlsForge.java index 6b1d95c..a01985a 100644 --- a/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/forge/RrlsForge.java +++ b/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/forge/RrlsForge.java @@ -10,12 +10,14 @@ /*package org.redlance.dima_dencep.mods.rrls.forge; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.ModContainer; import org.redlance.dima_dencep.mods.rrls.Rrls; import net.neoforged.fml.common.Mod; -@Mod(Rrls.MOD_ID) +@Mod(value = Rrls.MOD_ID, dist = Dist.CLIENT) public class RrlsForge extends Rrls { - public RrlsForge() { + public RrlsForge(ModContainer container) { // no-op } }*/ diff --git a/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/neoforge/ConfigExpectPlatformImpl.java b/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/neoforge/ConfigExpectPlatformImpl.java index 3e11d2f..02759b8 100644 --- a/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/neoforge/ConfigExpectPlatformImpl.java +++ b/forge/src/main/java/org/redlance/dima_dencep/mods/rrls/neoforge/ConfigExpectPlatformImpl.java @@ -33,6 +33,7 @@ public class ConfigExpectPlatformImpl { // TODO categorize public final ModConfigSpec.BooleanValue forceClose; public final ModConfigSpec.BooleanValue blockOverlay; public final ModConfigSpec.BooleanValue miniRender; + public final ModConfigSpec.BooleanValue enableScissor; public final ModConfigSpec.EnumValue type; public final ModConfigSpec.ConfigValue reloadText; public final ModConfigSpec.BooleanValue resetResources; @@ -67,6 +68,11 @@ public ConfigExpectPlatformImpl(ModConfigSpec.Builder builder) { .translation("text.autoconfig.rrls.option.miniRender") .define("miniRender", true); + enableScissor = builder + .translation("text.autoconfig.rrls.option.enableScissor") + .comment("text.autoconfig.rrls.option.enableScissor.@Tooltip") + .define("enableScissor", false); + type = builder .translation("text.autoconfig.rrls.option.type") .defineEnum("type", Type.PROGRESS); @@ -113,7 +119,7 @@ public ConfigExpectPlatformImpl(ModConfigSpec.Builder builder) { Optional activeContainer = ModList.get().getModContainerById(Rrls.MOD_ID); ModConfigSpec configSpec = ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getValue(); - final ModConfig modConfig = new ModConfig(ModConfig.Type.CLIENT, configSpec, activeContainer.orElse(null), "rrls.toml") { + final ModConfig modConfig = new ModConfig(ModConfig.Type.STARTUP, configSpec, activeContainer.orElse(null), "rrls.toml") { @Override public String getModId() { if (this.container == null) { @@ -124,11 +130,11 @@ public String getModId() { } }; activeContainer.ifPresentOrElse( - container -> container.addConfig(modConfig), + container -> container.addConfig(modConfig), // Configs with the STARTUP type are loaded here () -> Rrls.LOGGER.error("Unable to find ModContainer, this can cause issues!") ); - if (!configSpec.isLoaded()) { + if (!configSpec.isLoaded()) { // Fallback Rrls.LOGGER.warn("Config is not loaded?"); configSpec.acceptConfig( @@ -158,6 +164,10 @@ public static boolean miniRender() { return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().miniRender.get(); } + public static boolean enableScissor() { + return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().enableScissor.get(); + } + public static Type type() { return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().type.get(); } diff --git a/forge/src/main/resources/META-INF/neoforge.mods.toml b/forge/src/main/resources/META-INF/neoforge.mods.toml index aa0f9a3..580814d 100644 --- a/forge/src/main/resources/META-INF/neoforge.mods.toml +++ b/forge/src/main/resources/META-INF/neoforge.mods.toml @@ -11,14 +11,14 @@ displayURL = "https://curseforge.com/minecraft/mc-mods/rrls" displayName = "Remove Reloading Screen" # updateJSONURL = "https://api.modrinth.com/updates/rrls/forge_updates.json" authors = "dima_dencep" -credits = "ne4t0gg, nneewwtt, Madis0, notlin, Amirhan-Taipovjan, GodGun968, TheBossMagnus, LostLuma, FITFC, Gazmanovich, TheLegendofSaram" +credits = "ne4t0gg, nneewwtt, Madis0, notlin, oldveseliyschoolnik, GodGun968, TheBossMagnus, LostLuma, FITFC, Gazmanovich, TheLegendofSaram, thesh1xx, yichifauzi" description = "Makes resource packs load in the background, allowing you to do other things while waiting!" logoFile = "icon.png" [[mixins]] config = "rrls.mixins.json" [[mixins]] -config = "rrls-common.mixins.json" +config = "rrls-forge.mixins.json" [[dependencies.rrls]] modId = "neoforge" diff --git a/forge/src/main/resources/rrls.mixins.json b/forge/src/main/resources/rrls-forge.mixins.json similarity index 100% rename from forge/src/main/resources/rrls.mixins.json rename to forge/src/main/resources/rrls-forge.mixins.json diff --git a/gradle.properties b/gradle.properties index ceebe28..45bdb10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,10 @@ org.gradle.parallel=true minecraft_version = 1.20.6 parchment_version = 2024.05.01 loader_version = 0.15.11 - forge_version = 20.6.62-beta + forge_version = 20.6.111-beta # Mod Properties - mod_version = 4.0.5 + mod_version = 4.0.7 maven_group = org.redlance.dima_dencep.mods archives_base_name = rrls