Jump to content

Recommended Posts

Posted

So, I've been trying to figure out how to implement a custom liquid. I seem to be doing well so far, albeit it's displaying water instead of my custom liquid and the water is at the minimum level. Anyone have any ideas what's going on here? Here's my current liquid registry and building code

 

 

public class BioFluids {
public static Fluid ossidefluid;
public static BlockFluidFinite ossideblock;
static Item ossideitem;
static ModelResourceLocation ossideLocation = new ModelResourceLocation(Main.MODID + ":" + "ossideblock");
public static void createFluids()
{
	FluidRegistry.registerFluid(ossidefluid = new BoneChemFluid());
	ossideblock = new BoneChemBlock();
	GameRegistry.registerBlock(ossideblock, "ossideblock");
	ossideitem = Item.getItemFromBlock(ossideblock);
	ModelBakery.addVariantName(ossideitem);
	ModelLoader.setCustomMeshDefinition(ossideitem, new ItemMeshDefinition() {
            public ModelResourceLocation getModelLocation(ItemStack stack)
            {
                return ossideLocation;
            }
        });
	ModelLoader.setCustomStateMapper(ossideblock, new StateMapperBase()
        {
            protected ModelResourceLocation getModelResourceLocation(IBlockState state)
            {
                return ossideLocation;
            }
        });
}
}

 

 

Any thoughts? Granted, it's likely fairly clumsy but I figured it was worth asking about.

Posted

That looks mostly correct, though you'll crash the dedicated server by using client-only classes in code that needs to run on both sides. Move the model registration code to its own method and call that from your client proxy.

 

If you want a

BlockFluidFinite

to be at the maximum level, you need to set its

LEVEL

property to 7.

 

If your fluid is rendering as water, you haven't set the fluid for the model to render in your blockstates file.

 

I posted links to my fluid initialisation and model registration code here.

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.

Posted

Hm. Seems like it's immediately collapsing to minimum height, after the block has been placed. Unless there's been a significant change in how fluids flow, I'm reasonably certain this isn't supposed to be happening.

 

EDIT: Here's the code, should've posted this in the first place.

 

 

 public class BoneChemBlock extends BlockFluidFinite {
public static Fluid ossideflowinstance = new BoneChemFluid();
public static Material ossidematerial = new BoneChemMat();
public BoneChemBlock(Fluid fluid, Material material) {
	super(fluid, material);
	this.setUnlocalizedName("ossideblock");
	this.setCreativeTab(BioTab.bioTab);
	this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 7));
}
@Override
public int getRenderType()
{
	return 3;
}
public BoneChemBlock()
{
	this(ossideflowinstance, ossidematerial);
}
} 

 

Posted

I think that's just how

BlockFluidFinite

flows. If you want a fluid that flows like the vanilla liquids, use

BlockFluidClassic

.

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.

Posted

Ahhhhhh. OK, I thought BlockFluidFinite was for things like lava, whereas BlockFluidClassic was for things like water. Something that wouldn't form infinite pools, vs something that would. Thanks! Anyway, go ahead and mark this one as solved. Seems like my bio-engineering mod is well on its way to completion!

Posted

Finite is for fluids that don't have source blocks, only quanta.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.