Jump to content

Removing that Pesky Foliage Color


gosaints70

Recommended Posts

Hey there, I was curious how you removed foliage color. I have been playing around with it, but the only thing I managed to do was turn it into a completely black block. Anyone know how to do this?

 

CustomLeafBlock (Up to my attempts to change the color)

 

package com.crystal.block;

 

import java.util.List;

 

import net.minecraft.block.BlockLeaves;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.IIcon;

import net.minecraft.world.ColorizerFoliage;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

 

import com.crystal.creativetab.CreativeTabsManager;

import com.crystal.lib.StringLibrary;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class MagicalTreeLeaf extends BlockLeaves {

{

this.setCreativeTab(CreativeTabsManager.tabC);

this.setBlockName("MagicalLeaf");

}

public static final String[][] leaftypes = new String[][] {{"LeafMagical"}, {"LeafMagicalOpaque"}};

public static final String[] leaves = new String[] {"Magical"};

public MagicalTreeLeaf(Material leaves2) {

// TODO Auto-generated constructor stub

}

    @SideOnly(Side.CLIENT)

    public int getBlockColor()

    {

        double d0 = 0.5D;

        double d1 = 1.0D;

        //return ColorizerFoliage.getFoliageColor(d0, d1);

        return 0;

    }

    @SideOnly(Side.CLIENT)

    public int getRenderColor(int p_149741_1_)

    {

        //return ColorizerFoliage.getFoliageColorBasic();

return 0;

    }

 

Link to comment
Share on other sites

Ok, I found what actually changes the color of the block

 

 

    /**

    * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called

    * when first determining what to render.

    */

    @SideOnly(Side.CLIENT)

    public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_)

    {

        int l = 0;

        int i1 = 0;

        int j1 = 0;

 

        for (int k1 = -1; k1 <= 1; ++k1)

        {

            for (int l1 = -1; l1 <= 1; ++l1)

            {

                int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getBiomeFoliageColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1);

                l += (i2 & 16711680) >> 16;

                i1 += (i2 & 65280) >> 8;

                j1 += i2 & 255;

            }

        }

 

        return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;

    }

 

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