Jump to content

Recommended Posts

Posted

I am trying to change vanilla mechanics where forge does not provide any event to hook into. Currently my method is extend a vanilla class, override some methods and replace the existing object with the object of my class. But this method can not change static methods and it is not compatible with other mods. So I need to make a core mod and use Mixin.

By reading Forge code, I found that Forge supports write class transformers in javascript. But using Mixin is much easier than write raw transforming code. I did not find any documentation about how to use Mixin with Forge.

Posted (edited)
8 minutes ago, qouteall said:

I am trying to change vanilla mechanics where forge does not provide any event to hook into.

What mechanics do you want to change? What is the event (what should the event do) you are looking for?

Edited by DavidM

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.

 

 

Posted

Mixins aren't available for 1.13.2 yet. They're also planning on skipping 1.13.2 and going straight to 1.14.

 

We do not support coremodding on these forums. If you don't already know how to make a coremod you shouldn't be making one. Coremodding without a very good understanding of how Java works at a fundamental level leaves your code fragile and prone to breaking unexpectedly, especially when other mods get involved, and when Minecraft crashes there will be no evidence that its YOUR code that caused the problem. Coremodding is java code that lets you modify java code (even itself, which can get ugly) while it's running. It's literally dangerous if not done correctly. In the vast majority of situations you ever find yourself in, coremodding is not needed. The order of things to try first goes:

  1. Own code (extending, implementing)
  2. Events (handle existing hooks)
  3. Reflection (access private values)
  4. Making a PR to Forge to insert new events (and then doing #2)
  5. Not doing anything at all (stop touching it)
  6. Starting a new project (I said stop)
  7. Coremodding (After learning about ASM and Java Bytecode and how everything all works)

(Thanks to @Draco18s for the explanations, I copied them mostly word for word)

 

Heres a thread where I had a similar problem and made a PR to Forge

 

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)

Posted
26 minutes ago, DavidM said:

What mechanics do you want to change? What is the event (what should the event do) you are looking for?

tones of mechanics.

This is what I am trying to achieve.

1.Look through nether portals.

2.Going into nether is seamless, without loading screen.

2019-05-08_17_37_20.thumb.jpg.e7aeeaa704d706bb99d02bc7f2d3cbec.jpg

I currently use the replace-object method and got some progress. I copied tones of vanilla code and replaced tones of vanilla objects. This mod is still in work and has many bugs.

The mechanics that I am changing:

1.Rendering

  I copied tones of vanilla rendering code to render portals. It will not be compatible with optifine and a lot of mods.

2.The world syncing between server and client.

3.Server chunk loading

4.The property of fire block

If I proceed developing this mod without core modding I will replace even more vanilla objects and it become much more harder.

 

 

 

Posted (edited)

I've talked to the developer of OptiFine about doing just this and a coremod is likely not required or it will be a 1 line coremod.

 

From our conversation:

Quote

sp614x:

To render another world in a portal I would

- set position/orientation of the render view entity (camera) as needed

- render the world with EntityRenderer.updateCameraAndRender() or renderWorld()

- copy the result from the MC framebuffer into a work buffer

- restore original position/orientation of the render view entity (camera)

- render the world normally

- copy from the work buffer to the MC framebuffer

as implementation it could be added for example in EntityRenderer.updateCameraAndRender()

at the beginning render with custom camera position, copy results to work buffer then let the normal render go through at the end copy the work buffer into MC framebuffer
Cadiboo:

this would allow rendering of, for example, the nether through a portal in the overworld?

sp614x:

the nether could work, but not with nether specific shaders

on dimension change the shader pack can load nether specific shaders (no sun, no clouds, no shadows)

so it would be rendered with overworld shaders which would look strange

Cadiboo

I would call that "not my problem"

sp614x:

or even worse, it could try to switch the shaders each frame which would be extemely slow

if using updateCameraAndRender() it would try to switch shaders if using renderWorld() it would render it with overworld shaders

but I can't imagine how rendering another world would even work the whole chunk loading and shaders setup is built on the idea that the world is static

as I see it rendering the same world from a different viewpoint (near the player to avoid chunk loading problems) could be made to work

for example the Portal Gun mod should be possible

I was thinking of making an API and/or PRing a Forge hook for this since there are already mods that do this (not very well IMO) such as the Portal Gun Mod and the TARDIS mod. I'd be happy to work towards this with you.

Edited by Cadiboo
  • Thanks 1

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)

Posted
41 minutes ago, Cadiboo said:

I've talked to the developer of OptiFine about doing just this and a coremod is likely not required or it will be a 1 line coremod.

 

From our conversation:

I was thinking of making an API and/or PRing a Forge hook for this since there are already mods that do this (not very well IMO) such as the Portal Gun Mod and the TARDIS mod. I'd be happy to work towards this with you.

 

I am happy to accept collaboration. I am planning to put the code to github after making my code more readable.

 

And I think the main obstacle of being compatible with optifine is that rendering portal content needs culling.

The actual rendering process is different from what sp164x said. I directly render portal content into MC frame buffer, without involving other buffer.

The portal rendering happens before vanilla world rendering and before hand rendering.

It firstly renders the triangles that represent portal area. If no sample is passed, it will not render the world inside portal. This could increase performance. Rendering portal area also increases the stencil value by one. Then change the player position and dimension to render the world inside portal.

I use a special shader to render portal content, what this shader do is to cull all pixels behind the portal.

For example, if some triangles are between the teleported position and the world inside portal:2019-05-08_18_36_25.thumb.jpg.49526b304075bff089b8aa6d784a5d56.jpg

 

It will render incorrectly like this:

2019-05-08_18_36_04.thumb.jpg.64afa7cb310d59c59780207c1a1191ce.jpg

 

To avoid this, it should cull all pixels behind that plane

2019-05-08_18_39_37.thumb.jpg.df0938e55b942203373964aeee8ecdf6.jpg

Then it will render correctly.

 

So it will not be compatible with optifine's fancy shaders.

2019-05-08_18.36.11.jpg

Posted
On 5/8/2019 at 9:14 PM, qouteall said:

The actual rendering process is different from what sp164x said.

The method sp614x and I were discussing was on how to make it also compatible with shaders.

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)

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.