Jump to content

[Solved] [1.12.2] Fluid block texture is not rendered


Nuparu00

Recommended Posts

Hi.

I have got an issue with a custom fluid block, that I have been trying to fix for a whole night.

The issue is that I am not able to get my custom fluid texture to render. The Forge bucket texture works, but the actual block texture doesn't. No matter what I do I always get one of these results:

  1. The block is not rendered at all (there you can see through, but the block is obviously here as it still affects entities, make particles, etc...)
  2. The block is rendered as the missing model placeholder
  3. The block is rendered as a vanilla fluid 

 

My code:

ModFluids.java - Here I initialize the Fluid

https://pastebin.com/sxUHCSXc

 

The fluid is registered from a static block in my main class:

static {
		FluidRegistry.enableUniversalBucket();
		
		FluidRegistry.registerFluid(ModFluids.GASOLINE);
		FluidRegistry.addBucketForFluid(ModFluids.GASOLINE);
	}

 

BlockGasoline.java - The block that uses the Fluid

https://pastebin.com/eVDV90vr

 

The block is initialized like this:

public static final Block GASOLINE = new BlockGasoline(ModFluids.GASOLINE,Material.WATER).setRegistryName("gasoline").setUnlocalizedName("gasoline");
	

 

And registered using RegistryEvent.Register<Block>

@SubscribeEvent
	public static void registerBlocks(final RegistryEvent.Register<Block> event) {
		final IForgeRegistry<Block> registry = event.getRegistry();
		for (Block block : SevenDaysToMine.BLOCKS) {
			registry.register(block);
		}

	}

 

And this is how I register the models

@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public static void onModelEvent(final ModelRegistryEvent event) {
		for (Block block : SevenDaysToMine.BLOCKS) {
			registerBlockModel(block);
		}
		registerItemBlockModels();
		registerItemModels();
	}

	@SideOnly(Side.CLIENT)
	public static void registerBlockModel(Block block) {
		if (block instanceof IBlockBase) {
			IBlockBase iblockbase = (IBlockBase) block;
			if (iblockbase.hasCustomStateMapper()) {
				if (iblockbase.getStateMapper() != null) {
					ModelLoader.setCustomStateMapper(block, iblockbase.getStateMapper());
					return;
				} else {
					Utils.getLogger().warn("Trying to add a null IStateMapper to " + block.getRegistryName()
							+ " . That is a bad thing!");
				}
			}

		}
		
		registerBlockModel(block, 0);
	}

 

 

The .json blockstate file is correctly located in the blockstates folder and looks like this:

{
    "forge_marker": 1,
    "variants": {
        "fluid": {
            "model": "forge:fluid",
            "custom": { "fluid": "gasoline" }
        },
        "inventory": {
            "model": "forge:forgebucket",
            "transform": "forge:default-item",
            "custom": {
                "fluid": "gasoline"
            }
        }
    }
}

 

If I change in the file "gasoline" to some random word, it renders the vanilla water texture (which I suppose is a placeholder), however, if I change it to "lava", it correctly renders vanilla lava.

 

EDIT: Solved, caused by Fluid#setColor()

Edited by Nuparu00
Solved
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.