finished 1.2.0
This commit is contained in:
@@ -15,7 +15,7 @@ dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
|
||||
modApi("me.shedaniel.cloth:cloth-config-fabric:18.0.145") {
|
||||
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.vaporvee.loadsupport;
|
||||
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
|
||||
public class ClientScreenHandler {
|
||||
public static void register() {
|
||||
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||
ScreenEventHandler.eventTrigger(screen);
|
||||
});
|
||||
}
|
||||
}
|
@@ -6,6 +6,9 @@ public class LoadSupport implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
CommonClass.init();
|
||||
boolean initiated = CommonClass.init();
|
||||
if(initiated) {
|
||||
ClientScreenHandler.register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,24 +0,0 @@
|
||||
package com.vaporvee.loadsupport.mixin;
|
||||
|
||||
import com.vaporvee.loadsupport.Allocated;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
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;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@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,26 +0,0 @@
|
||||
package com.vaporvee.loadsupport.mixin;
|
||||
|
||||
import com.mojang.blaze3d.platform.DisplayData;
|
||||
import com.mojang.blaze3d.platform.ScreenManager;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.platform.WindowEventHandler;
|
||||
import com.vaporvee.loadsupport.Allocated;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(Window.class)
|
||||
public class WindowHideMixin {
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void onWindowInit(WindowEventHandler eventHandler, ScreenManager screenManager, DisplayData displayData, String preferredFullscreenVideoMode, String title, CallbackInfo ci) {
|
||||
if (!Allocated.enoughMemory) {
|
||||
long w = ((Window)(Object)this).getWindow();
|
||||
GLFW.glfwHideWindow(w);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,21 +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;
|
||||
|
||||
public class LSConfigFabric 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;
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
com.vaporvee.loadsupport.platform.LSConfigFabric
|
@@ -5,10 +5,7 @@
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MinecraftPauseMixin",
|
||||
"WindowHideMixin"
|
||||
],
|
||||
"client": [],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Reference in New Issue
Block a user