Search in sources :

Example 1 with GraveManager

use of eu.pb4.graves.grave.GraveManager in project UniversalGraves by Patbox.

the class GravesMod method onInitialize.

@Override
public void onInitialize() {
    this.crabboardDetection();
    FabricLoader loader = FabricLoader.getInstance();
    Registry.register(Registry.BLOCK, new Identifier("universal_graves", "grave"), GraveBlock.INSTANCE);
    GraveBlockEntity.BLOCK_ENTITY_TYPE = Registry.register(Registry.BLOCK_ENTITY_TYPE, "universal_graves:grave", FabricBlockEntityTypeBuilder.create(GraveBlockEntity::new, GraveBlock.INSTANCE).build(null));
    Commands.register();
    BlockHelper.registerVirtualBlockEntity(GraveBlockEntity.BLOCK_ENTITY_TYPE);
    if (loader.isModLoaded("trinkets")) {
        TrinketsCompat.register();
    }
    if (loader.isModLoaded("goml")) {
        GomlCompat.register();
    }
    if (loader.isModLoaded("inventorio")) {
        InventorioCompat.register();
    }
    ServerLifecycleEvents.SERVER_STARTING.register((server) -> ConfigManager.loadConfig());
    ServerLifecycleEvents.SERVER_STARTED.register(server -> {
        this.crabboardDetection();
        GraveManager.INSTANCE = (GraveManager) server.getOverworld().getPersistentStateManager().getOrCreate(GraveManager::fromNbt, GraveManager::new, "universal-graves");
    });
    ServerTickEvents.END_SERVER_TICK.register(s -> {
        var copied = new ArrayList<>(DO_ON_NEXT_TICK);
        DO_ON_NEXT_TICK.clear();
        for (var c : copied) {
            c.run();
        }
    });
}
Also used : Identifier(net.minecraft.util.Identifier) FabricLoader(net.fabricmc.loader.api.FabricLoader) ArrayList(java.util.ArrayList) GraveManager(eu.pb4.graves.grave.GraveManager)

Aggregations

GraveManager (eu.pb4.graves.grave.GraveManager)1 ArrayList (java.util.ArrayList)1 FabricLoader (net.fabricmc.loader.api.FabricLoader)1 Identifier (net.minecraft.util.Identifier)1