mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-24 05:54:41 +00:00
Buildscript cleanup and organization.
Updated to use newer libraries that reduce the command line arguments needed to run the game. Fix issues in the SecureModule's classloader that caused resources to not be seen when they are on parent module layers.
This commit is contained in:
23 files changed
+281
-458
No files matched your search
@@ -16,6 +16,8 @@ import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.math.Constants;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.FileUtil;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
@@ -155,7 +157,6 @@ import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.forge.snapshots.ForgeSnapshotsModClient;
|
||||
import net.minecraftforge.gametest.ForgeGameTestHooks;
|
||||
import net.minecraftforge.network.NetworkContext;
|
||||
import net.minecraftforge.network.NetworkInitialization;
|
||||
@@ -344,9 +345,16 @@ public class ForgeHooksClient {
|
||||
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
|
||||
}
|
||||
|
||||
public static void renderMainMenu(TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha) {
|
||||
public static void renderMainMenu(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) {
|
||||
VersionChecker.Status status = ForgeVersion.getStatus();
|
||||
ForgeSnapshotsModClient.renderMainMenuWarning(status, gui, guiGraphics, font, width, height, alpha);
|
||||
|
||||
if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) {
|
||||
// Render a warning at the top of the screen
|
||||
Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED);
|
||||
graphics.drawCenteredString(font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
line = Component.translatable("forge.update.beta.2");
|
||||
graphics.drawCenteredString(font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
}
|
||||
|
||||
forgeStatusLine = switch(status) {
|
||||
// case FAILED -> " Version check failed";
|
||||
|
||||
@@ -64,7 +64,6 @@ import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fml.*;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.*;
|
||||
import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod;
|
||||
import net.minecraftforge.registries.*;
|
||||
import net.minecraftforge.registries.holdersets.AndHolderSet;
|
||||
import net.minecraftforge.registries.holdersets.AnyHolderSet;
|
||||
@@ -389,7 +388,6 @@ public class ForgeMod {
|
||||
|
||||
public ForgeMod() {
|
||||
LOGGER.info(FORGEMOD,"Forge mod loading, version {}, for MC {} with MCP {}", ForgeVersion.getVersion(), MCPVersion.getMCVersion(), MCPVersion.getMCPVersion());
|
||||
ForgeSnapshotsMod.logStartupWarning();
|
||||
INSTANCE = this;
|
||||
MinecraftForge.initialize();
|
||||
CrashReportCallables.registerCrashCallable("Crash Report UUID", ()-> {
|
||||
|
||||
@@ -16,23 +16,18 @@ import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
|
||||
|
||||
public class BrandingControl
|
||||
{
|
||||
public class BrandingControl {
|
||||
private static List<String> brandings;
|
||||
private static List<String> brandingsNoMC;
|
||||
private static List<String> overCopyrightBrandings;
|
||||
|
||||
private static void computeBranding()
|
||||
{
|
||||
if (brandings == null)
|
||||
{
|
||||
private static void computeBranding() {
|
||||
if (brandings == null) {
|
||||
ImmutableList.Builder<String> brd = ImmutableList.builder();
|
||||
brd.add(ForgeSnapshotsMod.BRANDING_NAME + ' ' + ForgeVersion.getVersion());
|
||||
brd.add("Forge " + ForgeVersion.getVersion());
|
||||
brd.add("Minecraft " + MCPVersion.getMCVersion());
|
||||
brd.add("MCP " + MCPVersion.getMCPVersion());
|
||||
int tModCount = ModList.get().size();
|
||||
@@ -42,14 +37,12 @@ public class BrandingControl
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> getBrandings(boolean includeMC, boolean reverse)
|
||||
{
|
||||
private static List<String> getBrandings(boolean includeMC, boolean reverse) {
|
||||
computeBranding();
|
||||
if (includeMC) {
|
||||
if (includeMC)
|
||||
return reverse ? Lists.reverse(brandings) : brandings;
|
||||
} else {
|
||||
else
|
||||
return reverse ? Lists.reverse(brandingsNoMC) : brandingsNoMC;
|
||||
}
|
||||
}
|
||||
|
||||
private static void computeOverCopyrightBrandings() {
|
||||
@@ -71,11 +64,11 @@ public class BrandingControl
|
||||
}
|
||||
|
||||
public static String getClientBranding() {
|
||||
return ForgeSnapshotsMod.BRANDING_ID;
|
||||
return "forge";
|
||||
}
|
||||
|
||||
public static String getServerBranding() {
|
||||
return ForgeSnapshotsMod.BRANDING_ID;
|
||||
return "forge";
|
||||
}
|
||||
|
||||
public static ResourceManagerReloadListener resourceManagerReloadListener() {
|
||||
|
||||
@@ -21,25 +21,14 @@ import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class CrashReportExtender
|
||||
{
|
||||
|
||||
public static void extendSystemReport(final SystemReport systemReport)
|
||||
{
|
||||
for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables())
|
||||
{
|
||||
public class CrashReportExtender {
|
||||
public static void extendSystemReport(final SystemReport systemReport) {
|
||||
for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables()) {
|
||||
if (call.isActive())
|
||||
{
|
||||
systemReport.setDetail(call.getLabel(), call);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCrashReportHeader(StringBuilder stringbuilder, CrashReport crashReport)
|
||||
{
|
||||
net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.addCrashReportHeader(stringbuilder, crashReport);
|
||||
}
|
||||
|
||||
public static String generateEnhancedStackTrace(final Throwable throwable) {
|
||||
return generateEnhancedStackTrace(throwable, true);
|
||||
}
|
||||
@@ -55,7 +44,6 @@ public class CrashReportExtender
|
||||
return header ? s : s.substring(s.indexOf(Strings.LINE_SEPARATOR));
|
||||
}
|
||||
|
||||
|
||||
public static File dumpModLoadingCrashReport(final Logger logger, final LoadingFailedException error, final File topLevelDir) {
|
||||
final CrashReport crashReport = CrashReport.forThrowable(new Exception("Mod Loading has failed"), "Mod loading error has occurred");
|
||||
error.getErrors().forEach(mle -> {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.forge.snapshots;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.client.Options;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class ForgeSnapshotsMod
|
||||
{
|
||||
public static final String BRANDING_NAME = "Froge";
|
||||
public static final String BRANDING_ID = "froge";
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
static boolean seenSnapshotWarning = false;
|
||||
|
||||
public static void processOptions(Options.FieldAccess fieldAccess)
|
||||
{
|
||||
seenSnapshotWarning = fieldAccess.process("seenSnapshotWarning", seenSnapshotWarning);
|
||||
}
|
||||
|
||||
public static void logStartupWarning()
|
||||
{
|
||||
LOGGER.warn("Froge is not officially supported. Bugs and instability are expected.");
|
||||
}
|
||||
|
||||
public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport)
|
||||
{
|
||||
builder.append("---- Please note that Minecraft Forge DOES NOT support Froge builds. Bugs and instability are expected. ----\n");
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.forge.snapshots;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ScreenEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class ForgeSnapshotsModClient
|
||||
{
|
||||
public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha)
|
||||
{
|
||||
// Render a warning at the top of the screen
|
||||
Component line = Component.translatable("forge.froge.supportWarning").withStyle(ChatFormatting.RED);
|
||||
guiGraphics.drawCenteredString(font, line, width / 2, 4 + (font.lineHeight + 1) / 2, 0xFFFFFF | alpha);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
static void onScreenOpen(final ScreenEvent.Opening event)
|
||||
{
|
||||
if (ForgeSnapshotsMod.seenSnapshotWarning || !(event.getNewScreen() instanceof TitleScreen titleScreen))
|
||||
return;
|
||||
|
||||
event.setNewScreen(new ConfirmScreen(confirmed -> {
|
||||
if (confirmed)
|
||||
{
|
||||
ForgeSnapshotsMod.seenSnapshotWarning = true;
|
||||
Minecraft.getInstance().options.save();
|
||||
Minecraft.getInstance().setScreen(titleScreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
}, Component.translatable("forge.froge.warningScreen.title"), Component.translatable("forge.froge.warningScreen.text"),
|
||||
CommonComponents.GUI_ACKNOWLEDGE, Component.translatable("forge.gui.exit")));
|
||||
}
|
||||
|
||||
// @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
// static void onGuiOverlayDebugText(final CustomizeGuiOverlayEvent.DebugText event)
|
||||
// {
|
||||
// if (Minecraft.getInstance().options.renderDebug)
|
||||
// {
|
||||
// event.getLeft().add(0, "Minecraft Froge");
|
||||
// event.getRight().add(0, "NOT SUPPORTED");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.forge.snapshots;
|
||||
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.client.Options;
|
||||
|
||||
public class ForgeSnapshotsMod
|
||||
{
|
||||
public static final String BRANDING_NAME = "Forge";
|
||||
public static final String BRANDING_ID = "forge";
|
||||
|
||||
public static void processOptions(Options.FieldAccess fieldAccess) {}
|
||||
|
||||
public static void logStartupWarning() {}
|
||||
|
||||
public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport) {}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.forge.snapshots;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
|
||||
public class ForgeSnapshotsModClient
|
||||
{
|
||||
public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha)
|
||||
{
|
||||
if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED)
|
||||
{
|
||||
// Render a warning at the top of the screen
|
||||
Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED);
|
||||
graphics.drawCenteredString(font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
line = Component.translatable("forge.update.beta.2");
|
||||
graphics.drawCenteredString(font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user