Posted September 15, 201312 yr Just a list of possible events that would allow more freedom while making mods - ItemBobbingEvent Located in EntityRenderer private void setupViewBobbing(float par1) { if (this.mc.renderViewEntity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)this.mc.renderViewEntity; float f1 = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified; float f2 = -(entityplayer.distanceWalkedModified + f1 * par1); float f3 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * par1; float f4 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * par1; if(!MinecraftForge.EVENT_BUS.post(new ItemBobbingEvent(entityplayer, f1, f2, f3, f4, par1))) { GL11.glTranslatef(MathHelper.sin(f2 * (float)Math.PI) * f3 * 0.5F, -Math.abs(MathHelper.cos(f2 * (float)Math.PI) * f3), 0.0F); GL11.glRotatef(MathHelper.sin(f2 * (float)Math.PI) * f3 * 3.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(Math.abs(MathHelper.cos(f2 * (float)Math.PI - 0.2F) * f3) * 5.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(f4, 1.0F, 0.0F, 0.0F); } } } would be used for custom item bobbing (such as swords moving more realistically) - OrientCameraEvent Located in EntityRenderer private void orientCamera(float par1) { EntityLivingBase entitylivingbase = this.mc.renderViewEntity; float f1 = entitylivingbase.yOffset - 1.62F; double d0 = entitylivingbase.prevPosX + (entitylivingbase.posX - entitylivingbase.prevPosX) * (double)par1; double d1 = entitylivingbase.prevPosY + (entitylivingbase.posY - entitylivingbase.prevPosY) * (double)par1 - (double)f1; double d2 = entitylivingbase.prevPosZ + (entitylivingbase.posZ - entitylivingbase.prevPosZ) * (double)par1; GL11.glRotatef(this.prevCamRoll + (this.camRoll - this.prevCamRoll) * par1, 0.0F, 0.0F, 1.0F); if (entitylivingbase.isPlayerSleeping()) { f1 = (float)((double)f1 + 1.0D); GL11.glTranslatef(0.0F, 0.3F, 0.0F); if (!this.mc.gameSettings.debugCamEnable) { ForgeHooksClient.orientBedCamera(mc, entitylivingbase); GL11.glRotatef(entitylivingbase.prevRotationYaw + (entitylivingbase.rotationYaw - entitylivingbase.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); GL11.glRotatef(entitylivingbase.prevRotationPitch + (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); } } else if(MinecraftForge.EVENT_BUS.post(new OrientCameraEvent(entitylivingbase, f1, d0, d1, d2, par1))) { ; } ... Used for interesting movements in the viewpoint camera (such as combat jolting/landing jolt) - SetupFogEvent / UpdateFogColorEvent Located in EntityRenderer private void updateFogColor(float par1) { WorldClient worldclient = this.mc.theWorld; EntityLivingBase entitylivingbase = this.mc.renderViewEntity; float f1 = 1.0F / (float)(4 - this.mc.gameSettings.renderDistance); f1 = 1.0F - (float)Math.pow((double)f1, 0.25D); Vec3 vec3 = worldclient.getSkyColor(this.mc.renderViewEntity, par1); float f2 = (float)vec3.xCoord; float f3 = (float)vec3.yCoord; float f4 = (float)vec3.zCoord; Vec3 vec31 = worldclient.getFogColor(par1); this.fogColorRed = (float)vec31.xCoord; this.fogColorGreen = (float)vec31.yCoord; this.fogColorBlue = (float)vec31.zCoord; float f5; if (this.mc.gameSettings.renderDistance < 2) { Vec3 vec32 = MathHelper.sin(worldclient.getCelestialAngleRadians(par1)) > 0.0F ? worldclient.getWorldVec3Pool().getVecFromPool(-1.0D, 0.0D, 0.0D) : worldclient.getWorldVec3Pool().getVecFromPool(1.0D, 0.0D, 0.0D); f5 = (float)entitylivingbase.getLook(par1).dotProduct(vec32); ... if (this.mc.gameSettings.anaglyph) { f9 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; f10 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; float f11 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; this.fogColorRed = f9; this.fogColorGreen = f10; this.fogColorBlue = f11; } UpdateFogColorEvent event = new UpdateFogColorEvent(fogColorRed, fogColorGreen, fogColorBlue, par1, mc); MinecraftForge.EVENT_BUS.post(event); fogColorRed = event.fogColorRed; fogColorGreen = event.fogColorGreen; fogColorBlue = event.fogColorBlue; GL11.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } private void setupFog(int par1, float par2) { EntityLivingBase entitylivingbase = this.mc.renderViewEntity; boolean flag = false; if (entitylivingbase instanceof EntityPlayer) { flag = ((EntityPlayer)entitylivingbase).capabilities.isCreativeMode; } if (par1 == 999) { GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); GL11.glFogf(GL11.GL_FOG_START, 0.0F); GL11.glFogf(GL11.GL_FOG_END, 8.0F); if (GLContext.getCapabilities().GL_NV_fog_distance) { GL11.glFogi(34138, 34139); } GL11.glFogf(GL11.GL_FOG_START, 0.0F); } else { GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); GL11.glNormal3f(0.0F, -1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int j = ActiveRenderInfo.getBlockIdAtEntityViewpoint(this.mc.theWorld, entitylivingbase, par2); float f1; if (entitylivingbase.isPotionActive(Potion.blindness)) { ... else if (this.cloudFog) { GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F); } else if(MinecraftForge.EVENT_BUS.post(new SetupFogEvent(this.farPlaneDistance, par1, par2, mc))) { ; } else if (j > 0 && Block.blocksList[j].blockMaterial == Material.water) { GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); if (entitylivingbase.isPotionActive(Potion.waterBreathing)) { GL11.glFogf(GL11.GL_FOG_DENSITY, 0.05F); } else { GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F - (float)EnchantmentHelper.getRespiration(entitylivingbase) * 0.03F); } } else if (j > 0 && Block.blocksList[j].blockMaterial == Material.lava) { GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); GL11.glFogf(GL11.GL_FOG_DENSITY, 2.0F); } Used for changing distance of fog in situations / color (such as having a blizzard with a closer fog line) - WeatherEvent Located in World public void updateWeatherBody() { if (!this.provider.hasNoSky) { if(MinecraftForge.EVENT_BUS.post(new WeatherEvent(this))) { return; } int i = this.worldInfo.getThunderTime(); if (i <= 0) { if (this.worldInfo.isThundering()) { this.worldInfo.setThunderTime(this.rand.nextInt(12000) + 3600); } else { this.worldInfo.setThunderTime(this.rand.nextInt(168000) + 12000); } } else { --i; this.worldInfo.setThunderTime(i); if (i <= 0) { this.worldInfo.setThundering(!this.worldInfo.isThundering()); } } Also, a hook for mod options for ingame changes, a hook for custom dimension loading screens, and finally a way to create 3D gui's would be nice. (I have the mod options files already, working on custom dimension loading screen code as well. The 3D gui's may be a little complicated but I can get that done.) I didn't really bother to sugar coat the whole thing, but I can certainly explain anything on this post. If possible, it would be very useful to have these events/hooks inside minecraft forge instead of creating my own separate api that really has no point. Thank you
September 15, 201312 yr Submit a pr to github. Read the EAQ before posting! OR ELSE! This isn't building better software, its trying to grab a place in the commit list of a highly visible github project. www.forgeessentials.com Don't PM me, I don't check this account unless I have to.
September 15, 201312 yr How about PlayerWakeUpEvent - pretty self-explanatory, but currently I use LivingUpdateEvent to check if the player is fully asleep instead. InventorySlotClick event would be useful for intercepting inventory interactions, for example if you have a spell that creates magic armor that you don't want the player to be able to remove or that destroys itself if clicked. http://i.imgur.com/NdrFdld.png[/img]
September 15, 201312 yr Author Well I have just finished a Slot Render Event, but couldn't you just use the container.java method of slotClick for the SlotClickEvent? Also, thanks for the PlayerWakingEvent Idea! If anyone could tell me how to do a pr (noob at github) then that would be awesome!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.