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.

[1.15.1][Solved] Issue with overriding a model via 'RenderLivingEvent'

Featured Replies

Posted

So I'm trying to override the Players/an Entity model and render a new mob in its place. Everything work except the light mapping for the model. This same thing was used in 1.12, and I have messed with a lot of GL states to try and fix it. But so far no fix. I know a lot has changed in 1.15 with rendering from what I have read. And wonder if there is anything I can actually fix or I just have to wait. Image below. Code below that. 

 

Skeleton on the left is my player with the new model rendered over it. 

 

Spoiler

image.png.d89062d40af2e7059e0daa14193c8373.png

 

private static IRenderTypeBuffer Impl = IRenderTypeBuffer.func_228455_a_(new BufferBuilder(256));;

@SubscribeEvent
	public static void renderFakeEntity(RenderLivingEvent.Pre e) {
		
		if(e.getEntity() instanceof PlayerEntity) {
			e.setCanceled(true);

			//This is just for testing atm. Later will be handled differently
			SkeletonEntity newentity = new SkeletonEntity(EntityType.SKELETON, e.getEntity().getEntityWorld());
			
			int x = e.getEntity().getPosition().getX();
			int y = e.getEntity().getPosition().getY();
			int z = e.getEntity().getPosition().getZ();
			
			newentity.setPosition(x, y, z);
			newentity.rotationYawHead = e.getEntity().rotationYawHead;
			newentity.rotationYaw = e.getEntity().rotationYaw;
			newentity.rotationPitch = e.getEntity().rotationPitch;
			newentity.prevRotationPitch = e.getEntity().prevRotationPitch;
			newentity.prevRotationYaw = e.getEntity().prevRotationYaw;
			newentity.prevRotationYawHead = e.getEntity().prevRotationYawHead;
			newentity.prevRenderYawOffset = e.getEntity().prevRenderYawOffset;
			newentity.swingProgress = e.getEntity().swingProgress;
			newentity.limbSwing = e.getEntity().limbSwing;
			newentity.swingProgressInt = e.getEntity().swingProgressInt;
			newentity.limbSwingAmount = e.getEntity().limbSwingAmount;
			newentity.prevLimbSwingAmount = e.getEntity().prevLimbSwingAmount;
			newentity.setMotion(e.getEntity().getMotion());
			newentity.ticksExisted = e.getEntity().ticksExisted;
			newentity.prevPosX = e.getEntity().prevPosX;
			newentity.prevPosY = e.getEntity().prevPosY;
			newentity.prevPosZ = e.getEntity().prevPosZ;
			
			newentity.setHeldItem(Hand.MAIN_HAND, e.getEntity().getHeldItemMainhand());
			newentity.setCustomNameVisible(true);
//			Minecraft.getInstance().getRenderManager().func_229085_a_(e.getEntity(), e.getPartialRenderTick());
			Minecraft.getInstance().getRenderManager().func_229084_a_(newentity, 0, 0, 0, 0f, 0F,e.getMatrixStack(), Impl, 200);
		}
	}

 

 

The last Integer that is suppose to change the font color (from what I can tell), but seems to change the brightness of the whole model as well, 0 the skeleton is dark, 200-256 is bright. The world light level seems to affect it slightly, but block light levels do not seem to as much. The picture shown above is set with the 200 value.   

 

Minecraft.getInstance().getRenderManager().func_229084_a_(newentity, 0, 0, 0, 0f, 0F,e.getMatrixStack(), Impl, 200);

 

Edited by gendeathrow
Better explain the last couple of sentences.

  • Author

Alright after some searching thru all the function back finally realized that what I had thought was font color was something different. oh well I got the fix here. Hopefully this will help anyone else out with this. If I can remember I update this when the mappings get updated I will.  

 

 

EntityRendererManager rendermanager = Minecraft.getInstance().getRenderManager();
rendermanager.func_229084_a_(newentity, 0, 0, 0, 0f, 0F,e.getMatrixStack(), Impl, rendermanager.func_229085_a_(newentity, e.getPartialRenderTick()));

 

Edited by gendeathrow

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.