Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm trying to set the Camera Height and Bounding box of the player. That's all working, but after I changed the bounding box the player get's a 'black tint'. This is because I am using player.yOffset to change the camera height. I can't see any ways around this. If you could help me I would be very grateful.

 

Here's my code:

 

package gegy1000.warriors.client.renderer;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.player.EntityPlayer;

import org.lwjgl.opengl.GL11;

public class CustomEntityRenderer extends EntityRenderer
{
private final Minecraft mc;

float offsetY = -1.05F;

public CustomEntityRenderer(Minecraft mc)
{
	super(mc, mc.getResourceManager());
	this.mc = mc;
}

public void hurtCameraEffect(float p_78482_1_)
{
}

@Override
public void renderWorld(float p_78471_1_, long p_78471_2_)
{
	GL11.glRotatef(90, 1, 0, 0);
	GL11.glRotatef(90, 0, 1, 0);
	GL11.glRotatef(90, 0, 0, 1);
	super.renderWorld(p_78471_1_, p_78471_2_);
}

@Override
public void updateCameraAndRender(float partialTick)
{
	hurtCameraEffect(partialTick);

	EntityPlayer player = mc.thePlayer;

	if (player == null || player.isPlayerSleeping())
	{
		super.updateCameraAndRender(partialTick);
		return;
	}

	GL11.glRotatef(90, 1, 0, 0);

	player.yOffset -= offsetY;
	super.updateCameraAndRender(partialTick);
	player.yOffset = 1.62F;
}

@Override
public void getMouseOver(float partialTick)
{
	super.getMouseOver(partialTick);
}
}

 

	@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event)
{
	Minecraft mc = Minecraft.getMinecraft();

	if (mc.theWorld != null)
	{
		if(event.phase == Phase.START)
		{
			EntityClientPlayerMP player = mc.thePlayer;

			if (renderer == null)
			{
				renderer = new CustomEntityRenderer(mc);
			}
			if (mc.entityRenderer != renderer)
			{
				prevRenderer = mc.entityRenderer;
				mc.entityRenderer = renderer;
			}
		}
		else if(event.phase == Phase.END)
		{
		}
	}
}

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.