Hi, im fairly new to forge modding, so please forgive for asking such a stupid question.
Now for my problem. Im trying to draw a line between two positions. Drawing the line works, but when I change pitch or yaw, the line doesn't adjust, it just stays in the same position on screen.
I want it to adjust it's position, just like a normal block would.
What happens: https://imgur.com/EwpOGuo
What I tried:
Main class:
@Mod("path")
public class path
{
public path() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
}
private void setup(final FMLCommonSetupEvent event) {
MinecraftForge.EVENT_BUS.register(new PathRenderer());
}
}
Renderer:
public class PathRenderer {
private Minecraft mc;
public PathRenderer() {
mc = Minecraft.getInstance();
}
@SubscribeEvent
public void render(RenderWorldLastEvent event){
double x = mc.player.getPositionVec().x;
double y = mc.player.getPositionVec().y;
double z = mc.player.getPositionVec().z;
Vec3d p1 = new Vec3d(0, 57, 0);
Vec3d p2 = new Vec3d(5, 57, 0);
GL11.glPushMatrix();
GL11.glTranslated(-x, -y, -z);
GL11.glLineWidth(6.0f);
GL11.glColor3ub((byte)255,(byte)0,(byte)0);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex3d(p1.x, p1.y, p1.z);
GL11.glVertex3d(p2.x, p2.y, p2.z);
GL11.glEnd();
GL11.glPopMatrix();
}
}