use of com.minecolonies.coremod.blocks.BlockScarecrow in project minecolonies by Minecolonies.
the class TileEntityScarecrowRenderer method render.
@Override
public void render(final AbstractScarecrowTileEntity te, final float partialTicks, final MatrixStack matrixStack, @NotNull final IRenderTypeBuffer iRenderTypeBuffer, final int lightA, final int lightB) {
// Store the transformation
matrixStack.pushPose();
// Set viewport to tile entity position to render it
matrixStack.translate(BLOCK_MIDDLE, YOFFSET, BLOCK_MIDDLE);
matrixStack.mulPose(Vector3f.ZP.rotationDegrees(ROTATION));
// In the case of worldLags tileEntities may sometimes disappear.
if (te.getLevel().getBlockState(te.getBlockPos()).getBlock() instanceof BlockScarecrow) {
final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(AbstractBlockMinecoloniesDefault.FACING);
switch(facing) {
case EAST:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_EAST));
break;
case SOUTH:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_SOUTH));
break;
case WEST:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_WEST));
break;
default:
}
}
final IVertexBuilder vertexConsumer = getMaterial(te).buffer(iRenderTypeBuffer, RenderType::entitySolid);
this.model.renderToBuffer(matrixStack, vertexConsumer, lightA, lightB, 1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.popPose();
}
use of com.minecolonies.coremod.blocks.BlockScarecrow in project minecolonies by ldtteam.
the class TileEntityScarecrowRenderer method render.
@Override
public void render(final AbstractScarecrowTileEntity te, final float partialTicks, final MatrixStack matrixStack, @NotNull final IRenderTypeBuffer iRenderTypeBuffer, final int lightA, final int lightB) {
// Store the transformation
matrixStack.pushPose();
// Set viewport to tile entity position to render it
matrixStack.translate(BLOCK_MIDDLE, YOFFSET, BLOCK_MIDDLE);
matrixStack.mulPose(Vector3f.ZP.rotationDegrees(ROTATION));
// In the case of worldLags tileEntities may sometimes disappear.
if (te.getLevel().getBlockState(te.getBlockPos()).getBlock() instanceof BlockScarecrow) {
final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(AbstractBlockMinecoloniesDefault.FACING);
switch(facing) {
case EAST:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_EAST));
break;
case SOUTH:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_SOUTH));
break;
case WEST:
matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_WEST));
break;
default:
}
}
final IVertexBuilder vertexConsumer = getMaterial(te).buffer(iRenderTypeBuffer, RenderType::entitySolid);
this.model.renderToBuffer(matrixStack, vertexConsumer, lightA, lightB, 1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.popPose();
}
Aggregations