Skip to content
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

Blocks topping crashes on 1.17 due to candles #37

Open
Archengius opened this issue Jun 11, 2021 · 2 comments
Open

Blocks topping crashes on 1.17 due to candles #37

Archengius opened this issue Jun 11, 2021 · 2 comments

Comments

@Archengius
Copy link

Archengius commented Jun 11, 2021

in 1.17, candles were added, which can be stacked up to 4 in a single block
Light level emitted by candles depends on the amount of candles in block and their lit status, which is handled by the lambda in the candle block class looking like follows:

h = (var0) -> {
    return (Boolean)var0.c(f) ? 3 * (Integer)var0.c(e) : 0;
};

Since passed lambda is initialized inside of the BlockCandle as a static field and then referenced in Blocks class, currently burger will not resolve it properly through intercepting GETSTATIC, so default object will be returned, which will cause JSON serialization issues down the line

Simplest solution would be to hard-code light level of 12 to candles, by looking at the signature of the field get and falling back to hard-coded value. Obviously proper solution would involve looking into static fields and their initializers, but it's rather hard and requires investigating code outside of the primary blocks class

@Pokechu22
Copy link
Collaborator

Thanks for looking into this; I was aware of the problem but hadn't had time to look into it.

I believe sea pickles behave similarly, but Burger currently just skips them and doesn't assign any light information. That would probably be appropriate for candles as well. Hardcoding a specific value seems less useful to me.

@Archengius
Copy link
Author

bandaid solution I implemented locally was simply not assigning light information if provided object is not an int, but obviously it's a hacky one and there should probably be a proper way to intercept that, but unfortunately i'm not that familiar with jawa python package (and python in general) to find it quickly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants