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

TOP/WAILA(Hwyla) tooltips "latching" on Custom Cake fuels when multiple Custom Cakes are defined #23

Open
Exaxxion opened this issue Apr 9, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@Exaxxion
Copy link

Exaxxion commented Apr 9, 2021

The new cake fuel display tooltips in TOP/WAILA(Hwyla) are working fine for the vanilla dimension cakes, but the one for custom cakes has some strange behavior. This is reproducible in the runClient build target so it's not an external interaction.

Specifically, it is "latching" to whatever the last clicked Custom Cake's fuel type is. This isn't a problem if you only have a single custom cake defined, but with multiple cakes it will report the wrong information.

To reproduce this, define some custom cakes such that one of them uses minecraft:stick as fuel and the other uses minecraft:cobblestone. As we don't have additional dimensions in the dev environment, I have used dimID 0 and 1 for custom cakes "Zero" and "One", respectively. Next, start up the runClient build target.

In a fresh superflat, cheat in one of each cake with 0 bites remaining to test with (so clicking them won't teleport you anywhere), and place them in front of you.

In the following screenshots, I have the "Zero" cake configured to use minecraft:cobblestone and the "One" cake configured to use minecraft:stick.

Upon loading in, looking at the placed "One" cake shows the incorrect fuel in the overlay.
image

Right clicking it results in the overlay updating to the correct fuel ("Refill: Stick").
image

However, when you pan over to look at the "Zero" cake, it then shows that cake's fuel as Sticks as well, when it should be Cobblestone. Similarly, right-clicking to use the "Zero" cake updates the TOP/WAILA(Hwyla) overlays for both cakes to display the fuel as "Refill: Cobblestone".

@Exaxxion Exaxxion added the bug Something isn't working label Apr 9, 2021
@ALongStringOfNumbers
Copy link
Member

A similar issue: Custom Cakes refill items are always showing invalid item for me on first world load, and spamming my log that the fuel could not be parsed. The issue is then solved by giving the cakes a piece of fuel defined in the config.

Setup: Have 1 custom cake set to go to dimension 1, with the fuel being a stick. Place the cake, see that it displays invalid fuel. Feed it a stick and see that the issue is solved. Exit the game and restart it and see that the cake displays invalid fuel item again

@Exaxxion
Copy link
Author

Based on your description I think that what you're describing is partially due to the JED compatibility issue. We should see if you still have the same experience once that's merged.

@ALongStringOfNumbers
Copy link
Member

This issue was not fixed by updating to after the JED compat was merged.

On first load into the game, the cakes display missing items in their TOP panes:
2021-04-12_13 02 38

2021-04-12_13 02 43

These TOP panes spam the log with this until the fuel is used on the cake, after which the TOP display updates to show the fuel and also the "sticking" issue described in the original post happens at this time.

Note that the tooltip works perfectly.

@Exaxxion
Copy link
Author

The error being spammed indicates that the cake's fuel is being returned as either null or an empty String: https://github.com/OmnifactoryDevs/DimensionalEdibles/blob/2227ce47af825a2f66c58c467f7ec168fb0c28ef/src/main/java/jackyy/dimensionaledibles/block/BlockCakeBase.java#L316-L320

In the case of Custom Cakes, this would mean that the Cache has no usable entry for the current cakeDimension, as that's where the information is retrieved from:

https://github.com/OmnifactoryDevs/DimensionalEdibles/blob/2227ce47af825a2f66c58c467f7ec168fb0c28ef/src/main/java/jackyy/dimensionaledibles/block/BlockCakeBase.java#L124

https://github.com/OmnifactoryDevs/DimensionalEdibles/blob/2227ce47af825a2f66c58c467f7ec168fb0c28ef/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java#L189-L192

I don't think it's the act of fueling the cake but rather triggering onBlockActivated at all. If the cake's dimension ID passes BlockCustomCake::onBlockActivated's check for whether that dimension exists, the custom cake class sets its cakeDimension value to that dimension before calling the superclass method which handles the logic for consuming the item and refilling the cake:

https://github.com/OmnifactoryDevs/DimensionalEdibles/blob/2227ce47af825a2f66c58c467f7ec168fb0c28ef/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java#L78-L80

Exaxxion added a commit that referenced this issue Jun 1, 2021
See #23; a proper fix needs to rework how we represent custom cakes.
Exaxxion added a commit that referenced this issue Jun 2, 2021
Workaround for #23. A proper fix needs to rework how we track state for custom cakes.

Avoids issue by updating the BlockCustomCake.cakeDimension value before rendering the TOP/WAILA overlays.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants