Posted December 4, 20159 yr So i've tried looking at the ModelFluidDebug class here https://github.com/MinecraftForge/MinecraftForge/blob/b45fd787f36626ef84f26e881848167fec5957b5/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java but is not working I have done a new workspace with only that file (so basically a mod that adds only that fluid) but the texture is missing. This is the main mod file (and also the only class in the mod) package com.example.examplemod; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; 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.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = ModelFluidDebug.MODID, version = ModelFluidDebug.VERSION) public class ModelFluidDebug { public static final String MODID = "ForgeDebugModelFluid"; public static final String VERSION = "1.0"; private static ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "fluid"); private static ModelResourceLocation gasLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "gas"); @EventHandler public void preInit(FMLPreInitializationEvent event) { FluidRegistry.registerFluid(TestFluid.instance); FluidRegistry.registerFluid(TestGas.instance); GameRegistry.registerBlock(TestFluidBlock.instance, TestFluidBlock.name); GameRegistry.registerBlock(TestGasBlock.instance, TestGasBlock.name); Item fluid = Item.getItemFromBlock(TestFluidBlock.instance); Item gas = Item.getItemFromBlock(TestGasBlock.instance); ModelBakery.addVariantName(fluid); ModelBakery.addVariantName(gas); ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) { return fluidLocation; } }); ModelLoader.setCustomMeshDefinition(gas, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) { return gasLocation; } }); ModelLoader.setCustomStateMapper(TestFluidBlock.instance, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return fluidLocation; } }); ModelLoader.setCustomStateMapper(TestGasBlock.instance, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return gasLocation; } });} public static final class TestFluid extends Fluid { public static final String name = "testfluid"; public static final TestFluid instance = new TestFluid(); private TestFluid() { super(name); } @Override public int getColor() { return 0xFF00FF00; } } public static final class TestGas extends Fluid { public static final String name = "testgas"; public static final TestGas instance = new TestGas(); private TestGas() { super(name); density = -1000; isGaseous = true; } @Override public int getColor() { return 0xFFFF0000; } } public static final class TestFluidBlock extends BlockFluidClassic { public static final TestFluidBlock instance = new TestFluidBlock(); public static final String name = "TestFluidBlock"; private TestFluidBlock() { super(TestFluid.instance, Material.water); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } } public static final class TestGasBlock extends BlockFluidClassic { public static final TestGasBlock instance = new TestGasBlock(); public static final String name = "TestGasBlock"; private TestGasBlock() { super(TestGas.instance, Material.lava); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } } } and that's the json file { "forge_marker": 1, "variants": { "fluid": { "model": "forge:fluid", "custom": { "fluid": "testfluid" } }, "gas": { "model": "forge:fluid", "custom": { "fluid": "testgas" } } } } any idea on why is not working? Don't blame me if i always ask for your help. I just want to learn to be better
December 5, 20159 yr Author Anybody? I don't understand why the fluid when placed down is invisible UPDATE: i've added this to the TestFluidBlock class @Override public int getRenderType() { return 3; } and now it gives me this So apparently is not spreading like the normal water does, it fills all the space with "blocks", is because it has no texture? How can i give it one? Don't blame me if i always ask for your help. I just want to learn to be better
December 6, 20159 yr Author Still any idea? Don't blame me if i always ask for your help. I just want to learn to be better
December 6, 20159 yr I have got the same Problem too. Maybe this github code is wrong. catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
December 8, 20159 yr Author bump Don't blame me if i always ask for your help. I just want to learn to be better
December 8, 20159 yr Dunno if this helps, but MODID must be lowercase.. I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 8, 20159 yr Which version of Forge are you using? The fluid model was added in 1.8-11.14.3.1464. The FML log should tell you what's going wrong. If you don't know what to make of it, upload it to Gist and link it here. Fluid textures are set from the Fluid(String, ResourceLocation, ResourceLocation) constructor (added at the same time as the fluid model). Your code is using the Fluid(String) constructor. The fluid code on Forge's GitHub repository works for me in 1.8-11.14.4.1571. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
December 8, 20159 yr Author I do this in the ModelResourceLocation MODID.toLowerCase() so it's always lower case when passed as argument to ModelResourceLocation ctor Don't blame me if i always ask for your help. I just want to learn to be better
December 8, 20159 yr Author Mmm... i'm using the 1.8-11.14.1.1375 version, i'll try it in that version Don't blame me if i always ask for your help. I just want to learn to be better
December 8, 20159 yr I do this in the ModelResourceLocation MODID.toLowerCase() so it's always lower case when passed as argument to ModelResourceLocation ctor Well, that works.. But I'd really recommend making the MODID lowercase, as it will save you the time and tears when you forget to put it to lowercase. Give me one good reason for having an uppercase. I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 8, 20159 yr Author ahahahah that was just a copy/paste from the github file, in fact in the mod where this will go it's lower case Don't blame me if i always ask for your help. I just want to learn to be better
December 8, 20159 yr wow... Anyway, what's your current problem? I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 8, 20159 yr Author Actually i had to test it in a newer version of Forge and see if it works As soon as i can i'll let you kow Don't blame me if i always ask for your help. I just want to learn to be better
December 8, 20159 yr Okay It will probably fix the issue I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 9, 20159 yr Author Ok, so updating the Forge version to the latest or the MC1.8 fixed the error For anyone who want an example, this is the actual code package com.example.examplemod; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; 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.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = ModelFluidDebug.MODID, version = ModelFluidDebug.VERSION) public class ModelFluidDebug { public static final String MODID = "ForgeDebugModelFluid"; public static final String VERSION = "1.0"; private static ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "fluid"); private static ModelResourceLocation gasLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "gas"); @EventHandler public void preInit(FMLPreInitializationEvent event) { FluidRegistry.registerFluid(CustomFluid.instance); FluidRegistry.registerFluid(TestGas.instance); GameRegistry.registerBlock(TestFluidBlock.instance, TestFluidBlock.name); GameRegistry.registerBlock(TestGasBlock.instance, TestGasBlock.name); Item fluid = Item.getItemFromBlock(TestFluidBlock.instance); Item gas = Item.getItemFromBlock(TestGasBlock.instance); ModelBakery.addVariantName(fluid); ModelBakery.addVariantName(gas); ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) { return fluidLocation; } }); ModelLoader.setCustomMeshDefinition(gas, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) { return gasLocation; } }); ModelLoader.setCustomStateMapper(TestFluidBlock.instance, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return fluidLocation; } }); ModelLoader.setCustomStateMapper(TestGasBlock.instance, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return gasLocation; } });} public static final class CustomFluid extends Fluid { public static final String name = "myfluid"; public static final CustomFluid instance = new CustomFluid(); private CustomFluid() { super(name, new ResourceLocation(MODID.toLowerCase() + ":" + "blocks/testfluid"), new ResourceLocation(MODID.toLowerCase() + ":" + "blocks/testfluid")); } } public static final class TestGas extends Fluid { public static final String name = "testgas"; public static final TestGas instance = new TestGas(); private TestGas() { super(name, new ResourceLocation("blocks/lava_still"), new ResourceLocation("blocks/lava_flow")); density = -1000; isGaseous = true; } } public static final class TestFluidBlock extends BlockFluidClassic { public static final TestFluidBlock instance = new TestFluidBlock(); public static final String name = "TestFluidBlock"; private TestFluidBlock() { super(CustomFluid.instance, Material.water); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } @Override public int getRenderType() { return 3; } /** * The type of render function that is called for this block */ } public static final class TestGasBlock extends BlockFluidClassic { public static final TestGasBlock instance = new TestGasBlock(); public static final String name = "TestGasBlock"; private TestGasBlock() { super(TestGas.instance, Material.lava); setCreativeTab(CreativeTabs.tabBlock); setUnlocalizedName(MODID + ":" + name); } } } and this is the Json file { "forge_marker": 1, "variants": { "fluid": { "model": "forge:fluid", "custom": { "fluid": "myfluid" } }, "gas": { "model": "forge:fluid", "custom": { "fluid": "testgas" } } } } Note that the name specified in "custom" in the json file is the same name as specified in the class, otherwise it will have the default water texture Thanks Choonster for the tip Don't blame me if i always ask for your help. I just want to learn to be better
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.