-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,082 additions
and
126 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Setup JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "17" | ||
distribution: "temurin" | ||
|
||
- name: Build with Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
working-directory: ./neoforge | ||
with: | ||
arguments: build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[1004/203846.550:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/210622.059:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/210622.163:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/223616.841:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/233021.354:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/233021.469:ERROR:crashpad_client_win.cc(810)] not connected | ||
[1004/233120.351:ERROR:crashpad_client_win.cc(810)] not connected |
31 changes: 0 additions & 31 deletions
31
fabric/src/client/java/com/vaporvee/enoughmemory/EnoughMemoryClient.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
fabric/src/client/java/com/vaporvee/loadsupport/LSConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.vaporvee.loadsupport; | ||
|
||
import me.shedaniel.autoconfig.ConfigData; | ||
import me.shedaniel.autoconfig.annotation.Config; | ||
|
||
@Config(name = LoadSupport.MOD_ID) | ||
public class LSConfig implements ConfigData { | ||
boolean startSound = true; | ||
float minMemory = 4.0f; | ||
String errorTitle = "Error: Not enough Java memory!"; | ||
String errorDescription = "Please allocate at least {minMemory} GB of Java memory to your Minecraft Instance! You have currently {currentMemory} GB allocated."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
fabric/src/client/java/com/vaporvee/loadsupport/LoadNotifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.vaporvee.loadsupport; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.sound.PositionedSoundInstance; | ||
import net.minecraft.sound.SoundEvents; | ||
|
||
public class LoadNotifier { | ||
static boolean wasPlayed = false; | ||
public static void notifySound(MinecraftClient client){ | ||
if(LoadSupportClient.config.startSound && !wasPlayed) { | ||
wasPlayed = true; | ||
client.getSoundManager().play( | ||
PositionedSoundInstance.master(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE, 1.0F) // Use any sound event you like | ||
); | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
fabric/src/client/java/com/vaporvee/loadsupport/LoadSupportClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.vaporvee.loadsupport; | ||
|
||
import me.shedaniel.autoconfig.AutoConfig; | ||
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.AccessibilityOnboardingScreen; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
|
||
public class LoadSupportClient implements ClientModInitializer { | ||
public static LSConfig config; | ||
private static float allocatedMemoryInGB; | ||
@Override | ||
public void onInitializeClient() { | ||
AutoConfig.register(LSConfig.class, Toml4jConfigSerializer::new); | ||
config = AutoConfig.getConfigHolder(LSConfig.class).getConfig(); | ||
allocatedMemoryInGB = Runtime.getRuntime().totalMemory() / 1073741824f; // Hardcoded value for GB | ||
LoadSupport.logger.info(String.format("Allocated Memory: %.1f GB", allocatedMemoryInGB)); | ||
ScreenEvents.BEFORE_INIT.register(LoadSupportClient::beforeWindowInit); | ||
} | ||
|
||
public static String[] getWarningMessage(){ | ||
return new String[]{config.errorTitle, config.errorDescription | ||
.replace("{minMemory}", String.valueOf(config.minMemory)) | ||
.replace("{currentMemory}", String.format("%.1f", allocatedMemoryInGB))}; | ||
}; | ||
private static void beforeWindowInit(MinecraftClient minecraftClient, Screen screen, int i, int i1) { | ||
if(config.minMemory > allocatedMemoryInGB){ | ||
System.setProperty("java.awt.headless", "false"); // Hacky stupid thing but it works I guess... | ||
LSWindow.createWindow(minecraftClient, screen); | ||
} | ||
if (screen instanceof TitleScreen || screen instanceof AccessibilityOnboardingScreen){ | ||
LoadNotifier.notifySound(minecraftClient); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,42 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "enoughmemory", | ||
"version": "${version}", | ||
"name": "Enough Memory", | ||
"description": "It will show the user when they have set too less Java Memory. The amount of required memory can be adjusted with the config.", | ||
"authors": [ | ||
{ | ||
"name": "vaporvee", | ||
"contact": { | ||
"homepage" : "https://vaporvee.com" | ||
} | ||
} | ||
], | ||
"contact": { | ||
"sources": "https://github.com/vaporvee/EnoughMemory", | ||
"issues": "https://github.com/vaporvee/EnoughMemory/issues" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"links": { | ||
"modmenu.discord": "https://discord.gg/StMHnsC9s2" | ||
} | ||
} | ||
}, | ||
"license": "Apache License 2.0", | ||
"icon": "assets/enoughmemory/icon.png", | ||
"environment": "*", | ||
"entrypoints": { | ||
"main": [ | ||
"com.vaporvee.enoughmemory.EnoughMemory" | ||
], | ||
"client": [ | ||
"com.vaporvee.enoughmemory.EnoughMemoryClient" | ||
] | ||
}, | ||
"depends": { | ||
"fabricloader": ">=0.16.5", | ||
"minecraft": "~1.21.1", | ||
"java": ">=21", | ||
"fabric-api": "*" | ||
}, | ||
"suggests": { | ||
"another-mod": "*" | ||
} | ||
} | ||
"schemaVersion": 1, | ||
"id": "loadsupport", | ||
"version": "${version}", | ||
"name": "Load Support", | ||
"description": "Shows when the user has to less Java memory allocated, and plays a sound when the game has loaded.", | ||
"authors": [ | ||
{ | ||
"name": "vaporvee", | ||
"contact": { | ||
"homepage": "https://vaporvee.com" | ||
} | ||
} | ||
], | ||
"contact": { | ||
"sources": "https://github.com/vaporvee/EnoughMemory", | ||
"issues": "https://github.com/vaporvee/EnoughMemory/issues" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"links": { | ||
"modmenu.discord": "https://discord.gg/StMHnsC9s2" | ||
} | ||
} | ||
}, | ||
"license": "Apache License 2.0", | ||
"icon": "assets/loadsupport/icon.png", | ||
"environment": "*", | ||
"entrypoints": { | ||
"main": ["com.vaporvee.loadsupport.LoadSupport"], | ||
"client": ["com.vaporvee.loadsupport.LoadSupportClient"] | ||
}, | ||
"depends": { | ||
"fabricloader": ">=0.16.5", | ||
"minecraft": "~1.21.1", | ||
"java": ">=21", | ||
"fabric-api": "*" | ||
}, | ||
"suggests": { | ||
"another-mod": "*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...c/main/resources/enoughmemory.mixins.json → ...rc/main/resources/loadsupport.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Disable autocrlf on generated files, they always generate with LF | ||
# Add any extra files or paths here to make git stop saying they | ||
# are changed when only line endings change. | ||
src/generated/**/.cache/cache text eol=lf | ||
src/generated/**/*.json text eol=lf |
Oops, something went wrong.