30 avr. 2021, 13:26
Euh désoler j’ai un peu modifier le code en vain mais voila celui a jour qui ne marche toujours pas :
@SubscribeEvent public void renderWorld (RenderWorldLastEvent event){
Entity player = Minecraft.getMinecraft().player;
if(player instanceof EntityPlayerSP)
{
double x = player.getForward().x;
double y = player.getForward().y;
double z = player.getForward().z;
x *= 10;
y *= 10;
z *= 10;
Vec3d start = player.getPositionVector();
Vec3d end = new Vec3d(start.x + x, start.y + y + player.getEyeHeight(), start.z + z);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
GlStateManager.pushMatrix();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(start.x, start.y + ((EntityPlayerSP)player).getEyeHeight(), start.z).color(1f, 0f, 0f, 1f).endVertex();
buffer.pos(end.x, end.y, end.z).color(1f, 0f, 0f, 1f).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}