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

Address compatibility issues with JED dimensions #24

Merged
merged 4 commits into from
Apr 12, 2021
Merged

Conversation

Exaxxion
Copy link

@Exaxxion Exaxxion commented Apr 10, 2021

Fixes #22 by always registering configured custom cakes irrespective of whether the target dimension actually exists during FML initialization stages. Prevents players from actually eating the cake if the target dimension doesn't exist while the World is loaded, logging an error message to both the client and server that the configs need to be fixed.

It seems that a consequence of these changes is that existing Void Cakes (at least in my Omnifactory testing instance) disappeared from the world without warning. Perhaps it has something to do with actually registering the cake items properly rather than Omni's workaround of forcing JEI to list a cake with the expected NBT.

An extra benefit of this change is that now there's zero log spam about how Dim 119 doesn't exist during loading.

- Always register custom cakes even if the dimension doesn't exist
  during Forge mod initialization phase

- Prevent the player from eating a placed custom cake if the target
  dimension does not exist, and log an error when this occurs
if(!cache.containsKey(dim)) {
logger.error("No such dimension: \"{}\"", dim);
if(!isDimensionRegistered(dim)) {
logger.error("Requested dimension: \"{}\" does not exist. Please verify your configs.", dim);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just logging, a chat message should be displayed as well, because I imagine that most players will not have their log open while playing the game, and so will miss the logger warning, leaving them wondering why the cake is not working.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a fair point. I've reworked this such that the server thread will log an error and the client thread will print a message to the user in-game.

@Exaxxion Exaxxion merged commit 2227ce4 into master Apr 12, 2021
@Exaxxion Exaxxion deleted the jed-compat branch April 12, 2021 08:36
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

Successfully merging this pull request may close these issues.

Dimension compatibility problems with JED
3 participants