Posted March 10, 201510 yr Heya, I'm currently making a compatibility mod for our modpack. Now I have the following issue: I have created a fluid, and it's working fine. Buckets included. However when placed inside other mods containers this happens: As you can see, the fuel works in the bucket and when placed, however it shows a lava texture inside Thermal Expansions portable tank. (Mekanism tanks work fine however! ) Also inside the EnderIO VAT: It shows the fluid, but it has no texture (looks like it's empty, even tho it's full) Do I have to include both their api's just to get the fluid working? Or is there something I'm missing.
March 10, 201510 yr Show your code, especially the block and the fluid class. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
March 10, 201510 yr Author Fluids: package com.creepgaming.creepgamingmod.fluids; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; public class Fluids { public static Fluid rFuel; public static Block blockRFuel; public static void mainRegistry() { rFuel = new Fluid("fuel").setLuminosity(0).setDensity(790).setViscosity(1000); FluidRegistry.registerFluid(rFuel); blockRFuel = new BlockRFuel(rFuel, Material.water).setBlockName("rfuel"); GameRegistry.registerBlock(blockRFuel, blockRFuel.getUnlocalizedName().substring(5)); rFuel.setUnlocalizedName(blockRFuel.getUnlocalizedName()); } } FluidBlock: package com.creepgaming.creepgamingmod.fluids; import com.creepgaming.creepgamingmod.CreepGamingMod; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; public class BlockRFuel extends BlockFluidClassic{ @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockRFuel(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(CreepGamingMod.tabCCG); } @Override public IIcon getIcon(int side, int meta){ return (side == 0 || side == 1)? stillIcon : flowingIcon; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register){ stillIcon = register.registerIcon("creepgamingmod:fuel_still"); flowingIcon = register.registerIcon("creepgamingmod:fuel_flow"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z){ if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } } I used this tutorial: http://www.minecraftforge.net/wiki/Create_a_Fluid I don't think I've changed anything besides the textures and the properties of the liquid.
March 10, 201510 yr You need to call Fluid#setIcons() on your fluid to make the textures work (at least for me). Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
March 10, 201510 yr Author You need to call Fluid#setIcons() on your fluid to make the textures work (at least for me). I'm confused. I thought I was setting the textures here already: @Override public void registerBlockIcons(IIconRegister register){ stillIcon = register.registerIcon("creepgamingmod:fuel_still"); flowingIcon = register.registerIcon("creepgamingmod:fuel_flow"); } Also the textures work flawlessly except inside TE and EnderIO machines. How would I use setIcons()? Wouldn't I just register the same stuff again? oO I'm really confused why they work just fine outside of those 2 things
March 10, 201510 yr Author Those are the Icons for your Block. The fluid is technically not your Block, it is a different thing. When other mods interact with your Fluid they interact with the Fluid instance, not the Block. Hence you need to tell the Fluid about the Icons as well. Oh I understand. So they are 2 separate things. I assumed the fluid was simply a reference to the block. However I'm unsure of how I can set the textures inside the fluid class. I've checked a bunch of open source projects and found none of them were doing that. I'm not even sure I understand this whole Iicon thing. Any chance you could point me to an example class?
March 10, 201510 yr Author Inside registerBlockIcons after you got the IIcon objects (IIcon is really just a set of coordinates on the big texture sheet) you call setIcons on your Fluid object. IIcon is really just a set of coordinates on the big texture sheet Holy crap, you just summarized what I've been trying to understand via google for the past 2 hours. And it actually makes sense. Thank you! Also, I feel like a complete Idiot now. I JUST had it fixed before reading your post, but I was catching the block and reading the Iicons off it in postInit, then applying them to the fluids. This is 1000x smarter and better. Thanks! Just shows how little I understand Forge atm ._. Thanks for the quick help!
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.