Skip to content

Commit

Permalink
Fix forge overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Jan 16, 2024
1 parent 91d7cf9 commit 56ba1eb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface SplashAccessor {
if (!ConfigExpectPlatform.hideType().canHide(reloading))
return AttachType.DEFAULT;

if (reloading ||ConfigExpectPlatform.forceClose())
if (reloading || ConfigExpectPlatform.forceClose())
return AttachType.HIDE;

if (screen instanceof MessageScreen msg) // Loading Minecraft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ public abstract class SplashOverlayMixin extends Overlay {
cancellable = true
)
public void rrls$render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
this.rrls$attach = rrls$filterAttachType(client.currentScreen, this.rrls$attach != AttachType.WAIT);
if (rrls$attach != AttachType.DEFAULT)
this.rrls$attach = rrls$filterAttachType(client.currentScreen, this.rrls$attach != AttachType.WAIT);

if (this.rrls$attach == AttachType.HIDE) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.github.dimadencep.mods.rrls.Rrls;
import com.github.dimadencep.mods.rrls.accessor.SplashAccessor;
import net.neoforged.fml.ModContainer;
import net.neoforged.neoforge.client.event.RenderGuiEvent;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.common.NeoForge;
Expand All @@ -22,7 +21,7 @@

@Mod("rrls")
public class RrlsForge extends Rrls {
public RrlsForge(ModContainer modContainer) {
public RrlsForge() {
NeoForge.EVENT_BUS.register(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ForgeLoadingOverlayMixin(MinecraftClient client, ResourceReload monitor,
cancellable = true
)
public void rrls$render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
rrls$setAttachType(rrls$filterAttachType(minecraft.currentScreen, rrls$getAttachType() != AttachType.WAIT));
rrls$setAttachType(rrls$filterAttachType(minecraft.currentScreen, false)); // Forge loading overlay is loading overlay :)

if (rrls$getAttachType() == SplashAccessor.AttachType.HIDE) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,19 @@ public ConfigExpectPlatformImpl(ModConfigSpec.Builder builder) {

static { // Early loading for config
ModContainer activeContainer = ModList.get().getModContainerById(Rrls.MOD_ID).orElseThrow();
ModConfigSpec configSpec = ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getValue();

ModConfig modConfig = new ModConfig(ModConfig.Type.CLIENT, ConfigExpectPlatformImpl.CONFIG_SPEC_PAIR.getValue(), activeContainer, "rrls.toml");
modConfig.getSpec().acceptConfig(ConfigFileTypeHandler.TOML.reader(FMLPaths.CONFIGDIR.get()).apply(modConfig));

ModConfig modConfig = new ModConfig(ModConfig.Type.CLIENT, configSpec, activeContainer, "rrls.toml");
activeContainer.addConfig(modConfig);

if (!configSpec.isLoaded()) {
Rrls.LOGGER.warn("Config is not loaded?");

configSpec.acceptConfig(
ConfigFileTypeHandler.TOML.reader(FMLPaths.CONFIGDIR.get())
.apply(modConfig)
);
}
}

public static HideType hideType() {
Expand Down

0 comments on commit 56ba1eb

Please sign in to comment.