mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 22:43:56 +01:00
Fix issues
This commit is contained in:
parent
fc61ff1c98
commit
3176f1d0f5
@ -1,5 +1,7 @@
|
||||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import dev.engine_room.flywheel.api.internal.DependencyInjection;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
||||
@ -11,4 +13,6 @@ public interface FlwImplXplat {
|
||||
String getVersionStr();
|
||||
|
||||
FlwConfig getConfig();
|
||||
|
||||
Supplier<Boolean> getModLoaded(String modId);
|
||||
}
|
||||
|
@ -2,18 +2,17 @@ package dev.engine_room.flywheel.impl.compat;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import dev.engine_room.flywheel.impl.FlwImplXplat;
|
||||
|
||||
public enum CompatMods {
|
||||
SODIUM,
|
||||
EMBEDDIUM;
|
||||
EMBEDDIUM,
|
||||
IRIS;
|
||||
|
||||
private final Supplier<Boolean> isLoaded;
|
||||
|
||||
CompatMods() {
|
||||
isLoaded = Suppliers.memoize(() -> FabricLoader.getInstance().isModLoaded(name()));
|
||||
isLoaded = FlwImplXplat.INSTANCE.getModLoaded(name());
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
|
@ -1,6 +1,11 @@
|
||||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
import dev.engine_room.flywheel.api.event.ReloadLevelRendererCallback;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
||||
public class FlwImplXplatImpl implements FlwImplXplat {
|
||||
@ -18,4 +23,9 @@ public class FlwImplXplatImpl implements FlwImplXplat {
|
||||
public FlwConfig getConfig() {
|
||||
return FabricFlwConfig.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<Boolean> getModLoaded(String modId) {
|
||||
return Suppliers.memoize(() -> FabricLoader.getInstance().isModLoaded(modId));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package dev.engine_room.flywheel.impl;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.UnknownNullability;
|
||||
|
||||
import dev.engine_room.flywheel.impl.compat.CompatMods;
|
||||
import dev.engine_room.flywheel.lib.internal.FlwLibXplat;
|
||||
import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.BlockModelBuilder;
|
||||
@ -11,7 +12,6 @@ import dev.engine_room.flywheel.lib.model.baked.FabricBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.FabricMultiBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.MultiBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.util.ShadersModHandler;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
@ -52,8 +52,7 @@ public class FlwLibXplatImpl implements FlwLibXplat {
|
||||
@Override
|
||||
@Nullable
|
||||
public ShadersModHandler.InternalHandler createIrisHandler() {
|
||||
if (!FabricLoader.getInstance()
|
||||
.isModLoaded("iris")) {
|
||||
if (CompatMods.IRIS.isLoaded()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,12 @@
|
||||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
import dev.engine_room.flywheel.api.event.ReloadLevelRendererEvent;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.neoforged.fml.loading.LoadingModList;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
public class FlwImplXplatImpl implements FlwImplXplat {
|
||||
@ -19,4 +24,9 @@ public class FlwImplXplatImpl implements FlwImplXplat {
|
||||
public FlwConfig getConfig() {
|
||||
return ForgeFlwConfig.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<Boolean> getModLoaded(String modId) {
|
||||
return Suppliers.memoize(() -> LoadingModList.get().getModFileById(modId) != null);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.lang.reflect.Field;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.UnknownNullability;
|
||||
|
||||
import dev.engine_room.flywheel.impl.compat.CompatMods;
|
||||
import dev.engine_room.flywheel.lib.internal.FlwLibXplat;
|
||||
import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.BlockModelBuilder;
|
||||
@ -24,7 +25,6 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.util.ObfuscationReflectionHelper;
|
||||
|
||||
public class FlwLibXplatImpl implements FlwLibXplat {
|
||||
@ -69,8 +69,7 @@ public class FlwLibXplatImpl implements FlwLibXplat {
|
||||
@Override
|
||||
@Nullable
|
||||
public ShadersModHandler.InternalHandler createIrisHandler() {
|
||||
if (!ModList.get()
|
||||
.isLoaded("iris")) {
|
||||
if (!CompatMods.IRIS.isLoaded()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user