Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BlazingTwist

Members
  • Joined

  • Last visited

  1. Case closed, I'm an idiot! I just took a real close look at the debug and it turns out x1=-981.5 | x2=-981.5 | y1=4.70253470330818 | y2=4.70253470330818 | z1=279.5 | z2=279.5 ALL variables are the same! I just missed it the first time I checked because the numbers were flying past so quickly. It seems that Entity::posY and Entity::lastTickPosY are the same value. Fixed by using Entity::prevPosY instead.
  2. Okay... NOW I am confused... I changed a few things, I'm registering the listener in my client proxy now public class ClientProxy extends CommonProxy{ EntityTracker entityTracker; @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); entityTracker = new EntityTracker(this); MinecraftForge.EVENT_BUS.register(entityTracker); } } And I changed my onWorldRender function to not be static (as that messed with my eventlistener before, so I though 1+1=2, and it probably is, I just suck at math and got 3 instead) I also minimized the use of GL11 and accessed GlStateManager instead. public class EntityTracker { ClientProxy proxy; public static HashMap<String, TrackingData> observedEntityID = new HashMap<String, TrackingData>(); public static ArrayList<TracingData> tracingHistory = new ArrayList<TracingData>(); public EntityTracker(ClientProxy proxy){ this.proxy = proxy; } @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if(tracingHistory == null || tracingHistory.size() <= 0) { return; } if(Minecraft.getMinecraft().player == null) { return; } Vec3d player_pos = Minecraft.getMinecraft().player.getPositionVector(); GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.translate(-player_pos.x, -player_pos.y, -player_pos.z); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferBuilder = tessellator.getBuffer(); bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); TracingData trace_data; TrackingData track_data; for(Iterator<TracingData> it=tracingHistory.iterator(); it.hasNext();) { trace_data = it.next(); track_data=observedEntityID.get(trace_data.ID); trace_data.setupDrawingBuffer(bufferBuilder, track_data); if(System.currentTimeMillis()-trace_data.timeOfCreation>=(track_data.getTime()*1000) && ModuleManager.mode==0) { //rendered time >= max time it.remove(); } } tessellator.draw(); GlStateManager.glLineWidth(1.0f); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); } } Also TracingData::setupDrawingBuffer() is doing a little bit more stuff now: public void setupDrawingBuffer(BufferBuilder bufferBuilder ,TrackingData td) { GlStateManager.glLineWidth(td.getThickness()); //y1->y2 | x1->x2 | z1->z2 bufferBuilder.pos(x1, y1, z1).color(0,0,0,0).endVertex(); bufferBuilder.pos(x1, y2, z1).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos(x2, y2, z1).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos(x2, y2, z2).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); //render bounding box lines bufferBuilder.pos((x2-0.49), (y2-0.49), (z2-0.49)).color(0,0,0,0).endVertex(); bufferBuilder.pos((x2+0.49), (y2-0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2+0.49), (y2-0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2-0.49), (y2-0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2-0.49), (y2-0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2-0.49), (y2+0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2+0.49), (y2+0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2+0.49), (y2+0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2-0.49), (y2+0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2-0.49), (y2-0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); //fill missing 3 lines bufferBuilder.pos((x2-0.49), (y2+0.49), (z2+0.49)).color(0,0,0,0).endVertex(); bufferBuilder.pos((x2-0.49), (y2+0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2+0.49), (y2-0.49), (z2-0.49)).color(0,0,0,0).endVertex(); bufferBuilder.pos((x2+0.49), (y2+0.49), (z2-0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos((x2+0.49), (y2-0.49), (z2+0.49)).color(0,0,0,0).endVertex(); bufferBuilder.pos((x2+0.49), (y2+0.49), (z2+0.49)).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); } So, what's the problem now, you ask? For some reason it DOES render the complete lower half of TracingData::setupDrawingBuffer, I get a flawless boundingbox, but it does NOT render the first 3 lines (y1->y2 | x1->x2 | z1->z2)
  3. You could start by taking a look at the source code of your reference. https://github.com/MatterOverdrive/MatterOverdrive-Legacy-Edition/blob/1.12.2/src/main/java/matteroverdrive/client/render/biostat/BioticStatRendererShield.java And while you're at it, maybe take a look at this. You'll probably find something helpful there aswell. https://relativity.net.au/gaming/java/openGL_basics.html
  4. I'm a little lost to be honest, my code isn't throwing any errors and after doing some debugging in console the values of all variables seem fine, yet I end up with no lines in my world space whatsoever. I know that the actual rendering part of my code (should) work (because I used it in a hacked client before I wanted to recreate it as a forge mod), so I assume that I did something wrong when registering the listener or subscribing to the proper event. Here is the code for registering the listener in my Main: @EventHandler public static void postInit(FMLPostInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new EntityListener()); } And here is the corresponding section in EntityListener @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { EntityTracker.onWorldRender(); } Lastly here is the onWorldRender function in EntityTracker (I know this is a conflicting classname, didn't bother changing it yet as it shouldn't cause any issues (?), not like I plan to ever publish this anyway) public static void onWorldRender() { if(tracingHistory != null && tracingHistory.size() > 0) { if(Minecraft.getMinecraft().player == null) { return; } Vec3d player_pos = Minecraft.getMinecraft().player.getPositionVector(); GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.translate(-player_pos.x, -player_pos.y, -player_pos.z); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferBuilder = tessellator.getBuffer(); GL11.glEnable(GL11.GL_LINE_SMOOTH); bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); TracingData trace_data; TrackingData track_data; for(Iterator<TracingData> it=tracingHistory.iterator(); it.hasNext();) { trace_data = it.next(); track_data=observedEntityID.get(trace_data.ID); trace_data.setupDrawingBuffer(bufferBuilder, track_data); if(System.currentTimeMillis() - trace_data.timeOfCreation >= (track_data.getTime()*1000) && ModuleManager.mode == 0) { //rendered time >= max time it.remove(); } } tessellator.draw(); GL11.glLineWidth(1.0f); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); } } I should probably show what TracingData::setupDrawingBuffer does aswell public void setupDrawingBuffer(BufferBuilder bufferBuilder ,TrackingData td) { GL11.glLineWidth(td.getThickness()); //y1->y2 | x1->x2 | z1->z2 bufferBuilder.pos(x1, y1, z1).color(0,0,0,0).endVertex(); bufferBuilder.pos(x1, y2, z1).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos(x2, y2, z1).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); bufferBuilder.pos(x2, y2, z2).color(td.getRed(), td.getGreen(), td.getBlue(), td.getAlpha()).endVertex(); } Sooo... any ideas? Would really appreciate help here.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.