Skip to content

Commit

Permalink
Fix #50
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed May 13, 2024
1 parent 420eb75 commit a234f61
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public static LevelIdMap send(RegistryAccess access) {
return levelIdMap;
}

public static void init(RegistryAccess access) {
send(access);
}

public int id(ResourceKey<Level> key) {
return map.getInt(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.lukebemish.tempest.impl.Constants;
import dev.lukebemish.tempest.impl.data.AttachedWeatherMapReloadListener;
import dev.lukebemish.tempest.impl.data.WeatherSpawnProvider;
import dev.lukebemish.tempest.impl.data.world.LevelIdMap;
import dev.lukebemish.tempest.impl.fabriquilt.client.ClientEntrypoint;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
Expand All @@ -22,7 +23,10 @@ public void onInitialize() {
AttachedWeatherMapReloadListener.applyToServer(server)
);

ServerLifecycleEvents.SERVER_STARTED.register(AttachedWeatherMapReloadListener::applyToServer);
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
AttachedWeatherMapReloadListener.applyToServer(server);
LevelIdMap.init(server.registryAccess());
});

ResourceManagerHelper.get(PackType.SERVER_DATA).registerReloadListener(new IdentifiableWeatherSpawnProviderListener());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.lukebemish.tempest.impl.Services;
import dev.lukebemish.tempest.impl.data.AttachedWeatherMapReloadListener;
import dev.lukebemish.tempest.impl.data.WeatherSpawnProvider;
import dev.lukebemish.tempest.impl.data.world.LevelIdMap;
import dev.lukebemish.tempest.impl.forge.client.ClientEntrypoint;
import dev.lukebemish.tempest.impl.forge.compat.embeddium.EmbeddiumCompat;
import net.minecraft.world.level.chunk.LevelChunk;
Expand Down Expand Up @@ -74,5 +75,6 @@ private void onDatapackSync(OnDatapackSyncEvent event) {

private void onServerStarting(ServerStartingEvent event) {
AttachedWeatherMapReloadListener.applyToServer(event.getServer());
LevelIdMap.init(event.getServer().registryAccess());
}
}

0 comments on commit a234f61

Please sign in to comment.