[1.18] Integrate the gametest framework with Forge (#8225)

Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
SizableShrimp authored and GitHub committed 2022-02-25 01:06:32 +00:00
1 parent bb547a5748
commit f0c2554b1c
28 files changed
+944 -8

No files matched your search

@@ -29,6 +29,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import net.minecraft.gametest.framework.GameTestServer;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.server.packs.repository.RepositorySource;
import net.minecraft.world.level.storage.LevelResource;
@@ -97,7 +98,12 @@ public class ServerLifecycleHooks
public static boolean handleServerStarting(final MinecraftServer server)
{
DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, ()->()->LanguageHook.loadLanguagesOnServer(server));
DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, ()->()->{
LanguageHook.loadLanguagesOnServer(server);
// GameTestServer requires the gametests to be registered earlier, so it is done in main and should not be done twice.
if (!(server instanceof GameTestServer))
net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests();
});
PermissionAPI.initializePermissionAPI();
return !MinecraftForge.EVENT_BUS.post(new ServerStartingEvent(server));
}