Jump to content

Recommended Posts

Posted (edited)

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
Posted

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.

Posted

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.

Posted

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

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