use of party.lemons.biomemakeover.block.TapestryWallBlock 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();
}
Aggregations