Skip to content

Commit

Permalink
Correct showIn
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Jan 20, 2024
1 parent f48be4b commit 58f8385
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.github.dimadencep.mods.rrls.config.AprilFool;
import com.github.dimadencep.mods.rrls.config.HideType;
import com.github.dimadencep.mods.rrls.config.ShowIn;
import com.github.dimadencep.mods.rrls.config.Type;
import dev.architectury.injectables.annotations.ExpectPlatform;

Expand All @@ -33,7 +32,7 @@ public static boolean forceClose() {
}

@ExpectPlatform
public static ShowIn showIn() {
public static boolean miniRender() {
throw new AssertionError();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface SplashAccessor {
default void rrls$setAttachType(AttachType type) {
}

default void rrls$render(DrawContext context, boolean isGame) {
default void rrls$miniRender(DrawContext context) {
}

default AttachType rrls$filterAttachType(Screen screen, boolean reloading) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public abstract class SplashOverlayMixin extends Overlay {
}

@Override
public void rrls$render(DrawContext context, boolean isGame) {
if (!ConfigExpectPlatform.showIn().canShow(isGame)) return;

public void rrls$miniRender(DrawContext context) {
int i = context.getScaledWindowWidth();
int j = context.getScaledWindowHeight();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.github.dimadencep.mods.rrls.mixins.compat;

import com.github.dimadencep.mods.rrls.ConfigExpectPlatform;
import com.github.dimadencep.mods.rrls.accessor.SplashAccessor;
import com.github.dimadencep.mods.rrls.utils.DummyDrawContext;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Overlay;
import net.minecraft.client.render.GameRenderer;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -26,12 +29,15 @@ public class GameRendererMixin {
ordinal = 0
)
)
public Overlay rrls$fixOverlayRendering(Overlay original) { // TODO @Local(name = "i", ordinal = 0, index = 7) int mouseX, @Local(name = "j", ordinal = 1, index = 8) int mouseY
public Overlay rrls$fixOverlayRendering(Overlay original, @Local(ordinal = 0) DrawContext drawContext) { // TODO @Local(name = "i", ordinal = 0, index = 7) int mouseX, @Local(name = "j", ordinal = 1, index = 8) int mouseY
if (original == null || original.rrls$getAttachType() != SplashAccessor.AttachType.HIDE)
return original;

original.render(DummyDrawContext.INSTANCE, 0, 0, client.getLastFrameDuration());

if (ConfigExpectPlatform.miniRender())
original.rrls$miniRender(drawContext);

return null;
}
}
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/be_by.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§cМОЖА ВЫКЛІКАЦЬ ЭПІЛЕПСІЮ",
"text.autoconfig.rrls.option.ignoreScreen": "Схаваць экраны загрузкі",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "МОГУЦЬ УЗНІКНУЦЬ ПРАБЛЕМЫ",
"text.autoconfig.rrls.option.showIn": "Адлюстраванне прагрэссу перазагрузкі пакетаў рэсурсаў",
"text.autoconfig.rrls.option.miniRender": "Адлюстраванне прагрэссу перазагрузкі пакетаў рэсурсаў",
"text.autoconfig.rrls.option.resetResources": "Скідваць пакеты рэсурсаў, калі не атрымалася загрузіць",
"text.autoconfig.rrls.option.reInitScreen": "Рэініцыялізацыя бягучага экрана пасля перазагрузкі",
"text.autoconfig.rrls.option.reInitScreen.@Tooltip": "Адключэнне гэтай функцыі можа выклікаць праблемы пасля сканчэння перазагрузкі"
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§cMAY CAUSE EPILEPSY",
"text.autoconfig.rrls.option.ignoreScreen": "Ignoring uninitialized screen on loading",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "MAY CAUSE PROBLEMS",
"text.autoconfig.rrls.option.showIn": "Resource reloading process display",
"text.autoconfig.rrls.option.miniRender": "Resource (re)loading process display",
"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",
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/it_it.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§cPOTREBBE CAUSARE EPILESSIA",
"text.autoconfig.rrls.option.ignoreScreen": "Nascondi la schermata di ri-caricamento",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "POTREBBE CAUSARE PROBLEMI",
"text.autoconfig.rrls.option.showIn": "Visualizzazione del processo di ricaricamento dei pacchetti di risorse",
"text.autoconfig.rrls.option.miniRender": "Visualizzazione del processo di ricaricamento dei pacchetti di risorse",
"text.autoconfig.rrls.option.resetResources": "Ripristina i pacchetti di risorse se il caricamento fallisce",
"text.autoconfig.rrls.option.reInitScreen": "Reinizza la schermata corrente dopo un ricaricamento",
"text.autoconfig.rrls.option.reInitScreen.@Tooltip": "La disattivare questa funzione può eliminare il blocco dopo il completamento del ricaricamento"
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "PODE CAUSAR EPILEPSIA",
"text.autoconfig.rrls.option.ignoreScreen": "Ocultar tela de carregamento",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "PODE CAUSAR PROBLEMAS",
"text.autoconfig.rrls.option.showIn": "Exibição do processo de recarga de recursos",
"text.autoconfig.rrls.option.miniRender": "Exibição do processo de recarga de recursos",
"text.autoconfig.rrls.option.resetResources": "Redefinir recursos quando falha no carregamento",
"text.autoconfig.rrls.option.reInitScreen": "Reiniciando a tela atual após uma recarga",
"text.autoconfig.rrls.option.reInitScreen.@Tooltip": "Desativar esse recurso pode eliminar o desligamento após a conclusão do recarregamento",
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§cМОЖЕТ ВЫЗВАТЬ ЭПИЛЕПСИЮ",
"text.autoconfig.rrls.option.ignoreScreen": "Игнорирование неинициализированного экрана при загрузке",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "МОЖЕТ ВЫЗВАТЬ ПРОБЛЕМЫ",
"text.autoconfig.rrls.option.showIn": "Отображение процесса перезагрузки ресурсов",
"text.autoconfig.rrls.option.miniRender": "Отображение процесса (пере)загрузки ресурсов",
"text.autoconfig.rrls.option.type": "Что будет отображаться при перезагрузке",
"text.autoconfig.rrls.option.reloadText": "Текст, который будет отображаться, если выше выбран пункт TEXT",
"text.autoconfig.rrls.option.resetResources": "Сброс ресурсов при неудачной загрузке",
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/tt_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§cЭПИЛЕПСИЯНЕ ЧАКЫРА АЛА",
"text.autoconfig.rrls.option.ignoreScreen": "Йөкләү экранын яшерү",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "ПРОБЛЕМАЛАРНЫ ЧАКЫРА АЛА",
"text.autoconfig.rrls.option.showIn": "Ресурслар яңадан йөкләү процессын күрсәтү",
"text.autoconfig.rrls.option.miniRender": "Ресурслар яңадан йөкләү процессын күрсәтү",
"text.autoconfig.rrls.option.type": "Яңадан йөкләгәндә күрсәтелүче",
"text.autoconfig.rrls.option.reloadText": "Күрсәтеләчәҡ текст, әгәр TEXT өстә сайланса",
"text.autoconfig.rrls.option.resetResources": "Йөкләп булмаганда ресурсларын ташлату",
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§c可能引起癫痫",
"text.autoconfig.rrls.option.ignoreScreen": "隐藏加载屏幕",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "可能会引起问题",
"text.autoconfig.rrls.option.showIn": "资源包重新加载过程显示",
"text.autoconfig.rrls.option.miniRender": "资源包重新加载过程显示",
"text.autoconfig.rrls.option.resetResources": "加载失败时重置资源包",
"text.autoconfig.rrls.option.reInitScreen": "重新加载后重新初始化当前屏幕",
"text.autoconfig.rrls.option.reInitScreen.@Tooltip": "禁用此功能可能会消除重新加载完成后的挂起"
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/assets/rrls/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"text.autoconfig.rrls.option.rgbProgress.@Tooltip": "§c可能會引起癲癇",
"text.autoconfig.rrls.option.ignoreScreen": "隱藏載入畫面",
"text.autoconfig.rrls.option.ignoreScreen.@Tooltip": "可能會引起問題",
"text.autoconfig.rrls.option.showIn": "資源包重新載入進度顯示",
"text.autoconfig.rrls.option.miniRender": "資源包重新載入進度顯示",
"text.autoconfig.rrls.option.type": "在重新載入時會顯示什麼",
"text.autoconfig.rrls.option.reloadText": "如果上方選擇為 TEXT,將顯示下列文字。",
"text.autoconfig.rrls.option.resetResources": "當載入失敗時重設資源",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.github.dimadencep.mods.rrls.Rrls;
import com.github.dimadencep.mods.rrls.config.AprilFool;
import com.github.dimadencep.mods.rrls.config.HideType;
import com.github.dimadencep.mods.rrls.config.ShowIn;
import com.github.dimadencep.mods.rrls.config.Type;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
Expand All @@ -31,8 +30,7 @@ public class ConfigExpectPlatformImpl implements ConfigData {
@ConfigEntry.Gui.Tooltip
public boolean forceClose = false;

@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public ShowIn showIn = ShowIn.ALL;
public boolean miniRender = true;

@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public Type type = Type.PROGRESS;
Expand Down Expand Up @@ -65,8 +63,8 @@ public static boolean forceClose() {
return RrlsFabric.MOD_CONFIG.forceClose;
}

public static ShowIn showIn() {
return RrlsFabric.MOD_CONFIG.showIn;
public static boolean miniRender() {
return RrlsFabric.MOD_CONFIG.miniRender;
}

public static Type type() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,15 @@
package com.github.dimadencep.mods.rrls.fabric;

import com.github.dimadencep.mods.rrls.Rrls;
import com.github.dimadencep.mods.rrls.accessor.SplashAccessor;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;

public class RrlsFabric extends Rrls implements ClientModInitializer {
public static final ConfigExpectPlatformImpl MOD_CONFIG = AutoConfig.register(ConfigExpectPlatformImpl.class, Toml4jConfigSerializer::new).get();

@Override
public void onInitializeClient() {
ScreenEvents.AFTER_INIT.register((client1, screen, scaledWidth, scaledHeight) ->
ScreenEvents.afterRender(screen).register((screen1, drawContext, mouseX, mouseY, tickDelta) ->
getAccessor(SplashAccessor.AttachType.HIDE).ifPresent(splashAccessor -> splashAccessor.rrls$render(drawContext, false))
)
);

HudRenderCallback.EVENT.register((drawContext, tickDelta) ->
getAccessor(SplashAccessor.AttachType.HIDE).ifPresent(splashAccessor -> splashAccessor.rrls$render(drawContext, true))
);
// no-op
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,14 @@
* https://github.com/dima-dencep/rrls/blob/HEAD/LICENSE
*/

package com.github.dimadencep.mods.rrls.forge;
/*package com.github.dimadencep.mods.rrls.forge;
import com.github.dimadencep.mods.rrls.Rrls;
import com.github.dimadencep.mods.rrls.accessor.SplashAccessor;
import net.neoforged.neoforge.client.event.RenderGuiEvent;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
@Mod(Rrls.MOD_ID)
public class RrlsForge extends Rrls {
public RrlsForge() {
NeoForge.EVENT_BUS.register(this);
// no-op
}

@SubscribeEvent
public void onRenderGui(RenderGuiEvent.Pre event) {
getAccessor(SplashAccessor.AttachType.HIDE)
.ifPresent(splashAccessor -> splashAccessor.rrls$render(event.getGuiGraphics(), true));
}

@SubscribeEvent
public void onScreenRender(ScreenEvent.Render.Post event) {
getAccessor(SplashAccessor.AttachType.HIDE)
.ifPresent(splashAccessor -> splashAccessor.rrls$render(event.getGuiGraphics(), false));
}
}
}*/
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.github.dimadencep.mods.rrls.Rrls;
import com.github.dimadencep.mods.rrls.config.AprilFool;
import com.github.dimadencep.mods.rrls.config.HideType;
import com.github.dimadencep.mods.rrls.config.ShowIn;
import com.github.dimadencep.mods.rrls.config.Type;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModList;
Expand All @@ -30,7 +29,7 @@ public class ConfigExpectPlatformImpl {
public final ModConfigSpec.EnumValue<HideType> hideType;
public final ModConfigSpec.BooleanValue rgbProgress;
public final ModConfigSpec.BooleanValue forceClose;
public final ModConfigSpec.EnumValue<ShowIn> showIn;
public final ModConfigSpec.BooleanValue miniRender;
public final ModConfigSpec.EnumValue<Type> type;
public final ModConfigSpec.ConfigValue<String> reloadText;
public final ModConfigSpec.BooleanValue resetResources;
Expand All @@ -55,9 +54,9 @@ public ConfigExpectPlatformImpl(ModConfigSpec.Builder builder) {
.comment("text.autoconfig.rrls.option.forceClose.@Tooltip")
.define("forceClose", false);

showIn = builder
.translation("text.autoconfig.rrls.option.showIn")
.defineEnum("showIn", ShowIn.ALL);
miniRender = builder
.translation("text.autoconfig.rrls.option.miniRender")
.define("miniRender", true);

type = builder
.translation("text.autoconfig.rrls.option.type")
Expand Down Expand Up @@ -125,8 +124,8 @@ public static boolean forceClose() {
return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().forceClose.get();
}

public static ShowIn showIn() {
return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().showIn.get();
public static boolean miniRender() {
return ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getKey().miniRender.get();
}

public static Type type() {
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
modLoader = "javafml"
modLoader = "lowcodefml"
loaderVersion = "*"
issueTrackerURL = "https://github.com/dima-dencep/rrls/issues"
license = "OSL-3.0"
Expand Down

0 comments on commit 58f8385

Please sign in to comment.