-
-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fake level for JEI #10304
base: version/main
Are you sure you want to change the base?
Use fake level for JEI #10304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is technically breaking change logic-wise in latest fakelevel backport, so please update
Use singleblockfakelevel, probably with blockstate of air
Don't forget to override getRealLevel as redirect to mc.instance.level
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
|
||
@OnlyIn(Dist.CLIENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why onlyin? dont think we should use that in 1.21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paranoia, mostly. Since it's using client-only classes it must not be loaded in the server jar. Though that should be the case even without this, it seems safer to make it explicit.
Please, check how you are instancing this LivingEntity if you would need to use a fake level here too.
This is where it starts: minecolonies/src/main/java/com/minecolonies/core/compatibility/jei/JEIPlugin.java Line 131 in 7066c5c
|
Good catch, thanks. |
Hmm, out of scope of this PR: but why do we pass instantiated entity in the first place? |
Because (a) that's what the entity renderer wants in order to draw an entity, and (b) other places need to query various instance methods that only exist on the instantiated entity. |
Honestly, if possible, I prefer WeakReference instead of cached by magic number 2 minutes |
Minecraft GCs all the time, so a WeakReference is almost identical to not caching it at all. And entities are not sufficiently lightweight for that to seem justifiable. |
Closes #10302 (once ported)
Changes proposed in this pull request
Testing
Review please (should port)