Skip to content

Commit

Permalink
Add RegistriesFrozenEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
calmilamsy committed Jul 10, 2024
1 parent a6dfbdc commit 6a63f39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package net.modificationstation.stationapi.api.event.registry;

import net.mine_diver.unsafeevents.Event;
import net.mine_diver.unsafeevents.event.EventPhases;
import net.modificationstation.stationapi.api.StationAPI;

/**
* This is the last init event called by StAPI.
* Called after registries are frozen.
* {@link net.modificationstation.stationapi.mixin.registry.client.MinecraftMixin}
*/
@SuppressWarnings("JavadocReference") // Shut, I know.
@EventPhases(StationAPI.INTERNAL_PHASE)
public class RegistriesFrozenEvent extends Event {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.modificationstation.stationapi.mixin.registry.client;

import net.minecraft.client.Minecraft;
import net.modificationstation.stationapi.api.StationAPI;
import net.modificationstation.stationapi.api.event.registry.RegistriesFrozenEvent;
import net.modificationstation.stationapi.api.registry.Registries;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -16,5 +18,6 @@ class MinecraftMixin {
)
private void stationapi_freeze(CallbackInfo ci) {
Registries.bootstrap();
StationAPI.EVENT_BUS.post(new RegistriesFrozenEvent());
}
}

0 comments on commit 6a63f39

Please sign in to comment.