Skip to content

Commit

Permalink
Post init interface
Browse files Browse the repository at this point in the history
  • Loading branch information
paulevsGitch committed Jul 10, 2021
1 parent cb51137 commit 992d755
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/ru/bclib/client/BCLibClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.core.Registry;
import ru.bclib.api.ModIntegrationAPI;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IPostInit;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.registry.BaseBlockEntityRenders;

Expand All @@ -15,6 +16,11 @@ public void onInitializeClient() {
ModIntegrationAPI.registerAll();
BaseBlockEntityRenders.register();
registerRenderLayers();
Registry.BLOCK.forEach(block -> {
if (block instanceof IPostInit) {
((IPostInit) block).postInit();
}
});
}

private void registerRenderLayers() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/ru/bclib/interfaces/IPostInit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ru.bclib.interfaces;

public interface IPostInit {
void postInit();
}
7 changes: 7 additions & 0 deletions src/main/java/ru/bclib/server/BCLibServer.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package ru.bclib.server;

import net.fabricmc.api.DedicatedServerModInitializer;
import net.minecraft.core.Registry;
import ru.bclib.api.ModIntegrationAPI;
import ru.bclib.interfaces.IPostInit;

public class BCLibServer implements DedicatedServerModInitializer {
@Override
public void onInitializeServer() {
ModIntegrationAPI.registerAll();
Registry.BLOCK.forEach(block -> {
if (block instanceof IPostInit) {
((IPostInit) block).postInit();
}
});
}
}

0 comments on commit 992d755

Please sign in to comment.