finished 1.2.0
This commit is contained in:
@@ -10,7 +10,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
|
||||
implementation "me.shedaniel.cloth:cloth-config-neoforge:18.0.145"
|
||||
implementation "me.shedaniel.cloth:cloth-config-neoforge:${cloth_version}"
|
||||
}
|
||||
|
||||
neoForge {
|
||||
@@ -32,9 +32,6 @@ neoForge {
|
||||
client {
|
||||
client()
|
||||
}
|
||||
data {
|
||||
clientData()
|
||||
}
|
||||
server {
|
||||
server()
|
||||
}
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package com.vaporvee.loadsupport;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.neoforged.neoforge.client.event.ScreenEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
public class ClientScreenHandler {
|
||||
public static void register() {
|
||||
NeoForge.EVENT_BUS.addListener(ClientScreenHandler::onScreenInit);
|
||||
}
|
||||
|
||||
private static void onScreenInit(ScreenEvent.Init.Post event) {
|
||||
Screen screen = event.getScreen();
|
||||
ScreenEventHandler.eventTrigger(screen);
|
||||
}
|
||||
}
|
@@ -1,8 +1,5 @@
|
||||
package com.vaporvee.loadsupport;
|
||||
|
||||
|
||||
import com.vaporvee.loadsupport.platform.Services;
|
||||
import net.neoforged.bus.api.Event;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
||||
@@ -10,6 +7,9 @@ import net.neoforged.fml.common.Mod;
|
||||
public class LoadSupport {
|
||||
|
||||
public LoadSupport(IEventBus eventBus) {
|
||||
CommonClass.init();
|
||||
boolean initiated = CommonClass.init();
|
||||
if (initiated) {
|
||||
ClientScreenHandler.register();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package com.vaporvee.loadsupport.mixin;
|
||||
|
||||
import com.vaporvee.loadsupport.Allocated;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftPauseMixin {
|
||||
@Inject(method = "run", at = @At("HEAD"), cancellable = true)
|
||||
private void onRunHead(CallbackInfo ci) {
|
||||
if (!Allocated.enoughMemory) {
|
||||
while (Allocated.isWindowOpen()) {
|
||||
try { Thread.sleep(100); } catch (InterruptedException ignored) {}
|
||||
}
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package com.vaporvee.loadsupport.mixin;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.vaporvee.loadsupport.Allocated;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Window.class)
|
||||
public class WindowHideMixin {
|
||||
@Inject(
|
||||
method = "takeOverWindow",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void onTakeOverWindow(CallbackInfoReturnable<Long> cir) {
|
||||
if (!Allocated.enoughMemory) {
|
||||
long w = cir.getReturnValue();
|
||||
GLFW.glfwHideWindow(w);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package com.vaporvee.loadsupport.platform;
|
||||
|
||||
import com.vaporvee.loadsupport.CommonClass;
|
||||
import com.vaporvee.loadsupport.Config;
|
||||
import com.vaporvee.loadsupport.platform.services.IConfig;
|
||||
import me.shedaniel.autoconfig.AutoConfig;
|
||||
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
|
||||
import net.neoforged.neoforge.client.event.ScreenEvent;
|
||||
|
||||
public class LSConfigNeoForge implements IConfig {
|
||||
public static Config config;
|
||||
@Override
|
||||
public void InitConfig() {
|
||||
AutoConfig.register(Config.class, Toml4jConfigSerializer::new);
|
||||
config = AutoConfig.getConfigHolder(Config.class).getConfig();
|
||||
CommonClass.checkConfig(config);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
@@ -10,13 +10,11 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
|
||||
return "NeoForge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded(String modId) {
|
||||
|
||||
return ModList.get().isLoaded(modId);
|
||||
}
|
||||
|
||||
@@ -27,7 +25,6 @@ public class NeoForgePlatformHelper implements IPlatformHelper {
|
||||
|
||||
@Override
|
||||
public boolean isDevelopmentEnvironment() {
|
||||
|
||||
return !FMLLoader.isProduction();
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
com.vaporvee.loadsupport.platform.LSConfigNeoForge
|
@@ -4,10 +4,7 @@
|
||||
"package": "com.vaporvee.loadsupport.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MinecraftPauseMixin",
|
||||
"WindowHideMixin"
|
||||
],
|
||||
"client": [],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Reference in New Issue
Block a user