mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3da1b644d0 | ||
|
|
d3476f3f80 | ||
|
|
6665cdcf4e | ||
|
|
d9665f6447 | ||
|
|
ec73fd5240 | ||
|
|
3bbdbacb81 | ||
|
|
478d8b3f18 | ||
|
|
03f928a3de | ||
|
|
4834f16aef | ||
|
|
7846d25606 | ||
|
|
77cb0c5c4e | ||
|
|
5e421e8b8b | ||
|
|
5f37e8af53 | ||
|
|
5ab792f1d7 | ||
|
|
38ebbf189c | ||
|
|
f247eebd55 | ||
|
|
555989cf10 | ||
|
|
49fe93b1b5 | ||
|
|
48167e93b4 | ||
|
|
2bd132a6f8 | ||
|
|
b8168a12df | ||
|
|
df271e0265 | ||
|
|
d7687a72d5 |
No files matched your search
@@ -2,7 +2,7 @@ name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '26.1' ]
|
||||
branches: [ '26.2' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ plugins {
|
||||
id 'net.minecraftforge.gradle.patcher' version '[6.0.51,6.2)' apply false
|
||||
id 'net.minecraftforge.gradle.mcp' version '[6.0.51,6.2)' apply false
|
||||
id 'net.minecraftforge.gradlejarsigner' version '1.0.4'
|
||||
id 'org.barfuin.gradle.taskinfo' version '3.0.1'
|
||||
//id 'org.barfuin.gradle.taskinfo' version '3.0.1'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -21,7 +21,7 @@ ext {
|
||||
}
|
||||
|
||||
changelog {
|
||||
from '47.999'
|
||||
from '65.0'
|
||||
}
|
||||
|
||||
tasks.register('setup') {
|
||||
|
||||
+5
-5
@@ -88,7 +88,7 @@ ext {
|
||||
}
|
||||
final String MAVEN_PATH = ext.MAVEN_PATH
|
||||
|
||||
final String BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.2.0:fatjar'
|
||||
final String BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.3.0:fatjar'
|
||||
final String INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.5'
|
||||
final String FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.6'
|
||||
final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.2.0:fatjar'
|
||||
@@ -459,14 +459,14 @@ tasks.register('applyClientBinPatches', ApplyBinPatches) {
|
||||
tool = BINPATCH_TOOL
|
||||
clean = downloadClientRaw.dest
|
||||
patch = genClientBinPatches.output
|
||||
args.addAll(['--data', '--unpatched'])
|
||||
args.addAll(['--data', '--unpatched', '--store', '--marker', '.forge_patched_minecraft'])
|
||||
}
|
||||
tasks.register('applyServerBinPatches', ApplyBinPatches) {
|
||||
dependsOn extractServer
|
||||
tool = BINPATCH_TOOL
|
||||
clean = extractServer.output
|
||||
patch = genServerBinPatches.output
|
||||
args.addAll(['--data', '--unpatched'])
|
||||
args.addAll(['--data', '--unpatched', '--store'])
|
||||
}
|
||||
tasks.register('applyJoinedBinPatches', ApplyBinPatches) {
|
||||
tool = BINPATCH_TOOL
|
||||
@@ -718,7 +718,7 @@ tasks.register('installerJson', InstallerJson) {
|
||||
'--clean', '{MC_UNPACKED}',
|
||||
'--output', '{PATCHED}',
|
||||
'--apply', '{BINPATCH}',
|
||||
'--data', '--unpatched'
|
||||
'--data', '--unpatched', '--store'
|
||||
],
|
||||
outputs: [
|
||||
'{PATCHED}': '{PATCHED_SHA}'
|
||||
@@ -731,7 +731,7 @@ tasks.register('installerJson', InstallerJson) {
|
||||
'--clean', '{MINECRAFT_JAR}',
|
||||
'--output', '{PATCHED}',
|
||||
'--apply', '{BINPATCH}',
|
||||
'--data', '--unpatched'
|
||||
'--data', '--unpatched', '--store', '--marker', '.forge_patched_minecraft'
|
||||
],
|
||||
outputs: [
|
||||
'{PATCHED}': '{PATCHED_SHA}'
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[][Download]
|
||||
[][Download]
|
||||
[][Download] [][Discord] [][Patreon]
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -14,16 +14,14 @@ 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);
|
||||
}
|
||||
|
||||
@@ -33,19 +31,15 @@ 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();
|
||||
}
|
||||
});
|
||||
@@ -58,31 +52,23 @@ 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;
|
||||
}
|
||||
@@ -90,8 +76,7 @@ public class CrashReportCallables
|
||||
});
|
||||
}
|
||||
|
||||
public static List<ISystemReportExtender> allCrashCallables()
|
||||
{
|
||||
public static List<ISystemReportExtender> allCrashCallables() {
|
||||
return List.copyOf(crashCallables);
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,10 @@ 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, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
|
||||
(incoming, _) -> 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, e) -> ModLoadingContext.get().setActiveContainer(mc),
|
||||
(mc, e) -> ModLoadingContext.get().setActiveContainer(null)
|
||||
(mc, _) -> ModLoadingContext.get().setActiveContainer(mc),
|
||||
(_, _) -> ModLoadingContext.get().setActiveContainer(null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ 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((r, th)->null).thenApply(res -> list);
|
||||
return CompletableFuture.allOf(results).handle((_, _)->null).thenApply(_ -> 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((mc, exception) -> {
|
||||
.whenComplete((_, 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, parallel) -> sync),
|
||||
PARALLEL((sync, parallel) -> parallel);
|
||||
SYNC((sync, _) -> sync),
|
||||
PARALLEL((_, parallel) -> parallel);
|
||||
|
||||
private final BinaryOperator<Executor> selector;
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ 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
|
||||
{
|
||||
|
||||
+8
-8
@@ -116,7 +116,7 @@ public class RenderElement {
|
||||
}
|
||||
|
||||
public static RenderElement forgeVersionOverlay(SimpleFont font, String version) {
|
||||
return new RenderElement(RenderElement.initializeText(font, (bb, fnt, ctx)->
|
||||
return new RenderElement(RenderElement.initializeText(font, (bb, _, 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()}, f->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()}, _->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()}, f -> colour, f -> 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()}, _ -> colour, _ -> new float[]{0f, pm.progress()});
|
||||
}
|
||||
Renderer label = (bb, ctx, frame) -> renderText(font, text((ctx.scaledWidth() - BAR_WIDTH * ctx.scale()) / 2, y, pm.label().getText(), colour), bb, ctx);
|
||||
Renderer label = (bb, ctx, _) -> 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()}, f -> colour, f -> new float[]{0f, pi.memory()});
|
||||
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 width = font.stringWidth(pi.text());
|
||||
Renderer label = (bb, ctx, frame) -> renderText(font, text(ctx.scaledWidth() / 2 - width / 2, y + 18, pi.text(), context.colourScheme.foreground().packedint(globalAlpha)), bb, ctx);
|
||||
Renderer label = (bb, ctx, _) -> 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, frame) -> renderText(font, textGenerator, bb, context);
|
||||
return (bb, context, _) -> 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, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
|
||||
return (bb, font, _) -> 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, (action, path, incorrectValue, correctedValue) ->
|
||||
configSpec.correct(configData, (_, 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(), v->naming);
|
||||
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist);
|
||||
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), _->naming);
|
||||
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), _->dist);
|
||||
}
|
||||
|
||||
public static class Keys {
|
||||
|
||||
@@ -12,7 +12,6 @@ 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;
|
||||
@@ -42,7 +41,7 @@ public class FMLServiceProvider implements ITransformationService {
|
||||
LOGGER.debug(CORE, "Loading configuration");
|
||||
FMLConfig.load();
|
||||
LOGGER.debug(CORE, "Preparing ModFile");
|
||||
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile::new);
|
||||
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), _->ModFile::new);
|
||||
LOGGER.debug(CORE, "Preparing launch handler");
|
||||
FMLLoader.setupLaunchHandler(environment, arguments);
|
||||
FMLEnvironment.setupInteropEnvironment(environment);
|
||||
|
||||
@@ -7,7 +7,6 @@ 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,7 +6,6 @@
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* Convert a maven coordinate into a Path.
|
||||
|
||||
@@ -26,6 +26,7 @@ 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,7 +13,6 @@ 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 {
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ 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;
|
||||
@@ -56,7 +55,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((r, t) -> addCompletedFile(file, t));
|
||||
if (DEBUG) future = future.whenComplete((_, t) -> addCompletedFile(file, t));
|
||||
file.setFutureScanResult(future);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ public enum InvalidModIdentifier {
|
||||
LITELOADER(filePresent("litemod.json")),
|
||||
OPTIFINE(filePresent("optifine/Installer.class")),
|
||||
BUKKIT(filePresent("plugin.yml")),
|
||||
INVALIDZIP((f,zf) -> zf.isEmpty()); // note: only this one INVALIDZIP check is ran until the todo on this class is fixed
|
||||
INVALIDZIP((_,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 (f, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false);
|
||||
return (_, zfo) -> zfo.map(zf -> zf.getEntry(filename) != null).orElse(false);
|
||||
}
|
||||
|
||||
private static <T> Optional<T> optionalFromException(Supplier_WithExceptions<T, ? extends Exception> supp)
|
||||
|
||||
+1
-1
@@ -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, id -> new ArrayList<>()).add(entry);
|
||||
ids.computeIfAbsent(entry.coord, _ -> new ArrayList<>()).add(entry);
|
||||
}
|
||||
|
||||
for (var entry : ids.entrySet()) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public final class MinecraftLocator extends AbstractModProvider implements IModL
|
||||
|
||||
// Minecraft itself.
|
||||
var meta = new ModJarMetadata();
|
||||
var mcjar = SecureJar.from(jar -> meta, paths);
|
||||
var mcjar = SecureJar.from(_ -> meta, paths);
|
||||
var mc = ModFileFactory.FACTORY.build(mcjar, this, MinecraftLocator::buildMinecraftTOML);
|
||||
meta.setModFile(mc);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ 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;
|
||||
@@ -26,7 +25,6 @@ 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;
|
||||
|
||||
+1
-1
@@ -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, (key, existingList) -> {
|
||||
newMessages.compute(type, (_, existingList) -> {
|
||||
List<Message> newList = new ArrayList<>();
|
||||
if (existingList != null)
|
||||
{
|
||||
|
||||
+1
-1
@@ -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, base) -> {
|
||||
var modJar = SecureJar.from((path, _) -> {
|
||||
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, base) -> {
|
||||
(name, _) -> {
|
||||
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, k -> new HashSet<>()).add((String)value);
|
||||
mods.computeIfAbsent(pkg, _ -> new HashSet<>()).add((String)value);
|
||||
|
||||
idx = pkg.lastIndexOf('/');
|
||||
while (idx != -1) {
|
||||
|
||||
+3
-1
@@ -25,7 +25,9 @@ sealed abstract class ForgeProdLaunchHandler extends CommonLaunchHandler {
|
||||
|
||||
@Override
|
||||
public List<Path> getMinecraftPaths() {
|
||||
return List.of(getPathFromResource("net/minecraft/client/Minecraft.class"));
|
||||
// We use a marker because 3rd party launcher don't build their class paths correctly
|
||||
// https://github.com/MinecraftForge/MinecraftForge/issues/10797
|
||||
return List.of(getPathFromResource(".forge_patched_minecraft"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-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 " + fieldName + " is not private and an instance field");
|
||||
throw new IllegalStateException("Field " + classNode.name + '.' + fieldName + " is not private and an instance field");
|
||||
|
||||
var methodSignature = "()" + foundField.desc;
|
||||
var foundMethod = findMethod(classNode, methodName, methodSignature);
|
||||
|
||||
+1
-1
@@ -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),
|
||||
insn -> new MethodInsnNode(
|
||||
_ -> new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"net/minecraftforge/event/ForgeEventFactory",
|
||||
"onFinalizeSpawn",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"class": "net/minecraft/gametest/framework/GameTestHelper",
|
||||
"class": "net/minecraft/gametest/framework/GameTestEntityBuilder",
|
||||
"methods": [
|
||||
"spawn(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;"
|
||||
"spawn()Lnet/minecraft/world/entity/Entity;"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -20,7 +20,7 @@
|
||||
{
|
||||
"class": "net/minecraft/world/entity/EntityType",
|
||||
"methods": [
|
||||
"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;"
|
||||
"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;"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+4
-4
@@ -5,11 +5,11 @@ org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
JAVA_VERSION=25
|
||||
MC_VERSION=26.1
|
||||
MC_NEXT_VERSION=26.2
|
||||
MCP_VERSION=20260324.123823
|
||||
MC_VERSION=26.2
|
||||
MC_NEXT_VERSION=26.3
|
||||
MCP_VERSION=20260616.103818
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=26.1
|
||||
MAPPING_VERSION=26.2
|
||||
|
||||
# Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
CHECK_COMPATIBILITY=false
|
||||
|
||||
+1
-1
@@ -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,b)->a));
|
||||
.collect(Collectors.toMap(FMLModTarget::modId, Function.identity(), (a, _) -> a));
|
||||
scanResult.addLanguageLoader(modTargetMap);
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -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, b)->a));
|
||||
.collect(Collectors.toMap(LowCodeModTarget::modId, Function.identity(), (a, _)->a));
|
||||
scanResult.addLanguageLoader(modTargetMap);
|
||||
};
|
||||
}
|
||||
|
||||
+1
-3
@@ -6,7 +6,7 @@ plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'net.minecraftforge.gradle' version '[7.0.3,8)'
|
||||
id 'net.minecraftforge.gradle' version '[7.0.17,8)'
|
||||
}
|
||||
|
||||
version = '1.0.0'
|
||||
@@ -19,8 +19,6 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(25)
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: '@MC_VERSION@'
|
||||
|
||||
runs {
|
||||
configureEach {
|
||||
workingDir = layout.projectDirectory.dir('run')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
@@ -111,6 +_,9 @@
|
||||
@@ -201,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
|
||||
@@ -249,6 +_,10 @@
|
||||
@@ -239,6 +_,10 @@
|
||||
}
|
||||
|
||||
public static int toGlInternalId(final TextureFormat textureFormat) {
|
||||
+ return toGlInternalId(textureFormat, false);
|
||||
public static int toGlInternalId(final GpuFormat gpuFormat) {
|
||||
+ return toGlInternalId(gpuFormat, false);
|
||||
+ }
|
||||
+ 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 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 toGlExternalId(final TextureFormat textureFormat) {
|
||||
+ return toGlExternalId(textureFormat, false);
|
||||
public static int toGlExternalId(final GpuFormat gpuFormat) {
|
||||
+ return toGlExternalId(gpuFormat, false);
|
||||
+ }
|
||||
+ 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 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 toGlType(final TextureFormat textureFormat) {
|
||||
+ return toGlType(textureFormat, false);
|
||||
public static int toGlType(final GpuFormat gpuFormat) {
|
||||
+ return toGlType(gpuFormat, false);
|
||||
+ }
|
||||
+ 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;
|
||||
+ 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;
|
||||
@@ -15,30 +15,30 @@
|
||||
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);
|
||||
@@ -103,6 +_,8 @@
|
||||
@@ -83,6 +_,8 @@
|
||||
}
|
||||
|
||||
LOGGER.info("OpenGL debug message: {}", gldebug$logentry);
|
||||
LOGGER.info("OpenGL debug message: {}", entry);
|
||||
+ // TODO: [VEN] Trim the stack trace
|
||||
+ if (PRINT_STACKTRACE_ON_ERROR) LOGGER.info("Trace: ", new Throwable("GlDebug"));
|
||||
}
|
||||
|
||||
public List<String> getLastOpenGlDebugMessages() {
|
||||
@@ -126,7 +_,7 @@
|
||||
GlDebug gldebug1 = new GlDebug();
|
||||
enabledExtensions.add("GL_KHR_debug");
|
||||
GL11.glEnable(37600);
|
||||
- if (debugSynchronousGlLogs) {
|
||||
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
|
||||
GL11.glEnable(33346);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -140,7 +_,7 @@
|
||||
} else if (glcapabilities.GL_ARB_debug_output && GlDevice.USE_GL_ARB_debug_output) {
|
||||
GlDebug gldebug = new GlDebug();
|
||||
enabledExtensions.add("GL_ARB_debug_output");
|
||||
- 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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
@@ -129,7 +_,12 @@
|
||||
@@ -150,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 TextureFormat 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 GpuFormat 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
|
||||
@@ -142,6 +_,11 @@
|
||||
@@ -163,6 +_,11 @@
|
||||
final int depthOrLayers,
|
||||
final int mipLevels
|
||||
) {
|
||||
@@ -22,33 +22,29 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ 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) {
|
||||
+ 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) {
|
||||
GlStateManager.clearGlErrors();
|
||||
int i = GlStateManager._genTexture();
|
||||
int id = GlStateManager._genTexture();
|
||||
if (label == null) {
|
||||
@@ -169,14 +_,14 @@
|
||||
for (int k : GlConst.CUBEMAP_TARGETS) {
|
||||
for (int l = 0; l < mipLevels; l++) {
|
||||
GlStateManager._texImage2D(
|
||||
- k, l, GlConst.toGlInternalId(format), width >> l, height >> l, 0, GlConst.toGlExternalId(format), GlConst.toGlType(format), null
|
||||
+ k, l, GlConst.toGlInternalId(format, stencil), width >> l, height >> l, 0, GlConst.toGlExternalId(format, stencil), GlConst.toGlType(format, stencil), null
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i1 = 0; i1 < mipLevels; i1++) {
|
||||
GlStateManager._texImage2D(
|
||||
- j, i1, GlConst.toGlInternalId(format), width >> i1, height >> i1, 0, GlConst.toGlExternalId(format), GlConst.toGlType(format), null
|
||||
+ j, i1, GlConst.toGlInternalId(format, stencil), width >> i1, height >> i1, 0, GlConst.toGlExternalId(format, stencil), GlConst.toGlType(format, stencil), null
|
||||
);
|
||||
}
|
||||
@@ -186,9 +_,9 @@
|
||||
GlStateManager._texParameter(target, 34892, 0);
|
||||
}
|
||||
@@ -187,7 +_,7 @@
|
||||
} else if (j1 != 0) {
|
||||
throw new IllegalStateException("OpenGL error " + j1);
|
||||
|
||||
- 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);
|
||||
}
|
||||
|
||||
- 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);
|
||||
this.debugLabels.applyLabel(texture);
|
||||
return texture;
|
||||
} else {
|
||||
- GlTexture gltexture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, i);
|
||||
+ GlTexture gltexture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, i, stencil);
|
||||
this.debugLabels.applyLabel(gltexture);
|
||||
return gltexture;
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
@@ -86,6 +_,11 @@
|
||||
@@ -80,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean _isBlendEnabled() {
|
||||
+ public static boolean _isBlendEnabled(int index) {
|
||||
+ RenderSystem.assertOnRenderThread();
|
||||
+ return BLEND.mode.enabled;
|
||||
+ return BLEND[index].mode.enabled;
|
||||
+ }
|
||||
+
|
||||
public static void _disableBlend() {
|
||||
public static void _disableBlend(int index) {
|
||||
RenderSystem.assertOnRenderThread();
|
||||
BLEND.mode.disable();
|
||||
@@ -380,9 +_,17 @@
|
||||
BLEND[index].mode.disable();
|
||||
@@ -390,9 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
+
|
||||
public static void _texParameter(final int target, final int name, final int value) {
|
||||
RenderSystem.assertOnRenderThread();
|
||||
GL11.glTexParameteri(target, name, value);
|
||||
+ if (target == GL13.GL_TEXTURE1) {
|
||||
GL33C.glTexParameteri(target, name, value);
|
||||
+ if (target == GL33C.GL_TEXTURE1) {
|
||||
+ lastBrightnessX = name;
|
||||
+ lastBrightnessY = value;
|
||||
+ }
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
@@ -28,8 +_,13 @@
|
||||
final int mipLevels,
|
||||
final int id
|
||||
@@ -27,9 +_,14 @@
|
||||
final int id,
|
||||
final FrameBufferCache frameBufferCache
|
||||
) {
|
||||
+ this(usage, label, format, width, height, depthOrLayers, mipLevels, id, false);
|
||||
+ this(usage, label, format, width, height, depthOrLayers, mipLevels, id, frameBufferCache, false);
|
||||
+ }
|
||||
+
|
||||
+ protected GlTexture(int usage, String label, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, int id, boolean stencil) {
|
||||
+ protected GlTexture(@GpuTexture.Usage int usage, String label, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels, int id, FrameBufferCache frameBufferCache, boolean stencil) {
|
||||
super(usage, label, format, width, height, depthOrLayers, mipLevels);
|
||||
this.id = id;
|
||||
this.frameBufferCache = frameBufferCache;
|
||||
+ this.stencilEnabled = stencil;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,5 +_,12 @@
|
||||
@@ -84,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
|
||||
@@ -80,7 +_,7 @@
|
||||
@@ -83,7 +_,7 @@
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
if (this.useDepth) {
|
||||
- this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1);
|
||||
+ this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1, this.stencilEnabled);
|
||||
this.depthTextureView = gpudevice.createTextureView(this.depthTexture);
|
||||
- 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.depthTextureView = device.createTextureView(this.depthTexture);
|
||||
}
|
||||
|
||||
@@ -124,5 +_,26 @@
|
||||
@@ -121,5 +_,26 @@
|
||||
|
||||
public @Nullable GpuTextureView getDepthTextureView() {
|
||||
return this.depthTextureView;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -97,8 +_,9 @@
|
||||
Monitor monitor = this.screenManager.getMonitor(GLFW.glfwGetPrimaryMonitor());
|
||||
@@ -101,8 +_,9 @@
|
||||
Monitor initialMonitor = monitorManager.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 && monitor != null ? monitor.getMonitor() : 0L);
|
||||
+ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(this.width, this.height, title, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, () -> backend);
|
||||
- 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.backend = backend;
|
||||
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), 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 (monitor != null) {
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -110,6 +_,7 @@
|
||||
this.windowedX = this.x = aint1[0];
|
||||
this.windowedY = this.y = aint[0];
|
||||
+ 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 = actualX[0];
|
||||
this.windowedY = this.y = actualY[0];
|
||||
}
|
||||
+ }
|
||||
|
||||
this.setMode();
|
||||
this.refreshFramebufferSize();
|
||||
@@ -300,6 +_,9 @@
|
||||
GLFW.glfwGetFramebufferSize(this.handle, aint, aint1);
|
||||
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||
@@ -306,6 +_,9 @@
|
||||
outHeight[0] = this.isSoftScreen() ? outHeight[0] - 1 : outHeight[0];
|
||||
this.framebufferWidth = outWidth[0] > 0 ? outWidth[0] : 1;
|
||||
this.framebufferHeight = outHeight[0] > 0 ? outHeight[0] : 1;
|
||||
+ if (this.framebufferHeight == 0 || this.framebufferWidth == 0) {
|
||||
+ net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w -> this.framebufferWidth = w, h -> this.framebufferHeight = h);
|
||||
+ }
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
@@ -61,6 +_,21 @@
|
||||
@@ -73,6 +_,21 @@
|
||||
return this.backend.createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
|
||||
}
|
||||
|
||||
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
|
||||
+ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */
|
||||
+ public GpuTexture createTexture(
|
||||
+ final @Nullable Supplier<String> label,
|
||||
+ @GpuTexture.Usage final int usage,
|
||||
+ final TextureFormat format,
|
||||
+ final GpuFormat format,
|
||||
+ final int width,
|
||||
+ final int height,
|
||||
+ final int depthOrLayers,
|
||||
@@ -21,18 +21,18 @@
|
||||
+
|
||||
public GpuTexture createTexture(
|
||||
final @Nullable String label,
|
||||
@GpuTexture.Usage final int usage,
|
||||
@@ -72,6 +_,21 @@
|
||||
final @GpuTexture.Usage int usage,
|
||||
@@ -84,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, TextureFormat, int, int, int)} but with stencil support */
|
||||
+ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */
|
||||
+ public GpuTexture createTexture(
|
||||
+ final @Nullable String label,
|
||||
+ @GpuTexture.Usage final int usage,
|
||||
+ final TextureFormat format,
|
||||
+ final GpuFormat 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(@GpuTexture.Usage final int usage, final int width, final int height, final int depthOrLayers, final int mipLevels) {
|
||||
private void verifyTextureCreationArgs(final @GpuTexture.Usage int usage, final int width, final int height, final int depthOrLayers, final int mipLevels) {
|
||||
@@ -1,20 +1,18 @@
|
||||
--- a/com/mojang/blaze3d/systems/GpuDeviceBackend.java
|
||||
+++ b/com/mojang/blaze3d/systems/GpuDeviceBackend.java
|
||||
@@ -30,9 +_,19 @@
|
||||
@Nullable Supplier<String> label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels
|
||||
@@ -32,7 +_,17 @@
|
||||
@Nullable Supplier<String> label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels
|
||||
);
|
||||
|
||||
+ /** 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) {
|
||||
+ /** 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) {
|
||||
+ return createTexture(label, usage, format, width, height, depthOrLayers, mipLevels);
|
||||
+ }
|
||||
+
|
||||
GpuTexture createTexture(
|
||||
@Nullable String label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels
|
||||
);
|
||||
GpuTexture createTexture(@Nullable String label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels);
|
||||
+
|
||||
+ /** 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) {
|
||||
+ /** 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) {
|
||||
+ 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
|
||||
@@ -8,7 +_,7 @@
|
||||
@@ -9,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
@@ -29,6 +_,7 @@
|
||||
private final int[] offsetsByElement = new int[32];
|
||||
private @Nullable GpuBuffer immediateDrawVertexBuffer;
|
||||
private @Nullable GpuBuffer immediateDrawIndexBuffer;
|
||||
@@ -19,6 +_,7 @@
|
||||
private final int vertexSize;
|
||||
private final int stepRate;
|
||||
private final List<VertexFormatElement> elementValues;
|
||||
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
|
||||
private VertexFormat(final List<VertexFormatElement> elements, final List<String> names, final IntList offsets, final int vertexSize) {
|
||||
this.elements = elements;
|
||||
@@ -41,6 +_,11 @@
|
||||
int j = vertexformatelement != null ? elements.indexOf(vertexformatelement) : -1;
|
||||
this.offsetsByElement[i] = j != -1 ? offsets.getInt(j) : -1;
|
||||
private VertexFormat(final List<VertexFormatElement> elements, final int vertexSize, final int stepRate) {
|
||||
this.vertexSize = vertexSize;
|
||||
@@ -29,6 +_,11 @@
|
||||
}
|
||||
|
||||
this.elementValues = elements;
|
||||
+
|
||||
+ ImmutableMap.Builder<String, VertexFormatElement> elementMapping = ImmutableMap.builder();
|
||||
+ for (int i = 0; i < elements.size(); i++)
|
||||
+ elementMapping.put(names.get(i), elements.get(i));
|
||||
+ var elementMapping = com.google.common.collect.ImmutableMap.<String, VertexFormatElement>builder();
|
||||
+ for (var element : elements)
|
||||
+ elementMapping.put(element.name(), element);
|
||||
+ this.elementMapping = elementMapping.buildOrThrow();
|
||||
}
|
||||
|
||||
public static VertexFormat.Builder builder() {
|
||||
@@ -139,6 +_,9 @@
|
||||
this.immediateDrawIndexBuffer = uploadToBuffer(this.immediateDrawIndexBuffer, buffer, 72, () -> "Immediate index buffer for " + this);
|
||||
return this.immediateDrawIndexBuffer;
|
||||
public static VertexFormat.Builder builder(final int stepRate) {
|
||||
@@ -69,6 +_,8 @@
|
||||
public int hashCode() {
|
||||
return this.elementValues.hashCode();
|
||||
}
|
||||
+
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsetsByElement[index]; }
|
||||
+ public com.google.common.collect.ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Builder {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/math/Transformation.java
|
||||
+++ b/com/mojang/math/Transformation.java
|
||||
@@ -17,7 +_,7 @@
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Vector3fc;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
);
|
||||
+ }
|
||||
+
|
||||
+ private Matrix3f normalTransform = null;
|
||||
+ public Matrix3f getNormalMatrix() {
|
||||
+ private org.joml.Matrix3f normalTransform = null;
|
||||
+ public org.joml.Matrix3f getNormalMatrix() {
|
||||
+ checkNormalTransform();
|
||||
+ return normalTransform;
|
||||
+ }
|
||||
+
|
||||
+ private void checkNormalTransform() {
|
||||
+ if (normalTransform == null) {
|
||||
+ normalTransform = new Matrix3f(matrix);
|
||||
+ normalTransform = new org.joml.Matrix3f(matrix);
|
||||
+ normalTransform.invert();
|
||||
+ normalTransform.transpose();
|
||||
+ }
|
||||
|
||||
+1
-1
@@ -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.setScreen(this.nextScreen);
|
||||
+ minecraft.gui.setScreen(this.nextScreen);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return super.keyPressed(event);
|
||||
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
@@ -303,7 +_,7 @@
|
||||
int k = this.getY();
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.image, j + 2, k + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, i);
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, j, k, 60, 60, i);
|
||||
- int l = flag ? -6250336 : -1;
|
||||
+ int l = getFGColor();
|
||||
graphics.centeredText(RealmsResetWorldScreen.this.font, this.getMessage(), j + 28, k - 14, l);
|
||||
@@ -300,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);
|
||||
- int textColor = hoveredOrFocused ? -6250336 : -1;
|
||||
+ int textColor = getFGColor();
|
||||
graphics.centeredText(RealmsResetWorldScreen.this.font, this.getMessage(), x + 28, y - 14, textColor);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -58,14 +_,9 @@
|
||||
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
|
||||
if (this.uncategorizedStackTrace.length > 0) {
|
||||
builder.append("-- Head --\n");
|
||||
builder.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||
- builder.append("Stacktrace:\n");
|
||||
-
|
||||
- for (StackTraceElement stacktraceelement : this.uncategorizedStackTrace) {
|
||||
- builder.append("\t").append("at ").append(stacktraceelement);
|
||||
- for (StackTraceElement element : this.uncategorizedStackTrace) {
|
||||
- builder.append("\t").append("at ").append(element);
|
||||
- builder.append("\n");
|
||||
- }
|
||||
-
|
||||
@@ -17,7 +17,7 @@
|
||||
+ builder.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace));
|
||||
}
|
||||
|
||||
for (CrashReportCategory crashreportcategory : this.details) {
|
||||
for (CrashReportCategory entry : this.details) {
|
||||
@@ -73,6 +_,7 @@
|
||||
builder.append("\n\n");
|
||||
}
|
||||
@@ -26,23 +26,20 @@
|
||||
this.systemReport.appendToCrashReportString(builder);
|
||||
}
|
||||
|
||||
@@ -92,18 +_,7 @@
|
||||
throwable.setStackTrace(this.exception.getStackTrace());
|
||||
@@ -84,15 +_,7 @@
|
||||
exception = replaceMessage(exception, this.title);
|
||||
}
|
||||
|
||||
- String s;
|
||||
- try {
|
||||
- stringwriter = new StringWriter();
|
||||
- printwriter = new PrintWriter(stringwriter);
|
||||
- throwable.printStackTrace(printwriter);
|
||||
- s = stringwriter.toString();
|
||||
- writer = new StringWriter();
|
||||
- printWriter = new PrintWriter(writer);
|
||||
- exception.printStackTrace(printWriter);
|
||||
- return writer.toString();
|
||||
- } finally {
|
||||
- IOUtils.closeQuietly((Writer)stringwriter);
|
||||
- IOUtils.closeQuietly((Writer)printwriter);
|
||||
- IOUtils.closeQuietly(writer);
|
||||
- IOUtils.closeQuietly(printWriter);
|
||||
- }
|
||||
-
|
||||
- return s;
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(exception);
|
||||
}
|
||||
|
||||
public String getFriendlyReport(final ReportType reportType, final List<String> extraComments) {
|
||||
private static Throwable copyProperties(final Throwable original, final Throwable copy) {
|
||||
@@ -1,26 +1,26 @@
|
||||
--- a/net/minecraft/CrashReportCategory.java
|
||||
+++ b/net/minecraft/CrashReportCategory.java
|
||||
@@ -114,8 +_,10 @@
|
||||
if (astacktraceelement.length <= 0) {
|
||||
@@ -138,8 +_,10 @@
|
||||
return 0;
|
||||
} else {
|
||||
- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - nestedOffset];
|
||||
- System.arraycopy(astacktraceelement, 3 + nestedOffset, this.stackTrace, 0, this.stackTrace.length);
|
||||
+ int len = astacktraceelement.length - 3 - nestedOffset;
|
||||
+ if (len <= 0) len = astacktraceelement.length;
|
||||
+ this.stackTrace = new StackTraceElement[len];
|
||||
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
|
||||
return this.stackTrace.length;
|
||||
}
|
||||
}
|
||||
@@ -162,16 +_,16 @@
|
||||
|
||||
if (this.stackTrace != null && this.stackTrace.length > 0) {
|
||||
- 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;
|
||||
}
|
||||
|
||||
@@ -181,16 +_,16 @@
|
||||
|
||||
if (this.stackTrace.length > 0) {
|
||||
builder.append("\nStacktrace:");
|
||||
-
|
||||
- for (StackTraceElement stacktraceelement : this.stackTrace) {
|
||||
- for (StackTraceElement element : this.stackTrace) {
|
||||
- builder.append("\n\tat ");
|
||||
- builder.append(stacktraceelement);
|
||||
- builder.append(element);
|
||||
- }
|
||||
+ builder.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -216,6 +_,7 @@
|
||||
@@ -218,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -227,7 +_,11 @@
|
||||
@@ -220,7 +_,11 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(final Consumer<AdvancementHolder> output, final String name) {
|
||||
- AdvancementHolder advancementholder = this.build(Identifier.parse(name));
|
||||
- AdvancementHolder advancement = this.build(Identifier.parse(name));
|
||||
+ return save(output, Identifier.parse(name));
|
||||
+ }
|
||||
+
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> output, Identifier id) {
|
||||
+ AdvancementHolder advancementholder = this.build(id);
|
||||
output.accept(advancementholder);
|
||||
return advancementholder;
|
||||
+ AdvancementHolder advancement = this.build(id);
|
||||
output.accept(advancement);
|
||||
return advancement;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/advancements/AdvancementRewards.java
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -44,6 +_,7 @@
|
||||
LootParams lootparams = new LootParams.Builder(serverlevel)
|
||||
@@ -43,6 +_,7 @@
|
||||
LootParams params = new LootParams.Builder(level)
|
||||
.withParameter(LootContextParams.THIS_ENTITY, player)
|
||||
.withParameter(LootContextParams.ORIGIN, player.position())
|
||||
+ .withLuck(player.getLuck())
|
||||
.create(LootContextParamSets.ADVANCEMENT_REWARD);
|
||||
boolean flag = false;
|
||||
boolean changes = false;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -217,12 +_,14 @@
|
||||
return 90.0F;
|
||||
} else {
|
||||
float f = this.minecraft.options.fov().get().intValue() * Mth.lerp(partialTicks, this.oldFovModifier, this.fovModifier);
|
||||
- return this.modifyFovBasedOnDeathOrFluid(partialTicks, f);
|
||||
+ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, f);
|
||||
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, true).getFOV();
|
||||
@@ -224,11 +_,13 @@
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -17,7 +16,7 @@
|
||||
}
|
||||
|
||||
private float modifyFovBasedOnDeathOrFluid(final float partialTicks, float fov) {
|
||||
@@ -331,9 +_,13 @@
|
||||
@@ -337,9 +_,13 @@
|
||||
}
|
||||
|
||||
protected void setRotation(final float yRot, final float xRot) {
|
||||
@@ -32,7 +31,7 @@
|
||||
FORWARDS.rotate(this.rotation, this.forwards);
|
||||
UP.rotate(this.rotation, this.up);
|
||||
LEFT.rotate(this.rotation, this.left);
|
||||
@@ -364,6 +_,13 @@
|
||||
@@ -370,6 +_,13 @@
|
||||
|
||||
public float yRot() {
|
||||
return this.yRot;
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
}
|
||||
|
||||
private static void forAllKeyMappings(final InputConstants.Key key, final Consumer<KeyMapping> operation) {
|
||||
- List<KeyMapping> list = MAP.get(key);
|
||||
+ List<KeyMapping> list = MAP.getAll(key);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (KeyMapping keymapping : list) {
|
||||
operation.accept(keymapping);
|
||||
- List<KeyMapping> keyMappings = MAP.get(key);
|
||||
+ List<KeyMapping> keyMappings = MAP.getAll(key);
|
||||
if (keyMappings != null && !keyMappings.isEmpty()) {
|
||||
for (KeyMapping keyMapping : keyMappings) {
|
||||
operation.accept(keyMapping);
|
||||
@@ -106,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
return this.key.equals(that.key);
|
||||
}
|
||||
|
||||
@@ -175,11 +_,13 @@
|
||||
@@ -179,11 +_,13 @@
|
||||
}
|
||||
|
||||
public Component getTranslatedKeyMessage() {
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
public String saveString() {
|
||||
@@ -191,11 +_,94 @@
|
||||
@@ -195,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
|
||||
@@ -516,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;
|
||||
@@ -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 @@
|
||||
}
|
||||
@@ -525,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
screen.afterKeyboardAction();
|
||||
- if (screen.keyPressed(event)) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, event)) {
|
||||
if (this.minecraft.screen == null) {
|
||||
InputConstants.Key inputconstants$key = InputConstants.getKey(event);
|
||||
KeyMapping.set(inputconstants$key, false);
|
||||
@@ -597,6 +_,7 @@
|
||||
} 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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +_,7 @@
|
||||
Screen screen = this.minecraft.screen;
|
||||
if (screen != null && this.minecraft.getOverlay() == null) {
|
||||
@@ -570,7 +_,7 @@
|
||||
Screen screen = this.minecraft.gui.screen();
|
||||
if (screen != null && this.minecraft.gui.overlay() == null) {
|
||||
try {
|
||||
- screen.charTyped(event);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, event);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "charTyped event handler");
|
||||
screen.fillCrashDetails(crashreport);
|
||||
} catch (Throwable t) {
|
||||
CrashReport report = CrashReport.forThrowable(t, "charTyped event handler");
|
||||
screen.fillCrashDetails(report);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -272,7 +_,7 @@
|
||||
@@ -258,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;
|
||||
@@ -436,7 +_,6 @@
|
||||
@@ -410,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,158 +17,126 @@
|
||||
this.demo = gameConfig.game.demo;
|
||||
this.allowsMultiplayer = !gameConfig.game.disableMultiplayer;
|
||||
this.allowsChat = !gameConfig.game.disableChat;
|
||||
@@ -522,14 +_,14 @@
|
||||
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
|
||||
}
|
||||
|
||||
+ // 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 -> {
|
||||
@@ -617,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);
|
||||
@@ -638,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);
|
||||
@@ -669,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());
|
||||
@@ -695,14 +_,16 @@
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, gameConfig.quickPlay);
|
||||
this.setOverlay(
|
||||
- new LoadingOverlay(this, reloadinstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, minecraft$gameloadcookie), () -> {
|
||||
+ net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(
|
||||
+ () -> this, () -> reloadinstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, minecraft$gameloadcookie), () -> {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
|
||||
this.reloadStateTracker.finishReload();
|
||||
this.onResourceLoadFinished(minecraft$gameloadcookie);
|
||||
- }), false)
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
|
||||
+ }), false).get()
|
||||
);
|
||||
this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.logPath());
|
||||
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
||||
@@ -822,6 +_,7 @@
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
stringbuilder.append("*");
|
||||
+ stringbuilder.append(" Forge");
|
||||
@@ -547,12 +_,12 @@
|
||||
LOGGER.error("Couldn't set icon", e);
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -845,6 +_,8 @@
|
||||
+ // 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();
|
||||
}
|
||||
|
||||
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 @@
|
||||
StringBuilder builder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
builder.append("*");
|
||||
+ builder.append(" Forge");
|
||||
}
|
||||
|
||||
builder.append(" ");
|
||||
@@ -824,6 +_,8 @@
|
||||
}
|
||||
|
||||
private UserApiService createUserApiService(final YggdrasilAuthenticationService authService, final GameConfig config) {
|
||||
private static 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());
|
||||
}
|
||||
|
||||
@@ -857,7 +_,7 @@
|
||||
@@ -840,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(final Throwable t, final Minecraft.@Nullable GameLoadCookie loadCookie) {
|
||||
private void rollbackResourcePacks(final Throwable t, final @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);
|
||||
@@ -1134,12 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
- 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");
|
||||
@@ -1158,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();
|
||||
@@ -1241,6 +_,7 @@
|
||||
@@ -1141,6 +_,7 @@
|
||||
Util.shutdownExecutors();
|
||||
RenderSystem.getSamplerCache().close();
|
||||
RenderSystem.getDevice().close();
|
||||
this.windowSurface.close();
|
||||
RenderSystem.shutdownRenderer();
|
||||
+ net.minecraftforge.fml.config.ConfigTracker.forceUnload();
|
||||
} catch (Throwable throwable) {
|
||||
LOGGER.error("Shutdown failure!", throwable);
|
||||
throw throwable;
|
||||
@@ -1352,7 +_,9 @@
|
||||
profilerfiller.popPush("gpuAsync");
|
||||
RenderSystem.executePendingTasks();
|
||||
profilerfiller.pop();
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
|
||||
this.gameRenderer.render(this.deltaTracker, advanceGameTime);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
|
||||
profilerfiller.push("present");
|
||||
if (!this.gameRenderer.getGameRenderState().windowRenderState.isMinimized) {
|
||||
this.mainRenderTarget.blitToScreen();
|
||||
@@ -1456,6 +_,7 @@
|
||||
this.window.setGuiScale(i);
|
||||
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());
|
||||
} 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);
|
||||
}
|
||||
|
||||
profiler.push("present");
|
||||
@@ -1425,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());
|
||||
}
|
||||
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
@@ -1600,6 +_,7 @@
|
||||
@@ -1576,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -176,132 +144,132 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1629,10 +_,18 @@
|
||||
@@ -1599,10 +_,18 @@
|
||||
if (down && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
|
||||
BlockPos pos = blockHit.getBlockPos();
|
||||
- if (!this.level.getBlockState(pos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(pos)) {
|
||||
+ 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)) {
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
+ this.level.addBreakingBlockEffect(pos, blockHit);
|
||||
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
Direction direction = blockhitresult.getDirection();
|
||||
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||
- this.level.addBreakingBlockEffect(blockpos, direction);
|
||||
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
Direction direction = blockHit.getDirection();
|
||||
- if (this.gameMode.continueDestroyBlock(pos, direction)) {
|
||||
- this.level.addBreakingBlockEffect(pos, direction);
|
||||
+ if (this.gameMode.continueDestroyBlock(pos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(pos, blockHit);
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1675,6 +_,8 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
@@ -1656,6 +_,8 @@
|
||||
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 attackrange = itemstack.get(DataComponents.ATTACK_RANGE);
|
||||
@@ -1685,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1698,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1716,6 +_,12 @@
|
||||
}
|
||||
|
||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(1, this.options.keyUse, interactionhand);
|
||||
+ 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 @@
|
||||
}
|
||||
|
||||
for (InteractionHand hand : InteractionHand.values()) {
|
||||
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(1, this.options.keyUse, hand);
|
||||
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
|
||||
+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
|
||||
+ if (inputEvent.shouldSwingHand()) this.player.swing(hand);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
ItemStack heldItem = this.player.getItemInHand(hand);
|
||||
if (!heldItem.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1734,7 +_,7 @@
|
||||
&& this.gameMode.interact(this.player, entity, entityhitresult, interactionhand) instanceof InteractionResult.Success interactionresult$success2
|
||||
)
|
||||
{
|
||||
- if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
@@ -1712,7 +_,7 @@
|
||||
|
||||
if (this.player.isWithinEntityInteractionRange(entity, 0.0)
|
||||
&& this.gameMode.interact(this.player, entity, entityHit, hand) instanceof InteractionResult.Success success) {
|
||||
- if (success.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(hand);
|
||||
}
|
||||
|
||||
@@ -1746,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
|
||||
- if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1762,6 +_,9 @@
|
||||
@@ -1724,7 +_,7 @@
|
||||
int oldCount = heldItem.getCount();
|
||||
InteractionResult useResult = this.gameMode.useItemOn(this.player, hand, blockHit);
|
||||
if (useResult instanceof InteractionResult.Success success) {
|
||||
- if (success.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(hand);
|
||||
if (!heldItem.isEmpty() && (heldItem.getCount() != oldCount || this.player.hasInfiniteMaterials())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(hand);
|
||||
@@ -1740,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRightClickEmpty(this.player, interactionhand);
|
||||
+ if (heldItem.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRightClickEmpty(this.player, hand);
|
||||
+
|
||||
if (!itemstack.isEmpty()
|
||||
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
|
||||
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
@@ -1791,6 +_,8 @@
|
||||
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 @@
|
||||
}
|
||||
|
||||
ProfilerFiller profilerfiller = Profiler.get();
|
||||
ProfilerFiller profiler = Profiler.get();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||
+
|
||||
profilerfiller.push("gui");
|
||||
this.textInputManager.tick();
|
||||
this.chatListener.tick();
|
||||
@@ -1873,6 +_,7 @@
|
||||
profiler.push("gameMode");
|
||||
if (!this.pause && this.level != null) {
|
||||
this.gameMode.tick();
|
||||
@@ -1817,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
|
||||
try {
|
||||
this.level.tick(() -> true);
|
||||
} catch (Throwable throwable1) {
|
||||
@@ -1886,6 +_,7 @@
|
||||
} catch (Throwable t) {
|
||||
@@ -1830,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport1);
|
||||
throw new ReportedException(report);
|
||||
}
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true);
|
||||
}
|
||||
|
||||
profilerfiller.popPush("animateTick");
|
||||
@@ -1910,6 +_,7 @@
|
||||
profilerfiller.popPush("keyboard");
|
||||
profiler.popPush("animateTick");
|
||||
@@ -1854,6 +_,7 @@
|
||||
profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
profilerfiller.pop();
|
||||
profiler.pop();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -2140,6 +_,7 @@
|
||||
@@ -2059,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(final ClientLevel level) {
|
||||
@@ -309,35 +277,35 @@
|
||||
this.level = level;
|
||||
this.updateLevelInEngines(level);
|
||||
}
|
||||
@@ -2201,6 +_,7 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
@@ -2120,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.clientLevelTeardownInProgress = true;
|
||||
@@ -2208,6 +_,7 @@
|
||||
this.gui.setClientLevelTeardownInProgress(true);
|
||||
@@ -2127,6 +_,7 @@
|
||||
try {
|
||||
if (this.level != null) {
|
||||
this.gui.onDisconnected();
|
||||
this.gui.hud.onDisconnected();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(this.level);
|
||||
}
|
||||
|
||||
this.level = null;
|
||||
@@ -2222,6 +_,7 @@
|
||||
@@ -2141,6 +_,7 @@
|
||||
}
|
||||
|
||||
profilerfiller.pop();
|
||||
profiler.pop();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
|
||||
}
|
||||
|
||||
this.setScreenAndShow(screen);
|
||||
@@ -2374,6 +_,7 @@
|
||||
@@ -2354,6 +_,7 @@
|
||||
|
||||
private void pickBlockOrEntity() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInputPickBlock(this.options.keyPickItem)) return;
|
||||
boolean flag = this.hasControlDown();
|
||||
boolean includeData = this.hasControlDown();
|
||||
switch (this.hitResult) {
|
||||
case BlockHitResult blockhitresult:
|
||||
case BlockHitResult blockHitResult:
|
||||
@@ -1,68 +1,68 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -87,6 +_,7 @@
|
||||
@@ -77,6 +_,7 @@
|
||||
this.activeButton = null;
|
||||
}
|
||||
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(mousebuttoninfo, action)) return;
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
if (!this.mouseGrabbed && flag) {
|
||||
@@ -106,7 +_,7 @@
|
||||
&& i - this.lastClick.time() < 250L
|
||||
+ 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 @@
|
||||
&& currentTime - this.lastClick.time() < 250L
|
||||
&& this.lastClick.screen() == screen
|
||||
&& this.lastClickButton == mousebuttonevent.button();
|
||||
- if (screen.mouseClicked(mousebuttonevent, flag1)) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, mousebuttonevent, flag1)) {
|
||||
this.lastClick = new MouseHandler.LastClick(i, screen);
|
||||
this.lastClickButton = mousebuttoninfo.button();
|
||||
&& this.lastClickButton == event.button();
|
||||
- if (screen.mouseClicked(event, doubleClick)) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, xm, ym, event, doubleClick)) {
|
||||
this.lastClick = new MouseHandler.LastClick(currentTime, screen);
|
||||
this.lastClickButton = buttonInfo.button();
|
||||
return;
|
||||
@@ -121,7 +_,7 @@
|
||||
@@ -116,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
- if (screen.mouseReleased(mousebuttonevent)) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, d0, d1, mousebuttonevent)) {
|
||||
- if (screen.mouseReleased(event)) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, xm, ym, event)) {
|
||||
return;
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
@@ -151,6 +_,7 @@
|
||||
KeyMapping.click(inputconstants$key);
|
||||
} catch (Throwable t) {
|
||||
@@ -146,6 +_,7 @@
|
||||
KeyMapping.click(mouseKey);
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(mousebuttoninfo, action);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(buttonInfo, action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.getScaledXPos(this.minecraft.getWindow());
|
||||
double d4 = this.getScaledYPos(this.minecraft.getWindow());
|
||||
- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
|
||||
+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
@@ -197,7 +_,9 @@
|
||||
if (this.minecraft.gui.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();
|
||||
} else if (this.minecraft.player != null) {
|
||||
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
|
||||
@@ -211,6 +_,7 @@
|
||||
Vector2i wheelXY = this.scrollWheelHandler.onMouseScroll(scaledXOffset, scaledYOffset);
|
||||
@@ -206,6 +_,7 @@
|
||||
}
|
||||
|
||||
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
|
||||
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.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
|
||||
@@ -315,7 +_,7 @@
|
||||
double d5 = getScaledYPos(window, this.accumulatedDY);
|
||||
if (this.minecraft.gui.hud.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.hud.getSpectatorGui().onMouseScrolled(-wheel);
|
||||
@@ -312,7 +_,7 @@
|
||||
double dy = getScaledYPos(window, this.accumulatedDY);
|
||||
|
||||
try {
|
||||
- screen.mouseDragged(new MouseButtonEvent(d2, d3, this.activeButton), d4, d5);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(d2, d3, this.activeButton), d4, d5);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
|
||||
screen.fillCrashDetails(crashreport1);
|
||||
@@ -400,6 +_,14 @@
|
||||
- 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");
|
||||
screen.fillCrashDetails(report);
|
||||
@@ -397,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -921,6 +_,7 @@
|
||||
@@ -986,6 +_,7 @@
|
||||
);
|
||||
public boolean syncWrites;
|
||||
public boolean startedCleanly = true;
|
||||
@@ -8,15 +8,15 @@
|
||||
|
||||
public static boolean isSoundDeviceDefault(final String deviceName) {
|
||||
return deviceName.equals("");
|
||||
@@ -1396,6 +_,7 @@
|
||||
@@ -1474,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(final Minecraft minecraft, final File workingDirectory) {
|
||||
+ setForgeKeybindProperties();
|
||||
this.minecraft = minecraft;
|
||||
this.optionsFile = new File(workingDirectory, "options.txt");
|
||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1548,15 +_,28 @@
|
||||
boolean largeDistances = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1624,15 +_,28 @@
|
||||
this.startedCleanly = access.process("startedCleanly", this.startedCleanly);
|
||||
access.process("musicToast", this.musicToast);
|
||||
access.process("musicFrequency", this.musicFrequency);
|
||||
@@ -26,27 +26,27 @@
|
||||
|
||||
+ // FORGE: split off to allow reloading keys after mod loading is done
|
||||
+ private void processOptionsKeysOnly(Options.FieldAccess access) {
|
||||
for (KeyMapping keymapping : this.keyMappings) {
|
||||
- String s = keymapping.saveString();
|
||||
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||
String s1 = access.process("key_" + keymapping.getName(), s);
|
||||
if (!s.equals(s1)) {
|
||||
keymapping.setKey(InputConstants.getKey(s1));
|
||||
+ if (s1.indexOf(':') != -1) {
|
||||
+ String[] pts = s1.split(":");
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0]));
|
||||
for (KeyMapping keyMapping : this.keyMappings) {
|
||||
- String currentValue = keyMapping.saveString();
|
||||
+ String currentValue = keyMapping.saveString() + (keyMapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keyMapping.getKeyModifier() : "");
|
||||
String newValue = access.process("key_" + keyMapping.getName(), currentValue);
|
||||
if (!currentValue.equals(newValue)) {
|
||||
keyMapping.setKey(InputConstants.getKey(newValue));
|
||||
+ if (newValue.indexOf(':') != -1) {
|
||||
+ String[] pts = newValue.split(":");
|
||||
+ keyMapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0]));
|
||||
+ } else {
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(s1));
|
||||
+ keyMapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(newValue));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
+ private void processOptionsEnd(Options.FieldAccess access) {
|
||||
for (SoundSource soundsource : SoundSource.values()) {
|
||||
access.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
|
||||
for (SoundSource source : SoundSource.values()) {
|
||||
access.process("soundCategory_" + source.getName(), this.soundSourceVolumes.get(source));
|
||||
}
|
||||
@@ -1571,6 +_,10 @@
|
||||
@@ -1647,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -57,64 +57,60 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1590,7 +_,8 @@
|
||||
@@ -1666,7 +_,8 @@
|
||||
}
|
||||
|
||||
final CompoundTag compoundtag1 = this.dataFix(compoundtag);
|
||||
final CompoundTag options = this.dataFix(rawOptions);
|
||||
- this.processOptions(
|
||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
|
||||
+ processor.accept(
|
||||
new Options.FieldAccess() {
|
||||
{
|
||||
Objects.requireNonNull(Options.this);
|
||||
@@ -1672,6 +_,17 @@
|
||||
private @Nullable String getValue(final String name) {
|
||||
Tag tag = options.get(name);
|
||||
@@ -1748,6 +_,17 @@
|
||||
);
|
||||
compoundtag1.getString("fullscreenResolution").ifPresent(fullscreenResolution -> this.fullscreenVideoModeString = fullscreenResolution);
|
||||
options.getString("fullscreenResolution").ifPresent(fullscreenResolution -> this.fullscreenVideoModeString = fullscreenResolution);
|
||||
KeyMapping.resetMapping();
|
||||
+
|
||||
+ if (limited) {
|
||||
+ this.unknownKeys.clear();
|
||||
+ } else {
|
||||
+ var knownKeys = Arrays.stream(this.keyMappings).map(k -> "key_" + k.getName()).collect(Collectors.toSet());
|
||||
+ for (var entry : compoundtag1.entrySet()) {
|
||||
+ for (var entry : options.entrySet()) {
|
||||
+ if (entry.getKey().startsWith("key_") && entry.getValue().asString().isPresent() && !knownKeys.contains(entry.getKey()))
|
||||
+ this.unknownKeys.put(entry.getKey(), entry.getValue().asString().get());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to load options", (Throwable)exception);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to load options", e);
|
||||
}
|
||||
@@ -1699,6 +_,7 @@
|
||||
@@ -1778,9 +_,11 @@
|
||||
public void save() {
|
||||
try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
|
||||
printwriter.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version());
|
||||
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() {
|
||||
{
|
||||
@@ -1706,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void writePrefix(final String name) {
|
||||
+ seen.add(name);
|
||||
printwriter.print(name);
|
||||
printwriter.print(':');
|
||||
writer.print(name);
|
||||
writer.print(':');
|
||||
}
|
||||
@@ -1761,6 +_,12 @@
|
||||
if (s != null) {
|
||||
printwriter.println("fullscreenResolution:" + s);
|
||||
@@ -1836,6 +_,12 @@
|
||||
if (fullscreenVideoModeString != null) {
|
||||
writer.println("fullscreenResolution:" + fullscreenVideoModeString);
|
||||
}
|
||||
+ // Forge add any unknown keys so that Mods can add keybindings between vanilla loading/saving its config.
|
||||
+ for (var entry : this.unknownKeys.entrySet()) {
|
||||
+ if (!seen.contains(entry.getKey()))
|
||||
+ printwriter.println(entry.getKey() + ":" + entry.getValue());
|
||||
+ writer.println(entry.getKey() + ":" + entry.getValue());
|
||||
+ }
|
||||
+
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to save options", (Throwable)exception);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to save options", e);
|
||||
}
|
||||
@@ -1798,6 +_,7 @@
|
||||
@@ -1873,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -122,7 +118,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
||||
}
|
||||
@@ -1915,6 +_,23 @@
|
||||
@@ -1986,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(final Component caption, final int value) {
|
||||
return genericValueLabel(caption, Component.literal(Integer.toString(value)));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/Screenshot.java
|
||||
+++ b/net/minecraft/client/Screenshot.java
|
||||
@@ -45,6 +_,13 @@
|
||||
file2 = new File(file1, forceName);
|
||||
@@ -53,14 +_,24 @@
|
||||
file = new File(picDir, forceName);
|
||||
}
|
||||
|
||||
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(image, file2);
|
||||
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(image, file);
|
||||
+ if (net.minecraftforge.client.event.ScreenshotEvent.BUS.post(event)) {
|
||||
+ callback.accept(event.getCancelMessage());
|
||||
+ return;
|
||||
@@ -14,19 +14,17 @@
|
||||
Util.ioPool()
|
||||
.execute(
|
||||
() -> {
|
||||
@@ -52,10 +_,13 @@
|
||||
NativeImage nativeimage = image;
|
||||
|
||||
try {
|
||||
- image.writeToFile(file2);
|
||||
- Component component = Component.literal(file2.getName())
|
||||
+ image.writeToFile(outputFile);
|
||||
+ Component component = Component.literal(outputFile.getName())
|
||||
.withStyle(ChatFormatting.UNDERLINE)
|
||||
.withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(file2.getAbsoluteFile())));
|
||||
+ if (event.getResultMessage() != null)
|
||||
+ callback.accept(event.getResultMessage());
|
||||
+ else
|
||||
callback.accept(Component.translatable("screenshot.success", component));
|
||||
} catch (Throwable throwable1) {
|
||||
if (image != null) {
|
||||
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);
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/color/block/BlockColors.java
|
||||
+++ b/net/minecraft/client/color/block/BlockColors.java
|
||||
@@ -45,6 +_,7 @@
|
||||
blockcolors.register(List.of(BlockTintSources.constant(-2046180)), Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM);
|
||||
blockcolors.register(List.of(BlockTintSources.stem()), Blocks.MELON_STEM, Blocks.PUMPKIN_STEM);
|
||||
blockcolors.register(List.of(BlockTintSources.constant(-9321636, -14647248)), Blocks.LILY_PAD);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
|
||||
return blockcolors;
|
||||
colors.register(List.of(BlockTintSources.constant(-2046180)), Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM);
|
||||
colors.register(List.of(BlockTintSources.stem()), Blocks.MELON_STEM, Blocks.PUMPKIN_STEM);
|
||||
colors.register(List.of(BlockTintSources.constant(-9321636, -14647248)), Blocks.LILY_PAD);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(colors);
|
||||
return colors;
|
||||
}
|
||||
|
||||
@@ -57,6 +_,8 @@
|
||||
return layer >= list.size() ? null : list.get(layer);
|
||||
return layer >= layers.size() ? null : layers.get(layer);
|
||||
}
|
||||
|
||||
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
--- a/net/minecraft/client/data/Main.java
|
||||
+++ b/net/minecraft/client/data/Main.java
|
||||
@@ -28,13 +_,18 @@
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("client", "Include client generators");
|
||||
OptionSpec<Void> optionspec2 = optionparser.accepts("all", "Include all generators");
|
||||
OptionSpec<String> optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
|
||||
+ OptionSpec<String> inputSpec = optionparser.accepts("input", "Input folder").withRequiredArg();
|
||||
+ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(optionparser, true);
|
||||
OptionSet optionset = optionparser.parse(args);
|
||||
- if (!optionset.has(optionspec) && optionset.hasOptions()) {
|
||||
+ if (!optionset.has(optionspec) && optionset.hasOptions() && loader.hasArgs(optionset)) {
|
||||
+ var input = optionset.valuesOf(inputSpec).stream().map(Paths::get).toList();
|
||||
Path path = Paths.get(optionspec3.value(optionset));
|
||||
boolean flag = optionset.has(optionspec2);
|
||||
boolean flag1 = flag || optionset.has(optionspec1);
|
||||
OptionSpec<Void> clientOption = parser.accepts("client", "Include client generators");
|
||||
OptionSpec<Void> allOption = parser.accepts("all", "Include all generators");
|
||||
OptionSpec<String> outputOption = parser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
|
||||
+ OptionSpec<String> inputSpec = parser.accepts("input", "Input folder").withRequiredArg();
|
||||
+ var loader = net.minecraftforge.data.loading.DatagenModLoader.setup(parser, true);
|
||||
OptionSet optionSet = parser.parse(args);
|
||||
- if (!optionSet.has(helpOption) && optionSet.hasOptions()) {
|
||||
+ if (!optionSet.has(helpOption) && optionSet.hasOptions() && loader.hasArgs(optionSet)) {
|
||||
+ var input = optionSet.valuesOf(inputSpec).stream().map(Paths::get).toList();
|
||||
Path output = Paths.get(outputOption.value(optionSet));
|
||||
boolean allOptions = optionSet.has(allOption);
|
||||
boolean client = allOptions || optionSet.has(clientOption);
|
||||
Bootstrap.bootStrap();
|
||||
ClientBootstrap.bootstrap();
|
||||
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag))
|
||||
+ if (!loader.run(optionSet, output, input, allOptions, client, allOptions, allOptions))
|
||||
+ return;
|
||||
DataGenerator datagenerator = new DataGenerator.Cached(path, SharedConstants.getCurrentVersion(), true);
|
||||
addClientProviders(datagenerator, flag1);
|
||||
datagenerator.run();
|
||||
DataGenerator generator = new DataGenerator.Cached(output, SharedConstants.getCurrentVersion(), true);
|
||||
addClientProviders(generator, client);
|
||||
generator.run();
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
@@ -922,6 +_,9 @@
|
||||
@@ -868,6 +_,9 @@
|
||||
this.declareCustomModelItem(Items.COD);
|
||||
this.declareCustomModelItem(Items.FEATHER);
|
||||
this.declareCustomModelItem(Items.LEAD);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
--- a/net/minecraft/client/data/models/ModelProvider.java
|
||||
+++ b/net/minecraft/client/data/models/ModelProvider.java
|
||||
@@ -44,11 +_,11 @@
|
||||
@@ -43,11 +_,11 @@
|
||||
|
||||
@Override
|
||||
public CompletableFuture<?> run(final CachedOutput cache) {
|
||||
- ModelProvider.ItemInfoCollector modelprovider$iteminfocollector = new ModelProvider.ItemInfoCollector();
|
||||
- ModelProvider.BlockStateGeneratorCollector modelprovider$blockstategeneratorcollector = new ModelProvider.BlockStateGeneratorCollector();
|
||||
+ ModelProvider.ItemInfoCollector modelprovider$iteminfocollector = new ModelProvider.ItemInfoCollector(this::getKnownItems);
|
||||
+ ModelProvider.BlockStateGeneratorCollector modelprovider$blockstategeneratorcollector = new ModelProvider.BlockStateGeneratorCollector(this::getKnownBlocks);
|
||||
ModelProvider.SimpleModelCollector modelprovider$simplemodelcollector = new ModelProvider.SimpleModelCollector();
|
||||
- new BlockModelGenerators(modelprovider$blockstategeneratorcollector, modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run();
|
||||
- new ItemModelGenerators(modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run();
|
||||
+ getBlockModelGenerators(modelprovider$blockstategeneratorcollector, modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run();
|
||||
+ getItemModelGenerators(modelprovider$iteminfocollector, modelprovider$simplemodelcollector).run();
|
||||
modelprovider$blockstategeneratorcollector.validate();
|
||||
modelprovider$iteminfocollector.finalizeAndValidate();
|
||||
- ModelProvider.ItemInfoCollector itemModels = new ModelProvider.ItemInfoCollector();
|
||||
- ModelProvider.BlockStateGeneratorCollector blockStateGenerators = new ModelProvider.BlockStateGeneratorCollector();
|
||||
+ ModelProvider.ItemInfoCollector itemModels = new ModelProvider.ItemInfoCollector(this::getKnownItems);
|
||||
+ ModelProvider.BlockStateGeneratorCollector blockStateGenerators = new ModelProvider.BlockStateGeneratorCollector(this::getKnownBlocks);
|
||||
ModelProvider.SimpleModelCollector simpleModels = new ModelProvider.SimpleModelCollector();
|
||||
- new BlockModelGenerators(blockStateGenerators, itemModels, simpleModels).run();
|
||||
- new ItemModelGenerators(itemModels, simpleModels).run();
|
||||
+ getBlockModelGenerators(blockStateGenerators, itemModels, simpleModels).run();
|
||||
+ getItemModelGenerators(itemModels, simpleModels).run();
|
||||
blockStateGenerators.validate();
|
||||
itemModels.finalizeAndValidate();
|
||||
return CompletableFuture.allOf(
|
||||
@@ -58,6 +_,22 @@
|
||||
@@ -57,6 +_,22 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
@Override
|
||||
public final String getName() {
|
||||
return "Model Definitions";
|
||||
@@ -66,6 +_,15 @@
|
||||
@@ -65,6 +_,15 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class BlockStateGeneratorCollector implements Consumer<BlockModelDefinitionGenerator> {
|
||||
private final Map<Block, BlockModelDefinitionGenerator> generators = new HashMap<>();
|
||||
@@ -55,17 +55,17 @@
|
||||
|
||||
public void accept(final BlockModelDefinitionGenerator generator) {
|
||||
Block block = generator.block();
|
||||
@@ -76,8 +_,7 @@
|
||||
@@ -75,8 +_,7 @@
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
- List<Identifier> list = BuiltInRegistries.BLOCK
|
||||
- List<Identifier> missingDefinitions = BuiltInRegistries.BLOCK
|
||||
- .listElements()
|
||||
+ List<Identifier> list = known.get().map(Block::builtInRegistryHolder)
|
||||
+ List<Identifier> missingDefinitions = known.get().map(Block::builtInRegistryHolder)
|
||||
.filter(e -> !this.generators.containsKey(e.value()))
|
||||
.map(e -> e.key().identifier())
|
||||
.toList();
|
||||
@@ -97,6 +_,15 @@
|
||||
@@ -96,6 +_,15 @@
|
||||
public static class ItemInfoCollector implements ItemModelOutput {
|
||||
private final Map<Item, ClientItem> itemInfos = new HashMap<>();
|
||||
private final Map<Item, Item> copies = new HashMap<>();
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
@Override
|
||||
public void accept(final Item item, final ItemModel.Unbaked model, final ClientItem.Properties properties) {
|
||||
@@ -115,7 +_,7 @@
|
||||
@@ -114,7 +_,7 @@
|
||||
this.copies.put(acceptor, donor);
|
||||
}
|
||||
|
||||
@@ -89,23 +89,23 @@
|
||||
+ public void generateDefaultBlockModels() {
|
||||
BuiltInRegistries.ITEM.forEach(item -> {
|
||||
if (!this.copies.containsKey(item)) {
|
||||
if (item instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) {
|
||||
@@ -124,6 +_,8 @@
|
||||
if (item instanceof BlockItem blockItem && !this.itemInfos.containsKey(blockItem)) {
|
||||
@@ -123,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
+ }
|
||||
+ public void finalizeAndValidate() {
|
||||
this.copies.forEach((acceptor, donor) -> {
|
||||
ClientItem clientitem = this.itemInfos.get(donor);
|
||||
if (clientitem == null) {
|
||||
@@ -132,8 +_,8 @@
|
||||
this.register(acceptor, clientitem);
|
||||
}
|
||||
ClientItem donorInfo = this.itemInfos.get(donor);
|
||||
if (donorInfo == null) {
|
||||
@@ -131,8 +_,8 @@
|
||||
|
||||
this.register(acceptor, donorInfo);
|
||||
});
|
||||
- List<Identifier> list = BuiltInRegistries.ITEM
|
||||
- List<Identifier> missingDefinitions = BuiltInRegistries.ITEM
|
||||
- .listElements()
|
||||
+ List<Identifier> list = known.get()
|
||||
+ List<Identifier> missingDefinitions = known.get()
|
||||
+ .map(item -> item.builtInRegistryHolder())
|
||||
.filter(e -> !this.itemInfos.containsKey(e.value()))
|
||||
.map(e -> e.key().identifier())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/Font.java
|
||||
+++ b/net/minecraft/client/gui/Font.java
|
||||
@@ -33,7 +_,7 @@
|
||||
@@ -28,7 +_,7 @@
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,103 +1,75 @@
|
||||
--- a/net/minecraft/client/gui/Gui.java
|
||||
+++ b/net/minecraft/client/gui/Gui.java
|
||||
@@ -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);
|
||||
}
|
||||
@@ -64,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public void resetTitleTimes() {
|
||||
@@ -202,6 +_,10 @@
|
||||
@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 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;
|
||||
+ }
|
||||
if (!this.minecraft.options.hideGui) {
|
||||
this.extractCameraOverlays(graphics, deltaTracker);
|
||||
this.extractCrosshair(graphics, deltaTracker);
|
||||
@@ -385,7 +_,7 @@
|
||||
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
|
||||
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
|
||||
graphics.nextStratum();
|
||||
- this.chat.extractRenderState(graphics, this.getFont(), this.tickCount, i, j, ChatComponent.DisplayMode.BACKGROUND, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(graphics, this.chat, window, i, j, this.tickCount, this.getFont());
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int k = graphics.guiWidth();
|
||||
int l = 1;
|
||||
@@ -505,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (renderer.extractGuiIcon(mobeffectinstance, this, graphics, k, l, 0, f)) continue;
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(holder), k + 3, l + 3, 18, 18, ARGB.white(f));
|
||||
}
|
||||
- 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 @@
|
||||
}
|
||||
@@ -605,6 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void extractSelectedItemName(final GuiGraphicsExtractor graphics) {
|
||||
+ renderSelectedItemName(graphics, 0);
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
this.screen = screen;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -465,5 +_,10 @@
|
||||
}
|
||||
)
|
||||
);
|
||||
+ }
|
||||
+
|
||||
+ public void renderSelectedItemName(final GuiGraphicsExtractor graphics, int yShift) {
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
MutableComponent mutablecomponent = Component.empty()
|
||||
.append(this.lastToolHighlight.getHoverName())
|
||||
@@ -613,9 +_,13 @@
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
- int i = this.getFont().width(mutablecomponent);
|
||||
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent);
|
||||
+ 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 i = font.width(highlightTip);
|
||||
int j = (graphics.guiWidth() - i) / 2;
|
||||
- int k = graphics.guiHeight() - 59;
|
||||
+ int k = graphics.guiHeight() - Math.max(yShift, 59);
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -626,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (l > 0) {
|
||||
- graphics.textWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.white(l));
|
||||
+ graphics.textWithBackdrop(font, highlightTip, j, k, i, ARGB.white(l));
|
||||
}
|
||||
}
|
||||
+ @Override
|
||||
+ protected void setScreenInternal(Screen value) {
|
||||
+ this.screen = value;
|
||||
}
|
||||
@@ -1165,7 +_,9 @@
|
||||
this.toolHighlightTimer = 0;
|
||||
} else if (this.lastToolHighlight.isEmpty()
|
||||
|| !itemstack.is(this.lastToolHighlight.getItem())
|
||||
- || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
|
||||
+ || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())
|
||||
+ || !itemstack.getHighlightTip(itemstack.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
|
||||
@@ -88,7 +_,7 @@
|
||||
@@ -85,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;
|
||||
@@ -867,6 +_,7 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(itemStack.getItem()));
|
||||
+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem())));
|
||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(itemStack.getComponents()));
|
||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(itemStack.hasFoil()));
|
||||
throw new ReportedException(crashreport);
|
||||
@@ -893,6 +_,7 @@
|
||||
@@ -912,6 +_,7 @@
|
||||
CrashReport report = CrashReport.forThrowable(t, "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 @@
|
||||
this.itemCooldown(itemStack, x, y);
|
||||
this.itemCount(font, itemStack, x, y, countText);
|
||||
this.pose.popMatrix();
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,16 +_,25 @@
|
||||
@@ -1106,16 +_,25 @@
|
||||
this.setTooltipForNextFrame(this.minecraft.font, formattedCharSequences, DefaultTooltipPositioner.INSTANCE, x, y, false);
|
||||
}
|
||||
|
||||
@@ -51,17 +51,20 @@
|
||||
public void setTooltipForNextFrame(
|
||||
final Font font,
|
||||
final List<Component> texts,
|
||||
@@ -1087,8 +_,7 @@
|
||||
@@ -1124,11 +_,7 @@
|
||||
final int yo,
|
||||
final @Nullable Identifier style
|
||||
) {
|
||||
- List<ClientTooltipComponent> list = texts.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
|
||||
- optionalImage.ifPresent(image -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(image)));
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, texts, optionalImage, xo, guiWidth(), guiHeight(), font);
|
||||
this.setTooltipForNextFrameInternal(font, list, xo, yo, DefaultTooltipPositioner.INSTANCE, style, false);
|
||||
- List<ClientTooltipComponent> components = texts.stream()
|
||||
- .map(Component::getVisualOrderText)
|
||||
- .map(ClientTooltipComponent::create)
|
||||
- .collect(Util.toMutableList());
|
||||
- optionalImage.ifPresent(image -> components.add(components.isEmpty() ? 0 : 1, ClientTooltipComponent.create(image)));
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, texts, optionalImage, xo, guiWidth(), guiHeight(), font);
|
||||
this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, style, false);
|
||||
}
|
||||
|
||||
@@ -1116,7 +_,22 @@
|
||||
@@ -1156,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo) {
|
||||
@@ -85,7 +88,7 @@
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo, final @Nullable Identifier style) {
|
||||
@@ -1167,10 +_,16 @@
|
||||
@@ -1207,10 +_,16 @@
|
||||
) {
|
||||
if (!lines.isEmpty()) {
|
||||
if (this.deferredTooltip == null || replaceExisting) {
|
||||
@@ -103,7 +106,7 @@
|
||||
|
||||
public void tooltip(
|
||||
final Font font,
|
||||
@@ -1178,13 +_,16 @@
|
||||
@@ -1218,13 +_,16 @@
|
||||
final int xo,
|
||||
final int yo,
|
||||
final ClientTooltipPositioner positioner,
|
||||
@@ -113,48 +116,48 @@
|
||||
) {
|
||||
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, xo, yo, guiWidth(), guiHeight(), lines, font, positioner, style);
|
||||
+ if (preEvent == null) return;
|
||||
int i = 0;
|
||||
int j = lines.size() == 1 ? -2 : 0;
|
||||
int textWidth = 0;
|
||||
int tempHeight = lines.size() == 1 ? -2 : 0;
|
||||
|
||||
for (ClientTooltipComponent clienttooltipcomponent : lines) {
|
||||
- int k = clienttooltipcomponent.getWidth(font);
|
||||
+ int k = clienttooltipcomponent.getWidth(preEvent.getFont());
|
||||
if (k > i) {
|
||||
i = k;
|
||||
for (ClientTooltipComponent line : lines) {
|
||||
- int lineWidth = line.getWidth(font);
|
||||
+ int lineWidth = line.getWidth(preEvent.getFont());
|
||||
if (lineWidth > textWidth) {
|
||||
textWidth = lineWidth;
|
||||
}
|
||||
@@ -1194,25 +_,25 @@
|
||||
@@ -1234,25 +_,25 @@
|
||||
|
||||
int l1 = i;
|
||||
int i2 = j;
|
||||
- Vector2ic vector2ic = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), xo, yo, i, j);
|
||||
+ Vector2ic vector2ic = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i, j);
|
||||
int l = vector2ic.x();
|
||||
int i1 = vector2ic.y();
|
||||
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);
|
||||
int x = positionedTooltip.x();
|
||||
int y = positionedTooltip.y();
|
||||
this.pose.pushMatrix();
|
||||
- TooltipRenderUtil.extractTooltipBackground(this, l, i1, i, j, style);
|
||||
+ TooltipRenderUtil.extractTooltipBackground(this, l, i1, i, j, preEvent.getBackground());
|
||||
int j1 = i1;
|
||||
- TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, style);
|
||||
+ TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, preEvent.getBackground());
|
||||
int localY = y;
|
||||
|
||||
for (int k1 = 0; k1 < lines.size(); k1++) {
|
||||
ClientTooltipComponent clienttooltipcomponent1 = lines.get(k1);
|
||||
- clienttooltipcomponent1.extractText(this, font, l, j1);
|
||||
- j1 += clienttooltipcomponent1.getHeight(font) + (k1 == 0 ? 2 : 0);
|
||||
+ clienttooltipcomponent1.extractText(this, preEvent.getFont(), l, j1);
|
||||
+ j1 += clienttooltipcomponent1.getHeight(preEvent.getFont()) + (k1 == 0 ? 2 : 0);
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
ClientTooltipComponent line = lines.get(i);
|
||||
- line.extractText(this, font, x, localY);
|
||||
- localY += line.getHeight(font) + (i == 0 ? 2 : 0);
|
||||
+ line.extractText(this, preEvent.getFont(), x, localY);
|
||||
+ localY += line.getHeight(preEvent.getFont()) + (i == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
j1 = i1;
|
||||
localY = y;
|
||||
|
||||
for (int j2 = 0; j2 < lines.size(); j2++) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = lines.get(j2);
|
||||
- clienttooltipcomponent2.extractImage(font, l, j1, l1, i2, this);
|
||||
- j1 += clienttooltipcomponent2.getHeight(font) + (j2 == 0 ? 2 : 0);
|
||||
+ clienttooltipcomponent2.extractImage(preEvent.getFont(), l, j1, l1, i2, this);
|
||||
+ j1 += clienttooltipcomponent2.getHeight(preEvent.getFont()) + (j2 == 0 ? 2 : 0);
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
ClientTooltipComponent line = lines.get(i);
|
||||
- line.extractImage(font, x, localY, w, h, this);
|
||||
- localY += line.getHeight(font) + (i == 0 ? 2 : 0);
|
||||
+ line.extractImage(preEvent.getFont(), x, localY, w, h, this);
|
||||
+ localY += line.getHeight(preEvent.getFont()) + (i == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
this.pose.popMatrix();
|
||||
@@ -1287,6 +_,14 @@
|
||||
@@ -1326,6 +_,14 @@
|
||||
|
||||
private ActiveTextCollector.Parameters createDefaultTextParameters(final float opacity) {
|
||||
return new ActiveTextCollector.Parameters(new Matrix3x2f(this.pose), opacity, this.scissorStack.peek());
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
--- 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
|
||||
@@ -221,6 +_,23 @@
|
||||
@@ -225,6 +_,23 @@
|
||||
this.focused = focused;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
@@ -68,13 +_,16 @@
|
||||
|
||||
for (LerpingBossEvent lerpingbossevent : this.events.values()) {
|
||||
int k = i / 2 - 91;
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(graphics, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight);
|
||||
+ if (event != null) {
|
||||
this.extractBar(graphics, k, j, lerpingbossevent);
|
||||
Component component = lerpingbossevent.getName();
|
||||
int l = this.minecraft.font.width(component);
|
||||
int i1 = i / 2 - l / 2;
|
||||
int j1 = j - 9;
|
||||
graphics.text(this.minecraft.font, component, i1, j1, -1);
|
||||
- j += 10 + 9;
|
||||
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);
|
||||
Component msg = event.getName();
|
||||
int width = this.minecraft.font.width(msg);
|
||||
int x = screenWidth / 2 - width / 2;
|
||||
int y = yo - 9;
|
||||
graphics.text(this.minecraft.font, msg, x, y, -1);
|
||||
- yOffset += 10 + 9;
|
||||
+ }
|
||||
+ j += event.getIncrement();
|
||||
if (j >= graphics.guiHeight() / 3) {
|
||||
+ yOffset += progressEvent.getIncrement();
|
||||
if (yOffset >= graphics.guiHeight() / 3) {
|
||||
break;
|
||||
}
|
||||
+4
-4
@@ -2,9 +2,9 @@
|
||||
+++ b/net/minecraft/client/gui/components/debug/DebugEntryLookingAtEntity.java
|
||||
@@ -29,6 +_,7 @@
|
||||
if (entity != null) {
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(entity.typeHolder().getRegisteredName());
|
||||
+ entity.getType().builtInRegistryHolder().tags().forEach(t -> list.add("#" + t.location()));
|
||||
result.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
result.add(entity.typeHolder().getRegisteredName());
|
||||
+ entity.getType().builtInRegistryHolder().tags().forEach(t -> result.add("#" + t.location()));
|
||||
}
|
||||
|
||||
displayer.addToGroup(GROUP, list);
|
||||
displayer.addToGroup(GROUP, result);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
@@ -143,6 +_,7 @@
|
||||
@@ -142,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
|
||||
@@ -131,6 +_,7 @@
|
||||
builder.put((Class<? extends PictureInPictureRenderState>)pictureinpicturerenderer.getRenderStateClass(), pictureinpicturerenderer);
|
||||
@@ -110,6 +_,7 @@
|
||||
builder.put((Class<? extends PictureInPictureRenderState>)pictureInPictureRenderer.getRenderStateClass(), pictureInPictureRenderer);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, bufferSource, builder);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, 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
|
||||
@@ -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("");
|
||||
@@ -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("");
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
@@ -114,6 +_,8 @@
|
||||
@@ -109,6 +_,8 @@
|
||||
}
|
||||
|
||||
if (optional.isEmpty()) {
|
||||
if (resolvedAddress.isEmpty()) {
|
||||
+ ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", hostAndPort.getHost());
|
||||
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
|
||||
minecraft.execute(
|
||||
() -> minecraft.setScreen(
|
||||
new DisconnectedScreen(ConnectScreen.this.parent, ConnectScreen.this.connectFailedTitle, ConnectScreen.UNKNOWN_HOST_MESSAGE)
|
||||
() -> minecraft.gui
|
||||
.setScreen(
|
||||
@@ -8,24 +8,24 @@
|
||||
+
|
||||
@Override
|
||||
public void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
|
||||
int i = graphics.guiWidth();
|
||||
int width = graphics.guiWidth();
|
||||
@@ -103,6 +_,7 @@
|
||||
f2 = 1.0F;
|
||||
logoAlpha = 1.0F;
|
||||
}
|
||||
|
||||
+ if (extractContentRenderState(graphics, f2)) {
|
||||
int k2 = (int)(graphics.guiWidth() * 0.5);
|
||||
int i1 = (int)(graphics.guiHeight() * 0.5);
|
||||
double d0 = Math.min(graphics.guiWidth() * 0.75, (double)graphics.guiHeight()) * 0.25;
|
||||
@@ -118,6 +_,7 @@
|
||||
if (f < 1.0F) {
|
||||
this.extractProgressBar(graphics, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
||||
+ 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;
|
||||
@@ -148,6 +_,7 @@
|
||||
graphics, width / 2 - logoWidthHalf, barY - 5, width / 2 + logoWidthHalf, barY + 5, 1.0F - Mth.clamp(fadeOutAnim, 0.0F, 1.0F)
|
||||
);
|
||||
}
|
||||
+ }
|
||||
|
||||
if (f >= 2.0F) {
|
||||
this.minecraft.setOverlay(null);
|
||||
@@ -127,6 +_,7 @@
|
||||
if (fadeOutAnim >= 2.0F) {
|
||||
this.minecraft.gui.setOverlay(null);
|
||||
@@ -157,6 +_,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.fadeOutStart == -1L && this.reload.isDone() && this.isReadyToFadeOut()) {
|
||||
@@ -33,11 +33,11 @@
|
||||
try {
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
@@ -134,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(throwable));
|
||||
@@ -164,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(t));
|
||||
}
|
||||
|
||||
- this.fadeOutStart = Util.getMillis();
|
||||
if (this.minecraft.screen != null) {
|
||||
if (this.minecraft.gui.screen() != null) {
|
||||
Window window = this.minecraft.getWindow();
|
||||
this.minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
||||
this.minecraft.gui.screen().init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
||||
@@ -8,13 +8,13 @@
|
||||
+ }
|
||||
+
|
||||
+ public static <T extends AbstractContainerMenu> java.util.Optional<ScreenConstructor<T, ?>> getScreenFactory(@Nullable MenuType<T> type, Minecraft minecraft, int containerId, Component title) {
|
||||
MenuScreens.ScreenConstructor<T, ?> screenconstructor = getConstructor(type);
|
||||
if (screenconstructor == null) {
|
||||
MenuScreens.ScreenConstructor<T, ?> constructor = getConstructor(type);
|
||||
if (constructor == null) {
|
||||
LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(type));
|
||||
+ return java.util.Optional.empty();
|
||||
} else {
|
||||
- screenconstructor.fromPacket(title, type, minecraft, containerId);
|
||||
+ return java.util.Optional.of(screenconstructor);
|
||||
- constructor.fromPacket(title, type, minecraft, containerId);
|
||||
+ return java.util.Optional.of(constructor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -104,6 +_,7 @@
|
||||
} else {
|
||||
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
||||
@@ -165,6 +_,7 @@
|
||||
Button.builder(OPTIONS, var1x -> this.minecraft.gui.setScreen(new OptionsScreen(this, this.minecraft.options, true))).width(204).build(), 2
|
||||
);
|
||||
}
|
||||
+ gridlayout$rowhelper.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);
|
||||
+ 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);
|
||||
|
||||
this.disconnectButton = gridlayout$rowhelper.addChild(
|
||||
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
|
||||
@@ -194,7 +_,7 @@
|
||||
@@ -196,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
- this.minecraft.setScreen(null);
|
||||
+ this.minecraft.popGuiLayer();
|
||||
- this.minecraft.gui.setScreen(null);
|
||||
+ this.minecraft.gui.popLayer();
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(final T widget) {
|
||||
@@ -326,8 +_,10 @@
|
||||
@@ -327,8 +_,10 @@
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
if (!this.initialized) {
|
||||
@@ -20,7 +20,7 @@
|
||||
} else {
|
||||
this.repositionElements();
|
||||
}
|
||||
@@ -344,8 +_,10 @@
|
||||
@@ -345,8 +_,10 @@
|
||||
protected void rebuildWidgets() {
|
||||
this.clearWidgets();
|
||||
this.clearFocus();
|
||||
@@ -31,16 +31,16 @@
|
||||
}
|
||||
|
||||
protected void fadeWidgets(final float widgetFade) {
|
||||
@@ -385,6 +_,8 @@
|
||||
@@ -386,6 +_,8 @@
|
||||
this.extractMenuBackground(graphics);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, graphics);
|
||||
+
|
||||
this.minecraft.gui.extractDeferredSubtitles();
|
||||
this.minecraft.gui.hud.extractDeferredSubtitles();
|
||||
}
|
||||
|
||||
@@ -474,6 +_,19 @@
|
||||
@@ -471,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
|
||||
@@ -53,6 +_,7 @@
|
||||
@@ -57,6 +_,7 @@
|
||||
private boolean fading;
|
||||
private long fadeInStart;
|
||||
private final LogoRenderer logoRenderer;
|
||||
@@ -8,48 +8,48 @@
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -105,11 +_,15 @@
|
||||
int j = this.width - i - 2;
|
||||
int k = 24;
|
||||
int l = this.height / 4 + 48;
|
||||
@@ -114,11 +_,15 @@
|
||||
int copyrightX = this.width - copyrightWidth - 2;
|
||||
int spacing = 24;
|
||||
int topPos = this.height / 4 + 48;
|
||||
+ Button modButton = null;
|
||||
if (this.minecraft.isDemo()) {
|
||||
l = this.createDemoMenuOptions(l, 24);
|
||||
topPos = this.createDemoMenuOptions(topPos, 24);
|
||||
} else {
|
||||
l = this.createNormalMenuOptions(l, 24);
|
||||
+ 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, l).size(98, 20).build());
|
||||
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());
|
||||
}
|
||||
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
|
||||
|
||||
l = this.createTestWorldButton(l, 24);
|
||||
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
||||
@@ -176,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, i = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = flag;
|
||||
int numberOfButtons = 3;
|
||||
int currentButton = 0;
|
||||
@@ -199,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, var7 = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = multiplayerAllowed;
|
||||
this.addRenderableWidget(
|
||||
Button.builder(Component.translatable("menu.online"), button -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
||||
- .bounds(this.width / 2 - 100, topPos = i + spacing, 200, 20)
|
||||
+ .bounds(this.width / 2 + 2, topPos = i + spacing, 98, 20)
|
||||
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)
|
||||
.tooltip(tooltip)
|
||||
.build()
|
||||
)
|
||||
@@ -304,9 +_,18 @@
|
||||
s = s + I18n.get("menu.modded");
|
||||
@@ -323,9 +_,18 @@
|
||||
versionString = versionString + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
- graphics.text(this.font, s, 2, this.height - 10, ARGB.white(f));
|
||||
+ final float f_f = f;
|
||||
- graphics.text(this.font, versionString, 2, this.height - 10, ARGB.white(widgetFade));
|
||||
+ final float widgetFade_f = widgetFade;
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
|
||||
+ graphics.text(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(f_f, -1))
|
||||
+ graphics.text(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(widgetFade_f, -1))
|
||||
+ );
|
||||
+
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) ->
|
||||
+ graphics.text(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), ARGB.color(f_f, -1))
|
||||
+ graphics.text(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), ARGB.color(widgetFade_f, -1))
|
||||
+ );
|
||||
+
|
||||
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
|
||||
if (this.realmsNotificationsEnabled() && widgetFade >= 1.0F) {
|
||||
this.realmsNotificationsScreen.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
+ if (f >= 1.0f) this.modUpdateNotification.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
+ if (widgetFade >= 1.0f) this.modUpdateNotification.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
@@ -40,6 +_,7 @@
|
||||
private int maxY = Integer.MIN_VALUE;
|
||||
@@ -41,6 +_,7 @@
|
||||
private float fade;
|
||||
private boolean centered;
|
||||
private @Nullable AdvancementWidget hovered;
|
||||
+ private int page;
|
||||
|
||||
public AdvancementTab(
|
||||
final Minecraft minecraft,
|
||||
@@ -61,6 +_,15 @@
|
||||
@@ -62,6 +_,15 @@
|
||||
this.addWidget(this.root, rootNode.holder());
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
public AdvancementTabType getType() {
|
||||
return this.type;
|
||||
}
|
||||
@@ -155,8 +_,8 @@
|
||||
return null;
|
||||
} else {
|
||||
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
|
||||
- if (index < advancementtabtype.getMax()) {
|
||||
- return new AdvancementTab(minecraft, screen, advancementtabtype, index, root, optional.get());
|
||||
+ if ((index % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) {
|
||||
+ return new AdvancementTab(minecraft, screen, advancementtabtype, index % AdvancementTabType.MAX_TABS, index / AdvancementTabType.MAX_TABS, root, optional.get());
|
||||
}
|
||||
@@ -169,8 +_,8 @@
|
||||
}
|
||||
|
||||
index -= advancementtabtype.getMax();
|
||||
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();
|
||||
+21
-21
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
@@ -51,6 +_,7 @@
|
||||
@@ -52,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);
|
||||
@@ -64,6 +_,19 @@
|
||||
@@ -65,6 +_,19 @@
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
@@ -28,33 +28,33 @@
|
||||
this.layout.addTitleHeader(TITLE, this.font);
|
||||
this.tabs.clear();
|
||||
this.selectedTab = null;
|
||||
@@ -106,7 +_,7 @@
|
||||
int j = (this.height - 140) / 2;
|
||||
@@ -119,7 +_,7 @@
|
||||
int yo = (this.height - 140) / 2;
|
||||
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
- if (advancementtab.isMouseOver(i, j, event.x(), event.y())) {
|
||||
+ if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(i, j, event.x(), event.y())) {
|
||||
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
- if (tab.isMouseOver(xo, yo, event.x(), event.y())) {
|
||||
+ if (tab.getPage() == tabPage && tab.isMouseOver(xo, yo, event.x(), event.y())) {
|
||||
this.advancements.setSelectedTab(tab.getRootNode().holder(), true);
|
||||
break;
|
||||
}
|
||||
@@ -197,10 +_,12 @@
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, xo, yo, 0.0F, 0.0F, 252, 140, 256, 256);
|
||||
@@ -208,10 +_,12 @@
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, this.leftPos, this.topPos, 0.0F, 0.0F, 252, 140, 256, 256);
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
+ if (advancementtab.getPage() == tabPage)
|
||||
advancementtab.extractTab(graphics, xo, yo, mouseX, mouseY, advancementtab == this.selectedTab);
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
tab.extractTab(graphics, this.leftPos, this.topPos, mouseX, mouseY, tab == this.selectedTab);
|
||||
}
|
||||
|
||||
for (AdvancementTab advancementtab1 : this.tabs.values()) {
|
||||
+ if (advancementtab1.getPage() == tabPage)
|
||||
advancementtab1.extractIcon(graphics, xo, yo);
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
tab.extractIcon(graphics, this.leftPos, this.topPos);
|
||||
}
|
||||
}
|
||||
@@ -219,6 +_,7 @@
|
||||
@@ -230,6 +_,7 @@
|
||||
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
+ if (advancementtab.getPage() == tabPage)
|
||||
if (advancementtab.isMouseOver(xo, yo, mouseX, mouseY)) {
|
||||
graphics.setTooltipForNextFrame(this.font, advancementtab.getTitle(), mouseX, mouseY);
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
if (tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) {
|
||||
graphics.setTooltipForNextFrame(this.font, tab.getTitle(), mouseX, mouseY);
|
||||
}
|
||||
+78
-83
@@ -1,121 +1,118 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
@@ -111,6 +_,7 @@
|
||||
int i = this.leftPos;
|
||||
int j = this.topPos;
|
||||
@@ -98,6 +_,7 @@
|
||||
int xo = this.leftPos;
|
||||
int yo = this.topPos;
|
||||
super.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, graphics, mouseX, mouseY);
|
||||
graphics.pose().pushMatrix();
|
||||
graphics.pose().translate(i, j);
|
||||
graphics.pose().translate(xo, yo);
|
||||
this.extractLabels(graphics, mouseX, mouseY);
|
||||
@@ -122,6 +_,7 @@
|
||||
if (slot != null && slot != this.hoveredSlot) {
|
||||
this.onStopHovering(slot);
|
||||
@@ -109,6 +_,7 @@
|
||||
if (previouslyHoveredSlot != null && previouslyHoveredSlot != this.hoveredSlot) {
|
||||
this.onStopHovering(previouslyHoveredSlot);
|
||||
}
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, graphics, mouseX, mouseY);
|
||||
|
||||
graphics.pose().popMatrix();
|
||||
}
|
||||
@@ -203,9 +_,9 @@
|
||||
this.font,
|
||||
this.getTooltipFromContainerItem(itemstack),
|
||||
itemstack.getTooltipImage(),
|
||||
+ itemstack,
|
||||
mouseX,
|
||||
- mouseY,
|
||||
- itemstack.get(DataComponents.TOOLTIP_STYLE)
|
||||
+ mouseY
|
||||
@@ -170,7 +_,7 @@
|
||||
ItemStack item = this.hoveredSlot.getItem();
|
||||
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(item)) {
|
||||
graphics.setTooltipForNextFrame(
|
||||
- this.font, this.getTooltipFromContainerItem(item), item.getTooltipImage(), mouseX, mouseY, item.get(DataComponents.TOOLTIP_STYLE)
|
||||
+ this.font, this.getTooltipFromContainerItem(item), item.getTooltipImage(), item, mouseX, mouseY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +_,8 @@
|
||||
@@ -186,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 - (this.draggingItem.isEmpty() ? 0 : 8), itemCount);
|
||||
- graphics.itemDecorations(this.font, carried, x, y, 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 - (this.draggingItem.isEmpty() ? 0 : 8), itemCount);
|
||||
+ graphics.itemDecorations(font == null ? this.font : font, carried, x, y, itemCount);
|
||||
}
|
||||
|
||||
protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) {
|
||||
@@ -319,7 +_,8 @@
|
||||
if (super.mouseClicked(event, doubleClick)) {
|
||||
@@ -285,7 +_,8 @@
|
||||
return true;
|
||||
} else {
|
||||
- boolean flag = this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials();
|
||||
+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button());
|
||||
+ boolean flag = 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;
|
||||
@@ -329,6 +_,7 @@
|
||||
int i = this.leftPos;
|
||||
int j = this.topPos;
|
||||
boolean flag1 = this.hasClickedOutside(event.x(), event.y(), i, j);
|
||||
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
|
||||
int k = -1;
|
||||
if (slot != null) {
|
||||
k = slot.index;
|
||||
@@ -354,7 +_,7 @@
|
||||
}
|
||||
} else if (!this.isQuickCrafting) {
|
||||
if (this.menu.getCarried().isEmpty()) {
|
||||
- if (flag) {
|
||||
+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
||||
this.slotClicked(slot, k, event.button(), ContainerInput.CLONE);
|
||||
} else {
|
||||
boolean flag2 = k != -999 && event.hasShiftDown();
|
||||
@@ -378,7 +_,7 @@
|
||||
this.quickCraftingType = 0;
|
||||
} else if (event.button() == 1) {
|
||||
this.quickCraftingType = 1;
|
||||
- } else if (flag) {
|
||||
+ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
||||
this.quickCraftingType = 2;
|
||||
}
|
||||
}
|
||||
@@ -448,10 +_,13 @@
|
||||
}
|
||||
|
||||
- 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 @@
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(final MouseButtonEvent event) {
|
||||
+ super.mouseReleased(event); //Forge, Call parent to release buttons
|
||||
Slot slot = this.getHoveredSlot(event.x(), event.y());
|
||||
int i = this.leftPos;
|
||||
int j = this.topPos;
|
||||
boolean flag = this.hasClickedOutside(event.x(), event.y(), i, j);
|
||||
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
|
||||
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
|
||||
+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button());
|
||||
int k = -1;
|
||||
int slotId = -1;
|
||||
if (slot != null) {
|
||||
k = slot.index;
|
||||
@@ -468,7 +_,7 @@
|
||||
if (slot1 != null
|
||||
&& slot1.mayPickup(this.minecraft.player)
|
||||
&& slot1.hasItem()
|
||||
- && slot1.container == slot.container
|
||||
+ && slot1.isSameInventory(slot)
|
||||
&& AbstractContainerMenu.canItemQuickReplace(slot1, this.lastQuickMoved, true)) {
|
||||
this.slotClicked(slot1, slot1.index, event.button(), ContainerInput.QUICK_MOVE);
|
||||
slotId = slot.index;
|
||||
@@ -394,7 +_,7 @@
|
||||
if (target != null
|
||||
&& target.mayPickup(this.minecraft.player)
|
||||
&& target.hasItem()
|
||||
- && target.container == slot.container
|
||||
+ && target.isSameInventory(slot)
|
||||
&& AbstractContainerMenu.canItemQuickReplace(target, this.lastQuickMoved, true)) {
|
||||
this.slotClicked(target, target.index, event.button(), ContainerInput.QUICK_MOVE);
|
||||
}
|
||||
@@ -527,7 +_,7 @@
|
||||
} else if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) {
|
||||
@@ -421,7 +_,7 @@
|
||||
if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) {
|
||||
this.quickCraftToSlots();
|
||||
} else if (!this.menu.getCarried().isEmpty()) {
|
||||
- if (this.minecraft.options.keyPickItem.matchesMouse(event)) {
|
||||
+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
||||
this.slotClicked(slot, k, event.button(), ContainerInput.CLONE);
|
||||
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
|
||||
} else {
|
||||
boolean flag1 = k != -999 && event.hasShiftDown();
|
||||
@@ -598,7 +_,7 @@
|
||||
public boolean keyPressed(final KeyEvent event) {
|
||||
if (super.keyPressed(event)) {
|
||||
boolean quickKey = slotId != -999 && event.hasShiftDown();
|
||||
@@ -489,7 +_,7 @@
|
||||
return true;
|
||||
- } else if (this.minecraft.options.keyInventory.matches(event)) {
|
||||
+ } else if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(event))) {
|
||||
}
|
||||
|
||||
- if (this.minecraft.options.keyInventory.matches(event)) {
|
||||
+ if (this.minecraft.options.keyInventory.isActiveAndMatches(com.mojang.blaze3d.platform.InputConstants.getKey(event))) {
|
||||
this.onClose();
|
||||
return true;
|
||||
} else {
|
||||
@@ -696,6 +_,13 @@
|
||||
}
|
||||
@@ -587,4 +_,11 @@
|
||||
|
||||
super.onClose();
|
||||
}
|
||||
@@ -126,6 +123,4 @@
|
||||
+ 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) {
|
||||
}
|
||||
+82
-90
@@ -11,7 +11,7 @@
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(player), player.getInventory(), CommonComponents.EMPTY, 195, 136);
|
||||
@@ -164,7 +_,7 @@
|
||||
private void refreshCurrentTabContents(final Collection<ItemStack> displayList) {
|
||||
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||
int oldRowIndex = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||
this.menu.items.clear();
|
||||
- if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) {
|
||||
+ if (selectedTab.hasSearchBar()) {
|
||||
@@ -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);
|
||||
@@ -377,7 +_,7 @@
|
||||
public boolean charTyped(final CharacterEvent event) {
|
||||
if (this.ignoreTextInput) {
|
||||
@@ -379,7 +_,7 @@
|
||||
return false;
|
||||
- } else if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
|
||||
+ } else if (!selectedTab.hasSearchBar()) {
|
||||
}
|
||||
|
||||
- if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
|
||||
+ if (!selectedTab.hasSearchBar()) {
|
||||
return false;
|
||||
} else {
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -405,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -407,7 +_,7 @@
|
||||
@Override
|
||||
public boolean keyPressed(final KeyEvent event) {
|
||||
this.ignoreTextInput = false;
|
||||
@@ -73,28 +73,28 @@
|
||||
if (this.minecraft.options.keyChat.matches(event)) {
|
||||
this.ignoreTextInput = true;
|
||||
this.selectTab(CreativeModeTabs.searchTab());
|
||||
@@ -441,6 +_,7 @@
|
||||
@@ -443,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void refreshSearchResults() {
|
||||
+ if (!selectedTab.hasSearchBar()) return;
|
||||
this.menu.items.clear();
|
||||
this.visibleTags.clear();
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -453,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = sessionsearchtrees.creativeTagSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(s);
|
||||
String searchTerm = this.searchBox.getValue();
|
||||
@@ -455,10 +_,10 @@
|
||||
SearchTree<ItemStack> tree;
|
||||
if (searchTerm.startsWith("#")) {
|
||||
searchTerm = searchTerm.substring(1);
|
||||
- tree = searchTrees.creativeTagSearch();
|
||||
+ tree = searchTrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(searchTerm);
|
||||
} else {
|
||||
- searchtree = sessionsearchtrees.creativeNameSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
- tree = searchTrees.creativeNameSearch();
|
||||
+ tree = searchTrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
}
|
||||
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -484,7 +_,7 @@
|
||||
this.menu.items.addAll(tree.search(searchTerm.toLowerCase(Locale.ROOT)));
|
||||
@@ -486,7 +_,7 @@
|
||||
@Override
|
||||
protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) {
|
||||
if (selectedTab.showTitle()) {
|
||||
@@ -103,25 +103,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +_,7 @@
|
||||
double d0 = event.x() - this.leftPos;
|
||||
double d1 = event.y() - this.topPos;
|
||||
@@ -496,7 +_,7 @@
|
||||
double xm = event.x() - this.leftPos;
|
||||
double ym = event.y() - this.topPos;
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
- for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab tab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabClicked(tab, xm, ym)) {
|
||||
return true;
|
||||
}
|
||||
@@ -516,7 +_,7 @@
|
||||
double d1 = event.y() - this.topPos;
|
||||
@@ -518,7 +_,7 @@
|
||||
double ym = event.y() - this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
this.selectTab(creativemodetab);
|
||||
- for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab tab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabClicked(tab, xm, ym)) {
|
||||
this.selectTab(tab);
|
||||
return true;
|
||||
@@ -610,13 +_,15 @@
|
||||
@@ -611,13 +_,15 @@
|
||||
this.originalSlots = null;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
this.searchBox.setVisible(true);
|
||||
this.searchBox.setCanLoseFocus(false);
|
||||
this.searchBox.setFocused(true);
|
||||
if (creativemodetab != tab) {
|
||||
if (oldTab != tab) {
|
||||
this.searchBox.setValue("");
|
||||
}
|
||||
+ this.searchBox.setWidth(selectedTab.getSearchBarWidth());
|
||||
@@ -138,11 +138,11 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -679,7 +_,14 @@
|
||||
@@ -682,7 +_,14 @@
|
||||
this.effects.extractRenderState(graphics, mouseX, mouseY);
|
||||
super.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
- for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
+ if (this.pages.size() != 1) {
|
||||
+ Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
|
||||
+ graphics.pose().pushMatrix();
|
||||
@@ -150,83 +150,75 @@
|
||||
+ graphics.pose().popMatrix();
|
||||
+ }
|
||||
+
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabHovering(graphics, creativemodetab, mouseX, mouseY)) {
|
||||
+ for (CreativeModeTab tab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabHovering(graphics, tab, mouseX, mouseY)) {
|
||||
break;
|
||||
}
|
||||
@@ -701,7 +_,7 @@
|
||||
@@ -704,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(final ItemStack itemStack) {
|
||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
- boolean flag2 = selectedTab.getType() == CreativeModeTab.Type.SEARCH;
|
||||
+ boolean flag2 = selectedTab.hasSearchBar();
|
||||
TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
|
||||
List<Component> list = itemStack.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag);
|
||||
@@ -722,7 +_,7 @@
|
||||
int i = 1;
|
||||
boolean isCreativeSlot = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean isSingleCategoryTab = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
- boolean isSearchTab = selectedTab.getType() == CreativeModeTab.Type.SEARCH;
|
||||
+ boolean isSearchTab = selectedTab.hasSearchBar();
|
||||
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;
|
||||
|
||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
- if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(itemStack)) {
|
||||
+ if (!creativemodetab.hasSearchBar() && creativemodetab.contains(itemStack)) {
|
||||
list1.add(i++, creativemodetab.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));
|
||||
}
|
||||
@@ -735,7 +_,7 @@
|
||||
}
|
||||
@@ -740,7 +_,7 @@
|
||||
public void extractBackground(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
|
||||
super.extractBackground(graphics, mouseX, mouseY, a);
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (creativemodetab != selectedTab) {
|
||||
this.extractTabButton(graphics, mouseX, mouseY, creativemodetab);
|
||||
- for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab tab : currentPage.getVisibleTabs()) {
|
||||
if (tab != selectedTab) {
|
||||
this.extractTabButton(graphics, mouseX, mouseY, tab);
|
||||
}
|
||||
@@ -770,6 +_,7 @@
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, identifier, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
||||
@@ -775,6 +_,7 @@
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprite, xscr, yscr + (int)((yscr2 - yscr - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
|
||||
this.extractTabButton(graphics, mouseX, mouseY, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.extractEntityInInventoryFollowsMouse(
|
||||
@@ -779,7 +_,7 @@
|
||||
@@ -784,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(final CreativeModeTab tab) {
|
||||
- int i = tab.column();
|
||||
+ int i = currentPage.getColumn(tab);
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
- int pos = tab.column();
|
||||
+ int pos = currentPage.getColumn(tab);
|
||||
int spacing = 27;
|
||||
int x = 27 * pos;
|
||||
if (tab.isAlignedRight()) {
|
||||
@@ -791,7 +_,7 @@
|
||||
@@ -796,7 +_,7 @@
|
||||
|
||||
private int getTabY(final CreativeModeTab tab) {
|
||||
int i = 0;
|
||||
int y = 0;
|
||||
- if (tab.row() == CreativeModeTab.Row.TOP) {
|
||||
+ if (currentPage.isTop(tab)) {
|
||||
i -= 32;
|
||||
y -= 32;
|
||||
} else {
|
||||
i += this.imageHeight;
|
||||
@@ -819,8 +_,8 @@
|
||||
y += this.imageHeight;
|
||||
@@ -824,8 +_,8 @@
|
||||
|
||||
protected void extractTabButton(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final CreativeModeTab tab) {
|
||||
boolean flag = tab == selectedTab;
|
||||
- boolean flag1 = tab.row() == CreativeModeTab.Row.TOP;
|
||||
- int i = tab.column();
|
||||
+ boolean flag1 = currentPage.isTop(tab);
|
||||
+ int i = currentPage.getColumn(tab);
|
||||
int j = this.leftPos + this.getTabX(tab);
|
||||
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
|
||||
Identifier[] aidentifier;
|
||||
@@ -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, aidentifier[Mth.clamp(i, 0, aidentifier.length)], j, k, 26, 32);
|
||||
int l = j + 13 - 8;
|
||||
int i1 = k + 16 - 8 + (flag1 ? 1 : -1);
|
||||
@@ -870,6 +_,14 @@
|
||||
boolean selected = tab == selectedTab;
|
||||
- boolean isTop = tab.row() == CreativeModeTab.Row.TOP;
|
||||
- int pos = tab.column();
|
||||
+ boolean isTop = currentPage.isTop(tab);
|
||||
+ int pos = currentPage.getColumn(tab);
|
||||
int x = this.leftPos + this.getTabX(tab);
|
||||
int y = this.topPos - (isTop ? 28 : -(this.imageHeight - 4));
|
||||
Identifier[] sprites;
|
||||
@@ -875,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +233,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(final Container container, final int slot, final int x, final int y) {
|
||||
@@ -1050,6 +_,22 @@
|
||||
@@ -1055,6 +_,22 @@
|
||||
@Override
|
||||
public boolean mayPickup(final Player player) {
|
||||
return this.target.mayPickup(player);
|
||||
|
||||
+21
-21
@@ -1,39 +1,39 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||
@@ -47,12 +_,16 @@
|
||||
int j = this.screen.width - i;
|
||||
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
|
||||
if (!collection.isEmpty() && j >= 32) {
|
||||
- int k = j >= 120 ? j - 7 : 32;
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, j < 120, i);
|
||||
int availableWidth = this.screen.width - xo;
|
||||
Collection<MobEffectInstance> activeEffects = this.minecraft.player.getActiveEffects();
|
||||
if (!activeEffects.isEmpty() && availableWidth >= 32) {
|
||||
- int maxWidth = availableWidth >= 120 ? availableWidth - 7 : 32;
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, availableWidth, availableWidth < 120, xo);
|
||||
+ if (event == null) return;
|
||||
+ int k = !event.isCompact() ? j - 7 : 32;
|
||||
+ i = event.getHorizontalOffset();
|
||||
int l = 33;
|
||||
if (collection.size() > 5) {
|
||||
l = 132 / (collection.size() - 1);
|
||||
+ int maxWidth = !event.isCompact() ? availableWidth - 7 : 32;
|
||||
+ xo = event.getHorizontalOffset();
|
||||
int yStep = 33;
|
||||
if (activeEffects.size() > 5) {
|
||||
yStep = 132 / (activeEffects.size() - 1);
|
||||
}
|
||||
|
||||
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList();
|
||||
this.extractEffects(graphics, collection, i, l, mouseX, mouseY, k);
|
||||
+ Iterable<MobEffectInstance> iterable = activeEffects.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList();
|
||||
this.extractEffects(graphics, activeEffects, xo, yStep, mouseX, mouseY, maxWidth);
|
||||
}
|
||||
}
|
||||
@@ -72,6 +_,11 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : iterable) {
|
||||
boolean flag = mobeffectinstance.isAmbient();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||
+ if (renderer.extractInventory(mobeffectinstance, this, graphics, x0, i, 0)) {
|
||||
+ i += yStep;
|
||||
for (MobEffectInstance effect : sortedEffects) {
|
||||
boolean isAmbient = effect.isAmbient();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(effect);
|
||||
+ if (renderer.extractInventory(effect, this, graphics, x0, y0, 0)) {
|
||||
+ y0 += yStep;
|
||||
+ continue;
|
||||
+ }
|
||||
Component component = this.getEffectName(mobeffectinstance);
|
||||
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
|
||||
int j = this.extractBackground(graphics, font, component, component1, x0, i, flag, maxWidth);
|
||||
Component effectText = this.getEffectName(effect);
|
||||
Component duration = MobEffectUtil.formatDuration(effect, 1.0F, this.minecraft.level.tickRateManager().tickrate());
|
||||
int textureWidth = this.extractBackground(graphics, font, effectText, duration, x0, y0, isAmbient, maxWidth);
|
||||
@@ -136,5 +_,9 @@
|
||||
}
|
||||
|
||||
return mutablecomponent;
|
||||
return name;
|
||||
+ }
|
||||
+
|
||||
+ public AbstractContainerScreen<?> getScreen() {
|
||||
|
||||
+27
-26
@@ -1,32 +1,33 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
@@ -111,7 +_,7 @@
|
||||
int l1 = 86 - this.font.width(s);
|
||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||
int i2 = -9937334;
|
||||
- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) {
|
||||
+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||
graphics.textWithWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, ARGB.opaque((i2 & 16711422) >> 1), false);
|
||||
@@ -162,13 +_,16 @@
|
||||
int textWidth = 86 - this.font.width(costText);
|
||||
FormattedText message = EnchantmentNames.getInstance().getRandomName(this.font, textWidth);
|
||||
int col = -9937334;
|
||||
- if ((goldCount < i + 1 || this.minecraft.player.experienceLevel < cost) && !this.minecraft.player.hasInfiniteMaterials()) {
|
||||
+ if (((goldCount < i + 1 || this.minecraft.player.experienceLevel < cost) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[i] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, leftPos, yo + 14 + 19 * i, 108, 19);
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[i], leftPos + 1, yo + 15 + 19 * i, 16, 16);
|
||||
graphics.textWithWordWrap(this.font, message, leftPosText, yo + 16 + 19 * i, textWidth, ARGB.opaque((col & 16711422) >> 1), false);
|
||||
@@ -162,14 +_,18 @@
|
||||
.registryAccess()
|
||||
.lookupOrThrow(Registries.ENCHANTMENT)
|
||||
.get(this.menu.enchantClue[j]);
|
||||
- if (!optional.isEmpty()) {
|
||||
.get(this.menu.enchantClue[i]);
|
||||
- if (!enchant.isEmpty()) {
|
||||
+ {
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)mouseX, (double)mouseY) && l >= 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
+ list.add(Component.translatable("container.enchant.clue", optional.isEmpty() ? "" : Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
+ if (optional.isEmpty()) {
|
||||
+ list.add(Component.literal(""));
|
||||
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else if (!flag) {
|
||||
list.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < k) {
|
||||
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
|
||||
int enchantLevel = this.menu.levelClue[i];
|
||||
int cost = i + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * i, 108, 17, mouseX, mouseY) && minLevel > 0 && enchantLevel >= 0) {
|
||||
+ if (this.isHovering(60, 14 + 19 * i, 108, 17, (double)mouseX, (double)mouseY) && enchantLevel >= 0) {
|
||||
List<Component> texts = Lists.newArrayList();
|
||||
texts.add(
|
||||
- Component.translatable("container.enchant.clue", Enchantment.getFullname(enchant.get(), enchantLevel)).withStyle(ChatFormatting.WHITE)
|
||||
+ Component.translatable("container.enchant.clue", enchant.isEmpty() ? "" : Enchantment.getFullname(enchant.get(), enchantLevel)).withStyle(ChatFormatting.WHITE)
|
||||
);
|
||||
+ if (enchant.isEmpty()) {
|
||||
+ texts.add(Component.literal(""));
|
||||
+ texts.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else
|
||||
if (!infiniteMaterials) {
|
||||
texts.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < minLevel) {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
||||
@@ -15,7 +_,7 @@
|
||||
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||
@@ -16,7 +_,7 @@
|
||||
private static final Vector3fc 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");
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -20,7 +_,7 @@
|
||||
case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip(
|
||||
clientactiveplayerstooltip$activeplayerstooltip
|
||||
);
|
||||
@@ -18,7 +_,7 @@
|
||||
return 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);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
@@ -371,6 +_,8 @@
|
||||
@@ -369,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 (this.minecraft.options.touchscreen().get() || hovered) {
|
||||
if (hovered) {
|
||||
graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544);
|
||||
int i1 = mouseX - this.getContentX();
|
||||
int relX = mouseX - this.getContentX();
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
@@ -123,9 +_,10 @@
|
||||
@@ -116,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)
|
||||
@@ -133,7 +_,7 @@
|
||||
@@ -126,7 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, button -> {
|
||||
@@ -21,13 +21,13 @@
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
}).bounds(0, 0, 50, 20).createNarration(defaultNarrationSupplier -> Component.translatable("narrator.controls.reset", name)).build();
|
||||
this.refreshEntry();
|
||||
@@ -174,7 +_,8 @@
|
||||
MutableComponent mutablecomponent = Component.empty();
|
||||
@@ -167,7 +_,8 @@
|
||||
MutableComponent tooltip = Component.empty();
|
||||
if (!this.key.isUnbound()) {
|
||||
for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) {
|
||||
- if (keymapping != this.key && this.key.same(keymapping) && (!keymapping.isDefault() || !this.key.isDefault())) {
|
||||
+ var vanillConflict = keymapping != this.key && this.key.same(keymapping) && (!keymapping.isDefault() || !this.key.isDefault());
|
||||
+ if (vanillConflict || keymapping.hasKeyModifierConflict(this.key)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G
|
||||
for (KeyMapping otherKey : KeyBindsList.this.minecraft.options.keyMappings) {
|
||||
- if (otherKey != this.key && this.key.same(otherKey) && (!otherKey.isDefault() || !this.key.isDefault())) {
|
||||
+ var vanillConflict = otherKey != this.key && this.key.same(otherKey) && (!otherKey.isDefault() || !this.key.isDefault());
|
||||
+ if (vanillConflict || otherKey.hasKeyModifierConflict(this.key)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G
|
||||
if (this.hasCollision) {
|
||||
mutablecomponent.append(", ");
|
||||
tooltip.append(", ");
|
||||
}
|
||||
+4
-4
@@ -3,9 +3,9 @@
|
||||
@@ -42,7 +_,7 @@
|
||||
protected void addFooter() {
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), button -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
- keymapping.setKey(keymapping.getDefaultKey());
|
||||
+ keymapping.setToDefault();
|
||||
for (KeyMapping key : this.options.keyMappings) {
|
||||
- key.setKey(key.getDefaultKey());
|
||||
+ key.setToDefault();
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -27,7 +27,7 @@
|
||||
@@ -101,5 +_,18 @@
|
||||
}
|
||||
|
||||
this.resetButton.active = flag;
|
||||
this.resetButton.active = canReset;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
|
||||
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
|
||||
@@ -112,6 +_,10 @@
|
||||
@@ -111,6 +_,10 @@
|
||||
boolean canMoveUp();
|
||||
|
||||
boolean canMoveDown();
|
||||
@@ -11,7 +11,7 @@
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -213,6 +_,11 @@
|
||||
@@ -210,6 +_,11 @@
|
||||
@Override
|
||||
public void moveDown() {
|
||||
this.move(1);
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
@@ -66,7 +_,7 @@
|
||||
Component component = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD);
|
||||
this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, component), (int)(9.0F * 1.5F));
|
||||
@@ -65,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);
|
||||
- entries.forEach(e -> {
|
||||
+ entries.filter(PackSelectionModel.Entry::notHidden).forEach(e -> {
|
||||
TransferableSelectionList.PackEntry transferableselectionlist$packentry = new TransferableSelectionList.PackEntry(this.minecraft, this, e);
|
||||
this.addEntry(transferableselectionlist$packentry);
|
||||
TransferableSelectionList.PackEntry entry = new TransferableSelectionList.PackEntry(this.minecraft, this, e);
|
||||
this.addEntry(entry);
|
||||
if (transferredEntry != null && transferredEntry.getId().equals(e.getId())) {
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -177,6 +_,7 @@
|
||||
WorldDataConfiguration worlddataconfiguration = SharedConstants.IS_RUNNING_IN_IDE
|
||||
@@ -172,6 +_,7 @@
|
||||
WorldDataConfiguration dataConfig = SharedConstants.IS_RUNNING_IN_IDE
|
||||
? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS)
|
||||
: WorldDataConfiguration.DEFAULT;
|
||||
+ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(packrepository::addPackFinder);
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, worlddataconfiguration);
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
|
||||
worldloader$initconfig,
|
||||
@@ -520,7 +_,7 @@
|
||||
+ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(vanillaOnlyPackRepository::addPackFinder);
|
||||
WorldLoader.InitConfig loadConfig = createDefaultLoadConfig(vanillaOnlyPackRepository, dataConfig);
|
||||
CompletableFuture<WorldCreationContext> loadResult = WorldLoader.load(
|
||||
loadConfig,
|
||||
@@ -512,7 +_,7 @@
|
||||
if (retry) {
|
||||
onAbort.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,10 +17,10 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -634,6 +_,7 @@
|
||||
if (path != null) {
|
||||
@@ -621,6 +_,7 @@
|
||||
if (dataPackDir != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(dataPackDir, this.packValidator);
|
||||
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.tempDataPackRepository, false);
|
||||
this.tempDataPackRepository.reload();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
|
||||
@@ -29,6 +_,10 @@
|
||||
@@ -28,6 +_,10 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface PresetEditor {
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
@@ -234,7 +_,7 @@
|
||||
@@ -239,7 +_,7 @@
|
||||
|
||||
public @Nullable PresetEditor getPresetEditor() {
|
||||
Holder<WorldPreset> holder = this.getWorldType().preset();
|
||||
- return holder != null ? PresetEditor.EDITORS.get(holder.unwrapKey()) : null;
|
||||
+ return holder != null ? holder.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
|
||||
Holder<WorldPreset> preset = this.getWorldType().preset();
|
||||
- return preset != null ? PresetEditor.EDITORS.get(preset.unwrapKey()) : null;
|
||||
+ return preset != null ? preset.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
|
||||
}
|
||||
|
||||
public List<WorldCreationUiState.WorldTypeEntry> getNormalPresetList() {
|
||||
+22
-4
@@ -1,11 +1,29 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
@@ -507,6 +_,8 @@
|
||||
@@ -495,6 +_,8 @@
|
||||
this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
|
||||
PackRepository packrepository = ServerPacksSource.createPackRepository(worldAccess);
|
||||
PackRepository packRepository = ServerPacksSource.createPackRepository(worldAccess);
|
||||
|
||||
+ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(worldAccess, worldAccess.getLevelDirectory());
|
||||
+
|
||||
WorldStem worldstem;
|
||||
WorldStem worldStem;
|
||||
try {
|
||||
worldstem = this.loadWorldStem(worldAccess, levelDataTag, safeMode, packrepository);
|
||||
worldStem = this.loadWorldStem(worldAccess, levelDataTag, safeMode, packRepository);
|
||||
@@ -537,6 +_,8 @@
|
||||
WorldData data = worldDataAndGenSettings.data();
|
||||
boolean oldCustomized = worldDataAndGenSettings.genSettings().options().isOldCustomizedWorld();
|
||||
boolean unstable = data.worldGenSettingsLifecycle() != Lifecycle.stable();
|
||||
+ if (unstable && data instanceof PrimaryLevelData primaryData)
|
||||
+ unstable = !primaryData.hasConfirmedExperimentalWarning();
|
||||
if (!oldCustomized && !unstable) {
|
||||
this.openWorldLoadBundledResourcePack(worldAccess, worldStem, packRepository, onCancel);
|
||||
} else {
|
||||
@@ -553,6 +_,8 @@
|
||||
private void openWorldLoadBundledResourcePack(
|
||||
final LevelStorageSource.LevelStorageAccess worldAccess, final WorldStem worldStem, final PackRepository packRepository, final Runnable onCancel
|
||||
) {
|
||||
+ if (worldStem.worldDataAndGenSettings().data() instanceof PrimaryLevelData primaryLevelData)
|
||||
+ primaryLevelData.withConfirmedWarning(worldStem.worldDataAndGenSettings().data().worldGenSettingsLifecycle() != Lifecycle.stable());
|
||||
DownloadedPackSource packSource = this.minecraft.getDownloadedPackSource();
|
||||
this.loadBundledResourcePack(packSource, worldAccess).thenApply(unused -> true).exceptionallyComposeAsync(t -> {
|
||||
LOGGER.warn("Failed to load pack: ", t);
|
||||
Loaded 100 of 869 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user