Skip to content

Commit

Permalink
Merge pull request #3 from GTNewHorizons/hide-menu-switch-btn
Browse files Browse the repository at this point in the history
Hide Menu Switch Button (configurable)
  • Loading branch information
Dream-Master authored Jul 14, 2023
2 parents 7b94760 + 92b0c44 commit 1bf0533
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 156 deletions.
610 changes: 475 additions & 135 deletions build.gradle

Large diffs are not rendered by default.

49 changes: 41 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,36 @@ remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/con
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer

# Define a source file of your project with:
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience
# Turns most publicly visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = true

# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = DummyCore.Core.Tags
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = VERSION
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = CoreInitialiser.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =

# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,nei_at.cfg
accessTransformersFile =

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
Expand All @@ -70,7 +82,20 @@ forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USERNAME and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# mavenPublishUrl = http://jenkins.usrv.eu:8081/nexus/content/repositories/releases

# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.

Expand Down Expand Up @@ -113,4 +138,12 @@ curseForgeRelations =
# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# disableSpotless = true

# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/DummyCore/Client/GuiMainMenuOld.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.apache.commons.io.Charsets;
import org.lwjgl.opengl.GL11;

import DummyCore.Utils.IMainMenu;

import com.google.common.base.Strings;
import com.google.common.collect.Lists;

import DummyCore.Utils.IMainMenu;
import cpw.mods.fml.common.FMLCommonHandler;

public class GuiMainMenuOld extends GuiMainMenu implements IMainMenu {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/DummyCore/Client/GuiMenuList.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public GuiMenuList(GuiScreen mainMenu) {
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@SuppressWarnings("unchecked")
@Override
public void initGui() {
for (DummyData data : MainMenuRegistry.menuInfoLst) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/DummyCore/Client/MainMenuRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void newMainMenu(int index) {
index = menuList.size() - 1;
}
DummyConfig.setMainMenu(index);
currentScreen = menuList.get(DummyConfig.getMainMenu()).newInstance();
currentScreen = menuList.get(DummyConfig.getMainMenu()).getConstructor().newInstance();
Minecraft.getMinecraft().displayGuiScreen(currentScreen);
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -67,7 +67,7 @@ public static GuiScreen getGuiDisplayed() {
return mc.currentScreen;
if (currentScreen != null) return currentScreen;
try {
return menuList.get(DummyConfig.getMainMenu()).newInstance();
return menuList.get(DummyConfig.getMainMenu()).getConstructor().newInstance();
} catch (Exception e) {
e.printStackTrace();
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/DummyCore/Core/CoreInitialiser.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class CoreInitialiser {

public static final String modid = "DummyCore";
public static final String modname = "DummyCore";
public static final String version = "GRADLETOKEN_VERSION";
public static final String version = Tags.VERSION;

public static CoreInitialiser instance;
public static DummyConfig cfg = new DummyConfig();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/DummyCore/Utils/DummyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class DummyConfig implements IDummyConfig {
public boolean removeMissingTexturesErrors;
public static boolean enableNotifierLogging;
public static boolean shouldChangeImage;
public static boolean hideSwitchMenuButton;
public static Configuration cfg;

public void load(Configuration config) {
Expand All @@ -19,6 +20,7 @@ public void load(Configuration config) {
enableNotifierLogging = config.getBoolean("enableNotifierLogging", "GLOBAL", true, "");
shouldChangeImage = config.getBoolean("shouldChangeImageInCreativeTabs", "GLOBAL", true, "");
mainMenuID = config.getInt("mainMenuID", "GLOBAL", 0, 0, Integer.MAX_VALUE, "");
hideSwitchMenuButton = config.getBoolean("hideSwitchMenuButton", "GLOBAL", false, "");
dummyCoreSyncTimer = config.getInt(
"syncTimer",
"GLOBAL",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/DummyCore/Utils/DummyEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onMainMenuGUISetup(InitGuiEvent.Pre event) {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMainMenuGUISetup(InitGuiEvent.Post event) {
if (event.gui instanceof IMainMenu) {
if (event.gui instanceof IMainMenu && !DummyConfig.hideSwitchMenuButton) {
event.buttonList.add(
new GuiButton_ChangeGUI(
65535,
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/DummyCore/Utils/MiscUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ public static void registerDescriptionFor(String id, int meta, String descr, Enu
* @param dimId - the ID of the dimension to look the players.
* @param distance - the distance at which the players will get found.
*/
@SuppressWarnings("unchecked")
public static void sendPacketToAllAround(World w, Packet pkt, int x, int y, int z, int dimId, double distance) {
List<EntityPlayer> playerLst = w.getEntitiesWithinAABB(
EntityPlayer.class,
Expand Down Expand Up @@ -381,7 +380,6 @@ public static void sendPacketToAllAround(World w, Packet pkt, int x, int y, int
* @param w - the worldObj that we are operating in
* @param distance - the distance at which the players will get found.
*/
@SuppressWarnings("unchecked")
public static void sendPacketToAll(World w, Packet pkt) {
List<EntityPlayer> playerLst = w.playerEntities;
if (!playerLst.isEmpty()) {
Expand All @@ -406,7 +404,6 @@ public static void sendPacketToAll(World w, Packet pkt) {
* @param pkt - the packet to send
* @param dimId - the ID of the dimension to look the players.
*/
@SuppressWarnings("unchecked")
public static void sendPacketToAllInDim(World w, Packet pkt, int dimId) {
List<EntityPlayer> playerLst = w.playerEntities;
if (!playerLst.isEmpty()) {
Expand Down

0 comments on commit 1bf0533

Please sign in to comment.