net.minecraftforge.client.event.RenderWorldLastEvent Java Examples
The following examples show how to use
net.minecraftforge.client.event.RenderWorldLastEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IronChestFinder.java From ehacks-pro with GNU General Public License v3.0 | 8 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { try { for (Object o : Wrapper.INSTANCE.world().loadedTileEntityList) { if (Class.forName("cpw.mods.ironchest.TileEntityIronChest").isInstance(o)) { TileEntity chest = (TileEntity) o; double renderX = chest.xCoord - RenderManager.renderPosX; double renderY = chest.yCoord - RenderManager.renderPosY; double renderZ = chest.zCoord - RenderManager.renderPosZ; GL11.glPushMatrix(); GL11.glTranslated(renderX, renderY, renderZ); GL11.glColor3f(1.0f, 1.0f, 0.0f); AltAxisAlignedBB boundingBox = AltAxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); GL11.glColor4f(0.0f, 1.0f, 1.0f, 0.1f); GLUtils.startDrawingESPs(boundingBox, 0.3f, 0.8f, 1.0f); GL11.glPopMatrix(); } } } catch (Exception e) { } }
Example #2
Source File: Render.java From XRay-Mod with GNU General Public License v3.0 | 7 votes |
static void renderBlocks(RenderWorldLastEvent event) { Vector3d view = XRay.mc.gameRenderer.getActiveRenderInfo().getProjectedView(); MatrixStack stack = event.getMatrixStack(); stack.translate(-view.x, -view.y, -view.z); // translate RenderSystem.pushMatrix(); RenderSystem.multMatrix(stack.getLast().getMatrix()); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); Profile.BLOCKS.apply(); // Sets GL state for block drawing syncRenderList.forEach(blockProps -> { buffer.begin( GL_LINES, DefaultVertexFormats.POSITION_COLOR ); renderBlockBounding(buffer, blockProps); tessellator.draw(); } ); Profile.BLOCKS.clean(); RenderSystem.popMatrix(); }
Example #3
Source File: Breadcrumb.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { GL11.glPushMatrix(); GL11.glLineWidth(2.0f); GL11.glDisable(3553); GL11.glDisable(2896); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glEnable(3042); GL11.glDisable(2929); GL11.glBegin(3); positionsList.forEach((pos) -> { double distance = Breadcrumb.posit(Math.hypot(pos[0] - RenderManager.renderPosX, pos[1] - RenderManager.renderPosY)); if (!(distance > 100.0)) { GL11.glColor4f(0.0f, 1.0f, 0.0f, (1.0f - (float) (distance / 100.0))); GL11.glVertex3d((pos[0] - RenderManager.renderPosX), (pos[1] - RenderManager.renderPosY), (pos[2] - RenderManager.renderPosZ)); } }); GL11.glEnd(); GL11.glEnable(2929); GL11.glDisable(2848); GL11.glDisable(3042); GL11.glEnable(3553); GL11.glEnable(2896); GL11.glPopMatrix(); }
Example #4
Source File: ClientProxy.java From NBTEdit with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void renderWorldLast(RenderWorldLastEvent event){ GuiScreen curScreen = Minecraft.getMinecraft().currentScreen; if (curScreen instanceof GuiEditNBTTree){ GuiEditNBTTree screen = (GuiEditNBTTree)curScreen; Entity e = screen.getEntity(); if (e != null && e.isEntityAlive()) drawBoundingBox(event.context, event.partialTicks,e.boundingBox); else if (screen.isTileEntity()){ int x = screen.getBlockX(); int y = screen.y; int z = screen.z; World world = Minecraft.getMinecraft().theWorld; Block b = world.getBlock(x, y, z); if (b != null) { b.setBlockBoundsBasedOnState(world, x,y,z); drawBoundingBox(event.context,event.partialTicks, b.getSelectedBoundingBoxFromPool(world,x, y,z)); } } } }
Example #5
Source File: WorldOverlayRenderer.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent public void renderLastEvent(RenderWorldLastEvent event) { if (NEIClientConfig.isEnabled()) { GlStateManager.pushMatrix(); GlStateTracker.pushState(); Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); RenderUtils.translateToWorldCoords(entity, event.getPartialTicks()); renderChunkBounds(entity); renderMobSpawnOverlay(entity); GlStateTracker.popState(); GlStateManager.popMatrix(); } }
Example #6
Source File: RenderFairy.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent public static void renderFairy(RenderWorldLastEvent event) { if (Minecraft.getMinecraft().world == null || Minecraft.getMinecraft().player == null) return; GlStateManager.pushMatrix(); List<EntityFairy> fairies = Minecraft.getMinecraft().world.getEntitiesWithinAABB(EntityFairy.class, Minecraft.getMinecraft().player.getEntityBoundingBox().grow(Minecraft.getMinecraft().gameSettings.renderDistanceChunks * 16)); fairies.sort(Comparator.comparingDouble(o -> o.getDistanceSq(Minecraft.getMinecraft().player))); Collections.reverse(fairies); for (EntityFairy fairy : fairies) { if (fairy.isInvisible() || fairy.isDead) continue; FairyData dataFairy = fairy.getDataFairy(); if (dataFairy == null) return; dataFairy.render( fairy.world, new Vec3d(fairy.posX, fairy.posY + (dataFairy.isDepressed ? fairy.height : 0), fairy.posZ), new Vec3d(fairy.lastTickPosX, fairy.lastTickPosY, fairy.lastTickPosZ), event.getPartialTicks()); } GlStateManager.popMatrix(); }
Example #7
Source File: PhasedBlockRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public static void render(RenderWorldLastEvent event) { if (Minecraft.getMinecraft().player == null) return; if (Minecraft.getMinecraft().getRenderManager().options == null) return; Set<PhaseObject> tmp = new HashSet<>(phaseObjects); for (PhaseObject phaseObject : tmp) { if (Minecraft.getMinecraft().world.getTotalWorldTime() - phaseObject.lastWorldTick > phaseObject.expiry) phaseObjects.remove(phaseObject); float time = ClientTickHandler.getTicksInGame() + (Minecraft.getMinecraft().isGamePaused() ? 0 : ClientTickHandler.getPartialTicks()); BufferBuilder bufferBuilder = beginRender(); render(phaseObject, time, bufferBuilder); finishRender(bufferBuilder); } }
Example #8
Source File: ProphuntESP.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (this.isActive()) { Wrapper.INSTANCE.world().loadedEntityList.stream().filter((o) -> !(!(o instanceof EntityFallingBlock))).map((o) -> (EntityFallingBlock) o).map((e1) -> { Entity e = (Entity) e1; float halfWidth = e.width / 2.0f; AltAxisAlignedBB aaabb = AltAxisAlignedBB.getBoundingBox(e.width - halfWidth, e.height, e.width - halfWidth, e.width + halfWidth, e.height + e.height, e.width + halfWidth); double renderX = e.lastTickPosX + (e.posX - e.lastTickPosX) * event.partialTicks - RenderManager.renderPosX - e.width; double renderY = e.lastTickPosY + (e.posY - e.lastTickPosY) * event.partialTicks - RenderManager.renderPosY - e.height * 1.5; double renderZ = e.lastTickPosZ + (e.posZ - e.lastTickPosZ) * event.partialTicks - RenderManager.renderPosZ - e.width; GL11.glPushMatrix(); GL11.glTranslated(renderX, renderY, renderZ); GL11.glColor4f(0.27f, 0.7f, 0.92f, 1.0f); return aaabb; }).map((aaabb) -> { GL11.glColor4f(0.92f, 0.2f, 0.2f, 1.0f); return aaabb; }).map((aaabb) -> { GLUtils.startDrawingESPs((AltAxisAlignedBB) aaabb, 0.27f, 0.7f, 0.5f); return aaabb; }).forEachOrdered((_item) -> { GL11.glPopMatrix(); }); } }
Example #9
Source File: PlayerEspHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); double partialTicks = event.getPartialTicks(); if(style.getSelected().boxes) renderBoxes(partialTicks); if(style.getSelected().lines) renderLines(partialTicks); GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example #10
Source File: MobSpawnEspHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPushMatrix(); GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); for(ChunkScanner scanner : new ArrayList<>(scanners.values())) { if(scanner.displayList == 0) continue; GL11.glCallList(scanner.displayList); } GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example #11
Source File: MobEspHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); double partialTicks = event.getPartialTicks(); if(style.getSelected().boxes) renderBoxes(partialTicks); if(style.getSelected().lines) renderTracers(partialTicks); GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example #12
Source File: RenderEventService.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onRenderWorld(RenderWorldLastEvent event) { GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.disableDepth(); GlStateManager.glLineWidth(1.f); Vec3d renderPos = EntityUtils.getInterpolatedPos(getRenderEntity(), event.getPartialTicks()); RenderEvent e = new RenderEvent(TESSELLATOR, renderPos, event.getPartialTicks()); e.resetTranslation(); MinecraftForge.EVENT_BUS.post(e); GlStateManager.glLineWidth(1.f); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.enableCull(); GlStateManager.popMatrix(); }
Example #13
Source File: ArenaManager.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void renderWorld(RenderWorldLastEvent event) { for (Arena arena : arenas) { } }
Example #14
Source File: EventManager.java From Logistics-Pipes-2 with MIT License | 5 votes |
@SideOnly(Side.CLIENT) @SubscribeEvent public void onRenderAfterWorld(RenderWorldLastEvent event){ tickCounter++; if(LogisticsPipes2.proxy instanceof ClientProxy) { GlStateManager.pushMatrix(); ClientProxy.particleRender.renderParticles(Minecraft.getMinecraft().player, event.getPartialTicks()); GlStateManager.popMatrix(); } }
Example #15
Source File: EffectHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRender(RenderWorldLastEvent event) { Tessellator tessellator = Tessellator.instance; FXFlow.FXFlowBase.sheduleRender(tessellator); Orbital.sheduleRenders(orbitals, event.partialTicks); FXVortex.sheduleRender(fxVortexes, tessellator, event.partialTicks); }
Example #16
Source File: Events.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public static void onWorldRenderLast( RenderWorldLastEvent event ) // Called when drawing the world. { if ( Controller.isXRayActive() && XRay.mc.player != null ) { // this is a world pos of the player Render.renderBlocks(event); } }
Example #17
Source File: HUDHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent event){ if(!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) return; Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.thePlayer; double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.partialTicks; double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.partialTicks; double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialTicks; GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); ItemStack helmetStack = player.inventory.armorInventory[3]; if(helmetStack != null && helmetStack.getItem() == Itemss.pneumaticHelmet) { if(((IPressurizable)helmetStack.getItem()).getPressure(helmetStack) > 0F) { CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player); if(comHudHandler.ticksExisted > comHudHandler.getStartupTime()) { GL11.glDisable(GL11.GL_TEXTURE_2D); for(int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) { if(comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked) UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).render3D(event.partialTicks); } GL11.glEnable(GL11.GL_TEXTURE_2D); } } } GL11.glPopMatrix(); }
Example #18
Source File: ClientSemiBlockManager.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent event){ Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.thePlayer; double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.partialTicks; double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.partialTicks; double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialTicks; GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); // GL11.glEnable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_LIGHTING); RenderHelper.enableStandardItemLighting(); for(Map<ChunkPosition, ISemiBlock> map : SemiBlockManager.getInstance(player.worldObj).getSemiBlocks().values()) { for(ISemiBlock semiBlock : map.values()) { ISemiBlockRenderer renderer = getRenderer(semiBlock); if(renderer != null) { GL11.glPushMatrix(); GL11.glTranslated(semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ); renderer.render(semiBlock, event.partialTicks); GL11.glPopMatrix(); } } } GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
Example #19
Source File: StencilRendererHandler.java From OpenModsLib with MIT License | 5 votes |
@SubscribeEvent public void drawStenciledBackground(RenderWorldLastEvent evt) { if (!renderThisTick) return; renderThisTick = false; render(evt.getContext(), evt.getPartialTicks()); }
Example #20
Source File: BlockOverlayRender.java From MiningGadgets with MIT License | 5 votes |
public static void render(RenderWorldLastEvent event, ItemStack item) { final Minecraft mc = Minecraft.getInstance(); IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); int range = MiningProperties.getBeamRange(item); BlockRayTraceResult lookingAt = VectorHelper.getLookingAt(mc.player, RayTraceContext.FluidMode.NONE, range); if (mc.world.getBlockState(VectorHelper.getLookingAt(mc.player, item, range).getPos()) == Blocks.AIR.getDefaultState()) { return; } List<BlockPos> coords = MiningCollect.collect(mc.player, lookingAt, mc.world, MiningProperties.getRange(item)); Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); MatrixStack matrix = event.getMatrixStack(); matrix.push(); matrix.translate(-view.getX(), -view.getY(), -view.getZ()); IVertexBuilder builder; builder = buffer.getBuffer(MyRenderType.BlockOverlay); coords.forEach(e -> { if (mc.world.getBlockState(e).getBlock() != ModBlocks.RENDER_BLOCK.get()) { matrix.push(); matrix.translate(e.getX(), e.getY(), e.getZ()); matrix.translate(-0.005f, -0.005f, -0.005f); matrix.scale(1.01f, 1.01f, 1.01f); matrix.rotate(Vector3f.YP.rotationDegrees(-90.0F)); Matrix4f positionMatrix = matrix.getLast().getMatrix(); BlockOverlayRender.render(positionMatrix, builder, e, Color.GREEN); matrix.pop(); } }); matrix.pop(); RenderSystem.disableDepthTest(); buffer.finish(MyRenderType.BlockOverlay); }
Example #21
Source File: Events.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderWorld(RenderWorldLastEvent event) { if (!cheatEnabled) { return; } ModuleController.INSTANCE.modules.stream().filter((mod) -> !(!mod.isActive() || Wrapper.INSTANCE.world() == null)).forEachOrdered((mod) -> { mod.onWorldRender(event); }); }
Example #22
Source File: ItemEspHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { // GL settings GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glPushMatrix(); GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); double partialTicks = event.getPartialTicks(); renderBoxes(partialTicks); if(style.getSelected().lines) renderTracers(partialTicks); GL11.glPopMatrix(); // GL resets GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example #23
Source File: BlockOverlay.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { MovingObjectPosition position = Wrapper.INSTANCE.mc().objectMouseOver; Block block = Wrapper.INSTANCE.world().getBlock(position.blockX, position.blockY, position.blockZ); if (block.getMaterial() != Material.air) { this.drawESP(0.0f); } }
Example #24
Source File: AntiKnockBack.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (Wrapper.INSTANCE.player().hurtResistantTime > 0 && Wrapper.INSTANCE.player().hurtTime > 0) { Wrapper.INSTANCE.player().hurtResistantTime = 0; Wrapper.INSTANCE.player().hurtTime = 0; Wrapper.INSTANCE.player().motionX = 0.0; Wrapper.INSTANCE.player().motionY /= 10.0; Wrapper.INSTANCE.player().motionZ = 0.0; } }
Example #25
Source File: XRay.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (Wrapper.INSTANCE.world() != null && displayListId != 0) { double doubleX = RenderManager.renderPosX; double doubleY = RenderManager.renderPosY; double doubleZ = RenderManager.renderPosZ; GL11.glPushMatrix(); GL11.glTranslated((-doubleX), (-doubleY), (-doubleZ)); GL11.glCallList(displayListId); GL11.glPopMatrix(); } }
Example #26
Source File: Tracers.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { try { GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glLineWidth(2.0f); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glDepthMask(false); Wrapper.INSTANCE.world().loadedEntityList.stream().filter((entities) -> !(entities == Wrapper.INSTANCE.player() || !(entities instanceof EntityPlayer) || (entities instanceof EntityFakePlayer) || ((Entity) entities).isDead || ((EntityPlayer) entities).isInvisible())).map((entities) -> (EntityPlayer) entities).map((entity1) -> { Entity entity = (Entity) entity1; float distance = Wrapper.INSTANCE.mc().renderViewEntity.getDistanceToEntity(entity); double posX = entity.posX - RenderManager.renderPosX; double posY = entity.posY + (entity.height / 2.0f) - RenderManager.renderPosY; double posZ = entity.posZ - RenderManager.renderPosZ; String playerName = Wrapper.INSTANCE.player().getGameProfile().getName(); if (distance <= 6.0f) { GL11.glColor3f(1.0f, 0.0f, 0.0f); } else if (distance <= 96.0f) { GL11.glColor3f(1.0f, (distance / 100.0f), 0.0f); } else if (distance > 96.0f) { GL11.glColor3f(0.1f, 0.6f, 255.0f); } GL11.glBegin(1); GL11.glVertex3d(0.0, 0.0, 0.0); GL11.glVertex3d(posX, posY, posZ); return entity; }).forEachOrdered((_item) -> { GL11.glEnd(); }); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); } catch (Exception exception) { // empty catch block } }
Example #27
Source File: EndPort.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (selectedEnt == null) { return; } if (distVec != null) { distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize(); distVec.xCoord *= size; distVec.yCoord *= size; distVec.zCoord *= size; } NBTTagCompound tag = new NBTTagCompound(); selectedEnt.writeToNBT(tag); if (!GLUtils.hasClearedDepth) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GLUtils.hasClearedDepth = true; } Entity ent = selectedEnt; double tXPos = ent.posX; double tYPos = ent.posY; double tZPos = ent.posZ; double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks; double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + ((ent instanceof EntityPlayer) ? 1 : 0)) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks; double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks; ent.posX = ent.lastTickPosX = xPos; ent.posY = ent.lastTickPosY = yPos; ent.posZ = ent.lastTickPosZ = zPos; float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks; RenderHelper.enableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) { GL11.glColor4f(0, 1.0F, 0, 1f); } else { GL11.glColor4f(1.0F, 0, 0, 1f); } RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false); ent.posX = ent.lastTickPosX = tXPos; ent.posY = ent.lastTickPosY = tYPos; ent.posZ = ent.lastTickPosZ = tZPos; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
Example #28
Source File: VideoHook.java From malmo with MIT License | 4 votes |
/** * Called when the world has been rendered but not yet the GUI or player hand. * * @param event * Contains information about the event (not used). */ @SubscribeEvent public void postRender(RenderWorldLastEvent event) { // Check that the video producer and frame type match - eg if this is a colourmap frame, then // only the colourmap videoproducer needs to do anything. boolean colourmapFrame = TextureHelper.colourmapFrame; boolean colourmapVideoProducer = this.videoProducer.getVideoType() == VideoType.COLOUR_MAP; if (colourmapFrame != colourmapVideoProducer) return; EntityPlayerSP player = Minecraft.getMinecraft().player; float x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks()); float y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks()); float z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks()); float yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * event.getPartialTicks(); float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.getPartialTicks(); long time_before_ns = System.nanoTime(); if (observer != null) observer.frameProduced(); if (time_before_ns < retry_time_ns) return; boolean success = false; long time_after_render_ns; try { int size = this.videoProducer.getRequiredBufferSize(); if (AddressHelper.getMissionControlPort() == 0) { success = true; if (envServer != null) { // Write the obs data into a newly allocated buffer: byte[] data = new byte[size]; this.buffer.clear(); this.videoProducer.getFrame(this.missionInit, this.buffer); this.buffer.get(data); // Avoiding copy not simple as data is kept & written to a stream later. time_after_render_ns = System.nanoTime(); envServer.addFrame(data); } else { time_after_render_ns = System.nanoTime(); } } else { // Get buffer ready for writing to: this.buffer.clear(); this.headerbuffer.clear(); // Write the pos data: this.headerbuffer.putFloat(x); this.headerbuffer.putFloat(y); this.headerbuffer.putFloat(z); this.headerbuffer.putFloat(yaw); this.headerbuffer.putFloat(pitch); // Write the frame data: this.videoProducer.getFrame(this.missionInit, this.buffer); // The buffer gets flipped by getFrame(), but we need to flip our header buffer ourselves: this.headerbuffer.flip(); ByteBuffer[] buffers = {this.headerbuffer, this.buffer}; time_after_render_ns = System.nanoTime(); success = this.connection.sendTCPBytes(buffers, size + POS_HEADER_SIZE); } long time_after_ns = System.nanoTime(); float ms_send = (time_after_ns - time_after_render_ns) / 1000000.0f; float ms_render = (time_after_render_ns - time_before_ns) / 1000000.0f; if (success) { this.failedTCPSendCount = 0; // Reset count of failed sends. this.timeOfLastFrame = System.currentTimeMillis(); if (this.timeOfFirstFrame == 0) this.timeOfFirstFrame = this.timeOfLastFrame; this.framesSent++; // System.out.format("Total: %.2fms; collecting took %.2fms; sending %d bytes took %.2fms\n", ms_send + ms_render, ms_render, size, ms_send); // System.out.println("Collect: " + ms_render + "; Send: " + ms_send); } } catch (Exception e) { System.out.format(e.getMessage()); } if (!success) { System.out.format("Failed to send frame - will retry in %d seconds\n", RETRY_GAP_NS / 1000000000L); retry_time_ns = time_before_ns + RETRY_GAP_NS; this.failedTCPSendCount++; } }
Example #29
Source File: Module.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
public void onWorldRender(RenderWorldLastEvent event) { }
Example #30
Source File: RenderMiningLaser2.java From MiningGadgets with MIT License | 4 votes |
private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) { Hand activeHand; if (player.getHeldItemMainhand().getItem() instanceof MiningGadget) { activeHand = Hand.MAIN_HAND; } else if (player.getHeldItemOffhand().getItem() instanceof MiningGadget) { activeHand = Hand.OFF_HAND; } else { return; } IVertexBuilder builder; ItemStack stack = player.getHeldItem(activeHand); double distance = from.subtract(trace.getHitVec()).length(); long gameTime = player.world.getGameTime(); double v = gameTime * speedModifier; float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime); float beam2r = MiningProperties.getColor(stack, MiningProperties.COLOR_RED_INNER) / 255f; float beam2g = MiningProperties.getColor(stack, MiningProperties.COLOR_GREEN_INNER) / 255f; float beam2b =MiningProperties.getColor(stack, MiningProperties.COLOR_BLUE_INNER) / 255f; Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); MatrixStack matrix = event.getMatrixStack(); matrix.push(); matrix.translate(-view.getX(), -view.getY(), -view.getZ()); matrix.translate(from.x, from.y, from.z); matrix.rotate(Vector3f.YP.rotationDegrees(MathHelper.lerp(ticks, -player.rotationYaw, -player.prevRotationYaw))); matrix.rotate(Vector3f.XP.rotationDegrees(MathHelper.lerp(ticks, player.rotationPitch, player.prevRotationPitch))); MatrixStack.Entry matrixstack$entry = matrix.getLast(); Matrix3f matrixNormal = matrixstack$entry.getNormal(); Matrix4f positionMatrix = matrixstack$entry.getMatrix(); //additive laser beam builder = buffer.getBuffer(MyRenderType.LASER_MAIN_ADDITIVE); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, additiveThickness, activeHand, distance, 0.5, 1, ticks, r,g,b,0.7f); //main laser, colored part builder = buffer.getBuffer(MyRenderType.LASER_MAIN_BEAM); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness, activeHand, distance, v, v + distance * 1.5, ticks, r,g,b,1f); //core builder = buffer.getBuffer(MyRenderType.LASER_MAIN_CORE); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness/2, activeHand, distance, v, v + distance * 1.5, ticks, beam2r,beam2g,beam2b,1f); matrix.pop(); RenderSystem.disableDepthTest(); buffer.finish(); }