Command registry events and ReloadListenerRegistry

This commit is contained in:
shedaniel
2020-11-01 22:42:36 +08:00
parent 7279b4cd6e
commit abb57db971
7 changed files with 135 additions and 8 deletions

View File

@@ -0,0 +1,12 @@
package me.shedaniel.architectury.event.events;
import com.mojang.brigadier.CommandDispatcher;
import me.shedaniel.architectury.event.Event;
import me.shedaniel.architectury.event.EventFactory;
import net.minecraft.commands.CommandSourceStack;
public interface CommandRegistrationEvent {
Event<CommandRegistrationEvent> EVENT = EventFactory.createLoop(CommandRegistrationEvent.class);
void register(CommandDispatcher<CommandSourceStack> var1);
}

View File

@@ -19,10 +19,14 @@ package me.shedaniel.architectury.event.events;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.architectury.event.Event;
import me.shedaniel.architectury.event.EventFactory;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public interface GuiEvent {
Event<RenderHud> RENDER_HUD = EventFactory.createLoop(RenderHud.class);
@Environment(EnvType.CLIENT)
interface RenderHud {
void renderHud(PoseStack matrices, float tickDelta);
}

View File

@@ -0,0 +1,25 @@
package me.shedaniel.architectury.registry;
import me.shedaniel.architectury.ArchitecturyPopulator;
import me.shedaniel.architectury.Populatable;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.PreparableReloadListener;
public final class ReloadListenerRegistry {
private ReloadListenerRegistry() {}
@Populatable
private static final Impl IMPL = null;
public static void registerReloadListener(PackType type, PreparableReloadListener listener) {
IMPL.registerReloadListener(type, listener);
}
public interface Impl {
void registerReloadListener(PackType type, PreparableReloadListener listener);
}
static {
ArchitecturyPopulator.populate(ReloadListenerRegistry.class);
}
}