public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this) { BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)iblockstate.getValue(VARIANT); if (blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE) { return ColorizerFoliage.getFoliageColorPine(); } if (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH) { return ColorizerFoliage.getFoliageColorBirch(); } } return super.colorMultiplier(worldIn, pos, renderPass); }
@Override public void setBlockBiomeTint(Block block, IntFunction<BlockTint> tintTypeForSubtype) { if (!(block instanceof CSBlock)) return; BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); CSBlock csBlock = (CSBlock) block; blockColors.registerBlockColorHandler( (state, worldIn, pos, tintIndex) -> { if (worldIn == null || pos == null) return ColorizerFoliage.getFoliageColorBasic(); return tintTypeForSubtype.apply(csBlock.getSubtype(state)).getMultiplier(worldIn, pos); /*if (tintType == BiomeTintType.FOLIAGE) return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); if (tintType == BiomeTintType.GRASS) return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); if (tintType == BiomeTintType.WATER) return BiomeColorHelper.getWaterColorAtPos(worldIn, pos); return -1;*/ }, block); }
private static void genBiomeColours(BlockColours bc) { // generate array of foliage, grass, and water colour multipliers // for each biome. for (Object oBiome : Biome.REGISTRY) { Biome biome = (Biome) oBiome; if (biome != null) { double temp = MathHelper.clamp(biome.getTemperature(), 0.0F, 1.0F); double rain = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); int grasscolor = ColorizerGrass.getGrassColor(temp, rain); int foliagecolor = ColorizerFoliage.getFoliageColor(temp, rain); int watercolor = biome.getWaterColorMultiplier(); bc.setBiomeData(biome.getBiomeName(), watercolor & 0xffffff, grasscolor & 0xffffff, foliagecolor & 0xffffff); } } }
@Override public void init() { Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new IBlockColor() { public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) { if (world != null && pos != null) return BiomeColorHelper.getFoliageColorAtPos(world, pos); else return ColorizerFoliage.getFoliageColorBasic(); } }, NaturalTrees.branchOak, NaturalTrees.branchBirch, NaturalTrees.branchSpruce, NaturalTrees.branchJungle, NaturalTrees.branchDarkOak, NaturalTrees.branchAcacia); }
@SideOnly(Side.CLIENT) public int func_71920_b(IBlockAccess p_71920_1_, int p_71920_2_, int p_71920_3_, int p_71920_4_) { int var5 = p_71920_1_.func_72805_g(p_71920_2_, p_71920_3_, p_71920_4_); if((var5 & 3) == 1) { return ColorizerFoliage.func_77466_a(); } else if((var5 & 3) == 2) { return ColorizerFoliage.func_77469_b(); } else { int var6 = 0; int var7 = 0; int var8 = 0; for(int var9 = -1; var9 <= 1; ++var9) { for(int var10 = -1; var10 <= 1; ++var10) { int var11 = p_71920_1_.func_72807_a(p_71920_2_ + var10, p_71920_4_ + var9).func_76726_l(); var6 += (var11 & 16711680) >> 16; var7 += (var11 & '\uff00') >> 8; var8 += var11 & 255; } } return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255; } }
public int getRenderColor(IBlockState state) { if (state.getBlock() != this) { return super.getRenderColor(state); } else { BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT); return blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE ? ColorizerFoliage.getFoliageColorPine() : (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(state)); } }
public void onResourceManagerReload(IResourceManager resourceManager) { try { ColorizerFoliage.setFoliageBiomeColorizer(TextureUtil.readImageData(resourceManager, LOC_FOLIAGE_PNG)); } catch (IOException var3) { ; } }
@SideOnly(Side.CLIENT) public int getFoliageColorAtPos(BlockPos pos) { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getRainfall(), 0.0F, 1.0F); return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); }
@SideOnly(Side.CLIENT) public int getRenderColor(IBlockState state) { switch (variant) { case BIRCH: return ColorizerFoliage.getFoliageColorBirch(); case SPRUCE: return ColorizerFoliage.getFoliageColorPine(); } return ColorizerFoliage.getFoliageColorBasic(); }
/** * Provides the basic foliage color based on the biome temperature and rainfall */ public int getBiomeFoliageColor(int p_150571_1_, int p_150571_2_, int p_150571_3_) { double var4 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_150571_1_, p_150571_2_, p_150571_3_), 0.0F, 1.0F); double var6 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); return ColorizerFoliage.getFoliageColor(var4, var6); }
public void onResourceManagerReload(IResourceManager par1ResourceManager) { try { ColorizerFoliage.setFoliageBiomeColorizer(TextureUtil.readImageData(par1ResourceManager, field_130079_a)); } catch (IOException var3) { ; } }
@SideOnly(Side.CLIENT) public int getBlockColor() { double d0 = 0.5D; double d1 = 1.0D; return ColorizerFoliage.getFoliageColor(d0, d1); }
@SideOnly(Side.CLIENT) /** * Returns the color this block should be rendered. Used by leaves. */ public int getRenderColor(int meta) { return (meta & 3) == 1 ? ColorizerFoliage.getFoliageColorBasic() : ((meta & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); }
@SideOnly(Side.CLIENT) /** * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ public int colorMultiplier(IBlockAccess world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z); if ((l & 3) == 1) { return ColorizerFoliage.getFoliageColorPine(); } else if ((l & 3) == 2) { return ColorizerFoliage.getFoliageColorBirch(); } else { int i1 = 0; int j1 = 0; int k1 = 0; for (int l1 = -1; l1 <= 1; ++l1) { for (int i2 = -1; i2 <= 1; ++i2) { int j2 = world.getBiomeGenForCoords(x + i2, z + l1).getBiomeFoliageColor(); i1 += (j2 & 16711680) >> 16; j1 += (j2 & 65280) >> 8; k1 += j2 & 255; } } return (i1 / 9 & 255) << 16 | (j1 / 9 & 255) << 8 | k1 / 9 & 255; } }
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4); if ((l & 3) == 1) { return ColorizerFoliage.getFoliageColorPine(); } else if ((l & 3) == 2) { return ColorizerFoliage.getFoliageColorBirch(); } else { int i1 = 0; int j1 = 0; int k1 = 0; for (int l1 = -1; l1 <= 1; ++l1) { for (int i2 = -1; i2 <= 1; ++i2) { int j2 = par1IBlockAccess.getBiomeGenForCoords(par2 + i2, par4 + l1).getBiomeFoliageColor(); i1 += (j2 & 16711680) >> 16; j1 += (j2 & 65280) >> 8; k1 += j2 & 255; } } return (i1 / 9 & 255) << 16 | (j1 / 9 & 255) << 8 | k1 / 9 & 255; } }
@SideOnly(Side.CLIENT) public int getBiomeFoliageColor(int p_150571_1_, int p_150571_2_, int p_150571_3_) { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_150571_1_, p_150571_2_, p_150571_3_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); }
public void onResourceManagerReload(IResourceManager p_110549_1_) { try { ColorizerFoliage.setFoliageBiomeColorizer(TextureUtil.readImageData(p_110549_1_, field_130079_a)); } catch (IOException ioexception) { ; } }
@Override @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; double var3 = 1.0D; return ColorizerFoliage.getFoliageColor(var1, var3); }
@Override @SideOnly(Side.CLIENT) public int getBlockColor() { double d0 = 0.5D; double d1 = 1.0D; return ColorizerFoliage.getFoliageColor(d0, d1); }
@Override @SideOnly(Side.CLIENT) /** * Returns the color this block should be rendered. Used by leaves. */ public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); }
@Override @SideOnly(Side.CLIENT) /** * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4); if ((l & 3) == 1) { return ColorizerFoliage.getFoliageColorPine(); } else if ((l & 3) == 2) { return ColorizerFoliage.getFoliageColorBirch(); } else { int i1 = 0; int j1 = 0; int k1 = 0; for (int l1 = -1; l1 <= 1; ++l1) { for (int i2 = -1; i2 <= 1; ++i2) { int j2 = par1IBlockAccess.getBiomeGenForCoords(par2 + i2, par4 + l1).getBiomeFoliageColor(j1, l1, i1); i1 += (j2 & 16711680) >> 16; j1 += (j2 & 65280) >> 8; k1 += j2 & 255; } } return (i1 / 9 & 255) << 16 | (j1 / 9 & 255) << 8 | k1 / 9 & 255; } }
public void func_110549_a(ResourceManager p_110549_1_) { try { ColorizerFoliage.func_77467_a(TextureUtil.func_110986_a(p_110549_1_, field_130079_a)); } catch (IOException var3) { ; } }
@SideOnly(Side.CLIENT) /** * Provides the basic foliage color based on the biome temperature and rainfall */ public int getBiomeFoliageColor() { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); }
@SideOnly(Side.CLIENT) /** * Provides the basic foliage color based on the biome temperature and rainfall */ public int getBiomeFoliageColor() { double d0 = (double)this.getFloatTemperature(); double d1 = (double)this.getFloatRainfall(); return ((ColorizerFoliage.getFoliageColor(d0, d1) & 16711422) + 5115470) / 2; }
@SideOnly(Side.CLIENT) /** * Returns the color this block should be rendered. Used by leaves. */ public int getRenderColor(int par1) { return ColorizerFoliage.getFoliageColorBasic(); }