Skip to content

Commit f9a12bf

Browse files
committed
add API for GT Modules to subscribe to the Ore and Terrain Gen buses
1 parent a46460d commit f9a12bf

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/main/java/gregtech/api/modules/IGregTechModule.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,29 @@ default void serverStopped(FMLServerStoppedEvent event) {}
5555
default void registerPackets() {}
5656

5757
/**
58-
* @return A list of classes to subscribe to the Forge event bus.
59-
* As the class gets subscribed, not any specific instance, event handlers must be static!
58+
* As the class gets subscribed, not any specific instance, event handlers must be static!
59+
*
60+
* @return A list of classes to subscribe to the Forge Event Bus, {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
6061
*/
61-
@NotNull
62-
default List<Class<?>> getEventBusSubscribers() {
62+
default @NotNull List<Class<?>> getEventBusSubscribers() {
63+
return Collections.emptyList();
64+
}
65+
66+
/**
67+
* As the class gets subscribed, not any specific instance, event handlers must be static!
68+
*
69+
* @return A list of classes to subscribe to the Forge Terrain Gen Bus, {@link net.minecraftforge.common.MinecraftForge#TERRAIN_GEN_BUS}.
70+
*/
71+
default @NotNull List<Class<?>> getTerrainGenBusSubscribers() {
72+
return Collections.emptyList();
73+
}
74+
75+
/**
76+
* As the class gets subscribed, not any specific instance, event handlers must be static!
77+
*
78+
* @return A list of classes to subscribe to the Forge Ore Gen Bus, {@link net.minecraftforge.common.MinecraftForge#ORE_GEN_BUS}.
79+
*/
80+
default @NotNull List<Class<?>> getOreGenBusSubscribers() {
6381
return Collections.emptyList();
6482
}
6583

src/main/java/gregtech/modules/ModuleManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public void setup(ASMDataTable asmDataTable, File configDirectory) {
101101
for (Class<?> clazz : module.getEventBusSubscribers()) {
102102
MinecraftForge.EVENT_BUS.register(clazz);
103103
}
104+
for (Class<?> clazz : module.getTerrainGenBusSubscribers()) {
105+
MinecraftForge.TERRAIN_GEN_BUS.register(clazz);
106+
}
107+
for (Class<?> clazz : module.getOreGenBusSubscribers()) {
108+
MinecraftForge.ORE_GEN_BUS.register(clazz);
109+
}
104110
}
105111
}
106112

0 commit comments

Comments
 (0)