use of hellfirepvp.astralsorcery.common.tile.base.TileFakedState in project AstralSorcery by HellFirePvP.
the class RenderTileFakedState method render.
@Override
public void render(TileFakedState tile, float pTicks, MatrixStack renderStack, IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) {
BlockState fakedState = tile.getFakedState();
if (fakedState.getBlock() instanceof AirBlock) {
return;
}
Color blendColor = tile.getOverlayColor();
int[] color = new int[] { blendColor.getRed(), blendColor.getGreen(), blendColor.getBlue(), 128 };
RenderType type = RenderTypeLookup.func_239221_b_(fakedState);
RenderTypeDecorator decorated = RenderTypeDecorator.wrapSetup(type, () -> {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(false);
}, () -> {
RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
});
BufferDecoratorBuilder decorator = BufferDecoratorBuilder.withColor(((r, g, b, a) -> color));
IVertexBuilder buf = renderTypeBuffer.getBuffer(decorated);
RenderingUtils.renderSimpleBlockModel(fakedState, renderStack, decorator.decorate(buf), tile.getPos(), tile, true);
}
use of hellfirepvp.astralsorcery.common.tile.base.TileFakedState in project AstralSorcery by HellFirePvP.
the class BlockFakedState method playParticles.
@OnlyIn(Dist.CLIENT)
protected void playParticles(World world, BlockPos pos, Random rand) {
if (rand.nextInt(8) == 0) {
VFXColorFunction<?> colorFn = VFXColorFunction.WHITE;
TileFakedState fakedState = MiscUtils.getTileAt(world, pos, TileFakedState.class, false);
if (fakedState != null) {
colorFn = VFXColorFunction.constant(fakedState.getOverlayColor());
}
EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(Vector3.random().abs().add(pos)).alpha(VFXAlphaFunction.FADE_OUT).color(colorFn).setScaleMultiplier(0.2F + rand.nextFloat() * 0.05F).setMaxAge(25 + rand.nextInt(5));
}
}
Aggregations