@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(); } }
@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; }; } }
@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])); }
return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic();
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);
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()); }