Jump to content

Recommended Posts

Posted

I have added a fluid in 1.8 using the latest build of forge. I have textures and json files, but in game the item in hand has a texture, but the placed fluid is invisible. If you go under it, it has the water material. Also bubbles from water show, but the actual fluid is invisible. I looked through forge's github and IIcons are removed (which I knew), but their are still and flowing icon variables. These are TextureAtlasSprites though and I have no idea how to get my texture to show up using them.

 

tl;dr

I need my Fluid to show up with my texture. Any ideas?

 

Any help is appreciated!

Posted

Hi

 

Fluids aren't rendered the same way as normal blocks.  Vanilla does it this way, fluid blocks return 1 for getRenderType().

 

BlockRendererDispatcher::
    public boolean func_175018_a(IBlockState p_175018_1_, BlockPos p_175018_2_, IBlockAccess p_175018_3_, WorldRenderer p_175018_4_)
    {
        try
        {
            int i = p_175018_1_.getBlock().getRenderType();

            if (i == -1)
            {
                return false;
            }
            else
            {
                switch (i)
                {
                    case 1:
                        return this.fluidRenderer.func_178270_a(p_175018_3_, p_175018_1_, p_175018_2_, p_175018_4_);  // here
                    case 2:
                        return false;
                    case 3:
                        IBakedModel ibakedmodel = this.getModelFromBlockState(p_175018_1_, p_175018_3_, p_175018_2_);
                        return this.blockModelRenderer.func_178259_a(p_175018_3_, ibakedmodel, p_175018_1_, p_175018_2_, p_175018_4_);
                    default:
                        return false;
                }
            }
        }

 

Unfortunately I don't know how to get it to show the fluid texture.  You may need to use ASM+Reflection to force a call to your own renderer from this switch.

 

-TGG

 

Posted

So there is nothing built into forge to be able to render your own fluid? Could I maybe just change the color using hexadecimal (since I just changed the color of the water texture in Photoshop)? I don't need an elaborate or special texture. I just want a fluid that you can see  :P

Posted

Forge does have support for fluids but I've never used it so I'm not sure.  Also, I think it may not have been updated for 1.8 yet.

 

If you do figure it out, please let me know, I'd like to do a tutorial / MinecraftByExample topic on it at some point...

 

Cheers

  TGG

 

Posted

So I have literally coded, deleted, recoded in repeat for the last 2 days updating my mod, yet I still can't figure out this fluid thing. I even created a new TextureMap and TextureAtlasSprite and registered my sprite to a new resource location:

 

public static TextureAtlasSprite[] atlasSpritesFluid = new TextureAtlasSprite[2];
TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
this.atlasSpritesFluid[0] = texturemap.registerSprite(new ResourceLocation("examplemod:textures/blocks/FluidStill.png"));
this.atlasSpritesFluid[1] = texturemap.registerSprite(new ResourceLocation("examplemod:textures/blocks/FluidFlow.png"));

 

I do this because minecraft uses TextureAtlasSprites as the parameters for setStillIcon and setFlowingIcon.

 

But when I setStillIcon and setFlowingIcon to my fluid, it still renders invisible...

 

fluid.setStillIcon(atlasSpritesFluid[0]).setFlowingIcon(atlasSpritesFluid[1]);

 

My fluid does flow and moves seeds and displaces water like any normal fluid, but like stated before, it renders invisible.

 

EDIT: I set a println to tell me the color of the fluid, and even when I set the blocks color, the fluid color stays as 16777215... Any ideas?

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.