use of com.lowdragmc.multiblocked.api.item.ItemBlueprint in project Multiblocked by Low-Drag-MC.
the class BlueprintRegionRenderer method onRenderWorldLast.
@SubscribeEvent
public static void onRenderWorldLast(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getInstance();
PlayerEntity p = mc.player;
if (p == null)
return;
ItemStack held = p.getItemInHand(Hand.MAIN_HAND);
if (held.getItem() instanceof ItemBlueprint) {
BlockPos[] poses = ItemBlueprint.getPos(held);
if (poses == null)
return;
MatrixStack stack = event.getMatrixStack();
Vector3d pos = mc.gameRenderer.getMainCamera().getPosition();
stack.pushPose();
stack.translate(-pos.x, -pos.y, -pos.z);
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.disableCull();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuilder();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
RenderBufferUtils.renderCubeFace(stack, buffer, poses[0].getX(), poses[0].getY(), poses[0].getZ(), poses[1].getX() + 1, poses[1].getY() + 1, poses[1].getZ() + 1, 0.2f, 0.2f, 1f, 0.25f, true);
tessellator.end();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
RenderSystem.lineWidth(3);
RenderBufferUtils.renderCubeFrame(stack, buffer, poses[0].getX(), poses[0].getY(), poses[0].getZ(), poses[1].getX() + 1, poses[1].getY() + 1, poses[1].getZ() + 1, 0.0f, 0.0f, 1f, 0.5f);
tessellator.end();
RenderSystem.enableCull();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
// RenderSystem.color4f(1, 1, 1, 1);
stack.popPose();
}
}
Aggregations