Remove all remaining hard dependency on Fabric API modules
This commit is contained in:
parent
7e777625a5
commit
acec6112cb
|
|
@ -32,10 +32,10 @@ dependencies {
|
|||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
testImplementation "net.fabricmc:fabric-loader-junit:${rootProject.fabric_loader_version}"
|
||||
|
||||
modIncludeImplementation(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modIncludeImplementation(fabricApi.module("fabric-command-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modIncludeImplementation(fabricApi.module("fabric-models-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-command-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-models-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") { transitive false }
|
||||
modImplementation "curse.maven:spark-361579:${rootProject.spark_fabric_version}"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package org.embeddedt.modernfix.fabric.bridge;
|
||||
|
||||
import net.fabricmc.fabric.impl.client.model.ModelLoadingRegistryImpl;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ModelV0Bridge {
|
||||
public static void populate(Consumer<ResourceLocation> modelConsumer, ModelBakery bakery, ResourceManager manager) {
|
||||
ModelLoadingRegistryImpl.LoaderInstance instance = ModelLoadingRegistryImpl.begin(bakery, manager);
|
||||
instance.onModelPopulation(modelConsumer);
|
||||
instance.finish();
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import com.google.common.collect.ForwardingMap;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.math.Transformation;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import net.fabricmc.fabric.impl.client.model.ModelLoadingRegistryImpl;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.renderer.block.model.BlockModelDefinition;
|
||||
|
|
@ -39,6 +39,7 @@ import org.embeddedt.modernfix.api.entrypoint.ModernFixClientIntegration;
|
|||
import org.embeddedt.modernfix.duck.IExtendedModelBakery;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicBakedModelProvider;
|
||||
import org.embeddedt.modernfix.dynamicresources.ModelBakeryHelpers;
|
||||
import org.embeddedt.modernfix.fabric.bridge.ModelV0Bridge;
|
||||
import org.embeddedt.modernfix.util.LayeredForwardingMap;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
|
|
@ -138,9 +139,9 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
|
|||
};
|
||||
filler.push(s);
|
||||
this.injectedModels = new ObjectOpenHashSet<>();
|
||||
ModelLoadingRegistryImpl.LoaderInstance instance = ModelLoadingRegistryImpl.begin((ModelBakery)(Object)this, this.resourceManager);
|
||||
instance.onModelPopulation(this.injectedModels::add);
|
||||
instance.finish();
|
||||
if(FabricLoader.getInstance().isModLoaded("fabric-models-v0")) {
|
||||
ModelV0Bridge.populate(this.injectedModels::add, (ModelBakery)(Object)this, this.resourceManager);
|
||||
}
|
||||
}
|
||||
|
||||
private <K, V> void onModelRemoved(RemovalNotification<K, V> notification) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks {
|
|||
}
|
||||
|
||||
public void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, arg) -> handler.accept(dispatcher));
|
||||
if(FabricLoader.getInstance().isModLoaded("fabric-command-api-v1"))
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, arg) -> handler.accept(dispatcher));
|
||||
}
|
||||
|
||||
private static Multimap<String, String> modOptions;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
"modernfix-common.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabric-command-api-v1": "*",
|
||||
"fabric-models-v0": "*",
|
||||
"minecraft": ">=1.16.2"
|
||||
},
|
||||
"breaks": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user