mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-23 11:27:54 +01:00
address requested changes
This commit is contained in:
parent
fa57f34c47
commit
c705fdfc6f
7 changed files with 21 additions and 34 deletions
|
@ -1,18 +1,16 @@
|
|||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import dev.engine_room.flywheel.api.internal.DependencyInjection;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
||||
public interface FlwImplXplat {
|
||||
FlwImplXplat INSTANCE = DependencyInjection.load(FlwImplXplat.class, "dev.engine_room.flywheel.impl.FlwImplXplatImpl");
|
||||
|
||||
boolean getModLoaded(String modId);
|
||||
|
||||
void dispatchReloadLevelRendererEvent(ClientLevel level);
|
||||
|
||||
String getVersionStr();
|
||||
|
||||
FlwConfig getConfig();
|
||||
|
||||
BooleanSupplier getModLoaded(String modId);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package dev.engine_room.flywheel.impl.compat;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import dev.engine_room.flywheel.impl.FlwImplXplat;
|
||||
|
||||
public enum CompatMods {
|
||||
SODIUM("sodium"),
|
||||
IRIS("iris");
|
||||
|
||||
private final BooleanSupplier isLoaded;
|
||||
public final boolean isLoaded;
|
||||
|
||||
CompatMods(String modid) {
|
||||
isLoaded = FlwImplXplat.INSTANCE.getModLoaded(modid);
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
return isLoaded.getAsBoolean();
|
||||
CompatMods(String modId) {
|
||||
isLoaded = FlwImplXplat.INSTANCE.getModLoaded(modId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ abstract class BlockEntityTypeMixin<T extends BlockEntity> implements BlockEntit
|
|||
|
||||
@Override
|
||||
public void flywheel$setVisualizer(@Nullable BlockEntityVisualizer<? super T> visualizer) {
|
||||
if (CompatMods.SODIUM.isLoaded()) {
|
||||
if (CompatMods.SODIUM.isLoaded) {
|
||||
if (flywheel$visualizer == null && visualizer != null) {
|
||||
flywheel$sodiumPredicate = SodiumCompat.forBlockEntityType((BlockEntityType<?>) (Object) this);
|
||||
} else if (flywheel$visualizer != null && visualizer == null && flywheel$sodiumPredicate != null) {
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
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 {
|
||||
@Override
|
||||
public boolean getModLoaded(String modId) {
|
||||
return FabricLoader.getInstance().isModLoaded(modId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchReloadLevelRendererEvent(ClientLevel level) {
|
||||
ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level);
|
||||
|
@ -21,9 +24,4 @@ public class FlwImplXplatImpl implements FlwImplXplat {
|
|||
public FlwConfig getConfig() {
|
||||
return FabricFlwConfig.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanSupplier getModLoaded(String modId) {
|
||||
return () -> FabricLoader.getInstance().isModLoaded(modId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FlwLibXplatImpl implements FlwLibXplat {
|
|||
@Override
|
||||
@Nullable
|
||||
public ShadersModHandler.InternalHandler createIrisHandler() {
|
||||
if (!CompatMods.IRIS.isLoaded()) {
|
||||
if (!CompatMods.IRIS.isLoaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package dev.engine_room.flywheel.impl;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
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 {
|
||||
@Override
|
||||
public boolean getModLoaded(String modId) {
|
||||
return LoadingModList.get().getModFileById(modId) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchReloadLevelRendererEvent(ClientLevel level) {
|
||||
NeoForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level));
|
||||
|
@ -22,9 +25,4 @@ public class FlwImplXplatImpl implements FlwImplXplat {
|
|||
public FlwConfig getConfig() {
|
||||
return NeoForgeFlwConfig.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanSupplier getModLoaded(String modId) {
|
||||
return () -> LoadingModList.get().getModFileById(modId) != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@ package dev.engine_room.flywheel.impl;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeMultiBlockModelBuilder;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.UnknownNullability;
|
||||
|
||||
|
@ -12,8 +9,10 @@ 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;
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeBakedModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.MultiBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeBakedModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.model.baked.NeoForgeMultiBlockModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.util.ShadersModHandler;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -70,7 +69,7 @@ public class FlwLibXplatImpl implements FlwLibXplat {
|
|||
@Override
|
||||
@Nullable
|
||||
public ShadersModHandler.InternalHandler createIrisHandler() {
|
||||
if (!CompatMods.IRIS.isLoaded()) {
|
||||
if (!CompatMods.IRIS.isLoaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue