use of net.minecraft.client.render.RenderLayer in project BleachHack by BleachDrinker420.
the class MixinChunkRebuildTask method newRender.
private Set<BlockEntity> newRender(float cameraX, float cameraY, float cameraZ, ChunkData data, BlockBufferBuilderStorage buffers) {
BlockPos blockPos = field_20839.getOrigin().toImmutable();
BlockPos blockPos2 = blockPos.add(15, 15, 15);
ChunkOcclusionDataBuilder chunkOcclusionDataBuilder = new ChunkOcclusionDataBuilder();
Set<BlockEntity> set = new HashSet<>();
ChunkRendererRegion chunkRendererRegion = this.region;
this.region = null;
MatrixStack matrixStack = new MatrixStack();
if (chunkRendererRegion != null) {
BlockModelRenderer.enableBrightnessCache();
Random random = new Random();
BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();
for (BlockPos blockPos3 : BlockPos.iterate(blockPos, blockPos2)) {
BlockState blockState = chunkRendererRegion.getBlockState(blockPos3);
if (blockState.isOpaqueFullCube(chunkRendererRegion, blockPos3)) {
chunkOcclusionDataBuilder.markClosed(blockPos3);
}
if (blockState.hasBlockEntity()) {
BlockEntity blockEntityx = chunkRendererRegion.getBlockEntity(blockPos3, WorldChunk.CreationType.CHECK);
if (blockEntityx != null) {
this.addBlockEntity(data, set, blockEntityx);
}
}
FluidState fluid = chunkRendererRegion.getFluidState(blockPos3);
if (!fluid.isEmpty()) {
RenderLayer renderLayer = RenderLayers.getFluidLayer(fluid);
BufferBuilder bufferBuilder = buffers.get(renderLayer);
if (data.initializedLayers.add(renderLayer)) {
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
}
EventRenderFluid event = new EventRenderFluid(fluid, blockPos3, bufferBuilder);
BleachHack.eventBus.post(event);
if (event.isCancelled())
continue;
if (blockRenderManager.renderFluid(blockPos3, chunkRendererRegion, bufferBuilder, fluid)) {
data.empty = false;
data.nonEmptyLayers.add(renderLayer);
}
}
if (blockState.getRenderType() != BlockRenderType.INVISIBLE) {
RenderLayer renderLayer = RenderLayers.getBlockLayer(blockState);
BufferBuilder bufferBuilder = buffers.get(renderLayer);
if (data.initializedLayers.add(renderLayer)) {
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
}
EventRenderBlock.Tesselate event = new EventRenderBlock.Tesselate(blockState, blockPos3, matrixStack, bufferBuilder);
BleachHack.eventBus.post(event);
if (event.isCancelled())
continue;
matrixStack.push();
matrixStack.translate(blockPos3.getX() & 15, blockPos3.getY() & 15, blockPos3.getZ() & 15);
if (blockRenderManager.renderBlock(blockState, blockPos3, chunkRendererRegion, matrixStack, bufferBuilder, true, random)) {
data.empty = false;
data.nonEmptyLayers.add(renderLayer);
}
bufferBuilder.unfixColor();
matrixStack.pop();
}
}
if (data.nonEmptyLayers.contains(RenderLayer.getTranslucent())) {
BufferBuilder bufferBuilder2 = buffers.get(RenderLayer.getTranslucent());
bufferBuilder2.setCameraPosition(cameraX - (float) blockPos.getX(), cameraY - (float) blockPos.getY(), cameraZ - (float) blockPos.getZ());
data.bufferState = bufferBuilder2.popState();
}
Stream<RenderLayer> var10000 = data.initializedLayers.stream();
Objects.requireNonNull(buffers);
var10000.map(buffers::get).forEach(BufferBuilder::end);
BlockModelRenderer.disableBrightnessCache();
}
data.occlusionGraph = chunkOcclusionDataBuilder.build();
return set;
}
use of net.minecraft.client.render.RenderLayer in project meteor-client by MeteorDevelopment.
the class BannerBlockEntityRendererMixin method renderCrossbar.
private void renderCrossbar(BannerBlockEntity bannerBlockEntity, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
matrixStack.push();
BlockState blockState = bannerBlockEntity.getCachedState();
matrixStack.translate(0.5D, -0.1666666716337204D, 0.5D);
float h = -blockState.get(WallBannerBlock.FACING).asRotation();
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(h));
matrixStack.translate(0.0D, -0.3125D, -0.4375D);
matrixStack.push();
matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);
VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);
this.crossbar.render(matrixStack, vertexConsumer, i, j);
matrixStack.pop();
matrixStack.pop();
}
use of net.minecraft.client.render.RenderLayer in project Biome-Makeover by Lemonszz.
the class AltarBlockEntityRenderer method render.
@Override
public void render(AltarBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
matrices.translate(0.5D, 0.75D, 0.5D);
float ticks = (float) entity.ticks + tickDelta;
matrices.translate(0.0D, 0.1F + MathHelper.sin(ticks * 0.1F) * 0.01F, 0.0D);
float h;
for (h = entity.currentAngle - entity.lastAngle; h >= 3.1415927F; h -= 6.2831855F) {
}
while (h < -3.1415927F) {
h += 6.2831855F;
}
float k = entity.lastAngle + h * tickDelta;
matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(-k));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(80.0F));
float l = MathHelper.lerp(tickDelta, entity.pageAngle, entity.nextPageAngle);
float m = MathHelper.fractionalPart(l + 0.25F) * 1.6F - 0.3F;
float n = MathHelper.fractionalPart(l + 0.75F) * 1.6F - 0.3F;
float o = MathHelper.lerp(tickDelta, entity.pageTurningSpeed, entity.nextPageTurningSpeed);
this.book.setPageAngles(ticks, MathHelper.clamp(m, 0.0F, 1.0F), MathHelper.clamp(n, 0.0F, 1.0F), o);
VertexConsumer vertexConsumer = BOOK_TEXTURE.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid);
this.book.method_24184(matrices, vertexConsumer, light, overlay, 1.0F, 1.0F, 1.0F, 1.0F);
matrices.pop();
}
use of net.minecraft.client.render.RenderLayer in project Biome-Makeover by Lemonszz.
the class TapestryBlockEntityRenderer method render.
public void render(TapestryBlockEntity tapestry, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
float scale = 0.666F;
boolean inInventory = tapestry.getWorld() == null;
matrixStack.push();
long time;
if (inInventory) {
time = 0L;
matrixStack.translate(0.5D, 0.5D, 0.5D);
this.pillar.visible = true;
} else {
time = tapestry.getWorld().getTime();
BlockState blockState = tapestry.getCachedState();
float rotation;
if (blockState.getBlock() instanceof TapestryWallBlock || blockState.getBlock() instanceof AdjudicatorTapestryWallBlock) {
matrixStack.translate(0.5D, -0.1666666716337204D, 0.5D);
rotation = -blockState.get(TapestryWallBlock.FACING).asRotation();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
matrixStack.translate(0.0D, -0.3125D, -0.4375D);
this.pillar.visible = false;
} else {
matrixStack.translate(0.5D, 0.5D, 0.5D);
rotation = (float) (-(Integer) blockState.get(TapestryBlock.ROTATION) * 360) / 16.0F;
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
this.pillar.visible = true;
}
}
matrixStack.push();
matrixStack.scale(scale, -scale, -scale);
VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);
this.pillar.render(matrixStack, vertexConsumer, i, j);
this.crossbar.render(matrixStack, vertexConsumer, i, j);
BlockPos blockPos = tapestry.getPos();
float n = ((float) Math.floorMod((long) (blockPos.getX() * 7 + blockPos.getY() * 9 + blockPos.getZ() * 13) + time, 100L) + f) / 100.0F;
this.banner.pitch = (-0.0125F + 0.01F * MathHelper.cos(6.2831855F * n)) * 3.1415927F;
this.banner.pivotY = -32.0F;
renderTapestry(matrixStack, vertexConsumerProvider, i, j, this.banner, tapestry.getColor());
matrixStack.pop();
matrixStack.pop();
}
use of net.minecraft.client.render.RenderLayer in project Biome-Makeover by Lemonszz.
the class StoneGolemEntityRender method render.
@Override
public void render(StoneGolemEntity entity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
matrixStack.push();
boolean visible = this.isVisible(entity);
boolean isInvis = !visible && !entity.isInvisibleTo(MinecraftClient.getInstance().player);
boolean outline = MinecraftClient.getInstance().hasOutline(entity);
matrixStack.scale(-1.0F, -1.0F, 1.0F);
// ????
matrixStack.translate(0.0D, -1.5010000467300415D, 0.0D);
RenderLayer renderLayer = this.getRenderLayer(entity, visible, isInvis, outline);
if (renderLayer != null) {
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(renderLayer);
int overlay = getOverlay(entity, this.getAnimationCounter(entity, g));
getModel().renderBase(matrixStack, vertexConsumer, i, overlay, 1F, 1F, 1F, isInvis ? 0.15F : 1.0F);
}
matrixStack.pop();
super.render(entity, f, g, matrixStack, vertexConsumerProvider, i);
}
Aggregations