Fix decorative leaf colors

This commit is contained in:
mezz committed 2016-05-06 17:27:51 -07:00
1 parent 7403a6cdcd
commit 6d00d35ae5
3 files changed
+12 -15

No files matched your search

@@ -31,6 +31,8 @@ import net.minecraftforge.common.IShearable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.IFruitProvider;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.Tabs;
@@ -202,17 +204,20 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable,
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
if (leaves == null) {
TreeDefinition treeDefinition = state.getValue(getVariant());
if (treeDefinition == null) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
ITreeGenome genome = treeDefinition.getGenome();
if (tintIndex == 0) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
return leaves.getFoliageColour(thePlayer);
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
} else {
return leaves.getFruitColour();
IFruitProvider fruitProvider = genome.getFruitProvider();
return fruitProvider.getDecorativeColor();
}
}
}
@@ -43,12 +43,10 @@ public class ItemBlockDecorativeLeaves extends ItemBlockForestry<BlockDecorative
ITreeGenome genome = treeDefinition.getGenome();
if (renderPass == 0) {
int rgb = genome.getPrimary().getLeafSpriteProvider().getColor(false);
return ColourUtil.rgbToBgr(rgb);
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
} else {
IFruitProvider fruitProvider = genome.getFruitProvider();
int rgb = fruitProvider.getDecorativeColor();
return ColourUtil.rgbToBgr(rgb);
return fruitProvider.getDecorativeColor();
}
}
}
@@ -12,12 +12,6 @@ package forestry.core.utils;
public class ColourUtil {
public static int rgbToBgr(int rgb) {
int r = rgb >> 16 & 0xFF;
int b = rgb & 0xFF;
return rgb & 0xFF00FF00 | r | b << 16;
}
public static int addRGBComponents(int colour, int r, int g, int b) {
r = ((colour & 0xff0000) >> 16) + r;
g = ((colour & 0xff00) >> 8) + g;