diff options
| author | 2024-01-27 03:22:37 +0200 | |
|---|---|---|
| committer | 2024-01-27 03:22:37 +0200 | |
| commit | 99ba3f0be8835dac87b506a37f2a62ba89af0ca0 (patch) | |
| tree | 8506e3afc3cd84a0394982ea3a90e450f8c2262f /src/main/java/lv/enes/mc/eris_alchemy/Emc.java | |
| parent | Fix a dedicated server crash (diff) | |
| download | mc-eris-alchemy-99ba3f0be8835dac87b506a37f2a62ba89af0ca0.tar.gz mc-eris-alchemy-99ba3f0be8835dac87b506a37f2a62ba89af0ca0.tar.xz mc-eris-alchemy-99ba3f0be8835dac87b506a37f2a62ba89af0ca0.zip | |
Add support for a bunch of mods
Diffstat (limited to 'src/main/java/lv/enes/mc/eris_alchemy/Emc.java')
| -rw-r--r-- | src/main/java/lv/enes/mc/eris_alchemy/Emc.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/Emc.java b/src/main/java/lv/enes/mc/eris_alchemy/Emc.java index 731ecee..576fdc2 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/Emc.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/Emc.java | |||
| @@ -87,9 +87,7 @@ public final class Emc { | |||
| 87 | public static void initClient(Minecraft ignoredClient) { | 87 | public static void initClient(Minecraft ignoredClient) { |
| 88 | ClientPlayNetworking.registerGlobalReceiver( | 88 | ClientPlayNetworking.registerGlobalReceiver( |
| 89 | NetworkingConstants.UPDATE_EMCS, | 89 | NetworkingConstants.UPDATE_EMCS, |
| 90 | (client, handler, buf, responseSender) -> { | 90 | (client, handler, buf, responseSender) -> syncFrom(buf) |
| 91 | syncFrom(buf); | ||
| 92 | } | ||
| 93 | ); | 91 | ); |
| 94 | } | 92 | } |
| 95 | 93 | ||
| @@ -98,9 +96,7 @@ public final class Emc { | |||
| 98 | reinit(); | 96 | reinit(); |
| 99 | warnOfMissingValues(); | 97 | warnOfMissingValues(); |
| 100 | 98 | ||
| 101 | ServerPlayConnectionEvents.JOIN.register((handler, sender, server1) -> { | 99 | ServerPlayConnectionEvents.JOIN.register((handler, sender, server1) -> syncTo(handler.getPlayer())); |
| 102 | syncTo(handler.getPlayer()); | ||
| 103 | }); | ||
| 104 | } | 100 | } |
| 105 | 101 | ||
| 106 | public static void reloadData( | 102 | public static void reloadData( |
| @@ -192,7 +188,8 @@ public final class Emc { | |||
| 192 | world.getRecipeManager() | 188 | world.getRecipeManager() |
| 193 | .getRecipes() | 189 | .getRecipes() |
| 194 | .stream() | 190 | .stream() |
| 195 | .map(recipe -> new SimplifiedRecipe(recipe, world.registryAccess())) | 191 | .map(recipe -> SimplifiedRecipe.of(recipe, world.registryAccess())) |
| 192 | .flatMap(List::stream) | ||
| 196 | ); | 193 | ); |
| 197 | } | 194 | } |
| 198 | 195 | ||
| @@ -226,7 +223,7 @@ public final class Emc { | |||
| 226 | var sortedItems = sorted(recipes); | 223 | var sortedItems = sorted(recipes); |
| 227 | sortedItems.stream() | 224 | sortedItems.stream() |
| 228 | .filter(id -> !VALUES.containsKey(id)) | 225 | .filter(id -> !VALUES.containsKey(id)) |
| 229 | .forEach(id -> VALUES.put(id, calcEmc(id, recipes))); | 226 | .forEach(id -> calcEmc(id, recipes).ifPresent(v -> VALUES.put(id, OptionalDouble.of(v)))); |
| 230 | ErisAlchemy.LOGGER.info("Done calculating EMC values..."); | 227 | ErisAlchemy.LOGGER.info("Done calculating EMC values..."); |
| 231 | 228 | ||
| 232 | sync(); | 229 | sync(); |