Jump to content

[1.12.2] How to correctly change camera position


Recursion

Recommended Posts

I am currently developing a mod that involves changing the camera position(without moving the player entity or creating another dummy entity).

 

I located the class net.minecraft.client.renderer.EntityRenderer, but found that, what minecraft does for rendering sleeping etc. is to translate/ rotate, which will, in my case, result in blocks getting culled if the camera is behind player.

 

Is there a way to directly change the camera position?

 

Thanks for helping!

Link to comment
Share on other sites

Minecraft#setRenderViewEntity does what you want, the entity doesn’t have to be registered. I know you said you didn’t want a dummy entity but this is the best solution. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

8 hours ago, Recursion said:

This approach is easy enough, but by setting renderViewEntity, I am not able to see my self anymore

You could probably just do the render call yourself in one of forges render events. Looking at why the player isn’t rendering (where the code is that disables it) would be a good start to deciding where to do the render call from.

6 hours ago, DWDev said:

I would check out the pixelmon mod (https://github.com/zyczu1/pixelmon/tree/master/src/main/java/com/pixelmonmod/pixelmon/client/camera). They use an entity for the camera as well.

Personally I don’t think that Pixelmon is a good source, I would look at the vanilla code to understand what is going on, then at the pixelmon code to see what they do and then I would write my own implementation.

  • Like 2

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

7 hours ago, Cadiboo said:

You could probably just do the render call yourself in one of forges render events. Looking at why the player isn’t rendering (where the code is that disables it) would be a good start to deciding where to do the render call from.

Personally I don’t think that Pixelmon is a good source, I would look at the vanilla code to understand what is going on, then at the pixelmon code to see what they do and then I would write my own implementation.

I will definitely try to render the player again. But can you explain why you would go for a dummy entity?

 

Right now i am still weighing the two approaches:

 

1. Making another dummy entity and setViewEntity to this one.

 

2. Inspect how vanilla does the rendering and make opengl calls somewhere sensible 

 

and sort of trying both of them. Regarding the 2nd one, i was able to translate camera(by gl calls) to a certain position in the world after the forge rotation in orientCamera(), but that messed up how the camera rotates(It doesnt rotate about the new position, which makes sense, i guess). But I'm not sure how to fix it.

Link to comment
Share on other sites

45 minutes ago, Recursion said:

But can you explain why you would go for a dummy entity?

Compatibility, maintainability etc. A dummy entity is pretty much already supported by all mods and this approach is very unlikely to need major changes each minecraft update.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Selamat datang di IDRkasino salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor IDRkasino ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini IDRkasino.
    • Selamat datang di Rajabonanza88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor Rajabonanza88 ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Rajabonanza88.
    • A code: public class CommonProxy {     public void registerItemRenderer() {         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory")         );         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory"),                 new CustomItemRenderer(Minecraft.getMinecraft().getTextureManager(), Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(), Minecraft.getMinecraft().getItemColors())         );     } }   In YOUR_ITEM you must specify item. If not working try this: public class ModInit {     @Mod.EventHandler     public void init(FMLInitializationEvent event) {         CommonProxy commonProxy = new CommonProxy();         commonProxy.registerItemRenderer();     } }
    • Selamat datang di Rajacasino88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Rajacasino88.
    • Dalam mengikuti tren perubahan digital, Bank BRI terus berinovasi untuk memenuhi kebutuhan dan keinginan nasabahnya. Salah satu upaya terbaru yang dilakukan oleh Bank BRI adalah meluncurkan platform permainan online yang menarik, yang
  • Topics

×
×
  • Create New...

Important Information

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