TheDoomBringer Posted October 30, 2014 Posted October 30, 2014 I've tried following the Create a fluid (http://www.minecraftforge.net/wiki/Create_a_Fluid) tutorial but to no avail. I can't seem to understand how to actually register the block. If anyone has some time to help me understand how to do it or has a source with the correct way to do it, I would really appreciate it. Thanks for your time. Quote
Eternaldoom Posted October 30, 2014 Posted October 30, 2014 Register it like a normal block, but register the fluid first. Post your code -- how far have you gotten? Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
TheDoomBringer Posted October 30, 2014 Author Posted October 30, 2014 Ok so I've registered it where I register all my other blocks @GameRegistry.ObjectHolder(Reference.MOD_ID) public class ModBlocks { public static final BlockBL sbrick = new BlockSnowBrick(); public static final BlockBL icePulse = new BlockIcePulse(); public static final BlockBL orichalcumOre = new BlockOrichalcumOre(); public static final Fluid liquidElerium = new Fluid("liquidElerium"); public static void init() { GameRegistry.registerBlock(sbrick, "sbrick"); GameRegistry.registerBlock(icePulse, "icePulse"); GameRegistry.registerBlock(orichalcumOre, "orichalcumOre"); FluidRegistry.registerFluid(liquidElerium); } } Then I made another class where I construct (if that's the right word) the blocks and put this: public class BlockYourFluid extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockYourFluid(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(CreativeTabs.tabMisc); } @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("modid:fluidStill"); flowingIcon = register.registerIcon("modid:fluidFlowing"); } @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); } } Now I'm not entirely sure what to do from here. Do I make a new class to register the Block? Quote
Eternaldoom Posted October 30, 2014 Posted October 30, 2014 Nope, register it with your other blocks. Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
Eternaldoom Posted October 30, 2014 Posted October 30, 2014 Just put this where you create your other blocks: public static BlockYourFluid yourFluid = new BlockYourFluid(liquidElerium, Material.water); and change ModBlocks.init() to this: GameRegistry.registerBlock(sbrick, "sbrick"); GameRegistry.registerBlock(icePulse, "icePulse"); GameRegistry.registerBlock(orichalcumOre, "orichalcumOre"); FluidRegistry.registerFluid(liquidElerium); GameRegistry.registerBlock(yourFluid, "some_name") Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
Recommended Posts
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.