use DhScreenUtil.setScreen when possible
This commit is contained in:
+1
-1
@@ -87,7 +87,7 @@ public class DhUpdateScreenBase
|
||||
versionId
|
||||
));
|
||||
#else
|
||||
DhScreenUtil.showScreen(new UpdateModScreen(
|
||||
DhScreenUtil.setScreen(new UpdateModScreen(
|
||||
new TitleScreen(false),
|
||||
versionId
|
||||
));
|
||||
|
||||
+4
-2
@@ -12,9 +12,11 @@ public class DhScreenUtil
|
||||
//================//
|
||||
//region
|
||||
|
||||
public static void showScreen(Screen screen)
|
||||
public static void setScreen(Screen screen)
|
||||
{
|
||||
#if MC_VER <= MC_26_1_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(Minecraft.getMinecraft()).displayGuiScreen(screen);
|
||||
#elif MC_VER <= MC_26_1_2
|
||||
Objects.requireNonNull(Minecraft.getInstance()).setScreen(screen);
|
||||
#else
|
||||
Objects.requireNonNull(Minecraft.getInstance()).setScreenAndShow(screen);
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ public class MinecraftScreen
|
||||
#endif
|
||||
{
|
||||
this.screen.onClose(); // Close our screen
|
||||
DhScreenUtil.showScreen(this.parent); // Goto the parent screen
|
||||
DhScreenUtil.setScreen(this.parent); // Goto the parent screen
|
||||
}
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
|
||||
+7
-16
@@ -3,16 +3,15 @@ package com.seibel.distanthorizons.common.wrappers.gui.classicConfig;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
@@ -21,27 +20,20 @@ import com.seibel.distanthorizons.core.config.ConfigHandler;
|
||||
import com.seibel.distanthorizons.core.config.types.*;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
||||
|
||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigCommentTextPosition;
|
||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
@@ -55,7 +47,6 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
#endif
|
||||
|
||||
#if MC_VER >= MC_1_17_1
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
@@ -150,7 +141,7 @@ class DhConfigScreen extends DhScreen
|
||||
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
||||
if (changelogScreen.usable)
|
||||
{
|
||||
Objects.requireNonNull(this.minecraft).setScreen(changelogScreen);
|
||||
DhScreenUtil.setScreen(changelogScreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,7 +161,7 @@ class DhConfigScreen extends DhScreen
|
||||
(button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
DhScreenUtil.setScreen(this.parent);
|
||||
}));
|
||||
|
||||
// done/close button
|
||||
@@ -181,7 +172,7 @@ class DhConfigScreen extends DhScreen
|
||||
(button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
DhScreenUtil.setScreen(this.parent);
|
||||
}));
|
||||
|
||||
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
||||
@@ -464,7 +455,7 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
||||
this.reload = true;
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this);
|
||||
DhScreenUtil.setScreen(this);
|
||||
};
|
||||
|
||||
int resetButtonPosX = this.width
|
||||
@@ -574,7 +565,7 @@ class DhConfigScreen extends DhScreen
|
||||
((button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
Objects.requireNonNull(this.minecraft).setScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
||||
DhScreenUtil.setScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
||||
}));
|
||||
this.configListWidget.addButton(this, configType, widget, null, null, null);
|
||||
|
||||
@@ -790,7 +781,7 @@ class DhConfigScreen extends DhScreen
|
||||
public void onClose()
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
DhScreenUtil.setScreen(this.parent);
|
||||
|
||||
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
||||
}
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ public class ChangelogScreen extends DhScreen
|
||||
#if MC_VER <= MC_1_12_2
|
||||
// Handled by button to avoid recursive loop
|
||||
#else
|
||||
DhScreenUtil.showScreen(this.parent);
|
||||
DhScreenUtil.setScreen(this.parent);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -35,8 +35,6 @@ import net.minecraft.resources.Identifier;
|
||||
|
||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The screen that pops up if the mod has an update.
|
||||
*
|
||||
@@ -174,7 +172,7 @@ public class UpdateModScreen extends DhScreen
|
||||
20, 20,
|
||||
// Create the button and tell it where to go
|
||||
#if MC_VER > MC_1_12_2
|
||||
(buttonWidget) -> DhScreenUtil.showScreen(new ChangelogScreen(this, this.newVersionID)),
|
||||
(buttonWidget) -> DhScreenUtil.setScreen(new ChangelogScreen(this, this.newVersionID)),
|
||||
#endif
|
||||
// Add a title to the button
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@@ -296,7 +294,7 @@ public class UpdateModScreen extends DhScreen
|
||||
#if MC_VER <= MC_1_12_2
|
||||
// Handled by button to avoid recursive loop
|
||||
#else
|
||||
DhScreenUtil.showScreen(this.parent); // Go to the parent screen
|
||||
DhScreenUtil.setScreen(this.parent); // Go to the parent screen
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -217,7 +217,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
Vec3 projectedView = camera.position();
|
||||
#endif
|
||||
return new Vec3d(projectedView.x, projectedView.y, projectedView.z);
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user