Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved] [1.12.2] Fluid block texture is not rendered
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Nuparu00

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

By Nuparu00, June 1, 2019 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Nuparu00    1

Nuparu00

Nuparu00    1

  • Tree Puncher
  • Nuparu00
  • Members
  • 1
  • 15 posts
Posted June 1, 2019 (edited)

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 June 2, 2019 by Nuparu00
Solved
  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Maxi90909
      Forge 1.16.5 - 36.0.9 start up crash

      By Maxi90909 · Posted 28 minutes ago

      OK Thank you. I had 2 Random Patches datas in my mods folder.
    • matthyit
      my 1.16.5 modded game crashes after a while of playing

      By matthyit · Posted 28 minutes ago

      so i need to update java?
    • Luis_ST
      [1.16.5] Enchantments can Apply to all Tools

      By Luis_ST · Posted 32 minutes ago

      but eclipse say i have to set the cast currently i looked in the vanilla EnchantmentHelper at the method removeIncompatible and i creat this: List<Enchantment> enchantmentList = enchantments.keySet().stream().collect(Collectors.toList()); List<Integer> levelList = enchantments.values().stream().collect(Collectors.toList()); List<EnchantmentData> data = new ArrayList<EnchantmentData>(); for (int i = 0; i < enchantments.size(); i++) { data.add(new EnchantmentData(enchantmentList.get(i), levelList.get(i))); } for (int i = 0; i < data.size(); i++) { EnchantmentHelper.removeIncompatible(data, data.get(i)); }  
    • diesieben07
      [1.16.5] Enchantments can Apply to all Tools

      By diesieben07 · Posted 36 minutes ago

      Sure. Although you should not need that cast.   Actually. I looked again. No, that does not make sense. Why are you trying to cast the iterator.
    • Luis_ST
      [1.16.5] Enchantments can Apply to all Tools

      By Luis_ST · Posted 37 minutes ago

      than this while (enchantmentIterator.hasNext()) { Enchantment enchantment = (Enchantment) enchantmentIterator; if (!enchantment.isCompatibleWith(enchantmentIterator.next())) { enchantmentIterator.remove(); } }  
  • Topics

    • Maxi90909
      4
      Forge 1.16.5 - 36.0.9 start up crash

      By Maxi90909
      Started 2 hours ago

    • matthyit
      4
      my 1.16.5 modded game crashes after a while of playing

      By matthyit
      Started 2 hours ago

    • Luis_ST
      22
      [1.16.5] Enchantments can Apply to all Tools

      By Luis_ST
      Started Yesterday at 07:21 AM

    • Zockerbua
      1
      I need help

      By Zockerbua
      Started 1 hour ago

    • domi0908
      6
      fix hitbox red baby mobs version forge

      By domi0908
      Started Tuesday at 03:04 PM

  • Who's Online (See full list)

    • Luis_ST
    • matthyit
    • ianiiaannn
    • Tavi007
    • Ray99
    • domi0908
    • Puma_MGP
    • xX_deadbush_Xx
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved] [1.12.2] Fluid block texture is not rendered
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community