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);
}
}
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);
}
}
}
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());
}
});
}
Aggregations