Jump to content

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


gendeathrow

Recommended Posts

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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