Search in sources :

Example 1 with BlockColor

use of net.minecraft.client.color.block.BlockColor in project OreStoneVariants by PersonTheCat.

the class VariantColorizer method colorizeBlock.

private static void colorizeBlock(final BlockColors registry, final OreVariant variant) {
    Block source = variant.getBg();
    BlockColor color = getColor(registry, source);
    if (color == null) {
        source = variant.getFg();
        color = getColor(registry, source);
    }
    if (color != null) {
        log.info("Copying block colors from {} to {}", source, variant);
        registry.register(color, variant);
    }
}
Also used : BlockColor(net.minecraft.client.color.block.BlockColor) Block(net.minecraft.world.level.block.Block)

Example 2 with BlockColor

use of net.minecraft.client.color.block.BlockColor in project pollen by MoonflowerTeam.

the class FluidRendererMixin method modifyColor.

@Inject(method = "calculateQuadColors", at = @At("TAIL"))
public void modifyColor(ModelQuadView quad, BlockAndTintGetter world, BlockPos pos, LightPipeline lighter, Direction dir, float brightness, boolean colorized, CallbackInfo ci) {
    // Fix custom fluids not respecting normal block colors
    if (this.customFluidSprites.containsKey(this.captureFluid.getType())) {
        BlockState state = this.fluidStateCache.computeIfAbsent(this.captureFluid, FluidState::createLegacyBlock);
        BlockColor color = ((BlockColorsAccessor) Minecraft.getInstance().getBlockColors()).getBlockColors().byId(Registry.BLOCK.getId(state.getBlock()));
        if (color != null) {
            int[] biomeColors = this.biomeColorBlender.getColors(color, world, state, pos, quad);
            for (int i = 0; i < 4; ++i) this.quadColors[i] = ColorABGR.mul(biomeColors != null ? biomeColors[i] : -1, this.quadLightData.br[i] * brightness);
        }
    }
}
Also used : BlockColor(net.minecraft.client.color.block.BlockColor) BlockState(net.minecraft.world.level.block.state.BlockState) FluidState(net.minecraft.world.level.material.FluidState) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with BlockColor

use of net.minecraft.client.color.block.BlockColor in project InfinityLib by InfinityRaider.

the class ClientProxy method registerBlockRenderers.

private void registerBlockRenderers(Object blockRegistry) {
    if (blockRegistry == null) {
        return;
    }
    ReflectionHelper.forEachValueIn(blockRegistry, IInfinityBlock.class, object -> {
        // Set render type
        ItemBlockRenderTypes.setRenderLayer(object.cast(), object.getRenderType());
        // Register block color
        BlockColor color = object.getColor();
        if (color != null) {
            Minecraft.getInstance().getBlockColors().register(color, object.cast());
        }
    });
}
Also used : BlockColor(net.minecraft.client.color.block.BlockColor)

Aggregations

BlockColor (net.minecraft.client.color.block.BlockColor)3 Block (net.minecraft.world.level.block.Block)1 BlockState (net.minecraft.world.level.block.state.BlockState)1 FluidState (net.minecraft.world.level.material.FluidState)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1