@Nullable @Override public Function4<IBlockState, IBlockAccess, BlockPos, Integer, Integer> getBlockColorFunction() { return (iBlockState, iBlockAccess, blockPos, integer) -> iBlockAccess != null && blockPos != null ? BiomeColorHelper.getFoliageColorAtPos(iBlockAccess, blockPos) : ColorizerFoliage.getFoliageColorBasic(); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public static void registerColorHandlerBlocks(ColorHandlerEvent.Block event) { BlockColors blockcolors = event.getBlockColors(); blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D), BlocksTFC.getAllBlockRockVariants().stream().filter(x -> x.type.isGrass).toArray(BlockRockVariant[]::new)); blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> BlockFarmlandTFC.TINT[state.getValue(BlockFarmlandTFC.MOISTURE)], BlocksTFC.getAllBlockRockVariants().stream().filter(x -> x.type == Rock.Type.FARMLAND).toArray(BlockRockVariant[]::new)); blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D), BlocksTFC.PEAT_GRASS); blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> worldIn != null && pos != null ? BiomeColorHelper.getWaterColorAtPos(worldIn, pos) : 0, BlocksTFC.getAllFluidBlocks().stream().filter(x -> x.getDefaultState().getMaterial() == Material.WATER).toArray(BlockFluidBase[]::new)); blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(), BlocksTFC.getAllLeafBlocks().toArray(new Block[0])); }
public void init() { BlockColors blockColors = mc.getBlockColors(); blockColors.registerBlockColorHandler((state, access, pos, tintIndex) -> pos != null ? BiomeColorHelper.getGrassColorAtPos(access, pos) : 0xFFFFFF, MOSS); blockColors.registerBlockColorHandler((state, access, pos, tintIndex) -> pos == null ? ColorizerFoliage.getFoliageColorBasic() : BiomeColorHelper.getFoliageColorAtPos(access, pos), block); blockColors.registerBlockColorHandler((state, access, pos, tintIndex) -> pos == null ? ColorizerFoliage.getFoliageColorBasic() : BiomeColorHelper.getFoliageColorAtPos(access, pos), MOSS); if(JurassiCraftConfig.VEHICLES.tourRailBlockEnabled) blockColors.registerBlockColorHandler((state, access, pos, tintIndex) -> tintIndex == 1 ? ((TourRailBlock)state.getBlock()).getSpeedType().getColor() : -1, BlockHandler.TOUR_RAIL_SLOW, BlockHandler.TOUR_RAIL_MEDIUM, BlockHandler.TOUR_RAIL_FAST);
@SideOnly(Side.CLIENT) @Override public int colorMultiplier(@Nonnull IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) { if (world == null || pos == null) return ColorizerGrass.getGrassColor(0.5D, 1.0D); return BiomeColorHelper.getGrassColorAtPos(world, pos); }
/** * Register the {@link IBlockColor} handlers. * * @param blockColors The BlockColors instance */ private static void registerBlockColourHandlers(final BlockColors blockColors) { // Use the grass colour of the biome or the default grass colour final IBlockColor grassColourHandler = (state, blockAccess, pos, tintIndex) -> { if (blockAccess != null && pos != null) { return BiomeColorHelper.getGrassColorAtPos(blockAccess, pos); } return ColorizerGrass.getGrassColor(0.5D, 1.0D); }; final IBlockColor witheWebColourHandler = (state, blockAccess, pos, tintIndex) -> { if (blockAccess != null && pos != null) { return new Color(0, 0, 0).getRGB() & 0x00ffffff; } return new Color(0, 0, 0).getRGB() & 0x00ffffff; }; blockColors.registerBlockColorHandler(grassColourHandler, ModBlocks.SMALL_PLANT); //blockColors.registerBlockColorHandler(grassColourHandler, ModBlocks.ALGAE); blockColors.registerBlockColorHandler(grassColourHandler, ModBlocks.SWAMP_VENT); blockColors.registerBlockColorHandler(witheWebColourHandler, ModBlocks.WITHER_WEB); }
@Nullable @Override public IBlockColor getBlockColorMultiplier() { return (IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) -> { if (tintIndex == 0) return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(); else if (tintIndex == 1) return fruitType.getColor().getRGB(); else return -1; }; } }
return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic();
return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(); worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(); registerColorHandlerForBlock(FurnitureBlocks.HEDGE_OAK, hedgeBlockColorOld, hedgeItemColor); registerColorHandlerForBlock(FurnitureBlocks.HEDGE_SPRUCE, hedgeBlockColorOld, hedgeItemColor);
@SideOnly(Side.CLIENT) public static void initClient() { Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { Crop crop = HFCrops.SEEDS.getCropFromStack(stack); return crop != null ? crop.getColor() : -1; }, SEEDS); IBlockColor block = (state, worldIn, pos, tintIndex) -> tintIndex == 0 ? (worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic()) : -1; IItemColor item = (stack, index) -> ColorizerFoliage.getFoliageColorBasic(); Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(block, LEAVES_FRUIT); Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(block, LEAVES_TROPICAL); Minecraft.getMinecraft().getItemColors().registerItemColorHandler(item, Item.getItemFromBlock(LEAVES_FRUIT)); Minecraft.getMinecraft().getItemColors().registerItemColorHandler(item, Item.getItemFromBlock(LEAVES_TROPICAL)); }
@SideOnly(Side.CLIENT) public static void initClient() { ClientRegistry.bindTileEntitySpecialRenderer(TileBasket.class, new SpecialRendererBasket()); ClientRegistry.bindTileEntitySpecialRenderer(TilePlate.class, new SpecialRendererPlate()); ClientRegistry.bindTileEntitySpecialRenderer(TileFestivalPot.class, new SpecialRendererFestivalPot()); Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) -> { FlowerType type = HFCore.FLOWERS.getEnumFromState(state); if (!type.isColored()) return -1; return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(); }, HFCore.FLOWERS); Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> HFCore.FLOWERS.getEnumFromMeta(stack.getItemDamage()).isColored() ? ColorizerFoliage.getFoliageColorBasic() : -1 , HFCore.FLOWERS); ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new SpecialRendererMailbox()); }