2018-06-06 15:37:56 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2018-09-21 09:15:03 +00:00
|
|
|
* Copyright (c) 2016-2018.
|
2018-06-06 15:37:56 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2018-06-21 19:37:32 +00:00
|
|
|
package net.minecraftforge.fml;
|
2018-06-06 15:37:56 +00:00
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
|
import com.google.common.collect.Lists;
|
2018-10-04 23:28:45 +00:00
|
|
|
import net.minecraftforge.versions.forge.ForgeVersion;
|
|
|
|
import net.minecraftforge.versions.mcp.MCPVersion;
|
2018-06-06 15:37:56 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
2018-06-19 18:04:05 +00:00
|
|
|
import java.util.function.BiConsumer;
|
|
|
|
import java.util.stream.IntStream;
|
2018-06-06 15:37:56 +00:00
|
|
|
|
|
|
|
public class BrandingControl
|
|
|
|
{
|
|
|
|
private static List<String> brandings;
|
|
|
|
private static List<String> brandingsNoMC;
|
|
|
|
|
|
|
|
private static void computeBranding()
|
|
|
|
{
|
|
|
|
if (brandings == null)
|
|
|
|
{
|
|
|
|
ImmutableList.Builder<String> brd = ImmutableList.builder();
|
2018-10-02 04:32:41 +00:00
|
|
|
brd.add("Minecraft " + MCPVersion.getMCVersion());
|
|
|
|
brd.add("MCP " + MCPVersion.getMCPVersion());
|
2018-06-06 15:37:56 +00:00
|
|
|
brd.add("Forge " + ForgeVersion.getVersion());
|
2018-06-19 18:04:05 +00:00
|
|
|
int tModCount = ModList.get().size();
|
2018-09-29 01:07:46 +00:00
|
|
|
brd.add(ForgeI18n.parseMessage("fml.menu.loadingmods", tModCount));
|
2018-06-06 15:37:56 +00:00
|
|
|
brandings = brd.build();
|
|
|
|
brandingsNoMC = brandings.subList(1, brandings.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-30 00:47:47 +00:00
|
|
|
private static List<String> getBrandings(boolean includeMC, boolean reverse)
|
2018-06-06 15:37:56 +00:00
|
|
|
{
|
|
|
|
computeBranding();
|
|
|
|
if (includeMC) {
|
|
|
|
return reverse ? Lists.reverse(brandings) : brandings;
|
|
|
|
} else {
|
|
|
|
return reverse ? Lists.reverse(brandingsNoMC) : brandingsNoMC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-19 18:04:05 +00:00
|
|
|
public static void forEachLine(boolean includeMC, boolean reverse, BiConsumer<Integer, String> lineConsumer) {
|
|
|
|
final List<String> brandings = getBrandings(includeMC, reverse);
|
|
|
|
IntStream.range(0, brandings.size()).boxed().forEachOrdered(idx -> lineConsumer.accept(idx, brandings.get(idx)));
|
|
|
|
}
|
2018-09-30 00:47:47 +00:00
|
|
|
|
2018-06-06 15:37:56 +00:00
|
|
|
public static String getClientBranding() {
|
2018-09-30 00:47:47 +00:00
|
|
|
return "forge";
|
2018-06-06 15:37:56 +00:00
|
|
|
}
|
2018-06-21 19:37:32 +00:00
|
|
|
|
|
|
|
public static String getServerBranding() {
|
2018-09-30 00:47:47 +00:00
|
|
|
return "forge";
|
2018-06-21 19:37:32 +00:00
|
|
|
}
|
2018-06-06 15:37:56 +00:00
|
|
|
}
|