Posted February 10, 20178 yr I'm not sure if the problem is in the setting of the resource location or the blockstates file, but my liquid isn't correctly rendered (the model isn't loaded). liquid class: Spoiler package anagkai.biodiversity; import anagkai.biodiversity.BiodiversityFluids.BlockMercury; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; public class BiodiversityFluids { static ModelResourceLocation MERCURY_LOCATION = new ModelResourceLocation("biodiversity:mercury", "fluid"); public static void registerFluid(){ FluidRegistry.registerFluid(MercuryFluid.instance); GameRegistry.registerBlock(BlockMercury.instance, BlockMercury.name); Item mercury = Item.getItemFromBlock(BlockMercury.instance).setCreativeTab(Biodiversity.cTab); ModelLoader.setCustomMeshDefinition(mercury, new ItemMeshDefinition(){ @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return BiodiversityFluids.MERCURY_LOCATION; } }); ModelLoader.setCustomStateMapper(BlockMercury.instance, new StateMapperBase(){ @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return BiodiversityFluids.MERCURY_LOCATION; } }); } public static final class MercuryFluid extends Fluid{ public static final String name = "mercury"; public static final MercuryFluid instance = new MercuryFluid(); public MercuryFluid() { super(name, new ResourceLocation("biodiversity:blocks/mercury_still"), new ResourceLocation("biodiversity:blocks/mercury_flowing")); this.density = 3250; this.viscosity = 1800; } } public static final class BlockMercury extends BlockFluidClassic{ public static final String name = "mercury"; public static final BlockMercury instance = new BlockMercury(); public BlockMercury() { super(MercuryFluid.instance, Material.WATER); } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } } } blockstates file: Spoiler { "forge_marker":1 "variants":{ "fluid":{ "model":"forge:fluid", "custom":{"fluid":"mercury"} } "inventory":{ "model":"forge:forge_bucket", "textures":{ "base":"forge:items/bucket_base", "fluid":"biodiversity:items/mercuryBucket", "cover":"forge:item/bucket_cover" }, "transform":"forge:default-item", "custom":{ "fluid":"mercury", "flipGas":true } } } } Also I can't pick it up with a bucket. This is my code for the bucket event which I copied from my 1.7 code and changed around until it didn't give me errors anymore. Spoiler package anagkai.biodiversity; import java.util.HashMap; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class BiodiversityBucketHandler { public static BiodiversityBucketHandler INSTANCE = new BiodiversityBucketHandler(); public Map<Block, Item> buckets = new HashMap<Block, Item>(); private BiodiversityBucketHandler() { } @SubscribeEvent public void onBucketFill(FillBucketEvent event) { ItemStack result = fillCustomBucket(event.getWorld(), event.getTarget()); if (result == null) return; event.setResult(Result.ALLOW); } private ItemStack fillCustomBucket(World world, RayTraceResult pos) { Block block = world.getBlockState(pos.getBlockPos()).getBlock(); Item bucket = buckets.get(block); if (bucket != null && world.getBlockState(pos.getBlockPos()).getValue(BlockFluidClassic.LEVEL) == 0) { world.setBlockToAir(pos.getBlockPos()); return new ItemStack(bucket); } else return null; } } Any help is appreciated. Edited February 10, 20178 yr by diesieben07 syntax hightlighting
February 10, 20178 yr Author When I use this, I get a water bucket when picking up my liquid. What else do I need to do to fix this? As for the rendering, it is pink and black.
February 11, 20178 yr Author That's what the console has to say on the topic. No idea what this should tell me. The blcokstates file is in the original post. Spoiler [17:19:06] [Client thread/ERROR] [FML]: Exception loading model for variant biodiversity:mercury#fluid for blockstates ["biodiversity:mercury[level=13]", "biodiversity:mercury[level=12]", "biodiversity:mercury[level=15]", "biodiversity:mercury[level=14]", "biodiversity:mercury[level=9]", "biodiversity:mercury[level=8]", "biodiversity:mercury[level=11]", "biodiversity:mercury[level=10]", "biodiversity:mercury[level=5]", "biodiversity:mercury[level=4]", "biodiversity:mercury[level=7]", "biodiversity:mercury[level=6]", "biodiversity:mercury[level=1]", "biodiversity:mercury[level=0]", "biodiversity:mercury[level=3]", "biodiversity:mercury[level=2]"] net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biodiversity:mercury#fluid 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:241) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[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.startGame(Minecraft.java:540) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more [17:19:06] [Client thread/ERROR] [FML]: Exception loading blockstate for the variant biodiversity:mercury#fluid: java.lang.Exception: Could not load model definition for variant biodiversity:mercury at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:274) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:121) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[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.startGame(Minecraft.java:540) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of 'biodiversity:mercury' from: 'biodiversity:blockstates/mercury.json' in resourcepack: 'FMLFileResourcePack:Biodiversity Mod' at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:223) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:200) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:185) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:270) ~[ModelLoader.class:?] ... 20 more Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 3 column 6 at com.google.gson.Gson.fromJson(Gson.java:818) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:717) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:689) ~[Gson.class:?] at net.minecraftforge.client.model.BlockStateLoader.load(BlockStateLoader.java:76) ~[BlockStateLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:37) ~[ModelBlockDefinition.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:219) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:200) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:185) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:270) ~[ModelLoader.class:?] ... 20 more Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 3 column 6 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:480) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:166) ~[ReflectiveTypeAdapterFactory$Adapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:717) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:689) ~[Gson.class:?] at net.minecraftforge.client.model.BlockStateLoader.load(BlockStateLoader.java:76) ~[BlockStateLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:37) ~[ModelBlockDefinition.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:219) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:200) ~[ModelBakery.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:185) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:270) ~[ModelLoader.class:?] ... 20 more [17:19:06] [Client thread/ERROR] [FML]: Exception loading model for variant biodiversity:mercury#inventory for item "biodiversity:mercury", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biodiversity:item/mercury with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[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.startGame(Minecraft.java:540) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: biodiversity:models/item/mercury.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:68) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:311) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [17:19:06] [Client thread/ERROR] [FML]: Exception loading model for variant biodiversity:mercury#inventory for item "biodiversity:mercury", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biodiversity:mercury#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[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.startGame(Minecraft.java:540) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79] 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:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more
February 11, 20178 yr Author So do I need to set a model for every height level in the blockstates file or rather have it ignore the height level?
February 11, 20178 yr Author I tried registering a StateMap to ignore it, but I couldn't because I wasn't able to find out what name the fluid block goes by. How I can find it out?
February 11, 20178 yr Author Normally my blocks are defined and registered in my block registry class. If I want to use it for anything I can call BlocksBiodiversity.blockXYZ. This block is registered in the my fluids class. The only thing I could get from there that didn't give a compilation error was BiodiversityFluids.BlockMercury.instance. BUT I don't think that it's right, because the state mapper doesn't work (there's still the same error in the console) even though I did it like any other state mapper before. And all these do work... That's the code of the state mapper. Builder builder6 = new StateMap.Builder(); builder6.ignore(BiodiversityFluids.BlockMercury.LEVEL); IStateMapper mapper6 = builder6.build(); ModelLoader.setCustomStateMapper(BiodiversityFluids.BlockMercury.instance, mapper6);
February 11, 20178 yr Author There is my fluid class and the blockstates file in the original post. Ther is the implementation of the StateMapper that I just posted. And there is the error from the log. What else do you need to look at?
February 11, 20178 yr Author Is there a howtwo somewhere for making a repository? I have no idea on how to do it...
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.