-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathKitEvents.java
More file actions
35 lines (29 loc) · 1.04 KB
/
KitEvents.java
File metadata and controls
35 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package dev.amble.lib.api;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.chunk.WorldChunk;
public class KitEvents {
public static final Event<PreDatapackLoad> PRE_DATAPACK_LOAD = EventFactory.createArrayBacked(PreDatapackLoad.class, callbacks -> () -> {
for (PreDatapackLoad callback : callbacks) {
callback.load();
}
});
public static final Event<SyncRoot> SYNC_ROOT = EventFactory.createArrayBacked(SyncRoot.class,
callbacks -> (player, chunk) -> {
for (SyncRoot callback : callbacks) {
callback.sync(player, chunk);
}
});
/**
* Called when just before datapacks are loaded
*/
@FunctionalInterface
public interface PreDatapackLoad {
void load();
}
@FunctionalInterface
public interface SyncRoot {
void sync(ServerPlayerEntity player, WorldChunk chunk);
}
}