Skip to content

Commit

Permalink
Use the correct event to register the AE2 commands, fixing use after …
Browse files Browse the repository at this point in the history
…reload. (#8293)

Fixes #8119
  • Loading branch information
shartte authored Dec 19, 2024
1 parent 25a4753 commit b0b13d1
Showing 1 changed file with 3 additions and 7 deletions.
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

0 comments on commit b0b13d1

Please sign in to comment.