Jump to content

[Solved] "Cannot create a fluidstack from an unregistered fluid"??


Ms_Raven

Recommended Posts

I don't understand why I'm getting this error.

My fluid is registered. Why is this happening?

 

This is the method I'm using to register everything. It works perfectly fine until I add the fluid there, doesn't matter if it comes before or after everything else.

 

public static void init()
{
	FluidRegistry.registerFluid(honey);

	for (int i = 0; i < items.length; i++)
	{
		GameRegistry.registerItem(items[i], items[i].getUnlocalizedName());
	}
	for (int i = 0; i < blocks.length; i++)
	{
		GameRegistry.registerBlock(blocks[i], blocks[i].getUnlocalizedName());
	}

}

 

And this is how it's registered in the blocks array:

 

		honey_fluid = new HoneyClassic("honey_fluid", honey, Material.water),

Link to comment
Share on other sites

I used this site's own tutorial to try to do this.

 

Inside the preInit() of the main class is:

 

CoreRegistry.init()

 

Inside CoreRegistry (leaving all unrelated things out) is this:

 

public static Fluid honey = new Fluid("honey").setViscosity(6500);
public static Block honey_fluid;

public static Block[] blocks =
{
		honey_fluid = new HoneyClassic("honey", honey, Material.water),
};

public static void init()
{
	honey.setBlock(honey_fluid);
	FluidRegistry.registerFluid(honey);

	for (int i = 0; i < blocks.length; i++)
	{
		GameRegistry.registerBlock(blocks[i], blocks[i].getUnlocalizedName());
	}
}

 

Inside HoneyClassic is this:

 

public class HoneyClassic extends BlockFluidClassic
{

private String name;

@SideOnly(Side.CLIENT)
protected IIcon stillIcon;
@SideOnly(Side.CLIENT)
protected IIcon flowingIcon;

public HoneyClassic(String name, Fluid fluid, Material material)
{
	super(fluid, material);
	this.name = name;
	this.setCreativeTab(CoreTabs.core);
	this.setBlockName(name);
}

@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
	return Tools.getColour("gold", 2);
}

@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(Tools.get(name + "_still"));
	flowingIcon = register.registerIcon(Tools.get(name + "_flowing"));
}

@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);
}
}

Link to comment
Share on other sites

See this bit here?

register1.png

See how it occurs after this bit here?

register2.png

 

Yeah, they need to be reversed.  This is why you do not define your blocks, items, and fluids outside of a method.

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.

Link to comment
Share on other sites

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.