Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void drawEntityOnScreen(PoseStack stackIn, int posX, int posY, float scale, boolean follow, double xRot, double yRot, double zRot, float mouseX, float mouseY, Entity entity) {
- float customYaw = posX - mouseX;
- float customPitch = posY - mouseY;
- float f = (float) Math.atan(customYaw / 40.0F);
- float f1 = (float) Math.atan(customPitch / 40.0F);
- RenderSystem.applyModelViewMatrix();
- PoseStack posestack1 = new PoseStack();
- posestack1.translate(posX, posY, 120.0D);
- posestack1.scale(scale, scale, scale);
- Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
- Quaternion quaternion1 = Vector3f.XP.rotationDegrees(follow ? -f1 * 20.0F : 0.0F);
- quaternion.mul(quaternion1);
- posestack1.mulPose(quaternion);
- posestack1.mulPose(Vector3f.XP.rotationDegrees((float) xRot));
- posestack1.mulPose(Vector3f.YP.rotationDegrees((float) yRot - 270F));
- posestack1.mulPose(Vector3f.ZP.rotationDegrees((float) zRot));
- if (follow) {
- float yaw = -f * 20.0F - (float) yRot;
- entity.setYRot(yaw);
- entity.setXRot(f1 * 20.0F);
- if (entity instanceof LivingEntity) {
- ((LivingEntity) entity).yBodyRot = yaw;
- ((LivingEntity) entity).yBodyRotO = yaw;
- ((LivingEntity) entity).yHeadRot = yaw;
- ((LivingEntity) entity).yHeadRotO = yaw;
- }
- quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
- quaternion.mul(quaternion1);
- }
- Lighting.setupForEntityInInventory();
- EntityRenderDispatcher entityrenderdispatcher = Minecraft.getInstance().getEntityRenderDispatcher();
- quaternion1.conj();
- entityrenderdispatcher.overrideCameraOrientation(quaternion1);
- entityrenderdispatcher.setRenderShadow(true);
- MultiBufferSource.BufferSource multibuffersource$buffersource = Minecraft.getInstance().renderBuffers().bufferSource();
- RenderSystem.runAsFancy(() -> entityrenderdispatcher.render(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, posestack1, multibuffersource$buffersource, 15728880));
- multibuffersource$buffersource.endBatch();
- entityrenderdispatcher.setRenderShadow(false);
- entity.setYRot(0);
- entity.setXRot(0);
- if (entity instanceof LivingEntity) {
- ((LivingEntity) entity).yBodyRot = 0;
- ((LivingEntity) entity).yHeadRotO = 0;
- ((LivingEntity) entity).yHeadRot = 0;
- }
- RenderSystem.applyModelViewMatrix();
- Lighting.setupFor3DItems();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement