public static EntityPlayer getPlayer(Event event) { if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer) return (EntityPlayer)((LivingEvent)event).getEntity(); if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent) return HarshenCastle.proxy.getPlayer(); if(event instanceof PlayerTickEvent) return ((PlayerTickEvent)event).player; if(event instanceof PlayerEvent) return ((PlayerEvent)event).player; if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent) return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer(); if(event instanceof PlayerPunchedEvent) return ((PlayerPunchedEvent)event).attacker; if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource())) return getPlayerFromSource(((LivingDropsEvent)event).getSource()); return null; }
public static void onRenderWorld(RenderWorldLastEvent event) { // EntityPlayerSP player = Minecraft.getMinecraft().player; // if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) { // return; // } // if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) { // return; // } if (cleanAir != null) { EntityPlayerSP p = Minecraft.getMinecraft().player; if (hasGlasses()) { int cnt = cleanAir.size(); if (cnt != prevCnt) { System.out.println("cleanAir = " + cnt); prevCnt = cnt; } renderHighlightedBlocks(event, p, cleanAir); } } }
private static void renderBlocks(RenderWorldLastEvent evt, Set<BlockPos> blocks) { EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft()); double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks(); double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks(); double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks(); GlStateManager.pushMatrix(); GlStateManager.translate(-doubleX, -doubleY, -doubleZ); GlStateManager.disableDepth(); GlStateManager.enableTexture2D(); for (BlockPos pos : blocks) { renderBoxOutline(pos); } GlStateManager.enableDepth(); GlStateManager.popMatrix(); }
@SubscribeEvent public static void renderGhostAngstrom(RenderWorldLastEvent event) { EntityPlayerSP player = Minecraft.getMinecraft().player; ItemStack stack = player.getHeldItemMainhand(); if(stack.isEmpty() || stack.getItem() != ModItems.ANGSTROM) { stack = player.getHeldItemOffhand(); } if(!stack.isEmpty() && stack.getItem() == ModItems.ANGSTROM) { RayTraceResult result = RayTraceHelper.tracePlayerHighlight(player); if(result.typeOfHit != RayTraceResult.Type.BLOCK) { Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ); vec.add(Vector3.create(player.getLookVec()).multiply(2.5D)); BlockPos pos = new BlockPos(vec.toVec3d()); IBlockState replaced = player.world.getBlockState(pos); if(player.world.isAirBlock(pos) || replaced.getBlock().isReplaceable(player.world, pos)) { RenderHelper.renderGhostBlock(pos, ModBlocks.ANGSTROM.getDefaultState()); } } } }
@SubscribeEvent public void onRenderLast(RenderWorldLastEvent event) { if(Minecraft.getMinecraft().player == null) return; ItemStack held = Minecraft.getMinecraft().player.getHeldItemMainhand(); if(held.isEmpty()) { held = Minecraft.getMinecraft().player.getHeldItemOffhand(); } if(!held.isEmpty() && held.getItem() instanceof ItemConstructTool) { PlayerStructureSelectionHelper.StructureSelection sel = PlayerStructureSelectionHelper.clientSelection; if(sel != null) { List<BlockPos> toRender = sel.getSelectedPositions().stream() .filter((pos) -> pos.distanceSq(Minecraft.getMinecraft().player.getPosition()) <= 1024) .collect(Collectors.toList()); RenderingUtils.drawWhiteOutlineCubes(toRender, event.getPartialTicks()); } } ClientProxy.renderHelper.renderTranslucentBlocks(); }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onWorldRender (RenderWorldLastEvent event) { if (icon == null) icon = RenderUtils.getParticleTexture(new ItemStack(Blocks.STAINED_GLASS)); final Minecraft mc = Minecraft.getMinecraft(); final Frustum camera = RenderUtils.getCamera(mc.getRenderViewEntity(), event.getPartialTicks()); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); for (final BlockPos pos : BlockHandler.PROTECTED) if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(pos))) this.renderPingOverlay(pos); }
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { // Don't render anything if a GUI is open if (this.mc.currentScreen != null) { return; } World fakeWorld = TickHandler.getInstance().getFakeWorld(); if (fakeWorld != null) { synchronized (fakeWorld) { if (renderingEnabled && TickHandler.getInstance().isTargetingBlocks() && (Configs.renderAfterDelay == false || System.currentTimeMillis() - TickHandler.getInstance().getHoverStartTime() >= Configs.renderDelay)) { this.renderChangedBlocks(fakeWorld, this.mc.player, event.getPartialTicks()); } } } }
/** * The world render last event. This is used for structure rendering. * @param event The event object. */ @SubscribeEvent public static void onWorldRenderLast(RenderWorldLastEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.player.isSneaking())) { StructureRenderHandler.renderPlayerLook(mc.player, mc.objectMouseOver); } if (ItemBogus.renderTest) { ClientEventHandler.RenderTest(mc.world, mc.player); } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.BOTTOM) public static void onRenderWorldLast(RenderWorldLastEvent event) { if (true) return; // optifine // Minecraft mc = Minecraft.getMinecraft(); // float partialTicks = event.getPartialTicks(); // GlStateManager.enableFog(); // mc.entityRenderer.enableLightmap(); // mc.mcProfiler.endStartSection("litParticles"); // mc.effectRenderer.renderLitParticles(mc.thePlayer, partialTicks); // RenderHelper.disableStandardItemLighting(); // mc.entityRenderer.setupFog(0, partialTicks); // mc.mcProfiler.endStartSection("particles"); // mc.effectRenderer.renderParticles(mc.thePlayer, partialTicks); // mc.entityRenderer.disableLightmap(); // GlStateManager.disableFog(); }
@SubscribeEvent public void renderWorldLast(RenderWorldLastEvent event) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); EntityPlayer rootPlayer = Minecraft.getMinecraft().player; double x = rootPlayer.lastTickPosX + (rootPlayer.posX - rootPlayer.lastTickPosX) * event.getPartialTicks(); double y = rootPlayer.lastTickPosY + (rootPlayer.posY - rootPlayer.lastTickPosY) * event.getPartialTicks(); double z = rootPlayer.lastTickPosZ + (rootPlayer.posZ - rootPlayer.lastTickPosZ) * event.getPartialTicks(); GlStateManager.translate(-x, -y, -z); // vvv actual rendering stuff vvv GlStateManager.enableBlend(); GlStateManager.alphaFunc(GL11.GL_GEQUAL, 1f / 255f); RenderLaserUtil.startRenderingLasers(); for (LaserRenderInfo info : lasers.keySet()) RenderLaserUtil.renderLaser(info.color, info.start, info.end); RenderLaserUtil.finishRenderingLasers(); GlStateManager.disableBlend(); GlStateManager.disableAlpha(); GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
@SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent evt) { // Get the player and their held item EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND); // Check if the held item is an extendo if(heldItem == null) return; if(heldItem.getItem() instanceof BaseExtendo) { // Call the highlight on the held extendo BaseExtendo extendo = (BaseExtendo) heldItem.getItem(); extendo.drawHighlight(evt, player, heldItem); } }
@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(); } }
@SubscribeEvent public void onWorldRender(final RenderWorldLastEvent event) { final List<Trace> traces = TraceHandler.INSTANCE.getTraces(); if (traces.size() <= 0) { return; } final EntityPlayerSP player = this.minecraft.player; if (player == null) { return; } this.playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks()); this.playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks()); this.playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks()); this.minecraft.mcProfiler.startSection("tracer"); render(traces); this.minecraft.mcProfiler.endSection(); }
@SideOnly(Side.CLIENT) @Override public void renderOverlay(RenderWorldLastEvent evt, EntityPlayerSP player, ItemStack wand) { MovingObjectPosition mouseOver = Minecraft.getMinecraft().objectMouseOver; if (mouseOver != null && mouseOver.getBlockPos() != null && mouseOver.sideHit != null) { IBlockState state = player.worldObj.getBlockState(mouseOver.getBlockPos()); Block block = state.getBlock(); if (block != null && block.getMaterial() != Material.air) { int meta = block.getMetaFromState(state); int wandId = Tools.getTagCompound(wand).getInteger("block"); Block wandBlock = Block.blockRegistry.getObjectById(wandId); int wandMeta = Tools.getTagCompound(wand).getInteger("meta"); if (wandBlock == block && wandMeta == meta) { return; } Set<BlockPos> coordinates = findSuitableBlocks(wand, player.worldObj, mouseOver.sideHit, mouseOver.getBlockPos(), block, meta); renderOutlines(evt, player, coordinates, 200, 230, 180); } } }
protected static void renderOutlines(RenderWorldLastEvent evt, EntityPlayerSP p, Set<BlockPos> coordinates, int r, int g, int b) { double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.partialTicks; double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.partialTicks; double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.partialTicks; GlStateManager.pushAttrib(); GlStateManager.disableDepth(); GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.pushMatrix(); GlStateManager.translate(-doubleX, -doubleY, -doubleZ); renderOutlines(coordinates, r, g, b, 4); GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
/** * Draws the highlighting for the block for which xray is enabled */ public void onEvent2(RenderWorldLastEvent event) { if (this.mc.world != null && this.xrayEnabled) { float f = event.getPartialTicks(); float px = (float) this.mc.player.posX; float py = (float) this.mc.player.posY; float pz = (float) this.mc.player.posZ; float mx = (float) this.mc.player.prevPosX; float my = (float) this.mc.player.prevPosY; float mz = (float) this.mc.player.prevPosZ; float dx = mx + (px - mx) * f; float dy = my + (py - my) * f; float dz = mz + (pz - mz) * f; drawOres(dx, dy, dz); } }
@SubscribeEvent public void worldRenderTick(RenderWorldLastEvent event) { if ( mc.world == null || !XRay.drawCaves ) return; float f = event.getPartialTicks(); // this is a world pos of the player pulseRender( (float)mc.player.prevPosX + ( (float)mc.player.posX - (float)mc.player.prevPosX ) * f, (float)mc.player.prevPosY + ( (float)mc.player.posY - (float)mc.player.prevPosY ) * f, (float)mc.player.prevPosZ + ( (float)mc.player.posZ - (float)mc.player.prevPosZ ) * f ); // XRay.drawCaves = !XRay.drawCaves; }
@SideOnly(Side.CLIENT) @Override public void renderOverlay(RenderWorldLastEvent evt, EntityClientPlayerMP player, ItemStack wand) { MovingObjectPosition mouseOver = Minecraft.getMinecraft().objectMouseOver; if (mouseOver != null) { World world = player.worldObj; int x = mouseOver.blockX; int y = mouseOver.blockY; int z = mouseOver.blockZ; Block block = world.getBlock(x, y, z); if (block != null && block.getMaterial() != Material.air) { Set<Coordinate> coordinates = findSuitableBlocks(wand, world, mouseOver.sideHit, x, y, z); renderOutlines(evt, player, coordinates, 200, 230, 180); } } }
@SideOnly(Side.CLIENT) @Override public void renderOverlay(RenderWorldLastEvent evt, EntityClientPlayerMP player, ItemStack wand) { MovingObjectPosition mouseOver = Minecraft.getMinecraft().objectMouseOver; if (mouseOver != null) { Block block = player.worldObj.getBlock(mouseOver.blockX, mouseOver.blockY, mouseOver.blockZ); if (block != null && block.getMaterial() != Material.air) { int meta = player.worldObj.getBlockMetadata(mouseOver.blockX, mouseOver.blockY, mouseOver.blockZ); int wandId = Tools.getTagCompound(wand).getInteger("block"); Block wandBlock = (Block) Block.blockRegistry.getObjectById(wandId); int wandMeta = Tools.getTagCompound(wand).getInteger("meta"); if (wandBlock == block && wandMeta == meta) { return; } Set<Coordinate> coordinates = findSuitableBlocks(wand, player.worldObj, mouseOver.sideHit, mouseOver.blockX, mouseOver.blockY, mouseOver.blockZ, block, meta); renderOutlines(evt, player, coordinates, 200, 230, 180); } } }
protected static void renderOutlines(RenderWorldLastEvent evt, EntityClientPlayerMP p, Set<Coordinate> coordinates, int r, int g, int b) { double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.partialTicks; double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.partialTicks; double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.partialTicks; GL11.glPushAttrib(GL11.GL_CURRENT_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT | GL11.GL_TEXTURE_BIT); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslated(-doubleX, -doubleY, -doubleZ); renderOutlines(coordinates, r, g, b, 4); GL11.glPopMatrix(); GL11.glPopAttrib(); }
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { if(Blocksteps.config.waypointRenderInWorld == 1 && !Blocksteps.eventHandler.hideWaypoints) { Minecraft mc = Minecraft.getMinecraft(); RenderManager renderManager = mc.getRenderManager(); ArrayList<Waypoint> points = Blocksteps.eventHandler.getWaypoints(mc.theWorld.provider.getDimension()); Blocksteps.eventHandler.renderingMinimap = true; for(Waypoint wp : points) { double dx = mc.thePlayer.posX - (wp.pos.getX() + 0.5D); double dz = mc.thePlayer.posZ - (wp.pos.getZ() + 0.5D); double dist = Math.sqrt(dx * dx + dz * dz); if(wp.renderRange == 0 || dist < wp.renderRange) { wp.render(renderManager.renderPosX, renderManager.renderPosY, renderManager.renderPosZ, event.getPartialTicks(), true); } } GlStateManager.disableLighting(); //rendering the WP enables lighting. Disable it. Blocksteps.eventHandler.renderingMinimap = false; } }
@SubscribeEvent public void renderAllTip(RenderWorldLastEvent event) { mc.renderEngine.bindTexture(TipTexture); EntityPlayerSP player = mc.player; playerX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks(); playerY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks(); playerZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks(); eyeHeight = player.eyeHeight; GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); renderTipBlock(player, event); renderTipEntity(player, event); GL11.glPopMatrix(); }
@SubscribeEvent public void render(RenderWorldLastEvent e) { Iterator<PlaybackPlayer> it = players.iterator(); while(it.hasNext()) { PlaybackPlayer player = it.next(); if (player.isDead) { it.remove(); } RenderManager.instance.renderEntitySimple(player, e.partialTicks); } }
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (!Minecraft.isGuiEnabled()) return; EntityLivingBase cameraEntity = mc.renderViewEntity; Vec3 renderingVector = cameraEntity.getPosition(event.partialTicks); Frustrum frustrum = new Frustrum(); double viewX = cameraEntity.lastTickPosX + (cameraEntity.posX - cameraEntity.lastTickPosX) * event.partialTicks; double viewY = cameraEntity.lastTickPosY + (cameraEntity.posY - cameraEntity.lastTickPosY) * event.partialTicks; double viewZ = cameraEntity.lastTickPosZ + (cameraEntity.posZ - cameraEntity.lastTickPosZ) * event.partialTicks; frustrum.setPosition(viewX, viewY, viewZ); List<Entity> loadedEntities = mc.theWorld.getLoadedEntityList(); for (Entity entity : loadedEntities) { if (entity != null && entity instanceof EntityLivingBase && entity.isInRangeToRender3d(renderingVector.xCoord, renderingVector.yCoord, renderingVector.zCoord) && (entity.ignoreFrustumCheck || frustrum.isBoundingBoxInFrustum(entity.boundingBox)) && entity.isEntityAlive()) { renderHealthBar((EntityLivingBase) entity, event.partialTicks, cameraEntity); } } }
@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)); } } } }
@SubscribeEvent public void onRenderWorld(RenderWorldLastEvent event){ EntityPlayer p = Minecraft.getMinecraft().thePlayer; if (PlayerDataUtils.shouldRenderClaims(p)){ for (Claim claim : ClaimsList.For(Minecraft.getMinecraft().theWorld).getClaimsForPlayer(p, PermissionsMutex.ALL_FLAGS, true)){ if (AABBUtils.AABBIsWithinRange(claim.getBounds(), new Vec3(p.posX, p.posY, p.posZ), 32)){ GL11.glPushMatrix(); GL11.glTranslated(-(p.prevPosX + (p.posX - p.prevPosX) * event.partialTicks), -(p.prevPosY + (p.posY - p.prevPosY) * event.partialTicks), -(p.prevPosZ + (p.posZ - p.prevPosZ) * event.partialTicks)); RenderUtils.renderBoundingBox(claim.getBounds(), 0x00FF00, 0x000000); GL11.glPopMatrix(); } } } }
private void drawArm(RenderWorldLastEvent evt, final EntityPlayer player) { final TextureManager tex = Minecraft.getMinecraft().getTextureManager(); tex.bindTexture(texture); GlStateManager.color(1, 1, 1); GlStateManager.disableLighting(); GL11.glPushMatrix(); // values adjusted to roughly match TPP crane position GL11.glRotated(-player.rotationYaw, 0, 1, 0); GL11.glTranslatef(0, player.getEyeHeight() + 1.6f, -1f); arm.rotateAngleY = 0; arm.render(1.0f / 16.0f); GL11.glPopMatrix(); GlStateManager.enableLighting(); }
@SubscribeEvent public void onRenderWorldLast(final RenderWorldLastEvent event) { final EntityPlayerSP player = this.minecraft.player; if (player != null) { this.playerPosition.x = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks(); this.playerPosition.y = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks(); this.playerPosition.z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks(); this.profiler.startSection("laserlevel"); GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); render(player); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); this.profiler.endSection(); } }
@SubscribeEvent public void onRender(final RenderWorldLastEvent event) { if (this.isUsingBow) { final EntityPlayerSP player = this.minecraft.thePlayer; if (player != null) { this.playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks); this.playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks); this.playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks); if (!compile(player)) { return; } render(); } } }
@SubscribeEvent public void renderWorldLast(RenderWorldLastEvent event){ if (sel != null && !sel.isEmpty() && mc.thePlayer.dimension == sel.getDimension()) { if (sel.isEntitySelection()) drawBoundingBox(event.context, event.partialTicks, sel.getSelectedEntity()); else if (sel.isTileSelection()) drawBoundingBox(event.context, event.partialTicks, sel.getSelectedTile()); else if (sel.getCorner2() == null) //aabb = corner1 aabb drawBoundingBox(event.context, event.partialTicks, aabb, Utils.CORNER1_SETTINGS); else { drawBoundingBox(event.context, event.partialTicks, aabb); drawBoundingBox(event.context, event.partialTicks, sel.getCorner1().getAABB().expand(XPAN, XPAN, XPAN), Utils.CORNER1_SETTINGS); drawBoundingBox(event.context, event.partialTicks, sel.getCorner2().getAABB().expand(XPAN, XPAN, XPAN), Utils.CORNER2_SETTINGS); for (Entity e : entities) drawBoundingBox(event.context, event.partialTicks, e); for (TileEntity t : tiles) drawBoundingBox(event.context, event.partialTicks, t); } } }
@SubscribeEvent public void onRender(@Nonnull RenderWorldLastEvent event) { Minecraft mc = Minecraft.getMinecraft(); Vector3d eye = Util.getEyePositionEio(mc.player); Vector3d lookAt = Util.getLookVecEio(mc.player); lookAt.add(eye); Matrix4d mv = VecmathUtil.createMatrixAsLookAt(eye, lookAt, new Vector3d(0, 1, 0)); float fov = Minecraft.getMinecraft().gameSettings.fovSetting; Matrix4d pr = VecmathUtil.createProjectionMatrixAsPerspective(fov, 0.05f, mc.gameSettings.renderDistanceChunks * 16, mc.displayWidth, mc.displayHeight); currentView.setProjectionMatrix(pr); currentView.setViewMatrix(mv); currentView.setViewport(0, 0, mc.displayWidth, mc.displayHeight); fovRad = Math.toRadians(fov); tanFovRad = Math.tanh(fovRad); }
@SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent event) { if (!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) return; Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.player; double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks(); double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks(); double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks(); GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) { 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.getPartialTicks()); } GL11.glEnable(GL11.GL_TEXTURE_2D); } } } GL11.glPopMatrix(); }
@SuppressWarnings({"rawtypes", "unchecked"}) @SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent event) { Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.player; double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks(); double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks(); double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks(); GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); RenderHelper.enableStandardItemLighting(); for (Map<BlockPos, List<ISemiBlock>> map : SemiBlockManager.getInstance(player.world).getSemiBlocks().values()) { for (List<ISemiBlock> semiBlocks : map.values()) { for(ISemiBlock semiBlock : semiBlocks){ ISemiBlockRenderer renderer = getRenderer(semiBlock); if (renderer != null) { GL11.glPushMatrix(); GL11.glTranslated(semiBlock.getPos().getX(), semiBlock.getPos().getY(), semiBlock.getPos().getZ()); renderer.render(semiBlock, event.getPartialTicks()); GL11.glPopMatrix(); } } } } RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); }
@SubscribeEvent public void lastRender(RenderWorldLastEvent event) { if(!Minecraft.getMinecraft().player.capabilities.isCreativeMode && !Minecraft.getMinecraft().player.isSpectator()) return; ArrayList<BlockPos> nonRemovedPlates = new ArrayList<>(); int time = platePositions.size(); for(int i = 0; i < time; i++) if(Minecraft.getMinecraft().world.getBlockState(platePositions.get(i)).getBlock() instanceof HarshenDimensionalFlatPlate) nonRemovedPlates.add(renderAt(platePositions.get(i), event.getPartialTicks())); platePositions = nonRemovedPlates; }
@HarshenEvent public void renderWorldLast(RenderWorldLastEvent event) { for(BlockPos finalPos : finalBlockPos) if(net.minecraft.client.Minecraft.getMinecraft().world.getBlockState(finalPos).getBlock() != Blocks.AIR) HarshenClientUtils.renderGhostBlock(net.minecraft.client.Minecraft.getMinecraft().world.getBlockState(finalPos), finalPos, true, event.getPartialTicks()); }
@SubscribeEvent public void renderWorldLast(RenderWorldLastEvent event) { EntityPlayer player = net.minecraft.client.Minecraft.getMinecraft().player; for(Entity e : player.world.getLoadedEntityList()) if(e instanceof EntityThrown) Minecraft.getMinecraft().getRenderManager().renderEntityStatic(e, event.getPartialTicks(), false); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onRenderAfterWorld(RenderWorldLastEvent event){ if (Melodium.proxy instanceof ClientProxy && Minecraft.getMinecraft().player != null){ GlStateManager.pushMatrix(); ClientProxy.particleRenderer.renderParticles(Minecraft.getMinecraft().player, event.getPartialTicks()); GlStateManager.popMatrix(); } }
public static void showFoundInventories(RenderWorldLastEvent evt) { if (!foundPositions.isEmpty()) { if (System.currentTimeMillis() > time) { foundPositions.clear(); time = -1; return; } renderBlocks(evt, foundPositions); } }
@SubscribeEvent public void renderBlockBreakAnim(RenderWorldLastEvent event) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); this.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getBuffer(), this.mc.getRenderViewEntity(), event.getPartialTicks()); this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableBlend(); }