public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { return true; } else if (livingEntity.getLeashed() && livingEntity.getLeashedToEntity() != null) { Entity entity = livingEntity.getLeashedToEntity(); return camera.isBoundingBoxInFrustum(entity.getEntityBoundingBox()); } else { return false; } }
public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { return true; } else if (livingEntity.getLeashed() && livingEntity.getLeashedToEntity() != null) { Entity entity = livingEntity.getLeashedToEntity(); return camera.isBoundingBoxInFrustum(entity.getRenderBoundingBox()); } else { return false; } }
public boolean shouldRender(EntityShulker livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { return true; } else { if (livingEntity.getClientTeleportInterp() > 0 && livingEntity.isAttachedToBlock()) { BlockPos blockpos = livingEntity.getOldAttachPos(); BlockPos blockpos1 = livingEntity.getAttachmentPos(); Vec3d vec3d = new Vec3d((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); Vec3d vec3d1 = new Vec3d((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord, vec3d.zCoord))) { return true; } } return false; } }
private void checkLoadVisibleChunks(Entity p_checkLoadVisibleChunks_1_, float p_checkLoadVisibleChunks_2_, ICamera p_checkLoadVisibleChunks_3_, boolean p_checkLoadVisibleChunks_4_) { if (this.loadVisibleChunks) { this.loadVisibleChunks = false; this.loadAllVisibleChunks(p_checkLoadVisibleChunks_1_, (double)p_checkLoadVisibleChunks_2_, p_checkLoadVisibleChunks_3_, p_checkLoadVisibleChunks_4_); } if (Keyboard.isKeyDown(61) && Keyboard.isKeyDown(38)) { this.loadVisibleChunks = true; TextComponentString textcomponentstring = new TextComponentString(I18n.format("of.message.loadingVisibleChunks", new Object[0])); this.mc.ingameGUI.getChatGUI().printChatMessage(textcomponentstring); Reflector.Minecraft_actionKeyF3.setValue(this.mc, Boolean.TRUE); } }
@SideOnly(Side.CLIENT) void visitChain(ICamera camera, float partial, ChainRender cr) { // This is far from efficient as it ought to be. // If the line is diagonal, then there will be huge amounts of // space where the line is drawn even tho it is far off-screen. if (start == null) return; Vec3 s = getStart(partial); Vec3 e = getEnd(partial); // The lines are drawn fat, so make the box a bit fatter as well final double d = 0.125; AxisAlignedBB box = SpaceUtil.newBoxSort(s, e).expand(d, d, d); if (camera.isBoundingBoxInFrustum(box)) { cr.drawChain(s, e, partial); } }
private static void refreshCamera() { Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); if(entity == null) return; float partialTicks = Animation.getPartialTickTime(); ICamera newCam = new Frustum(); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks; newCam.setPosition(d0, d1, d2); cameraX = d0; cameraY = d1; cameraZ = d2; camera = newCam; }
public boolean shouldRender(EntityGuardian livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { return true; } else { if (livingEntity.hasTargetedEntity()) { EntityLivingBase entitylivingbase = livingEntity.getTargetedEntity(); if (entitylivingbase != null) { Vec3 vec3 = this.func_177110_a(entitylivingbase, (double)entitylivingbase.height * 0.5D, 1.0F); Vec3 vec31 = this.func_177110_a(livingEntity, (double)livingEntity.getEyeHeight(), 1.0F); if (camera.isBoundingBoxInFrustum(AxisAlignedBB.fromBounds(vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord, vec3.zCoord))) { return true; } } } return false; } }
public boolean shouldRender(EntityGuardian livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender((EntityLiving)livingEntity, camera, camX, camY, camZ)) { return true; } else { if (livingEntity.hasTargetedEntity()) { EntityLivingBase entitylivingbase = livingEntity.getTargetedEntity(); if (entitylivingbase != null) { Vec3 vec3 = this.func_177110_a(entitylivingbase, (double)entitylivingbase.height * 0.5D, 1.0F); Vec3 vec31 = this.func_177110_a(livingEntity, (double)livingEntity.getEyeHeight(), 1.0F); if (camera.isBoundingBoxInFrustum(AxisAlignedBB.fromBounds(vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord, vec3.zCoord))) { return true; } } } return false; } }
public boolean shouldRender(EntityGuardian livingEntity, ICamera camera, double camX, double camY, double camZ) { if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) { return true; } else { if (livingEntity.hasTargetedEntity()) { EntityLivingBase entitylivingbase = livingEntity.getTargetedEntity(); if (entitylivingbase != null) { Vec3d vec3d = this.getPosition(entitylivingbase, (double)entitylivingbase.height * 0.5D, 1.0F); Vec3d vec3d1 = this.getPosition(livingEntity, (double)livingEntity.getEyeHeight(), 1.0F); if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord, vec3d.zCoord))) { return true; } } } return false; } }
private boolean isOutlineActive(Entity p_184383_1_, Entity p_184383_2_, ICamera p_184383_3_) { if(Hacks.findMod(OutlineESP.class).isEnabled()) return true; boolean flag = p_184383_2_ instanceof EntityLivingBase && ((EntityLivingBase)p_184383_2_).isPlayerSleeping(); return p_184383_1_ == p_184383_2_ && this.mc.gameSettings.thirdPersonView == 0 && !flag ? false : (p_184383_1_.isGlowing() ? true : (this.mc.player.isSpectator() && this.mc.gameSettings.keyBindSpectatorOutlines.isKeyDown() && p_184383_1_ instanceof EntityPlayer ? p_184383_1_.ignoreFrustumCheck || p_184383_3_.isBoundingBoxInFrustum(p_184383_1_.getEntityBoundingBox()) || p_184383_1_.isRidingOrBeingRiddenBy(this.mc.player) : false)); }
@SubscribeEvent public void drawChains(RenderWorldLastEvent event) { if (chains.isEmpty()) return; final float partial = event.partialTicks; final ICamera camera = getFrustum(partial); final Minecraft mc = Minecraft.getMinecraft(); final EntityRenderer er = mc.entityRenderer; final TextureManager textureManager = mc.getTextureManager(); setup = false; world = mc.theWorld; for (WeakReference<ChainLink> ref : chains) { ChainLink chain = ref.get(); if (chain == null) { needsRebag = true; continue; } chain.visitChain(camera, partial, this); } if (!setup) { cleanup(); return; } GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT ); textureManager.bindTexture(new ResourceLocation("factorization", "textures/chain.png")); er.enableLightmap(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); tessI.draw(); er.disableLightmap(); GL11.glPopAttrib(); textureManager.bindTexture(Core.blockAtlas); cleanup(); }
ICamera getFrustum(float partial) { // Unfortunately we have to make our own Frustum. final Minecraft mc = Minecraft.getMinecraft(); final Entity eye = mc.getRenderViewEntity(); double eyeX = eye.lastTickPosX + (eye.posX - eye.lastTickPosX) * (double)partial; double eyeY = eye.lastTickPosY + (eye.posY - eye.lastTickPosY) * (double)partial; double eyeZ = eye.lastTickPosZ + (eye.posZ - eye.lastTickPosZ) * (double)partial; Frustum frustum = new Frustum(); // Notch can't spell frustum.setPosition(eyeX, eyeY, eyeZ); return frustum; }
@Override public void setupTerrain(Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator) { if (Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player instanceof EntityPlayerSP) super.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator || ((EntityPlayerSP) Minecraft.getMinecraft().player).getOverrideNoclip()); else super.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator); }
public void updateInFrustum(ICamera par1ICamera) { this.isInFrustum = par1ICamera.isBoundingBoxInFrustum(this.rendererBoundingBox); if (this.isInFrustum && Config.isOcclusionFancy()) { this.isInFrustrumFully = par1ICamera.isBoundingBoxInFrustumFully(this.rendererBoundingBox); } else { this.isInFrustrumFully = false; } }
/** * Checks all renderers that previously weren't in the frustum and 1/16th of those that previously were in the * frustum for frustum clipping Args: frustum, partialTickTime */ public void clipRenderersByFrustum(ICamera par1ICamera, float par2) { for (int var3 = 0; var3 < this.countSortedWorldRenderers; ++var3) { WorldRenderer wr = this.sortedWorldRenderers[var3]; if (!wr.skipAllRenderPasses()) { wr.updateInFrustum(par1ICamera); } } }
public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) { AxisAlignedBB axisalignedbb = livingEntity.getRenderBoundingBox().expandXyz(0.5D); if (axisalignedbb.hasNaN() || axisalignedbb.getAverageEdgeLength() == 0.0D) { axisalignedbb = new AxisAlignedBB(livingEntity.posX - 2.0D, livingEntity.posY - 2.0D, livingEntity.posZ - 2.0D, livingEntity.posX + 2.0D, livingEntity.posY + 2.0D, livingEntity.posZ + 2.0D); } return livingEntity.isInRangeToRender3d(camX, camY, camZ) && (livingEntity.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(axisalignedbb)); }
public void clipRenderersByFrustum(ICamera p_72729_1_, float p_72729_2_) { for (int i = 0; i < this.worldRenderers.length; ++i) { if (!this.worldRenderers[i].skipAllRenderPasses() && (!this.worldRenderers[i].isInFrustum || (i + this.frustumCheckOffset & 15) == 0)) { this.worldRenderers[i].updateInFrustum(p_72729_1_); } } ++this.frustumCheckOffset; }
public void func_72729_a(ICamera p_72729_1_, float p_72729_2_) { for(int var3 = 0; var3 < this.field_72765_l.length; ++var3) { if(!this.field_72765_l[var3].func_78906_e() && (!this.field_72765_l[var3].field_78927_l || (var3 + this.field_72757_g & 15) == 0)) { this.field_72765_l[var3].func_78908_a(p_72729_1_); } } ++this.field_72757_g; }
/** * Checks all renderers that previously weren't in the frustum and 1/16th of those that previously were in the * frustum for frustum clipping Args: frustum, partialTickTime */ public void clipRenderersByFrustum(ICamera par1ICamera, float par2) { for (int i = 0; i < this.worldRenderers.length; ++i) { if (!this.worldRenderers[i].skipAllRenderPasses() && (!this.worldRenderers[i].isInFrustum || (i + this.frustumCheckOffset & 15) == 0)) { this.worldRenderers[i].updateInFrustum(par1ICamera); } } ++this.frustumCheckOffset; }
@Override public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) { super.renderEntities(renderViewEntity, camera, partialTicks); }
@Override public void setupTerrain(Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator) { super.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator); }
public boolean shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ) { Render<Entity> render = this.<Entity>getEntityRenderObject(entityIn); return render != null && render.shouldRender(entityIn, camera, camX, camY, camZ); }
public static void setupTerrain(RenderGlobal renderGlobal, Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator) { renderGlobal.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator); }
public boolean shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ) { Render render = this.getEntityRenderObject(entityIn); return render != null && render.shouldRender(entityIn, camera, camX, camY, camZ); }
public static void setFrustrumPosition(ICamera frustum, double x, double y, double z) { frustum.setPosition(x, y, z); }
private void loadAllVisibleChunks(Entity p_loadAllVisibleChunks_1_, double p_loadAllVisibleChunks_2_, ICamera p_loadAllVisibleChunks_4_, boolean p_loadAllVisibleChunks_5_) { RenderGlobal renderglobal = Config.getRenderGlobal(); int i = renderglobal.getCountLoadedChunks(); long j = System.currentTimeMillis(); Config.dbg("Loading visible chunks"); long k = System.currentTimeMillis() + 5000L; int l = 0; boolean flag = false; while (true) { flag = false; for (int i1 = 0; i1 < 100; ++i1) { renderglobal.displayListEntitiesDirty = true; renderglobal.setupTerrain(p_loadAllVisibleChunks_1_, p_loadAllVisibleChunks_2_, p_loadAllVisibleChunks_4_, this.frameCount++, p_loadAllVisibleChunks_5_); if (!renderglobal.hasNoChunkUpdates()) { flag = true; } l = l + renderglobal.getCountChunksToUpdate(); renderglobal.updateChunks(System.nanoTime() + 1000000000L); l = l - renderglobal.getCountChunksToUpdate(); } if (renderglobal.getCountLoadedChunks() != i) { flag = true; i = renderglobal.getCountLoadedChunks(); } if (System.currentTimeMillis() > k) { Config.log("Chunks loaded: " + l); k = System.currentTimeMillis() + 5000L; } if (!flag) { break; } } Config.log("Chunks loaded: " + l); Config.log("Finished loading visible chunks"); RenderChunk.renderChunksUpdated = 0; }