Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct event to register the AE2 commands, fixing use after reload. #8293

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/main/java/appeng/core/AppEngBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
import java.util.Collection;
import java.util.Collections;

import com.mojang.brigadier.CommandDispatcher;

import org.jetbrains.annotations.Nullable;

import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand All @@ -42,9 +39,9 @@
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.RegisterGameTestsEvent;
import net.neoforged.neoforge.event.server.ServerAboutToStartEvent;
import net.neoforged.neoforge.event.server.ServerStartingEvent;
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
import net.neoforged.neoforge.network.PacketDistributor;
Expand Down Expand Up @@ -215,9 +212,8 @@ public void registerKeyTypes(Registry<AEKeyType> registry) {
Registry.register(registry, AEKeyType.fluids().getId(), AEKeyType.fluids());
}

public void registerCommands(ServerStartingEvent evt) {
CommandDispatcher<CommandSourceStack> dispatcher = evt.getServer().getCommands().getDispatcher();
new AECommand().register(dispatcher);
public void registerCommands(RegisterCommandsEvent evt) {
new AECommand().register(evt.getDispatcher());
}

public void registerSounds(Registry<SoundEvent> registry) {
Expand Down
Loading