Jump to content

[1.12.2] Only first fluid registered renders properly


Lyinginbedmon

Recommended Posts

I managed to successfully implement an acid fluid, but every fluid afterwards has refused to properly accept its model, despite using entirely identical code.

AdHgcv5.png

Mod fluid registry:

public class VOFluids
{
	private static final List<Fluid> FLUIDS = new ArrayList<Fluid>();
	
	public static Fluid ACID;
	public static Fluid GREASE;
	
	public static Fluid PETRIFYING;
	
	public static void init()
	{
		ACID	= addFluid(new FluidAcid());
		GREASE	= addFluid(new FluidGrease());
		
		PETRIFYING	= addFluid(new GasPetrifying());
	}
	
	private static Fluid addFluid(Fluid fluidIn)
	{
		FLUIDS.add(fluidIn);
		FluidRegistry.registerFluid(fluidIn);
		return fluidIn;
	}
	
	public static void renderFluids()
	{
		((BlockFluidVO)VOBlocks.ACID).render();
		((BlockFluidVO)VOBlocks.GREASE).render();
		((BlockFluidVO)VOBlocks.PETRIFYING_GAS).render();
	}
}

All of the fluids extend out of Forge's Fluid class, with the exception of GasPetrifying which does a little bit of defaults for gaseous fluids and still experiences the same problem. init() is called by the CommonProxy, renderFluids() is called by the ClientProxy, both during pre-initialisation.

 

Mod fluid block class:

public abstract class BlockFluidVO extends BlockFluidClassic
{
	public BlockFluidVO(String nameIn, Fluid fluidIn)
	{
		this(nameIn, fluidIn, Material.WATER);
	}
	
	public BlockFluidVO(String nameIn, Fluid fluidIn, Material materialIn)
	{
		super(fluidIn, materialIn);
		setCreativeTab(CreativeTabVO.BLOCKS_TAB);
		setBlockDefaults(nameIn);
	}
	
	public void setBlockDefaults(String nameIn)
	{
		this.setCreativeTab(null);
		this.setRegistryName(Reference.ModInfo.MOD_ID, nameIn);
		this.setUnlocalizedName(getRegistryName().toString());
	}
	
	@SideOnly(Side.CLIENT)
	public void render()
	{
		ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(LEVEL).build());
	}
}

The only meaningful change I've managed to identify is that altering the order of model registration in renderFluids() changes which fluid works fine. All the fluids use essentially identical blockstate files, however only the first registered is accepted, the others complain about missing states for different fluid levels (despite explicitly being told to ignore them).

Fluid blockstate:

{
     "forge_marker": 1,
     "defaults":
     {
        "model": "forge:fluid",
        "transform": "forge:default-item"
     },
     "variants":
     {
         "normal":
         {
             "model": "forge:fluid", 
             "custom": { "fluid": "varodd:acid" }
         }
     }
}

I've checked for any documentation, tutorials, or other mods that incorporate multiple fluids and I haven't been able to find a reason for this error.

Link to comment
Share on other sites

I don't know exactly what your issue is, but I can point you to my 1.12.2 fluid code where I have several fluids with their own textures: initialisation and registration, model registration, blockstates file.

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.

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.