mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 08:44:25 +00:00
After internal discussion, it was decided that we need to include "contributors" to the license header. This avoids claiming that the Java source files are under the exclusive copyright ownership of Forge LLC, which excludes contributors that still hold copyright ownership over their contributions (but is licensed under the LGPLv2.1 as stated in the Forge CLA).
26 lines
914 B
Java
26 lines
914 B
Java
/*
|
|
* Copyright (c) Forge Development LLC and contributors
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
*/
|
|
|
|
package net.minecraftforge.client;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.screens.Screen;
|
|
import net.minecraftforge.fml.ModList;
|
|
import net.minecraftforge.fml.IExtensionPoint;
|
|
import net.minecraftforge.forgespi.language.IModInfo;
|
|
|
|
import java.util.Optional;
|
|
import java.util.function.BiFunction;
|
|
|
|
public class ConfigGuiHandler
|
|
{
|
|
public record ConfigGuiFactory(BiFunction<Minecraft, Screen, Screen> screenFunction) implements IExtensionPoint<ConfigGuiFactory> {}
|
|
public static Optional<BiFunction<Minecraft, Screen, Screen>> getGuiFactoryFor(IModInfo selectedMod)
|
|
{
|
|
return ModList.get().getModContainerById(selectedMod.getModId()).
|
|
flatMap(mc -> mc.getCustomExtension(ConfigGuiFactory.class).map(ConfigGuiFactory::screenFunction));
|
|
}
|
|
}
|