Merge remote-tracking branch 'origin/quilt_test' into quilt_test
# Conflicts: # fabric/build.gradle
This commit is contained in:
+20
-1
@@ -115,12 +115,25 @@ subprojects { p ->
|
||||
// Toml
|
||||
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
||||
|
||||
if (p != project(":forge")) {
|
||||
if (p != project(":forge") && p != project(":fabric")) {
|
||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||
// Do NOT use other classes from fabric loader unless working with fabric
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
}
|
||||
|
||||
if (p == project(":fabric")) {
|
||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||
// Do NOT use other classes from fabric loader unless working with fabric
|
||||
if (rootProject.use_quilt_rather_than_fabric == "true") {
|
||||
// Quilt loader
|
||||
modImplementation "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
|
||||
modImplementation "org.quiltmc:quilt-json5:1.0.0" // Needed for quilt loader but for some reason it dosnt come with it
|
||||
} else {
|
||||
// Fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
}
|
||||
}
|
||||
|
||||
if (p != project(":core")) {
|
||||
common(project(":core")) { transitive false }
|
||||
shadowMe(project(":core")) { transitive false }
|
||||
@@ -180,6 +193,12 @@ allprojects { p ->
|
||||
}
|
||||
}
|
||||
|
||||
// Required for Quilt
|
||||
maven {
|
||||
name 'Quilt'
|
||||
url 'https://maven.quiltmc.org/repository/release'
|
||||
}
|
||||
|
||||
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
||||
flatDir {
|
||||
dirs "${rootDir}/mods/fabric"
|
||||
|
||||
+9
@@ -59,6 +59,7 @@ import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -326,6 +327,14 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
|
||||
return mc.getCurrentServer() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerSkylight() {
|
||||
if (mc.level == null) return -1;
|
||||
if (mc.player == null) return -1;
|
||||
if (mc.player.blockPosition() == null) return -1;
|
||||
return mc.level.getBrightness(LightLayer.SKY, mc.player.blockPosition());
|
||||
}
|
||||
|
||||
public ServerData getCurrentServer()
|
||||
{
|
||||
return mc.getCurrentServer();
|
||||
|
||||
+1
-1
Submodule core updated: 6ad6ecc731...83a2fa86d9
@@ -53,9 +53,11 @@ public class Main
|
||||
// Once it works on servers change the implement to ModInitializer and in fabric.mod.json it should be "environment": "*"
|
||||
|
||||
public static ClientProxy client_proxy;
|
||||
public static boolean isQuilt;
|
||||
|
||||
// This loads the mod after minecraft loads which doesn't causes a lot of issues
|
||||
public static void init() {
|
||||
scuffedQuiltChecker();
|
||||
LodCommonMain.initConfig();
|
||||
LodCommonMain.startup(null, false, new NetworkHandler());
|
||||
FabricDependencySetup.createInitialBindings();
|
||||
@@ -85,4 +87,13 @@ public class Main
|
||||
FabricDependencySetup.finishBinding();
|
||||
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
}
|
||||
|
||||
public static void scuffedQuiltChecker() {
|
||||
try {
|
||||
Class.forName("org.quiltmc.loader.api.QuiltLoader");
|
||||
isQuilt = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
isQuilt = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.seibel.lod.fabric.quilt;
|
||||
|
||||
/**
|
||||
* Used to call classes that are in Quilt
|
||||
* @author Ran
|
||||
*/
|
||||
public class QuiltUtils {
|
||||
public static boolean isModLoaded(String modId) {
|
||||
try {
|
||||
return (boolean) Class.forName("org.quiltmc.loader.api.QuiltLoader").getDeclaredMethod("isModLoaded", String.class).invoke(null, modId);
|
||||
} catch (Exception ignored) { }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@
|
||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.lod.fabric.Main;
|
||||
import com.seibel.lod.fabric.quilt.QuiltUtils;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public class ModChecker implements IModChecker {
|
||||
@@ -27,6 +29,10 @@ public class ModChecker implements IModChecker {
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded(String modid) {
|
||||
return FabricLoader.getInstance().isModLoaded(modid);
|
||||
if (Main.isQuilt) {
|
||||
return QuiltUtils.isModLoaded(modid);
|
||||
} else {
|
||||
return FabricLoader.getInstance().isModLoaded(modid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user