Compare commits

..
14 Commits
Author SHA1 Message Date
berkay8987 4e25d8106c Fix missing forge config UI translation keys (#10912) 2026-11-02 17:30:09 -08:00
LexManos cedee17635 Add protection against large network channel lists 2026-10-12 19:11:17 -07:00
BonsUnleashed fafa95bdf4 Store object holder handlers per registry name (#10899) 2026-10-12 13:46:08 -07:00
coolsim d5d1e3157d Fixed getToolModifiedState for AXE_SCRAPE (#10881) 2026-08-26 18:24:54 -07:00
RealMangoRage b1008b481b Add TooltipContext and TooltipDisplay to ItemTooltipEvent (#10879) 2026-08-20 08:47:20 -07:00
LexManos e14159c05d Fix mod packets being processed after vanilla packets when received in the same tick. 2026-08-13 13:23:46 -07:00
LexManos 211d3aa692 26.1.2 RB 1 2026-07-27 13:34:36 -07:00
LexManos 88bb2217e5 Fix ModList screen selection getting out of sync. Closes #10855 2026-07-27 13:26:59 -07:00
LexManos 278bdfc132 Bump Dependencies, Notably ASM for Java 27 support 2026-07-27 13:24:33 -07:00
Matt 66d4d888eb Add DeltaTracker (partialTick) context to PassDefinitions (#10848) 2026-07-21 11:34:01 -07:00
Meme Man ee1e695124 Update equality check for RegistryObject to include RegistryObject#key. (#10859) 2026-07-21 10:44:44 -07:00
zznty 6435274d1e Handle glfw window pos errors gracefully for wayland (#10852) 2026-07-18 14:36:59 -07:00
6c3729d6e9 ForgeDev 7 (#10821)
Co-authored-by: LexManos <[email protected]>
Co-authored-by: Jonathing <[email protected]>
2026-06-28 13:21:48 -07:00
Matt 6a702686db Toml parsing errors are now visible in the latest log. (#10825) 2026-06-18 11:09:43 -07:00
718 changed files with 6013 additions and 5638 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ name: Publish
on:
push:
branches: [ '26.2' ]
branches: [ '26.1.2' ]
permissions:
contents: read
-1
View File
@@ -38,7 +38,6 @@ src/minecraft
/projects/**/run/
/projects/**/*.launch
/repo/
/rejects-*/
src/*/generated/**/.cache/
# Generated by gradle every import
+1
View File
@@ -785,6 +785,7 @@ forgedev.runs.configureEach {
run.configure { dependsOn finalizeSpawn}
runTest.configure { dependsOn finalizeSpawn}
}
// run gradlew dependencyUpdates --no-parallel
//noinspection UnnecessaryQualifiedReference
tasks.named('dependencyUpdates', com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask) {
+2 -2
View File
@@ -2,8 +2,8 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=26.2-&query=$.promos["26.2-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=26.2-&query=$.promos["26.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=26.1.2-&query=$.promos["26.1.2-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=26.1.2-&query=$.promos["26.1.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon]
Forge is a free, open-source modding API all of your favourite mods use!
@@ -14,14 +14,16 @@ import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
public class CrashReportCallables {
public class CrashReportCallables
{
private static final Logger LOGGER = LogUtils.getLogger();
private static final List<ISystemReportExtender> crashCallables = Collections.synchronizedList(new ArrayList<>());
/**
* Register a custom {@link ISystemReportExtender}
*/
public static void registerCrashCallable(ISystemReportExtender callable) {
public static void registerCrashCallable(ISystemReportExtender callable)
{
crashCallables.add(callable);
}
@@ -31,15 +33,19 @@ public class CrashReportCallables {
* @param headerName The name of the system report entry
* @param reportGenerator The report generator to be called when a crash report is built
*/
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator) {
registerCrashCallable(new ISystemReportExtender() {
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator)
{
registerCrashCallable(new ISystemReportExtender()
{
@Override
public String getLabel() {
public String getLabel()
{
return headerName;
}
@Override
public String get() {
public String get()
{
return reportGenerator.get();
}
});
@@ -52,23 +58,31 @@ public class CrashReportCallables {
* @param reportGenerator The report generator to be called when a crash report is built
* @param active The supplier of the flag to be checked when a crash report is built
*/
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator, BooleanSupplier active) {
registerCrashCallable(new ISystemReportExtender() {
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator, BooleanSupplier active)
{
registerCrashCallable(new ISystemReportExtender()
{
@Override
public String getLabel() {
public String getLabel()
{
return headerName;
}
@Override
public String get() {
public String get()
{
return reportGenerator.get();
}
@Override
public boolean isActive() {
try {
public boolean isActive()
{
try
{
return active.getAsBoolean();
} catch (Throwable t) {
}
catch (Throwable t)
{
LOGGER.warn("CrashCallable '{}' threw an exception while checking the active flag, disabling", headerName, t);
return false;
}
@@ -76,7 +90,8 @@ public class CrashReportCallables {
});
}
public static List<ISystemReportExtender> allCrashCallables() {
public static List<ISystemReportExtender> allCrashCallables()
{
return List.copyOf(crashCallables);
}
}
@@ -7,10 +7,12 @@ package net.minecraftforge.fml;
import java.util.function.Supplier;
public interface ISystemReportExtender extends Supplier<String> {
public interface ISystemReportExtender extends Supplier<String>
{
String getLabel();
default boolean isActive() {
default boolean isActive()
{
return true;
}
}
@@ -53,7 +53,7 @@ public abstract class ModContainer {
Supplier<IExtensionPoint.DisplayTest> displayTestSupplier = switch (displayTestString) {
case "MATCH_VERSION" -> // default displaytest checks for version string match
() -> new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(),
(incoming, _) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
(incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods
IExtensionPoint.DisplayTest.IGNORE_SERVER_VERSION;
case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information
@@ -379,8 +379,8 @@ public final class ModLoader {
@SuppressWarnings("removal")
public static <T extends IModBusEvent> void postEventWrapContainerInModOrder(T event) {
postEventWithWrapInModOrder(event,
(mc, _) -> ModLoadingContext.get().setActiveContainer(mc),
(_, _) -> ModLoadingContext.get().setActiveContainer(null)
(mc, e) -> ModLoadingContext.get().setActiveContainer(mc),
(mc, e) -> ModLoadingContext.get().setActiveContainer(null)
);
}
@@ -9,6 +9,7 @@ import net.minecraftforge.fml.loading.progress.ProgressMeter;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Function;
@@ -99,7 +99,7 @@ final class ModStateTransitionHelper {
results[i] = raw.whenComplete((result, exception) -> list.set(i, new FutureResult<>(result, exception)));
}
return CompletableFuture.allOf(results).handle((_, _)->null).thenApply(_ -> list);
return CompletableFuture.allOf(results).handle((r, th)->null).thenApply(res -> list);
}
private static <T extends IModBusEvent> CompletableFuture<Void> addCompletableFutureTaskForModDispatch(
@@ -135,7 +135,7 @@ final class ModStateTransitionHelper {
handler.run();
mod.acceptEvent(eventGenerator.apply(mod));
}, executor)
.whenComplete((_, exception) -> {
.whenComplete((mc, exception) -> {
mod.modLoadingStage = nextState.apply(mod.modLoadingStage, exception);
progressBar.increment();
ModLoadingContext.get().setActiveContainer(null);
@@ -9,8 +9,8 @@ import java.util.concurrent.Executor;
import java.util.function.BinaryOperator;
public enum ThreadSelector implements BinaryOperator<Executor> {
SYNC((sync, _) -> sync),
PARALLEL((_, parallel) -> parallel);
SYNC((sync, parallel) -> sync),
PARALLEL((sync, parallel) -> parallel);
private final BinaryOperator<Executor> selector;
@@ -13,6 +13,8 @@ import net.minecraftforge.fml.loading.StringUtils;
import java.io.ByteArrayInputStream;
import java.nio.file.Path;
import java.util.Locale;
import java.util.concurrent.Callable;
public class ModConfig
{
@@ -113,14 +113,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
return "fmlearlywindow";
}
@Override
public ImmediateWindowProvider selectBackend(String backend) {
// We only support opengl
if ("default".equals(backend) || "opengl".equals(backend))
return this;
return ImmediateWindowProvider.getFallbackHandler();
}
@Override
public Runnable initialize(String[] arguments) {
String mcVersion = FMLLoader.versionInfo().mcVersion();
@@ -145,7 +137,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
this.colourScheme = ColourScheme.BLACK;
} else {
try {
// check the options file for the color scheme
// check the options file for the colour scheme
var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt")));
var keyName = "darkMojangStudiosBackground:";
for (String line : optionLines) {
@@ -116,7 +116,7 @@ public class RenderElement {
}
public static RenderElement forgeVersionOverlay(SimpleFont font, String version) {
return new RenderElement(RenderElement.initializeText(font, (bb, _, ctx)->
return new RenderElement(RenderElement.initializeText(font, (bb, fnt, ctx)->
font.generateVerticesForTexts(ctx.scaledWidth() - font.stringWidth(version) - 10,
ctx.scaledHeight() - font.lineSpacing() + font.descent() - 10, bb,
new SimpleFont.DisplayText(version, ctx.colourScheme.foreground().packedint(RenderElement.globalAlpha)))));
@@ -178,11 +178,11 @@ public class RenderElement {
var colour = (alpha << 24) | 0xFFFFFF;
Renderer bar;
if (pm.steps() == 0) {
bar = progressBar(ctx->new int[] {(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, _->colour, frame -> indeterminateBar(frame, cnt == 0));
bar = progressBar(ctx->new int[] {(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, f->colour, frame -> indeterminateBar(frame, cnt == 0));
} else {
bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, _ -> colour, _ -> new float[]{0f, pm.progress()});
bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y + font.lineSpacing() - font.descent(), BAR_WIDTH * ctx.scale()}, f -> colour, f -> new float[]{0f, pm.progress()});
}
Renderer label = (bb, ctx, _) -> renderText(font, text((ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, pm.label().getText(), colour), bb, ctx);
Renderer label = (bb, ctx, frame) -> renderText(font, text((ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, pm.label().getText(), colour), bb, ctx);
return bar.then(label);
}
private static float[] indeterminateBar(int frame, boolean isActive) {
@@ -198,9 +198,9 @@ public class RenderElement {
var y = 10 * context.scale();
PerformanceInfo pi = context.performance();
final int colour = hsvToRGB((1.0f - (float)Math.pow(pi.memory(), 1.5f)) / 3f, 1.0f, 0.5f);
var bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, BAR_WIDTH * ctx.scale()}, _ -> colour, _ -> new float[]{0f, pi.memory()});
var bar = progressBar(ctx -> new int[]{(ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, BAR_WIDTH * ctx.scale()}, f -> colour, f -> new float[]{0f, pi.memory()});
var width = font.stringWidth(pi.text());
Renderer label = (bb, ctx, _) -> renderText(font, text(ctx.scaledWidth() / 2 - width / 2, y + 18, pi.text(), context.colourScheme.foreground().packedint(globalAlpha)), bb, ctx);
Renderer label = (bb, ctx, frame) -> renderText(font, text(ctx.scaledWidth() / 2 - width / 2, y + 18, pi.text(), context.colourScheme.foreground().packedint(globalAlpha)), bb, ctx);
bar.then(label).accept(buffer, context, frameNumber);
}
@@ -250,7 +250,7 @@ public class RenderElement {
}
private static Renderer initializeText(SimpleFont font, TextGenerator textGenerator) {
return (bb, context, _) -> renderText(font, textGenerator, bb, context);
return (bb, context, frame) -> renderText(font, textGenerator, bb, context);
}
private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) {
@@ -262,7 +262,7 @@ public class RenderElement {
}
private static TextGenerator text(int x, int y, String text, int colour) {
return (bb, font, _) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
}
private static Renderer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
@@ -109,7 +109,7 @@ public class FMLConfig
}
if (!configSpec.isCorrect(configData)) {
LOGGER.warn(CORE, "Configuration file {} is not correct. Correcting", configFile);
configSpec.correct(configData, (_, path, incorrectValue, correctedValue) ->
configSpec.correct(configData, (action, path, incorrectValue, correctedValue) ->
LOGGER.info(CORE, "Incorrect key {} was corrected from {} to {}", path, incorrectValue, correctedValue));
}
configData.putAllComments(configComments);
@@ -20,8 +20,8 @@ public class FMLEnvironment
public static final boolean secureJarsEnabled = FMLLoader.isSecureJarEnabled();
static void setupInteropEnvironment(IEnvironment environment) {
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), _->naming);
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), _->dist);
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming);
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist);
}
public static class Keys {
@@ -12,6 +12,7 @@ import net.minecraftforge.forgespi.Environment;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@@ -41,7 +42,7 @@ public class FMLServiceProvider implements ITransformationService {
LOGGER.debug(CORE, "Loading configuration");
FMLConfig.load();
LOGGER.debug(CORE, "Preparing ModFile");
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), _->ModFile::new);
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile::new);
LOGGER.debug(CORE, "Preparing launch handler");
FMLLoader.setupLaunchHandler(environment, arguments);
FMLEnvironment.setupInteropEnvironment(environment);
@@ -10,13 +10,8 @@ import net.minecraftforge.fml.loading.progress.StartupNotificationManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import joptsimple.OptionParser;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.function.*;
import java.util.stream.Collectors;
@@ -46,62 +41,16 @@ public class ImmediateWindowHandler {
if (provider == null) {
LOGGER.info("Failed to find ImmediateWindowProvider {}, disabling", providername);
provider = new DummyProvider();
} else {
var backend = findBackend(arguments);
var newProvider = provider.selectBackend(backend);
if (provider != newProvider) {
if (newProvider == null)
newProvider = new DummyProvider();
LOGGER.info("ImmediateWindowProvider {} does not support {}, switching to {}", provider.name(), backend, newProvider.name());
provider = newProvider;
}
}
}
// Only update config if the provider isn't the dummy provider
if (!Objects.equals(provider.name(), "dummyprovider"))
FMLConfig.updateConfig(FMLConfig.ConfigValue.EARLY_WINDOW_PROVIDER, provider.name());
FMLLoader.progressWindowTick = provider.initialize(arguments);
earlyProgress = StartupNotificationManager.addProgressBar("EARLY", 0);
earlyProgress.label("Bootstrapping Minecraft");
}
private static String findBackend(String[] arguments) {
// Try and parse from the command line arguments
var parser = new OptionParser();
var backendOption = parser.accepts("graphicsBackend").withRequiredArg();
parser.allowsUnrecognizedOptions();
var parsed = parser.parse(arguments);
if (parsed.has(backendOption))
return parsed.valueOf(backendOption).toLowerCase(Locale.ENGLISH);
// Read the options.txt if it exists.
var optionsFile = FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt"));
if (!Files.exists(optionsFile)) // Default is OpenGL first
return "default";
List<String> lines = null;
try {
lines = Files.readAllLines(optionsFile);
} catch (IOException e) {
return "default"; // We failed to read for some reason, assume we're using the default.
}
final String key = "preferredGraphicsBackend:";
for (var line : lines) {
if (line.startsWith(key)) {
var backend = line.substring(key.length() + 1, line.length() - 1);
return backend.toLowerCase(Locale.ENGLISH);
}
}
return "default";
}
public static long setupMinecraftWindow(final int width, final int height, final String title, final long monitor, final Supplier<Object> backend) {
return provider.setupMinecraftWindow(width, height, title, monitor, backend);
}
@@ -134,7 +83,7 @@ public class ImmediateWindowHandler {
earlyProgress.label(message);
}
record DummyProvider() implements ImmediateWindowProvider {
private record DummyProvider() implements ImmediateWindowProvider {
private static Method NV_HANDOFF;
private static Method NV_POSITION;
private static Method NV_OVERLAY;
@@ -24,36 +24,11 @@ import java.util.function.Supplier;
* No doubt many more things can be said here.
*/
public interface ImmediateWindowProvider {
/**
* Returns a new instance of ImmediateWindowProvider which just bounces to the vanilla code.
* This can be useful when you want to disable your provider and defer to vanilla behavior for some reason.
*/
public static ImmediateWindowProvider getFallbackHandler() {
return new ImmediateWindowHandler.DummyProvider();
}
/**
* @return The name of this window provider. Do NOT use fmlearlywindow.
*/
String name();
/**
* This is called before initialize, but after reading the preferred graphics backend config value from the user's
* options.txt or command line.
*
* If you do not support the requested backend, you can return a new ImmediateWindowProvider that does.
* {@link #getFallbackHandler()} can be used to get an instance that falls back to Vanilla's code effectively
* disabling the early loading screen.
*
* @param backend - The backend the user has selected, known values: "default", "opengl", and "vulkan". However this
* is read from the config file, or command line arguments so could be anything.
* Default and OpenGL are treated the same, attempting to load OpenGL first, then Vulkan.
* Vulkan attempts to load Vulkan first then OpenGL
*/
default ImmediateWindowProvider selectBackend(String backend) {
return this;
}
/**
* This is called very early on to initialize ourselves. Use this to initialize the window and other GL core resources.
*
@@ -7,6 +7,7 @@ package net.minecraftforge.fml.loading;
import com.mojang.logging.LogUtils;
import cpw.mods.modlauncher.api.INameMappingService;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import java.io.BufferedReader;
@@ -6,6 +6,7 @@
package net.minecraftforge.fml.loading;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Convert a maven coordinate into a Path.
@@ -26,7 +26,6 @@ public class StringUtils {
return java.util.stream.Stream.of(endings).anyMatch(lowerSearch::endsWith);
}
@SuppressWarnings("deprecation")
public static URL toURL(final String string) {
if (string == null || string.trim().isEmpty() || string.contains("myurl.me") || string.contains("example.invalid"))
return null;
@@ -13,6 +13,7 @@ import org.jetbrains.annotations.ApiStatus;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.BiPredicate;
@ApiStatus.Internal // since 1.21.1, will be made non-public in a later MC version
public class VersionSupportMatrix {
@@ -7,6 +7,7 @@ package net.minecraftforge.fml.loading.moddiscovery;
import com.mojang.logging.LogUtils;
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.LogMarkers;
import net.minecraftforge.forgespi.language.ModFileScanData;
import org.slf4j.Logger;
@@ -55,7 +56,7 @@ public final class BackgroundScanHandler {
ImmediateWindowHandler.updateProgress("Scanning mod candidates");
CompletableFuture<ModFileScanData> future = CompletableFuture.supplyAsync(file::compileContent, modContentScanner)
.whenComplete(file::setScanResult);
if (DEBUG) future = future.whenComplete((_, t) -> addCompletedFile(file, t));
if (DEBUG) future = future.whenComplete((r, t) -> addCompletedFile(file, t));
file.setFutureScanResult(future);
}
@@ -24,7 +24,7 @@ public enum InvalidModIdentifier {
LITELOADER(filePresent("litemod.json")),
OPTIFINE(filePresent("optifine/Installer.class")),
BUKKIT(filePresent("plugin.yml")),
INVALIDZIP((_,zf) -> zf.isEmpty()); // note: only this one INVALIDZIP check is ran until the todo on this class is fixed
INVALIDZIP((f,zf) -> zf.isEmpty()); // note: only this one INVALIDZIP check is ran until the todo on this class is fixed
private final BiPredicate<Path, Optional<ZipFile>> ident;
@@ -51,7 +51,7 @@ public enum InvalidModIdentifier {
private static BiPredicate<Path, Optional<ZipFile>> filePresent(String filename)
{
return (_, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false);
return (f, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false);
}
private static <T> Optional<T> optionalFromException(Supplier_WithExceptions<T, ? extends Exception> supp)
@@ -145,7 +145,7 @@ public class JarInJarDependencyLocator extends AbstractModProvider implements ID
var ids = new TreeMap<String, List<Entry>>();
for (var entry : selector.entries.values()) {
if (entry != FAILED && entry.coord != null)
ids.computeIfAbsent(entry.coord, _ -> new ArrayList<>()).add(entry);
ids.computeIfAbsent(entry.coord, id -> new ArrayList<>()).add(entry);
}
for (var entry : ids.entrySet()) {
@@ -27,7 +27,7 @@ public final class MinecraftLocator extends AbstractModProvider implements IModL
// Minecraft itself.
var meta = new ModJarMetadata();
var mcjar = SecureJar.from(_ -> meta, paths);
var mcjar = SecureJar.from(jar -> meta, paths);
var mc = ModFileFactory.FACTORY.build(mcjar, this, MinecraftLocator::buildMinecraftTOML);
meta.setModFile(mc);
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading.moddiscovery;
import com.google.common.collect.ImmutableMap;
import com.mojang.logging.LogUtils;
import cpw.mods.jarhandling.SecureJar;
import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.loading.LanguageLoadingProvider;
import net.minecraftforge.fml.loading.LogMarkers;
import net.minecraftforge.forgespi.language.IModFileInfo;
@@ -25,6 +26,7 @@ import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -35,18 +35,16 @@ public class ModFileParser {
LOGGER.warn(LogMarkers.LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
return null;
}
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
try {
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
return new ModFileInfo(modFile, configWrapper, configWrapper::setFile);
} catch (ParsingException e) { // Handle landmine toml errors, e.g. incorrectly ported mods.
} catch (ParsingException e) {
LOGGER.error("Mod candidate {} contains a corrupt or misconfigured toml.", modFile.getFileName());
throw new ModFileLoadingException("Mod candidate " + modFile.getFileName() + " contains a corrupt or misconfigured toml.");
} catch (Exception other) { // Otherwise this is just someone who (probably) forgot a comma or something.
LOGGER.error("Mod candidate {}'s toml .", modFile.getFileName());
throw new ModFileLoadingException("Mod candidate " + modFile.getFileName() + " contains broken toml, likely due to a typo.");
}
}
@@ -56,7 +56,7 @@ public class StartupNotificationManager {
private synchronized static void addMessage(Message.MessageType type, String message, int maxSize)
{
EnumMap<Message.MessageType, List<Message>> newMessages = new EnumMap<>(messages);
newMessages.compute(type, (_, existingList) -> {
newMessages.compute(type, (key, existingList) -> {
List<Message> newList = new ArrayList<>();
if (existingList != null)
{
@@ -141,7 +141,7 @@ abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
protected static Path getForgeOnly(Path forge) {
var packages = getPackages(); // Pulled out so it is passed to the lambda as value
// We need to separate out our resources/code so that we can show up as a different data pack.
var modJar = SecureJar.from((path, _) -> {
var modJar = SecureJar.from((path, base) -> {
if (!path.endsWith(".class")) return true;
for (var pkg : packages)
if (path.startsWith(pkg)) return true;
@@ -112,7 +112,7 @@ public final class ForgeDevLocator extends AbstractModProvider implements IModLo
// We want just the class files from the root of the input paths. So make a new union with a filter.
var classes = UnionHelper.newFileSystem(
(name, _) -> {
(name, base) -> {
if (name.endsWith("/")) {
if (name.startsWith("/"))
name = name.substring(1);
@@ -164,7 +164,7 @@ public final class ForgeDevLocator extends AbstractModProvider implements IModLo
if ("value".equals(key)) {
int idx = clsName.lastIndexOf('/');
var pkg = clsName.substring(0, idx);
mods.computeIfAbsent(pkg, _ -> new HashSet<>()).add((String)value);
mods.computeIfAbsent(pkg, k -> new HashSet<>()).add((String)value);
idx = pkg.lastIndexOf('/');
while (idx != -1) {
@@ -126,7 +126,7 @@ record FieldToMethodTransformer(String className, Map<String, String> fields) im
throw new IllegalStateException("No field with name " + fieldName + " found");
if (!Modifier.isPrivate(foundField.access) || Modifier.isStatic(foundField.access))
throw new IllegalStateException("Field " + classNode.name + '.' + fieldName + " is not private and an instance field");
throw new IllegalStateException("Field " + fieldName + " is not private and an instance field");
var methodSignature = "()" + foundField.desc;
var foundMethod = findMethod(classNode, methodName, methodSignature);
@@ -41,7 +41,7 @@ record MethodRedirector() implements ITransformer<ClassNode> {
"finalizeSpawn",
"(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
GSON.fromJson(new InputStreamReader(sneak(() -> MethodRedirector.class.getModule().getResourceAsStream("coremods/finalize_spawn_targets.json"))), Target[].class),
_ -> new MethodInsnNode(
insn -> new MethodInsnNode(
Opcodes.INVOKESTATIC,
"net/minecraftforge/event/ForgeEventFactory",
"onFinalizeSpawn",
@@ -1,8 +1,8 @@
[
{
"class": "net/minecraft/gametest/framework/GameTestEntityBuilder",
"class": "net/minecraft/gametest/framework/GameTestHelper",
"methods": [
"spawn()Lnet/minecraft/world/entity/Entity;"
"spawn(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;"
]
},
{
@@ -20,7 +20,7 @@
{
"class": "net/minecraft/world/entity/EntityType",
"methods": [
"create(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/PostSpawnProcessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/EntitySpawnReason;ZZ)Lnet/minecraft/world/entity/Entity;"
"create(Lnet/minecraft/server/level/ServerLevel;Ljava/util/function/Consumer;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/EntitySpawnReason;ZZ)Lnet/minecraft/world/entity/Entity;"
]
},
{
@@ -81,7 +81,7 @@ public class FMLJavaModLanguageProvider implements IModLanguageProvider
.filter(ad -> ad.annotationType().equals(MODANNOTATION))
.peek(ad -> LOGGER.debug(SCAN, "Found @Mod class {} with id {}", ad.clazz().getClassName(), ad.annotationData().get("value")))
.map(ad -> new FMLModTarget(ad.clazz().getClassName(), (String)ad.annotationData().get("value")))
.collect(Collectors.toMap(FMLModTarget::modId, Function.identity(), (a, _) -> a));
.collect(Collectors.toMap(FMLModTarget::modId, Function.identity(), (a,b)->a));
scanResult.addLanguageLoader(modTargetMap);
};
}
@@ -74,7 +74,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider
.flatMap(fi->fi.getMods().stream())
.map(IModInfo::getModId)
.map(LowCodeModTarget::new)
.collect(Collectors.toMap(LowCodeModTarget::modId, Function.identity(), (a, _)->a));
.collect(Collectors.toMap(LowCodeModTarget::modId, Function.identity(), (a, b)->a));
scanResult.addLanguageLoader(modTargetMap);
};
}
+4 -4
View File
@@ -1,6 +1,6 @@
[versions]
java = "25"
minecraft = "26.2"
minecraft-next = "26.3"
mcp = "20260616.103818"
changelog-base = "65.0"
minecraft = "26.1.2"
minecraft-next = "26.2"
mcp = "20260409.101008"
changelog-base = "64.0"
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
@@ -201,6 +_,9 @@
@@ -111,6 +_,9 @@
GlStateManager._colorMask(15);
GlStateManager._clear(16384);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
@@ -1,35 +1,35 @@
--- a/com/mojang/blaze3d/opengl/GlConst.java
+++ b/com/mojang/blaze3d/opengl/GlConst.java
@@ -239,6 +_,10 @@
@@ -249,6 +_,10 @@
}
public static int toGlInternalId(final GpuFormat gpuFormat) {
+ return toGlInternalId(gpuFormat, false);
public static int toGlInternalId(final TextureFormat textureFormat) {
+ return toGlInternalId(textureFormat, false);
+ }
+ public static int toGlInternalId(final GpuFormat gpuFormat, final boolean stencil) {
+ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8;
return switch (gpuFormat) {
case R8_UNORM -> 33321;
case R8_SNORM -> 36756;
@@ -291,6 +_,10 @@
+ public static int toGlInternalId(final TextureFormat textureFormat, final boolean stencil) {
+ if (stencil && textureFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8;
return switch (textureFormat) {
case RGBA8 -> 32856;
case RED8 -> 33321;
@@ -258,6 +_,10 @@
}
public static int toGlExternalId(final GpuFormat gpuFormat) {
+ return toGlExternalId(gpuFormat, false);
public static int toGlExternalId(final TextureFormat textureFormat) {
+ return toGlExternalId(textureFormat, false);
+ }
+ public static int toGlExternalId(final GpuFormat gpuFormat, final boolean stencil) {
+ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL;
return switch (gpuFormat) {
case R8_UNORM, R8_SNORM, R16_UNORM, R16_SNORM, R16_FLOAT, R32_FLOAT -> 6403;
case RG8_UNORM, RG8_SNORM, RG16_UNORM, RG16_SNORM, RG16_FLOAT, RG32_FLOAT -> 33319;
@@ -308,6 +_,10 @@
+ public static int toGlExternalId(final TextureFormat textureFormat, final boolean stencil) {
+ if (stencil && textureFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL;
return switch (textureFormat) {
case RGBA8 -> 6408;
case RED8 -> 6403;
@@ -267,6 +_,10 @@
}
public static int toGlType(final GpuFormat gpuFormat) {
+ return toGlType(gpuFormat, false);
public static int toGlType(final TextureFormat textureFormat) {
+ return toGlType(textureFormat, false);
+ }
+ public static int toGlType(final GpuFormat gpuFormat, boolean stencil) {
+ if (stencil && gpuFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
return switch (gpuFormat) {
case R8_UNORM, RG8_UNORM, RGB8_UNORM, RGBA8_UNORM, R8_UINT, RG8_UINT, RGBA8_UINT, S8_UINT, RGB8_UINT -> 5121;
case R8_SNORM, RG8_SNORM, RGB8_SNORM, RGBA8_SNORM, R8_SINT, RG8_SINT, RGBA8_SINT, RGB8_SINT -> 5120;
+ public static int toGlType(final TextureFormat textureFormat, boolean stencil) {
+ if (stencil && textureFormat.hasDepthAspect()) return org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
return switch (textureFormat) {
case RGBA8 -> 5121;
case RED8 -> 5121;
@@ -15,7 +15,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
private static final int CIRCULAR_LOG_SIZE = 10;
private final Queue<GlDebug.LogEntry> MESSAGE_BUFFER = EvictingQueue.create(10);
@@ -83,6 +_,8 @@
@@ -103,6 +_,8 @@
}
LOGGER.info("OpenGL debug message: {}", entry);
@@ -24,21 +24,21 @@
}
public List<String> getLastOpenGlDebugMessages() {
@@ -107,7 +_,7 @@
GlDebug debug = new GlDebug();
enabledExtensions.add("GL_KHR_debug");
GL33C.glEnable(37600);
- if (debugSynchronousGlLogs) {
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
GL33C.glEnable(33346);
}
@@ -126,7 +_,7 @@
GlDebug debug = new GlDebug();
enabledExtensions.add("GL_KHR_debug");
GL11.glEnable(37600);
- if (debugSynchronousGlLogs) {
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
GL11.glEnable(33346);
}
@@ -121,7 +_,7 @@
} else if (caps.GL_ARB_debug_output && GlDevice.USE_GL_ARB_debug_output) {
GlDebug debug = new GlDebug();
enabledExtensions.add("GL_ARB_debug_output");
- if (debugSynchronousGlLogs) {
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
GL33C.glEnable(33346);
}
@@ -140,7 +_,7 @@
} else if (caps.GL_ARB_debug_output && GlDevice.USE_GL_ARB_debug_output) {
GlDebug debug = new GlDebug();
enabledExtensions.add("GL_ARB_debug_output");
- if (debugSynchronousGlLogs) {
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
GL11.glEnable(33346);
}
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlDevice.java
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
@@ -150,7 +_,12 @@
@@ -129,7 +_,12 @@
final int depthOrLayers,
final int mipLevels
) {
@@ -9,12 +9,12 @@
+ }
+
+ @Override
+ public GpuTexture createTexture(final @Nullable Supplier<String> label, @GpuTexture.Usage final int usage, final GpuFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, final boolean stencil) {
+ public GpuTexture createTexture(final @Nullable Supplier<String> label, @GpuTexture.Usage final int usage, final TextureFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, final boolean stencil ) {
+ return this.createTexture(this.debugLabels.exists() && label != null ? label.get() : null, usage, format, width, height, depthOrLayers, mipLevels, stencil);
}
@Override
@@ -163,6 +_,11 @@
@@ -142,6 +_,11 @@
final int depthOrLayers,
final int mipLevels
) {
@@ -22,29 +22,41 @@
+ }
+
+ @Override
+ public GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, final GpuFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, boolean stencil) {
+ public GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, final TextureFormat format, final int width, final int height, final int depthOrLayers, final int mipLevels, boolean stencil) {
GlStateManager.clearGlErrors();
int id = GlStateManager._genTexture();
if (label == null) {
@@ -186,9 +_,9 @@
GlStateManager._texParameter(target, 34892, 0);
}
- int glInternalID = GlConst.toGlInternalId(format);
- int glExternalID = GlConst.toGlExternalId(format);
- int glType = GlConst.toGlType(format);
+ int glInternalID = GlConst.toGlInternalId(format, stencil);
+ int glExternalID = GlConst.toGlExternalId(format, stencil);
+ int glType = GlConst.toGlType(format, stencil);
if (glInternalID != 0 && glExternalID != 0 && glType != 0) {
if (isCubemap) {
for (int cubeTarget : GlConst.CUBEMAP_TARGETS) {
@@ -211,7 +_,7 @@
throw new IllegalStateException("OpenGL error " + error);
@@ -171,12 +_,12 @@
GlStateManager._texImage2D(
cubeTarget,
i,
- GlConst.toGlInternalId(format),
+ GlConst.toGlInternalId(format, stencil),
width >> i,
height >> i,
0,
- GlConst.toGlExternalId(format),
- GlConst.toGlType(format),
+ GlConst.toGlExternalId(format, stencil),
+ GlConst.toGlType(format, stencil),
null
);
}
@@ -184,7 +_,7 @@
} else {
for (int i = 0; i < mipLevels; i++) {
GlStateManager._texImage2D(
- target, i, GlConst.toGlInternalId(format), width >> i, height >> i, 0, GlConst.toGlExternalId(format), GlConst.toGlType(format), null
+ target, i, GlConst.toGlInternalId(format, stencil), width >> i, height >> i, 0, GlConst.toGlExternalId(format, stencil), GlConst.toGlType(format, stencil), null
);
}
- GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, this.frameBufferCache);
+ GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, this.frameBufferCache, stencil);
}
@@ -195,7 +_,7 @@
} else if (error != 0) {
throw new IllegalStateException("OpenGL error " + error);
} else {
- GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id);
+ GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, stencil);
this.debugLabels.applyLabel(texture);
return texture;
} else {
}
@@ -1,18 +1,18 @@
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
@@ -80,6 +_,11 @@
@@ -86,6 +_,11 @@
}
}
+ public static boolean _isBlendEnabled(int index) {
+ public static boolean _isBlendEnabled() {
+ RenderSystem.assertOnRenderThread();
+ return BLEND[index].mode.enabled;
+ return BLEND.mode.enabled;
+ }
+
public static void _disableBlend(int index) {
public static void _disableBlend() {
RenderSystem.assertOnRenderThread();
BLEND[index].mode.disable();
@@ -390,9 +_,17 @@
BLEND.mode.disable();
@@ -380,9 +_,17 @@
}
}
@@ -22,8 +22,8 @@
+
public static void _texParameter(final int target, final int name, final int value) {
RenderSystem.assertOnRenderThread();
GL33C.glTexParameteri(target, name, value);
+ if (target == GL33C.GL_TEXTURE1) {
GL11.glTexParameteri(target, name, value);
+ if (target == GL13.GL_TEXTURE1) {
+ lastBrightnessX = name;
+ lastBrightnessY = value;
+ }
@@ -1,21 +1,20 @@
--- a/com/mojang/blaze3d/opengl/GlTexture.java
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
@@ -27,9 +_,14 @@
final int id,
final FrameBufferCache frameBufferCache
@@ -28,8 +_,13 @@
final int mipLevels,
final int id
) {
+ this(usage, label, format, width, height, depthOrLayers, mipLevels, id, frameBufferCache, false);
+ this(usage, label, format, width, height, depthOrLayers, mipLevels, id, false);
+ }
+
+ protected GlTexture(@GpuTexture.Usage int usage, String label, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, int id, FrameBufferCache frameBufferCache, boolean stencil) {
+ protected GlTexture(int usage, String label, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, int id, boolean stencil) {
super(usage, label, format, width, height, depthOrLayers, mipLevels);
this.id = id;
this.frameBufferCache = frameBufferCache;
+ this.stencilEnabled = stencil;
}
@Override
@@ -84,5 +_,12 @@
@@ -96,5 +_,12 @@
if (this.closed && this.views == 0) {
this.destroyImmediately();
}
@@ -1,15 +1,15 @@
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -83,7 +_,7 @@
@@ -80,7 +_,7 @@
this.width = width;
this.height = height;
if (this.useDepth) {
- this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, GpuFormat.D32_FLOAT, width, height, 1, 1);
+ this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, GpuFormat.D32_FLOAT, width, height, 1, 1, this.stencilEnabled);
- this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1);
+ this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1, this.stencilEnabled);
this.depthTextureView = device.createTextureView(this.depthTexture);
}
@@ -121,5 +_,26 @@
@@ -124,5 +_,26 @@
public @Nullable GpuTextureView getDepthTextureView() {
return this.depthTextureView;
@@ -1,17 +1,17 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -101,8 +_,9 @@
Monitor initialMonitor = monitorManager.getMonitor(GLFW.glfwGetPrimaryMonitor());
@@ -97,8 +_,9 @@
Monitor initialMonitor = this.screenManager.getMonitor(GLFW.glfwGetPrimaryMonitor());
this.windowedWidth = this.width = allowedWindowMinSize(displayData.width());
this.windowedHeight = this.height = allowedWindowMinSize(displayData.height());
- this.handle = this.createWindow(backend, this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.monitor() : 0L);
+ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.monitor() : 0L, () -> backend);
- this.handle = this.createWindow(backend, this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.getMonitor() : 0L);
+ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.getMonitor() : 0L, () -> backend);
this.backend = backend;
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(initialMonitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) {
if (initialMonitor != null) {
VideoMode mode = initialMonitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
this.windowedX = this.x = initialMonitor.x() + mode.getWidth() / 2 - this.width / 2;
@@ -114,6 +_,7 @@
this.windowedX = this.x = initialMonitor.getX() + mode.getWidth() / 2 - this.width / 2;
@@ -110,6 +_,7 @@
this.windowedX = this.x = actualX[0];
this.windowedY = this.y = actualY[0];
}
@@ -19,8 +19,8 @@
this.setMode();
this.refreshFramebufferSize();
@@ -306,6 +_,9 @@
outHeight[0] = this.isSoftScreen() ? outHeight[0] - 1 : outHeight[0];
@@ -300,6 +_,9 @@
GLFW.glfwGetFramebufferSize(this.handle, outWidth, outHeight);
this.framebufferWidth = outWidth[0] > 0 ? outWidth[0] : 1;
this.framebufferHeight = outHeight[0] > 0 ? outHeight[0] : 1;
+ if (this.framebufferHeight == 0 || this.framebufferWidth == 0) {
@@ -1,14 +1,14 @@
--- a/com/mojang/blaze3d/systems/GpuDevice.java
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
@@ -73,6 +_,21 @@
@@ -61,6 +_,21 @@
return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
}
+ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
+ public GpuTexture createTexture(
+ final @Nullable Supplier<String> label,
+ @GpuTexture.Usage final int usage,
+ final GpuFormat format,
+ final TextureFormat format,
+ final int width,
+ final int height,
+ final int depthOrLayers,
@@ -21,18 +21,18 @@
+
public GpuTexture createTexture(
final @Nullable String label,
final @GpuTexture.Usage int usage,
@@ -84,6 +_,21 @@
@GpuTexture.Usage final int usage,
@@ -72,6 +_,21 @@
) {
this.verifyTextureCreationArgs(usage, width, height, depthOrLayers, mipLevels);
return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
+ }
+
+ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
+ public GpuTexture createTexture(
+ final @Nullable String label,
+ @GpuTexture.Usage final int usage,
+ final GpuFormat format,
+ final TextureFormat format,
+ final int width,
+ final int height,
+ final int depthOrLayers,
@@ -43,4 +43,4 @@
+ return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels, stencil);
}
private void verifyTextureCreationArgs(final @GpuTexture.Usage int usage, final int width, final int height, final int depthOrLayers, final int mipLevels) {
private void verifyTextureCreationArgs(@GpuTexture.Usage final int usage, final int width, final int height, final int depthOrLayers, final int mipLevels) {
@@ -1,18 +1,20 @@
--- a/com/mojang/blaze3d/systems/GpuDeviceBackend.java
+++ b/com/mojang/blaze3d/systems/GpuDeviceBackend.java
@@ -32,7 +_,17 @@
@Nullable Supplier<String> label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels
@@ -30,9 +_,19 @@
@Nullable Supplier<String> label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels
);
+ /** Forge: same as {@link #createTexture(Supplier<String>, int, GpuFormat, int, int, int)} but with stencil support */
+ default GpuTexture createTexture(@Nullable Supplier<String> label, @GpuTexture.Usage final int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) {
+ /** Forge: same as {@link #createTexture(Supplier<String>, int, TextureFormat, int, int, int)} but with stencil support */
+ default GpuTexture createTexture(@Nullable Supplier<String> label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) {
+ return createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
+ }
+
GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels);
GpuTexture createTexture(
@Nullable String label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels
);
+
+ /** Forge: same as {@link #createTexture(String, int, GpuFormat, int, int, int)} but with stencil support */
+ default GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) {
+ /** Forge: same as {@link #createTexture(String, int, TextureFormat, int, int, int)} but with stencil support */
+ default GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) {
+ return createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
+ }
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/textures/GpuTexture.java
+++ b/com/mojang/blaze3d/textures/GpuTexture.java
@@ -9,7 +_,7 @@
@@ -8,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
@@ -1,31 +1,32 @@
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
@@ -19,6 +_,7 @@
private final int vertexSize;
private final int stepRate;
private final List<VertexFormatElement> elementValues;
@@ -29,6 +_,7 @@
private final int[] offsetsByElement = new int[32];
private @Nullable GpuBuffer immediateDrawVertexBuffer;
private @Nullable GpuBuffer immediateDrawIndexBuffer;
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
private VertexFormat(final List<VertexFormatElement> elements, final int vertexSize, final int stepRate) {
this.vertexSize = vertexSize;
@@ -29,6 +_,11 @@
private VertexFormat(final List<VertexFormatElement> elements, final List<String> names, final IntList offsets, final int vertexSize) {
this.elements = elements;
@@ -41,6 +_,11 @@
int index = element != null ? elements.indexOf(element) : -1;
this.offsetsByElement[id] = index != -1 ? offsets.getInt(index) : -1;
}
this.elementValues = elements;
+
+ var elementMapping = com.google.common.collect.ImmutableMap.<String, VertexFormatElement>builder();
+ for (var element : elements)
+ elementMapping.put(element.name(), element);
+ ImmutableMap.Builder<String, VertexFormatElement> elementMapping = ImmutableMap.builder();
+ for (int i = 0; i < elements.size(); i++)
+ elementMapping.put(names.get(i), elements.get(i));
+ this.elementMapping = elementMapping.buildOrThrow();
}
public static VertexFormat.Builder builder(final int stepRate) {
@@ -69,6 +_,8 @@
public int hashCode() {
return this.elementValues.hashCode();
public static VertexFormat.Builder builder() {
@@ -139,6 +_,9 @@
this.immediateDrawIndexBuffer = uploadToBuffer(this.immediateDrawIndexBuffer, buffer, 72, () -> "Immediate index buffer for " + this);
return this.immediateDrawIndexBuffer;
}
+
+ public com.google.common.collect.ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
+ public int getOffset(int index) { return offsetsByElement[index]; }
@OnlyIn(Dist.CLIENT)
public static class Builder {
@@ -1,6 +1,6 @@
--- a/com/mojang/math/Transformation.java
+++ b/com/mojang/math/Transformation.java
@@ -14,7 +_,7 @@
@@ -16,7 +_,7 @@
import org.joml.Vector3fc;
import org.jspecify.annotations.Nullable;
@@ -9,21 +9,21 @@
private static final Vector3fc ZERO_TRANSLATION = new Vector3f();
private static final Vector3fc UNIT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
private static final Quaternionfc ZERO_ROTATION = new Quaternionf();
@@ -172,6 +_,20 @@
@@ -171,6 +_,20 @@
this.scale().lerp(that.scale(), progress, new Vector3f()),
this.rightRotation().slerp(that.rightRotation(), progress, new Quaternionf())
);
+ }
+
+ private org.joml.Matrix3f normalTransform = null;
+ public org.joml.Matrix3f getNormalMatrix() {
+ private Matrix3f normalTransform = null;
+ public Matrix3f getNormalMatrix() {
+ checkNormalTransform();
+ return normalTransform;
+ }
+
+ private void checkNormalTransform() {
+ if (normalTransform == null) {
+ normalTransform = new org.joml.Matrix3f(matrix);
+ normalTransform = new Matrix3f(matrix);
+ normalTransform.invert();
+ normalTransform.transpose();
+ }
@@ -6,7 +6,7 @@
@Override
+ public boolean keyPressed(net.minecraft.client.input.KeyEvent event) {
+ if (event.key() == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
+ minecraft.gui.setScreen(this.nextScreen);
+ minecraft.setScreen(this.nextScreen);
+ return true;
+ }
+ return super.keyPressed(event);
@@ -1,6 +1,6 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
@@ -300,7 +_,7 @@
@@ -302,7 +_,7 @@
int y = this.getY();
graphics.blit(RenderPipelines.GUI_TEXTURED, this.image, x + 2, y + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, color);
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, x, y, 60, 60, color);
@@ -1,7 +1,7 @@
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -58,14 +_,9 @@
if (this.uncategorizedStackTrace.length > 0) {
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
builder.append("-- Head --\n");
builder.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
- builder.append("Stacktrace:\n");
@@ -26,20 +26,23 @@
this.systemReport.appendToCrashReportString(builder);
}
@@ -84,15 +_,7 @@
exception = replaceMessage(exception, this.title);
@@ -92,18 +_,7 @@
exception.setStackTrace(this.exception.getStackTrace());
}
- String var4;
- try {
- writer = new StringWriter();
- printWriter = new PrintWriter(writer);
- exception.printStackTrace(printWriter);
- return writer.toString();
- var4 = writer.toString();
- } finally {
- IOUtils.closeQuietly(writer);
- IOUtils.closeQuietly(printWriter);
- IOUtils.closeQuietly((Writer)writer);
- IOUtils.closeQuietly((Writer)printWriter);
- }
-
- return var4;
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(exception);
}
private static Throwable copyProperties(final Throwable original, final Throwable copy) {
public String getFriendlyReport(final ReportType reportType, final List<String> extraComments) {
@@ -1,21 +1,21 @@
--- a/net/minecraft/CrashReportCategory.java
+++ b/net/minecraft/CrashReportCategory.java
@@ -138,8 +_,10 @@
@@ -140,8 +_,10 @@
if (full.length <= 0) {
return 0;
} else {
- this.stackTrace = new StackTraceElement[full.length - 3 - nestedOffset];
- System.arraycopy(full, 3 + nestedOffset, this.stackTrace, 0, this.stackTrace.length);
+ int len = full.length - 3 - nestedOffset;
+ if (len <= 0) len = full.length;
+ this.stackTrace = new StackTraceElement[len];
+ System.arraycopy(full, full.length - len, this.stackTrace, 0, this.stackTrace.length);
return this.stackTrace.length;
}
- this.stackTrace = new StackTraceElement[full.length - 3 - nestedOffset];
- System.arraycopy(full, 3 + nestedOffset, this.stackTrace, 0, this.stackTrace.length);
+ int len = full.length - 3 - nestedOffset;
+ if (len <= 0) len = full.length;
+ this.stackTrace = new StackTraceElement[len];
+ System.arraycopy(full, full.length - len, this.stackTrace, 0, this.stackTrace.length);
return this.stackTrace.length;
}
@@ -188,16 +_,16 @@
@@ -181,16 +_,16 @@
if (this.stackTrace.length > 0) {
if (this.stackTrace != null && this.stackTrace.length > 0) {
builder.append("\nStacktrace:");
-
- for (StackTraceElement element : this.stackTrace) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -218,6 +_,7 @@
@@ -216,6 +_,7 @@
}
static {
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -220,7 +_,11 @@
@@ -219,7 +_,11 @@
}
public AdvancementHolder save(final Consumer<AdvancementHolder> output, final String name) {
@@ -1,12 +1,13 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -224,11 +_,13 @@
@@ -217,12 +_,14 @@
return 90.0F;
} else {
float fov = this.minecraft.options.fov().get().intValue() * Mth.lerp(partialTicks, this.oldFovModifier, this.fovModifier);
- return this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
+ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, true).getFOV();
}
float fov = this.minecraft.options.fov().get().intValue() * Mth.lerp(partialTicks, this.oldFovModifier, this.fovModifier);
- return this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
+ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, true).getFOV();
}
private float calculateHudFov(final float partialTicks) {
@@ -16,7 +17,7 @@
}
private float modifyFovBasedOnDeathOrFluid(final float partialTicks, float fov) {
@@ -337,9 +_,13 @@
@@ -331,9 +_,13 @@
}
protected void setRotation(final float yRot, final float xRot) {
@@ -31,7 +32,7 @@
FORWARDS.rotate(this.rotation, this.forwards);
UP.rotate(this.rotation, this.up);
LEFT.rotate(this.rotation, this.left);
@@ -370,6 +_,13 @@
@@ -364,6 +_,13 @@
public float yRot() {
return this.yRot;
@@ -70,7 +70,7 @@
return this.key.equals(that.key);
}
@@ -179,11 +_,13 @@
@@ -175,11 +_,13 @@
}
public Component getTranslatedKeyMessage() {
@@ -85,7 +85,7 @@
}
public String saveString() {
@@ -195,11 +_,94 @@
@@ -191,11 +_,94 @@
}
private void registerMapping(final InputConstants.Key key) {
@@ -1,24 +1,24 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -478,7 +_,7 @@
if (screen != null) {
try {
if (action != 1 && action != 2) {
- if (action == 0 && screen.keyReleased(event)) {
+ if (action == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, event)) {
if (options.keyDebugModifier.matches(event)) {
this.usedDebugKeyAsModifier = false;
}
@@ -487,7 +_,7 @@
@@ -514,7 +_,7 @@
if (screen != null) {
try {
if (action != 1 && action != 2) {
- if (action == 0 && screen.keyReleased(event)) {
+ if (action == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, event)) {
if (options.keyDebugModifier.matches(event)) {
this.usedDebugKeyAsModifier = false;
}
} else {
screen.afterKeyboardAction();
- if (screen.keyPressed(event)) {
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, event)) {
if (this.minecraft.gui.screen() == null) {
InputConstants.Key key = InputConstants.getKey(event);
KeyMapping.set(key, false);
@@ -562,6 +_,7 @@
@@ -523,7 +_,7 @@
}
} else {
screen.afterKeyboardAction();
- if (screen.keyPressed(event)) {
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, event)) {
if (this.minecraft.screen == null) {
InputConstants.Key key = InputConstants.getKey(event);
KeyMapping.set(key, false);
@@ -595,6 +_,7 @@
}
}
}
@@ -26,12 +26,12 @@
}
}
@@ -570,7 +_,7 @@
Screen screen = this.minecraft.gui.screen();
if (screen != null && this.minecraft.gui.overlay() == null) {
@@ -603,7 +_,7 @@
Screen screen = this.minecraft.screen;
if (screen != null && this.minecraft.getOverlay() == null) {
try {
- screen.charTyped(event);
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, event);
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "charTyped event handler");
} catch (Throwable var8) {
CrashReport report = CrashReport.forThrowable(var8, "charTyped event handler");
screen.fillCrashDetails(report);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -258,7 +_,7 @@
@@ -268,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +9,7 @@
private static Minecraft instance;
private static final Logger LOGGER = LogUtils.getLogger();
private static final int MAX_TICKS_PER_UPDATE = 10;
@@ -410,7 +_,6 @@
@@ -432,7 +_,6 @@
}
}, Util.nonCriticalIoPool());
LOGGER.info("Setting user: {}", this.user.getName());
@@ -17,74 +17,68 @@
this.demo = gameConfig.game.demo;
this.allowsMultiplayer = !gameConfig.game.disableMultiplayer;
this.allowsChat = !gameConfig.game.disableChat;
@@ -547,12 +_,12 @@
LOGGER.error("Couldn't set icon", e);
}
+ // FORGE: Move mouse and keyboard handler setup further below
this.mouseHandler = new MouseHandler(this);
- this.mouseHandler.setup(this.window);
this.keyboardHandler = new KeyboardHandler(this);
- this.keyboardHandler.setup(this.window);
this.options.applyGraphicsPreset(this.options.graphicsPreset().get());
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
this.resourcePackRepository.reload();
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.languageManager = new LanguageManager(this.options.languageCode, var1 -> {
@@ -630,6 +_,7 @@
ParticleResources particleResources = new ParticleResources();
this.resourceManager.registerReloadListener(particleResources);
this.particleEngine = new ParticleEngine(this.level, particleResources);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(particleResources);
particleResources.onReload(this.particleEngine::clearParticles);
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.modelManager);
WindowRenderState windowRenderState = this.gameRenderer.gameRenderState().windowRenderState;
@@ -647,6 +_,7 @@
this.window.getHeight()
);
this.levelExtractor = new LevelExtractor(this, this.gameRenderer.gameRenderState().levelRenderState, this.levelRenderer);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onInitLevelRenderer();
this.resourceManager.registerReloadListener(this.levelExtractor);
this.resourceManager.registerReloadListener(this.levelRenderer.cloudRenderer());
this.gpuWarnlistManager = new GpuWarnlistManager();
@@ -654,6 +_,9 @@
this.resourceManager.registerReloadListener(this.regionalCompliancies);
this.gui = new Gui(this, new Hud(this), this.gameRenderer.gameRenderState().guiRenderState);
this.gui.registerReloadListeners(this.resourceManager);
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
+ this.mouseHandler.setup(this.window);
+ this.keyboardHandler.setup(this.window);
RealmsClient realmsClient = RealmsClient.getOrCreate(this);
this.realmsDataFetcher = new RealmsDataFetcher(realmsClient);
RenderSystem.setErrorCallback(this::onFullscreenError);
@@ -686,6 +_,7 @@
}
}
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
this.window.setDefaultErrorCallback();
@@ -710,14 +_,15 @@
.createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, packs);
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
GameLoadCookie loadCookie = new GameLoadCookie(realmsClient, gameConfig.quickPlay);
- this.gui.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
+ this.gui.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () ->reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
if (SharedConstants.IS_RUNNING_IN_IDE) {
this.selfTest();
@@ -518,14 +_,14 @@
LOGGER.error("Couldn't set icon", (Throwable)var23);
}
this.reloadStateTracker.finishReload();
this.onResourceLoadFinished(loadCookie);
- }), false));
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
+ }), false).get());
this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.logPath());
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
this.fpsPieProfiler = new ContinuousProfiler(Util.timeSource(), () -> this.fpsPieRenderTicks, this.framerateLimitTracker::isHeavilyThrottled);
@@ -801,6 +_,7 @@
+ // FORGE: Move mouse and keyboard handler setup further below
this.mouseHandler = new MouseHandler(this);
- this.mouseHandler.setup(this.window);
this.keyboardHandler = new KeyboardHandler(this);
- this.keyboardHandler.setup(this.window);
this.options.applyGraphicsPreset(this.options.graphicsPreset().get());
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
this.resourcePackRepository.reload();
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.languageManager = new LanguageManager(this.options.languageCode, languageData -> {
@@ -613,6 +_,7 @@
this.particleResources = new ParticleResources();
this.resourceManager.registerReloadListener(this.particleResources);
this.particleEngine = new ParticleEngine(this.level, this.particleResources);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleResources);
this.particleResources.onReload(this.particleEngine::clearParticles);
this.waypointStyles = new WaypointStyleManager();
this.resourceManager.registerReloadListener(this.waypointStyles);
@@ -634,6 +_,9 @@
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.resourceManager.registerReloadListener(this.regionalCompliancies);
this.gui = new Gui(this);
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
+ this.mouseHandler.setup(this.window);
+ this.keyboardHandler.setup(this.window);
RealmsClient realmsClient = RealmsClient.getOrCreate(this);
this.realmsDataFetcher = new RealmsDataFetcher(realmsClient);
RenderSystem.setErrorCallback(this::onFullscreenError);
@@ -665,6 +_,7 @@
}
}
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
this.window.updateVsync(this.options.enableVsync().get());
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
@@ -690,14 +_,15 @@
.createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, packs);
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
Minecraft.GameLoadCookie loadCookie = new Minecraft.GameLoadCookie(realmsClient, gameConfig.quickPlay);
- this.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
+ this.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () ->reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
if (SharedConstants.IS_RUNNING_IN_IDE) {
this.selfTest();
}
this.reloadStateTracker.finishReload();
this.onResourceLoadFinished(loadCookie);
- }), false));
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
+ }), false).get());
this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.logPath());
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
this.fpsPieProfiler = new ContinuousProfiler(Util.timeSource, () -> this.fpsPieRenderTicks, this.framerateLimitTracker::isHeavilyThrottled);
@@ -816,6 +_,7 @@
StringBuilder builder = new StringBuilder("Minecraft");
if (checkModStatus().shouldReportAsModified()) {
builder.append("*");
@@ -92,51 +86,88 @@
}
builder.append(" ");
@@ -824,6 +_,8 @@
@@ -839,6 +_,8 @@
}
private static UserApiService createUserApiService(final YggdrasilAuthenticationService authService, final GameConfig config) {
private UserApiService createUserApiService(final YggdrasilAuthenticationService authService, final GameConfig config) {
+ if ("0".equals(config.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
+ return UserApiService.OFFLINE;
return config.game.offlineDeveloperMode ? UserApiService.OFFLINE : authService.createUserApiService(config.user.user.getAccessToken());
}
@@ -840,7 +_,7 @@
@@ -851,7 +_,7 @@
}
private void rollbackResourcePacks(final Throwable t, final @Nullable GameLoadCookie loadCookie) {
private void rollbackResourcePacks(final Throwable t, final Minecraft.@Nullable GameLoadCookie loadCookie) {
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
this.clearResourcePacksOnError(t, null, loadCookie);
} else {
Util.throwAsRuntime(t);
@@ -1141,6 +_,7 @@
Util.shutdownExecutors();
this.windowSurface.close();
RenderSystem.shutdownRenderer();
+ net.minecraftforge.fml.config.ConfigTracker.forceUnload();
} catch (Throwable t) {
LOGGER.error("Shutdown failure!", t);
throw t;
@@ -1301,7 +_,9 @@
profiler.popPush("gpuAsync");
RenderSystem.executePendingTasks();
profiler.pop();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
this.gameRenderer.render(this.deltaTracker, advanceGameTime);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
}
@@ -1128,12 +_,6 @@
LOGGER.error("setScreen called from non-game thread");
}
profiler.push("present");
@@ -1425,6 +_,7 @@
- if (this.screen != null) {
- this.screen.removed();
- } else {
- this.setLastInputType(InputType.NONE);
- }
-
if (screen == null) {
if (this.clientLevelTeardownInProgress) {
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
@@ -1152,6 +_,23 @@
}
}
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
+ Screen old = this.screen;
+ if (screen != null) {
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, screen);
+ if (event == null) return;
+ screen = event;
+ }
+
+ if (screen != old) {
+ if (old != null) {
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
+ old.removed();
+ } else {
+ this.setLastInputType(InputType.NONE);
+ }
+ }
+
this.screen = screen;
if (this.screen != null) {
this.screen.added();
@@ -1235,6 +_,7 @@
Util.shutdownExecutors();
RenderSystem.getSamplerCache().close();
RenderSystem.getDevice().close();
+ net.minecraftforge.fml.config.ConfigTracker.forceUnload();
} catch (Throwable var5) {
LOGGER.error("Shutdown failure!", var5);
throw var5;
@@ -1346,7 +_,9 @@
profiler.popPush("gpuAsync");
RenderSystem.executePendingTasks();
profiler.pop();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
this.gameRenderer.render(this.deltaTracker, advanceGameTime);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
profiler.push("present");
if (!this.gameRenderer.getGameRenderState().windowRenderState.isMinimized) {
this.mainRenderTarget.blitToScreen();
@@ -1450,6 +_,7 @@
this.window.setGuiScale(guiScale);
if (this.gui.screen() != null) {
this.gui.screen().resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
+ this.gui.resizeLayers(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
if (this.screen != null) {
this.screen.resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
}
this.mouseHandler.setIgnoreFirstMove();
@@ -1576,6 +_,7 @@
@@ -1601,6 +_,7 @@
}
public void stop() {
@@ -144,7 +175,7 @@
this.running = false;
}
@@ -1599,10 +_,18 @@
@@ -1630,10 +_,18 @@
if (down && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
BlockPos pos = blockHit.getBlockPos();
@@ -166,36 +197,36 @@
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1656,6 +_,8 @@
@@ -1676,6 +_,8 @@
this.player.swing(InteractionHand.MAIN_HAND);
return true;
} else {
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
switch (this.hitResult.getType()) {
case ENTITY:
AttackRange customItemRange = heldItem.get(DataComponents.ATTACK_RANGE);
@@ -1686,7 +_,7 @@
case BLOCK:
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
BlockPos pos = blockHit.getBlockPos();
- if (!this.level.getBlockState(pos).isAir()) {
+ if (!this.level.isEmptyBlock(pos)) {
this.gameMode.startDestroyBlock(pos, blockHit.getDirection());
if (this.level.getBlockState(pos).isAir()) {
endAttack = true;
@@ -1699,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
}
+ if (inputEvent.shouldSwingHand())
this.player.swing(InteractionHand.MAIN_HAND);
return endAttack;
}
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
switch (this.hitResult.getType()) {
case ENTITY:
AttackRange customItemRange = heldItem.get(DataComponents.ATTACK_RANGE);
@@ -1666,7 +_,7 @@
case BLOCK:
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
BlockPos pos = blockHit.getBlockPos();
- if (!this.level.getBlockState(pos).isAir()) {
+ if (!this.level.isEmptyBlock(pos)) {
this.gameMode.startDestroyBlock(pos, blockHit.getDirection());
if (this.level.getBlockState(pos).isAir()) {
endAttack = true;
@@ -1679,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
}
+ if (inputEvent.shouldSwingHand())
this.player.swing(InteractionHand.MAIN_HAND);
return endAttack;
}
@@ -1696,6 +_,12 @@
@@ -1717,6 +_,12 @@
}
for (InteractionHand hand : InteractionHand.values()) {
@@ -208,7 +239,7 @@
ItemStack heldItem = this.player.getItemInHand(hand);
if (!heldItem.isItemEnabled(this.level.enabledFeatures())) {
return;
@@ -1712,7 +_,7 @@
@@ -1733,7 +_,7 @@
if (this.player.isWithinEntityInteractionRange(entity, 0.0)
&& this.gameMode.interact(this.player, entity, entityHit, hand) instanceof InteractionResult.Success success) {
@@ -217,7 +248,7 @@
this.player.swing(hand);
}
@@ -1724,7 +_,7 @@
@@ -1745,7 +_,7 @@
int oldCount = heldItem.getCount();
InteractionResult useResult = this.gameMode.useItemOn(this.player, hand, blockHit);
if (useResult instanceof InteractionResult.Success success) {
@@ -226,7 +257,7 @@
this.player.swing(hand);
if (!heldItem.isEmpty() && (heldItem.getCount() != oldCount || this.player.hasInfiniteMaterials())) {
this.gameRenderer.itemInHandRenderer.itemUsed(hand);
@@ -1740,6 +_,9 @@
@@ -1761,6 +_,9 @@
}
}
@@ -236,24 +267,24 @@
if (!heldItem.isEmpty() && this.gameMode.useItem(this.player, hand) instanceof InteractionResult.Success success) {
if (success.swingSource() == InteractionResult.SwingSource.CLIENT) {
this.player.swing(hand);
@@ -1768,6 +_,8 @@
@@ -1789,6 +_,8 @@
}
ProfilerFiller profiler = Profiler.get();
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
+
profiler.push("gameMode");
if (!this.pause && this.level != null) {
this.gameMode.tick();
@@ -1817,6 +_,7 @@
profiler.push("gui");
this.textInputManager.tick();
this.chatListener.tick();
@@ -1871,6 +_,7 @@
this.tutorial.tick();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
try {
this.level.tick(() -> true);
} catch (Throwable t) {
@@ -1830,6 +_,7 @@
} catch (Throwable var6) {
@@ -1884,6 +_,7 @@
throw new ReportedException(report);
}
@@ -261,7 +292,7 @@
}
profiler.popPush("animateTick");
@@ -1854,6 +_,7 @@
@@ -1908,6 +_,7 @@
profiler.popPush("keyboard");
this.keyboardHandler.tick();
profiler.pop();
@@ -269,7 +300,7 @@
}
private boolean isLevelRunningNormally() {
@@ -2059,6 +_,7 @@
@@ -2138,6 +_,7 @@
}
public void setLevel(final ClientLevel level) {
@@ -277,23 +308,23 @@
this.level = level;
this.updateLevelInEngines(level);
}
@@ -2120,6 +_,7 @@
@@ -2199,6 +_,7 @@
IntegratedServer server = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerLogout(this.gameMode, this.player);
this.gameMode = null;
this.narrator.clear();
this.gui.setClientLevelTeardownInProgress(true);
@@ -2127,6 +_,7 @@
this.clientLevelTeardownInProgress = true;
@@ -2206,6 +_,7 @@
try {
if (this.level != null) {
this.gui.hud.onDisconnected();
this.gui.onDisconnected();
+ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(this.level);
}
this.level = null;
@@ -2141,6 +_,7 @@
@@ -2220,6 +_,7 @@
}
profiler.pop();
@@ -301,7 +332,7 @@
}
this.setScreenAndShow(screen);
@@ -2354,6 +_,7 @@
@@ -2372,6 +_,7 @@
private void pickBlockOrEntity() {
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java
@@ -77,6 +_,7 @@
@@ -87,6 +_,7 @@
this.activeButton = null;
}
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(buttonInfo, action)) return;
if (this.minecraft.gui.overlay() == null) {
if (pressed
&& this.minecraft.handleGlobalKeyPress(InputConstants.Type.MOUSE.getOrCreate(buttonInfo.button()), buttonInfo.hasControlDownWithQuirk())) {
@@ -101,7 +_,7 @@
if (this.minecraft.getOverlay() == null) {
if (this.minecraft.screen == null) {
if (!this.mouseGrabbed && pressed) {
@@ -106,7 +_,7 @@
&& currentTime - this.lastClick.time() < 250L
&& this.lastClick.screen() == screen
&& this.lastClickButton == event.button();
@@ -17,7 +17,7 @@
this.lastClick = new MouseHandler.LastClick(currentTime, screen);
this.lastClickButton = buttonInfo.button();
return;
@@ -116,7 +_,7 @@
@@ -121,7 +_,7 @@
}
} else {
try {
@@ -25,8 +25,8 @@
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, xm, ym, event)) {
return;
}
} catch (Throwable t) {
@@ -146,6 +_,7 @@
} catch (Throwable var17) {
@@ -151,6 +_,7 @@
KeyMapping.click(mouseKey);
}
}
@@ -34,35 +34,35 @@
}
}
@@ -197,7 +_,9 @@
if (this.minecraft.gui.screen() != null) {
@@ -202,7 +_,9 @@
if (this.minecraft.screen != null) {
double xm = this.getScaledXPos(this.minecraft.getWindow());
double ym = this.getScaledYPos(this.minecraft.getWindow());
- this.minecraft.gui.screen().mouseScrolled(xm, ym, scaledXOffset, scaledYOffset);
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.gui.screen(), xm, ym, scaledXOffset, scaledYOffset)) return;
+ if (this.minecraft.gui.screen().mouseScrolled(xm, ym, scaledXOffset, scaledYOffset)) return;
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.gui.screen(), xm, ym, scaledXOffset, scaledYOffset);
this.minecraft.gui.screen().afterMouseAction();
- this.minecraft.screen.mouseScrolled(xm, ym, scaledXOffset, scaledYOffset);
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, xm, ym, scaledXOffset, scaledYOffset)) return;
+ if (this.minecraft.screen.mouseScrolled(xm, ym, scaledXOffset, scaledYOffset)) return;
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, xm, ym, scaledXOffset, scaledYOffset);
this.minecraft.screen.afterMouseAction();
} else if (this.minecraft.player != null) {
Vector2i wheelXY = this.scrollWheelHandler.onMouseScroll(scaledXOffset, scaledYOffset);
@@ -206,6 +_,7 @@
@@ -211,6 +_,7 @@
}
int wheel = wheelXY.y == 0 ? -wheelXY.x : wheelXY.y;
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, scaledXOffset, scaledYOffset)) return;
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.hud.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.hud.getSpectatorGui().onMouseScrolled(-wheel);
@@ -312,7 +_,7 @@
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-wheel);
@@ -317,7 +_,7 @@
double dy = getScaledYPos(window, this.accumulatedDY);
try {
- screen.mouseDragged(new MouseButtonEvent(xm, ym, this.activeButton), dx, dy);
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(xm, ym, this.activeButton), dx, dy);
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "mouseDragged event handler");
} catch (Throwable var19) {
CrashReport report = CrashReport.forThrowable(var19, "mouseDragged event handler");
screen.fillCrashDetails(report);
@@ -397,6 +_,14 @@
@@ -402,6 +_,14 @@
public double ypos() {
return this.ypos;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -986,6 +_,7 @@
@@ -929,6 +_,7 @@
);
public boolean syncWrites;
public boolean startedCleanly = true;
@@ -8,7 +8,7 @@
public static boolean isSoundDeviceDefault(final String deviceName) {
return deviceName.equals("");
@@ -1474,6 +_,7 @@
@@ -1404,6 +_,7 @@
}
public Options(final Minecraft minecraft, final File workingDirectory) {
@@ -16,7 +16,7 @@
this.minecraft = minecraft;
this.optionsFile = new File(workingDirectory, "options.txt");
boolean largeDistances = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1624,15 +_,28 @@
@@ -1556,15 +_,28 @@
this.startedCleanly = access.process("startedCleanly", this.startedCleanly);
access.process("musicToast", this.musicToast);
access.process("musicFrequency", this.musicFrequency);
@@ -46,7 +46,7 @@
for (SoundSource source : SoundSource.values()) {
access.process("soundCategory_" + source.getName(), this.soundSourceVolumes.get(source));
}
@@ -1647,6 +_,10 @@
@@ -1579,6 +_,10 @@
}
public void load() {
@@ -57,7 +57,7 @@
try {
if (!this.optionsFile.exists()) {
return;
@@ -1666,7 +_,8 @@
@@ -1598,7 +_,8 @@
}
final CompoundTag options = this.dataFix(rawOptions);
@@ -65,9 +65,9 @@
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
+ processor.accept(
new Options.FieldAccess() {
private @Nullable String getValue(final String name) {
Tag tag = options.get(name);
@@ -1748,6 +_,17 @@
{
Objects.requireNonNull(Options.this);
@@ -1680,6 +_,17 @@
);
options.getString("fullscreenResolution").ifPresent(fullscreenResolution -> this.fullscreenVideoModeString = fullscreenResolution);
KeyMapping.resetMapping();
@@ -82,22 +82,26 @@
+ }
+ }
+
} catch (Exception e) {
LOGGER.error("Failed to load options", e);
} catch (Exception var7) {
LOGGER.error("Failed to load options", (Throwable)var7);
}
@@ -1778,9 +_,11 @@
@@ -1707,6 +_,7 @@
public void save() {
try (final PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
writer.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version());
+ var seen = new java.util.HashSet<String>();
this.processOptions(
new Options.FieldAccess() {
{
@@ -1714,6 +_,7 @@
}
public void writePrefix(final String name) {
+ seen.add(name);
writer.print(name);
writer.print(':');
}
@@ -1836,6 +_,12 @@
@@ -1769,6 +_,12 @@
if (fullscreenVideoModeString != null) {
writer.println("fullscreenResolution:" + fullscreenVideoModeString);
}
@@ -107,10 +111,10 @@
+ writer.println(entry.getKey() + ":" + entry.getValue());
+ }
+
} catch (Exception e) {
LOGGER.error("Failed to save options", e);
} catch (Exception var6) {
LOGGER.error("Failed to save options", (Throwable)var6);
}
@@ -1873,6 +_,7 @@
@@ -1806,6 +_,7 @@
}
public void broadcastOptions() {
@@ -118,7 +122,7 @@
if (this.minecraft.player != null) {
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
}
@@ -1986,6 +_,23 @@
@@ -1923,6 +_,23 @@
public static Component genericValueLabel(final Component caption, final int value) {
return genericValueLabel(caption, Component.literal(Integer.toString(value)));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Screenshot.java
+++ b/net/minecraft/client/Screenshot.java
@@ -53,14 +_,24 @@
@@ -44,6 +_,13 @@
file = new File(picDir, forceName);
}
@@ -14,17 +14,19 @@
Util.ioPool()
.execute(
() -> {
try (image) {
- image.writeToFile(file);
- Component component = Component.literal(file.getName())
+ image.writeToFile(outputFile);
+ Component component = Component.literal(outputFile.getName())
.withStyle(ChatFormatting.UNDERLINE)
- .withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(file.getAbsoluteFile())));
+ .withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(outputFile.getAbsoluteFile())));
+ if (event.getResultMessage() != null)
+ callback.accept(event.getResultMessage());
+ else
callback.accept(Component.translatable("screenshot.success", component));
} catch (Exception e) {
LOGGER.warn("Couldn't save screenshot", e);
@@ -51,10 +_,13 @@
NativeImage twrVar0$ = image;
try {
- image.writeToFile(file);
- Component component = Component.literal(file.getName())
+ image.writeToFile(outputFile);
+ Component component = Component.literal(outputFile.getName())
.withStyle(ChatFormatting.UNDERLINE)
.withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(file.getAbsoluteFile())));
+ if (event.getResultMessage() != null)
+ callback.accept(event.getResultMessage());
+ else
callback.accept(Component.translatable("screenshot.success", component));
} catch (Throwable var7) {
if (image != null) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
@@ -868,6 +_,9 @@
@@ -909,6 +_,9 @@
this.declareCustomModelItem(Items.COD);
this.declareCustomModelItem(Items.FEATHER);
this.declareCustomModelItem(Items.LEAD);
@@ -100,8 +100,8 @@
ClientItem donorInfo = this.itemInfos.get(donor);
if (donorInfo == null) {
@@ -131,8 +_,8 @@
this.register(acceptor, donorInfo);
this.register(acceptor, donorInfo);
}
});
- List<Identifier> missingDefinitions = BuiltInRegistries.ITEM
- .listElements()
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -28,7 +_,7 @@
@@ -33,7 +_,7 @@
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
@@ -1,75 +1,116 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -64,7 +_,7 @@
import org.slf4j.Logger;
@@ -150,7 +_,7 @@
public float vignetteBrightness = 1.0F;
private int toolHighlightTimer;
private ItemStack lastToolHighlight = ItemStack.EMPTY;
- private final DebugScreenOverlay debugOverlay;
+ protected DebugScreenOverlay debugOverlay;
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -192,6 +_,7 @@
() -> new JumpableVehicleBarRenderer(minecraft)
);
this.resetTitleTimes();
+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.init(this, minecraft);
}
@OnlyIn(Dist.CLIENT)
-public class Gui {
+public class Gui extends net.minecraftforge.client.gui.overlay.ForgeLayerInstance {
private static final Logger LOGGER = LogUtils.getLogger();
private static final Component SOCIAL_INTERACTIONS_NOT_AVAILABLE = Component.translatable("multiplayer.socialInteractions.not_available");
public static final Component SAVING_LEVEL = Component.translatable("menu.savingLevel");
@@ -80,6 +_,7 @@
private @Nullable TutorialToast socialInteractionsToast;
public void resetTitleTimes() {
@@ -202,6 +_,10 @@
public Gui(final Minecraft minecraft, final Hud hud, final GuiRenderState guiRenderState) {
+ super(minecraft);
this.minecraft = minecraft;
this.hud = hud;
this.splashManager = new SplashManager(minecraft.getUser());
@@ -175,7 +_,7 @@
profiler.push("screen");
try {
- this.screen.extractRenderStateWithTooltipAndSubtitles(graphics, xMouse, yMouse, deltaTracker.getGameTimeDeltaTicks());
+ drawScreen(graphics, xMouse, yMouse, deltaTracker.getRealtimeDeltaTicks());
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "Rendering screen");
CrashReportCategory category = report.addCategory("Screen render details");
@@ -224,12 +_,6 @@
LOGGER.error("setScreen called from non-game thread");
}
- if (this.screen != null) {
- this.screen.removed();
- } else {
- this.minecraft.setLastInputType(InputType.NONE);
- }
-
if (screen == null) {
if (this.clientLevelTeardownInProgress) {
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
@@ -248,6 +_,22 @@
}
}
+ clearLayers();
+ Screen old = this.screen;
+ if (screen != null) {
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, screen);
+ if (event == null) return;
+ screen = event;
+ }
+
+ if (screen != old) {
+ if (old != null) {
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
+ old.removed();
+ } else {
+ this.minecraft.setLastInputType(InputType.NONE);
public void extractRenderState(final GuiGraphicsExtractor graphics, final DeltaTracker deltaTracker) {
if (!(this.minecraft.screen instanceof LevelLoadingScreen)) {
+ if (Boolean.valueOf(true)) {
+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.extractRenderState(graphics, deltaTracker);
+ return;
+ }
+ }
this.screen = screen;
if (this.screen != null) {
this.screen.added();
@@ -465,5 +_,10 @@
if (!this.minecraft.options.hideGui) {
this.extractCameraOverlays(graphics, deltaTracker);
this.extractCrosshair(graphics, deltaTracker);
@@ -385,7 +_,7 @@
int mouseX = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
int mouseY = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
graphics.nextStratum();
- this.chat.extractRenderState(graphics, this.getFont(), this.tickCount, mouseX, mouseY, ChatComponent.DisplayMode.BACKGROUND, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(graphics, this.chat, window, mouseX, mouseY, this.tickCount, this.getFont());
}
}
@@ -478,6 +_,8 @@
for (MobEffectInstance instance : Ordering.natural().reverse().sortedCopy(activeEffects)) {
Holder<MobEffect> effect = instance.getEffect();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(instance);
+ if (!renderer.isVisibleInGui(instance)) continue;
if (instance.showIcon()) {
int x = graphics.guiWidth();
int y = 1;
@@ -508,6 +_,7 @@
}
)
);
}
+ if (renderer.extractGuiIcon(instance, this, graphics, x, y, 0, alpha)) continue;
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(effect), x + 3, y + 3, 18, 18, ARGB.white(alpha));
}
}
@@ -610,15 +_,37 @@
}
public void extractSelectedItemName(final GuiGraphicsExtractor graphics) {
+ renderSelectedItemName(graphics, 0);
+ }
+
+ @Override
+ protected void setScreenInternal(Screen value) {
+ this.screen = value;
+ // Forge: Maintain vanilla parity during FLD#BACKGROUND
+ public final void updateContextualInfo(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
+ Gui.ContextualInfo nextContextualInfo = this.nextContextualInfoState();
+ if (nextContextualInfo != this.contextualInfoBar.getKey()) {
+ this.contextualInfoBar = Pair.of(nextContextualInfo, this.contextualInfoBarRenderers.get(nextContextualInfo).get());
+ }
+
+ this.contextualInfoBar.getValue().extractBackground(graphics, deltaTracker);
+ }
+ // Forge: Same as above but for FLD#CONTEXTUAL_INFO
+ public final void extractContextualInfoState(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
+ this.contextualInfoBar.getValue().extractRenderState(graphics, deltaTracker);
+ }
+
+ public void renderSelectedItemName(final GuiGraphicsExtractor graphics, int yShift) {
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
MutableComponent str = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) {
str.withStyle(ChatFormatting.ITALIC);
}
- int strWidth = this.getFont().width(str);
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(str);
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null)
+ font = this.getFont();
+ int strWidth = font.width(highlightTip);
int x = (graphics.guiWidth() - strWidth) / 2;
- int y = graphics.guiHeight() - 59;
+ int y = graphics.guiHeight() - Math.max(yShift, 59);
if (!this.minecraft.gameMode.canHurtPlayer()) {
y += 14;
}
@@ -629,7 +_,7 @@
}
if (alpha > 0) {
- graphics.textWithBackdrop(this.getFont(), str, x, y, strWidth, ARGB.white(alpha));
+ graphics.textWithBackdrop(font, highlightTip, x, y, strWidth, ARGB.white(alpha));
}
}
}
}
@@ -1195,7 +_,9 @@
this.toolHighlightTimer = 0;
} else if (this.lastToolHighlight.isEmpty()
|| !selected.is(this.lastToolHighlight.getItem())
- || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
+ || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())
+ || !selected.getHighlightTip(selected.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName()))
+ ) {
this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get());
} else if (this.toolHighlightTimer > 0) {
this.toolHighlightTimer--;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/GuiGraphicsExtractor.java
+++ b/net/minecraft/client/gui/GuiGraphicsExtractor.java
@@ -85,7 +_,7 @@
@@ -88,7 +_,7 @@
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
@@ -9,15 +9,15 @@
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
private final Minecraft minecraft;
private final Matrix3x2fStack pose;
@@ -912,6 +_,7 @@
CrashReport report = CrashReport.forThrowable(t, "Rendering item");
@@ -914,6 +_,7 @@
CrashReport report = CrashReport.forThrowable(var11, "Rendering item");
CrashReportCategory category = report.addCategory("Item being rendered");
category.setDetail("Item Type", () -> String.valueOf(itemStack.getItem()));
+ category.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem())));
category.setDetail("Item Components", () -> String.valueOf(itemStack.getComponents()));
category.setDetail("Item Foil", () -> String.valueOf(itemStack.hasFoil()));
throw new ReportedException(report);
@@ -938,6 +_,7 @@
@@ -940,6 +_,7 @@
this.itemCooldown(itemStack, x, y);
this.itemCount(font, itemStack, x, y, countText);
this.pose.popMatrix();
@@ -25,7 +25,7 @@
}
}
@@ -1106,16 +_,25 @@
@@ -1112,16 +_,25 @@
this.setTooltipForNextFrame(this.minecraft.font, formattedCharSequences, DefaultTooltipPositioner.INSTANCE, x, y, false);
}
@@ -51,7 +51,7 @@
public void setTooltipForNextFrame(
final Font font,
final List<Component> texts,
@@ -1124,11 +_,7 @@
@@ -1130,11 +_,7 @@
final int yo,
final @Nullable Identifier style
) {
@@ -64,7 +64,7 @@
this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, style, false);
}
@@ -1156,7 +_,22 @@
@@ -1162,7 +_,22 @@
}
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo) {
@@ -88,7 +88,7 @@
}
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo, final @Nullable Identifier style) {
@@ -1207,10 +_,16 @@
@@ -1213,10 +_,16 @@
) {
if (!lines.isEmpty()) {
if (this.deferredTooltip == null || replaceExisting) {
@@ -106,7 +106,7 @@
public void tooltip(
final Font font,
@@ -1218,13 +_,16 @@
@@ -1224,13 +_,16 @@
final int xo,
final int yo,
final ClientTooltipPositioner positioner,
@@ -125,17 +125,17 @@
if (lineWidth > textWidth) {
textWidth = lineWidth;
}
@@ -1234,25 +_,25 @@
@@ -1240,25 +_,25 @@
int w = textWidth;
int h = tempHeight;
- Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), xo, yo, w, h);
+ Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), w, h);
- Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), xo, yo, textWidth, tempHeight);
+ Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), textWidth, tempHeight);
int x = positionedTooltip.x();
int y = positionedTooltip.y();
this.pose.pushMatrix();
- TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, style);
+ TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, preEvent.getBackground());
- TooltipRenderUtil.extractTooltipBackground(this, x, y, textWidth, tempHeight, style);
+ TooltipRenderUtil.extractTooltipBackground(this, x, y, textWidth, tempHeight, preEvent.getBackground());
int localY = y;
for (int i = 0; i < lines.size(); i++) {
@@ -157,7 +157,7 @@
}
this.pose.popMatrix();
@@ -1326,6 +_,14 @@
@@ -1333,6 +_,14 @@
private ActiveTextCollector.Parameters createDefaultTextParameters(final float opacity) {
return new ActiveTextCollector.Parameters(new Matrix3x2f(this.pose), opacity, this.scissorStack.peek());
@@ -1,116 +0,0 @@
--- a/net/minecraft/client/gui/Hud.java
+++ b/net/minecraft/client/gui/Hud.java
@@ -156,7 +_,7 @@
public float vignetteBrightness = 1.0F;
private int toolHighlightTimer;
private ItemStack lastToolHighlight = ItemStack.EMPTY;
- private final DebugScreenOverlay debugOverlay;
+ protected DebugScreenOverlay debugOverlay;
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -198,6 +_,7 @@
() -> new JumpableVehicleBar(minecraft)
);
this.resetTitleTimes();
+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.init(this, minecraft);
}
public void registerReloadListeners(final ReloadableResourceManager resourceManager) {
@@ -221,6 +_,10 @@
public void extractRenderState(final GuiGraphicsExtractor graphics, final DeltaTracker deltaTracker) {
this.minecraft.gameRenderer.gameRenderState().guiRenderState.isHudHidden = this.isHidden;
if (!(this.minecraft.gui.screen() instanceof LevelLoadingScreen)) {
+ if (Boolean.valueOf(true)) {
+ net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.extractRenderState(graphics, deltaTracker);
+ return;
+ }
if (!this.isHidden) {
this.extractCameraOverlays(graphics, deltaTracker);
this.extractCrosshair(graphics, deltaTracker);
@@ -404,7 +_,7 @@
int mouseX = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
int mouseY = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
graphics.nextStratum();
- this.chat.extractRenderState(graphics, this.getFont(), this.tickCount, mouseX, mouseY, ChatComponent.DisplayMode.BACKGROUND, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(graphics, this.chat, window, mouseX, mouseY, this.tickCount, this.getFont());
}
}
@@ -497,6 +_,8 @@
for (MobEffectInstance instance : Ordering.natural().reverse().sortedCopy(activeEffects)) {
Holder<MobEffect> effect = instance.getEffect();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(instance);
+ if (!renderer.isVisibleInGui(instance)) continue;
if (instance.showIcon()) {
int x = graphics.guiWidth();
int y = 1;
@@ -527,6 +_,7 @@
}
}
+ if (renderer.extractGuiIcon(instance, this, graphics, x, y, 0, alpha)) continue;
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(effect), x + 3, y + 3, 18, 18, ARGB.white(alpha));
}
}
@@ -629,15 +_,37 @@
}
public void extractSelectedItemName(final GuiGraphicsExtractor graphics) {
+ renderSelectedItemName(graphics, 0);
+ }
+
+ // Forge: Maintain vanilla parity during FLD#BACKGROUND
+ public final void updateContextualInfo(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
+ var nextContextualInfo = this.nextContextualInfoState();
+ if (nextContextualInfo != this.contextualInfoBar.getFirst()) {
+ this.contextualInfoBar = Pair.of(nextContextualInfo, this.contextualInfoBars.get(nextContextualInfo).get());
+ }
+
+ this.contextualInfoBar.getSecond().extractBackground(graphics, deltaTracker);
+ }
+ // Forge: Same as above but for FLD#CONTEXTUAL_INFO
+ public final void extractContextualInfoState(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
+ this.contextualInfoBar.getSecond().extractRenderState(graphics, deltaTracker);
+ }
+
+ public void renderSelectedItemName(final GuiGraphicsExtractor graphics, int yShift) {
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
MutableComponent str = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) {
str.withStyle(ChatFormatting.ITALIC);
}
- int strWidth = this.getFont().width(str);
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(str);
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null)
+ font = this.getFont();
+ int strWidth = font.width(highlightTip);
int x = (graphics.guiWidth() - strWidth) / 2;
- int y = graphics.guiHeight() - 59;
+ int y = graphics.guiHeight() - Math.max(yShift, 59);
if (!this.minecraft.gameMode.canHurtPlayer()) {
y += 14;
}
@@ -648,7 +_,7 @@
}
if (alpha > 0) {
- graphics.textWithBackdrop(this.getFont(), str, x, y, strWidth, ARGB.white(alpha));
+ graphics.textWithBackdrop(font, highlightTip, x, y, strWidth, ARGB.white(alpha));
}
}
}
@@ -1216,7 +_,9 @@
this.toolHighlightTimer = 0;
} else if (this.lastToolHighlight.isEmpty()
|| !selected.is(this.lastToolHighlight.getItem())
- || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
+ || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())
+ || !selected.getHighlightTip(selected.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName()))
+ ) {
this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get());
} else if (this.toolHighlightTimer > 0) {
this.toolHighlightTimer--;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -225,6 +_,23 @@
@@ -221,6 +_,23 @@
this.focused = focused;
}
@@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
@@ -68,13 +_,16 @@
for (LerpingBossEvent event : this.events.values()) {
int xLeft = screenWidth / 2 - 91;
int yo = yOffset;
+ var progressEvent = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(graphics, this.minecraft.getWindow(), event, xLeft, yOffset, 10 + this.minecraft.font.lineHeight);
+ if (progressEvent != null) {
this.extractBar(graphics, xLeft, yo, event);
this.extractBar(graphics, xLeft, yOffset, event);
Component msg = event.getName();
int width = this.minecraft.font.width(msg);
int x = screenWidth / 2 - width / 2;
int y = yo - 9;
int y = yOffset - 9;
graphics.text(this.minecraft.font, msg, x, y, -1);
- yOffset += 10 + 9;
+ }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
@@ -142,6 +_,7 @@
@@ -143,6 +_,7 @@
}
public void addToast(final Toast toast) {
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/render/GuiRenderer.java
+++ b/net/minecraft/client/gui/render/GuiRenderer.java
@@ -110,6 +_,7 @@
@@ -130,6 +_,7 @@
builder.put((Class<? extends PictureInPictureRenderState>)pictureInPictureRenderer.getRenderStateClass(), pictureInPictureRenderer);
}
+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, builder);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, bufferSource, builder);
this.pictureInPictureRenderers = builder.buildOrThrow();
}
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/screens/ChatScreen.java
+++ b/net/minecraft/client/gui/screens/ChatScreen.java
@@ -141,6 +_,7 @@
this.handleChatInput(this.input.getValue(), true);
if (this.closeOnSubmit) {
this.exitReason = ChatScreen.ExitReason.DONE;
+ if (this.minecraft.gui.screen() == this) // FORGE: Prevent closing the screen if another screen has been opened.
this.minecraft.gui.setScreen(null);
} else {
this.input.setValue("");
@@ -139,6 +_,7 @@
this.handleChatInput(this.input.getValue(), true);
if (this.closeOnSubmit) {
this.exitReason = ChatScreen.ExitReason.DONE;
+ if (this.minecraft.screen == this) // FORGE: Prevent closing the screen if another screen has been opened.
this.minecraft.setScreen(null);
} else {
this.input.setValue("");
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
@@ -109,6 +_,8 @@
@@ -114,6 +_,8 @@
}
if (resolvedAddress.isEmpty()) {
+ ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", hostAndPort.getHost());
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
minecraft.execute(
() -> minecraft.gui
.setScreen(
() -> minecraft.setScreen(
new DisconnectedScreen(ConnectScreen.this.parent, ConnectScreen.this.connectFailedTitle, ConnectScreen.UNKNOWN_HOST_MESSAGE)
@@ -16,7 +16,7 @@
+ if (extractContentRenderState(graphics, logoAlpha)) {
int contentX = (int)(graphics.guiWidth() * 0.5);
int logoY = (int)(graphics.guiHeight() * 0.5);
double logoHeight = Math.min(graphics.guiWidth() * 0.75, graphics.guiHeight()) * 0.25;
double logoHeight = Math.min(graphics.guiWidth() * 0.75, (double)graphics.guiHeight()) * 0.25;
@@ -148,6 +_,7 @@
graphics, width / 2 - logoWidthHalf, barY - 5, width / 2 + logoWidthHalf, barY + 5, 1.0F - Mth.clamp(fadeOutAnim, 0.0F, 1.0F)
);
@@ -24,7 +24,7 @@
+ }
if (fadeOutAnim >= 2.0F) {
this.minecraft.gui.setOverlay(null);
this.minecraft.setOverlay(null);
@@ -157,6 +_,7 @@
@Override
public void tick() {
@@ -34,10 +34,10 @@
this.reload.checkExceptions();
this.onFinish.accept(Optional.empty());
@@ -164,7 +_,6 @@
this.onFinish.accept(Optional.of(t));
this.onFinish.accept(Optional.of(var2));
}
- this.fadeOutStart = Util.getMillis();
if (this.minecraft.gui.screen() != null) {
if (this.minecraft.screen != null) {
Window window = this.minecraft.getWindow();
this.minecraft.gui.screen().init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
this.minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -165,6 +_,7 @@
Button.builder(OPTIONS, var1x -> this.minecraft.gui.setScreen(new OptionsScreen(this, this.minecraft.options, true))).width(204).build(), 2
);
@@ -102,6 +_,7 @@
} else {
helper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
}
+ helper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.gui.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
+ helper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
this.disconnectButton = helper.addChild(
Button.builder(
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -196,7 +_,7 @@
@@ -194,7 +_,7 @@
}
public void onClose() {
- this.minecraft.gui.setScreen(null);
+ this.minecraft.gui.popLayer();
- this.minecraft.setScreen(null);
+ this.minecraft.popGuiLayer();
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(final T widget) {
@@ -327,8 +_,10 @@
@@ -326,8 +_,10 @@
this.width = width;
this.height = height;
if (!this.initialized) {
@@ -20,7 +20,7 @@
} else {
this.repositionElements();
}
@@ -345,8 +_,10 @@
@@ -344,8 +_,10 @@
protected void rebuildWidgets() {
this.clearWidgets();
this.clearFocus();
@@ -31,16 +31,16 @@
}
protected void fadeWidgets(final float widgetFade) {
@@ -386,6 +_,8 @@
@@ -385,6 +_,8 @@
this.extractMenuBackground(graphics);
}
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, graphics);
+
this.minecraft.gui.hud.extractDeferredSubtitles();
this.minecraft.gui.extractDeferredSubtitles();
}
@@ -471,6 +_,19 @@
@@ -474,6 +_,19 @@
}
public void onFilesDrop(final List<Path> files) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/TitleScreen.java
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -57,6 +_,7 @@
@@ -53,6 +_,7 @@
private boolean fading;
private long fadeInStart;
private final LogoRenderer logoRenderer;
@@ -8,7 +8,7 @@
public TitleScreen() {
this(false);
@@ -114,11 +_,15 @@
@@ -105,11 +_,15 @@
int copyrightX = this.width - copyrightWidth - 2;
int spacing = 24;
int topPos = this.height / 4 + 48;
@@ -17,23 +17,23 @@
topPos = this.createDemoMenuOptions(topPos, 24);
} else {
topPos = this.createNormalMenuOptions(topPos, 24);
+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.gui.setScreen(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .pos(this.width / 2 - 100, topPos).size(98, 20).build());
+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .pos(this.width / 2 - 100, topPos).size(98, 20).build());
}
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
int numberOfButtons = 3;
int currentButton = 0;
@@ -199,7 +_,7 @@
}).bounds(this.width / 2 - 100, var7 = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = multiplayerAllowed;
topPos = this.createTestWorldButton(topPos, 24);
SpriteIconButton language = this.addRenderableWidget(
@@ -182,7 +_,7 @@
}).bounds(this.width / 2 - 100, var6 = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = multiplayerAllowed;
this.addRenderableWidget(
Button.builder(Component.translatable("menu.online"), var1 -> this.minecraft.gui.setScreen(new RealmsMainScreen(this)))
- .bounds(this.width / 2 - 100, topPos = var7 + spacing, 200, 20)
+ .bounds(this.width / 2 + 2, topPos = var7 + spacing, 98, 20)
Button.builder(Component.translatable("menu.online"), button -> this.minecraft.setScreen(new RealmsMainScreen(this)))
- .bounds(this.width / 2 - 100, topPos = var6 + spacing, 200, 20)
+ .bounds(this.width / 2 + 2, topPos = var6 + spacing, 98, 20)
.tooltip(tooltip)
.build()
)
@@ -323,9 +_,18 @@
@@ -310,9 +_,18 @@
versionString = versionString + I18n.get("menu.modded");
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -41,6 +_,7 @@
@@ -40,6 +_,7 @@
private int maxY = Integer.MIN_VALUE;
private float fade;
private boolean centered;
private @Nullable AdvancementWidget hovered;
+ private int page;
public AdvancementTab(
final Minecraft minecraft,
@@ -62,6 +_,15 @@
@@ -61,6 +_,15 @@
this.addWidget(this.root, rootNode.holder());
}
@@ -24,14 +24,14 @@
public AdvancementTabType getType() {
return this.type;
}
@@ -169,8 +_,8 @@
}
@@ -155,8 +_,8 @@
return null;
} else {
for (AdvancementTabType type : AdvancementTabType.values()) {
- if (index < type.getMax()) {
- return new AdvancementTab(minecraft, screen, type, index, root, display.get());
+ if ((index % AdvancementTabType.MAX_TABS) < type.getMax()) {
+ return new AdvancementTab(minecraft, screen, type, index % AdvancementTabType.MAX_TABS, index / AdvancementTabType.MAX_TABS, root, display.get());
}
for (AdvancementTabType type : AdvancementTabType.values()) {
- if (index < type.getMax()) {
- return new AdvancementTab(minecraft, screen, type, index, root, display.get());
+ if ((index % AdvancementTabType.MAX_TABS) < type.getMax()) {
+ return new AdvancementTab(minecraft, screen, type, index % AdvancementTabType.MAX_TABS, index / AdvancementTabType.MAX_TABS, root, display.get());
}
index -= type.getMax();
index -= type.getMax();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -52,6 +_,7 @@
@@ -50,6 +_,7 @@
private final Map<AdvancementHolder, AdvancementTab> tabs = Maps.newLinkedHashMap();
private @Nullable AdvancementTab selectedTab;
private boolean isScrolling;
@@ -8,7 +8,7 @@
public AdvancementsScreen(final ClientAdvancements advancements) {
this(advancements, null);
@@ -65,6 +_,19 @@
@@ -63,6 +_,19 @@
@Override
protected void init() {
@@ -28,7 +28,7 @@
this.layout.addTitleHeader(TITLE, this.font);
this.tabs.clear();
this.selectedTab = null;
@@ -119,7 +_,7 @@
@@ -105,7 +_,7 @@
int yo = (this.height - 140) / 2;
for (AdvancementTab tab : this.tabs.values()) {
@@ -37,24 +37,24 @@
this.advancements.setSelectedTab(tab.getRootNode().holder(), true);
break;
}
@@ -208,10 +_,12 @@
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, this.leftPos, this.topPos, 0.0F, 0.0F, 252, 140, 256, 256);
@@ -196,10 +_,12 @@
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, xo, yo, 0.0F, 0.0F, 252, 140, 256, 256);
if (this.tabs.size() > 1) {
for (AdvancementTab tab : this.tabs.values()) {
+ if (tab.getPage() == tabPage)
tab.extractTab(graphics, this.leftPos, this.topPos, mouseX, mouseY, tab == this.selectedTab);
tab.extractTab(graphics, xo, yo, mouseX, mouseY, tab == this.selectedTab);
}
for (AdvancementTab tab : this.tabs.values()) {
+ if (tab.getPage() == tabPage)
tab.extractIcon(graphics, this.leftPos, this.topPos);
tab.extractIcon(graphics, xo, yo);
}
}
@@ -230,6 +_,7 @@
@@ -218,6 +_,7 @@
if (this.tabs.size() > 1) {
for (AdvancementTab tab : this.tabs.values()) {
+ if (tab.getPage() == tabPage)
if (tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) {
if (tab.isMouseOver(xo, yo, mouseX, mouseY)) {
graphics.setTooltipForNextFrame(this.font, tab.getTitle(), mouseX, mouseY);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -98,6 +_,7 @@
@@ -111,6 +_,7 @@
int xo = this.leftPos;
int yo = this.topPos;
super.extractRenderState(graphics, mouseX, mouseY, a);
@@ -8,7 +8,7 @@
graphics.pose().pushMatrix();
graphics.pose().translate(xo, yo);
this.extractLabels(graphics, mouseX, mouseY);
@@ -109,6 +_,7 @@
@@ -122,6 +_,7 @@
if (previouslyHoveredSlot != null && previouslyHoveredSlot != this.hoveredSlot) {
this.onStopHovering(previouslyHoveredSlot);
}
@@ -16,7 +16,7 @@
graphics.pose().popMatrix();
}
@@ -170,7 +_,7 @@
@@ -200,7 +_,7 @@
ItemStack item = this.hoveredSlot.getItem();
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(item)) {
graphics.setTooltipForNextFrame(
@@ -25,53 +25,53 @@
);
}
}
@@ -186,7 +_,8 @@
@@ -216,7 +_,8 @@
private void extractFloatingItem(final GuiGraphicsExtractor graphics, final ItemStack carried, final int x, final int y, final @Nullable String itemCount) {
graphics.item(carried, x, y);
- graphics.itemDecorations(this.font, carried, x, y, itemCount);
- graphics.itemDecorations(this.font, carried, x, y - (this.draggingItem.isEmpty() ? 0 : 8), itemCount);
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(carried).getFont(carried, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ graphics.itemDecorations(font == null ? this.font : font, carried, x, y, itemCount);
+ graphics.itemDecorations(font == null ? this.font : font, carried, x, y - (this.draggingItem.isEmpty() ? 0 : 8), itemCount);
}
protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) {
@@ -285,7 +_,8 @@
@@ -316,7 +_,8 @@
if (super.mouseClicked(event, doubleClick)) {
return true;
}
- boolean cloning = this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials();
+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button());
+ boolean cloning = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey) && this.minecraft.player.hasInfiniteMaterials();
Slot slot = this.getHoveredSlot(event.x(), event.y());
this.doubleclick = this.lastClickSlot == slot && doubleClick;
this.skipNextRelease = false;
@@ -295,6 +_,7 @@
int xo = this.leftPos;
int yo = this.topPos;
boolean clickedOutside = this.hasClickedOutside(event.x(), event.y(), xo, yo);
+ if (slot != null) clickedOutside = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int slotId = -1;
if (slot != null) {
slotId = slot.index;
@@ -306,7 +_,7 @@
if (slotId != -1 && !this.isQuickCrafting) {
if (this.menu.getCarried().isEmpty()) {
- if (cloning) {
+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
} else {
boolean quickKey = slotId != -999 && event.hasShiftDown();
@@ -330,7 +_,7 @@
this.quickCraftingType = 0;
} else if (event.button() == 1) {
this.quickCraftingType = 1;
- } else if (cloning) {
+ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.quickCraftingType = 2;
}
}
@@ -374,10 +_,13 @@
} else {
- boolean cloning = this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials();
+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button());
+ boolean cloning = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey) && this.minecraft.player.hasInfiniteMaterials();
Slot slot = this.getHoveredSlot(event.x(), event.y());
this.doubleclick = this.lastClickSlot == slot && doubleClick;
this.skipNextRelease = false;
@@ -326,6 +_,7 @@
int xo = this.leftPos;
int yo = this.topPos;
boolean clickedOutside = this.hasClickedOutside(event.x(), event.y(), xo, yo);
+ if (slot != null) clickedOutside = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int slotId = -1;
if (slot != null) {
slotId = slot.index;
@@ -351,7 +_,7 @@
}
} else if (!this.isQuickCrafting) {
if (this.menu.getCarried().isEmpty()) {
- if (cloning) {
+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
} else {
boolean quickKey = slotId != -999 && event.hasShiftDown();
@@ -375,7 +_,7 @@
this.quickCraftingType = 0;
} else if (event.button() == 1) {
this.quickCraftingType = 1;
- } else if (cloning) {
+ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.quickCraftingType = 2;
}
}
@@ -445,10 +_,13 @@
@Override
public boolean mouseReleased(final MouseButtonEvent event) {
@@ -85,7 +85,7 @@
int slotId = -1;
if (slot != null) {
slotId = slot.index;
@@ -394,7 +_,7 @@
@@ -465,7 +_,7 @@
if (target != null
&& target.mayPickup(this.minecraft.player)
&& target.hasItem()
@@ -94,8 +94,8 @@
&& AbstractContainerMenu.canItemQuickReplace(target, this.lastQuickMoved, true)) {
this.slotClicked(target, target.index, event.button(), ContainerInput.QUICK_MOVE);
}
@@ -421,7 +_,7 @@
if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) {
@@ -524,7 +_,7 @@
} else if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) {
this.quickCraftToSlots();
} else if (!this.menu.getCarried().isEmpty()) {
- if (this.minecraft.options.keyPickItem.matchesMouse(event)) {
@@ -103,16 +103,16 @@
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
} else {
boolean quickKey = slotId != -999 && event.hasShiftDown();
@@ -489,7 +_,7 @@
@@ -595,7 +_,7 @@
public boolean keyPressed(final KeyEvent event) {
if (super.keyPressed(event)) {
return true;
}
- if (this.minecraft.options.keyInventory.matches(event)) {
+ if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(event))) {
- } else if (this.minecraft.options.keyInventory.matches(event)) {
+ } else if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(event))) {
this.onClose();
return true;
}
@@ -587,4 +_,11 @@
} else {
@@ -693,6 +_,13 @@
super.onClose();
}
@@ -123,4 +123,6 @@
+ public int getGuiTop() { return topPos; }
+ public int getXSize() { return imageWidth; }
+ public int getYSize() { return imageHeight; }
}
@OnlyIn(Dist.CLIENT)
private record SnapbackData(ItemStack item, Vector2i start, Vector2i end, long time) {
@@ -55,16 +55,16 @@
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
this.searchBox.setMaxLength(50);
this.searchBox.setBordered(false);
@@ -379,7 +_,7 @@
@@ -377,7 +_,7 @@
public boolean charTyped(final CharacterEvent event) {
if (this.ignoreTextInput) {
return false;
}
- if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
+ if (!selectedTab.hasSearchBar()) {
- } else if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
+ } else if (!selectedTab.hasSearchBar()) {
return false;
}
@@ -407,7 +_,7 @@
} else {
String oldContents = this.searchBox.getValue();
@@ -405,7 +_,7 @@
@Override
public boolean keyPressed(final KeyEvent event) {
this.ignoreTextInput = false;
@@ -73,7 +73,7 @@
if (this.minecraft.options.keyChat.matches(event)) {
this.ignoreTextInput = true;
this.selectTab(CreativeModeTabs.searchTab());
@@ -443,6 +_,7 @@
@@ -441,6 +_,7 @@
}
private void refreshSearchResults() {
@@ -81,7 +81,7 @@
this.menu.items.clear();
this.visibleTags.clear();
String searchTerm = this.searchBox.getValue();
@@ -455,10 +_,10 @@
@@ -453,10 +_,10 @@
SearchTree<ItemStack> tree;
if (searchTerm.startsWith("#")) {
searchTerm = searchTerm.substring(1);
@@ -94,7 +94,7 @@
}
this.menu.items.addAll(tree.search(searchTerm.toLowerCase(Locale.ROOT)));
@@ -486,7 +_,7 @@
@@ -484,7 +_,7 @@
@Override
protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) {
if (selectedTab.showTitle()) {
@@ -103,7 +103,7 @@
}
}
@@ -496,7 +_,7 @@
@@ -494,7 +_,7 @@
double xm = event.x() - this.leftPos;
double ym = event.y() - this.topPos;
@@ -112,7 +112,7 @@
if (this.checkTabClicked(tab, xm, ym)) {
return true;
}
@@ -518,7 +_,7 @@
@@ -516,7 +_,7 @@
double ym = event.y() - this.topPos;
this.scrolling = false;
@@ -121,7 +121,7 @@
if (this.checkTabClicked(tab, xm, ym)) {
this.selectTab(tab);
return true;
@@ -611,13 +_,15 @@
@@ -610,13 +_,15 @@
this.originalSlots = null;
}
@@ -138,7 +138,7 @@
this.refreshSearchResults();
} else {
@@ -682,7 +_,14 @@
@@ -679,7 +_,14 @@
this.effects.extractRenderState(graphics, mouseX, mouseY);
super.extractRenderState(graphics, mouseX, mouseY, a);
@@ -154,7 +154,7 @@
if (this.checkTabHovering(graphics, tab, mouseX, mouseY)) {
break;
}
@@ -704,7 +_,7 @@
@@ -701,7 +_,7 @@
public List<Component> getTooltipFromContainerItem(final ItemStack itemStack) {
boolean isCreativeSlot = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean isSingleCategoryTab = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
@@ -163,16 +163,16 @@
TooltipFlag.Default originalTooltipStyle = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
TooltipFlag tooltipStyle = isCreativeSlot ? originalTooltipStyle.asCreative() : originalTooltipStyle;
List<Component> originalLines = itemStack.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipStyle);
@@ -728,7 +_,7 @@
int i = 1;
@@ -722,7 +_,7 @@
int i = 1;
for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
- if (tab.getType() != CreativeModeTab.Type.SEARCH && tab.contains(itemStack)) {
+ if (!tab.hasSearchBar() && tab.contains(itemStack)) {
linesToDisplay.add(i++, tab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
- if (tab.getType() != CreativeModeTab.Type.SEARCH && tab.contains(itemStack)) {
+ if (!tab.hasSearchBar() && tab.contains(itemStack)) {
linesToDisplay.add(i++, tab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
}
}
}
@@ -740,7 +_,7 @@
@@ -735,7 +_,7 @@
public void extractBackground(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
super.extractBackground(graphics, mouseX, mouseY, a);
@@ -181,7 +181,7 @@
if (tab != selectedTab) {
this.extractTabButton(graphics, mouseX, mouseY, tab);
}
@@ -775,6 +_,7 @@
@@ -770,6 +_,7 @@
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprite, xscr, yscr + (int)((yscr2 - yscr - 17) * this.scrollOffs), 12, 15);
}
@@ -189,7 +189,7 @@
this.extractTabButton(graphics, mouseX, mouseY, selectedTab);
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.extractEntityInInventoryFollowsMouse(
@@ -784,7 +_,7 @@
@@ -779,7 +_,7 @@
}
private int getTabX(final CreativeModeTab tab) {
@@ -198,7 +198,7 @@
int spacing = 27;
int x = 27 * pos;
if (tab.isAlignedRight()) {
@@ -796,7 +_,7 @@
@@ -791,7 +_,7 @@
private int getTabY(final CreativeModeTab tab) {
int y = 0;
@@ -207,7 +207,7 @@
y -= 32;
} else {
y += this.imageHeight;
@@ -824,8 +_,8 @@
@@ -819,8 +_,8 @@
protected void extractTabButton(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final CreativeModeTab tab) {
boolean selected = tab == selectedTab;
@@ -218,7 +218,15 @@
int x = this.leftPos + this.getTabX(tab);
int y = this.topPos - (isTop ? 28 : -(this.imageHeight - 4));
Identifier[] sprites;
@@ -875,6 +_,14 @@
@@ -834,6 +_,7 @@
graphics.requestCursor(CursorTypes.POINTING_HAND);
}
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprites[Mth.clamp(pos, 0, sprites.length)], x, y, 26, 32);
int iconX = x + 13 - 8;
int iconY = y + 16 - 8 + (isTop ? 1 : -1);
@@ -870,6 +_,14 @@
}
}
@@ -233,7 +241,7 @@
@OnlyIn(Dist.CLIENT)
private static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(final Container container, final int slot, final int x, final int y) {
@@ -1055,6 +_,22 @@
@@ -1050,6 +_,22 @@
@Override
public boolean mayPickup(final Player player) {
return this.target.mayPickup(player);
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -16,7 +_,7 @@
private static final Vector3fc TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
@@ -15,7 +_,7 @@
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int TEXTURE_WIDTH = 16;
private static final int TEXTURE_HEIGHT = 16;
- private final Identifier texture = Identifier.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
@@ -18,7 +_,7 @@
return switch (component) {
return (ClientTooltipComponent)(switch (component) {
case BundleTooltip bundleTooltip -> new ClientBundleTooltip(bundleTooltip.contents());
case ClientActivePlayersTooltip.ActivePlayersTooltip activePlayersTooltip -> new ClientActivePlayersTooltip(activePlayersTooltip);
- default -> throw new IllegalArgumentException("Unknown TooltipComponent");
+ default -> net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(component);
};
});
}
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -369,6 +_,8 @@
@@ -372,6 +_,8 @@
graphics.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), mouseX, mouseY);
}
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, graphics, this.getContentX(), this.getContentY(), this.getContentWidth(), mouseX - this.getContentX(), mouseY - this.getContentY());
+
if (hovered) {
if (this.minecraft.options.touchscreen().get() || hovered) {
graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544);
int relX = mouseX - this.getContentX();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
@@ -116,9 +_,10 @@
@@ -122,9 +_,10 @@
this.name = name;
this.changeButton = Button.builder(name, button -> {
KeyBindsList.this.keyBindsScreen.selectedKey = key;
@@ -12,7 +12,7 @@
.createNarration(
defaultNarrationSupplier -> key.isUnbound()
? Component.translatable("narrator.controls.unbound", name)
@@ -126,7 +_,7 @@
@@ -132,7 +_,7 @@
)
.build();
this.resetButton = Button.builder(RESET_BUTTON_TITLE, button -> {
@@ -21,7 +21,7 @@
KeyBindsList.this.resetMappingAndUpdateButtons();
}).bounds(0, 0, 50, 20).createNarration(defaultNarrationSupplier -> Component.translatable("narrator.controls.reset", name)).build();
this.refreshEntry();
@@ -167,7 +_,8 @@
@@ -173,7 +_,8 @@
MutableComponent tooltip = Component.empty();
if (!this.key.isUnbound()) {
for (KeyMapping otherKey : KeyBindsList.this.minecraft.options.keyMappings) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
@@ -111,6 +_,10 @@
@@ -112,6 +_,10 @@
boolean canMoveUp();
boolean canMoveDown();
@@ -11,7 +11,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -210,6 +_,11 @@
@@ -213,6 +_,11 @@
@Override
public void moveDown() {
this.move(1);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
+++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
@@ -65,7 +_,7 @@
@@ -66,7 +_,7 @@
Component header = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD);
this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, header), (int)(9.0F * 1.5F));
this.setSelected(null);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -172,6 +_,7 @@
@@ -174,6 +_,7 @@
WorldDataConfiguration dataConfig = SharedConstants.IS_RUNNING_IN_IDE
? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS)
: WorldDataConfiguration.DEFAULT;
@@ -8,7 +8,7 @@
WorldLoader.InitConfig loadConfig = createDefaultLoadConfig(vanillaOnlyPackRepository, dataConfig);
CompletableFuture<WorldCreationContext> loadResult = WorldLoader.load(
loadConfig,
@@ -512,7 +_,7 @@
@@ -509,7 +_,7 @@
if (retry) {
onAbort.accept(this.uiState.getSettings().dataConfiguration());
} else {
@@ -17,7 +17,7 @@
}
},
Component.translatable("dataPack.validation.failed"),
@@ -621,6 +_,7 @@
@@ -623,6 +_,7 @@
if (dataPackDir != null) {
if (this.tempDataPackRepository == null) {
this.tempDataPackRepository = ServerPacksSource.createPackRepository(dataPackDir, this.packValidator);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -239,7 +_,7 @@
@@ -229,7 +_,7 @@
public @Nullable PresetEditor getPresetEditor() {
Holder<WorldPreset> preset = this.getWorldType().preset();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -495,6 +_,8 @@
@@ -489,6 +_,8 @@
this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
PackRepository packRepository = ServerPacksSource.createPackRepository(worldAccess);
@@ -9,7 +9,7 @@
WorldStem worldStem;
try {
worldStem = this.loadWorldStem(worldAccess, levelDataTag, safeMode, packRepository);
@@ -537,6 +_,8 @@
@@ -530,6 +_,8 @@
WorldData data = worldDataAndGenSettings.data();
boolean oldCustomized = worldDataAndGenSettings.genSettings().options().isOldCustomizedWorld();
boolean unstable = data.worldGenSettingsLifecycle() != Lifecycle.stable();
@@ -18,7 +18,7 @@
if (!oldCustomized && !unstable) {
this.openWorldLoadBundledResourcePack(worldAccess, worldStem, packRepository, onCancel);
} else {
@@ -553,6 +_,8 @@
@@ -546,6 +_,8 @@
private void openWorldLoadBundledResourcePack(
final LevelStorageSource.LevelStorageAccess worldAccess, final WorldStem worldStem, final PackRepository packRepository, final Runnable onCancel
) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -83,6 +_,7 @@
@@ -84,6 +_,7 @@
private static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted");
private static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join");
private static final Logger LOGGER = LogUtils.getLogger();
@@ -8,7 +8,7 @@
private static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
private static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
private static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
@@ -483,6 +_,19 @@
@@ -486,6 +_,19 @@
}
}
@@ -28,11 +28,11 @@
@Override
public Component getNarration() {
Component entryNarration = Component.translatable(
@@ -512,6 +_,7 @@
@@ -515,6 +_,7 @@
this.infoText.setPosition(textX, this.getContentY() + 9 + 9 + 3);
this.infoText.extractRenderState(graphics, mouseX, mouseY, a);
graphics.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32);
+ renderExperimentalWarning(graphics, mouseX, mouseY, this.getContentY(), this.getContentX());
if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && hovered) {
if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && (this.minecraft.options.touchscreen().get() || hovered)) {
graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544);
int relX = mouseX - this.getContentX();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -159,8 +_,8 @@
@@ -114,8 +_,8 @@
CrashReport.preload();
logger = LogUtils.getLogger();
stage = "Bootstrap";
@@ -22,13 +22,13 @@
}
@OnlyIn(Dist.CLIENT)
- public enum ArmPose {
+ public enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
- public static enum ArmPose {
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
EMPTY(false, false),
ITEM(false, false),
BLOCK(false, false),
@@ -523,10 +_,29 @@
ArmPose(final boolean twoHanded, final boolean affectsOffhandPose) {
private ArmPose(final boolean twoHanded, final boolean affectsOffhandPose) {
this.twoHanded = twoHanded;
this.affectsOffhandPose = affectsOffhandPose;
+ this.forgeArmPose = null;
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -557,6 +_,7 @@
result.put(ModelLayers.PALE_OAK_CHEST_BOAT, chestBoatModel);
result.put(ModelLayers.MANGROVE_BOAT, boatModel);
result.put(ModelLayers.MANGROVE_CHEST_BOAT, chestBoatModel);
@@ -569,6 +_,7 @@
result.put(ModelLayers.createHangingSignModelName(woodType, attachmentType), hangingSignModel);
}
});
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(result);
ImmutableMap<ModelLayerLocation, LayerDefinition> definitions = result.build();
List<ModelLayerLocation> missingDefinitions = ModelLayers.getKnownLocations().filter(l -> !definitions.containsKey(l)).toList();
@@ -0,0 +1,24 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -324,15 +_,18 @@
}
public static ModelLayerLocation createStandingSignModelName(final WoodType type) {
- return createLocation("sign/standing/" + type.name(), "main");
+ Identifier location = Identifier.parse(type.name());
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/standing/" + location.getPath()), "main");
}
public static ModelLayerLocation createWallSignModelName(final WoodType type) {
- return createLocation("sign/wall/" + type.name(), "main");
+ Identifier location = Identifier.parse(type.name());
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main");
}
public static ModelLayerLocation createHangingSignModelName(final WoodType type, final HangingSignBlock.Attachment attachmentType) {
- return createLocation("hanging_sign/" + type.name() + "/" + attachmentType.getSerializedName(), "main");
+ Identifier location = Identifier.parse(type.name());
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + attachmentType.getSerializedName()), "main");
}
public static Stream<ModelLayerLocation> getKnownLocations() {
@@ -3,9 +3,9 @@
@@ -75,6 +_,8 @@
this.writeProfileKeyPair(fetchedKeyPair);
return Optional.ofNullable(fetchedKeyPair);
} catch (IOException | CryptException | MinecraftClientException e) {
} catch (CryptException | MinecraftClientException | IOException var3) {
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE)
LOGGER.error("Failed to retrieve profile key pair", e);
LOGGER.error("Failed to retrieve profile key pair", (Throwable)var3);
this.writeProfileKeyPair(null);
return cachedKeyPair;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
@@ -64,6 +_,7 @@
@@ -65,6 +_,7 @@
int index = this.storage.getIndex(pos.x(), pos.z());
LevelChunk currentChunk = this.storage.getChunk(index);
if (isValidChunk(currentChunk, pos.x(), pos.z())) {
@@ -9,10 +9,10 @@
}
}
@@ -124,6 +_,7 @@
}
this.level.onChunkLoaded(pos);
+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(chunk, false));
return chunk;
}
this.level.onChunkLoaded(pos);
+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(chunk, false));
return chunk;
}
Loaded 100 of 718 files, more files were not shown because too many files have changed in this diff. Show more