Java 类net.minecraft.client.renderer.color.BlockColors 实例源码

项目:customstuff4    文件:ClientProxy.java   
@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);
}
项目:Soot    文件:ClientProxy.java   
@Override
public void init() {
    BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
    ItemColors itemColors = Minecraft.getMinecraft().getItemColors();

    for (IBlockColored block : COLOR_BLOCKS) {
        blockColors.registerBlockColorHandler(block::getColorMultiplier,(Block)block);
    }

    for (IItemColored item : COLOR_ITEMS) {
        itemColors.registerItemColorHandler(item::getColorFromItemstack,(Item)item);
    }

    registerTESRs();
}
项目:Backmemed    文件:BlockModelRenderer.java   
public BlockModelRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;

    if (Reflector.ForgeModContainer_forgeLightPipelineEnabled.exists())
    {
        Reflector.setFieldValue(Reflector.ForgeModContainer_forgeLightPipelineEnabled, Boolean.valueOf(false));
    }
}
项目:AquaRegia    文件:ModColourManager.java   
/**
     * 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);
//      };
//
//      blockColors.registerBlockColorHandler(grassColourHandler, ModBlocks.WATER_GRASS);
    }
项目:AquaRegia    文件:ModColourManager.java   
/**
     * Register the {@link IItemColor} handlers
     *
     * @param blockColors The BlockColors instance
     * @param itemColors  The ItemColors instance
     */
    private static void registerItemColourHandlers(final BlockColors blockColors, final ItemColors itemColors) {
        // Use the Block's colour handler for an ItemBlock
//      final IItemColor itemBlockColourHandler = (stack, tintIndex) -> {
//          @SuppressWarnings("deprecation")
//          final IBlockState state = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
//          return blockColors.colorMultiplier(state, null, null, tintIndex);
//      };
//
//      itemColors.registerItemColorHandler(itemBlockColourHandler, ModBlocks.WATER_GRASS);
    }
项目:ExoMagica    文件:ClientProxy.java   
@Override
public void registerBlocks() {
    super.registerBlocks();

    ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new AltarRenderer());

    BlockColors bc = Minecraft.getMinecraft().getBlockColors();
    bc.registerBlockColorHandler(ExoContent.CHALK, ExoContent.CHALK);
}
项目:Alchemy    文件:AlchemyColorLoader.java   
private static <T extends Block & IColorBlock> void registerBlockColor() {
    BlockColors colors = Minecraft.getMinecraft().getBlockColors();
    for (T t : (List<T>) block_color) {
        IBlockColor color = t.getBlockColor();
        if (color != null) {
            colors.registerBlockColorHandler(color, t);
            AlchemyInitHook.push_event(t);
        }
    }
}
项目:EverythingBlocks    文件:EBBlocks.java   
@SideOnly(Side.CLIENT)
public static void registerRendering() {
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    BlockColors colors = Minecraft.getMinecraft().getBlockColors();
    ItemColors icolors = Minecraft.getMinecraft().getItemColors();
    for(Block block : blocks) {
        renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, 
                new ModelResourceLocation(RefStrings.MODID + ":" + block.getUnlocalizedName().substring(5), "inventory"));
        colors.registerBlockColorHandler(new EverythingBlockColor(), block);
        icolors.registerItemColorHandler(new EverythingItemColor(), block);
    }
}
项目:TechStack-s-HeavyMachineryMod    文件:ClientProxy.java   
@Override
public void Init() {
    final BlockColors blockcolors = Minecraft.getMinecraft().getBlockColors();
    blockcolors.registerBlockColorHandler(new IBlockColor() {
        public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
            return worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D);
        }
    }, ModBlocks.machinemowedgrass);
}
项目:Runes-of-Wizardry    文件:ClientProxy.java   
@Override
public void registerColors(){
    ItemColors items = Minecraft.getMinecraft().getItemColors();
    BlockColors blocks = Minecraft.getMinecraft().getBlockColors();
    items.registerItemColorHandler(new DustPouchItemColor(), WizardryRegistry.dust_pouch);
    registerDustColors(items);
    registerDustBlockColors(blocks,items);
}
项目:Runes-of-Wizardry    文件:ClientProxy.java   
private static void registerDustBlockColors(BlockColors bcols, ItemColors icols){
    for(IDustStorageBlock block: DustRegistry.getAllBlocks()){
        if(block.getInstance() instanceof ADustStorageBlock){
            bcols.registerBlockColorHandler(DustStorageBlockColor.instance(), block.getInstance());
            icols.registerItemColorHandler(DustStorageItemBlockColor.instance(),Item.getItemFromBlock(block.getInstance()));
        }
    }
}
项目:OpenBlocks    文件:BlockColorHandlerRegistration.java   
@SubscribeEvent
public static void registerBlockHandler(ColorHandlerEvent.Block evt) {
    final BlockColors blockColors = evt.getBlockColors();

    if (OpenBlocks.Blocks.canvas != null) {
        blockColors.registerBlockColorHandler(new BlockCanvas.InnerBlockColorHandler(blockColors), OpenBlocks.Blocks.canvas);
    }

    if (OpenBlocks.Blocks.paintMixer != null) {
        blockColors.registerBlockColorHandler(new BlockPaintMixer.BlockColorHandler(), OpenBlocks.Blocks.paintMixer);
    }
}
项目:Zombe-Modpack    文件:Minecraft.java   
public BlockColors getBlockColors()
{
    return this.blockColors;
}
项目:Backmemed    文件:BlockFluidRenderer.java   
public BlockFluidRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;
    this.initAtlasSprites();
}
项目:Backmemed    文件:BlockRendererDispatcher.java   
public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_)
{
    this.blockModelShapes = p_i46577_1_;
    this.blockModelRenderer = new BlockModelRenderer(p_i46577_2_);
    this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_);
}
项目:Backmemed    文件:Minecraft.java   
public BlockColors getBlockColors()
{
    return this.blockColors;
}
项目:Backmemed    文件:CustomColors.java   
public static BlockColors getBlockColors()
{
    return Minecraft.getMinecraft().getBlockColors();
}
项目:CustomWorldGen    文件:ForgeBlockModelRenderer.java   
public ForgeBlockModelRenderer(BlockColors colors)
{
    // TODO Auto-generated constructor stub
    super(colors);
    this.colors = colors;
}
项目:CustomWorldGen    文件:BlockInfo.java   
public BlockInfo(BlockColors colors)
{
    this.colors = colors;
}
项目:CustomWorldGen    文件:VertexLighterFlat.java   
public VertexLighterFlat(BlockColors colors)
{
    this.blockInfo = new BlockInfo(colors);
}
项目:CustomWorldGen    文件:VertexLighterSmoothAo.java   
public VertexLighterSmoothAo(BlockColors colors)
{
    super(colors);
}
项目:CustomWorldGen    文件:BlockFluidRenderer.java   
public BlockFluidRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;
    this.initAtlasSprites();
}
项目:CustomWorldGen    文件:BlockRendererDispatcher.java   
public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_)
{
    this.blockModelShapes = p_i46577_1_;
    this.blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_);
    this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_);
}
项目:CustomWorldGen    文件:BlockModelRenderer.java   
public BlockModelRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;
}
项目:CustomWorldGen    文件:Minecraft.java   
public BlockColors getBlockColors()
{
    return this.blockColors;
}
项目:ModularMachinery    文件:ClientProxy.java   
private void registerPendingIBlockColorBlocks() {
    BlockColors colors = Minecraft.getMinecraft().getBlockColors();
    for (BlockDynamicColor b : RegistryBlocks.pendingIBlockColorBlocks) {
        colors.registerBlockColorHandler(b::getColorMultiplier, (Block) b);
    }
}
项目:CCTweaks    文件:RenderHooks.java   
private static void renderQuad(BakedQuad quad, IBlockAccess world, IBlockState state, BlockPos pos, VertexBuffer buffer, long rand, boolean useAO) {
    AOLightMatrix matrix = new AOLightMatrix();
    matrix.locate(world, pos, useAO);
    CCQuad ccQuad = new CCQuad(quad);
    ccQuad.quadulate();
    ccQuad.computeNormals();
    VertexFormat format = buffer.getVertexFormat();
    BlockColors colours = Minecraft.getMinecraft().getBlockColors();
    LightModel lightModel = quad.shouldApplyDiffuseLighting() ? standardLightModel : noDifuseLightModel;
    int quadTintRenderPass = quad.getTintIndex();
    int tintMultiplier = -1;
    if (quadTintRenderPass != -1) {
        tintMultiplier = colours.colorMultiplier(state, world, pos, quadTintRenderPass);
    }
    for (int v = 0; v < 4; v++) {
        Vertex5 vert = ccQuad.vertices[v].copy();
        Vector3 normal = ccQuad.normals[v].copy();
        Colour colour = ccQuad.colours[v].copy().multiply(new ColourRGBA(lightModel.apply(tintMultiplier, normal)));
        LC lc = new LC();
        lc.compute(vert.vec, normal);
        TripleABC<Integer, Integer, ?> lm = matrix.apply(lc, colour);
        int finalColour = lm.getA();
        int brightness = lm.getB();
        for (int e = 0; e < format.getElementCount(); e++) {
            VertexFormatElement element = format.getElement(e);
            switch (element.getUsage()){
                case POSITION:
                    buffer.pos(vert.vec.x, vert.vec.y, vert.vec.z);
                    break;
                case UV:
                    if (element.getIndex() == 0) {
                        buffer.tex(vert.uv.u, vert.uv.v);
                    } else {
                        buffer.lightmap(brightness >> 16 & 65535, brightness & 65535);
                    }
                    break;
                case COLOR:
                    buffer.color(finalColour >>> 24, finalColour >> 16 & 0xFF, finalColour >> 8 & 0xFF, finalColour & 0xFF);
                    break;
                case NORMAL:
                    buffer.normal((float) normal.x, (float) normal.y, (float) normal.z);
                    break;
                case PADDING:
                    break;
                default:
                    throw new UnsupportedOperationException("Generic vertex format element");
            }
        }
        buffer.endVertex();
    }
    buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
}
项目:CodeChickenLib    文件:CCBlockRendererDispatcher.java   
public CCBlockRendererDispatcher(BlockRendererDispatcher dispatcher, BlockColors blockColours) {
    super(dispatcher.getBlockModelShapes(), blockColours);
    parentDispatcher = dispatcher;
}
项目:Alchemy    文件:BlockFluidRender.java   
public BlockFluidRender(BlockColors blockColorsIn) {
    blockColors = blockColorsIn;
}
项目:Hard-Science    文件:PerQuadModelRenderer.java   
public PerQuadModelRenderer(BlockColors colors)
{
    super(colors);
    this.colors = colors;
}
项目:ExpandedRailsMod    文件:BlockFluidRenderer.java   
public BlockFluidRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;
    this.initAtlasSprites();
}
项目:ExpandedRailsMod    文件:BlockRendererDispatcher.java   
public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_)
{
    this.blockModelShapes = p_i46577_1_;
    this.blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_);
    this.fluidRenderer = new BlockFluidRenderer(p_i46577_2_);
}
项目:ExpandedRailsMod    文件:BlockModelRenderer.java   
public BlockModelRenderer(BlockColors blockColorsIn)
{
    this.blockColors = blockColorsIn;
}
项目:ExpandedRailsMod    文件:Minecraft.java   
public BlockColors getBlockColors()
{
    return this.blockColors;
}
项目:OpenBlocks    文件:BlockColorHandlerRegistration.java   
@SubscribeEvent
public static void registerItemColormHandlers(ColorHandlerEvent.Item evt) {
    final ItemColors itemColors = evt.getItemColors();
    final BlockColors blockColors = evt.getBlockColors();

    if (OpenBlocks.Items.paintBrush != null) {
        itemColors.registerItemColorHandler(new ItemPaintBrush.ColorHandler(), OpenBlocks.Items.paintBrush);
    }

    if (OpenBlocks.Items.crayonGlasses != null) {
        itemColors.registerItemColorHandler(new ItemImaginationGlasses.CrayonColorHandler(), OpenBlocks.Items.crayonGlasses);
    }

    if (OpenBlocks.Blocks.paintCan != null) {
        itemColors.registerItemColorHandler(new ItemPaintCan.ItemColorHandler(), OpenBlocks.Blocks.paintCan);
        blockColors.registerBlockColorHandler(new BlockPaintCan.BlockColorHandler(), OpenBlocks.Blocks.paintCan);
    }

    if (OpenBlocks.Blocks.imaginary != null) {
        itemColors.registerItemColorHandler(new ItemImaginary.CrayonColorHandler(), OpenBlocks.Blocks.imaginary);
    }

    if (OpenBlocks.Items.devNull != null) {
        itemColors.registerItemColorHandler(new ItemDevNull.NestedItemColorHandler(itemColors), OpenBlocks.Items.devNull);
    }

    if (OpenBlocks.Blocks.elevator != null) {
        blockColors.registerBlockColorHandler(new BlockElevator.BlockColorHandler(), OpenBlocks.Blocks.elevator);
        itemColors.registerItemColorHandler(new ItemElevator.ItemColorHandler(), OpenBlocks.Blocks.elevator);
    }

    if (OpenBlocks.Blocks.elevatorRotating != null) {
        blockColors.registerBlockColorHandler(new BlockElevator.BlockColorHandler(), OpenBlocks.Blocks.elevatorRotating);
        itemColors.registerItemColorHandler(new ItemElevator.ItemColorHandler(), OpenBlocks.Blocks.elevatorRotating);
    }

    if (OpenBlocks.Blocks.flag != null) {
        itemColors.registerItemColorHandler(new ItemFlagBlock.ItemColorHandler(), OpenBlocks.Blocks.flag);
        blockColors.registerBlockColorHandler(new BlockFlag.BlockColorHandler(), OpenBlocks.Blocks.flag);
    }
}
项目:OpenBlocks    文件:BlockCanvas.java   
public InnerBlockColorHandler(BlockColors blockColors) {
    this.blockColors = blockColors;
}