Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I'm trying to create a fluid, in order to get my basics up and running for my to come mod.

But I can't seem to figure out why it won't load.

 

this is the error:
 

[09:01:26] [Client thread/ERROR] [FML]: Exception loading model for variant sw:fluid_steel#level=11 for blockstate "sw:fluid_steel[level=11]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model sw:fluid_steel#level=11 with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more

 

SteelWorks

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {

    ModFluids.init();
    ModFluids.register();

    ModBlocks.init();
    ModBlocks.register();

    ModItems.init();
    ModItems.register();
}

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    proxy.init();
    ModCrafting.register();
}

 

Proxy

public class ClientProxy implements CommonProxy {
    @Override
    public void init() {
        ModItems.registerRenders();
        ModBlocks.registerRenders();
        ModFluids.registerRenders();

        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJar.class, new RendererJar());
    }

}

 

ModFluids

public class ModFluids {

    private static List<Fluid> items = new ArrayList<>();
    public static FluidSteel fluidSteel;


    public static void init() {
        items.add(fluidSteel = new FluidSteel());
    }

    public static void register() {

        items.forEach(FluidRegistry::registerFluid);
    }

    public static void registerRenders() {
        items.forEach(ModFluids::registerRender);
    }

    private static void registerRender(Fluid item) {
        Item i = Item.getItemFromBlock(item.getBlock());
        String loc = Reference.MOD_ID + ":" + item.getName();

        ModelLoader.setCustomMeshDefinition(i, stack -> new ModelResourceLocation(loc, "fluid"));
        ModelLoader.setCustomStateMapper(item.getBlock(), new StateMapperBase() {
            @Override
            protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
                return new ModelResourceLocation(loc, "fluid");
            }
        });
    }

}

 

fluid_steel

{
  "forge_marker": 1,
  "variants": {
    "fluid": {
      "model": "forge:fluid",
      "custom": { "fluid": "fluid_steel" }
    },
    "inventory": {
      "model": "forge:forgebucket",
      "textures": {
        "base": "forge:items/bucket_base",
        "fluid": "sw:items/bucket_fluid",
        "cover": "forge:items/bucket_cover"
      },
      "transform": "forge:default-item",
      "custom": {
        "fluid": "fluid_steel",
        "flipGas": true
      }
    }
  }
}

 

I think this is the most relevant code, but in case you want to check everything out:

all code: https://github.com/cskiwi/SteelWorks

Edited by cskiwi
Added blockstate

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.