Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • Fastfund recovery helps an individual to get back their scammed funds irrespective of nationality, Romance scam funds and Broker's scam, all kinds of scam funds are 100% accurately recovered without disappointment, their goal is to give all those who seek help to recover lost satisfaction of funds recovery within 72 hours After countless hours of research and desperate attempts to find a solution, I stumbled upon FASTFUND RECOVERY. It was like finding an oasis in the middle of a desert. Their website promised to help victims of scams reclaim what was rightfully theirs, and I instantly knew I had to give them a shot. Before diving headfirst into the recovery process, I wanted to make sure that FASTFUND RECOVERY was the real deal. So, I did my due diligence and looked into their expertise and reputation. To my relief, I found that they had an impeccable track record, successfully assisting countless individuals in recovering their lost funds. Their team consisted of experts in cybersecurity and financial fraud, armed with the knowledge and tools needed to tackle even the most intricate scams. With their reputation preceding them, I felt a renewed sense of hope. FASTFUND RECOVERY successfully came to my aid and got back the amount I lost to these scammers and for this, I am sending this article for clarification. The info of FASTFUND RECOVERY is email: Fastfundrecovery8 (@)Gmail (.) com. Web fastfundrecovery(.)com. (W/A 1 807/500/7554)
  • Topics

×
×
  • Create New...

Important Information

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