@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); }
@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(); }
public BlockModelRenderer(BlockColors blockColorsIn) { this.blockColors = blockColorsIn; if (Reflector.ForgeModContainer_forgeLightPipelineEnabled.exists()) { Reflector.setFieldValue(Reflector.ForgeModContainer_forgeLightPipelineEnabled, Boolean.valueOf(false)); } }
/** * 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); }
/** * 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); }
@Override public void registerBlocks() { super.registerBlocks(); ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new AltarRenderer()); BlockColors bc = Minecraft.getMinecraft().getBlockColors(); bc.registerBlockColorHandler(ExoContent.CHALK, ExoContent.CHALK); }
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); } } }
@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); } }
@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); }
@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); }
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())); } } }
@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); } }
public BlockColors getBlockColors() { return this.blockColors; }
public BlockFluidRenderer(BlockColors blockColorsIn) { this.blockColors = blockColorsIn; this.initAtlasSprites(); }
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_); }
public static BlockColors getBlockColors() { return Minecraft.getMinecraft().getBlockColors(); }
public ForgeBlockModelRenderer(BlockColors colors) { // TODO Auto-generated constructor stub super(colors); this.colors = colors; }
public BlockInfo(BlockColors colors) { this.colors = colors; }
public VertexLighterFlat(BlockColors colors) { this.blockInfo = new BlockInfo(colors); }
public VertexLighterSmoothAo(BlockColors colors) { super(colors); }
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_); }
public BlockModelRenderer(BlockColors blockColorsIn) { this.blockColors = blockColorsIn; }
private void registerPendingIBlockColorBlocks() { BlockColors colors = Minecraft.getMinecraft().getBlockColors(); for (BlockDynamicColor b : RegistryBlocks.pendingIBlockColorBlocks) { colors.registerBlockColorHandler(b::getColorMultiplier, (Block) b); } }
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()); }
public CCBlockRendererDispatcher(BlockRendererDispatcher dispatcher, BlockColors blockColours) { super(dispatcher.getBlockModelShapes(), blockColours); parentDispatcher = dispatcher; }
public BlockFluidRender(BlockColors blockColorsIn) { blockColors = blockColorsIn; }
public PerQuadModelRenderer(BlockColors colors) { super(colors); this.colors = colors; }
@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); } }
public InnerBlockColorHandler(BlockColors blockColors) { this.blockColors = blockColors; }