mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3da1b644d0 |
No files matched your search
@@ -2,7 +2,7 @@ name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '26.1.2' ]
|
||||
branches: [ '26.2' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ ext {
|
||||
}
|
||||
|
||||
changelog {
|
||||
from '64.0'
|
||||
from '65.0'
|
||||
}
|
||||
|
||||
tasks.register('setup') {
|
||||
|
||||
+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) {
|
||||
|
||||
+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.2
|
||||
MC_NEXT_VERSION=26.2
|
||||
MCP_VERSION=20260409.101008
|
||||
MC_VERSION=26.2
|
||||
MC_NEXT_VERSION=26.3
|
||||
MCP_VERSION=20260616.103818
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=26.1.2
|
||||
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,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,7 +15,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int CIRCULAR_LOG_SIZE = 10;
|
||||
private final Queue<GlDebug.LogEntry> MESSAGE_BUFFER = EvictingQueue.create(10);
|
||||
@@ -103,6 +_,8 @@
|
||||
@@ -83,6 +_,8 @@
|
||||
}
|
||||
|
||||
LOGGER.info("OpenGL debug message: {}", entry);
|
||||
@@ -24,21 +24,21 @@
|
||||
}
|
||||
|
||||
public List<String> getLastOpenGlDebugMessages() {
|
||||
@@ -126,7 +_,7 @@
|
||||
GlDebug debug = new GlDebug();
|
||||
enabledExtensions.add("GL_KHR_debug");
|
||||
GL11.glEnable(37600);
|
||||
- if (debugSynchronousGlLogs) {
|
||||
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
|
||||
GL11.glEnable(33346);
|
||||
}
|
||||
@@ -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 (caps.GL_ARB_debug_output && GlDevice.USE_GL_ARB_debug_output) {
|
||||
GlDebug debug = new GlDebug();
|
||||
enabledExtensions.add("GL_ARB_debug_output");
|
||||
- if (debugSynchronousGlLogs) {
|
||||
+ if (debugSynchronousGlLogs | PRINT_STACKTRACE_ON_ERROR) {
|
||||
GL11.glEnable(33346);
|
||||
}
|
||||
@@ -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,41 +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 id = GlStateManager._genTexture();
|
||||
if (label == null) {
|
||||
@@ -171,12 +_,12 @@
|
||||
GlStateManager._texImage2D(
|
||||
cubeTarget,
|
||||
i,
|
||||
- GlConst.toGlInternalId(format),
|
||||
+ GlConst.toGlInternalId(format, stencil),
|
||||
width >> i,
|
||||
height >> i,
|
||||
0,
|
||||
- GlConst.toGlExternalId(format),
|
||||
- GlConst.toGlType(format),
|
||||
+ GlConst.toGlExternalId(format, stencil),
|
||||
+ GlConst.toGlType(format, stencil),
|
||||
null
|
||||
);
|
||||
}
|
||||
@@ -184,7 +_,7 @@
|
||||
} else {
|
||||
for (int i = 0; i < mipLevels; i++) {
|
||||
GlStateManager._texImage2D(
|
||||
- target, i, GlConst.toGlInternalId(format), width >> i, height >> i, 0, GlConst.toGlExternalId(format), GlConst.toGlType(format), null
|
||||
+ target, i, GlConst.toGlInternalId(format, stencil), width >> i, height >> i, 0, GlConst.toGlExternalId(format, stencil), GlConst.toGlType(format, stencil), null
|
||||
);
|
||||
}
|
||||
@@ -186,9 +_,9 @@
|
||||
GlStateManager._texParameter(target, 34892, 0);
|
||||
}
|
||||
@@ -195,7 +_,7 @@
|
||||
} else if (error != 0) {
|
||||
throw new IllegalStateException("OpenGL error " + error);
|
||||
} else {
|
||||
- GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id);
|
||||
+ GlTexture texture = new GlTexture(usage, label, format, width, height, depthOrLayers, mipLevels, id, stencil);
|
||||
|
||||
- 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 {
|
||||
@@ -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 = device.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1);
|
||||
+ this.depthTexture = device.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, width, height, 1, 1, this.stencilEnabled);
|
||||
- this.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,17 +1,17 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -97,8 +_,9 @@
|
||||
Monitor initialMonitor = 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 && initialMonitor != null ? initialMonitor.getMonitor() : 0L);
|
||||
+ this.handle = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.getMonitor() : 0L, () -> backend);
|
||||
- this.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(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.getX() + mode.getWidth() / 2 - this.width / 2;
|
||||
@@ -110,6 +_,7 @@
|
||||
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];
|
||||
}
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
this.setMode();
|
||||
this.refreshFramebufferSize();
|
||||
@@ -300,6 +_,9 @@
|
||||
GLFW.glfwGetFramebufferSize(this.handle, outWidth, outHeight);
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 index = element != null ? elements.indexOf(element) : -1;
|
||||
this.offsetsByElement[id] = index != -1 ? offsets.getInt(index) : -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
|
||||
@@ -16,7 +_,7 @@
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Vector3fc;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
private static final Vector3fc ZERO_TRANSLATION = new Vector3f();
|
||||
private static final Vector3fc UNIT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||
private static final Quaternionfc ZERO_ROTATION = new Quaternionf();
|
||||
@@ -171,6 +_,20 @@
|
||||
@@ -172,6 +_,20 @@
|
||||
this.scale().lerp(that.scale(), progress, new Vector3f()),
|
||||
this.rightRotation().slerp(that.rightRotation(), progress, new Quaternionf())
|
||||
);
|
||||
+ }
|
||||
+
|
||||
+ 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);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
@@ -302,7 +_,7 @@
|
||||
@@ -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);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- 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");
|
||||
@@ -26,23 +26,20 @@
|
||||
this.systemReport.appendToCrashReportString(builder);
|
||||
}
|
||||
|
||||
@@ -92,18 +_,7 @@
|
||||
exception.setStackTrace(this.exception.getStackTrace());
|
||||
@@ -84,15 +_,7 @@
|
||||
exception = replaceMessage(exception, this.title);
|
||||
}
|
||||
|
||||
- String var4;
|
||||
- try {
|
||||
- writer = new StringWriter();
|
||||
- printWriter = new PrintWriter(writer);
|
||||
- exception.printStackTrace(printWriter);
|
||||
- var4 = writer.toString();
|
||||
- return writer.toString();
|
||||
- } finally {
|
||||
- IOUtils.closeQuietly((Writer)writer);
|
||||
- IOUtils.closeQuietly((Writer)printWriter);
|
||||
- IOUtils.closeQuietly(writer);
|
||||
- IOUtils.closeQuietly(printWriter);
|
||||
- }
|
||||
-
|
||||
- return var4;
|
||||
+ 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,21 +1,21 @@
|
||||
--- a/net/minecraft/CrashReportCategory.java
|
||||
+++ b/net/minecraft/CrashReportCategory.java
|
||||
@@ -140,8 +_,10 @@
|
||||
if (full.length <= 0) {
|
||||
@@ -138,8 +_,10 @@
|
||||
return 0;
|
||||
} else {
|
||||
- this.stackTrace = new StackTraceElement[full.length - 3 - nestedOffset];
|
||||
- System.arraycopy(full, 3 + nestedOffset, this.stackTrace, 0, this.stackTrace.length);
|
||||
+ int len = full.length - 3 - nestedOffset;
|
||||
+ if (len <= 0) len = full.length;
|
||||
+ this.stackTrace = new StackTraceElement[len];
|
||||
+ System.arraycopy(full, full.length - len, this.stackTrace, 0, this.stackTrace.length);
|
||||
return this.stackTrace.length;
|
||||
}
|
||||
}
|
||||
@@ -188,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 element : this.stackTrace) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -216,6 +_,7 @@
|
||||
@@ -218,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -219,7 +_,11 @@
|
||||
@@ -220,7 +_,11 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(final Consumer<AdvancementHolder> output, final String name) {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -217,12 +_,14 @@
|
||||
return 90.0F;
|
||||
} else {
|
||||
float fov = this.minecraft.options.fov().get().intValue() * Mth.lerp(partialTicks, this.oldFovModifier, this.fovModifier);
|
||||
- return this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
|
||||
+ var ret = this.modifyFovBasedOnDeathOrFluid(partialTicks, fov);
|
||||
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this.minecraft.gameRenderer, this, partialTicks, ret, true).getFOV();
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -514,7 +_,7 @@
|
||||
if (screen != null) {
|
||||
try {
|
||||
if (action != 1 && action != 2) {
|
||||
- if (action == 0 && screen.keyReleased(event)) {
|
||||
+ if (action == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, event)) {
|
||||
if (options.keyDebugModifier.matches(event)) {
|
||||
this.usedDebugKeyAsModifier = false;
|
||||
@@ -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 @@
|
||||
}
|
||||
@@ -523,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
screen.afterKeyboardAction();
|
||||
- if (screen.keyPressed(event)) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, event)) {
|
||||
if (this.minecraft.screen == null) {
|
||||
InputConstants.Key key = InputConstants.getKey(event);
|
||||
KeyMapping.set(key, false);
|
||||
@@ -595,6 +_,7 @@
|
||||
} 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 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,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 var8) {
|
||||
CrashReport report = CrashReport.forThrowable(var8, "charTyped event handler");
|
||||
} 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
|
||||
@@ -268,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;
|
||||
@@ -432,7 +_,6 @@
|
||||
@@ -410,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,68 +17,74 @@
|
||||
this.demo = gameConfig.game.demo;
|
||||
this.allowsMultiplayer = !gameConfig.game.disableMultiplayer;
|
||||
this.allowsChat = !gameConfig.game.disableChat;
|
||||
@@ -518,14 +_,14 @@
|
||||
LOGGER.error("Couldn't set icon", (Throwable)var23);
|
||||
@@ -547,12 +_,12 @@
|
||||
LOGGER.error("Couldn't set icon", e);
|
||||
}
|
||||
|
||||
+ // FORGE: Move mouse and keyboard handler setup further below
|
||||
this.mouseHandler = new MouseHandler(this);
|
||||
- this.mouseHandler.setup(this.window);
|
||||
this.keyboardHandler = new KeyboardHandler(this);
|
||||
- this.keyboardHandler.setup(this.window);
|
||||
this.options.applyGraphicsPreset(this.options.graphicsPreset().get());
|
||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, var1 -> {
|
||||
@@ -630,6 +_,7 @@
|
||||
ParticleResources particleResources = new ParticleResources();
|
||||
this.resourceManager.registerReloadListener(particleResources);
|
||||
this.particleEngine = new ParticleEngine(this.level, particleResources);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(particleResources);
|
||||
particleResources.onReload(this.particleEngine::clearParticles);
|
||||
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.modelManager);
|
||||
WindowRenderState windowRenderState = this.gameRenderer.gameRenderState().windowRenderState;
|
||||
@@ -647,6 +_,7 @@
|
||||
this.window.getHeight()
|
||||
);
|
||||
this.levelExtractor = new LevelExtractor(this, this.gameRenderer.gameRenderState().levelRenderState, this.levelRenderer);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onInitLevelRenderer();
|
||||
this.resourceManager.registerReloadListener(this.levelExtractor);
|
||||
this.resourceManager.registerReloadListener(this.levelRenderer.cloudRenderer());
|
||||
this.gpuWarnlistManager = new GpuWarnlistManager();
|
||||
@@ -654,6 +_,9 @@
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
this.gui = new Gui(this, new Hud(this), this.gameRenderer.gameRenderState().guiRenderState);
|
||||
this.gui.registerReloadListeners(this.resourceManager);
|
||||
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
|
||||
+ this.mouseHandler.setup(this.window);
|
||||
+ this.keyboardHandler.setup(this.window);
|
||||
RealmsClient realmsClient = RealmsClient.getOrCreate(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsClient);
|
||||
RenderSystem.setErrorCallback(this::onFullscreenError);
|
||||
@@ -686,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
|
||||
this.window.setDefaultErrorCallback();
|
||||
@@ -710,14 +_,15 @@
|
||||
.createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, packs);
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
GameLoadCookie loadCookie = new GameLoadCookie(realmsClient, gameConfig.quickPlay);
|
||||
- this.gui.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
|
||||
+ this.gui.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () ->reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
|
||||
+ // FORGE: Move mouse and keyboard handler setup further below
|
||||
this.mouseHandler = new MouseHandler(this);
|
||||
- this.mouseHandler.setup(this.window);
|
||||
this.keyboardHandler = new KeyboardHandler(this);
|
||||
- this.keyboardHandler.setup(this.window);
|
||||
this.options.applyGraphicsPreset(this.options.graphicsPreset().get());
|
||||
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
|
||||
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, languageData -> {
|
||||
@@ -613,6 +_,7 @@
|
||||
this.particleResources = new ParticleResources();
|
||||
this.resourceManager.registerReloadListener(this.particleResources);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.particleResources);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleResources);
|
||||
this.particleResources.onReload(this.particleEngine::clearParticles);
|
||||
this.waypointStyles = new WaypointStyleManager();
|
||||
this.resourceManager.registerReloadListener(this.waypointStyles);
|
||||
@@ -634,6 +_,9 @@
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
this.gui = new Gui(this);
|
||||
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
|
||||
+ this.mouseHandler.setup(this.window);
|
||||
+ this.keyboardHandler.setup(this.window);
|
||||
RealmsClient realmsClient = RealmsClient.getOrCreate(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsClient);
|
||||
RenderSystem.setErrorCallback(this::onFullscreenError);
|
||||
@@ -665,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
|
||||
@@ -690,14 +_,15 @@
|
||||
.createReload(Util.backgroundExecutor().forName("resourceLoad"), this, RESOURCE_RELOAD_INITIAL_TASK, packs);
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie loadCookie = new Minecraft.GameLoadCookie(realmsClient, gameConfig.quickPlay);
|
||||
- this.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
|
||||
+ this.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () ->reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
|
||||
this.reloadStateTracker.finishReload();
|
||||
this.onResourceLoadFinished(loadCookie);
|
||||
- }), false));
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
|
||||
+ }), false).get());
|
||||
this.quickPlayLog = QuickPlayLog.of(gameConfig.quickPlay.logPath());
|
||||
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
||||
this.fpsPieProfiler = new ContinuousProfiler(Util.timeSource, () -> this.fpsPieRenderTicks, this.framerateLimitTracker::isHeavilyThrottled);
|
||||
@@ -816,6 +_,7 @@
|
||||
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("*");
|
||||
@@ -86,88 +92,51 @@
|
||||
}
|
||||
|
||||
builder.append(" ");
|
||||
@@ -839,6 +_,8 @@
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -851,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);
|
||||
@@ -1128,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");
|
||||
@@ -1152,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||
+ Screen old = this.screen;
|
||||
+ if (screen != null) {
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, screen);
|
||||
+ if (event == null) return;
|
||||
+ screen = event;
|
||||
+ }
|
||||
+
|
||||
+ if (screen != old) {
|
||||
+ if (old != null) {
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
|
||||
+ old.removed();
|
||||
+ } else {
|
||||
+ this.setLastInputType(InputType.NONE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
this.screen = screen;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1235,6 +_,7 @@
|
||||
@@ -1141,6 +_,7 @@
|
||||
Util.shutdownExecutors();
|
||||
RenderSystem.getSamplerCache().close();
|
||||
RenderSystem.getDevice().close();
|
||||
this.windowSurface.close();
|
||||
RenderSystem.shutdownRenderer();
|
||||
+ net.minecraftforge.fml.config.ConfigTracker.forceUnload();
|
||||
} catch (Throwable var5) {
|
||||
LOGGER.error("Shutdown failure!", var5);
|
||||
throw var5;
|
||||
@@ -1346,7 +_,9 @@
|
||||
profiler.popPush("gpuAsync");
|
||||
RenderSystem.executePendingTasks();
|
||||
profiler.pop();
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
|
||||
this.gameRenderer.render(this.deltaTracker, advanceGameTime);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
|
||||
profiler.push("present");
|
||||
if (!this.gameRenderer.getGameRenderState().windowRenderState.isMinimized) {
|
||||
this.mainRenderTarget.blitToScreen();
|
||||
@@ -1450,6 +_,7 @@
|
||||
} 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.screen != null) {
|
||||
this.screen.resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
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();
|
||||
@@ -1601,6 +_,7 @@
|
||||
@@ -1576,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -175,7 +144,7 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1630,10 +_,18 @@
|
||||
@@ -1599,10 +_,18 @@
|
||||
if (down && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
|
||||
BlockPos pos = blockHit.getBlockPos();
|
||||
@@ -197,36 +166,36 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1676,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 customItemRange = heldItem.get(DataComponents.ATTACK_RANGE);
|
||||
@@ -1686,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockHit = (BlockHitResult)this.hitResult;
|
||||
BlockPos pos = blockHit.getBlockPos();
|
||||
- if (!this.level.getBlockState(pos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(pos)) {
|
||||
this.gameMode.startDestroyBlock(pos, blockHit.getDirection());
|
||||
if (this.level.getBlockState(pos).isAir()) {
|
||||
endAttack = true;
|
||||
@@ -1699,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return endAttack;
|
||||
}
|
||||
@@ -1717,6 +_,12 @@
|
||||
|
||||
+ 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()) {
|
||||
@@ -239,7 +208,7 @@
|
||||
ItemStack heldItem = this.player.getItemInHand(hand);
|
||||
if (!heldItem.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1733,7 +_,7 @@
|
||||
@@ -1712,7 +_,7 @@
|
||||
|
||||
if (this.player.isWithinEntityInteractionRange(entity, 0.0)
|
||||
&& this.gameMode.interact(this.player, entity, entityHit, hand) instanceof InteractionResult.Success success) {
|
||||
@@ -248,7 +217,7 @@
|
||||
this.player.swing(hand);
|
||||
}
|
||||
|
||||
@@ -1745,7 +_,7 @@
|
||||
@@ -1724,7 +_,7 @@
|
||||
int oldCount = heldItem.getCount();
|
||||
InteractionResult useResult = this.gameMode.useItemOn(this.player, hand, blockHit);
|
||||
if (useResult instanceof InteractionResult.Success success) {
|
||||
@@ -257,7 +226,7 @@
|
||||
this.player.swing(hand);
|
||||
if (!heldItem.isEmpty() && (heldItem.getCount() != oldCount || this.player.hasInfiniteMaterials())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(hand);
|
||||
@@ -1761,6 +_,9 @@
|
||||
@@ -1740,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,24 +236,24 @@
|
||||
if (!heldItem.isEmpty() && this.gameMode.useItem(this.player, hand) instanceof InteractionResult.Success success) {
|
||||
if (success.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
this.player.swing(hand);
|
||||
@@ -1789,6 +_,8 @@
|
||||
@@ -1768,6 +_,8 @@
|
||||
}
|
||||
|
||||
ProfilerFiller profiler = Profiler.get();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||
+
|
||||
profiler.push("gui");
|
||||
this.textInputManager.tick();
|
||||
this.chatListener.tick();
|
||||
@@ -1871,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 var6) {
|
||||
@@ -1884,6 +_,7 @@
|
||||
} catch (Throwable t) {
|
||||
@@ -1830,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(report);
|
||||
}
|
||||
@@ -292,7 +261,7 @@
|
||||
}
|
||||
|
||||
profiler.popPush("animateTick");
|
||||
@@ -1908,6 +_,7 @@
|
||||
@@ -1854,6 +_,7 @@
|
||||
profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
profiler.pop();
|
||||
@@ -300,7 +269,7 @@
|
||||
}
|
||||
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -2138,6 +_,7 @@
|
||||
@@ -2059,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(final ClientLevel level) {
|
||||
@@ -308,23 +277,23 @@
|
||||
this.level = level;
|
||||
this.updateLevelInEngines(level);
|
||||
}
|
||||
@@ -2199,6 +_,7 @@
|
||||
@@ -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;
|
||||
@@ -2206,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;
|
||||
@@ -2220,6 +_,7 @@
|
||||
@@ -2141,6 +_,7 @@
|
||||
}
|
||||
|
||||
profiler.pop();
|
||||
@@ -332,7 +301,7 @@
|
||||
}
|
||||
|
||||
this.setScreenAndShow(screen);
|
||||
@@ -2372,6 +_,7 @@
|
||||
@@ -2354,6 +_,7 @@
|
||||
|
||||
private void pickBlockOrEntity() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -87,6 +_,7 @@
|
||||
@@ -77,6 +_,7 @@
|
||||
this.activeButton = null;
|
||||
}
|
||||
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(buttonInfo, action)) return;
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
if (!this.mouseGrabbed && pressed) {
|
||||
@@ -106,7 +_,7 @@
|
||||
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 == event.button();
|
||||
@@ -17,7 +17,7 @@
|
||||
this.lastClick = new MouseHandler.LastClick(currentTime, screen);
|
||||
this.lastClickButton = buttonInfo.button();
|
||||
return;
|
||||
@@ -121,7 +_,7 @@
|
||||
@@ -116,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -25,8 +25,8 @@
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, xm, ym, event)) {
|
||||
return;
|
||||
}
|
||||
} catch (Throwable var17) {
|
||||
@@ -151,6 +_,7 @@
|
||||
} catch (Throwable t) {
|
||||
@@ -146,6 +_,7 @@
|
||||
KeyMapping.click(mouseKey);
|
||||
}
|
||||
}
|
||||
@@ -34,35 +34,35 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
@@ -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.screen.mouseScrolled(xm, ym, scaledXOffset, scaledYOffset);
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, xm, ym, scaledXOffset, scaledYOffset)) return;
|
||||
+ if (this.minecraft.screen.mouseScrolled(xm, ym, scaledXOffset, scaledYOffset)) return;
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, xm, ym, scaledXOffset, scaledYOffset);
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
- 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 wheelXY = this.scrollWheelHandler.onMouseScroll(scaledXOffset, scaledYOffset);
|
||||
@@ -211,6 +_,7 @@
|
||||
@@ -206,6 +_,7 @@
|
||||
}
|
||||
|
||||
int wheel = wheelXY.y == 0 ? -wheelXY.x : wheelXY.y;
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, scaledXOffset, scaledYOffset)) return;
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-wheel);
|
||||
@@ -317,7 +_,7 @@
|
||||
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(xm, ym, this.activeButton), dx, dy);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(xm, ym, this.activeButton), dx, dy);
|
||||
} catch (Throwable var19) {
|
||||
CrashReport report = CrashReport.forThrowable(var19, "mouseDragged event handler");
|
||||
} catch (Throwable t) {
|
||||
CrashReport report = CrashReport.forThrowable(t, "mouseDragged event handler");
|
||||
screen.fillCrashDetails(report);
|
||||
@@ -402,6 +_,14 @@
|
||||
@@ -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
|
||||
@@ -929,6 +_,7 @@
|
||||
@@ -986,6 +_,7 @@
|
||||
);
|
||||
public boolean syncWrites;
|
||||
public boolean startedCleanly = true;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public static boolean isSoundDeviceDefault(final String deviceName) {
|
||||
return deviceName.equals("");
|
||||
@@ -1404,6 +_,7 @@
|
||||
@@ -1474,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(final Minecraft minecraft, final File workingDirectory) {
|
||||
@@ -16,7 +16,7 @@
|
||||
this.minecraft = minecraft;
|
||||
this.optionsFile = new File(workingDirectory, "options.txt");
|
||||
boolean largeDistances = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1556,15 +_,28 @@
|
||||
@@ -1624,15 +_,28 @@
|
||||
this.startedCleanly = access.process("startedCleanly", this.startedCleanly);
|
||||
access.process("musicToast", this.musicToast);
|
||||
access.process("musicFrequency", this.musicFrequency);
|
||||
@@ -46,7 +46,7 @@
|
||||
for (SoundSource source : SoundSource.values()) {
|
||||
access.process("soundCategory_" + source.getName(), this.soundSourceVolumes.get(source));
|
||||
}
|
||||
@@ -1579,6 +_,10 @@
|
||||
@@ -1647,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -57,7 +57,7 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1598,7 +_,8 @@
|
||||
@@ -1666,7 +_,8 @@
|
||||
}
|
||||
|
||||
final CompoundTag options = this.dataFix(rawOptions);
|
||||
@@ -65,9 +65,9 @@
|
||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
|
||||
+ processor.accept(
|
||||
new Options.FieldAccess() {
|
||||
{
|
||||
Objects.requireNonNull(Options.this);
|
||||
@@ -1680,6 +_,17 @@
|
||||
private @Nullable String getValue(final String name) {
|
||||
Tag tag = options.get(name);
|
||||
@@ -1748,6 +_,17 @@
|
||||
);
|
||||
options.getString("fullscreenResolution").ifPresent(fullscreenResolution -> this.fullscreenVideoModeString = fullscreenResolution);
|
||||
KeyMapping.resetMapping();
|
||||
@@ -82,26 +82,22 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
} catch (Exception var7) {
|
||||
LOGGER.error("Failed to load options", (Throwable)var7);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to load options", e);
|
||||
}
|
||||
@@ -1707,6 +_,7 @@
|
||||
@@ -1778,9 +_,11 @@
|
||||
public void save() {
|
||||
try (final PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
|
||||
writer.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version());
|
||||
+ var seen = new java.util.HashSet<String>();
|
||||
this.processOptions(
|
||||
new Options.FieldAccess() {
|
||||
{
|
||||
@@ -1714,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void writePrefix(final String name) {
|
||||
+ seen.add(name);
|
||||
writer.print(name);
|
||||
writer.print(':');
|
||||
}
|
||||
@@ -1769,6 +_,12 @@
|
||||
@@ -1836,6 +_,12 @@
|
||||
if (fullscreenVideoModeString != null) {
|
||||
writer.println("fullscreenResolution:" + fullscreenVideoModeString);
|
||||
}
|
||||
@@ -111,10 +107,10 @@
|
||||
+ writer.println(entry.getKey() + ":" + entry.getValue());
|
||||
+ }
|
||||
+
|
||||
} catch (Exception var6) {
|
||||
LOGGER.error("Failed to save options", (Throwable)var6);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to save options", e);
|
||||
}
|
||||
@@ -1806,6 +_,7 @@
|
||||
@@ -1873,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -122,7 +118,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
||||
}
|
||||
@@ -1923,6 +_,23 @@
|
||||
@@ -1986,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(final Component caption, final int value) {
|
||||
return genericValueLabel(caption, Component.literal(Integer.toString(value)));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Screenshot.java
|
||||
+++ b/net/minecraft/client/Screenshot.java
|
||||
@@ -44,6 +_,13 @@
|
||||
@@ -53,14 +_,24 @@
|
||||
file = new File(picDir, forceName);
|
||||
}
|
||||
|
||||
@@ -14,19 +14,17 @@
|
||||
Util.ioPool()
|
||||
.execute(
|
||||
() -> {
|
||||
@@ -51,10 +_,13 @@
|
||||
NativeImage twrVar0$ = image;
|
||||
|
||||
try {
|
||||
- image.writeToFile(file);
|
||||
- Component component = Component.literal(file.getName())
|
||||
+ image.writeToFile(outputFile);
|
||||
+ Component component = Component.literal(outputFile.getName())
|
||||
.withStyle(ChatFormatting.UNDERLINE)
|
||||
.withStyle(s -> s.withClickEvent(new ClickEvent.OpenFile(file.getAbsoluteFile())));
|
||||
+ if (event.getResultMessage() != null)
|
||||
+ callback.accept(event.getResultMessage());
|
||||
+ else
|
||||
callback.accept(Component.translatable("screenshot.success", component));
|
||||
} catch (Throwable var7) {
|
||||
if (image != null) {
|
||||
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,6 +1,6 @@
|
||||
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
@@ -909,6 +_,9 @@
|
||||
@@ -868,6 +_,9 @@
|
||||
this.declareCustomModelItem(Items.COD);
|
||||
this.declareCustomModelItem(Items.FEATHER);
|
||||
this.declareCustomModelItem(Items.LEAD);
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
ClientItem donorInfo = this.itemInfos.get(donor);
|
||||
if (donorInfo == null) {
|
||||
@@ -131,8 +_,8 @@
|
||||
this.register(acceptor, donorInfo);
|
||||
}
|
||||
|
||||
this.register(acceptor, donorInfo);
|
||||
});
|
||||
- List<Identifier> missingDefinitions = BuiltInRegistries.ITEM
|
||||
- .listElements()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/Font.java
|
||||
+++ b/net/minecraft/client/gui/Font.java
|
||||
@@ -33,7 +_,7 @@
|
||||
@@ -28,7 +_,7 @@
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,116 +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 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());
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance instance : Ordering.natural().reverse().sortedCopy(activeEffects)) {
|
||||
Holder<MobEffect> effect = instance.getEffect();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(instance);
|
||||
+ if (!renderer.isVisibleInGui(instance)) continue;
|
||||
if (instance.showIcon()) {
|
||||
int x = graphics.guiWidth();
|
||||
int y = 1;
|
||||
@@ -508,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (renderer.extractGuiIcon(instance, this, graphics, x, y, 0, alpha)) continue;
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(effect), x + 3, y + 3, 18, 18, ARGB.white(alpha));
|
||||
}
|
||||
- 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 @@
|
||||
}
|
||||
@@ -610,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) {
|
||||
+ Gui.ContextualInfo nextContextualInfo = this.nextContextualInfoState();
|
||||
+ if (nextContextualInfo != this.contextualInfoBar.getKey()) {
|
||||
+ this.contextualInfoBar = Pair.of(nextContextualInfo, this.contextualInfoBarRenderers.get(nextContextualInfo).get());
|
||||
+ clearLayers();
|
||||
+ Screen old = this.screen;
|
||||
+ if (screen != null) {
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, screen);
|
||||
+ if (event == null) return;
|
||||
+ screen = event;
|
||||
+ }
|
||||
+
|
||||
+ this.contextualInfoBar.getValue().extractBackground(graphics, deltaTracker);
|
||||
+ }
|
||||
+ // Forge: Same as above but for FLD#CONTEXTUAL_INFO
|
||||
+ public final void extractContextualInfoState(final GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
|
||||
+ this.contextualInfoBar.getValue().extractRenderState(graphics, deltaTracker);
|
||||
+ 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 str = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||
if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) {
|
||||
str.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
- int strWidth = this.getFont().width(str);
|
||||
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(str);
|
||||
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||
+ if (font == null)
|
||||
+ font = this.getFont();
|
||||
+ int strWidth = font.width(highlightTip);
|
||||
int x = (graphics.guiWidth() - strWidth) / 2;
|
||||
- int y = graphics.guiHeight() - 59;
|
||||
+ int y = graphics.guiHeight() - Math.max(yShift, 59);
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
y += 14;
|
||||
}
|
||||
@@ -629,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (alpha > 0) {
|
||||
- graphics.textWithBackdrop(this.getFont(), str, x, y, strWidth, ARGB.white(alpha));
|
||||
+ graphics.textWithBackdrop(font, highlightTip, x, y, strWidth, ARGB.white(alpha));
|
||||
}
|
||||
}
|
||||
+ @Override
|
||||
+ protected void setScreenInternal(Screen value) {
|
||||
+ this.screen = value;
|
||||
}
|
||||
@@ -1195,7 +_,9 @@
|
||||
this.toolHighlightTimer = 0;
|
||||
} else if (this.lastToolHighlight.isEmpty()
|
||||
|| !selected.is(this.lastToolHighlight.getItem())
|
||||
- || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
|
||||
+ || !selected.getHoverName().equals(this.lastToolHighlight.getHoverName())
|
||||
+ || !selected.getHighlightTip(selected.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName()))
|
||||
+ ) {
|
||||
this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get());
|
||||
} else if (this.toolHighlightTimer > 0) {
|
||||
this.toolHighlightTimer--;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/GuiGraphicsExtractor.java
|
||||
+++ b/net/minecraft/client/gui/GuiGraphicsExtractor.java
|
||||
@@ -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;
|
||||
@@ -914,6 +_,7 @@
|
||||
CrashReport report = CrashReport.forThrowable(var11, "Rendering item");
|
||||
@@ -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);
|
||||
@@ -940,6 +_,7 @@
|
||||
@@ -938,6 +_,7 @@
|
||||
this.itemCooldown(itemStack, x, y);
|
||||
this.itemCount(font, itemStack, x, y, countText);
|
||||
this.pose.popMatrix();
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,16 +_,25 @@
|
||||
@@ -1106,16 +_,25 @@
|
||||
this.setTooltipForNextFrame(this.minecraft.font, formattedCharSequences, DefaultTooltipPositioner.INSTANCE, x, y, false);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
public void setTooltipForNextFrame(
|
||||
final Font font,
|
||||
final List<Component> texts,
|
||||
@@ -1130,11 +_,7 @@
|
||||
@@ -1124,11 +_,7 @@
|
||||
final int yo,
|
||||
final @Nullable Identifier style
|
||||
) {
|
||||
@@ -64,7 +64,7 @@
|
||||
this.setTooltipForNextFrameInternal(font, components, xo, yo, DefaultTooltipPositioner.INSTANCE, style, false);
|
||||
}
|
||||
|
||||
@@ -1162,7 +_,22 @@
|
||||
@@ -1156,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo) {
|
||||
@@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(final Font font, final List<Component> lines, final int xo, final int yo, final @Nullable Identifier style) {
|
||||
@@ -1213,10 +_,16 @@
|
||||
@@ -1207,10 +_,16 @@
|
||||
) {
|
||||
if (!lines.isEmpty()) {
|
||||
if (this.deferredTooltip == null || replaceExisting) {
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
public void tooltip(
|
||||
final Font font,
|
||||
@@ -1224,13 +_,16 @@
|
||||
@@ -1218,13 +_,16 @@
|
||||
final int xo,
|
||||
final int yo,
|
||||
final ClientTooltipPositioner positioner,
|
||||
@@ -125,17 +125,17 @@
|
||||
if (lineWidth > textWidth) {
|
||||
textWidth = lineWidth;
|
||||
}
|
||||
@@ -1240,25 +_,25 @@
|
||||
@@ -1234,25 +_,25 @@
|
||||
|
||||
int w = textWidth;
|
||||
int h = tempHeight;
|
||||
- Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), xo, yo, textWidth, tempHeight);
|
||||
+ Vector2ic positionedTooltip = positioner.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), textWidth, tempHeight);
|
||||
- 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, x, y, textWidth, tempHeight, style);
|
||||
+ TooltipRenderUtil.extractTooltipBackground(this, x, y, textWidth, tempHeight, preEvent.getBackground());
|
||||
- TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, style);
|
||||
+ TooltipRenderUtil.extractTooltipBackground(this, x, y, w, h, preEvent.getBackground());
|
||||
int localY = y;
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
@@ -157,7 +157,7 @@
|
||||
}
|
||||
|
||||
this.pose.popMatrix();
|
||||
@@ -1333,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
@@ -68,13 +_,16 @@
|
||||
|
||||
for (LerpingBossEvent event : this.events.values()) {
|
||||
int xLeft = screenWidth / 2 - 91;
|
||||
int yo = yOffset;
|
||||
+ var progressEvent = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(graphics, this.minecraft.getWindow(), event, xLeft, yOffset, 10 + this.minecraft.font.lineHeight);
|
||||
+ if (progressEvent != null) {
|
||||
this.extractBar(graphics, xLeft, yOffset, event);
|
||||
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 = yOffset - 9;
|
||||
int y = yo - 9;
|
||||
graphics.text(this.minecraft.font, msg, x, y, -1);
|
||||
- yOffset += 10 + 9;
|
||||
+ }
|
||||
|
||||
+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
|
||||
@@ -130,6 +_,7 @@
|
||||
@@ -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 (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(
|
||||
@@ -16,7 +16,7 @@
|
||||
+ if (extractContentRenderState(graphics, logoAlpha)) {
|
||||
int contentX = (int)(graphics.guiWidth() * 0.5);
|
||||
int logoY = (int)(graphics.guiHeight() * 0.5);
|
||||
double logoHeight = Math.min(graphics.guiWidth() * 0.75, (double)graphics.guiHeight()) * 0.25;
|
||||
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)
|
||||
);
|
||||
@@ -24,7 +24,7 @@
|
||||
+ }
|
||||
|
||||
if (fadeOutAnim >= 2.0F) {
|
||||
this.minecraft.setOverlay(null);
|
||||
this.minecraft.gui.setOverlay(null);
|
||||
@@ -157,6 +_,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -34,10 +34,10 @@
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
@@ -164,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(var2));
|
||||
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());
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -102,6 +_,7 @@
|
||||
} else {
|
||||
helper.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
|
||||
);
|
||||
}
|
||||
+ helper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
|
||||
+ 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 = 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,7 +8,7 @@
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -105,11 +_,15 @@
|
||||
@@ -114,11 +_,15 @@
|
||||
int copyrightX = this.width - copyrightWidth - 2;
|
||||
int spacing = 24;
|
||||
int topPos = this.height / 4 + 48;
|
||||
@@ -17,23 +17,23 @@
|
||||
topPos = this.createDemoMenuOptions(topPos, 24);
|
||||
} else {
|
||||
topPos = this.createNormalMenuOptions(topPos, 24);
|
||||
+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this)))
|
||||
+ .pos(this.width / 2 - 100, topPos).size(98, 20).build());
|
||||
+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.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);
|
||||
|
||||
topPos = this.createTestWorldButton(topPos, 24);
|
||||
SpriteIconButton language = this.addRenderableWidget(
|
||||
@@ -182,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, var6 = topPos + spacing, 200, 20).tooltip(tooltip).build()).active = multiplayerAllowed;
|
||||
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 = var6 + spacing, 200, 20)
|
||||
+ .bounds(this.width / 2 + 2, topPos = var6 + 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()
|
||||
)
|
||||
@@ -310,9 +_,18 @@
|
||||
@@ -323,9 +_,18 @@
|
||||
versionString = versionString + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
|
||||
+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 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());
|
||||
}
|
||||
@@ -169,8 +_,8 @@
|
||||
}
|
||||
|
||||
index -= type.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();
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
@@ -50,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);
|
||||
@@ -63,6 +_,19 @@
|
||||
@@ -65,6 +_,19 @@
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
@@ -28,7 +28,7 @@
|
||||
this.layout.addTitleHeader(TITLE, this.font);
|
||||
this.tabs.clear();
|
||||
this.selectedTab = null;
|
||||
@@ -105,7 +_,7 @@
|
||||
@@ -119,7 +_,7 @@
|
||||
int yo = (this.height - 140) / 2;
|
||||
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
@@ -37,24 +37,24 @@
|
||||
this.advancements.setSelectedTab(tab.getRootNode().holder(), true);
|
||||
break;
|
||||
}
|
||||
@@ -196,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 tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
tab.extractTab(graphics, xo, yo, mouseX, mouseY, tab == this.selectedTab);
|
||||
tab.extractTab(graphics, this.leftPos, this.topPos, mouseX, mouseY, tab == this.selectedTab);
|
||||
}
|
||||
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
tab.extractIcon(graphics, xo, yo);
|
||||
tab.extractIcon(graphics, this.leftPos, this.topPos);
|
||||
}
|
||||
}
|
||||
@@ -218,6 +_,7 @@
|
||||
@@ -230,6 +_,7 @@
|
||||
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab tab : this.tabs.values()) {
|
||||
+ if (tab.getPage() == tabPage)
|
||||
if (tab.isMouseOver(xo, yo, mouseX, mouseY)) {
|
||||
if (tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) {
|
||||
graphics.setTooltipForNextFrame(this.font, tab.getTitle(), mouseX, mouseY);
|
||||
}
|
||||
+53
-55
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
@@ -111,6 +_,7 @@
|
||||
@@ -98,6 +_,7 @@
|
||||
int xo = this.leftPos;
|
||||
int yo = this.topPos;
|
||||
super.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
@@ -8,7 +8,7 @@
|
||||
graphics.pose().pushMatrix();
|
||||
graphics.pose().translate(xo, yo);
|
||||
this.extractLabels(graphics, mouseX, mouseY);
|
||||
@@ -122,6 +_,7 @@
|
||||
@@ -109,6 +_,7 @@
|
||||
if (previouslyHoveredSlot != null && previouslyHoveredSlot != this.hoveredSlot) {
|
||||
this.onStopHovering(previouslyHoveredSlot);
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
graphics.pose().popMatrix();
|
||||
}
|
||||
@@ -200,7 +_,7 @@
|
||||
@@ -170,7 +_,7 @@
|
||||
ItemStack item = this.hoveredSlot.getItem();
|
||||
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(item)) {
|
||||
graphics.setTooltipForNextFrame(
|
||||
@@ -25,53 +25,53 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -216,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) {
|
||||
@@ -316,7 +_,8 @@
|
||||
if (super.mouseClicked(event, doubleClick)) {
|
||||
@@ -285,7 +_,8 @@
|
||||
return true;
|
||||
} else {
|
||||
- boolean cloning = this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials();
|
||||
+ var mouseKey = com.mojang.blaze3d.platform.InputConstants.Type.MOUSE.getOrCreate(event.button());
|
||||
+ boolean cloning = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey) && this.minecraft.player.hasInfiniteMaterials();
|
||||
Slot slot = this.getHoveredSlot(event.x(), event.y());
|
||||
this.doubleclick = this.lastClickSlot == slot && doubleClick;
|
||||
this.skipNextRelease = false;
|
||||
@@ -326,6 +_,7 @@
|
||||
int xo = this.leftPos;
|
||||
int yo = this.topPos;
|
||||
boolean clickedOutside = this.hasClickedOutside(event.x(), event.y(), xo, yo);
|
||||
+ if (slot != null) clickedOutside = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
|
||||
int slotId = -1;
|
||||
if (slot != null) {
|
||||
slotId = slot.index;
|
||||
@@ -351,7 +_,7 @@
|
||||
}
|
||||
} else if (!this.isQuickCrafting) {
|
||||
if (this.menu.getCarried().isEmpty()) {
|
||||
- if (cloning) {
|
||||
+ if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
||||
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
|
||||
} else {
|
||||
boolean quickKey = slotId != -999 && event.hasShiftDown();
|
||||
@@ -375,7 +_,7 @@
|
||||
this.quickCraftingType = 0;
|
||||
} else if (event.button() == 1) {
|
||||
this.quickCraftingType = 1;
|
||||
- } else if (cloning) {
|
||||
+ } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
||||
this.quickCraftingType = 2;
|
||||
}
|
||||
}
|
||||
@@ -445,10 +_,13 @@
|
||||
}
|
||||
|
||||
- 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) {
|
||||
@@ -85,7 +85,7 @@
|
||||
int slotId = -1;
|
||||
if (slot != null) {
|
||||
slotId = slot.index;
|
||||
@@ -465,7 +_,7 @@
|
||||
@@ -394,7 +_,7 @@
|
||||
if (target != null
|
||||
&& target.mayPickup(this.minecraft.player)
|
||||
&& target.hasItem()
|
||||
@@ -94,8 +94,8 @@
|
||||
&& AbstractContainerMenu.canItemQuickReplace(target, this.lastQuickMoved, true)) {
|
||||
this.slotClicked(target, target.index, event.button(), ContainerInput.QUICK_MOVE);
|
||||
}
|
||||
@@ -524,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)) {
|
||||
@@ -103,16 +103,16 @@
|
||||
this.slotClicked(slot, slotId, event.button(), ContainerInput.CLONE);
|
||||
} else {
|
||||
boolean quickKey = slotId != -999 && event.hasShiftDown();
|
||||
@@ -595,7 +_,7 @@
|
||||
public boolean keyPressed(final KeyEvent event) {
|
||||
if (super.keyPressed(event)) {
|
||||
@@ -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 {
|
||||
@@ -693,6 +_,13 @@
|
||||
}
|
||||
@@ -587,4 +_,11 @@
|
||||
|
||||
super.onClose();
|
||||
}
|
||||
@@ -123,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) {
|
||||
}
|
||||
+30
-38
@@ -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 oldContents = this.searchBox.getValue();
|
||||
@@ -405,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -407,7 +_,7 @@
|
||||
@Override
|
||||
public boolean keyPressed(final KeyEvent event) {
|
||||
this.ignoreTextInput = false;
|
||||
@@ -73,7 +73,7 @@
|
||||
if (this.minecraft.options.keyChat.matches(event)) {
|
||||
this.ignoreTextInput = true;
|
||||
this.selectTab(CreativeModeTabs.searchTab());
|
||||
@@ -441,6 +_,7 @@
|
||||
@@ -443,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void refreshSearchResults() {
|
||||
@@ -81,7 +81,7 @@
|
||||
this.menu.items.clear();
|
||||
this.visibleTags.clear();
|
||||
String searchTerm = this.searchBox.getValue();
|
||||
@@ -453,10 +_,10 @@
|
||||
@@ -455,10 +_,10 @@
|
||||
SearchTree<ItemStack> tree;
|
||||
if (searchTerm.startsWith("#")) {
|
||||
searchTerm = searchTerm.substring(1);
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
this.menu.items.addAll(tree.search(searchTerm.toLowerCase(Locale.ROOT)));
|
||||
@@ -484,7 +_,7 @@
|
||||
@@ -486,7 +_,7 @@
|
||||
@Override
|
||||
protected void extractLabels(final GuiGraphicsExtractor graphics, final int xm, final int ym) {
|
||||
if (selectedTab.showTitle()) {
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +_,7 @@
|
||||
@@ -496,7 +_,7 @@
|
||||
double xm = event.x() - this.leftPos;
|
||||
double ym = event.y() - this.topPos;
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
if (this.checkTabClicked(tab, xm, ym)) {
|
||||
return true;
|
||||
}
|
||||
@@ -516,7 +_,7 @@
|
||||
@@ -518,7 +_,7 @@
|
||||
double ym = event.y() - this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
if (this.checkTabClicked(tab, xm, ym)) {
|
||||
this.selectTab(tab);
|
||||
return true;
|
||||
@@ -610,13 +_,15 @@
|
||||
@@ -611,13 +_,15 @@
|
||||
this.originalSlots = null;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -679,7 +_,14 @@
|
||||
@@ -682,7 +_,14 @@
|
||||
this.effects.extractRenderState(graphics, mouseX, mouseY);
|
||||
super.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
if (this.checkTabHovering(graphics, tab, mouseX, mouseY)) {
|
||||
break;
|
||||
}
|
||||
@@ -701,7 +_,7 @@
|
||||
@@ -704,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(final ItemStack itemStack) {
|
||||
boolean isCreativeSlot = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean isSingleCategoryTab = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
@@ -163,16 +163,16 @@
|
||||
TooltipFlag.Default originalTooltipStyle = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipStyle = isCreativeSlot ? originalTooltipStyle.asCreative() : originalTooltipStyle;
|
||||
List<Component> originalLines = itemStack.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipStyle);
|
||||
@@ -722,7 +_,7 @@
|
||||
int i = 1;
|
||||
@@ -728,7 +_,7 @@
|
||||
int i = 1;
|
||||
|
||||
for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
- if (tab.getType() != CreativeModeTab.Type.SEARCH && tab.contains(itemStack)) {
|
||||
+ if (!tab.hasSearchBar() && tab.contains(itemStack)) {
|
||||
linesToDisplay.add(i++, tab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
|
||||
- if (tab.getType() != CreativeModeTab.Type.SEARCH && tab.contains(itemStack)) {
|
||||
+ if (!tab.hasSearchBar() && tab.contains(itemStack)) {
|
||||
linesToDisplay.add(i++, tab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
if (tab != selectedTab) {
|
||||
this.extractTabButton(graphics, mouseX, mouseY, tab);
|
||||
}
|
||||
@@ -770,6 +_,7 @@
|
||||
@@ -775,6 +_,7 @@
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprite, xscr, yscr + (int)((yscr2 - yscr - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
this.extractTabButton(graphics, mouseX, mouseY, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.extractEntityInInventoryFollowsMouse(
|
||||
@@ -779,7 +_,7 @@
|
||||
@@ -784,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(final CreativeModeTab tab) {
|
||||
@@ -198,7 +198,7 @@
|
||||
int spacing = 27;
|
||||
int x = 27 * pos;
|
||||
if (tab.isAlignedRight()) {
|
||||
@@ -791,7 +_,7 @@
|
||||
@@ -796,7 +_,7 @@
|
||||
|
||||
private int getTabY(final CreativeModeTab tab) {
|
||||
int y = 0;
|
||||
@@ -207,7 +207,7 @@
|
||||
y -= 32;
|
||||
} else {
|
||||
y += this.imageHeight;
|
||||
@@ -819,8 +_,8 @@
|
||||
@@ -824,8 +_,8 @@
|
||||
|
||||
protected void extractTabButton(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final CreativeModeTab tab) {
|
||||
boolean selected = tab == selectedTab;
|
||||
@@ -218,15 +218,7 @@
|
||||
int x = this.leftPos + this.getTabX(tab);
|
||||
int y = this.topPos - (isTop ? 28 : -(this.imageHeight - 4));
|
||||
Identifier[] sprites;
|
||||
@@ -834,6 +_,7 @@
|
||||
graphics.requestCursor(CursorTypes.POINTING_HAND);
|
||||
}
|
||||
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprites[Mth.clamp(pos, 0, sprites.length)], x, y, 26, 32);
|
||||
int iconX = x + 13 - 8;
|
||||
int iconY = y + 16 - 8 + (isTop ? 1 : -1);
|
||||
@@ -870,6 +_,14 @@
|
||||
@@ -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);
|
||||
|
||||
+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");
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -18,7 +_,7 @@
|
||||
return (ClientTooltipComponent)(switch (component) {
|
||||
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);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
@@ -372,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 relX = mouseX - this.getContentX();
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
@@ -122,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)
|
||||
@@ -132,7 +_,7 @@
|
||||
@@ -126,7 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, button -> {
|
||||
@@ -21,7 +21,7 @@
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
}).bounds(0, 0, 50, 20).createNarration(defaultNarrationSupplier -> Component.translatable("narrator.controls.reset", name)).build();
|
||||
this.refreshEntry();
|
||||
@@ -173,7 +_,8 @@
|
||||
@@ -167,7 +_,8 @@
|
||||
MutableComponent tooltip = Component.empty();
|
||||
if (!this.key.isUnbound()) {
|
||||
for (KeyMapping otherKey : KeyBindsList.this.minecraft.options.keyMappings) {
|
||||
|
||||
+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);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
@@ -66,7 +_,7 @@
|
||||
@@ -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);
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -174,6 +_,7 @@
|
||||
@@ -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;
|
||||
@@ -8,7 +8,7 @@
|
||||
WorldLoader.InitConfig loadConfig = createDefaultLoadConfig(vanillaOnlyPackRepository, dataConfig);
|
||||
CompletableFuture<WorldCreationContext> loadResult = WorldLoader.load(
|
||||
loadConfig,
|
||||
@@ -509,7 +_,7 @@
|
||||
@@ -512,7 +_,7 @@
|
||||
if (retry) {
|
||||
onAbort.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -623,6 +_,7 @@
|
||||
@@ -621,6 +_,7 @@
|
||||
if (dataPackDir != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(dataPackDir, this.packValidator);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
@@ -229,7 +_,7 @@
|
||||
@@ -239,7 +_,7 @@
|
||||
|
||||
public @Nullable PresetEditor getPresetEditor() {
|
||||
Holder<WorldPreset> preset = this.getWorldType().preset();
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
@@ -489,6 +_,8 @@
|
||||
@@ -495,6 +_,8 @@
|
||||
this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
|
||||
PackRepository packRepository = ServerPacksSource.createPackRepository(worldAccess);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
WorldStem worldStem;
|
||||
try {
|
||||
worldStem = this.loadWorldStem(worldAccess, levelDataTag, safeMode, packRepository);
|
||||
@@ -530,6 +_,8 @@
|
||||
@@ -537,6 +_,8 @@
|
||||
WorldData data = worldDataAndGenSettings.data();
|
||||
boolean oldCustomized = worldDataAndGenSettings.genSettings().options().isOldCustomizedWorld();
|
||||
boolean unstable = data.worldGenSettingsLifecycle() != Lifecycle.stable();
|
||||
@@ -18,7 +18,7 @@
|
||||
if (!oldCustomized && !unstable) {
|
||||
this.openWorldLoadBundledResourcePack(worldAccess, worldStem, packRepository, onCancel);
|
||||
} else {
|
||||
@@ -546,6 +_,8 @@
|
||||
@@ -553,6 +_,8 @@
|
||||
private void openWorldLoadBundledResourcePack(
|
||||
final LevelStorageSource.LevelStorageAccess worldAccess, final WorldStem worldStem, final PackRepository packRepository, final Runnable onCancel
|
||||
) {
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
@@ -84,6 +_,7 @@
|
||||
@@ -83,6 +_,7 @@
|
||||
private static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted");
|
||||
private static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join");
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -8,7 +8,7 @@
|
||||
private static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
|
||||
private static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
|
||||
private static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
|
||||
@@ -486,6 +_,19 @@
|
||||
@@ -483,6 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
@Override
|
||||
public Component getNarration() {
|
||||
Component entryNarration = Component.translatable(
|
||||
@@ -515,6 +_,7 @@
|
||||
@@ -512,6 +_,7 @@
|
||||
this.infoText.setPosition(textX, this.getContentY() + 9 + 9 + 3);
|
||||
this.infoText.extractRenderState(graphics, mouseX, mouseY, a);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32);
|
||||
+ renderExperimentalWarning(graphics, mouseX, mouseY, this.getContentY(), this.getContentX());
|
||||
if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && (this.minecraft.options.touchscreen().get() || hovered)) {
|
||||
if (this.list.entryType == WorldSelectionList.EntryType.SINGLEPLAYER && hovered) {
|
||||
graphics.fill(this.getContentX(), this.getContentY(), this.getContentX() + 32, this.getContentY() + 32, -1601138544);
|
||||
int relX = mouseX - this.getContentX();
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/main/Main.java
|
||||
+++ b/net/minecraft/client/main/Main.java
|
||||
@@ -114,8 +_,8 @@
|
||||
@@ -159,8 +_,8 @@
|
||||
CrashReport.preload();
|
||||
logger = LogUtils.getLogger();
|
||||
stage = "Bootstrap";
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
- public static enum ArmPose {
|
||||
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
|
||||
- public enum ArmPose {
|
||||
+ public enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
|
||||
EMPTY(false, false),
|
||||
ITEM(false, false),
|
||||
BLOCK(false, false),
|
||||
@@ -523,10 +_,29 @@
|
||||
private ArmPose(final boolean twoHanded, final boolean affectsOffhandPose) {
|
||||
ArmPose(final boolean twoHanded, final boolean affectsOffhandPose) {
|
||||
this.twoHanded = twoHanded;
|
||||
this.affectsOffhandPose = affectsOffhandPose;
|
||||
+ this.forgeArmPose = null;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -569,6 +_,7 @@
|
||||
result.put(ModelLayers.createHangingSignModelName(woodType, attachmentType), hangingSignModel);
|
||||
}
|
||||
});
|
||||
@@ -557,6 +_,7 @@
|
||||
result.put(ModelLayers.PALE_OAK_CHEST_BOAT, chestBoatModel);
|
||||
result.put(ModelLayers.MANGROVE_BOAT, boatModel);
|
||||
result.put(ModelLayers.MANGROVE_CHEST_BOAT, chestBoatModel);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(result);
|
||||
ImmutableMap<ModelLayerLocation, LayerDefinition> definitions = result.build();
|
||||
List<ModelLayerLocation> missingDefinitions = ModelLayers.getKnownLocations().filter(l -> !definitions.containsKey(l)).toList();
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
@@ -75,6 +_,8 @@
|
||||
this.writeProfileKeyPair(fetchedKeyPair);
|
||||
return Optional.ofNullable(fetchedKeyPair);
|
||||
} catch (CryptException | MinecraftClientException | IOException var3) {
|
||||
} catch (IOException | CryptException | MinecraftClientException e) {
|
||||
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
|
||||
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE)
|
||||
LOGGER.error("Failed to retrieve profile key pair", (Throwable)var3);
|
||||
LOGGER.error("Failed to retrieve profile key pair", e);
|
||||
this.writeProfileKeyPair(null);
|
||||
return cachedKeyPair;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
|
||||
@@ -65,6 +_,7 @@
|
||||
@@ -64,6 +_,7 @@
|
||||
int index = this.storage.getIndex(pos.x(), pos.z());
|
||||
LevelChunk currentChunk = this.storage.getChunk(index);
|
||||
if (isValidChunk(currentChunk, pos.x(), pos.z())) {
|
||||
@@ -9,10 +9,10 @@
|
||||
}
|
||||
}
|
||||
@@ -124,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.level.onChunkLoaded(pos);
|
||||
+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(chunk, false));
|
||||
return chunk;
|
||||
}
|
||||
|
||||
this.level.onChunkLoaded(pos);
|
||||
+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(chunk, false));
|
||||
return chunk;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
@@ -148,6 +_,7 @@
|
||||
}));
|
||||
}
|
||||
@@ -144,6 +_,7 @@
|
||||
}
|
||||
}));
|
||||
}
|
||||
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
@@ -209,6 +_,7 @@
|
||||
@@ -211,6 +_,7 @@
|
||||
Component title = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
|
||||
if (this.serverData != null && this.serverData.isRealm()) {
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, title, details.reason(), CommonComponents.GUI_BACK));
|
||||
this.minecraft.gui.setScreen(new DisconnectedScreen(this.parent, title, details.reason(), CommonComponents.GUI_BACK));
|
||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, details.reason())) {
|
||||
} else {
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, title, details));
|
||||
this.minecraft.gui.setScreen(new DisconnectedScreen(this.parent, title, details));
|
||||
}
|
||||
@@ -233,6 +_,7 @@
|
||||
@@ -235,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomQuery(final ClientboundCustomQueryPacket packet) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
||||
@@ -150,6 +_,7 @@
|
||||
@@ -165,6 +_,7 @@
|
||||
cache.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
||||
cache.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
|
||||
cache.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.WATER_COLOR_RESOLVER)));
|
||||
@@ -8,8 +8,8 @@
|
||||
});
|
||||
private final ClientChunkCache chunkSource;
|
||||
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
|
||||
@@ -161,6 +_,8 @@
|
||||
private final EnvironmentAttributeSystem environmentAttributes;
|
||||
@@ -178,6 +_,8 @@
|
||||
private final Long2ObjectMap<SortedSet<BlockDestructionProgress>> destructionProgress = new Long2ObjectOpenHashMap<>();
|
||||
private final int seaLevel;
|
||||
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
|
||||
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
public void handleBlockChangedAck(final int sequence) {
|
||||
if (SharedConstants.DEBUG_BLOCK_BREAK) {
|
||||
@@ -243,6 +_,8 @@
|
||||
@@ -260,6 +_,8 @@
|
||||
this.serverSimulationDistance = serverSimulationDistance;
|
||||
this.environmentAttributes = this.addEnvironmentAttributeLayers(EnvironmentAttributeSystem.builder()).build();
|
||||
this.updateSkyBrightness();
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
private EnvironmentAttributeSystem.Builder addEnvironmentAttributeLayers(final EnvironmentAttributeSystem.Builder environmentAttributes) {
|
||||
@@ -352,6 +_,7 @@
|
||||
@@ -471,6 +_,7 @@
|
||||
entity.setOldPosAndRot();
|
||||
entity.tickCount++;
|
||||
Profiler.get().push(entity.typeHolder()::getRegisteredName);
|
||||
@@ -34,7 +34,7 @@
|
||||
entity.tick();
|
||||
Profiler.get().pop();
|
||||
|
||||
@@ -412,8 +_,10 @@
|
||||
@@ -527,8 +_,10 @@
|
||||
}
|
||||
|
||||
public void addEntity(final Entity entity) {
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
public void removeEntity(final int id, final Entity.RemovalReason reason) {
|
||||
@@ -576,8 +_,10 @@
|
||||
@@ -692,8 +_,10 @@
|
||||
final float pitch,
|
||||
final long seed
|
||||
) {
|
||||
@@ -57,7 +57,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,8 +_,10 @@
|
||||
@@ -707,8 +_,10 @@
|
||||
final float pitch,
|
||||
final long seed
|
||||
) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -946,7 +_,7 @@
|
||||
@@ -1081,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void addDestroyBlockEffect(final BlockPos pos, final BlockState blockState) {
|
||||
@@ -78,7 +78,7 @@
|
||||
VoxelShape shape = blockState.getShape(this, pos);
|
||||
double density = 0.25;
|
||||
shape.forAllBoxes(
|
||||
@@ -973,6 +_,7 @@
|
||||
@@ -1108,6 +_,7 @@
|
||||
new TerrainParticle(
|
||||
this, pos.getX() + x, pos.getY() + y, pos.getZ() + z, relX - 0.5, relY - 0.5, relZ - 0.5, blockState, pos
|
||||
)
|
||||
@@ -86,7 +86,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -982,6 +_,13 @@
|
||||
@@ -1117,6 +_,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
public void addBreakingBlockEffect(final BlockPos pos, final Direction direction) {
|
||||
BlockState blockState = this.getBlockState(pos);
|
||||
if (blockState.getRenderShape() != RenderShape.INVISIBLE && blockState.shouldSpawnTerrainParticles()) {
|
||||
@@ -1017,7 +_,7 @@
|
||||
@@ -1152,7 +_,7 @@
|
||||
xp = x + shape.maxX + 0.1F;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1083,6 +_,16 @@
|
||||
@@ -1218,6 +_,16 @@
|
||||
this.explosionTracker.track(center, radius, blockCount, blockParticles);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class ClientLevelData implements WritableLevelData {
|
||||
private final boolean hardcore;
|
||||
@@ -1138,6 +_,7 @@
|
||||
@@ -1273,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setDifficulty(final Difficulty difficulty) {
|
||||
@@ -134,7 +134,7 @@
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
@@ -1185,6 +_,12 @@
|
||||
@@ -1315,6 +_,12 @@
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(final Entity entity) {
|
||||
@@ -1197,6 +_,15 @@
|
||||
@@ -1327,6 +_,15 @@
|
||||
ClientLevel.this.dragonParts.removeAll(Arrays.asList(dragon.getSubEntities()));
|
||||
break;
|
||||
default:
|
||||
|
||||
+11
-11
@@ -2,13 +2,13 @@
|
||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
@@ -531,6 +_,7 @@
|
||||
this.debugSubscriber.clear();
|
||||
this.minecraft.levelRenderer.debugRenderer.refreshRendererList();
|
||||
this.minecraft.levelExtractor.debugRenderer.refreshRendererList();
|
||||
this.minecraft.player.resetPos();
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerLogin(this.minecraft.gameMode, this.minecraft.player, this.minecraft.getConnection().connection);
|
||||
this.minecraft.player.setId(packet.playerId());
|
||||
this.level.addEntity(this.minecraft.player);
|
||||
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1325,6 +_,8 @@
|
||||
@@ -1323,6 +_,8 @@
|
||||
newPlayer.getAttributes().assignBaseValues(oldPlayer.getAttributes());
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
this.level.addEntity(newPlayer);
|
||||
newPlayer.input = new KeyboardInput(this.minecraft.options);
|
||||
this.minecraft.gameMode.adjustPlayer(newPlayer);
|
||||
@@ -1480,7 +_,7 @@
|
||||
@@ -1478,7 +_,7 @@
|
||||
ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(blockEntity.problemPath(), LOGGER);
|
||||
|
||||
try {
|
||||
- blockEntity.loadWithComponents(TagValueInput.create(reporter, this.registryAccess, packet.getTag()));
|
||||
+ blockEntity.onDataPacket(connection, TagValueInput.create(reporter, this.registryAccess, packet.getTag()), this.registryAccess);
|
||||
} catch (Throwable var7) {
|
||||
} catch (Throwable t$) {
|
||||
try {
|
||||
reporter.close();
|
||||
@@ -1687,7 +_,9 @@
|
||||
@@ -1686,7 +_,9 @@
|
||||
@Override
|
||||
public void handleCommands(final ClientboundCommandsPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.minecraft.packetProcessor());
|
||||
@@ -37,15 +37,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1788,6 +_,7 @@
|
||||
if (this.minecraft.screen instanceof RecipeUpdateListener updateListener) {
|
||||
@@ -1787,6 +_,7 @@
|
||||
if (this.minecraft.gui.screen() instanceof RecipeUpdateListener updateListener) {
|
||||
updateListener.recipesUpdated();
|
||||
}
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRecipesUpdated(recipeBook);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1832,6 +_,8 @@
|
||||
@@ -1830,6 +_,8 @@
|
||||
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
|
||||
List<ItemStack> searchItems = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
||||
this.searchTrees.updateCreativeTags(searchItems);
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2650,7 +_,9 @@
|
||||
@@ -2652,7 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
Instant timeStamp = Instant.now();
|
||||
long salt = Crypt.SaltSupplier.getLong();
|
||||
LastSeenMessagesTracker.Update lastSeenUpdate = this.lastSeenMessages.generateAndApplyUpdate();
|
||||
@@ -2659,6 +_,7 @@
|
||||
@@ -2661,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sendCommand(final String command) {
|
||||
@@ -73,7 +73,7 @@
|
||||
SignableCommand<ClientSuggestionProvider> signableCommand = SignableCommand.of(this.commands.parse(command, this.suggestionsProvider));
|
||||
if (signableCommand.arguments().isEmpty()) {
|
||||
this.send(new ServerboundChatCommandPacket(command));
|
||||
@@ -2675,6 +_,7 @@
|
||||
@@ -2677,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sendUnattendedCommand(final String command, final @Nullable Screen screenAfterCommand) {
|
||||
|
||||
+124
-114
@@ -1,61 +1,25 @@
|
||||
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
@@ -114,6 +_,7 @@
|
||||
@@ -115,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean destroyBlock(final BlockPos pos) {
|
||||
+ if (minecraft.player.getMainHandItem().onBlockStartBreak(pos, minecraft.player)) return false;
|
||||
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, pos, this.localPlayerMode)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -128,9 +_,8 @@
|
||||
} else if (oldState.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
- oldBlock.playerWillDestroy(level, pos, oldState, this.minecraft.player);
|
||||
FluidState fluidState = level.getFluidState(pos);
|
||||
- boolean changed = level.setBlock(pos, fluidState.createLegacyBlock(), 11);
|
||||
+ boolean changed = oldState.onDestroyedByPlayer(level, pos, minecraft.player, false, fluidState);
|
||||
if (changed) {
|
||||
oldBlock.destroy(level, pos, oldState);
|
||||
}
|
||||
@@ -159,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
@@ -134,9 +_,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK))
|
||||
this.destroyBlock(pos);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -172,6 +_,7 @@
|
||||
this.connection
|
||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, direction));
|
||||
}
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK);
|
||||
|
||||
BlockState state = this.minecraft.level.getBlockState(pos);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, 0.0F);
|
||||
@@ -182,9 +_,11 @@
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
boolean notAir = !state.isAir();
|
||||
if (notAir && this.destroyProgress == 0.0F) {
|
||||
+ if (event != null && !event.getUseBlock().isDenied())
|
||||
state.attack(this.minecraft.level, pos, this.minecraft.player);
|
||||
}
|
||||
|
||||
+ if (event != null && !event.getUseItem().isDenied()) {
|
||||
if (notAir && state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos) >= 1.0F) {
|
||||
this.destroyBlock(pos);
|
||||
} else {
|
||||
@@ -195,6 +_,7 @@
|
||||
this.destroyTicks = 0.0F;
|
||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||
}
|
||||
+ }
|
||||
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -235,6 +_,7 @@
|
||||
- oldBlock.playerWillDestroy(level, pos, oldState, this.minecraft.player);
|
||||
FluidState fluidState = level.getFluidState(pos);
|
||||
- boolean changed = level.setBlock(pos, fluidState.createLegacyBlock(), 11);
|
||||
+ boolean changed = oldState.onDestroyedByPlayer(level, pos, minecraft.player, false, fluidState);
|
||||
if (changed) {
|
||||
oldBlock.destroy(level, pos, oldState);
|
||||
}
|
||||
@@ -165,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
@@ -63,24 +27,68 @@
|
||||
this.destroyBlock(pos);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -247,7 +_,7 @@
|
||||
} else {
|
||||
this.destroyProgress = this.destroyProgress + state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos);
|
||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||
- SoundType soundType = state.getSoundType();
|
||||
+ SoundType soundType = state.getSoundType(this.minecraft.level, pos, this.minecraft.player);
|
||||
this.minecraft
|
||||
.getSoundManager()
|
||||
.play(
|
||||
@@ -264,6 +_,7 @@
|
||||
@@ -178,6 +_,7 @@
|
||||
this.connection
|
||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, direction));
|
||||
}
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK);
|
||||
|
||||
this.destroyTicks++;
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||
BlockState state = this.minecraft.level.getBlockState(pos);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, 0.0F);
|
||||
@@ -188,9 +_,11 @@
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
boolean notAir = !state.isAir();
|
||||
if (notAir && this.destroyProgress == 0.0F) {
|
||||
+ if (event != null && !event.getUseBlock().isDenied())
|
||||
state.attack(this.minecraft.level, pos, this.minecraft.player);
|
||||
}
|
||||
|
||||
+ if (event != null && !event.getUseItem().isDenied()) {
|
||||
if (notAir && state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos) >= 1.0F) {
|
||||
this.destroyBlock(pos);
|
||||
} else {
|
||||
@@ -201,6 +_,7 @@
|
||||
this.destroyTicks = 0.0F;
|
||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||
}
|
||||
+ }
|
||||
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -242,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK))
|
||||
this.destroyBlock(pos);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -255,7 +_,7 @@
|
||||
|
||||
this.destroyProgress = this.destroyProgress + state.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), pos);
|
||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||
- SoundType soundType = state.getSoundType();
|
||||
+ SoundType soundType = state.getSoundType(this.minecraft.level, pos, this.minecraft.player);
|
||||
this.minecraft
|
||||
.getSoundManager()
|
||||
.play(
|
||||
@@ -272,6 +_,7 @@
|
||||
|
||||
this.destroyTicks++;
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, pos, state, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onLeftClickBlockHold(this.minecraft.player, pos, direction).getUseItem().isDenied()) return true;
|
||||
if (this.destroyProgress >= 1.0F) {
|
||||
this.isDestroying = false;
|
||||
if (SharedConstants.DEBUG_BLOCK_BREAK) {
|
||||
@@ -306,7 +_,7 @@
|
||||
if (this.destroyProgress >= 1.0F) {
|
||||
this.isDestroying = false;
|
||||
if (SharedConstants.DEBUG_BLOCK_BREAK) {
|
||||
@@ -279,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.startPrediction(this.minecraft.level, sequence -> {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, pos, direction, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK))
|
||||
this.destroyBlock(pos);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, direction, sequence);
|
||||
});
|
||||
@@ -313,7 +_,7 @@
|
||||
|
||||
private boolean sameDestroyTarget(final BlockPos pos) {
|
||||
ItemStack selected = this.minecraft.player.getMainHandItem();
|
||||
@@ -89,7 +97,7 @@
|
||||
}
|
||||
|
||||
private void ensureHasSentCarriedItem() {
|
||||
@@ -334,12 +_,23 @@
|
||||
@@ -341,13 +_,24 @@
|
||||
private InteractionResult performUseItemOn(final LocalPlayer player, final InteractionHand hand, final BlockHitResult blockHit) {
|
||||
BlockPos pos = blockHit.getBlockPos();
|
||||
ItemStack itemStack = player.getItemInHand(hand);
|
||||
@@ -99,58 +107,60 @@
|
||||
+ }
|
||||
if (this.localPlayerMode == GameType.SPECTATOR) {
|
||||
return InteractionResult.CONSUME;
|
||||
} else {
|
||||
- boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
+ UseOnContext context = new UseOnContext(player, hand, blockHit);
|
||||
+ if (!event.getUseItem().isDenied()) {
|
||||
+ InteractionResult result = itemStack.onItemUseFirst(context);
|
||||
+ if (result != InteractionResult.PASS) {
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+ boolean haveSomethingInOurHands = !player.getMainHandItem().doesSneakBypassUse(player.level(), pos, player) || !player.getOffhandItem().doesSneakBypassUse(player.level(), pos, player);
|
||||
boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands;
|
||||
- if (!suppressUsingBlock) {
|
||||
+ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !suppressUsingBlock)) {
|
||||
BlockState blockState = this.minecraft.level.getBlockState(pos);
|
||||
if (!this.connection.isFeatureEnabled(blockState.getBlock().requiredFeatures())) {
|
||||
return InteractionResult.FAIL;
|
||||
@@ -358,8 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
+ UseOnContext context = new UseOnContext(player, hand, blockHit);
|
||||
+ if (!event.getUseItem().isDenied()) {
|
||||
+ InteractionResult result = itemStack.onItemUseFirst(context);
|
||||
+ if (result != InteractionResult.PASS) {
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+ boolean haveSomethingInOurHands = !player.getMainHandItem().doesSneakBypassUse(player.level(), pos, player) || !player.getOffhandItem().doesSneakBypassUse(player.level(), pos, player);
|
||||
boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands;
|
||||
- if (!suppressUsingBlock) {
|
||||
+ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !suppressUsingBlock)) {
|
||||
BlockState blockState = this.minecraft.level.getBlockState(pos);
|
||||
if (!this.connection.isFeatureEnabled(blockState.getBlock().requiredFeatures())) {
|
||||
return InteractionResult.FAIL;
|
||||
@@ -366,8 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack)) {
|
||||
- UseOnContext context = new UseOnContext(player, hand, blockHit);
|
||||
+ if (event.getUseItem().isDenied()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ if (event.getUseItem().isAllowed() || (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack))) {
|
||||
InteractionResult success;
|
||||
if (player.hasInfiniteMaterials()) {
|
||||
int count = itemStack.getCount();
|
||||
@@ -398,6 +_,12 @@
|
||||
return packet;
|
||||
}
|
||||
|
||||
- if (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack)) {
|
||||
- UseOnContext context = new UseOnContext(player, hand, blockHit);
|
||||
+ if (event.getUseItem().isDenied()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem(player, hand);
|
||||
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem.BUS.post(event)) {
|
||||
+ interactionResult.setValue(event.getCancellationResult());
|
||||
+ return packet;
|
||||
+ }
|
||||
+ if (event.getUseItem().isAllowed() || (!itemStack.isEmpty() && !player.getCooldowns().isOnCooldown(itemStack))) {
|
||||
InteractionResult success;
|
||||
if (player.hasInfiniteMaterials()) {
|
||||
int count = itemStack.getCount();
|
||||
@@ -389,6 +_,11 @@
|
||||
interactionResult.setValue(InteractionResult.PASS);
|
||||
return packet;
|
||||
} else {
|
||||
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem(player, hand);
|
||||
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem.BUS.post(event)) {
|
||||
+ interactionResult.setValue(event.getCancellationResult());
|
||||
+ return packet;
|
||||
+ }
|
||||
InteractionResult resultHolder = itemStack.use(this.minecraft.level, player, hand);
|
||||
ItemStack result;
|
||||
if (resultHolder instanceof InteractionResult.Success success) {
|
||||
@@ -399,6 +_,9 @@
|
||||
+
|
||||
InteractionResult resultHolder = itemStack.use(this.minecraft.level, player, hand);
|
||||
ItemStack result;
|
||||
if (resultHolder instanceof InteractionResult.Success success) {
|
||||
@@ -408,6 +_,9 @@
|
||||
|
||||
if (result != itemStack) {
|
||||
player.setItemInHand(hand, result);
|
||||
+ if (result.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemStack, hand);
|
||||
+ }
|
||||
}
|
||||
if (result != itemStack) {
|
||||
player.setItemInHand(hand, result);
|
||||
+ if (result.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemStack, hand);
|
||||
+ }
|
||||
}
|
||||
|
||||
interactionResult.setValue(resultHolder);
|
||||
@@ -434,6 +_,10 @@
|
||||
interactionResult.setValue(resultHolder);
|
||||
@@ -445,6 +_,10 @@
|
||||
this.ensureHasSentCarriedItem();
|
||||
Vec3 location = hitResult.getLocation().subtract(entity.getX(), entity.getY(), entity.getZ());
|
||||
this.connection.send(new ServerboundInteractPacket(entity.getId(), hand, location, player.isShiftKeyDown()));
|
||||
@@ -158,6 +168,6 @@
|
||||
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, location);
|
||||
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific.BUS.post(event)) return event.getCancellationResult();
|
||||
+ }
|
||||
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : player.interactOn(entity, hand, location));
|
||||
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : player.interactOn(entity, hand, location);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
+++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
@@ -123,6 +_,7 @@
|
||||
@@ -118,6 +_,7 @@
|
||||
onPersistentDataChange.run();
|
||||
}
|
||||
});
|
||||
@@ -8,12 +8,12 @@
|
||||
this.pingStart = Util.getMillis();
|
||||
connection.send(new ServerboundPingRequestPacket(this.pingStart));
|
||||
this.success = true;
|
||||
@@ -179,7 +_,7 @@
|
||||
@@ -174,7 +_,7 @@
|
||||
private void pingLegacyServer(
|
||||
final InetSocketAddress resolvedAddress, final ServerAddress rawAddress, final ServerData data, final EventLoopGroupHolder eventLoopGroupHolder
|
||||
) {
|
||||
- new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup()).handler(new ChannelInitializer<Channel>() {
|
||||
+ new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup(true)).handler(new ChannelInitializer<Channel>() {
|
||||
{
|
||||
Objects.requireNonNull(ServerStatusPinger.this);
|
||||
}
|
||||
@Override
|
||||
protected void initChannel(final Channel channel) {
|
||||
try {
|
||||
Loaded 100 of 697 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user