Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

At the moment my fluid just renders as blocks (see the attachment). How do I make it render like normal liquids?

2017-09-17_11.05.12.png

You need to use the forge:fluid model. Use Forge's blockstates format to set the "fluid" custom property to the name of your Fluid.

 

I use this blockstates file to define the models for my mod's fluid Blocks/ItemBlocks and these methods to register them.

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.

  • Author

What is MeshDefenitionFix? I can't import it.

Edited by meee39

6 hours ago, meee39 said:

What is MeshDefenitionFix? I can't import it.

 

It's a class added by my mod to allow the use of lambdas as ItemMeshDefinitions.

 

I'm pretty sure the ForgeGradle reobfuscation bug that prevented that was fixed a while ago, so it's probably not needed anymore. 

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.

  • Author
package com.leo.occultcraft.fluids;

import com.leo.occultcraft.Occultcraft;

import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;

@Mod.EventBusSubscriber(value = Side.CLIENT, modid = Occultcraft.modid)
public class FluidRenderer {
	public static final FluidRenderer INSTANCE = new FluidRenderer();
	private static final String FLUID_MODEL_PATH =  Occultcraft.modid + ":fluid";
	
	@SubscribeEvent
	public static void registerAllModels(final ModelRegistryEvent event) {
		
	}
	
	private void registerFluidModel(final IFluidBlock fluidBlock) {
		final Item item = Item.getItemFromBlock((Block) fluidBlock);
		assert item != Items.AIR;

		ModelBakery.registerItemVariants(item);

		final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(FLUID_MODEL_PATH, fluidBlock.getFluid().getName());

		//ModelLoader.setCustomMeshDefinition(item, ItemMeshDefenition.create(stack -> modelResourceLocation));

		ModelLoader.setCustomStateMapper((Block) fluidBlock, new StateMapperBase() {
			@Override
			protected ModelResourceLocation getModelResourceLocation(final IBlockState p_178132_1_) {
				return modelResourceLocation;
			}
		});
	}
	
}

 

I don't think you really need to make your own renderer unless you're doing something fancy. Since you said you wanted to have them show up like "normal" liquids you might just want to check my custom fluid tutorial to see what you're doing wrong. http://jabelarminecraft.blogspot.com/p/minecraft-modding-fluids_18.html . 

 

Also, you probably have an indication in the console log. It may complain about not finding the blockstate file, or having a bad blockstate file, or missing variant, or missing texture, and so forth. So most likely related to your JSONs or else related to your registry names not matching your JSON file names. So either post your log or debug it yourself.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.