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

So ive added a few new fluids, and i have their textures rendering properly in fluid tanks and such, however the acutal fluid in the world, and the icon for the fluid in JEI render as water. Both render as water and im 90% sure its the blockstate.json file. Any help is much appreciated.

 

block_fluids.json

Spoiler

{
    "forge-marker": 1,
    "variants": {
        "coolant": {
             "model": "forge:fluid",
             "custom": { "fluid": "coolant" }
        },
        "energized_redstone": {
             "model": "forge:fluid",
             "custom": { "fluid": "energized_redstone" }
        } 
    }
}

 

Edited by Zeher_Monkey

  • Author

In my BlockHandlerClass:

Spoiler

public static void register(){

       registerFluidModel(myFluidBlock);

}

 

public static void registerFluidModel(TRZBlockFluid fluidBlock){
        Item item = Item.getItemFromBlock(fluidBlock);
        
        ModelBakery.registerItemVariants(item);

        final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(OreCraft.mod_id + ":" +  "block_fluids", fluidBlock.getFluid().getName());
        
        ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create(stack -> modelResourceLocation));

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

 

The register() function is called in my CommonProxy preInit() function.

  • Author

Okay so update, the item tile in the inventory works. I changed some code around to look like this:

 

BlockHandler.java

Spoiler

public static void register(){

        registerFluidBlock(my_fluid_block);

        registerFluidModel(my_fluid_block);

}

 

public static void registerFluidBlock(Block block){
        GameRegistry.register(block);
    }
    
    public static void registerFluidModel(TRZBlockFluid fluidBlock){
        Item item = Item.getItemFromBlock(fluidBlock);
        
        ModelBakery.registerItemVariants(item);

        final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(OreCraft.mod_id + ":" +  "block_fluids", fluidBlock.getFluid().getName());
        
        ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create(stack -> modelResourceLocation));

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

 

However the fluid still renders as water in the world.

Where do you call BlockHandler.registerFluidModel from?

 

ModelLoader methods need to be called in preInit or ModelRegistryEvent.

 

Model registration must be done in a client-only class. Block and Item registration must be done in common code.

 

You should use the registry events to register your Blocks, Items and other IForgeRegistryEntry implementations. This will make it easier to update to 1.12+, where GameRegistry.register is private.

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.

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.