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

项目:rflux    文件:LightBlock.java   
@SideOnly(Side.CLIENT)
    public void initBlockColors() {
        Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
            @Override
            public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
                if (pos != null && worldIn != null) {
                    TileEntity te = worldIn.getTileEntity(pos);
                    if (te instanceof LightTE) {
                        LightTE tileEntity = (LightTE) te;
                        return 0xff0000;
//                        return tileEntity.getShieldColor();
                    }
                }
                return 0xffffff;
            }
        }, this);
    }
项目:NaturalTrees    文件:ClientProxy.java   
@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);
}
项目:EnderIO    文件:SmartModelAttacher.java   
@SideOnly(Side.CLIENT)
public static void registerColoredBlocksAndItems() {
  NNList<Block> blocklist = new NNList<Block>();
  NNList<Item> itemlist = new NNList<Item>();
  for (RegistrationHolder<?, ?> holder : blocks) {
    Block block = holder.block;
    Item item = Item.getItemFromBlock(block);
    if (block instanceof IPaintable || block instanceof ITintedBlock || block instanceof ITintedItem || item instanceof ITintedItem) {
      blocklist.add(block);
      if (item != Items.AIR) {
        itemlist.add(item);
      }
    } else {
      if (block instanceof IBlockColor) {
        Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor) block, block);
      }
      if (item instanceof IItemColor) {
        Minecraft.getMinecraft().getItemColors().registerItemColorHandler((IItemColor) item, item);
      }
    }
  }

  PaintTintHandler handler = new PaintTintHandler();
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(handler, blocklist.toArray(new Block[0]));
  Minecraft.getMinecraft().getItemColors().registerItemColorHandler(handler, itemlist.toArray(new Item[0]));
}
项目:SeasonsAPI    文件:LeavesGrassUtils.java   
private static IBlockColor getFoliageColor (final IBlockColor original) {
    return new IBlockColor() {

        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
            return Seasons.enabled ? LeavesGrassUtils.getLeavesColor(state, p_186720_2_, pos, original.colorMultiplier(state, p_186720_2_, pos, tintIndex)) : original.colorMultiplier(state, p_186720_2_, pos, tintIndex);
        }
    };
}
项目:SeasonsAPI    文件:LeavesGrassUtils.java   
private static IBlockColor getGrassColor (final IBlockColor original) {
    return new IBlockColor() {

        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
            return Seasons.enabled ? LeavesGrassUtils.getGrassColor(state, p_186720_2_, pos, original.colorMultiplier(state, p_186720_2_, pos, tintIndex)) : original.colorMultiplier(state, p_186720_2_, pos, tintIndex);
        }
    };
}
项目:Alchemy    文件:AlchemyBlockColor.java   
@Override
@SideOnly(Side.CLIENT)
public IBlockColor getBlockColor() {
    return new IBlockColor() {

        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess access, BlockPos pos, int index) {
            return index == 1 ? color : -1;
        }

    };
}
项目: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);
        }
    }
}
项目: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);
}
项目:NordMod    文件:RegisterColorHelper.java   
@Override
public void registerBlockColorHandler(Block block){
    if (block instanceof IBlockColor){
        IBlockColor iBlockColor = (IBlockColor) block;
        blockColor.registerBlockColorHandler(iBlockColor,block);
    }
}
项目:FloodLights    文件:ClientProxy.java   
@Override
public void initRenderers() {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPhantomLight.class, new TileEntityPhantomLightRenderer());
    RenderUtil.setupColors();
    minecraft.getBlockColors().registerBlockColorHandler(new IBlockColor() {
        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int renderPass) {
            return getColorAsInt(state.getValue(BlockFLColorableMachine.COLOR));
        }
    },ModBlocks.blockCarbonLight,ModBlocks.blockElectricLight,ModBlocks.blockSmallElectricLight);
}
项目:EnderIO    文件:PaintTintHandler.java   
@Override
public int colorMultiplier(@Nonnull IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
  if (world == null || pos == null) {
    return -1;
  }
  Block block = state.getBlock();

  IBlockState paintSource = null;
  if (block instanceof IPaintable) {
    paintSource = ((IPaintable) block).getPaintSource(state, world, pos);
    if (paintSource != null && paintSource.getBlock() != block) {
      block = paintSource.getBlock();
      state = paintSource;
    } else {
      paintSource = null;
    }
  }
  if (block instanceof ITintedBlock) {
    return ((ITintedBlock) block).getBlockTint(state, world, pos, tintIndex);
  }
  if (block instanceof IBlockColor) {
    return ((IBlockColor) block).colorMultiplier(state, world, pos, tintIndex);
  }
  if (paintSource != null) {
    return Minecraft.getMinecraft().getBlockColors().colorMultiplier(paintSource, world, pos, tintIndex);
  }
  return -1;
}
项目:BetterWithAddons    文件:ItemToolShard.java   
@Override
public IBlockColor getBlockColor() {
    return null;
}
项目:BetterWithAddons    文件:ItemSamuraiArmor.java   
@Override
public IBlockColor getBlockColor() {
    return null;
}
项目:BetterWithAddons    文件:BlockExtraGrass.java   
@Override
public IBlockColor getBlockColor() {
    return ColorHandlers.GRASS_COLORING;
}
项目:BetterWithAddons    文件:BlockEcksieSapling.java   
@Override
public IBlockColor getBlockColor() {
    return null;
}
项目:BetterWithAddons    文件:IColorable.java   
@SideOnly(Side.CLIENT)
IBlockColor getBlockColor();
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
public IBlockColor getBlockColor() {
    return ColorHandlers.REDSTONE_COLORING;
}
项目:CommonUtils    文件:ProxyModBase.java   
@SideOnly(Side.CLIENT)
public void addBlockColors(IBlockColor blockColor, Collection<Block> blocks) {
    addBlockColors(blockColor, blocks.toArray(new Block[0]));
}
项目:CommonUtils    文件:ProxyModBase.java   
@SideOnly(Side.CLIENT)
public void addBlockColors(IBlockColor blockColor, Block... blocks) {
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(blockColor, blocks);
}
项目:Alchemy    文件:IColorBlock.java   
@SideOnly(Side.CLIENT)
IBlockColor getBlockColor();
项目:ARKCraft    文件:ClientProxy.java   
private void registerRenderers()
{
    // TODO update this a bit + make client component to init manager
    registerBlockRenderer();
    InitializationManager.instance().getRegistry().forEachEntry((RegistryEntry<?> r) -> {
        if (r.standardRender) {
            r.forEachMeta((Integer meta) -> {
                Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(r.content, meta, new ModelResourceLocation(ARKCraft.MODID + ":" + r.modelLocationPrefix + r.name, "inventory"));
            });
        }
        Collection<String> v = new ArrayList<>(Arrays.asList(r.getVariants()));
        v.add(ARKCraft.MODID + ":" + r.modelLocationPrefix + r.name);
        ModelLoader.registerItemVariants(r.content, CollectionUtil.convert(v, (e) -> new ResourceLocation(e)).toArray(new ResourceLocation[0]));
    });

    // TODO this can also render other item's models for this one!
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ARKCraftItems.blueprint, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack)
        {
            return new ModelResourceLocation(ARKCraft.instance().modid() + ":blueprint/" + ItemBlueprint.getEngram(stack).getName(), "inventory");
        }
    });

    // Register models for entities
    registerEntityModels();

    registerBlockTexture(ARKCraftBlocks.cropPlot, 1, "crop_plot");
    registerBlockTexture(ARKCraftBlocks.cropPlot, 2, "crop_plot");
    registerBlockTexture(ARKCraftBlocks.cable, 1, "cable_vert");

    meshedItems.forEach(i -> Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register((Item) i, i::getModel));

    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor()
    {
        @Override
        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));
        }
    }, new Block[] {ARKCraftBlocks.berryBush});
    ARKCustomModelLoader.init();
    ARKCustomModelLoader.instance.modelMap.put(new ResourceLocation("arkcraft:cable"), new ModelCable());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElectricOutlet.class, new TileEntityElectricOutletSpecialRenderer());
}
项目:MMDLib-old    文件:MMDLibRegistry.java   
@SideOnly(Side.CLIENT)
public static void registerBlockColour(Block block) {
    if (!(block instanceof IBlockColor)) return;
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor) block, block);
}
项目:Bookshelf    文件:IColorfulBlock.java   
@SideOnly(Side.CLIENT)
public IBlockColor getColorHandler ();
项目:Bookshelf    文件:RegistryHelper.java   
/**
 * Registers a color handler for a block. This method is client side only, and should be
 * called during the init stage.
 *
 * @param block The block to register the handler for.
 * @param color The color handler to register.
 */
@SideOnly(Side.CLIENT)
public void registerColorHandler (@Nonnull Block block, @Nonnull IBlockColor color) {

    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(color, block);
}