Add WorldBeforeLoadEvent and WorldEndLoadEvent (#7523)

* Add `WorldBeforeLoadEvent` and `WorldEndLoadEvent`

* rename
This commit is contained in:
WayZer
2022-09-07 20:24:31 +08:00
committed by GitHub
parent 67552add78
commit 5c1e3a2862
2 changed files with 8 additions and 1 deletions

View File

@@ -202,6 +202,7 @@ public class World{
*/
public void beginMapLoad(){
generating = true;
Events.fire(new WorldLoadBeginEvent());
}
/**
@@ -209,6 +210,7 @@ public class World{
* A WorldLoadEvent will be fire.
*/
public void endMapLoad(){
Events.fire(new WorldLoadEndEvent());
for(Tile tile : tiles){
//remove legacy blocks; they need to stop existing

View File

@@ -77,8 +77,13 @@ public class EventType{
public static class MusicRegisterEvent{}
/** Called *after* all the modded files have been added into Vars.tree */
public static class FileTreeInitEvent{}
/** Called when a game begins and the world tiles are loaded. Entities are not yet loaded at this stage. */
/** Called when a game begins and the world tiles are loaded, just set `generating = false`. Entities are not yet loaded at this stage. */
public static class WorldLoadEvent{}
/** Called when the world begin to load, just set `generating = true`. */
public static class WorldLoadBeginEvent{}
/** Called when a game begins and the world tiles are initiated. About to updates tile proximity and sets up physics for the world(Before WorldLoadEvent) */
public static class WorldLoadEndEvent{}
public static class SaveLoadEvent{
public final boolean isMap;