GlStateManager.pushMatrix();
GlStateManager.disableTexture();
GlStateManager.disableLighting();
GlStateManager.disableDepthTest();
GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.lineWidth(1);
Vec3d renderPos = Utils.getInterpolatedEyePos(MC.player, event.getPartialTicks());
RenderEvent renderEvent = new RenderEvent(GeometryTessellator.getInstance(), renderPos, event.getPartialTicks());
renderEvent.resetTranslation();
MinecraftForge.EVENT_BUS.post(renderEvent);
GlStateManager.lineWidth(1);
GlStateManager.disableBlend();
GlStateManager.enableDepthTest();
GlStateManager.enableLighting();
GlStateManager.enableTexture();
GlStateManager.popMatrix();
GeometryTesselattor extends Tesselator and adds some helper functions.
RenderEvent.resetTranslation() translates tesselators buffer by renderPos. (Passed in constructor)
Utils.getInterpolatedEyePos():
public static Vec3d getInterpolated(Entity entity, double x, double y, double z) {
return new Vec3d((entity.posX - entity.lastTickPosX) * x, (entity.posY - entity.lastTickPosY) * y, (entity.posZ - entity.lastTickPosZ) * z);
}
public static Vec3d getInterpolated(Entity entity, double ticks) {
return getInterpolated(entity, ticks, ticks, ticks);
}
public static Vec3d getInterpolatedPos(Entity entity, double ticks) {
return new Vec3d(entity.posX, entity.posY, entity.posZ).add(getInterpolated(entity, ticks)) ;
}
public static Vec3d getInterpolatedEyePos(Entity entity, double ticks) {
return getInterpolatedPos(entity, ticks).add(0, entity.getEyeHeight(), 0);
}
And when I Subscribe to that event is just adds some vertices to buffer and calls tesselators draw method.
If you can help me it would be awesome.