Jump to content

[1.15.2] Isometric View


quinn50

Recommended Posts

So I am currently working on a Action RPG hack and slash mod for 1.15.2 and I have having trouble figuring out how to create an isometric view in 1.15.2. I have looked at other mods such as mineshot and shoulder surfing reloaded and I have figured out how to modify the position of the player camera using reflection (ActiveRenderInfo has some methods and fields with access modifiers protected and private. I have tried doing some openGL things but I couldn't figure that out. I also need to figure out how restrict the player from looking up and down. 

 

Code for my cameraSetup event handler

Spoiler

@SubscribeEvent(   priority = EventPriority.LOWEST,
            receiveCanceled = true)
    public void onCameraSetup(EntityViewRenderEvent.CameraSetup event){


        if(Minecraft.getInstance().gameSettings.thirdPersonView == 1){
            final ActiveRenderInfo info = event.getInfo();

            float prev = ObfuscationReflectionHelper.getPrivateValue(ActiveRenderInfo.class, info, "previousHeight");
            float height = ObfuscationReflectionHelper.getPrivateValue(ActiveRenderInfo.class, info, "height");

            double x = MathHelper.lerp(event.getRenderPartialTicks(), info.getRenderViewEntity().prevPosX, info.getRenderViewEntity().getPosX());
            double y = MathHelper.lerp(event.getRenderPartialTicks(), info.getRenderViewEntity().prevPosY, info.getRenderViewEntity().getPosY()) + MathHelper.lerp(event.getRenderPartialTicks(), prev, height);
            double z = MathHelper.lerp(event.getRenderPartialTicks(), info.getRenderViewEntity().prevPosZ, info.getRenderViewEntity().getPosZ());

            try{
                Method setPosition =  ObfuscationReflectionHelper.findMethod(ActiveRenderInfo.class, "setPosition", double.class, double.class, double.class);
                Method movePosition = ObfuscationReflectionHelper.findMethod(ActiveRenderInfo.class, "movePosition", double.class, double.class, double.class);
                Method setDirection = ObfuscationReflectionHelper.findMethod(ActiveRenderInfo.class, "setDirection", float.class, float.class);
                setPosition.invoke(info, x, y, z);


              //  setDirection.invoke(info, xRot + 180.0F, -328);
                movePosition.invoke(info, -10, 2, -1);

            }catch (Exception e){
                e.printStackTrace();
            }


        }



    }

 



 

 

Edited by quinn50
Link to comment
Share on other sites

Note that you also shouldn't look up methods via reflection every time the camera updates.

Look them up once, and store them in a static field.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

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.