diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cab1eaee47..ea7d5307b8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Publish on: push: - branches: [ '26.1.2' ] + branches: [ '26.2' ] permissions: contents: read diff --git a/build.gradle b/build.gradle index a16064a6b9..d99a97e636 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ ext { } changelog { - from '64.0' + from '65.0' } tasks.register('setup') { diff --git a/docs/README.md b/docs/README.md index 1827460387..aa34bcb471 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,8 +2,8 @@ MinecraftForge ============= -[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.21.11-&query=$.promos["1.21.11-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download] -[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=26.1.2-&query=$.promos["26.1.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo= +[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=26.1.2-&query=$.promos["26.1.2-latest"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download] +[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=26.2-&query=$.promos["26.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo= )][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon] Forge is a free, open-source modding API all of your favourite mods use! diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java b/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java index 18bc69f54f..d17eaedb7b 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java @@ -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 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 reportGenerator) - { - registerCrashCallable(new ISystemReportExtender() - { + public static void registerCrashCallable(String headerName, Supplier 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 reportGenerator, BooleanSupplier active) - { - registerCrashCallable(new ISystemReportExtender() - { + public static void registerCrashCallable(String headerName, Supplier 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 allCrashCallables() - { + public static List allCrashCallables() { return List.copyOf(crashCallables); } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java b/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java index e533be752b..e39d9d069e 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ISystemReportExtender.java @@ -7,12 +7,10 @@ package net.minecraftforge.fml; import java.util.function.Supplier; -public interface ISystemReportExtender extends Supplier -{ +public interface ISystemReportExtender extends Supplier { String getLabel(); - default boolean isActive() - { + default boolean isActive() { return true; } } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java index b4a1ea8c69..8c453fda1c 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java @@ -53,7 +53,7 @@ public abstract class ModContainer { Supplier 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 diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java index e8629be1bb..f6be23d2d1 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -379,8 +379,8 @@ public final class ModLoader { @SuppressWarnings("removal") public static 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) ); } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java index ed7347c61e..bba28748b7 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java @@ -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; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java index 704a707113..683b5d92ba 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModStateTransitionHelper.java @@ -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 CompletableFuture 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); diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java b/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java index fe03dcc582..8a3c9a7347 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ThreadSelector.java @@ -9,8 +9,8 @@ import java.util.concurrent.Executor; import java.util.function.BinaryOperator; public enum ThreadSelector implements BinaryOperator { - SYNC((sync, parallel) -> sync), - PARALLEL((sync, parallel) -> parallel); + SYNC((sync, _) -> sync), + PARALLEL((_, parallel) -> parallel); private final BinaryOperator selector; diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java index dcce18700b..bb2f2f5670 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/ModConfig.java @@ -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 { diff --git a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java index 68895f3298..e0cd43e72c 100644 --- a/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java +++ b/fmlearlydisplay/src/main/java/net/minecraftforge/fml/earlydisplay/RenderElement.java @@ -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) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java index 1530f6b575..414dee68e3 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java @@ -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); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java index 4f72460375..327279e890 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLEnvironment.java @@ -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 { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java index f5b2258d1f..fd74cf0698 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java @@ -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); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java index ca908d0470..201aca6de4 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java @@ -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; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java index fe3e595b06..d0d90d22cb 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MavenCoordinateResolver.java @@ -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. diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java index 195719ee5b..bf40fc6492 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/StringUtils.java @@ -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; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java index 3435993791..da25929206 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java @@ -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 { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java index b795a82033..faed16a26c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java @@ -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 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); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java index 8d6cd490da..7e84195398 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModIdentifier.java @@ -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> ident; @@ -51,7 +51,7 @@ public enum InvalidModIdentifier { private static BiPredicate> 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 Optional optionalFromException(Supplier_WithExceptions supp) diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java index c2e497621e..38e5b0c083 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java @@ -145,7 +145,7 @@ public class JarInJarDependencyLocator extends AbstractModProvider implements ID var ids = new TreeMap>(); 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()) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java index 5a3aeccbdd..b2ffbfd22c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java @@ -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); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java index e9a8cfc597..5008e0d80b 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java @@ -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; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java index 2e714d5ed1..6bd30c47db 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/StartupNotificationManager.java @@ -56,7 +56,7 @@ public class StartupNotificationManager { private synchronized static void addMessage(Message.MessageType type, String message, int maxSize) { EnumMap> newMessages = new EnumMap<>(messages); - newMessages.compute(type, (key, existingList) -> { + newMessages.compute(type, (_, existingList) -> { List newList = new ArrayList<>(); if (existingList != null) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java index 570b6a680f..b9dc6ef946 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java @@ -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; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java index 1ab63857e5..7b9d067940 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ForgeDevLocator.java @@ -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) { diff --git a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java index 5f5df8e829..113dac1e5c 100644 --- a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java +++ b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/FieldToMethodTransformer.java @@ -126,7 +126,7 @@ record FieldToMethodTransformer(String className, Map 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); diff --git a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java index dfa92c5f46..c87b3f9dbb 100644 --- a/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java +++ b/forge-transformers/src/main/java/net/minecraftforge/forge/transformers/MethodRedirector.java @@ -41,7 +41,7 @@ record MethodRedirector() implements ITransformer { "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", diff --git a/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json b/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json index 8355662f9a..c2ed16258c 100644 --- a/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json +++ b/forge-transformers/src/main/resources/coremods/finalize_spawn_targets.json @@ -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;" ] }, { diff --git a/gradle.properties b/gradle.properties index 8f274a471c..fb411878ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java index 49bbeb9d46..6bc2b2e139 100644 --- a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java +++ b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java @@ -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); }; } diff --git a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java index 0f5dcb950f..f39666fd40 100644 --- a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java +++ b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModLanguageProvider.java @@ -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); }; } diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch index 2c728bacba..8ef6350531 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlCommandEncoder.java.patch @@ -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); diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch index e025fc1df7..19c0803e0c 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlConst.java.patch @@ -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; diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch index 9dcd24218d..5f5f2a7781 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlDebug.java.patch @@ -15,7 +15,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final int CIRCULAR_LOG_SIZE = 10; private final Queue MESSAGE_BUFFER = EvictingQueue.create(10); -@@ -103,6 +_,8 @@ +@@ -83,6 +_,8 @@ } LOGGER.info("OpenGL debug message: {}", entry); @@ -24,21 +24,21 @@ } public List 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); + } diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch index ddcc82b13f..6700394d6b 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlDevice.java.patch @@ -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 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 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 { diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch index 4605f091f5..11e9b24586 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlStateManager.java.patch @@ -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; + } diff --git a/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch b/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch index 0c0efb4678..a46d2a3d47 100644 --- a/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/opengl/GlTexture.java.patch @@ -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(); } diff --git a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 1821e02f6e..0c3e099fc8 100644 --- a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -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; diff --git a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch index 1da5502ab9..e7a00bd35a 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch @@ -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) { diff --git a/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch b/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch index 4ef186d362..056d0582eb 100644 --- a/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/systems/GpuDevice.java.patch @@ -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 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) { diff --git a/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch b/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch index 457ba3d3a0..d39e0b3864 100644 --- a/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/systems/GpuDeviceBackend.java.patch @@ -1,20 +1,18 @@ --- a/com/mojang/blaze3d/systems/GpuDeviceBackend.java +++ b/com/mojang/blaze3d/systems/GpuDeviceBackend.java -@@ -30,9 +_,19 @@ - @Nullable Supplier label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels +@@ -32,7 +_,17 @@ + @Nullable Supplier label, @GpuTexture.Usage int usage, GpuFormat format, int width, int height, int depthOrLayers, int mipLevels ); -+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */ -+ default GpuTexture createTexture(@Nullable Supplier label, @GpuTexture.Usage final int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, boolean stencil) { ++ /** Forge: same as {@link #createTexture(Supplier, int, GpuFormat, int, int, int)} but with stencil support */ ++ default GpuTexture createTexture(@Nullable Supplier 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); + } diff --git a/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch b/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch index 77b6b38a95..e1acf98c71 100644 --- a/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/textures/GpuTexture.java.patch @@ -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) diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch index 71a66ec7e9..d181b3f0bb 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch @@ -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 elementValues; + private final com.google.common.collect.ImmutableMap elementMapping; - private VertexFormat(final List elements, final List 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 elements, final int vertexSize, final int stepRate) { + this.vertexSize = vertexSize; +@@ -29,6 +_,11 @@ } + + this.elementValues = elements; + -+ ImmutableMap.Builder 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.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 getElementMapping() { return elementMapping; } -+ public int getOffset(int index) { return offsetsByElement[index]; } ++ public com.google.common.collect.ImmutableMap getElementMapping() { return elementMapping; } @OnlyIn(Dist.CLIENT) public static class Builder { diff --git a/patches/minecraft/com/mojang/math/Transformation.java.patch b/patches/minecraft/com/mojang/math/Transformation.java.patch index dbb6774e63..a08cc0d2b5 100644 --- a/patches/minecraft/com/mojang/math/Transformation.java.patch +++ b/patches/minecraft/com/mojang/math/Transformation.java.patch @@ -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(); + } diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index 8956112e2d..f7cb1fe45c 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -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); diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch index 84348ff3a8..fc1e5576c9 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/CrashReport.java.patch b/patches/minecraft/net/minecraft/CrashReport.java.patch index 7315552858..cbf30e33e5 100644 --- a/patches/minecraft/net/minecraft/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/CrashReport.java.patch @@ -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 extraComments) { + private static Throwable copyProperties(final Throwable original, final Throwable copy) { diff --git a/patches/minecraft/net/minecraft/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/CrashReportCategory.java.patch index 1adddf7dcd..c6cf02d013 100644 --- a/patches/minecraft/net/minecraft/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/CrashReportCategory.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/SharedConstants.java.patch b/patches/minecraft/net/minecraft/SharedConstants.java.patch index a22540af53..661c3eada0 100644 --- a/patches/minecraft/net/minecraft/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/SharedConstants.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -216,6 +_,7 @@ +@@ -218,6 +_,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch index 4c5e4fafa5..ededdcc34c 100644 --- a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch +++ b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch @@ -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 output, final String name) { diff --git a/patches/minecraft/net/minecraft/client/Camera.java.patch b/patches/minecraft/net/minecraft/client/Camera.java.patch index 47f39b96a9..2b21b2469f 100644 --- a/patches/minecraft/net/minecraft/client/Camera.java.patch +++ b/patches/minecraft/net/minecraft/client/Camera.java.patch @@ -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; diff --git a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch index 345782f4c3..ef8d086d33 100644 --- a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch index d25a7a62fc..121ab8fa48 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 7ae0e21049..1986a3b198 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -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(() -> 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(() -> 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) { diff --git a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch index bcbd48a913..7be4daacb7 100644 --- a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch @@ -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; diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index c06d1f0058..165bac1558 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -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 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(); 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))); diff --git a/patches/minecraft/net/minecraft/client/Screenshot.java.patch b/patches/minecraft/net/minecraft/client/Screenshot.java.patch index cce47db65c..b5df8b3e6a 100644 --- a/patches/minecraft/net/minecraft/client/Screenshot.java.patch +++ b/patches/minecraft/net/minecraft/client/Screenshot.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch b/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch index 3d412eead5..bc85a58c04 100644 --- a/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch +++ b/patches/minecraft/net/minecraft/client/data/models/ItemModelGenerators.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch b/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch index e0dd6d0676..ddd4b0600a 100644 --- a/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch +++ b/patches/minecraft/net/minecraft/client/data/models/ModelProvider.java.patch @@ -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 missingDefinitions = BuiltInRegistries.ITEM - .listElements() diff --git a/patches/minecraft/net/minecraft/client/gui/Font.java.patch b/patches/minecraft/net/minecraft/client/gui/Font.java.patch index 55ffbfcb53..1749a11c05 100644 --- a/patches/minecraft/net/minecraft/client/gui/Font.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Font.java.patch @@ -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) diff --git a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch index dba9af4ad4..8aeebcebc3 100644 --- a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch @@ -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 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--; + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch index 4d5898a6c8..3f0f48e0ba 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiGraphicsExtractor.java.patch @@ -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 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 lines, final int xo, final int yo) { @@ -88,7 +88,7 @@ } public void setComponentTooltipForNextFrame(final Font font, final List 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()); diff --git a/patches/minecraft/net/minecraft/client/gui/Hud.java.patch b/patches/minecraft/net/minecraft/client/gui/Hud.java.patch new file mode 100644 index 0000000000..52f4edb8f3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/Hud.java.patch @@ -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 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--; diff --git a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch index 7fa0c6a30d..a836cbc212 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch @@ -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; } diff --git a/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch index aa89778180..99351df883 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch @@ -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; + } diff --git a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch index 6b3471dc2e..c24fc060da 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastManager.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch index 17ad64af07..3a38a98fa3 100644 --- a/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/render/GuiRenderer.java.patch @@ -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)pictureInPictureRenderer.getRenderStateClass(), pictureInPictureRenderer); } -+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, bufferSource, builder); ++ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(pictureInPictureRenderers, builder); this.pictureInPictureRenderers = builder.buildOrThrow(); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch index 2458106002..44572e9d4b 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/ChatScreen.java.patch @@ -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(""); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch index 06989a69b4..cc71b72a4e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/ConnectScreen.java.patch @@ -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( diff --git a/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch index 7ee979b614..a63c4a7bd0 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch @@ -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()); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch index d78d0a9314..7e40bbe1dc 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/PauseScreen.java.patch @@ -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( diff --git a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch index acf649d56d..9ec2c33b30 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch @@ -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 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 files) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch index 6bea4f3d44..e4a863df35 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -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"); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch index 8522fc3e7f..a76516fffd 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch @@ -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(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch index 9516a4603f..a1e863e50a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch @@ -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 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); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 67832b00f1..54657e5031 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -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) { + } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index b9d7663b0d..89c9860fb0 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -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 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 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 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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch index 39298d9625..617ada3af3 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch @@ -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"); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch index 5823f8029f..1c74ad59e2 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch @@ -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); - }); + }; } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch index 906daafefb..770354dba6 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch @@ -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(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch index 54adfe62fe..c377afcffa 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch index 32cbf8ce37..10e954a55a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch index e5867e8ce1..53617793d5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index ebcd6eea9c..6e72414996 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -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 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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch index 7550bad00c..628bc0c979 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch @@ -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 preset = this.getWorldType().preset(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch index 3f3b31516f..f34ed9e0f1 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch @@ -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 ) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch index 57a716822a..4612184de5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch @@ -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(); diff --git a/patches/minecraft/net/minecraft/client/main/Main.java.patch b/patches/minecraft/net/minecraft/client/main/Main.java.patch index 70984f135e..30246c1da7 100644 --- a/patches/minecraft/net/minecraft/client/main/Main.java.patch +++ b/patches/minecraft/net/minecraft/client/main/Main.java.patch @@ -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"; diff --git a/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch b/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch index d931e128dc..8309858145 100644 --- a/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch +++ b/patches/minecraft/net/minecraft/client/model/HumanoidModel.java.patch @@ -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; diff --git a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch index b2257ffa10..2c26bba477 100644 --- a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch +++ b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch @@ -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 definitions = result.build(); List missingDefinitions = ModelLayers.getKnownLocations().filter(l -> !definitions.containsKey(l)).toList(); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch index 6767c1b645..18309f6ec9 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch @@ -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; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch index 714ac6ac1f..e20e0e1797 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch @@ -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; } + diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch index d12bfa070b..5276b053c2 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch @@ -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); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch index 183b9f99df..e35f76eaec 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch index 984b6e8835..e4aedd7cfb 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -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 lightUpdateQueue = Queues.newArrayDeque(); -@@ -161,6 +_,8 @@ - private final EnvironmentAttributeSystem environmentAttributes; +@@ -178,6 +_,8 @@ + private final Long2ObjectMap> destructionProgress = new Long2ObjectOpenHashMap<>(); private final int seaLevel; private static final Set MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT); + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> 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: diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 5471634931..93ba01ef1f 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -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 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 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) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index 65d02b1331..3f564487bf 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch @@ -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); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch index d588e61db7..b30ddd96a7 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch @@ -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() { + new Bootstrap().group(eventLoopGroupHolder.eventLoopGroup(true)).handler(new ChannelInitializer() { - { - Objects.requireNonNull(ServerStatusPinger.this); - } + @Override + protected void initChannel(final Channel channel) { + try { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch index 4a31f4895a..a44448243a 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/chat/ChatListener.java.patch @@ -1,44 +1,46 @@ --- a/net/minecraft/client/multiplayer/chat/ChatListener.java +++ b/net/minecraft/client/multiplayer/chat/ChatListener.java -@@ -140,6 +_,8 @@ +@@ -142,6 +_,8 @@ LocalPlayer receiver = this.minecraft.player; if (receiver != null && receiver.chatAbilities().canReceivePlayerMessages()) { Component decoratedMessage = boundChatType.decorate(message); + decoratedMessage = net.minecraftforge.client.ForgeHooksClient.onClientChat(boundChatType, decoratedMessage, Util.NIL_UUID); + if (decoratedMessage == null) return false; - this.minecraft.gui.getChat().addPlayerMessage(decoratedMessage, null, GuiMessageTag.system()); + this.minecraft.gui.hud.getChat().addPlayerMessage(decoratedMessage, null, GuiMessageTag.system()); this.narrateChatMessage(boundChatType, message); this.logSystemMessage(decoratedMessage, received); -@@ -169,12 +_,16 @@ +@@ -177,12 +_,16 @@ MessageSignature signature = message.signature(); FilterMask filterMask = message.filterMask(); if (filterMask.isEmpty()) { -- this.minecraft.gui.getChat().addPlayerMessage(decoratedMessage, signature, tag); +- this.minecraft.gui.hud.getChat().addPlayerMessage(decoratedMessage, signature, tag); + Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(boundChatType, decoratedMessage, message, message.sender()); + if (forgeComponent == null) return false; -+ this.minecraft.gui.getChat().addPlayerMessage(forgeComponent, signature, tag); ++ this.minecraft.gui.hud.getChat().addPlayerMessage(forgeComponent, signature, tag); this.narrateChatMessage(boundChatType, message.decoratedContent()); } else { Component filteredContent = filterMask.applyWithFormatting(message.signedContent()); if (filteredContent != null) { -- this.minecraft.gui.getChat().addPlayerMessage(boundChatType.decorate(filteredContent), signature, tag); +- this.minecraft.gui.hud.getChat().addPlayerMessage(boundChatType.decorate(filteredContent), signature, tag); + Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(boundChatType, boundChatType.decorate(filteredContent), message, message.sender()); + if (forgeComponent == null) return false; -+ this.minecraft.gui.getChat().addPlayerMessage(forgeComponent, signature, tag); ++ this.minecraft.gui.hud.getChat().addPlayerMessage(forgeComponent, signature, tag); this.narrateChatMessage(boundChatType, filteredContent); } } -@@ -208,10 +_,12 @@ +@@ -216,12 +_,14 @@ chatLog.push(LoggedChatMessage.system(message, timeStamp)); } - public void handleSystemMessage(final Component message, final boolean remote) { + public void handleSystemMessage(Component message, final boolean remote) { - if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(message))) { - LocalPlayer receiver = this.minecraft.player; - if (receiver != null && receiver.chatAbilities().canReceiveSystemMessages()) { -+ message = net.minecraftforge.client.ForgeHooksClient.onClientSystemMessage(message, remote); -+ if (message == null) return; - if (remote) { - this.minecraft.gui.getChat().addServerSystemMessage(message); - this.logSystemMessage(message, Instant.now()); + UUID guessedUUID = this.guessChatUUID(message); + if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(guessedUUID)) { + if (guessedUUID == Util.NIL_UUID || !this.minecraft.isFriendOnlyRestricted(guessedUUID)) { + LocalPlayer receiver = this.minecraft.player; + if (receiver != null && receiver.chatAbilities().canReceiveSystemMessages()) { ++ message = net.minecraftforge.client.ForgeHooksClient.onClientSystemMessage(message, remote); ++ if (message == null) return; + if (remote) { + this.minecraft.gui.hud.getChat().addServerSystemMessage(message); + this.logSystemMessage(message, Instant.now()); diff --git a/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch b/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch index e1b2a6936a..e010a4a758 100644 --- a/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/FireworkParticles.java.patch @@ -4,10 +4,10 @@ colors = IntList.of(DyeColor.BLACK.getFireworkColor()); } -+ var factory = net.minecraftforge.client.FireworkShapeFactoryRegistry.get(explosionx.shape()); ++ var factory = net.minecraftforge.client.FireworkShapeFactoryRegistry.get(explosion.shape()); + if (factory != null) + factory.build(this, trail, twinkle, colors.toIntArray(), colors.toIntArray()); + else - switch (explosionx.shape()) { + switch (explosion.shape()) { case SMALL_BALL: this.createParticleBall(0.25, 2, colors, fadeColors, trail, twinkle); diff --git a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch index 0c38eaf21f..a35194545d 100644 --- a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java -@@ -205,6 +_,10 @@ +@@ -208,6 +_,10 @@ return Optional.empty(); } diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch index 7be893aaa4..e2d8d3f95a 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/ParticleEngine.java +++ b/net/minecraft/client/particle/ParticleEngine.java -@@ -63,7 +_,7 @@ +@@ -64,7 +_,7 @@ private @Nullable Particle makeParticle( final T options, final double x, final double y, final double z, final double xa, final double ya, final double za ) { @@ -9,16 +9,16 @@ return provider == null ? null : provider.createParticle(options, this.level, x, y, z, xa, ya, za, this.random); } -@@ -111,6 +_,8 @@ +@@ -114,6 +_,8 @@ return new ItemPickupParticleGroup(this); } else if (type == ParticleRenderType.ELDER_GUARDIANS) { return new ElderGuardianParticleGroup(this); + } else if (factories.containsKey(type)) { + return factories.get(type).apply(this); } else { - return (ParticleGroup)(type == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, type)); + return type == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, type); } -@@ -120,8 +_,20 @@ +@@ -123,8 +_,20 @@ this.trackedParticleCounts.addTo(limit, change); } diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch index 49cb37f093..405fb678b4 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleResources.java.patch @@ -8,8 +8,8 @@ private @Nullable Runnable onReload; public ParticleResources() { -@@ -175,14 +_,17 @@ - this.register(ParticleTypes.FIREFLY, FireflyParticle.FireflyProvider::new); +@@ -183,14 +_,17 @@ + this.register(ParticleTypes.SULFUR_CUBE_GOO, BreakingItemParticle.SulfurCubeProvider::new); } + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */ @@ -27,7 +27,7 @@ } @Override -@@ -278,8 +_,13 @@ +@@ -281,8 +_,13 @@ } } diff --git a/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch index d0498f2dd0..755c17877b 100644 --- a/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/PortalParticle.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/particle/PortalParticle.java +++ b/net/minecraft/client/particle/PortalParticle.java -@@ -84,6 +_,7 @@ - this.x = this.xStart + this.xd * var4; - this.y = this.yStart + this.yd * var4 + (1.0F - pos); - this.z = this.zStart + this.zd * var4; +@@ -85,6 +_,7 @@ + this.x = this.xStart + this.xd * pos; + this.y = this.yStart + this.yd * pos + (1.0F - a); + this.z = this.zStart + this.zd * pos; + this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box } } diff --git a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch index 8d84db9304..6ccb204b23 100644 --- a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch @@ -58,7 +58,7 @@ this.handsBusy = false; if (this.getControlledVehicle() instanceof AbstractBoat boat) { boat.setInput(this.input.keyPresses.left(), this.input.keyPresses.right(), this.input.keyPresses.forward(), this.input.keyPresses.backward()); -@@ -1146,7 +_,7 @@ +@@ -1147,7 +_,7 @@ && this.isSprintingPossible(this.getAbilities().flying) && !this.isSlowDueToUsingItem() && (!this.isFallFlying() || this.isUnderWater()) diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index dbab5fd128..6c126a4949 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -233,6 +_,9 @@ +@@ -220,6 +_,9 @@ case null: default: this.clearPostEffect(); @@ -10,41 +10,18 @@ } } -@@ -244,7 +_,13 @@ - public void processBlurEffect() { - PostChain postChain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS); - if (postChain != null) { -+ // TODO: [Forge][Rendering] Check if this blend management is needed anymnore with the new render pipeline changes -+ boolean wasBlendEnabled = com.mojang.blaze3d.opengl.GlStateManager._isBlendEnabled(); -+ if (wasBlendEnabled) -+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend(); - postChain.process(this.minecraft.getMainRenderTarget(), this.resourcePool); -+ if (wasBlendEnabled) -+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); - } - } - -@@ -509,7 +_,7 @@ - profiler.push("screen"); - - try { -- this.minecraft.screen.extractRenderStateWithTooltipAndSubtitles(graphics, xMouse, yMouse, deltaTracker.getGameTimeDeltaTicks()); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, graphics, xMouse, yMouse, deltaTracker.getRealtimeDeltaTicks()); - } catch (Throwable var12) { - CrashReport report = CrashReport.forThrowable(var12, "Rendering screen"); - CrashReportCategory category = report.addCategory("Screen render details"); -@@ -674,6 +_,10 @@ - Registry blockRegistry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK); - renderOutline = !itemStack.isEmpty() - && (itemStack.canBreakBlockInAdventureMode(blockInWorld) || itemStack.canPlaceOnBlockInAdventureMode(blockInWorld)); -+ if (!renderOutline && blockState.hasBlockEntity()) { -+ var blockEntity = this.minecraft.level.getBlockEntity(pos); -+ renderOutline = blockEntity != null && blockEntity.hasCustomOutlineRendering(); -+ } - } +@@ -515,6 +_,10 @@ + Registry blockRegistry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK); + renderOutline = !itemStack.isEmpty() + && (itemStack.canBreakBlockInAdventureMode(blockInWorld) || itemStack.canPlaceOnBlockInAdventureMode(blockInWorld)); ++ if (!renderOutline && blockState.hasBlockEntity()) { ++ var blockEntity = this.minecraft.level.getBlockEntity(pos); ++ renderOutline = blockEntity != null && blockEntity.hasCustomOutlineRendering(); ++ } } } -@@ -698,6 +_,9 @@ + } +@@ -538,6 +_,9 @@ if (optionsState.bobView) { this.bobView(cameraState, bobStack); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch index 0741f21e3d..4406fd83bb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch @@ -5,7 +5,7 @@ float mainhandInverseArmHeight = this.itemModelResolver.swapAnimationScale(this.mainHandItem) * (1.0F - Mth.lerp(frameInterp, this.oMainHandHeight, this.mainHandHeight)); + if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.MAIN_HAND, poseStack, submitNodeCollector, lightCoords, frameInterp, xRot, mainHandAttack, mainhandInverseArmHeight, this.mainHandItem)) - this.renderArmWithItem( + this.submitArmWithItem( player, frameInterp, @@ -380,6 +_,8 @@ @@ -14,10 +14,10 @@ * (1.0F - Mth.lerp(frameInterp, this.oOffHandHeight, this.offHandHeight)); + + if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.OFF_HAND, poseStack, submitNodeCollector, lightCoords, frameInterp, xRot, offHandAttack, offhandInverseArmHeight, this.offHandItem)) - this.renderArmWithItem( + this.submitArmWithItem( player, frameInterp, -@@ -457,7 +_,7 @@ +@@ -454,7 +_,7 @@ } else { this.renderOneHandedMap(poseStack, submitNodeCollector, lightCoords, inverseArmHeight, arm, attack, itemStack); } @@ -26,7 +26,7 @@ this.applyItemArmTransform(poseStack, arm, inverseArmHeight); boolean charged = CrossbowItem.isCharged(itemStack); boolean isRightArm = arm == HumanoidArm.RIGHT; -@@ -502,6 +_,7 @@ +@@ -499,6 +_,7 @@ } else { boolean isRightArm = arm == HumanoidArm.RIGHT; int invert = isRightArm ? 1 : -1; diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch index 2e20aee1cb..72a8555d01 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelEventHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LevelEventHandler.java +++ b/net/minecraft/client/renderer/LevelEventHandler.java -@@ -302,7 +_,7 @@ +@@ -305,7 +_,7 @@ case 2001: BlockState blockState = Block.stateById(data); if (!blockState.isAir()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch index ea79aef0e9..f5282c908f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch @@ -1,115 +1,38 @@ --- a/net/minecraft/client/renderer/LevelRenderer.java +++ b/net/minecraft/client/renderer/LevelRenderer.java -@@ -189,6 +_,7 @@ - this.optionsRenderState = gameRenderState.optionsRenderState; - this.levelRenderState = gameRenderState.levelRenderState; - this.featureRenderDispatcher = featureRenderDispatcher; -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onInitLevelRenderer(); - } - - @Override -@@ -518,7 +_,8 @@ - this.addSkyPass(frame, cameraState, terrainFog); +@@ -235,6 +_,7 @@ } -- this.addMainPass(frame, cullFrustum, modelViewMatrix, terrainFog, renderOutline, this.levelRenderState, deltaTracker, profiler, chunkSectionsToRender); -+ var hasCustomOutline = this.levelRenderState.blockOutlineRenderState != null && this.levelRenderState.blockOutlineRenderState.customRenderer() != null; -+ this.addMainPass(frame, cullFrustum, modelViewMatrix, terrainFog, renderOutline | hasCustomOutline, this.levelRenderState, deltaTracker, profiler, chunkSectionsToRender); - PostChain entityOutlineChain = this.minecraft.getShaderManager().getPostChain(ENTITY_OUTLINE_POST_CHAIN_ID, LevelTargetBundle.OUTLINE_TARGETS); - if (this.levelRenderState.haveGlowingEntities && entityOutlineChain != null) { - entityOutlineChain.addToFrame(frame, screenWidth, screenHeight, this.targets); -@@ -544,6 +_,7 @@ - } - - this.addLateDebugPass(frame, this.levelRenderState.cameraRenderState, terrainFog, modelViewMatrix); + this.addAlwaysOnTopPass(frame, featureFrame, terrainFog); + net.minecraftforge.client.FramePassManager.insertForgePasses(frame, targets, this.levelRenderState); // Forge: Modded passes are inserted here. profiler.popPush("executeFrameGraph"); frame.execute(resourceAllocator, new FrameGraphBuilder.Inspector() { - { -@@ -581,7 +_,7 @@ - profiler.popPush("entities"); - this.extractVisibleEntities(camera, cullFrustum, deltaTracker, this.levelRenderState); - profiler.popPush("blockEntities"); -- this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState); -+ this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState, cullFrustum); - profiler.popPush("blockOutline"); - this.extractBlockOutline(camera, this.levelRenderState); - profiler.popPush("blockBreaking"); -@@ -857,7 +_,7 @@ + @Override +@@ -285,7 +_,8 @@ + this.submitBlockDestroyAnimation(poseStack, submitNodeCollector, levelRenderState); + levelRenderState.blockBreakingRenderStates.clear(); + levelRenderState.particlesRenderState.submit(submitNodeCollector, levelRenderState.cameraRenderState); +- if (renderOutline) { ++ var hasCustomOutline = this.levelRenderState.blockOutlineRenderState != null && this.levelRenderState.blockOutlineRenderState.customRenderer() != null; ++ if (renderOutline || hasCustomOutline) { + this.submitBlockOutline(poseStack, this.submitNodeStorage, levelRenderState); } - } -- private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState) { -+ private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState, final Frustum frustum) { - Vec3 cameraPos = camera.position(); - double camX = cameraPos.x(); - double camY = cameraPos.y(); -@@ -868,6 +_,7 @@ - List renderableBlockEntities = section.getSectionMesh().getRenderableBlockEntities(); - if (!renderableBlockEntities.isEmpty() && !(section.getVisibility(Util.getMillis()) < 0.3F)) { - for (BlockEntity blockEntity : renderableBlockEntities) { -+ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; - BlockPos blockPos = blockEntity.getBlockPos(); - SortedSet progresses = this.destructionProgress.get(blockPos.asLong()); - ModelFeatureRenderer.CrumblingOverlay breakProgress; -@@ -895,6 +_,7 @@ - if (blockEntity.isRemoved()) { - iterator.remove(); - } else { -+ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; - BlockEntityRenderState state = this.blockEntityRenderDispatcher.tryExtractRenderState(blockEntity, deltaPartialTick, null); - if (state != null) { - levelRenderState.blockEntityRenderStates.add(state); -@@ -931,7 +_,7 @@ - SortedSet progresses = entry.getValue(); - if (progresses != null && !progresses.isEmpty()) { - int progress = progresses.last().getProgress(); -- levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress)); -+ levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress, this.level.getModelDataManager().getAtOrEmpty(pos))); - } - } - } -@@ -957,6 +_,12 @@ - - private void extractBlockOutline(final Camera camera, final LevelRenderState levelRenderState) { - levelRenderState.blockOutlineRenderState = null; -+ var custom = net.minecraftforge.client.ForgeHooksClient.onExtractBlockOutline(this, camera, levelRenderState, this.minecraft.hitResult); -+ if (custom != null) { -+ levelRenderState.blockOutlineRenderState = new BlockOutlineRenderState(BlockPos.ZERO, false, false, net.minecraft.world.phys.shapes.Shapes.empty(), null, null, null, custom); -+ return; -+ } -+ - if (this.minecraft.hitResult instanceof BlockHitResult blockHitResult) { - if (blockHitResult.getType() != HitResult.Type.MISS) { - BlockPos pos = blockHitResult.getBlockPos(); -@@ -990,6 +_,10 @@ - ) { +@@ -705,6 +_,10 @@ + private void submitBlockOutline(final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final LevelRenderState levelRenderState) { BlockOutlineRenderState state = levelRenderState.blockOutlineRenderState; if (state != null) { + if (state.customRenderer() != null) { -+ state.customRenderer().render(bufferSource, poseStack, onlyTranslucentBlocks, levelRenderState); ++ state.customRenderer().render(submitNodeCollector, poseStack, levelRenderState); + return; + } - if (state.isTranslucent() == onlyTranslucentBlocks) { - Vec3 cameraPos = levelRenderState.cameraRenderState.pos; - if (state.highContrast()) { -@@ -1458,7 +_,7 @@ - } else { - int packedBrightness = brightnessGetter.packedBrightness(level, pos); - int block = LightCoordsUtil.block(packedBrightness); -- int blockSelfEmission = state.getLightEmission(); -+ int blockSelfEmission = state.getLightEmission(level, pos); - return block < blockSelfEmission ? LightCoordsUtil.withBlock(packedBrightness, blockSelfEmission) : packedBrightness; - } - } -@@ -1506,6 +_,18 @@ + Vec3 cameraPos = levelRenderState.cameraRenderState.pos; + BlockPos pos = state.pos(); + poseStack.pushPose(); +@@ -979,6 +_,14 @@ - public CloudRenderer getCloudRenderer() { - return this.cloudRenderer; -+ } -+ -+ public int getTicks() { -+ return this.ticks; + public SectionOcclusionGraph sectionOcclusionGraph() { + return this.sectionOcclusionGraph; + } + + public WeatherEffectRenderer getWeatherEffects() { @@ -120,4 +43,4 @@ + this.weatherEffectRenderer = value; } - public Gizmos.TemporaryCollection collectPerFrameGizmos() { + public Gizmos.TemporaryCollection collectPerFrameRenderThreadGizmos() { diff --git a/patches/minecraft/net/minecraft/client/renderer/OrderedSubmitNodeCollector.java.patch b/patches/minecraft/net/minecraft/client/renderer/OrderedSubmitNodeCollector.java.patch deleted file mode 100644 index ec1d208644..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/OrderedSubmitNodeCollector.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/client/renderer/OrderedSubmitNodeCollector.java -+++ b/net/minecraft/client/renderer/OrderedSubmitNodeCollector.java -@@ -183,6 +_,10 @@ - - void submitBreakingBlockModel(PoseStack poseStack, BlockStateModel model, long seed, int progress); - -+ default void submitBreakingBlockModel(PoseStack poseStack, BlockStateModel model, long seed, int progress, net.minecraftforge.client.model.data.ModelData data) { -+ submitBreakingBlockModel(poseStack, model, seed, progress); -+ } -+ - void submitItem( - PoseStack poseStack, - ItemDisplayContext displayContext, diff --git a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index 1d22bf1826..7250254598 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -1,36 +1,37 @@ --- a/net/minecraft/client/renderer/ScreenEffectRenderer.java +++ b/net/minecraft/client/renderer/ScreenEffectRenderer.java -@@ -62,19 +_,25 @@ +@@ -61,8 +_,9 @@ + PoseStack poseStack = new PoseStack(); Player player = this.minecraft.player; if (isFirstPerson && !isSleeping) { - if (!player.noPhysics) { -- BlockState blockState = getViewBlockingState(player); -+ var overlay = getOverlayBlock(player); -+ BlockState blockState = overlay == null ? null : overlay.getLeft(); - if (blockState != null) { -+ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, poseStack, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) - renderTex(this.minecraft.getModelManager().getBlockStateModelSet().getParticleMaterial(blockState).sprite(), poseStack, this.bufferSource); - } - } +- BlockState blockState = getViewBlockingState(player); +- if (blockState != null) { ++ var overlay = getOverlayBlock(player); ++ BlockState blockState = overlay == null ? null : overlay.getLeft(); ++ if (blockState != null && net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, poseStack, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) { + BlockStateModelSet blockStateModelSet = this.minecraft.getModelManager().getBlockStateModelSet(); + TextureAtlasSprite sprite = blockStateModelSet.getParticleMaterial(blockState).sprite(); + submitBlockSprite(sprite, poseStack, submitNodeCollector, -15132391); +@@ -70,11 +_,15 @@ if (!this.minecraft.player.isSpectator()) { if (this.minecraft.player.isEyeInFluid(FluidTags.WATER)) { + if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, poseStack)) - renderWater(this.minecraft, poseStack, this.bufferSource); + submitWater(this.minecraft, poseStack, submitNodeCollector); + } else if (!player.getEyeInFluidType().isAir()) { -+ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(this.minecraft, poseStack, this.bufferSource); ++ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(this.minecraft, poseStack, submitNodeCollector); } if (this.minecraft.player.isOnFire()) { TextureAtlasSprite fireSprite = this.sprites.get(ModelBakery.FIRE_1); + if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, poseStack)) - renderFire(poseStack, this.bufferSource, fireSprite); + submitFire(poseStack, submitNodeCollector, fireSprite); } } -@@ -124,6 +_,11 @@ - } +@@ -128,6 +_,11 @@ + return null; + } - private static @Nullable BlockState getViewBlockingState(final Player player) { + var ret = getOverlayBlock(player); + return ret == null ? null : ret.getLeft(); + } @@ -39,8 +40,8 @@ BlockPos.MutableBlockPos testPos = new BlockPos.MutableBlockPos(); for (int i = 0; i < 8; i++) { -@@ -133,7 +_,7 @@ - testPos.set(xo, yo, zo); +@@ -138,7 +_,7 @@ + ); BlockState blockState = player.level().getBlockState(testPos); if (blockState.getRenderShape() != RenderShape.INVISIBLE && blockState.isViewBlocking(player.level(), testPos)) { - return blockState; @@ -48,23 +49,22 @@ } } -@@ -161,6 +_,10 @@ +@@ -156,13 +_,17 @@ } - private static void renderWater(final Minecraft minecraft, final PoseStack poseStack, final MultiBufferSource bufferSource) { -+ renderFluid(minecraft, poseStack, bufferSource, UNDERWATER_LOCATION); + private static void submitWater(final Minecraft minecraft, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector) { ++ renderFluid(minecraft, poseStack, submitNodeCollector, UNDERWATER_LOCATION); + } + -+ public static void renderFluid(Minecraft minecraft, PoseStack poseStack, MultiBufferSource bufferSource, Identifier texture) { - BlockPos pos = BlockPos.containing(minecraft.player.getX(), minecraft.player.getEyeY(), minecraft.player.getZ()); - float br = Lightmap.getBrightness(minecraft.player.level().dimensionType(), minecraft.player.level().getMaxLocalRawBrightness(pos)); - int color = ARGB.colorFromFloat(0.1F, br, br, br); -@@ -173,7 +_,7 @@ - float uo = -minecraft.player.getYRot() / 64.0F; - float vo = minecraft.player.getXRot() / 64.0F; - Matrix4f pose = poseStack.last().pose(); -- VertexConsumer builder = bufferSource.getBuffer(RenderTypes.blockScreenEffect(UNDERWATER_LOCATION)); -+ VertexConsumer builder = bufferSource.getBuffer(RenderTypes.blockScreenEffect(texture)); - builder.addVertex(pose, -1.0F, -1.0F, -0.5F).setUv(4.0F + uo, 4.0F + vo).setColor(color); - builder.addVertex(pose, 1.0F, -1.0F, -0.5F).setUv(0.0F + uo, 4.0F + vo).setColor(color); - builder.addVertex(pose, 1.0F, 1.0F, -0.5F).setUv(0.0F + uo, 0.0F + vo).setColor(color); ++ public static void renderFluid(Minecraft minecraft, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, Identifier texture) { + LocalPlayer player = minecraft.player; + BlockPos pos = BlockPos.containing(player.getEyePosition()); + float brightness = Lightmap.getBrightness(player.level().dimensionType(), player.level().getMaxLocalRawBrightness(pos)); + int color = ARGB.colorFromFloat(0.1F, brightness, brightness, brightness); + float u0 = -player.getYRot() / 64.0F; + float v0 = player.getXRot() / 64.0F; +- submitNodeCollector.submitCustomGeometry(poseStack, RenderTypes.blockScreenEffect(UNDERWATER_LOCATION), (pose, builder) -> { ++ submitNodeCollector.submitCustomGeometry(poseStack, RenderTypes.blockScreenEffect(texture), (pose, builder) -> { + float uvSize = 4.0F; + buildQuad(builder, pose.pose(), -1.0F, -1.0F, 1.0F, 1.0F, -0.5F, u0 + 4.0F, v0 + 4.0F, u0, v0, color); + }); diff --git a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch index 71ea5a8683..3486c46905 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch @@ -1,32 +1,9 @@ --- a/net/minecraft/client/renderer/Sheets.java +++ b/net/minecraft/client/renderer/Sheets.java -@@ -146,11 +_,11 @@ - } - - private static SpriteId createSignSprite(final WoodType type) { -- return SIGN_MAPPER.defaultNamespaceApply(type.name()); -+ return SIGN_MAPPER.apply(Identifier.parse(type.name())); - } - - private static SpriteId createHangingSignSprite(final WoodType type) { -- return HANGING_SIGN_MAPPER.defaultNamespaceApply(type.name()); -+ return HANGING_SIGN_MAPPER.apply(Identifier.parse(type.name())); - } - - public static SpriteId getSignSprite(final WoodType type) { -@@ -184,5 +_,22 @@ - case COPPER_WEATHERED -> (SpriteId)CHEST_COPPER_WEATHERED.select(type); - case COPPER_OXIDIZED -> (SpriteId)CHEST_COPPER_OXIDIZED.select(type); +@@ -120,4 +_,13 @@ + case COPPER_OXIDIZED -> (SpriteId)CHEST_COPPER.oxidized().select(type); }; -+ } -+ -+ /** -+ * Not thread-safe. Enqueue it in client setup. -+ */ -+ public static void addWoodType(WoodType woodType) { -+ SIGN_SPRITES.put(woodType, createSignSprite(woodType)); -+ HANGING_SIGN_SPRITES.put(woodType, createHangingSignSprite(woodType)); -+ } + } + + static { + if (net.minecraftforge.fml.ModLoader.isLoadingStateValid() && !net.minecraftforge.fml.ModLoader.hasCompletedState(net.minecraftforge.common.ForgeStatesProvider.LOAD_REGISTRIES)) { @@ -35,5 +12,5 @@ + new IllegalStateException("net.minecraft.client.renderer.Sheets loaded too early") + ); + } - } ++ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/SubmitNodeCollection.java.patch b/patches/minecraft/net/minecraft/client/renderer/SubmitNodeCollection.java.patch deleted file mode 100644 index 8fa5f0d8c5..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/SubmitNodeCollection.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/client/renderer/SubmitNodeCollection.java -+++ b/net/minecraft/client/renderer/SubmitNodeCollection.java -@@ -179,6 +_,12 @@ - } - - @Override -+ public void submitBreakingBlockModel(final PoseStack poseStack, final BlockStateModel model, final long seed, final int progress, final net.minecraftforge.client.model.data.ModelData data) { -+ this.wasUsed = true; -+ this.breakingBlockModelSubmits.add(new SubmitNodeStorage.BreakingBlockModelSubmit(poseStack.last().copy(), model, seed, progress, data)); -+ } -+ -+ @Override - public void submitItem( - final PoseStack poseStack, - final ItemDisplayContext displayContext, diff --git a/patches/minecraft/net/minecraft/client/renderer/SubmitNodeStorage.java.patch b/patches/minecraft/net/minecraft/client/renderer/SubmitNodeStorage.java.patch deleted file mode 100644 index 0b2d317ec6..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/SubmitNodeStorage.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/client/renderer/SubmitNodeStorage.java -+++ b/net/minecraft/client/renderer/SubmitNodeStorage.java -@@ -141,6 +_,11 @@ - } - - @Override -+ public void submitBreakingBlockModel(final PoseStack poseStack, final BlockStateModel model, final long seed, final int progress, final net.minecraftforge.client.model.data.ModelData data) { -+ this.order(0).submitBreakingBlockModel(poseStack, model, seed, progress, data); -+ } -+ -+ @Override - public void submitItem( - final PoseStack poseStack, - final ItemDisplayContext displayContext, -@@ -192,7 +_,10 @@ - } - - @OnlyIn(Dist.CLIENT) -- public record BreakingBlockModelSubmit(PoseStack.Pose pose, BlockStateModel model, long seed, int progress) { -+ public record BreakingBlockModelSubmit(PoseStack.Pose pose, BlockStateModel model, long seed, int progress, net.minecraftforge.client.model.data.ModelData data) { -+ public BreakingBlockModelSubmit(PoseStack.Pose pose, BlockStateModel model, long seed, int progress) { -+ this(pose, model, seed, progress, net.minecraftforge.client.model.data.ModelData.EMPTY); -+ } - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch index 4a67c8ed23..5bdbaa158c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/FluidRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/FluidRenderer.java +++ b/net/minecraft/client/renderer/block/FluidRenderer.java -@@ -87,8 +_,10 @@ +@@ -86,8 +_,10 @@ boolean renderEast = shouldRenderFace(fluidState, blockState, Direction.EAST, fluidStateEast); if (renderUp || renderDown || renderEast || renderWest || renderNorth || renderSouth) { FluidModel model = this.fluidModels.get(fluidState); @@ -12,7 +12,7 @@ CardinalLighting cardinalLighting = level.cardinalLighting(); Fluid type = fluidState.getType(); float heightSelf = this.getHeight(level, type, pos, blockState, fluidState); -@@ -295,7 +_,7 @@ +@@ -294,7 +_,7 @@ boolean isOverlay = false; if (model.overlayMaterial() != null) { Block relativeBlock = faceState.getBlock(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch index 9cf6048610..938f1d1453 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java +++ b/net/minecraft/client/renderer/block/dispatch/BlockStateModel.java -@@ -21,9 +_,11 @@ +@@ -20,9 +_,11 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -12,4 +12,4 @@ + /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#particleMaterial(net.minecraftforge.client.model.data.ModelData)}*/ Material.Baked particleMaterial(); - @BakedQuad.MaterialFlags + @BakedQuad.MaterialFlags int materialFlags(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch index 17002e9c96..6d820387cf 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java +++ b/net/minecraft/client/renderer/block/dispatch/WeightedVariants.java -@@ -17,11 +_,13 @@ +@@ -16,11 +_,13 @@ + private final WeightedList list; private final Material.Baked particleMaterial; - @BakedQuad.MaterialFlags - private final int materialFlags; + private final @BakedQuad.MaterialFlags int materialFlags; + private final BlockStateModel first; public WeightedVariants(final WeightedList list) { @@ -14,19 +14,19 @@ this.materialFlags = computeMaterialFlags(list); } -@@ -41,6 +_,11 @@ - return this.particleMaterial; +@@ -40,6 +_,11 @@ } -+ @Override + @Override + public Material.Baked particleMaterial(net.minecraftforge.client.model.data.ModelData data) { + return this.first.particleMaterial(data); + } + - @BakedQuad.MaterialFlags - @Override - public int materialFlags() { -@@ -50,6 +_,11 @@ ++ @Override + public @BakedQuad.MaterialFlags int materialFlags() { + return this.materialFlags; + } +@@ -47,6 +_,11 @@ @Override public void collectParts(final RandomSource random, final List output) { this.list.getRandomOrThrow(random).collectParts(random, output); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch index 0cd8f69738..886541fbd5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java.patch @@ -1,20 +1,19 @@ --- a/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java +++ b/net/minecraft/client/renderer/block/dispatch/multipart/MultiPartModel.java -@@ -38,6 +_,13 @@ - return this.shared.particleMaterial; +@@ -38,12 +_,24 @@ } -+ @Override + @Override + public Material.Baked particleMaterial(net.minecraftforge.client.model.data.ModelData data) { + if (this.models == null) + this.models = this.shared.selectModels(this.blockState); + return this.models.getFirst().particleMaterial(data); + } + - @BakedQuad.MaterialFlags - @Override - public int materialFlags() { -@@ -46,6 +_,11 @@ ++ @Override + public @BakedQuad.MaterialFlags int materialFlags() { + return this.shared.materialFlags; + } @Override public void collectParts(final RandomSource random, final List output) { @@ -26,7 +25,7 @@ if (this.models == null) { this.models = this.shared.selectModels(this.blockState); } -@@ -54,7 +_,7 @@ +@@ -52,7 +_,7 @@ for (BlockStateModel model : this.models) { random.setSeed(seed); diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch index b4d5cf9d3e..9c94cca359 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java +++ b/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java -@@ -13,7 +_,7 @@ +@@ -14,7 +_,7 @@ @OnlyIn(Dist.CLIENT) public class BlockEntityRenderers { diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch index 6c34bb4d4b..9248946751 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch @@ -10,7 +10,7 @@ map.put(SkullBlock.Types.SKELETON, Identifier.withDefaultNamespace("textures/entity/skeleton/skeleton.png")); @@ -67,7 +_,9 @@ case PIGLIN -> new PiglinHeadModel(modelSet.bakeLayer(ModelLayers.PIGLIN_HEAD)); - }); + }; } else { - return null; + if (customModels == null) diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch index bb977f1a21..57a9638c4e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/SectionCompiler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/SectionCompiler.java +++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java -@@ -61,6 +_,7 @@ +@@ -56,6 +_,7 @@ public SectionCompiler.Results compile( final SectionPos sectionPos, final RenderSectionRegion region, final VertexSorting vertexSorting, final SectionBufferBuilderPack builders ) { @@ -8,7 +8,7 @@ SectionCompiler.Results results = new SectionCompiler.Results(); BlockPos minPos = sectionPos.origin(); BlockPos maxPos = minPos.offset(15, 15, 15); -@@ -100,6 +_,9 @@ +@@ -95,6 +_,9 @@ } if (blockState.getRenderShape() == RenderShape.MODEL) { @@ -18,7 +18,7 @@ blockRenderer.tesselateBlock( ModelBlockRenderer.forceOpaque(this.cutoutLeaves, blockState) ? opaqueQuadOutput : quadOutput, SectionPos.sectionRelative(pos.getX()), -@@ -108,8 +_,9 @@ +@@ -103,8 +_,9 @@ region, pos, blockState, @@ -29,4 +29,4 @@ + modelData ); } - } catch (Throwable var21) { + } catch (Throwable t) { diff --git a/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch index 454a39430f..7e02373768 100644 --- a/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java +++ b/net/minecraft/client/renderer/debug/EntityHitboxDebugRenderer.java -@@ -98,8 +_,8 @@ +@@ -99,8 +_,8 @@ ); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch index 24854d9d4c..0b8b6f89b8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -1,33 +1,30 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java -@@ -128,16 +_,17 @@ +@@ -128,13 +_,14 @@ final S state, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final CameraRenderState camera, final int offset ) { poseStack.pushPose(); - if (state.scoreText != null) { +- submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, state.scoreText, !state.isDiscrete, state.lightCoords, camera); + var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(state, this, poseStack, submitNodeCollector, camera); + if (event.getScoreContent() != null) { - submitNodeCollector.submitNameTag( -- poseStack, state.nameTagAttachment, offset, state.scoreText, !state.isDiscrete, state.lightCoords, state.distanceToCameraSq, camera -+ poseStack, state.nameTagAttachment, offset, event.getScoreContent(), !state.isDiscrete, state.lightCoords, state.distanceToCameraSq, camera - ); ++ submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, event.getScoreContent(), !state.isDiscrete, state.lightCoords, camera); poseStack.translate(0.0F, 9.0F * 1.15F * 0.025F, 0.0F); } - if (state.nameTag != null) { +- submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, state.nameTag, !state.isDiscrete, state.lightCoords, camera); + if (event.getContent() != null) { - submitNodeCollector.submitNameTag( -- poseStack, state.nameTagAttachment, offset, state.nameTag, !state.isDiscrete, state.lightCoords, state.distanceToCameraSq, camera -+ poseStack, state.nameTagAttachment, offset, event.getContent(), !state.isDiscrete, state.lightCoords, state.distanceToCameraSq, camera - ); ++ submitNodeCollector.submitNameTag(poseStack, state.nameTagAttachment, offset, event.getContent(), !state.isDiscrete, state.lightCoords, camera); } -@@ -189,7 +_,7 @@ - + poseStack.popPose(); +@@ -252,7 +_,7 @@ + protected final void extractNameTags(final T entity, final S state, final float partialTicks, final double nameTagDistance, final double belowNameDistance) { if (this.entityRenderDispatcher.camera != null) { state.distanceToCameraSq = this.entityRenderDispatcher.distanceToSqr(entity); -- boolean shouldShowName = state.distanceToCameraSq < 4096.0 && this.shouldShowName(entity, state.distanceToCameraSq); -+ boolean shouldShowName = net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(entity, state.distanceToCameraSq) && this.shouldShowName(entity, state.distanceToCameraSq); +- boolean shouldShowName = state.distanceToCameraSq < Mth.square(nameTagDistance) && this.shouldShowName(entity, state.distanceToCameraSq); ++ boolean shouldShowName = net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(entity, state.distanceToCameraSq, nameTagDistance) && this.shouldShowName(entity, state.distanceToCameraSq); if (shouldShowName) { state.nameTag = this.getNameTag(entity); state.nameTagAttachment = entity.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, entity.getYRot(partialTicks)); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch index d4694ecaba..7ffa0ca238 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java -@@ -72,6 +_,7 @@ +@@ -73,6 +_,7 @@ } public void submit(final S state, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final CameraRenderState camera) { @@ -8,7 +8,7 @@ poseStack.pushPose(); if (state.hasPose(Pose.SLEEPING)) { Direction bedOrientation = state.bedOrientation; -@@ -109,6 +_,7 @@ +@@ -110,6 +_,7 @@ poseStack.popPose(); super.submit(state, poseStack, submitNodeCollector, camera); @@ -16,7 +16,7 @@ } protected boolean shouldRenderLayers(final S state) { -@@ -285,7 +_,7 @@ +@@ -278,7 +_,7 @@ state.isFullyFrozen = entity.isFullyFrozen(); state.isBaby = entity.isBaby(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch index 909399e425..f6f46b961d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch @@ -5,7 +5,7 @@ if (equippable != null && shouldRender(equippable, slot)) { A model = this.getArmorModel(state, slot); + var newModel = this.getArmorModel(state, slot, itemStack, model); - EquipmentClientInfo.LayerType layerType = state.isBaby && state.entityType != EntityType.ARMOR_STAND + EquipmentClientInfo.LayerType layerType = state.isBaby && state.entityType != EntityTypes.ARMOR_STAND ? EquipmentClientInfo.LayerType.HUMANOID_BABY : (this.usesInnerModel(slot) ? EquipmentClientInfo.LayerType.HUMANOID_LEGGINGS : EquipmentClientInfo.LayerType.HUMANOID); this.equipmentRenderer diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch index ed46262468..8dd36f4d24 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/player/AvatarRenderer.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/client/renderer/entity/player/AvatarRenderer.java +++ b/net/minecraft/client/renderer/entity/player/AvatarRenderer.java -@@ -96,7 +_,7 @@ - private static HumanoidModel.ArmPose getArmPose(final Avatar avatar, final ItemStack itemInHand, final InteractionHand hand) { - if (itemInHand.isEmpty()) { +@@ -98,7 +_,7 @@ return HumanoidModel.ArmPose.EMPTY; -- } else if (!avatar.swinging && itemInHand.is(Items.CROSSBOW) && CrossbowItem.isCharged(itemInHand)) { -+ } else if (!avatar.swinging && itemInHand.getItem() instanceof CrossbowItem && CrossbowItem.isCharged(itemInHand)) { + } + +- if (!avatar.swinging && itemInHand.is(Items.CROSSBOW) && CrossbowItem.isCharged(itemInHand)) { ++ if (!avatar.swinging && itemInHand.getItem() instanceof CrossbowItem && CrossbowItem.isCharged(itemInHand)) { return HumanoidModel.ArmPose.CROSSBOW_HOLD; + } + +@@ -141,7 +_,9 @@ + if (attack != null && attack.type() == SwingAnimationType.STAB && avatar.swinging) { + return HumanoidModel.ArmPose.SPEAR; } else { - if (avatar.getUsedItemHand() == hand && avatar.getUseItemRemainingTicks() > 0) { -@@ -138,7 +_,9 @@ - if (attack != null && attack.type() == SwingAnimationType.STAB && avatar.swinging) { - return HumanoidModel.ArmPose.SPEAR; - } else { -- return itemInHand.is(ItemTags.SPEARS) ? HumanoidModel.ArmPose.SPEAR : HumanoidModel.ArmPose.ITEM; -+ if (itemInHand.is(ItemTags.SPEARS)) return HumanoidModel.ArmPose.SPEAR; -+ var pose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemInHand).getArmPose(avatar, hand, itemInHand); -+ return pose == null ? HumanoidModel.ArmPose.ITEM : pose; - } +- return itemInHand.is(ItemTags.SPEARS) ? HumanoidModel.ArmPose.SPEAR : HumanoidModel.ArmPose.ITEM; ++ if (itemInHand.is(ItemTags.SPEARS)) return HumanoidModel.ArmPose.SPEAR; ++ var pose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemInHand).getArmPose(avatar, hand, itemInHand); ++ return pose == null ? HumanoidModel.ArmPose.ITEM : pose; } } -@@ -239,12 +_,14 @@ + +@@ -241,12 +_,14 @@ public void renderRightHand( final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final int lightCoords, final Identifier skinTexture, final boolean hasSleeve ) { @@ -35,7 +35,7 @@ this.renderHand(poseStack, submitNodeCollector, lightCoords, skinTexture, this.model.leftArm, hasSleeve); } -@@ -302,5 +_,12 @@ +@@ -304,5 +_,12 @@ public static boolean isPlayerUpsideDown(final Player player) { return isUpsideDownName(player.getGameProfile().name()); diff --git a/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch b/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch new file mode 100644 index 0000000000..1ed87d4486 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/extract/LevelExtractor.java.patch @@ -0,0 +1,58 @@ +--- a/net/minecraft/client/renderer/extract/LevelExtractor.java ++++ b/net/minecraft/client/renderer/extract/LevelExtractor.java +@@ -172,7 +_,7 @@ + profiler.popPush("entities"); + this.extractVisibleEntities(camera, cullFrustum, deltaTracker, this.levelRenderState); + profiler.popPush("blockEntities"); +- this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState); ++ this.extractVisibleBlockEntities(camera, deltaPartialTick, this.levelRenderState, cullFrustum); + profiler.popPush("blockOutline"); + this.extractBlockOutline(camera, this.levelRenderState); + profiler.popPush("blockBreaking"); +@@ -264,7 +_,7 @@ + return this.levelRenderer.entityRenderDispatcher().extractEntity(entity, partialTickTime); + } + +- private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState) { ++ private void extractVisibleBlockEntities(final Camera camera, final float deltaPartialTick, final LevelRenderState levelRenderState, final Frustum frustum) { + Vec3 cameraPos = camera.position(); + double camX = cameraPos.x(); + double camY = cameraPos.y(); +@@ -275,6 +_,7 @@ + List renderableBlockEntities = section.getSectionMesh().getRenderableBlockEntities(); + if (!renderableBlockEntities.isEmpty() && !(section.getVisibility(Util.getMillis()) < 0.3F)) { + for (BlockEntity blockEntity : renderableBlockEntities) { ++ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; + BlockPos blockPos = blockEntity.getBlockPos(); + SortedSet progresses = this.level.destructionProgress().get(blockPos.asLong()); + ModelFeatureRenderer.CrumblingOverlay breakProgress; +@@ -304,6 +_,7 @@ + if (blockEntity.isRemoved()) { + iterator.remove(); + } else { ++ if (!frustum.isVisible(blockEntity.getRenderBoundingBox())) continue; + BlockEntityRenderState state = this.levelRenderer + .blockEntityRenderDispatcher() + .tryExtractRenderState(blockEntity, deltaPartialTick, null, true); +@@ -327,7 +_,7 @@ + SortedSet progresses = entry.getValue(); + if (progresses != null && !progresses.isEmpty()) { + int progress = progresses.last().getProgress(); +- levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress)); ++ levelRenderState.blockBreakingRenderStates.add(new BlockBreakingRenderState(pos, this.level.getBlockState(pos), progress, this.level.getModelDataManager().getAtOrEmpty(pos))); + } + } + } +@@ -335,6 +_,12 @@ + + private void extractBlockOutline(final Camera camera, final LevelRenderState levelRenderState) { + levelRenderState.blockOutlineRenderState = null; ++ var custom = net.minecraftforge.client.ForgeHooksClient.onExtractBlockOutline(this, camera, levelRenderState, this.minecraft.hitResult); ++ if (custom != null) { ++ levelRenderState.blockOutlineRenderState = new BlockOutlineRenderState(BlockPos.ZERO, false, false, net.minecraft.world.phys.shapes.Shapes.empty(), null, null, null, custom); ++ return; ++ } ++ + if (this.minecraft.hitResult instanceof BlockHitResult blockHitResult) { + if (blockHitResult.getType() != HitResult.Type.MISS) { + BlockPos pos = blockHitResult.getBlockPos(); diff --git a/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch index bcf3d046c2..386f3cf404 100644 --- a/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/fog/FogRenderer.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/renderer/fog/FogRenderer.java +++ b/net/minecraft/client/renderer/fog/FogRenderer.java -@@ -153,6 +_,12 @@ - fogBlue = Mth.lerp(brightenFactor, fogBlue, fogBlue * targetScale); - } - -+ var fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(camera, partialTicks, level, renderDistance, darkenWorldAmount, fogRed, fogGreen, fogBlue); -+ -+ fogRed = fogColor.x(); -+ fogGreen = fogColor.y(); -+ fogBlue = fogColor.z(); -+ - dest.set(fogRed, fogGreen, fogBlue, 1.0F); +@@ -159,6 +_,12 @@ + fogBlue = Mth.lerp(brightenFactor, fogBlue, fogBlue * scale); } + ++ var fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(camera, partialTicks, level, renderDistance, darkenWorldAmount, fogRed, fogGreen, fogBlue); ++ ++ fogRed = fogColor.x(); ++ fogGreen = fogColor.y(); ++ fogBlue = fogColor.z(); ++ + dest.set(fogRed, fogGreen, fogBlue, 1.0F); } -@@ -181,6 +_,7 @@ + +@@ -186,6 +_,7 @@ float renderDistanceFogSpan = Mth.clamp(renderDistanceInBlocks / 10.0F, 4.0F, 64.0F); fog.renderDistanceStart = renderDistanceInBlocks - renderDistanceFogSpan; fog.renderDistanceEnd = renderDistanceInBlocks; diff --git a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch b/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch index 6297ab501f..fcbfb34b31 100644 --- a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderTypes.java.patch @@ -12,9 +12,9 @@ @@ -582,19 +_,19 @@ } - public static RenderType textIntensity(final Identifier texture) { -- return TEXT_INTENSITY.apply(texture); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensity(texture); + public static RenderType textGrayscale(final Identifier texture) { +- return TEXT_GRAYSCALE.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscale(texture); } public static RenderType textPolygonOffset(final Identifier texture) { @@ -22,9 +22,9 @@ + return net.minecraftforge.client.ForgeRenderTypes.getTextPolygonOffset(texture); } - public static RenderType textIntensityPolygonOffset(final Identifier texture) { -- return TEXT_INTENSITY_POLYGON_OFFSET.apply(texture); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensityPolygonOffset(texture); + public static RenderType textGrayscalePolygonOffset(final Identifier texture) { +- return TEXT_GRAYSCALE_POLYGON_OFFSET.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscalePolygonOffset(texture); } public static RenderType textSeeThrough(final Identifier texture) { @@ -36,9 +36,9 @@ @@ -602,7 +_,7 @@ } - public static RenderType textIntensitySeeThrough(final Identifier texture) { -- return TEXT_INTENSITY_SEE_THROUGH.apply(texture); -+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensitySeeThrough(texture); + public static RenderType textGrayscaleSeeThrough(final Identifier texture) { +- return TEXT_GRAYSCALE_SEE_THROUGH.apply(texture); ++ return net.minecraftforge.client.ForgeRenderTypes.getTextGrayscaleSeeThrough(texture); } public static RenderType lightning() { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch index 591ad8c712..0a07048d44 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/client/renderer/texture/MipmapGenerator.java +++ b/net/minecraft/client/renderer/texture/MipmapGenerator.java -@@ -122,12 +_,16 @@ - float cutoutRef = mipmapStrategy == MipmapStrategy.STRICT_CUTOUT ? 0.3F : 0.5F; - float originalCoverage = isCutoutMip ? alphaTestCoverage(currentMips[0], cutoutRef, 1.0F) : 0.0F; +@@ -123,12 +_,16 @@ + float cutoutRef = mipmapStrategy == MipmapStrategy.STRICT_CUTOUT ? 0.3F : 0.5F; + float originalCoverage = isCutoutMip ? alphaTestCoverage(currentMips[0], cutoutRef, 1.0F) : 0.0F; -+ int maxMipmapLevel = net.minecraftforge.client.ForgeHooksClient.getMaxMipmapLevel(result[0].getWidth(), result[0].getHeight()); - for (int level = 1; level <= newMipLevel; level++) { - if (level < currentMips.length) { - result[level] = currentMips[level]; - } else { - NativeImage lastData = result[level - 1]; -- NativeImage data = new NativeImage(lastData.getWidth() >> 1, lastData.getHeight() >> 1, false); -+ // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes -+ NativeImage data = new NativeImage(Math.max(1, lastData.getWidth() >> 1), Math.max(1, lastData.getHeight() >> 1), false); -+ if (level <= maxMipmapLevel) { ++ int maxMipmapLevel = net.minecraftforge.client.ForgeHooksClient.getMaxMipmapLevel(result[0].getWidth(), result[0].getHeight()); + for (int level = 1; level <= newMipLevel; level++) { + if (level < currentMips.length) { + result[level] = currentMips[level]; + } else { + NativeImage lastData = result[level - 1]; +- NativeImage data = new NativeImage(lastData.getWidth() >> 1, lastData.getHeight() >> 1, false); ++ // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes ++ NativeImage data = new NativeImage(Math.max(1, lastData.getWidth() >> 1), Math.max(1, lastData.getHeight() >> 1), false); ++ if (level <= maxMipmapLevel) { + - int width = data.getWidth(); - int height = data.getHeight(); + int width = data.getWidth(); + int height = data.getHeight(); -@@ -146,6 +_,7 @@ +@@ -147,6 +_,7 @@ - data.setPixel(x, y, color); - } -+ } + data.setPixel(x, y, color); } ++ } + } - result[level] = data; + result[level] = data; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch index adf953788d..0d4d9f1d02 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/SpriteLoader.java +++ b/net/minecraft/client/renderer/texture/SpriteLoader.java -@@ -72,7 +_,7 @@ +@@ -71,7 +_,7 @@ int minSize = Math.min(minTexelSize, lowestOneBit); int minPowerOfTwo = Mth.log2(minSize); int mipLevel; @@ -9,7 +9,7 @@ LOGGER.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.location, maxMipmapLevels, minPowerOfTwo, minSize); mipLevel = minPowerOfTwo; } else { -@@ -132,7 +_,8 @@ +@@ -129,7 +_,8 @@ final Executor taskExecutor, final Set> additionalMetadata ) { @@ -19,7 +19,7 @@ return CompletableFuture.>supplyAsync(() -> SpriteSourceList.load(manager, atlasInfoLocation).list(manager), taskExecutor) .thenCompose(sprites -> runSpriteSuppliers(spriteResourceLoader, (List)sprites, taskExecutor)) .thenApply(resources -> this.stitch((List)resources, maxMipmapLevels, taskExecutor)); -@@ -141,7 +_,7 @@ +@@ -138,7 +_,7 @@ private Map getStitchedSprites(final Stitcher stitcher, final int atlasWidth, final int atlasHeight) { Map result = new HashMap<>(); stitcher.gatherSprites( diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 185a35cc17..98165c19d2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -23,12 +23,12 @@ throw new StitcherException(holder.entry, holders.stream().map(h -> h.entry).collect(ImmutableList.toImmutableList())); } } -@@ -93,7 +_,7 @@ - boolean yWillGrow = yCanGrow && yCurrentSize != yNewSize; - boolean growOnX; - if (xWillGrow ^ yWillGrow) { -- growOnX = xWillGrow; -+ growOnX = !xWillGrow && xCanGrow; // Forge: Fix stitcher not expanding entire height before growing width, and (potentially) growing larger then the max size. - } else { - growOnX = xCanGrow && xCurrentSize <= yCurrentSize; - } +@@ -94,7 +_,7 @@ + boolean yWillGrow = yCanGrow && yCurrentSize != yNewSize; + boolean growOnX; + if (xWillGrow ^ yWillGrow) { +- growOnX = xWillGrow; ++ growOnX = !xWillGrow && xCanGrow; // Forge: Fix stitcher not expanding entire height before growing width, and (potentially) growing larger then the max size. + } else { + growOnX = xCanGrow && xCurrentSize <= yCurrentSize; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch index 65bf550361..6b9b413024 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlas.java +++ b/net/minecraft/client/renderer/texture/TextureAtlas.java -@@ -123,6 +_,7 @@ - this.sprites = sprites; - this.animatedTexturesStates = List.copyOf(animationStates); - this.uploadInitialContents(); -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); - if (SharedConstants.DEBUG_DUMP_TEXTURE_ATLAS) { - Path dumpDir = TextureUtil.getDebugTexturePath(); +@@ -135,6 +_,7 @@ + } -@@ -302,5 +_,10 @@ + this.uploadInitialContents(); ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); + if (SharedConstants.DEBUG_DUMP_TEXTURE_ATLAS) { + Path dumpDir = TextureUtil.getDebugTexturePath(); + +@@ -324,5 +_,10 @@ int getHeight() { return this.height; diff --git a/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch b/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch deleted file mode 100644 index 1bf7bb8c3e..0000000000 --- a/patches/minecraft/net/minecraft/client/resources/language/I18n.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/resources/language/I18n.java -+++ b/net/minecraft/client/resources/language/I18n.java -@@ -15,6 +_,7 @@ - - static void setLanguage(final Language locale) { - language = locale; -+ net.minecraftforge.common.ForgeI18n.loadLanguageData(locale.getLanguageData()); - } - - public static String get(final String id, final Object... args) { diff --git a/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch index 6247c80ac9..03ba4a31c1 100644 --- a/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/language/LanguageManager.java.patch @@ -10,7 +10,7 @@ } private static Map extractLanguages(final Stream resourcePacks) { -@@ -68,8 +_,12 @@ +@@ -67,8 +_,12 @@ this.reloadCallback.accept(locale); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch b/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch index b2143eb706..e5da32b5be 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/BlockStateDefinitions.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/client/resources/model/BlockStateDefinitions.java @@ -33,6 +_,8 @@ - static Function> definitionLocationToBlockStateMapper() { + public static Function> definitionLocationToBlockStateMapper() { Map> result = new HashMap<>(STATIC_DEFINITIONS); + var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onRegisterModeStateDefinitions(); + result.putAll(event.getStates()); diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch index 30c13e90c9..1053df58f3 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBaker.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/resources/model/ModelBaker.java +++ b/net/minecraft/client/resources/model/ModelBaker.java @@ -32,4 +_,16 @@ - public interface SharedOperationKey { + interface SharedOperationKey { T compute(ModelBaker modelBakery); } + diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch index fb2918adae..0b9ae29949 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ModelManager.java +++ b/net/minecraft/client/resources/model/ModelManager.java -@@ -67,6 +_,7 @@ +@@ -61,6 +_,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final FileToIdConverter MODEL_LISTER = FileToIdConverter.json("models"); private Map bakedItemStackModels = Map.of(); @@ -8,7 +8,7 @@ private Map itemProperties = Map.of(); private final AtlasManager atlasManager; private final PlayerSkinRenderCache playerSkinRenderCache; -@@ -77,6 +_,7 @@ +@@ -71,6 +_,7 @@ private @Nullable BlockModelSet blockModelSet; private @Nullable FluidStateModelSet fluidStateModelSet; private Object2IntMap modelGroups = Object2IntMaps.emptyMap(); @@ -16,7 +16,7 @@ public ModelManager(final BlockColors blockColors, final AtlasManager atlasManager, final PlayerSkinRenderCache playerSkinRenderCache) { this.blockColors = blockColors; -@@ -88,6 +_,18 @@ +@@ -82,6 +_,18 @@ return this.bakedItemStackModels.getOrDefault(id, this.missingModels.item()); } @@ -35,7 +35,7 @@ public ClientItem.Properties getItemProperties(final Identifier id) { return this.itemProperties.getOrDefault(id, ClientItem.Properties.DEFAULT); } -@@ -111,6 +_,7 @@ +@@ -105,6 +_,7 @@ final PreparableReloadListener.PreparationBarrier preparationBarrier, final Executor reloadExecutor ) { @@ -43,16 +43,14 @@ ResourceManager manager = currentReload.resourceManager(); CompletableFuture entityModelSet = CompletableFuture.supplyAsync(EntityModelSet::vanilla, taskExecutor); CompletableFuture> modelCache = loadBlockModels(manager, taskExecutor); -@@ -269,6 +_,8 @@ - bakedModelsFuture, +@@ -224,12 +_,14 @@ (bakingResult, bakedModels) -> { - Map fluidModels = FluidStateModelSet.bake(materialBaker); -+ fluidModels = net.minecraftforge.client.ForgeHooksClient.onFluidModelBake(bakery, materialBaker, fluidModels); + blockItemMaterialBaker.logMissingTextures(); + Map fluidModels = FluidStateModelSet.bake(blockOnlyMaterialBaker); ++ fluidModels = net.minecraftforge.client.ForgeHooksClient.onFluidModelBake(bakery, blockOnlyMaterialBaker, fluidModels); + net.minecraftforge.client.ForgeHooksClient.onModifyBakingResult(bakery, bakingResult); - missingSprites.asMap() - .forEach( - (location, sprites) -> LOGGER.warn( -@@ -289,7 +_,7 @@ + blockOnlyMaterialBaker.logMissingTextures(); + Map modelByStateCache = createBlockStateToModelDispatch( bakingResult.blockStateModels(), bakingResult.missingModels().block() ); return new ModelManager.ReloadState( @@ -61,7 +59,7 @@ ); } ); -@@ -327,10 +_,15 @@ +@@ -261,10 +_,15 @@ private void apply(final ModelManager.ReloadState preparations) { ModelBakery.BakingResult bakedModels = preparations.bakedModels; @@ -77,7 +75,7 @@ this.blockStateModelSet = new BlockStateModelSet(preparations.blockStateModels, this.missingModels.block()); this.blockModelSet = new BlockModelSet(this.blockStateModelSet, preparations.blockModels, this.blockColors); this.fluidStateModelSet = new FluidStateModelSet(preparations.fluidModels, this.missingModels.fluid()); -@@ -366,7 +_,8 @@ +@@ -333,7 +_,8 @@ Map blockStateModels, Map blockModels, Map fluidModels, diff --git a/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch index 8a69840bf3..d60e332b5f 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ResolvedModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ResolvedModel.java +++ b/net/minecraft/client/resources/model/ResolvedModel.java -@@ -88,7 +_,7 @@ +@@ -89,7 +_,7 @@ } default QuadCollection bakeTopGeometry(final TextureSlots textureSlots, final ModelBaker baker, final ModelState state) { @@ -9,7 +9,7 @@ } static Material.Baked resolveParticleMaterial(final TextureSlots textureSlots, final ModelBaker baker, final ModelDebugName resolvedModel) { -@@ -132,5 +_,9 @@ +@@ -133,5 +_,9 @@ default ItemTransforms getTopTransforms() { return findTopTransforms(this); diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch index bb44fc2b9f..8bd3875a95 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/CuboidModel.java.patch @@ -42,4 +42,4 @@ + return geo; if (!object.has("elements")) { return null; - } else { + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch index 2f7dbffa78..f053947293 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/cuboid/ItemTransform.java.patch @@ -14,10 +14,10 @@ public void apply(final boolean applyLeftHandFix, final PoseStack.Pose pose) { @@ -63,7 +_,7 @@ translation.set(Mth.clamp(translation.x, -5.0F, 5.0F), Mth.clamp(translation.y, -5.0F, 5.0F), Mth.clamp(translation.z, -5.0F, 5.0F)); - Vector3f scale = this.getVector3f(object, "scale", DEFAULT_SCALE); + Vector3f scale = getVector3f(object, "scale", DEFAULT_SCALE); scale.set(Mth.clamp(scale.x, -4.0F, 4.0F), Mth.clamp(scale.y, -4.0F, 4.0F), Mth.clamp(scale.z, -4.0F, 4.0F)); - return new ItemTransform(rotation, translation, scale); + return new ItemTransform(rotation, translation, scale, this.getVector3f(object, "right_rotation", DEFAULT_ROTATION)); } - private Vector3f getVector3f(final JsonObject object, final String key, final Vector3f def) { + private static Vector3f getVector3f(final JsonObject object, final String key, final Vector3fc def) { diff --git a/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch b/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch index 166488eaa6..94a691fada 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/geometry/QuadCollection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/geometry/QuadCollection.java +++ b/net/minecraft/client/resources/model/geometry/QuadCollection.java -@@ -71,6 +_,12 @@ +@@ -70,6 +_,12 @@ return this.all; } @@ -10,6 +10,6 @@ + transformer.process(this.west), transformer.process(this.up), transformer.process(this.down)); + } + - @BakedQuad.MaterialFlags - public int materialFlags() { + public @BakedQuad.MaterialFlags int materialFlags() { if (this.materialFlags == -1) { + this.materialFlags = computeMaterialFlags(this.all); diff --git a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch index 125d0efffc..989eb4441f 100644 --- a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java -@@ -98,12 +_,13 @@ +@@ -103,12 +_,13 @@ LOGGER.info("Starting integrated minecraft server version {}", SharedConstants.getCurrentVersion().name()); this.setUsesAuthentication(true); this.initializeKeyPair(); @@ -15,7 +15,7 @@ } @Override -@@ -259,6 +_,7 @@ +@@ -371,6 +_,7 @@ @Override public void halt(final boolean wait) { diff --git a/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch b/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch index 02cd7abe32..20ca07e2b3 100644 --- a/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/server/LanServerPinger.java.patch @@ -17,4 +17,4 @@ + InetAddress group = InetAddress.getByName(MULTICAST_GROUP); DatagramPacket packet = new DatagramPacket(ping, ping.length, group, 4445); this.socket.send(packet); - } catch (IOException var6) { + } catch (IOException e) { diff --git a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch index e51afe28f3..0beb89e8a4 100644 --- a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch @@ -16,7 +16,7 @@ } private synchronized void loadLibrary() { -@@ -340,12 +_,15 @@ +@@ -340,7 +_,7 @@ } } @@ -24,31 +24,33 @@ + public SoundEngine.PlayResult play(SoundInstance instance) { if (!this.loaded) { return SoundEngine.PlayResult.NOT_STARTED; - } else if (!instance.canPlaySound()) { + } +@@ -349,6 +_,9 @@ return SoundEngine.PlayResult.NOT_STARTED; - } else { -+ instance = net.minecraftforge.client.ForgeHooksClient.playSound(this, instance); -+ if (instance == null || !instance.canPlaySound()) -+ return SoundEngine.PlayResult.NOT_STARTED; - WeighedSoundEvents soundEvent = instance.resolve(this.soundManager); - Identifier eventLocation = instance.getIdentifier(); - if (soundEvent == null) { -@@ -425,15 +_,18 @@ - channel.setSelfPosition(position); - channel.setRelative(isRelative); - }); -+ SoundInstance soundinstance = instance; - if (!isStreaming) { - this.soundBuffers.getCompleteBuffer(sound.getPath()).thenAccept(soundBuffer -> handle.execute(channel -> { - channel.attachStaticBuffer(soundBuffer); - channel.play(); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlaySoundSource(this, soundinstance, channel); - })); - } else { - this.soundBuffers.getStream(sound.getPath(), isLooping).thenAccept(stream -> handle.execute(channel -> { - channel.attachBufferStream(stream); - channel.play(); -+ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlayStreamingSource(this, soundinstance, channel); - })); - } + } + ++ instance = net.minecraftforge.client.ForgeHooksClient.playSound(this, instance); ++ if (instance == null || !instance.canPlaySound()) ++ return SoundEngine.PlayResult.NOT_STARTED; + WeighedSoundEvents soundEvent = instance.resolve(this.soundManager); + Identifier eventLocation = instance.getIdentifier(); + if (soundEvent == null) { +@@ -430,15 +_,18 @@ + channel.setSelfPosition(position); + channel.setRelative(isRelative); + }); ++ SoundInstance soundinstance = instance; + if (!isStreaming) { + this.soundBuffers.getCompleteBuffer(sound.getPath()).thenAccept(soundBuffer -> handle.execute(channel -> { + channel.attachStaticBuffer(soundBuffer); + channel.play(); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlaySoundSource(this, soundinstance, channel); + })); + } else { + this.soundBuffers.getStream(sound.getPath(), isLooping).thenAccept(stream -> handle.execute(channel -> { + channel.attachBufferStream(stream); + channel.play(); ++ net.minecraftforge.client.event.ForgeEventFactoryClient.onPlayStreamingSource(this, soundinstance, channel); + })); + } diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index b69d1d9b87..58a2296f83 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -9,15 +9,15 @@ RaidCommand.register(this.dispatcher, context); DebugPathCommand.register(this.dispatcher); DebugMobSpawningCommand.register(this.dispatcher); -@@ -298,6 +_,7 @@ - if (commandSelection.includeIntegrated) { +@@ -299,6 +_,7 @@ PublishCommand.register(this.dispatcher); + UnpublishCommand.register(this.dispatcher); } + net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.dispatcher, commandSelection, context); this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer()); } -@@ -320,9 +_,18 @@ +@@ -321,9 +_,18 @@ public void performCommand(final ParseResults command, final String commandString) { CommandSourceStack sender = command.getContext().getSource(); Profiler.get().push(() -> "/" + commandString); @@ -37,7 +37,7 @@ if (commandChain != null) { executeCommandInContext( sender, -@@ -413,7 +_,10 @@ +@@ -414,7 +_,10 @@ Map, CommandNode> playerCommands = new HashMap<>(); RootCommandNode root = new RootCommandNode<>(); playerCommands.put(this.dispatcher.getRoot(), root); diff --git a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch index 7eae079a0b..8cbc4da9a8 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -129,7 +_,7 @@ +@@ -128,7 +_,7 @@ if (contextBuilder.getSource() instanceof SharedSuggestionProvider source) { StringReader reader = new StringReader(builder.getInput()); reader.setCursor(builder.getStart()); diff --git a/patches/minecraft/net/minecraft/core/BlockPos.java.patch b/patches/minecraft/net/minecraft/core/BlockPos.java.patch index 3e33eccdeb..0755583bf8 100644 --- a/patches/minecraft/net/minecraft/core/BlockPos.java.patch +++ b/patches/minecraft/net/minecraft/core/BlockPos.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java -@@ -30,7 +_,7 @@ - import org.apache.commons.lang3.tuple.Pair; +@@ -29,7 +_,7 @@ + import org.apache.commons.lang3.Validate; @Immutable -public class BlockPos extends Vec3i { diff --git a/patches/minecraft/net/minecraft/core/Holder.java.patch b/patches/minecraft/net/minecraft/core/Holder.java.patch index 38c1dc1eb9..7fbde66e6f 100644 --- a/patches/minecraft/net/minecraft/core/Holder.java.patch +++ b/patches/minecraft/net/minecraft/core/Holder.java.patch @@ -4,8 +4,8 @@ import net.minecraft.tags.TagKey; import org.jspecify.annotations.Nullable; --public interface Holder { -+public interface Holder extends java.util.function.Supplier, net.minecraftforge.registries.tags.IReverseTag { +-public sealed interface Holder permits Holder.Direct, Holder.Reference { ++public sealed interface Holder extends java.util.function.Supplier, net.minecraftforge.registries.tags.IReverseTag permits Holder.Direct, Holder.Reference { + @Override + default boolean containsTag(TagKey key) { + return this.is(key); diff --git a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch index 5eff8c0326..66de6fc518 100644 --- a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch @@ -17,47 +17,45 @@ this.validateWrite(key); Objects.requireNonNull(key); Objects.requireNonNull(value); -@@ -104,6 +_,8 @@ - holder.bindKey(key); - } else { - holder = this.byKey.computeIfAbsent(key, k -> Holder.Reference.createStandAlone(this, (ResourceKey)k)); -+ // Forge: Bind the value immediately so it can be queried while the registry is not frozen -+ holder.bindValue(value); +@@ -107,6 +_,8 @@ + holder.bindKey(key); + } else { + holder = this.byKey.computeIfAbsent(key, k -> Holder.Reference.createStandAlone(this, (ResourceKey)k)); ++ // Forge: Bind the value immediately so it can be queried while the registry is not frozen ++ holder.bindValue(value); + } + + this.byKey.put(key, holder); +@@ -278,7 +_,6 @@ + } + + this.frozen = true; +- this.byValue.forEach((value, holder) -> holder.bindValue((T)value)); + List unboundEntries = this.byKey + .entrySet() + .stream() +@@ -295,7 +_,8 @@ + throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); } - this.byKey.put(key, holder); -@@ -275,7 +_,6 @@ - return this; - } else { - this.frozen = true; -- this.byValue.forEach((value, holder) -> holder.bindValue((T)value)); - List unboundEntries = this.byKey - .entrySet() - .stream() -@@ -291,7 +_,8 @@ - throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); - } - -- this.unregisteredIntrusiveHolders = null; -+ // Forge: We freeze/unfreeze vanilla registries more than once, so we need to keep the unregistered intrusive holders map around. -+ //this.unregisteredIntrusiveHolders = null; - } - - if (this.allTags.isBound()) { -@@ -305,8 +_,9 @@ - .sorted() - .toList(); - if (!unboundTags.isEmpty()) { -- throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + unboundTags); -- } else { -+ LOGGER.debug(MARKER, "Unbound tags in registry " + this.key() + ": " + unboundTags); -+ bindAllUnboundTagsToEmpty(); -+ } /* else */ { - this.componentLookup = new DataComponentLookup<>(this.byId); - this.allTags = MappedRegistry.TagSet.fromMap(this.frozenTags); - this.refreshTagsInHolders(); -@@ -317,6 +_,13 @@ +- this.unregisteredIntrusiveHolders = null; ++ // Forge: We freeze/unfreeze vanilla registries more than once, so we need to keep the unregistered intrusive holders map around. ++ //this.unregisteredIntrusiveHolders = null; } + + if (this.allTags.isBound()) { +@@ -310,7 +_,8 @@ + .sorted() + .toList(); + if (!unboundTags.isEmpty()) { +- throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + unboundTags); ++ LOGGER.debug(MARKER, "Unbound tags in registry " + this.key() + ": " + unboundTags); ++ bindAllUnboundTagsToEmpty(); + } + + this.componentLookup = new DataComponentLookup<>(this.byId); +@@ -319,6 +_,13 @@ + return this; } + private void bindAllUnboundTagsToEmpty() { @@ -70,7 +68,7 @@ @Override public Holder.Reference createIntrusiveHolder(final T value) { if (this.unregisteredIntrusiveHolders == null) { -@@ -395,6 +_,31 @@ +@@ -393,6 +_,31 @@ }; } @@ -102,15 +100,15 @@ @Override public Registry.PendingTags prepareTagReload(final TagLoader.LoadResult tags) { if (!this.frozen) { -@@ -450,6 +_,11 @@ - @Override - public HolderLookup.RegistryLookup lookup() { - return patchedHolder; -+ } +@@ -441,6 +_,11 @@ + @Override + public HolderLookup.RegistryLookup lookup() { + return patchedHolder; ++ } + -+ @Override -+ public List> getPending(TagKey key) { -+ return pendingContents.getOrDefault(key, List.of()); - } ++ @Override ++ public List> getPending(TagKey key) { ++ return pendingContents.getOrDefault(key, List.of()); + } - @Override + @Override diff --git a/patches/minecraft/net/minecraft/core/Registry.java.patch b/patches/minecraft/net/minecraft/core/Registry.java.patch index 2ca4381be8..374850a9da 100644 --- a/patches/minecraft/net/minecraft/core/Registry.java.patch +++ b/patches/minecraft/net/minecraft/core/Registry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/Registry.java +++ b/net/minecraft/core/Registry.java -@@ -180,5 +_,7 @@ +@@ -175,5 +_,7 @@ void apply(); int size(); diff --git a/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch b/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch index da7821729f..27bba4809c 100644 --- a/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistrySetBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/RegistrySetBuilder.java +++ b/net/minecraft/core/RegistrySetBuilder.java -@@ -23,7 +_,8 @@ +@@ -22,7 +_,8 @@ import org.apache.commons.lang3.mutable.MutableObject; import org.jspecify.annotations.Nullable; @@ -10,7 +10,7 @@ private final List> entries = new ArrayList<>(); private static HolderGetter wrapContextLookup(final HolderLookup.RegistryLookup original) { -@@ -67,14 +_,43 @@ +@@ -66,14 +_,43 @@ public RegistrySetBuilder add( final ResourceKey> key, final Lifecycle lifecycle, final RegistrySetBuilder.RegistryBootstrap bootstrap ) { @@ -56,35 +56,35 @@ RegistrySetBuilder.BuildState state = RegistrySetBuilder.BuildState.create(context, this.entries.stream().map(RegistrySetBuilder.RegistryStub::key)); this.entries.forEach(e -> e.apply(state)); @@ -181,14 +_,16 @@ - throw new NullPointerException("No cloner for " + registryKey.identifier()); - } else { - Map, Holder.Reference> entries = new HashMap<>(); -- HolderLookup.RegistryLookup patchContents = patchProvider.lookupOrThrow(registryKey); -+ HolderLookup.RegistryLookup patchContents = patchProvider.lookup(registryKey).orElse(null); - patchContents.listElements().forEach(elementHolder -> { - ResourceKey elementKey = elementHolder.key(); - RegistrySetBuilder.LazyHolder holder = new RegistrySetBuilder.LazyHolder<>(owner, elementKey); - holder.supplier = () -> cloner.clone((T)elementHolder.value(), patchProvider, targetProvider.get()); - entries.put(elementKey, holder); - }); -- HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookupOrThrow(registryKey); -+ HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookup(registryKey).orElse(null); -+ Lifecycle lifecycle = patchContents.registryLifecycle(); -+ if (fallbackContents != null) { - fallbackContents.listElements().forEach(elementHolder -> { - ResourceKey elementKey = elementHolder.key(); - entries.computeIfAbsent(elementKey, key -> { -@@ -197,7 +_,8 @@ - return holder; - }); - }); -- Lifecycle lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); -+ lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); -+ } - return lookupFromMap(registryKey, lifecycle, owner, entries); } + + Map, Holder.Reference> entries = new HashMap<>(); +- HolderLookup.RegistryLookup patchContents = patchProvider.lookupOrThrow(registryKey); ++ HolderLookup.RegistryLookup patchContents = patchProvider.lookup(registryKey).orElse(null); + patchContents.listElements().forEach(elementHolder -> { + ResourceKey elementKey = elementHolder.key(); + RegistrySetBuilder.LazyHolder holder = new RegistrySetBuilder.LazyHolder<>(owner, elementKey); + holder.supplier = () -> cloner.clone((T)elementHolder.value(), patchProvider, targetProvider.get()); + entries.put(elementKey, holder); + }); +- HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookupOrThrow(registryKey); ++ HolderLookup.RegistryLookup fallbackContents = fallbackProvider.lookup(registryKey).orElse(null); ++ Lifecycle lifecycle = patchContents.registryLifecycle(); ++ if (fallbackContents != null) { + fallbackContents.listElements().forEach(elementHolder -> { + ResourceKey elementKey = elementHolder.key(); + entries.computeIfAbsent(elementKey, key -> { +@@ -197,7 +_,8 @@ + return holder; + }); + }); +- Lifecycle lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); ++ lifecycle = patchContents.registryLifecycle().add(fallbackContents.registryLifecycle()); ++ } + return lookupFromMap(registryKey, lifecycle, owner, entries); } -@@ -271,6 +_,11 @@ + +@@ -266,6 +_,11 @@ @Override public HolderGetter lookup(final ResourceKey> key) { return (HolderGetter)BuildState.this.registries.getOrDefault(key.identifier(), BuildState.this.lookup); diff --git a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch index ff9bc9d0ef..f756c58e99 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch @@ -25,4 +25,4 @@ - AbstractBoat boat = this.type.create(level, EntitySpawnReason.DISPENSER); if (boat != null) { boat.setInitialPos(spawnX, spawnY + yOffset, spawnZ); - EntityType.createDefaultStackConfig(level, dispensed, null).accept(boat); + EntityType.createDefaultStackConfig(level, dispensed, null).apply(boat); diff --git a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch index fa2c8bdf84..35d8910ab2 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -147,7 +_,7 @@ +@@ -141,7 +_,7 @@ DispensibleContainerItem bucket = (DispensibleContainerItem)dispensed.getItem(); BlockPos target = source.pos().relative(source.state().getValue(DispenserBlock.FACING)); Level level = source.level(); @@ -9,15 +9,3 @@ bucket.checkExtraContent(null, level, dispensed, target); return this.consumeWithRemainder(source, dispensed, new ItemStack(Items.BUCKET)); } else { -@@ -198,8 +_,9 @@ - } else if (CampfireBlock.canLight(target) || CandleBlock.canLight(target) || CandleCakeBlock.canLight(target)) { - level.setBlockAndUpdate(targetPos, target.setValue(BlockStateProperties.LIT, true)); - level.gameEvent(null, GameEvent.BLOCK_CHANGE, targetPos); -- } else if (target.getBlock() instanceof TntBlock) { -- if (TntBlock.prime(level, targetPos)) { -+ } else if (target.isFlammable(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite())) { -+ if (target.onCaughtFire(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite(), null)) { -+ if (target.getBlock() instanceof TntBlock) - level.removeBlock(targetPos, false); - } else { - this.setSuccess(false); diff --git a/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch new file mode 100644 index 0000000000..67d867e46e --- /dev/null +++ b/patches/minecraft/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java ++++ b/net/minecraft/core/dispenser/FlintAndSteelDispenseItemBehavior.java +@@ -32,8 +_,9 @@ + } else if (CampfireBlock.canLight(target) || CandleBlock.canLight(target) || CandleCakeBlock.canLight(target)) { + level.setBlockAndUpdate(targetPos, target.setValue(BlockStateProperties.LIT, true)); + level.gameEvent(null, GameEvent.BLOCK_CHANGE, targetPos); +- } else if (target.getBlock() instanceof TntBlock) { +- if (TntBlock.prime(level, targetPos)) { ++ } else if (target.isFlammable(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite())) { ++ if (target.onCaughtFire(level, targetPos, source.state().getValue(DispenserBlock.FACING).getOpposite(), null)) { ++ if (target.getBlock() instanceof TntBlock) + level.removeBlock(targetPos, false); + } else { + this.setSuccess(false); diff --git a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch index 9db6fd0f5d..ebb3225c50 100644 --- a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch +++ b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java -@@ -385,11 +_,13 @@ +@@ -389,11 +_,13 @@ } private static > R internalRegister( @@ -16,7 +16,7 @@ WRITABLE_REGISTRY.register((ResourceKey)name, registry, RegistrationInfo.BUILT_IN); return registry; } -@@ -425,7 +_,7 @@ +@@ -429,7 +_,7 @@ if (r instanceof DefaultedRegistry) { Identifier key = ((DefaultedRegistry)r).getDefaultKey(); diff --git a/patches/minecraft/net/minecraft/core/registries/Registries.java.patch b/patches/minecraft/net/minecraft/core/registries/Registries.java.patch index 19ddbb8e35..6069af07bf 100644 --- a/patches/minecraft/net/minecraft/core/registries/Registries.java.patch +++ b/patches/minecraft/net/minecraft/core/registries/Registries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/registries/Registries.java +++ b/net/minecraft/core/registries/Registries.java -@@ -323,6 +_,8 @@ +@@ -326,6 +_,8 @@ } private static String registryDirPath(final ResourceKey> registryKey) { diff --git a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch index 4ce67a2fa3..3aa26cd8e4 100644 --- a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/DataGenerator.java +++ b/net/minecraft/data/DataGenerator.java -@@ -19,6 +_,7 @@ +@@ -18,6 +_,7 @@ protected final PackOutput vanillaPackOutput; protected final Set allProviderIds = new HashSet<>(); protected final Map providersToRun = new LinkedHashMap<>(); @@ -8,7 +8,7 @@ public DataGenerator(final Path output) { this.vanillaPackOutput = new PackOutput(output); -@@ -34,6 +_,35 @@ +@@ -33,6 +_,35 @@ Path packOutputDir = this.vanillaPackOutput.getOutputFolder(PackOutput.Target.DATA_PACK).resolve("minecraft").resolve("datapacks").resolve(packId); return new DataGenerator.PackGenerator(toRun, packId, new PackOutput(packOutputDir)); } @@ -44,7 +44,7 @@ static { Bootstrap.bootStrap(); -@@ -61,6 +_,7 @@ +@@ -60,6 +_,7 @@ DataGenerator.LOGGER.debug("Generator {} already run for version {}", providerId, this.version.name()); } else { DataGenerator.LOGGER.info("Starting provider: {}", providerId); @@ -52,7 +52,7 @@ stopwatch.start(); cache.applyUpdate(cache.generateUpdate(providerId, provider::run).join()); stopwatch.stop(); -@@ -112,6 +_,7 @@ +@@ -109,6 +_,7 @@ Stopwatch stopwatch = Stopwatch.createUnstarted(); this.providersToRun.forEach((providerId, provider) -> { DataGenerator.LOGGER.info("Starting uncached provider: {}", providerId); diff --git a/patches/minecraft/net/minecraft/data/HashCache.java.patch b/patches/minecraft/net/minecraft/data/HashCache.java.patch index 81ecf0ff66..abe2871b98 100644 --- a/patches/minecraft/net/minecraft/data/HashCache.java.patch +++ b/patches/minecraft/net/minecraft/data/HashCache.java.patch @@ -25,7 +25,7 @@ cache.save(this.rootDir, cachePath, DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(ZonedDateTime.now()) + "\t" + providerId); } -@@ -224,10 +_,11 @@ +@@ -217,10 +_,11 @@ output.write(extraHeaderInfo); output.newLine(); @@ -38,4 +38,4 @@ + output.write(rootDir.relativize(e.getKey()).toString().replace("\\", "/")); // Forge: Standardize file paths. output.newLine(); } - } catch (IOException var9) { + } catch (IOException e) { diff --git a/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch index 7e9b2796ac..2cedc75886 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/EntityLootSubProvider.java +++ b/net/minecraft/data/loot/EntityLootSubProvider.java -@@ -120,12 +_,16 @@ +@@ -117,12 +_,16 @@ public abstract void generate(); diff --git a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch index 08cccec02f..0dbbdf45d1 100644 --- a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,23 +1,24 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -891,13 +_,13 @@ - } - +@@ -908,14 +_,14 @@ + final List> tasks = new ArrayList<>(); + RecipeOutput recipeOutput = new RecipeOutput() { @Override - public void accept(final ResourceKey> id, final Recipe recipe, final @Nullable AdvancementHolder advancementHolder) { + public void accept(final ResourceKey> id, final Recipe recipe, net.minecraft.resources.@Nullable Identifier advancementId, com.google.gson.@Nullable JsonElement advancement) { if (!allRecipes.add(id)) { throw new IllegalStateException("Duplicate recipe " + id.identifier()); - } else { - this.saveRecipe(id, recipe); -- if (advancementHolder != null) { -- this.saveAdvancement(advancementHolder); -+ if (advancement != null && advancementId != null) { -+ this.saveAdvancement(advancementId, advancement); - } + } + + this.saveRecipe(id, recipe); +- if (advancementHolder != null) { +- this.saveAdvancement(advancementHolder); ++ if (advancement != null && advancementId != null) { ++ this.saveAdvancement(advancementId, advancement); } } -@@ -912,19 +_,26 @@ + +@@ -929,19 +_,26 @@ AdvancementHolder root = Advancement.Builder.recipeAdvancement() .addCriterion("impossible", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance())) .build(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT); diff --git a/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch b/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch index dbe1bb8181..adf14ed7fa 100644 --- a/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch +++ b/patches/minecraft/net/minecraft/data/registries/VanillaRegistries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/registries/VanillaRegistries.java +++ b/net/minecraft/data/registries/VanillaRegistries.java -@@ -108,6 +_,7 @@ +@@ -110,6 +_,7 @@ .add(Registries.TIMELINE, Timelines::bootstrap) .add(Registries.VILLAGER_TRADE, VillagerTrades::bootstrap) .add(Registries.TRADE_SET, TradeSets::bootstrap); @@ -8,7 +8,7 @@ private static void validateThatAllBiomeFeaturesHaveBiomeFilter(final HolderLookup.Provider provider) { validateThatAllBiomeFeaturesHaveBiomeFilter(provider.lookupOrThrow(Registries.PLACED_FEATURE), provider.lookupOrThrow(Registries.BIOME)); -@@ -139,5 +_,9 @@ +@@ -141,5 +_,9 @@ HolderLookup.Provider newRegistries = BUILDER.build(staticRegistries); validateThatAllBiomeFeaturesHaveBiomeFilter(newRegistries); return newRegistries; diff --git a/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch index 6fc2e16a2b..7f57b981e8 100644 --- a/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch @@ -3,7 +3,7 @@ @@ -9,8 +_,14 @@ import net.minecraft.world.level.block.entity.BannerPatterns; - public class BannerPatternTagsProvider extends KeyTagProvider { + public class BannerPatternTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #BannerPatternTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated public BannerPatternTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { diff --git a/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch b/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch new file mode 100644 index 0000000000..46728d91f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/BlockItemTagAppender.java.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/data/tags/BlockItemTagAppender.java ++++ b/net/minecraft/data/tags/BlockItemTagAppender.java +@@ -56,4 +_,28 @@ + this.original.addOptionalTag(tag); + return this; + } ++ ++ @Override ++ public TagAppender addOptional(net.minecraft.resources.Identifier location) { ++ this.original.addOptional(location); ++ return this; ++ } ++ ++ @Override ++ public TagAppender replace(boolean value) { ++ this.original.replace(value); ++ return this; ++ } ++ ++ @Override ++ public TagAppender remove(final net.minecraft.resources.Identifier location) { ++ this.original.remove(location); ++ return this; ++ } ++ ++ @Override ++ public TagAppender remove(TagKey tag) { ++ this.original.remove(tag); ++ return this; ++ } + } diff --git a/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch new file mode 100644 index 0000000000..3f4b6a64db --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/BlockItemTagsProvider.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/data/tags/BlockItemTagsProvider.java ++++ b/net/minecraft/data/tags/BlockItemTagsProvider.java +@@ -64,6 +_,12 @@ + return this; + } + ++ default BlockItemTagsProvider.CombinedAppender add(final BlockItemTagId... ids) { ++ for (var id : ids) ++ addTag(id); ++ return this; ++ } ++ + default BlockItemTagsProvider.CombinedAppender addAll(final Collection ids) { + this.addAll(ids.stream()); + return this; diff --git a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch index 61dfb52c0e..5159b1e7c2 100644 --- a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/data/tags/EntityTypeTagsProvider.java +++ b/net/minecraft/data/tags/EntityTypeTagsProvider.java -@@ -12,6 +_,10 @@ - super(output, Registries.ENTITY_TYPE, lookupProvider, e -> e.builtInRegistryHolder().key()); +@@ -13,6 +_,10 @@ + super(output, Registries.ENTITY_TYPE, lookupProvider); } + public EntityTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(output, Registries.ENTITY_TYPE, lookupProvider, e -> e.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(output, Registries.ENTITY_TYPE, lookupProvider, modId, existingFileHelper); + } + @Override diff --git a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch index 565f54b821..28fd0f8030 100644 --- a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/FluidTagsProvider.java +++ b/net/minecraft/data/tags/FluidTagsProvider.java @@ -13,6 +_,10 @@ - super(output, Registries.FLUID, lookupProvider, e -> e.builtInRegistryHolder().key()); + super(output, Registries.FLUID, lookupProvider); } + public FluidTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(output, Registries.FLUID, lookupProvider, e -> e.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(output, Registries.FLUID, lookupProvider, modId, existingFileHelper); + } + @Override protected void addTags(final HolderLookup.Provider registries) { - this.tag(FluidTags.WATER).add(Fluids.WATER, Fluids.FLOWING_WATER); + this.tag(FluidTags.WATER).add(FluidIds.WATER, FluidIds.FLOWING_WATER); diff --git a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch index 9c4d02eee9..dbd35d4100 100644 --- a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -59,6 +_,10 @@ +@@ -60,6 +_,10 @@ super(output, Registries.GAME_EVENT, lookupProvider); } diff --git a/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch deleted file mode 100644 index 54a860a62e..0000000000 --- a/patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java -+++ b/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java -@@ -26,6 +_,18 @@ - final PackOutput output, - final ResourceKey> registryKey, - final CompletableFuture lookupProvider, -+ final Function> keyExtractor, -+ final String modid, -+ final @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper -+ ) { -+ super(output, registryKey, lookupProvider, modid, existingFileHelper); -+ this.keyExtractor = keyExtractor; -+ } -+ -+ public IntrinsicHolderTagsProvider( -+ final PackOutput output, -+ final ResourceKey> registryKey, -+ final CompletableFuture lookupProvider, - final CompletableFuture> parentProvider, - final Function> keyExtractor - ) { -@@ -33,8 +_,21 @@ - this.keyExtractor = keyExtractor; - } - -+ public IntrinsicHolderTagsProvider( -+ final PackOutput output, -+ final ResourceKey> registryKey, -+ final CompletableFuture lookupProvider, -+ final CompletableFuture> parentProvider, -+ final Function> keyExtractor, -+ final String modid, -+ final @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper -+ ) { -+ super(output, registryKey, lookupProvider, parentProvider, modid, existingFileHelper); -+ this.keyExtractor = keyExtractor; -+ } -+ - protected TagAppender tag(final TagKey tag) { - TagBuilder builder = this.getOrCreateRawBuilder(tag); -- return TagAppender.forBuilder(builder).map(this.keyExtractor); -+ return TagAppender.forBuilder(builder, this.modId).map(this.keyExtractor); - } - } diff --git a/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch deleted file mode 100644 index d8f7ac66d3..0000000000 --- a/patches/minecraft/net/minecraft/data/tags/KeyTagProvider.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/data/tags/KeyTagProvider.java -+++ b/net/minecraft/data/tags/KeyTagProvider.java -@@ -20,9 +_,13 @@ - return TagAppender.forBuilder(builder); - } - -+ protected KeyTagProvider(final PackOutput output, final ResourceKey> registryKey, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(output, registryKey, lookupProvider, modId, existingFileHelper); -+ } -+ - protected TagAppender, T> tag(final TagKey tag, final boolean replace) { - TagBuilder builder = this.getOrCreateRawBuilder(tag); - builder.setReplace(replace); -- return TagAppender.forBuilder(builder); -+ return TagAppender.forBuilder(builder, this.modId); - } - } diff --git a/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch index d1801fec15..f7a73aa2b4 100644 --- a/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch @@ -3,7 +3,7 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.entity.decoration.painting.PaintingVariants; - public class PaintingVariantTagsProvider extends KeyTagProvider { + public class PaintingVariantTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #PaintingVariantTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ public PaintingVariantTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { super(output, Registries.PAINTING_VARIANT, lookupProvider); diff --git a/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch index e9fa6dd1be..3549bd0cd1 100644 --- a/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch @@ -3,7 +3,7 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.entity.ai.village.poi.PoiTypes; - public class PoiTypeTagsProvider extends KeyTagProvider { + public class PoiTypeTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #PoiTypeTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ public PoiTypeTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { super(output, Registries.POINT_OF_INTEREST_TYPE, lookupProvider); diff --git a/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch index 60cfd57a4d..e2f5697e5e 100644 --- a/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch @@ -3,7 +3,7 @@ @@ -9,8 +_,13 @@ import net.minecraft.world.level.levelgen.structure.Structure; - public class StructureTagsProvider extends KeyTagProvider { + public class StructureTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@linkplain #StructureTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ public StructureTagsProvider(final PackOutput output, final CompletableFuture lookupProvider) { super(output, Registries.STRUCTURE, lookupProvider); diff --git a/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch b/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch index 149eb6002d..f30cfc6529 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagAppender.java.patch @@ -1,29 +1,30 @@ --- a/net/minecraft/data/tags/TagAppender.java +++ b/net/minecraft/data/tags/TagAppender.java -@@ -9,7 +_,7 @@ +@@ -7,7 +_,7 @@ import net.minecraft.tags.TagBuilder; import net.minecraft.tags.TagKey; --public interface TagAppender { -+public interface TagAppender extends net.minecraftforge.common.extensions.IForgeTagAppender { - TagAppender add(E element); +-public interface TagAppender { ++public interface TagAppender extends net.minecraftforge.common.extensions.IForgeTagAppender { + TagAppender add(ResourceKey element); - default TagAppender add(final E... elements) { -@@ -33,6 +_,10 @@ - TagAppender addOptionalTag(TagKey tag); + default TagAppender add(final ResourceKey... elements) { +@@ -31,6 +_,10 @@ + TagAppender addOptionalTag(TagKey tag); - static TagAppender, T> forBuilder(final TagBuilder builder) { + static TagAppender forBuilder(final TagBuilder builder) { + return forBuilder(builder, "unknown"); + } + -+ static TagAppender, T> forBuilder(final TagBuilder builder, String source) { - return new TagAppender, T>() { - public TagAppender, T> add(final ResourceKey element) { - builder.addElement(element.identifier()); -@@ -55,6 +_,21 @@ ++ static TagAppender forBuilder(final TagBuilder builder, String source) { + return new TagAppender() { + @Override + public TagAppender add(final ResourceKey element) { +@@ -54,6 +_,16 @@ + public TagAppender addOptionalTag(final TagKey tag) { builder.addOptionalTag(tag.location()); return this; - } ++ } + + @Override + public TagBuilder getInternalBuilder() { @@ -33,35 +34,6 @@ + @Override + public String getSourceName() { + return source; -+ } -+ -+ @Override -+ public TagAppender, T> remove(ResourceKey value) { -+ return this.remove(value.identifier()); -+ } - }; - } - -@@ -86,6 +_,22 @@ - @Override - public TagAppender addOptionalTag(final TagKey tag) { - original.addOptionalTag(tag); -+ return this; -+ } -+ -+ @Override -+ public TagBuilder getInternalBuilder() { -+ return original.getInternalBuilder(); -+ } -+ -+ @Override -+ public String getSourceName() { -+ return original.getSourceName(); -+ } -+ -+ @Override -+ public TagAppender remove(U value) { -+ original.remove(converter.apply(value)); - return this; } }; + } diff --git a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch index 3836edd899..61dd38debc 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch @@ -81,20 +81,20 @@ if (!unresolvedEntries.isEmpty()) { throw new IllegalArgumentException( String.format( -@@ -93,8 +_,11 @@ - ) +@@ -94,8 +_,11 @@ ); - } else { -- Path path = this.pathProvider.json(id); -- return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace()), path); -+ Path path = this.getPath(id); -+ if (path == null) { -+ return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. -+ } -+ return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace(), builder.getRemoveEntries().toList()), path); } + +- Path path = this.pathProvider.json(id); +- return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace()), path); ++ Path path = this.getPath(id); ++ if (path == null) { ++ return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. ++ } ++ return DataProvider.saveStable(cache, c.contents, TagFile.CODEC, new TagFile(entries, builder.shouldReplace(), builder.getRemoveEntries().toList()), path); } ) + .toArray(CompletableFuture[]::new) @@ -105,7 +_,12 @@ } @@ -109,12 +109,10 @@ } public CompletableFuture> contentsGetter() { -@@ -118,6 +_,15 @@ - this.addTags(registries); - return (HolderLookup.Provider)registries; +@@ -120,15 +_,24 @@ }); -+ } -+ + } + + + private boolean missing(TagEntry reference) { + // Optional tags should not be validated @@ -122,6 +120,19 @@ + return existingFileHelper == null || !existingFileHelper.exists(reference.getId(), reference.isTag() ? resourceType : elementResourceType); + } + return false; ++ } ++ + protected TagAppender tag(final TagKey tag) { + TagBuilder builder = this.getOrCreateRawBuilder(tag); +- return TagAppender.forBuilder(builder); ++ return TagAppender.forBuilder(builder, this.modId); + } + + protected TagAppender tag(final TagKey tag, final boolean replace) { + TagBuilder builder = this.getOrCreateRawBuilder(tag); + builder.setReplace(replace); +- return TagAppender.forBuilder(builder); ++ return TagAppender.forBuilder(builder, this.modId); } @FunctionalInterface diff --git a/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch index b1f6fb2758..4e69799faf 100644 --- a/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/VanillaBlockTagsProvider.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/data/tags/VanillaBlockTagsProvider.java +++ b/net/minecraft/data/tags/VanillaBlockTagsProvider.java -@@ -17,6 +_,10 @@ - super(output, Registries.BLOCK, lookupProvider, e -> e.builtInRegistryHolder().key()); +@@ -29,6 +_,10 @@ + }; } + public VanillaBlockTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(output, Registries.BLOCK, lookupProvider, e -> e.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(output, Registries.BLOCK, lookupProvider, modId, existingFileHelper); + } + @Override protected void addTags(final HolderLookup.Provider registries) { - (new BlockItemTagsProvider() { + new VanillaBlockItemTagsProvider(tagId -> BlockItemTagsProvider.wrapForBlocks(this.tag(tagId.block()))).run(); diff --git a/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch index b85e778d9c..cb163841a1 100644 --- a/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/VanillaItemTagsProvider.java.patch @@ -1,26 +1,13 @@ --- a/net/minecraft/data/tags/VanillaItemTagsProvider.java +++ b/net/minecraft/data/tags/VanillaItemTagsProvider.java -@@ -16,6 +_,10 @@ - super(output, Registries.ITEM, lookupProvider, e -> e.builtInRegistryHolder().key()); +@@ -28,6 +_,10 @@ + }; } + public VanillaItemTagsProvider(final PackOutput output, final CompletableFuture lookupProvider, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(output, Registries.ITEM, lookupProvider, e -> e.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(output, Registries.ITEM, lookupProvider, modId, existingFileHelper); + } + @Override protected void addTags(final HolderLookup.Provider registries) { - (new BlockItemTagsProvider() { -@@ -578,6 +_,12 @@ - @Override - public TagAppender addOptionalTag(final TagKey tag) { - this.itemAppender.addOptionalTag(blockTagToItemTag(tag)); -+ return this; -+ } -+ -+ @Override -+ public TagAppender remove(final Block value) { -+ this.itemAppender.remove(Objects.requireNonNull(value.asItem())); - return this; - } - } + new VanillaBlockItemTagsProvider(tagId -> BlockItemTagsProvider.wrapForItems(this.tag(tagId.item()))).run(); diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch index d11eb8800a..a77a2f311d 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/gametest/framework/GameTestHelper.java +++ b/net/minecraft/gametest/framework/GameTestHelper.java -@@ -76,7 +_,7 @@ +@@ -77,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.jspecify.annotations.Nullable; @@ -9,7 +9,7 @@ private final GameTestInfo testInfo; private boolean finalCheckAdded; -@@ -1076,6 +_,12 @@ +@@ -1109,6 +_,12 @@ return this.testInfo.getTick(); } @@ -22,7 +22,7 @@ public AABB getBounds() { return this.testInfo.getStructureBounds(); } -@@ -1122,6 +_,26 @@ +@@ -1153,6 +_,26 @@ if (result.right().isPresent()) { throw this.assertionException("test.error.set_biome"); } diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch index 08f4ca665b..76fcf278cc 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -9,11 +9,11 @@ enabledPacks.remove("vanilla"); enabledPacks.addFirst("vanilla"); WorldDataConfiguration defaultTestConfig = new WorldDataConfiguration(new DataPackConfig(enabledPacks, List.of()), ENABLED_FEATURES); -@@ -173,6 +_,7 @@ +@@ -174,6 +_,7 @@ @Override protected boolean initServer() { + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, new EmptyNotificationService()) { - { - Objects.requireNonNull(GameTestServer.this); + this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, new EmptyNotificationService()) {}); + Gizmos.withCollector(GizmoCollector.NOOP); + this.loadLevel(); diff --git a/patches/minecraft/net/minecraft/locale/Language.java.patch b/patches/minecraft/net/minecraft/locale/Language.java.patch index bf914e4b7d..ed7306a5e9 100644 --- a/patches/minecraft/net/minecraft/locale/Language.java.patch +++ b/patches/minecraft/net/minecraft/locale/Language.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java -@@ -37,7 +_,8 @@ +@@ -38,7 +_,8 @@ BiConsumer output = loadedData::put; parseTranslations(output, "/assets/minecraft/lang/en_us.json"); deprecatedInfo.applyToMap(loadedData); @@ -10,7 +10,7 @@ return new Language() { @Override public String getOrDefault(final String elementId, final String defaultValue) { -@@ -62,6 +_,11 @@ +@@ -63,6 +_,11 @@ ) .isPresent(); } @@ -22,9 +22,11 @@ }; } -@@ -89,6 +_,8 @@ +@@ -89,7 +_,10 @@ + public static void inject(final Language language) { instance = language; ++ net.minecraftforge.common.ForgeI18n.loadLanguageData(language.getLanguageData()); } + + public Map getLanguageData() { return Map.of(); } diff --git a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch index 98e18d9c7f..ee3ca5ffca 100644 --- a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch +++ b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch @@ -9,16 +9,16 @@ private final byte[] encodeBuf = new byte[8192]; private final Deflater deflater; private int threshold; -@@ -24,6 +_,12 @@ - VarInt.write(out, 0); - out.writeBytes(uncompressed); - } else { -+ if (!DISABLE_PACKET_DEBUG && uncompressedLength > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { -+ uncompressed.markReaderIndex(); -+ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", uncompressedLength, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, -+ net.minecraftforge.common.util.HexDumper.dump(uncompressed)); -+ uncompressed.resetReaderIndex(); -+ } - byte[] input = new byte[uncompressedLength]; - uncompressed.readBytes(input); - VarInt.write(out, input.length); +@@ -25,6 +_,12 @@ + VarInt.write(out, 0); + out.writeBytes(uncompressed); + } else { ++ if (!DISABLE_PACKET_DEBUG && uncompressedLength > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { ++ uncompressed.markReaderIndex(); ++ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", uncompressedLength, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, ++ net.minecraftforge.common.util.HexDumper.dump(uncompressed)); ++ uncompressed.resetReaderIndex(); ++ } + byte[] input = new byte[uncompressedLength]; + uncompressed.readBytes(input); + VarInt.write(out, input.length); diff --git a/patches/minecraft/net/minecraft/network/Connection.java.patch b/patches/minecraft/net/minecraft/network/Connection.java.patch index f5e92ecd28..2567ce0d12 100644 --- a/patches/minecraft/net/minecraft/network/Connection.java.patch +++ b/patches/minecraft/net/minecraft/network/Connection.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java @@ -81,9 +_,17 @@ - private boolean handlingFault; private volatile @Nullable DisconnectionDetails delayedDisconnect; private @Nullable BandwidthDebugMonitor bandwidthDebugMonitor; + private @Nullable UUID intendedProfileId; + private java.util.function.Consumer activationHandler; + private final net.minecraftforge.common.util.PacketLogger packetLogger = new net.minecraftforge.common.util.PacketLogger(this); + private ProtocolInfo outboundProtocol = null; @@ -26,41 +26,41 @@ if (this.delayedDisconnect != null) { this.disconnect(this.delayedDisconnect); } -@@ -151,6 +_,7 @@ - } else { - if (packetListener.shouldHandleMessage(packet)) { - try { -+ packetLogger.recv(packet); - genericsFtw(packet, packetListener); - } catch (RunningOnDifferentThreadException var5) { - } catch (RejectedExecutionException var6) { -@@ -200,6 +_,7 @@ - if (protocol.flow() != this.getReceiving()) { +@@ -152,6 +_,7 @@ + + if (packetListener.shouldHandleMessage(packet)) { + try { ++ packetLogger.recv(packet); + genericsFtw(packet, packetListener); + } catch (RunningOnDifferentThreadException var5) { + } catch (RejectedExecutionException ignored) { +@@ -201,6 +_,7 @@ throw new IllegalStateException("Invalid inbound protocol: " + protocol.id()); - } else { -+ this.inboundProtocol = protocol; - this.packetListener = packetListener; - this.disconnectListener = null; - UnconfiguredPipelineHandler.InboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupInboundProtocol(protocol); -@@ -217,7 +_,7 @@ - if (protocol.flow() != this.getSending()) { - throw new IllegalStateException("Invalid outbound protocol: " + protocol.id()); - } else { -- UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol); -+ UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol).andThen(_ -> this.outboundProtocol = protocol); - BundlerInfo bundlerInfo = protocol.bundlerInfo(); - if (bundlerInfo != null) { - PacketBundleUnpacker newUnbundler = new PacketBundleUnpacker(bundlerInfo); -@@ -264,7 +_,8 @@ - this.disconnectListener = listener; - this.runOnceConnected(connection -> { - this.setupInboundProtocol(inbound, listener); -- connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), hostName, port, intent), null, true); -+ // TODO: Change this to be a immediately sent login custom payload packet? -+ connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), net.minecraftforge.network.NetworkContext.enhanceHostName(hostName), port, intent), null, true); - this.setupOutboundProtocol(outbound); - }); } + ++ this.inboundProtocol = protocol; + this.packetListener = packetListener; + this.disconnectListener = null; + UnconfiguredPipelineHandler.InboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupInboundProtocol(protocol); +@@ -218,7 +_,7 @@ + throw new IllegalStateException("Invalid outbound protocol: " + protocol.id()); + } + +- UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol); ++ UnconfiguredPipelineHandler.OutboundConfigurationTask configMessage = UnconfiguredPipelineHandler.setupOutboundProtocol(protocol).andThen(_ -> this.outboundProtocol = protocol); + BundlerInfo bundlerInfo = protocol.bundlerInfo(); + if (bundlerInfo != null) { + PacketBundleUnpacker newUnbundler = new PacketBundleUnpacker(bundlerInfo); +@@ -265,7 +_,8 @@ + this.disconnectListener = listener; + this.runOnceConnected(connection -> { + this.setupInboundProtocol(inbound, listener); +- connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), hostName, port, intent), null, true); ++ // TODO: Change this to be a immediately sent login custom payload packet? ++ connection.sendPacket(new ClientIntentionPacket(SharedConstants.getCurrentVersion().protocolVersion(), net.minecraftforge.network.NetworkContext.enhanceHostName(hostName), port, intent), null, true); + this.setupOutboundProtocol(outbound); + }); + } @@ -309,10 +_,13 @@ if (listener != null) { ChannelFuture future = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); @@ -95,7 +95,7 @@ @Override protected void initChannel(final Channel channel) { try { -@@ -499,7 +_,8 @@ +@@ -491,7 +_,8 @@ public static Connection connectToLocalServer(final SocketAddress address) { final Connection connection = new Connection(PacketFlow.CLIENTBOUND); diff --git a/patches/minecraft/net/minecraft/resources/Identifier.java.patch b/patches/minecraft/net/minecraft/resources/Identifier.java.patch index 870fa93d0b..302c39ded6 100644 --- a/patches/minecraft/net/minecraft/resources/Identifier.java.patch +++ b/patches/minecraft/net/minecraft/resources/Identifier.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/Identifier.java +++ b/net/minecraft/resources/Identifier.java -@@ -266,4 +_,10 @@ +@@ -274,4 +_,10 @@ return path; } } diff --git a/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch b/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch index d53de572f7..d76a89a96c 100644 --- a/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch +++ b/patches/minecraft/net/minecraft/resources/RegistryDataLoader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java -@@ -80,7 +_,7 @@ +@@ -81,7 +_,7 @@ public class RegistryDataLoader { private static final Logger LOGGER = LogUtils.getLogger(); private static final Comparator> ERROR_KEY_COMPARATOR = Comparator., Identifier>comparing(ResourceKey::registry).thenComparing(ResourceKey::identifier); @@ -9,7 +9,7 @@ new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), -@@ -130,7 +_,7 @@ +@@ -132,7 +_,7 @@ public static final List> DIMENSION_REGISTRIES = List.of( new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC) ); @@ -18,7 +18,7 @@ new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.NETWORK_CODEC), new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC), -@@ -160,6 +_,10 @@ +@@ -163,6 +_,10 @@ new RegistryDataLoader.RegistryData<>(Registries.WORLD_CLOCK, WorldClock.DIRECT_CODEC), new RegistryDataLoader.RegistryData<>(Registries.TIMELINE, Timeline.NETWORK_CODEC) ); diff --git a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch index 071f0c0ff1..5b3820256f 100644 --- a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourceKey.java +++ b/net/minecraft/resources/ResourceKey.java -@@ -9,7 +_,7 @@ +@@ -10,7 +_,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.network.codec.StreamCodec; @@ -9,7 +9,7 @@ private static final ConcurrentMap> VALUES = new MapMaker().weakValues().makeMap(); private final Identifier registryName; private final Identifier identifier; -@@ -65,5 +_,18 @@ +@@ -74,5 +_,18 @@ } private record InternKey(Identifier registry, Identifier identifier) { diff --git a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch index 12ae3a7053..8392dba490 100644 --- a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -56,6 +_,8 @@ - CauldronInteractions.bootStrap(); - BuiltInRegistries.bootStrap(); - CreativeModeTabs.validate(); -+ net.minecraftforge.registries.GameData.vanillaSnapshot(); -+ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context - wrapStreams(); - bootstrapDuration.set(Duration.between(start, Instant.now()).toMillis()); - } -@@ -122,7 +_,6 @@ +@@ -59,6 +_,8 @@ + CauldronInteractions.bootStrap(); + BuiltInRegistries.bootStrap(); + CreativeModeTabs.validate(); ++ net.minecraftforge.registries.GameData.vanillaSnapshot(); ++ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context + wrapStreams(); + bootstrapDuration.set(Duration.between(start, Instant.now()).toMillis()); + } +@@ -123,7 +_,6 @@ Commands.validate(); } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index 5b9d1beade..6bb69fb7f5 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -82,6 +_,17 @@ +@@ -85,6 +_,17 @@ OptionSpec jfrProfilingOption = parser.accepts("jfrProfile"); OptionSpec pidFile = parser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); OptionSpec nonOptions = parser.nonOptions(); @@ -18,7 +18,7 @@ try { OptionSet options = parser.parse(args); -@@ -90,6 +_,14 @@ +@@ -93,6 +_,14 @@ return; } @@ -33,7 +33,7 @@ Path pidFilePath = options.valueOf(pidFile); if (pidFilePath != null) { writePidFile(pidFilePath); -@@ -104,24 +_,28 @@ +@@ -107,26 +_,30 @@ Bootstrap.validate(); Util.startTimerHackThread(); Path settingsFile = Paths.get("server.properties"); @@ -58,6 +58,8 @@ - File universePath = new File(options.valueOf(universe)); Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), universePath); + NotificationManager notificationManager = new NotificationManager(); + ManagementServer jsonRpcServer = JsonRpc.create(settings, notificationManager); String levelName = Optional.ofNullable(options.valueOf(worldName)).orElse(settings.getProperties().levelName); + // Forge: make each gametest use a timestamped world name + if (uniqueWorld != null && options.has(uniqueWorld)) @@ -69,7 +71,7 @@ LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(universePath.toPath()); LevelStorageSource.LevelStorageAccess access = levelStorageSource.validateAndCreateAccess(levelName); Dynamic levelDataTag; -@@ -157,6 +_,10 @@ +@@ -162,6 +_,10 @@ PackRepository packRepository = ServerPacksSource.createPackRepository(access); @@ -80,7 +82,7 @@ WorldStem worldStem; try { WorldLoader.InitConfig worldLoadConfig = loadOrCreateConfig(settings.getProperties(), levelDataTag, safeModeEnabled, packRepository); -@@ -219,6 +_,7 @@ +@@ -233,6 +_,7 @@ @Override public void run() { dedicatedServer.halt(true); @@ -88,7 +90,7 @@ } }; shutdownThread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); -@@ -254,6 +_,16 @@ +@@ -268,6 +_,16 @@ worldOptions = bonusChest ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; dimensions = properties.createDimensions(context.datapackWorldgen()); } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index f9a9dfaf3a..f8e85ecfb6 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -297,7 +_,7 @@ +@@ -296,7 +_,7 @@ public static S spin(final Function factory) { AtomicReference serverReference = new AtomicReference<>(); @@ -9,7 +9,7 @@ thread.setUncaughtExceptionHandler((t, e) -> LOGGER.error("Uncaught exception in server thread", e)); if (Runtime.getRuntime().availableProcessors() > 4) { thread.setPriority(8); -@@ -443,6 +_,7 @@ +@@ -436,6 +_,7 @@ this.scoreboard.load(this.savedDataStorage.computeIfAbsent(ScoreboardSaveData.TYPE).getData()); this.commandStorage = new CommandStorage(this.savedDataStorage); this.stopwatches = this.savedDataStorage.computeIfAbsent(Stopwatches.TYPE); @@ -17,7 +17,7 @@ if (!levelData.isInitialized()) { try { setInitialSpawn(overworld, levelData, worldOptions.generateBonusChest(), isDebug, this.levelLoadListener); -@@ -477,6 +_,7 @@ +@@ -470,6 +_,7 @@ this, this.executor, this.storageSource, derivedLevelData, dimension, entry.getValue(), isDebug, biomeZoomSeed, ImmutableList.of(), false ); this.levels.put(dimension, level); @@ -25,7 +25,7 @@ } else { level = overworld; } -@@ -499,6 +_,7 @@ +@@ -492,6 +_,7 @@ levelData.setSpawn(LevelData.RespawnData.of(level.dimension(), BlockPos.ZERO.above(80), 0.0F, 0.0F)); } else { ServerChunkCache chunkSource = level.getChunkSource(); @@ -33,15 +33,15 @@ ChunkPos spawnChunk = ChunkPos.containing(chunkSource.randomState().sampler().findSpawnPosition()); levelLoadListener.start(LevelLoadListener.Stage.PREPARE_GLOBAL_SPAWN, 0); levelLoadListener.updateFocus(level.dimension(), spawnChunk); -@@ -688,6 +_,7 @@ - for (ServerLevel levelx : this.getAllLevels()) { - if (levelx != null) { +@@ -678,6 +_,7 @@ + for (ServerLevel level : this.getAllLevels()) { + if (level != null) { try { -+ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(levelx); - levelx.close(); - } catch (IOException var5) { - LOGGER.error("Exception closing the level", (Throwable)var5); -@@ -735,9 +_,11 @@ ++ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(level); + level.close(); + } catch (IOException e) { + LOGGER.error("Exception closing the level", e); +@@ -725,9 +_,11 @@ throw new IllegalStateException("Failed to initialize server"); } @@ -53,16 +53,16 @@ while (this.running) { long thisTickNanos; -@@ -791,6 +_,8 @@ +@@ -781,6 +_,8 @@ this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } + net.minecraftforge.server.ServerLifecycleHooks.handleServerStopping(this); + net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // Forge: Has to come before MinecraftServer#onServerCrash to avoid race conditions - } catch (Throwable var69) { - LOGGER.error("Encountered an unexpected exception", var69); - CrashReport report = constructOrExtractCrashReport(var69); -@@ -802,6 +_,7 @@ + } catch (Throwable t) { + LOGGER.error("Encountered an unexpected exception", t); + CrashReport report = constructOrExtractCrashReport(t); +@@ -792,6 +_,7 @@ LOGGER.error("We were unable to save this crash report to disk."); } @@ -70,15 +70,15 @@ this.onServerCrash(report); } finally { try { -@@ -810,6 +_,7 @@ - } catch (Throwable var64) { - LOGGER.error("Exception stopping the server", var64); +@@ -800,6 +_,7 @@ + } catch (Throwable t) { + LOGGER.error("Exception stopping the server", t); } finally { + net.minecraftforge.server.ServerLifecycleHooks.handleServerStopped(this); this.onServerExit(); } } -@@ -990,12 +_,14 @@ +@@ -980,12 +_,14 @@ } } @@ -93,7 +93,7 @@ } this.ticksUntilAutosave--; -@@ -1013,6 +_,7 @@ +@@ -1003,6 +_,7 @@ this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)tickTime / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; this.logTickMethodTime(nano); profiler.pop(); @@ -101,7 +101,7 @@ } protected void processPacketsAndTick(final boolean sprinting) { -@@ -1074,7 +_,8 @@ +@@ -1064,7 +_,8 @@ Optional.of(players), Optional.of(ServerStatus.Version.current()), Optional.ofNullable(this.statusIcon), @@ -111,7 +111,7 @@ ); } -@@ -1119,9 +_,11 @@ +@@ -1109,9 +_,11 @@ profiler.push("levels"); this.updateEffectiveRespawnData(); @@ -124,7 +124,7 @@ try { level.tick(haveTime); -@@ -1130,9 +_,11 @@ +@@ -1120,9 +_,11 @@ level.fillReportDetails(report); throw new ReportedException(report); } @@ -136,7 +136,7 @@ } profiler.popPush("connection"); -@@ -1141,7 +_,7 @@ +@@ -1131,7 +_,7 @@ this.playerList.tick(); profiler.popPush("debugSubscribers"); this.debugSubscribers.tick(); @@ -145,7 +145,7 @@ profiler.popPush("gameTests"); GameTestTicker.SINGLETON.tick(); } -@@ -1227,7 +_,7 @@ +@@ -1217,7 +_,7 @@ } public String getServerModName() { @@ -154,7 +154,7 @@ } public ServerClockManager clockManager() { -@@ -1563,6 +_,7 @@ +@@ -1561,6 +_,7 @@ this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures()); @@ -162,7 +162,7 @@ }, this); if (this.isSameThread()) { this.managedBlock(result::isDone); -@@ -1574,12 +_,15 @@ +@@ -1572,12 +_,15 @@ public static WorldDataConfiguration configurePackRepository( final PackRepository packRepository, final WorldDataConfiguration initialDataConfig, final boolean initMode, final boolean safeMode ) { @@ -176,10 +176,10 @@ if (safeMode) { - return configureRepositoryWithSelection(packRepository, List.of("vanilla"), forcedFeatures, false); + return configureRepositoryWithSelection(packRepository, net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla(), forcedFeatures, false); - } else { - Set selected = Sets.newLinkedHashSet(); + } -@@ -2233,6 +_,48 @@ + Set selected = Sets.newLinkedHashSet(); +@@ -2226,6 +_,48 @@ public ServerLinks serverLinks() { return ServerLinks.EMPTY; diff --git a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch index e99ae1a416..bd42a95708 100644 --- a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java -@@ -172,6 +_,7 @@ +@@ -171,6 +_,7 @@ this.unregisterListeners(holder); this.progressChanged.add(holder); result = true; @@ -8,7 +8,7 @@ if (!wasDone && progress.isDone()) { holder.value().rewards().grant(this.player); holder.value().display().ifPresent(display -> { -@@ -179,6 +_,7 @@ +@@ -178,6 +_,7 @@ this.playerList.broadcastSystemMessage(display.getType().createAnnouncement(holder, this.player), false); } }); @@ -16,7 +16,7 @@ } } -@@ -197,6 +_,7 @@ +@@ -196,6 +_,7 @@ this.registerListeners(advancement); this.progressChanged.add(advancement); result = true; diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 5cf33b4b10..bf6bdbf01c 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,51 +1,51 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -97,6 +_,7 @@ +@@ -88,6 +_,7 @@ + private final ServerLinks serverLinks; private final Map codeOfConductTexts; - private @Nullable ManagementServer jsonRpcServer; - private long lastHeartbeat; + private final @Nullable ManagementServer jsonRpcServer; + private net.minecraft.client.server.@Nullable LanServerPinger dediLanPinger; public DedicatedServer( final Thread serverThread, -@@ -211,6 +_,7 @@ - +@@ -167,6 +_,7 @@ + Thread consoleThread = new Thread("Server console handler") { @Override public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); String line; -@@ -284,11 +_,13 @@ - this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSubscribers(), RemoteDebugSampleType.TICK_TIME); - long levelNanoTime = Util.getNanos(); - this.services.nameToIdCache().resolveOfflineUsers(!this.usesAuthentication()); -+ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); - this.loadLevel(); - long elapsed = Util.getNanos() - levelNanoTime; - String time = String.format(Locale.ROOT, "%.3fs", elapsed / 1.0E9); - LOGGER.info("Done ({})! For help, type \"help\"", time); -+ this.nextTickTimeNanos = Util.getNanos(); //Forge: Update server time to prevent watchdog/spaming during long load. - if (properties.announcePlayerAchievements != null) { - this.getGameRules().set(GameRules.SHOW_ADVANCEMENT_MESSAGES, properties.announcePlayerAchievements, this); - } -@@ -318,7 +_,12 @@ - - this.saveEverything(false, true, true); - this.notificationManager().serverStarted(); -- return true; -+ if (net.minecraftforge.common.ForgeConfig.SERVER.advertiseDedicatedServerToLan.get()) { -+ this.dediLanPinger = new net.minecraft.client.server.LanServerPinger(this.getMotd(), String.valueOf(this.getServerPort())); -+ this.dediLanPinger.start(); -+ } -+ -+ return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); +@@ -241,11 +_,13 @@ + this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSubscribers(), RemoteDebugSampleType.TICK_TIME); + long levelNanoTime = Util.getNanos(); + this.services.nameToIdCache().resolveOfflineUsers(!this.usesAuthentication()); ++ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; + LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); + this.loadLevel(); + long elapsed = Util.getNanos() - levelNanoTime; + String time = String.format(Locale.ROOT, "%.3fs", elapsed / 1.0E9); + LOGGER.info("Done ({})! For help, type \"help\"", time); ++ this.nextTickTimeNanos = Util.getNanos(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (properties.announcePlayerAchievements != null) { + this.getGameRules().set(GameRules.SHOW_ADVANCEMENT_MESSAGES, properties.announcePlayerAchievements, this); } +@@ -274,7 +_,12 @@ + + this.saveEverything(false, true, true); + this.notificationManager().serverStarted(); +- return true; ++ if (net.minecraftforge.common.ForgeConfig.SERVER.advertiseDedicatedServerToLan.get()) { ++ this.dediLanPinger = new net.minecraft.client.server.LanServerPinger(this.getMotd(), String.valueOf(this.getServerPort())); ++ this.dediLanPinger.start(); ++ } ++ ++ return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); } -@@ -470,6 +_,13 @@ - LOGGER.error("Interrupted while stopping the management server", (Throwable)var2); + @Override +@@ -417,6 +_,13 @@ + LOGGER.error("Interrupted while stopping the management server", e); } } + @@ -58,7 +58,7 @@ } @Override -@@ -751,8 +_,13 @@ +@@ -719,8 +_,13 @@ @Override protected void stopServer() { diff --git a/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch b/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch index c539d68dc4..ad47d9f1f5 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/ServerWatchdog.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/dedicated/ServerWatchdog.java +++ b/net/minecraft/server/dedicated/ServerWatchdog.java -@@ -78,7 +_,7 @@ - ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); - ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); +@@ -80,7 +_,7 @@ + ThreadInfo[] threadInfos = Util.dumpThreadInfo(); + Arrays.sort(threadInfos, THREAD_INFO_COMPARATOR); StringBuilder builder = new StringBuilder(); -- Error exception = new Error("Watchdog"); -+ Error exception = new Error(String.format(java.util.Locale.ENGLISH, "ServerHangWatchdog detected that a single server tick took too long")); // Forge: don't just make a crash report with a seemingly-inexplicable Error +- Error exception = new Error("Watchdog (" + message + ")"); ++ Error exception = new Error("Watchdog (" + message + ") detected that a single server tick took too long"); // Forge: don't just make a crash report with a seemingly-inexplicable Error for (ThreadInfo threadInfo : threadInfos) { if (threadInfo.getThreadId() == mainThreadId) { diff --git a/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch b/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch index 26cb9685f4..fbbfbafb00 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/dedicated/Settings.java +++ b/net/minecraft/server/dedicated/Settings.java -@@ -66,7 +_,7 @@ +@@ -58,7 +_,7 @@ public void store(final Path output) { try (Writer os = Files.newBufferedWriter(output, StandardCharsets.UTF_8)) { - this.properties.store(os, "Minecraft server properties"); + net.minecraftforge.common.util.SortedProperties.store(this.properties, os, "Minecraft server properties"); - } catch (IOException var7) { + } catch (IOException e) { LOGGER.error("Failed to store properties to file: {}", output); } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 44192e7b79..b6f29e0aa7 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/gui/MinecraftServerGui.java +++ b/net/minecraft/server/gui/MinecraftServerGui.java -@@ -141,8 +_,10 @@ +@@ -136,8 +_,10 @@ return panel; } @@ -11,7 +11,7 @@ } public void close() { -@@ -156,6 +_,9 @@ +@@ -151,6 +_,9 @@ } public void print(final JTextArea console, final JScrollPane scrollPane, final String line) { diff --git a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch index 207194d26e..a4cd417234 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -391,6 +_,7 @@ - this.modified = true; - } - -+ net.minecraftforge.event.ForgeEventFactory.fireChunkTicketLevelUpdated(this.level, node, oldLevel, level, chunk); - return chunk; +@@ -392,6 +_,7 @@ + this.modified = true; } + ++ net.minecraftforge.event.ForgeEventFactory.fireChunkTicketLevelUpdated(this.level, node, oldLevel, level, chunk); + return chunk; } + @@ -522,6 +_,7 @@ if (this.pendingUnloads.remove(pos, chunkHolder) && chunk != null) { if (chunk instanceof LevelChunk levelChunk) { @@ -16,15 +16,15 @@ } this.save(chunk); -@@ -764,6 +_,7 @@ - this.activeChunkWrites.incrementAndGet(); - SerializableChunkData data = SerializableChunkData.copyOf(this.level, chunk); - CompletableFuture encodedData = CompletableFuture.supplyAsync(data::write, Util.backgroundExecutor()); -+ net.minecraftforge.event.ForgeEventFactory.onChunkDataSave(chunk, chunk.getWorldForge() != null ? chunk.getWorldForge() : this.level, data); - this.write(pos, encodedData::join).handle((ignored, throwable) -> { - if (throwable != null) { - this.level.getServer().reportChunkSaveFailure(throwable, this.storageInfo(), pos); -@@ -1136,7 +_,7 @@ +@@ -767,6 +_,7 @@ + this.activeChunkWrites.incrementAndGet(); + SerializableChunkData data = SerializableChunkData.copyOf(this.level, chunk); + CompletableFuture encodedData = CompletableFuture.supplyAsync(data::write, Util.backgroundExecutor()); ++ net.minecraftforge.event.ForgeEventFactory.onChunkDataSave(chunk, chunk.getWorldForge() != null ? chunk.getWorldForge() : this.level, data); + this.write(pos, encodedData::join).handle((ignored, throwable) -> { + if (throwable != null) { + this.level.getServer().reportChunkSaveFailure(throwable, this.storageInfo(), pos); +@@ -1142,7 +_,7 @@ } protected void addEntity(final Entity entity) { diff --git a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch index 53826a331c..c3e4756ad1 100644 --- a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -190,6 +_,10 @@ +@@ -189,6 +_,10 @@ return this.ticketDispatcher.getDebugStatus(); } diff --git a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch index f62f30b1af..c76f6f6747 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -193,6 +_,10 @@ - if (chunkHolder == null) { - return null; - } else { -+ // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. -+ if (chunkHolder.currentlyLoading != null) { -+ return chunkHolder.currentlyLoading; -+ } - ChunkAccess chunk = chunkHolder.getChunkIfPresent(ChunkStatus.FULL); - if (chunk != null) { - this.storeInCache(pos, chunk, ChunkStatus.FULL); +@@ -194,6 +_,11 @@ + return null; + } + ++ // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. ++ if (chunkHolder.currentlyLoading != null) { ++ return chunkHolder.currentlyLoading; ++ } ++ + ChunkAccess chunk = chunkHolder.getChunkIfPresent(ChunkStatus.FULL); + if (chunk != null) { + this.storeInCache(pos, chunk, ChunkStatus.FULL); diff --git a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch index 40dfb42506..30b21a502a 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -257,6 +_,7 @@ +@@ -262,6 +_,7 @@ public void removePairing(final ServerPlayer player) { this.entity.stopSeenByPlayer(player); player.connection.send(new ClientboundRemoveEntitiesPacket(this.entity.getId())); @@ -8,7 +8,7 @@ } public void addPairing(final ServerPlayer player) { -@@ -264,6 +_,7 @@ +@@ -269,6 +_,7 @@ this.sendPairingData(player, packets::add); player.connection.send(new ClientboundBundlePacket(packets)); this.entity.startSeenByPlayer(player); diff --git a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch index 06fa862fa8..d5e687789e 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -216,10 +_,12 @@ +@@ -217,10 +_,12 @@ private final List customSpawners; private @Nullable EnderDragonFight dragonFight; private final Int2ObjectMap dragonParts = new Int2ObjectOpenHashMap<>(); @@ -13,7 +13,7 @@ public ServerLevel( final MinecraftServer server, -@@ -303,6 +_,18 @@ +@@ -304,6 +_,18 @@ this.waypointManager = new ServerWaypointManager(); this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build(); this.updateSkyBrightness(); @@ -31,8 +31,8 @@ + return getCapabilities(); } - @Deprecated -@@ -354,7 +_,9 @@ + @Override +@@ -367,7 +_,9 @@ if (this.sleepStatus.areEnoughSleeping(percentage) && this.sleepStatus.areEnoughDeepSleeping(percentage, this.players)) { Optional> defaultClock = this.dimensionType().defaultClock(); if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) { @@ -43,7 +43,7 @@ } this.wakeUpAllPlayers(); -@@ -428,6 +_,7 @@ +@@ -441,6 +_,7 @@ entity.stopRiding(); } @@ -51,7 +51,7 @@ profiler.push("tick"); this.guardEntityTick(this::tickNonPassenger, entity); profiler.pop(); -@@ -569,6 +_,7 @@ +@@ -581,6 +_,7 @@ BlockPos topPos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); BlockPos belowPos = topPos.below(); Biome biome = this.getBiome(topPos).value(); @@ -59,7 +59,7 @@ if (biome.shouldFreeze(this, belowPos)) { this.setBlockAndUpdate(belowPos, Blocks.ICE.defaultBlockState()); } -@@ -778,8 +_,8 @@ +@@ -790,8 +_,8 @@ this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.START_RAINING, 0.0F)); } @@ -70,7 +70,7 @@ } } -@@ -817,6 +_,7 @@ +@@ -829,6 +_,7 @@ entity.tickCount++; profiler.push(entity.typeHolder()::getRegisteredName); profiler.incrementCounter("tickNonPassenger"); @@ -78,7 +78,7 @@ entity.tick(); profiler.pop(); -@@ -834,6 +_,7 @@ +@@ -846,6 +_,7 @@ ProfilerFiller profiler = Profiler.get(); profiler.push(entity.typeHolder()::getRegisteredName); profiler.incrementCounter("tickPassenger"); @@ -86,7 +86,7 @@ entity.rideTick(); profiler.pop(); -@@ -880,6 +_,7 @@ +@@ -892,6 +_,7 @@ } else { this.entityManager.autoSave(); } @@ -94,7 +94,7 @@ } } -@@ -971,6 +_,7 @@ +@@ -983,6 +_,7 @@ } private void addPlayer(final ServerPlayer player) { @@ -102,7 +102,7 @@ Entity existing = this.getEntity(player.getUUID()); if (existing != null) { LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); -@@ -978,7 +_,8 @@ +@@ -990,7 +_,8 @@ this.removePlayerImmediately((ServerPlayer)existing, Entity.RemovalReason.DISCARDED); } @@ -112,7 +112,7 @@ } private boolean addEntity(final Entity entity) { -@@ -986,7 +_,12 @@ +@@ -998,7 +_,12 @@ LOGGER.warn("Tried to add entity {} but it was marked as removed already", entity.typeHolder().getRegisteredName()); return false; } else { @@ -126,7 +126,7 @@ } } -@@ -1035,6 +_,8 @@ +@@ -1047,6 +_,8 @@ final float pitch, final long seed ) { @@ -135,7 +135,7 @@ this.server .getPlayerList() .broadcast( -@@ -1042,9 +_,9 @@ +@@ -1054,9 +_,9 @@ x, y, z, @@ -147,7 +147,7 @@ ); } -@@ -1058,6 +_,8 @@ +@@ -1070,6 +_,8 @@ final float pitch, final long seed ) { @@ -156,7 +156,7 @@ this.server .getPlayerList() .broadcast( -@@ -1067,7 +_,7 @@ +@@ -1079,7 +_,7 @@ sourceEntity.getZ(), sound.value().getRange(volume), this.dimension(), @@ -165,7 +165,7 @@ ); } -@@ -1116,6 +_,7 @@ +@@ -1128,6 +_,7 @@ @Override public void gameEvent(final Holder gameEvent, final Vec3 position, final GameEvent.Context context) { @@ -173,7 +173,7 @@ this.gameEventDispatcher.post(gameEvent, position, context); } -@@ -1154,11 +_,15 @@ +@@ -1166,11 +_,15 @@ @Override public void updateNeighborsAt(final BlockPos pos, final Block sourceBlock) { @@ -189,7 +189,7 @@ this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, null, orientation); } -@@ -1166,6 +_,10 @@ +@@ -1178,6 +_,10 @@ public void updateNeighborsAtExceptFromFacing( final BlockPos pos, final Block blockObject, final Direction skipDirection, final @Nullable Orientation orientation ) { @@ -200,7 +200,7 @@ this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, blockObject, skipDirection, orientation); } -@@ -1214,7 +_,7 @@ +@@ -1226,7 +_,7 @@ Explosion.BlockInteraction blockInteraction = switch (interactionType) { case NONE -> Explosion.BlockInteraction.KEEP; case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY); @@ -209,7 +209,7 @@ ? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY); -@@ -1222,6 +_,8 @@ +@@ -1234,6 +_,8 @@ }; Vec3 center = new Vec3(x, y, z); ServerExplosion explosion = new ServerExplosion(this, source, damageSource, damageCalculator, center, r, fire, blockInteraction); @@ -218,7 +218,7 @@ int blockCount = explosion.explode(); ParticleOptions explosionParticle = explosion.isSmall() ? smallExplosionParticles : largeExplosionParticles; -@@ -1888,6 +_,11 @@ +@@ -1894,6 +_,11 @@ return this.getGameRules().get(GameRules.SPAWNER_BLOCKS_WORK); } @@ -228,9 +228,9 @@ + } + private final class EntityCallbacks implements LevelCallback { - private EntityCallbacks() { - Objects.requireNonNull(ServerLevel.this); -@@ -1948,6 +_,12 @@ + public void onCreated(final Entity entity) { + if (entity instanceof WaypointTransmitter waypoint && waypoint.isTransmittingWaypoint()) { +@@ -1949,6 +_,12 @@ } } @@ -243,7 +243,7 @@ entity.updateDynamicGameEventListener(DynamicGameEventListener::add); } -@@ -1976,8 +_,17 @@ +@@ -1977,8 +_,17 @@ } } diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch index 2ee95df9d8..f9691666ec 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -202,7 +_,8 @@ +@@ -205,7 +_,8 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -10,7 +10,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; -@@ -880,6 +_,7 @@ +@@ -881,6 +_,7 @@ @Override public void die(final DamageSource source) { @@ -18,32 +18,32 @@ this.gameEvent(GameEvent.ENTITY_DIE); boolean showDeathMessage = this.level().getGameRules().get(GameRules.SHOW_DEATH_MESSAGES); if (showDeathMessage) { -@@ -1088,6 +_,7 @@ +@@ -1093,6 +_,7 @@ } public @Nullable ServerPlayer teleport(final TeleportTransition transition) { + if (net.minecraftforge.event.ForgeEventFactory.onTravelToDimension(this, transition.newLevel().dimension())) return null; if (this.isRemoved()) { return null; - } else { -@@ -1115,7 +_,7 @@ - PlayerList playerList = this.server.getPlayerList(); - playerList.sendPlayerPermissionLevel(this); - oldLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); -- this.unsetRemoved(); -+ this.revive(); - ProfilerFiller profiler = Profiler.get(); - profiler.push("moving"); - if (lastDimension == Level.OVERWORLD && newLevel.dimension() == Level.NETHER) { -@@ -1140,6 +_,7 @@ - this.lastSentHealth = -1.0F; - this.lastSentFood = -1; - this.teleportSpectators(transition, oldLevel); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerChangedDimension(this, lastDimension, transition.newLevel().dimension()); - return this; - } } -@@ -1181,10 +_,13 @@ +@@ -1122,7 +_,7 @@ + PlayerList playerList = this.server.getPlayerList(); + playerList.sendPlayerPermissionLevel(this); + oldLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); +- this.unsetRemoved(); ++ this.revive(); + ProfilerFiller profiler = Profiler.get(); + profiler.push("moving"); + if (lastDimension == Level.OVERWORLD && newLevel.dimension() == Level.NETHER) { +@@ -1147,6 +_,7 @@ + this.lastSentHealth = -1.0F; + this.lastSentFood = -1; + this.teleportSpectators(transition, oldLevel); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerChangedDimension(this, lastDimension, transition.newLevel().dimension()); + return this; + } + +@@ -1186,10 +_,13 @@ @Override public Either startSleepInBed(final BlockPos pos) { @@ -58,7 +58,7 @@ boolean canSetSpawn = rule.canSetSpawn(this.level()); if (!canSetSpawn && !canSleep) { return Either.left(rule.asProblem()); -@@ -1248,6 +_,7 @@ +@@ -1250,6 +_,7 @@ } private boolean bedInRange(final BlockPos pos, final Direction direction) { @@ -66,15 +66,15 @@ return this.isReachableBedBlock(pos) || this.isReachableBedBlock(pos.relative(direction.getOpposite())); } -@@ -1350,6 +_,7 @@ - this.connection.send(new ClientboundOpenScreenPacket(menu.containerId, menu.getType(), provider.getDisplayName())); - this.initMenu(menu); - this.containerMenu = menu; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerOpenContainer(this, this.containerMenu); - return OptionalInt.of(this.containerCounter); - } +@@ -1354,6 +_,7 @@ + this.connection.send(new ClientboundOpenScreenPacket(menu.containerId, menu.getType(), provider.getDisplayName())); + this.initMenu(menu); + this.containerMenu = menu; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerOpenContainer(this, this.containerMenu); + return OptionalInt.of(this.containerCounter); } -@@ -1419,6 +_,7 @@ + } +@@ -1422,6 +_,7 @@ public void doCloseContainer() { this.containerMenu.removed(this); this.inventoryMenu.transferState(this.containerMenu); @@ -82,7 +82,7 @@ this.containerMenu = this.inventoryMenu; } -@@ -1636,6 +_,15 @@ +@@ -1641,6 +_,15 @@ this.setShoulderEntityRight(oldPlayer.getShoulderEntityRight()); this.setLastDeathLocation(oldPlayer.getLastDeathLocation()); this.waypointIcon().copyFrom(oldPlayer.waypointIcon()); @@ -98,7 +98,7 @@ } private void transferInventoryXpAndScore(final Player oldPlayer) { -@@ -1745,8 +_,9 @@ +@@ -1750,8 +_,9 @@ return (ServerLevel)super.level(); } @@ -108,18 +108,18 @@ + mode = net.minecraftforge.common.ForgeHooks.onChangeGameType(this, this.gameMode.getGameModeForPlayer(), mode); if (!this.gameMode.changeGameModeForPlayer(mode)) { return false; - } else { -@@ -1930,6 +_,9 @@ + } +@@ -1935,6 +_,9 @@ public void setCamera(final @Nullable Entity newCamera) { Entity oldCamera = this.getCamera(); - this.camera = (Entity)(newCamera == null ? this : newCamera); + this.camera = newCamera == null ? this : newCamera; + while (this.camera instanceof net.minecraftforge.entity.PartEntity partEntity) { + this.camera = partEntity.getParent(); // FORGE: fix MC-46486 + } if (oldCamera != this.camera) { if (this.camera.level() instanceof ServerLevel level) { this.teleportTo(level, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false); -@@ -1956,7 +_,11 @@ +@@ -1961,7 +_,11 @@ } public @Nullable Component getTabListDisplayName() { @@ -132,7 +132,7 @@ } public int getTabListOrder() { -@@ -1990,6 +_,7 @@ +@@ -1995,6 +_,7 @@ } public void setRespawnPosition(final ServerPlayer.@Nullable RespawnConfig respawnConfig, final boolean showMessage) { @@ -140,7 +140,7 @@ if (showMessage && respawnConfig != null && !respawnConfig.isSamePosition(this.respawnConfig)) { this.sendSystemMessage(SPAWN_SET_MESSAGE); } -@@ -2077,6 +_,9 @@ +@@ -2082,6 +_,9 @@ public void drop(final boolean all) { Inventory inventory = this.getInventory(); @@ -150,7 +150,7 @@ ItemStack removed = inventory.removeFromSelected(all); this.containerMenu .findSlot(inventory, inventory.getSelectedSlot()) -@@ -2085,7 +_,7 @@ +@@ -2090,7 +_,7 @@ this.stopUsingItem(); } @@ -159,7 +159,7 @@ } @Override -@@ -2187,6 +_,75 @@ +@@ -2192,6 +_,75 @@ public @Nullable BlockPos getRaidOmenPosition() { return this.raidOmenPosition; diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch index b84852104c..0f23261e57 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -35,57 +35,58 @@ + int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(level, gameModeForPlayer, player, pos); + if (exp == -1) { return false; - } else { - BlockEntity blockEntity = this.level.getBlockEntity(pos); -@@ -269,34 +_,50 @@ - if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { - this.level.sendBlockUpdated(pos, state, state, 3); - return false; -+ } else if (player.getMainHandItem().onBlockStartBreak(pos, player)) { -+ return false; - } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { - return false; - } else { -- BlockState adjustedState = block.playerWillDestroy(this.level, pos, state, this.player); -- boolean changed = this.level.removeBlock(pos, false); -- if (SharedConstants.DEBUG_BLOCK_BREAK) { -- LOGGER.info("server broke {} {} -> {}", pos, adjustedState, this.level.getBlockState(pos)); -- } -- -- if (changed) { -- block.destroy(this.level, pos, adjustedState); -- } -- -+ BlockState adjustedState = state; - if (this.player.preventsBlockDrops()) { -+ removeBlock(pos, false); - return true; - } else { - ItemStack itemStack = this.player.getMainHandItem(); - ItemStack destroyedWith = itemStack.copy(); -- boolean canDestroy = this.player.hasCorrectToolForDrops(adjustedState); -+ boolean canDestroy = adjustedState.canHarvestBlock(this.level, pos, this.player); // previously player.hasCorrectToolForDrops(blockstate) - itemStack.mineBlock(this.level, adjustedState, pos, this.player); -+ -+ if (itemStack.isEmpty() && !destroyedWith.isEmpty()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, destroyedWith, InteractionHand.MAIN_HAND); -+ } -+ boolean changed = removeBlock(pos, canDestroy); -+ - if (changed && canDestroy) { - block.playerDestroy(this.level, this.player, pos, adjustedState, blockEntity, destroyedWith); - } - -+ if (canDestroy && exp > 0) { -+ state.getBlock().popExperience(level, pos, exp); -+ } -+ - return true; - } - } } -+ } + +@@ -272,35 +_,53 @@ + return false; + } + ++ if (player.getMainHandItem().onBlockStartBreak(pos, player)) { ++ return false; ++ } + + if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { + return false; + } + +- BlockState adjustedState = block.playerWillDestroy(this.level, pos, state, this.player); +- boolean changed = this.level.removeBlock(pos, false); +- if (SharedConstants.DEBUG_BLOCK_BREAK) { +- LOGGER.info("server broke {} {} -> {}", pos, adjustedState, this.level.getBlockState(pos)); +- } +- +- if (changed) { +- block.destroy(this.level, pos, adjustedState); +- } +- ++ BlockState adjustedState = state; + if (this.player.preventsBlockDrops()) { ++ removeBlock(pos, false); + return true; + } + + ItemStack itemStack = this.player.getMainHandItem(); + ItemStack destroyedWith = itemStack.copy(); +- boolean canDestroy = this.player.hasCorrectToolForDrops(adjustedState); ++ boolean canDestroy = adjustedState.canHarvestBlock(this.level, pos, this.player); // previously player.hasCorrectToolForDrops(blockstate) + itemStack.mineBlock(this.level, adjustedState, pos, this.player); ++ ++ if (itemStack.isEmpty() && !destroyedWith.isEmpty()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, destroyedWith, InteractionHand.MAIN_HAND); ++ } ++ boolean changed = removeBlock(pos, canDestroy); ++ + if (changed && canDestroy) { + block.playerDestroy(this.level, this.player, pos, adjustedState, blockEntity, destroyedWith); + } + ++ if (canDestroy && exp > 0) { ++ state.getBlock().popExperience(level, pos, exp); ++ } ++ + return true; + } + + private boolean removeBlock(BlockPos pos, boolean canHarvest) { + BlockState state = this.level.getBlockState(pos); + boolean removed = state.onDestroyedByPlayer(this.level, pos, this.player, canHarvest, this.level.getFluidState(pos)); @@ -96,31 +97,30 @@ + state.getBlock().destroy(this.level, pos, state); + } + return removed; - } - - public InteractionResult useItem(final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand) { -@@ -305,6 +_,8 @@ - } else if (player.getCooldowns().isOnCooldown(itemStack)) { - return InteractionResult.PASS; - } else { -+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(player, hand); -+ if (cancelResult != null) return cancelResult; - int oldCount = itemStack.getCount(); - int oldDamage = itemStack.getDamageValue(); - InteractionResult result = itemStack.use(level, player, hand); -@@ -348,6 +_,11 @@ - if (!state.getBlock().isEnabled(level.enabledFeatures())) { - return InteractionResult.FAIL; - } else if (this.gameModeForPlayer == GameType.SPECTATOR) { -+ } ++ } + + public InteractionResult useItem(final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand) { + if (this.gameModeForPlayer == GameType.SPECTATOR) { + return InteractionResult.PASS; +@@ -310,6 +_,8 @@ + return InteractionResult.PASS; + } + ++ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(player, hand); ++ if (cancelResult != null) return cancelResult; + int oldCount = itemStack.getCount(); + int oldDamage = itemStack.getDamageValue(); + InteractionResult result = itemStack.use(level, player, hand); +@@ -355,6 +_,8 @@ + return InteractionResult.FAIL; + } + + var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(player, hand, pos, hitResult); + if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock.BUS.post(event)) return event.getCancellationResult(); -+ if (this.gameModeForPlayer == GameType.SPECTATOR) { + if (this.gameModeForPlayer == GameType.SPECTATOR) { MenuProvider menuProvider = state.getMenuProvider(level, pos); if (menuProvider != null) { - player.openMenu(menuProvider); -@@ -356,10 +_,16 @@ +@@ -364,10 +_,16 @@ return InteractionResult.PASS; } } else { @@ -138,7 +138,7 @@ InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult); if (itemUse.consumesAction()) { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack); -@@ -375,8 +_,8 @@ +@@ -383,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch index 13cc4b0557..267dd699cc 100644 --- a/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/server/level/WorldGenRegion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java -@@ -301,6 +_,7 @@ +@@ -341,6 +_,7 @@ @Override public boolean addFreshEntity(final Entity entity) { diff --git a/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch index 22c44f0b0c..6458aa4e0c 100644 --- a/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/MemoryServerHandshakePacketListenerImpl.java.patch @@ -7,4 +7,4 @@ + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(packet, this.connection)) return; if (packet.intention() != ClientIntent.LOGIN) { throw new UnsupportedOperationException("Invalid intention " + packet.intention()); - } else { + } diff --git a/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch index bef37c5114..002bd84c0c 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch @@ -51,12 +51,12 @@ this.addOptionalTasks(); this.returnToWorld(); } -@@ -211,7 +_,7 @@ +@@ -213,7 +_,7 @@ this.currentTask = task; try { - task.start(this::send); + task.start(this.taskContext); - } catch (Exception var3) { - LOGGER.error("Failed to start configuration task {}", task.type(), var3); + } catch (Exception e) { + LOGGER.error("Failed to start configuration task {}", task.type(), e); this.disconnect(DISCONNECT_REASON_CONFIGURATION_ERROR); diff --git a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch index eafdf76953..3e7eab4ee0 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerConnectionListener.java +++ b/net/minecraft/server/network/ServerConnectionListener.java -@@ -38,6 +_,7 @@ +@@ -40,6 +_,7 @@ import org.slf4j.Logger; public class ServerConnectionListener { @@ -8,7 +8,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private final MinecraftServer server; public volatile boolean running; -@@ -50,6 +_,8 @@ +@@ -53,6 +_,8 @@ } public void startTcpServerListener(final @Nullable InetAddress address, final int port) throws IOException { @@ -17,7 +17,7 @@ synchronized (this.channels) { EventLoopGroupHolder eventLoopGroupHolder = EventLoopGroupHolder.remote(this.server.useNativeTransport()); this.channels -@@ -69,7 +_,7 @@ +@@ -68,7 +_,7 @@ } catch (ChannelException var5) { } @@ -26,7 +26,7 @@ if (ServerConnectionListener.this.server.repliesToStatus()) { pipeline.addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); } -@@ -88,7 +_,7 @@ +@@ -87,7 +_,7 @@ } ) .group(eventLoopGroupHolder.eventLoopGroup()) diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 6815b8aa2b..41650457d9 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1286,9 +_,10 @@ +@@ -1297,9 +_,10 @@ } case SWAP_ITEM_WITH_OFFHAND: if (!this.player.isSpectator()) { @@ -14,7 +14,7 @@ this.player.stopUsingItem(); } -@@ -1504,8 +_,9 @@ +@@ -1515,8 +_,9 @@ } CompletableFuture filteredFuture = this.filterTextPacket(signedMessage.signedContent()); @@ -25,7 +25,7 @@ PlayerChatMessage filteredMessage = signedMessage.withUnsignedContent(decorated).filter(filtered.mask()); this.broadcastChatMessage(filteredMessage); }); -@@ -2175,6 +_,7 @@ +@@ -2195,6 +_,7 @@ @Override public void handleCustomPayload(final ServerboundCustomPayloadPacket packet) { diff --git a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch index a789944c91..7d3d662689 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -186,7 +_,7 @@ - throw new IllegalStateException("Protocol error", var7); +@@ -188,7 +_,7 @@ + throw new IllegalStateException("Protocol error", e); } - Thread thread = new Thread("User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { + Thread thread = new Thread(net.minecraftforge.fml.util.thread.SidedThreadGroups.SERVER, "User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) { - { - Objects.requireNonNull(ServerLoginPacketListenerImpl.this); - } -@@ -236,6 +_,7 @@ + @Override + public void run() { + String name = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); +@@ -234,6 +_,7 @@ @Override public void handleCustomQueryPacket(final ServerboundCustomQueryAnswerPacket packet) { @@ -17,7 +17,7 @@ this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); } -@@ -258,6 +_,11 @@ +@@ -256,6 +_,11 @@ @Override public void handleCookieResponse(final ServerboundCookieResponsePacket packet) { this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); @@ -28,4 +28,4 @@ + return this.authenticatedProfile; } - private static enum State { + private enum State { diff --git a/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch b/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch index 3df7bd84ce..f23dea503a 100644 --- a/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch +++ b/patches/minecraft/net/minecraft/server/network/config/PrepareSpawnTask.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/config/PrepareSpawnTask.java +++ b/net/minecraft/server/network/config/PrepareSpawnTask.java -@@ -187,6 +_,7 @@ +@@ -180,6 +_,7 @@ .loadPlayerData(PrepareSpawnTask.this.nameAndId) .map(tag -> TagValueInput.create(reporter, PrepareSpawnTask.this.server.registryAccess(), tag)); input.ifPresent(player::load); diff --git a/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch b/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch index f468936039..2a159a9ae9 100644 --- a/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/AbstractPackResources.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/AbstractPackResources.java +++ b/net/minecraft/server/packs/AbstractPackResources.java -@@ -42,4 +_,9 @@ +@@ -39,4 +_,9 @@ public PackLocationInfo location() { return this.location; } diff --git a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch index 6b77a59f69..b30611ce73 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch @@ -16,16 +16,16 @@ } public static Pack.@Nullable Metadata readPackMetadata( -@@ -66,7 +_,7 @@ +@@ -63,7 +_,7 @@ PackCompatibility packCompatibility = PackCompatibility.forVersion(meta.supportedFormats(), currentPackVersion); OverlayMetadataSection overlays = pack.getMetadataSection(OverlayMetadataSection.forPackType(type)); List overlaySet = overlays != null ? overlays.overlaysForVersion(currentPackVersion) : List.of(); -- var11 = new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet); -+ var11 = new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet, pack.isHidden()); +- return new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet); ++ return new Pack.Metadata(meta.description(), packCompatibility, requiredFlags, overlaySet, pack.isHidden()); } - - return var11; -@@ -128,6 +_,10 @@ + } catch (Exception e) { + LOGGER.warn("Failed to read pack {} metadata", location.id(), e); +@@ -123,6 +_,10 @@ return this.location.source(); } @@ -36,7 +36,7 @@ @Override public boolean equals(final Object o) { if (this == o) { -@@ -142,7 +_,10 @@ +@@ -137,7 +_,10 @@ return this.location.hashCode(); } @@ -47,4 +47,4 @@ + } } - public static enum Position { + public enum Position { diff --git a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch index b205cfe28f..b5c17dc1d1 100644 --- a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -127,6 +_,7 @@ +@@ -126,6 +_,8 @@ private int simulationDistance; private boolean allowCommandsForAllPlayers; private int sendAllPlayerInfoIn; + private final List playersView = java.util.Collections.unmodifiableList(players); ++ private final Map playersByUUIDView = java.util.Collections.unmodifiableMap(this.playersByUUID); public PlayerList( final MinecraftServer server, @@ -24,7 +25,7 @@ } protected void updateEntireScoreboard(final ServerScoreboard scoreboard, final ServerPlayer player) { -@@ -295,6 +_,7 @@ +@@ -291,6 +_,7 @@ } protected void save(final ServerPlayer player) { @@ -32,7 +33,7 @@ this.playerIo.save(player); ServerStatsCounter stats = this.stats.get(player.getUUID()); if (stats != null) { -@@ -308,6 +_,7 @@ +@@ -304,6 +_,7 @@ } public void remove(final ServerPlayer player) { @@ -64,7 +65,7 @@ if (this.ops.remove(nameAndId)) { ServerPlayer player = this.getPlayer(nameAndId.id()); if (player != null) { -@@ -824,7 +_,7 @@ +@@ -826,11 +_,11 @@ } public List getPlayers() { @@ -72,8 +73,13 @@ + return this.playersView; //Unmodifiable view, we don't want people removing things without us knowing. } + public Map getPlayersByUUID() { +- return this.playersByUUID; ++ return this.playersByUUIDView; //Unmodifiable view, we don't want people removing things without us knowing. + } + public @Nullable ServerPlayer getPlayer(final UUID uuid) { -@@ -850,6 +_,7 @@ +@@ -856,6 +_,7 @@ advancements.reload(this.server.getAdvancements()); } @@ -81,7 +87,7 @@ this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); RecipeManager recipeManager = this.server.getRecipeManager(); ClientboundUpdateRecipesPacket recipes = new ClientboundUpdateRecipesPacket( -@@ -864,5 +_,9 @@ +@@ -870,5 +_,9 @@ public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; diff --git a/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch index 55c5476327..de766c6d43 100644 --- a/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/DamageTypeTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/DamageTypeTags.java +++ b/net/minecraft/tags/DamageTypeTags.java -@@ -43,4 +_,12 @@ +@@ -44,4 +_,12 @@ private static TagKey create(final String name) { return TagKey.create(Registries.DAMAGE_TYPE, Identifier.withDefaultNamespace(name)); } diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch index 02445ad445..deef29fb0b 100644 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/EntityTypeTags.java +++ b/net/minecraft/tags/EntityTypeTags.java -@@ -56,4 +_,12 @@ +@@ -57,4 +_,12 @@ private static TagKey> create(final String name) { return TagKey.create(Registries.ENTITY_TYPE, Identifier.withDefaultNamespace(name)); } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 78eef07590..508c67264a 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -219,4 +_,12 @@ +@@ -220,4 +_,12 @@ private static TagKey bind(final String name) { return TagKey.create(Registries.ITEM, Identifier.withDefaultNamespace(name)); } diff --git a/patches/minecraft/net/minecraft/tags/TagKey.java.patch b/patches/minecraft/net/minecraft/tags/TagKey.java.patch index 6d37669408..9ae3dab205 100644 --- a/patches/minecraft/net/minecraft/tags/TagKey.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagKey.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/TagKey.java +++ b/net/minecraft/tags/TagKey.java -@@ -40,6 +_,10 @@ +@@ -38,6 +_,10 @@ return (TagKey)VALUES.intern(new TagKey<>(registry, location)); } diff --git a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch index ff4b7cb312..f086720b23 100644 --- a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch @@ -5,8 +5,8 @@ String sourceId = resource.sourcePackId(); parsedContents.entries().forEach(ex -> tagContents.add(new TagLoader.EntryWithSource(ex, sourceId))); + parsedContents.remove().forEach(e -> tagContents.add(new TagLoader.EntryWithSource(e, sourceId, true))); - } catch (Exception var17) { - LOGGER.error("Couldn't read tag list {} from {} in data pack {}", id, location, resource.sourcePackId(), var17); + } catch (Exception e) { + LOGGER.error("Couldn't read tag list {} from {} in data pack {}", id, location, resource.sourcePackId(), e); } @@ -74,16 +_,17 @@ } @@ -29,7 +29,7 @@ } public Map> build(final Map> builders) { -@@ -111,7 +_,7 @@ +@@ -107,7 +_,7 @@ missing -> LOGGER.error( "Couldn't load tag {} as it is missing following references: {}", id, @@ -38,7 +38,7 @@ ) ) .ifRight(tag -> newTags.put(id, (List)tag)) -@@ -192,7 +_,11 @@ +@@ -188,7 +_,11 @@ } } diff --git a/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch b/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch index 14dce9ae6e..353e0d4a23 100644 --- a/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch +++ b/patches/minecraft/net/minecraft/util/LightCoordsUtil.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/LightCoordsUtil.java +++ b/net/minecraft/util/LightCoordsUtil.java -@@ -10,7 +_,7 @@ +@@ -15,7 +_,7 @@ } public static int block(final int packed) { @@ -9,3 +9,12 @@ } public static int sky(final int packed) { +@@ -115,7 +_,7 @@ + + int packedBrightness = brightnessGetter.packedBrightness(level, pos); + int block = block(packedBrightness); +- int blockSelfEmission = state.getLightEmission(); ++ int blockSelfEmission = state.getLightEmission(level, pos); + return block < blockSelfEmission ? withBlock(packedBrightness, blockSelfEmission) : packedBrightness; + } + diff --git a/patches/minecraft/net/minecraft/util/Util.java.patch b/patches/minecraft/net/minecraft/util/Util.java.patch index f177964579..51be679f5f 100644 --- a/patches/minecraft/net/minecraft/util/Util.java.patch +++ b/patches/minecraft/net/minecraft/util/Util.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/util/Util.java +++ b/net/minecraft/util/Util.java -@@ -272,7 +_,7 @@ +@@ -313,7 +_,7 @@ .getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().dataVersion().version())) .getChoiceType(reference, name); - } catch (IllegalArgumentException var4) { + } catch (IllegalArgumentException e) { - LOGGER.error("No data fixer registered for {}", name); + LOGGER.debug("No data fixer registered for {}", name); if (SharedConstants.IS_RUNNING_IN_IDE) { - throw var4; + throw e; } diff --git a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch index 1f0b8b3c00..3ac8a74494 100644 --- a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch @@ -15,6 +15,6 @@ + } + // Forge: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data + return chunk.createString("unknown." + key); - } else { - String resultingId = conversion.fallback; - if (!conversion.biomeMapping().isEmpty()) { + } + + String resultingId = conversion.fallback; diff --git a/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch b/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch index e9bfd02c48..4ed55e4c00 100644 --- a/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch +++ b/patches/minecraft/net/minecraft/util/random/WeightedList.java.patch @@ -9,7 +9,7 @@ private static final int FLAT_THRESHOLD = 64; private final int totalWeight; private final List> items; -@@ -143,7 +_,7 @@ +@@ -153,7 +_,7 @@ return 31 * result + this.items.hashCode(); } diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index 469814262e..902b817cac 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -159,7 +_,9 @@ +@@ -156,7 +_,9 @@ import org.slf4j.Logger; public abstract class Entity @@ -17,8 +17,8 @@ + @Deprecated // Forge: Use the getter to allow overriding in mods private final EntityType type; private boolean requiresPrecisePosition; - private int id = ENTITY_COUNTER.incrementAndGet(); -@@ -320,6 +_,8 @@ + private int id = 0; +@@ -322,6 +_,8 @@ this.entityData = entityDataBuilder.build(); this.setPos(0.0, 0.0, 0.0); this.eyeHeight = this.dimensions.eyeHeight(); @@ -27,7 +27,7 @@ } public boolean isColliding(final BlockPos pos, final BlockState state) { -@@ -423,6 +_,7 @@ +@@ -429,6 +_,7 @@ public void remove(final Entity.RemovalReason reason) { this.setRemoved(reason); @@ -35,7 +35,7 @@ } public void onClientRemoval() { -@@ -542,7 +_,7 @@ +@@ -548,7 +_,7 @@ } if (this.isInLava()) { @@ -44,18 +44,18 @@ } this.checkBelowWorld(); -@@ -1000,9 +_,7 @@ - return getOnPos; - } else { - BlockState belowState = this.level().getBlockState(getOnPos); -- return (!(offset <= 0.5) || !belowState.is(BlockTags.FENCES)) -- && !belowState.is(BlockTags.WALLS) -- && !(belowState.getBlock() instanceof FenceGateBlock) -+ return (!((double)offset <= 0.5) || !belowState.collisionExtendsVertically(this.level(), getOnPos, this)) - ? getOnPos.atY(Mth.floor(this.position.y - offset)) - : getOnPos; +@@ -1064,9 +_,7 @@ } -@@ -1363,19 +_,19 @@ + + BlockState belowState = this.level().getBlockState(getOnPos); +- return (!(offset <= 0.5) || !belowState.is(BlockTags.FENCES)) +- && !belowState.is(BlockTags.WALLS) +- && !(belowState.getBlock() instanceof FenceGateBlock) ++ return (!((double)offset <= 0.5) || !belowState.collisionExtendsVertically(this.level(), getOnPos, this)) + ? getOnPos.atY(Mth.floor(this.position.y - offset)) + : getOnPos; + } else { +@@ -1447,19 +_,19 @@ return !aboveState.is(BlockTags.INSIDE_STEP_SOUND_BLOCKS) && !aboveState.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS) ? affectingPos : abovePos; } @@ -81,7 +81,7 @@ this.playSound(soundType.getStepSound(), soundType.getVolume() * 0.15F, soundType.getPitch()); } -@@ -1510,6 +_,10 @@ +@@ -1598,6 +_,10 @@ return this.wasTouchingWater; } @@ -89,10 +89,10 @@ + return this.isInWater() || isInFluidType((fluidType, height) -> canSwimInFluidType(fluidType)); + } + - boolean isInRain() { + private boolean isInRain() { BlockPos pos = this.blockPosition(); return this.level().isRainingAt(pos) || this.level().isRainingAt(BlockPos.containing(pos.getX(), this.getBoundingBox().maxY, pos.getZ())); -@@ -1547,10 +_,10 @@ +@@ -1635,10 +_,10 @@ public void updateSwimming() { if (this.isSwimming()) { @@ -105,7 +105,7 @@ ); } } -@@ -1567,16 +_,7 @@ +@@ -1655,16 +_,7 @@ } this.wasTouchingWater = inWater; @@ -123,7 +123,7 @@ return inWater || inLava; } -@@ -1624,12 +_,13 @@ +@@ -1712,12 +_,13 @@ } public boolean canSpawnSprintParticle() { @@ -138,7 +138,7 @@ if (blockState.getRenderShape() != RenderShape.INVISIBLE) { Vec3 movement = this.getDeltaMovement(); BlockPos entityPosition = this.blockPosition(); -@@ -1644,7 +_,7 @@ +@@ -1732,7 +_,7 @@ } this.level() @@ -147,7 +147,7 @@ } } -@@ -2021,6 +_,10 @@ +@@ -2113,6 +_,10 @@ output.putBoolean("HasVisualFire", this.hasVisualFire); } @@ -158,7 +158,7 @@ if (!this.tags.isEmpty()) { output.store("Tags", TAG_LIST_CODEC, List.copyOf(this.tags)); } -@@ -2090,6 +_,9 @@ +@@ -2184,6 +_,9 @@ this.setGlowingTag(input.getBooleanOr("Glowing", false)); this.setTicksFrozen(input.getIntOr("TicksFrozen", 0)); this.hasVisualFire = input.getBooleanOr("HasVisualFire", false); @@ -168,16 +168,16 @@ this.customData = input.read("data", CustomData.CODEC).orElse(CustomData.EMPTY); this.tags.clear(); input.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll); -@@ -2139,6 +_,8 @@ - } else { - ItemEntity entity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, itemStack); - entity.setDefaultPickUpDelay(); -+ if (captureDrops() != null) captureDrops().add(entity); -+ else - level.addFreshEntity(entity); - return entity; - } -@@ -2197,11 +_,11 @@ +@@ -2234,6 +_,8 @@ + + ItemEntity entity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, itemStack); + entity.setDefaultPickUpDelay(); ++ if (captureDrops() != null) captureDrops().add(entity); ++ else + level.addFreshEntity(entity); + return entity; + } +@@ -2291,11 +_,11 @@ } ItemStack heldItem = player.getItemInHand(hand); @@ -190,8 +190,8 @@ + && heldItem.canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST) && target.canShearEquipment(player) && !player.isSecondaryUseActive() - && this.attemptToShearEquipment(player, hand, heldItem, target)) { -@@ -2309,6 +_,7 @@ + && target.attemptToShearEquipment(player, hand, heldItem)) { +@@ -2379,6 +_,7 @@ public void rideTick() { this.setDeltaMovement(Vec3.ZERO); @@ -199,15 +199,15 @@ this.tick(); if (this.isPassenger()) { this.getVehicle().positionRider(this); -@@ -2369,6 +_,7 @@ - } +@@ -2444,6 +_,7 @@ } + } -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityToRide, true)) return false; - if (force || this.canRide(entityToRide) && entityToRide.canAddPassenger(this)) { - if (this.isPassenger()) { - this.stopRiding(); -@@ -2404,6 +_,7 @@ ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityToRide, true)) return false; + if (force || this.canRide(entityToRide) && entityToRide.canAddPassenger(this)) { + if (this.isPassenger()) { + this.stopRiding(); +@@ -2478,6 +_,7 @@ public void removeVehicle() { if (this.vehicle != null) { Entity oldVehicle = this.vehicle; @@ -215,7 +215,7 @@ this.vehicle = null; oldVehicle.removePassenger(this); Entity.RemovalReason removalReason = this.getRemovalReason(); -@@ -2454,6 +_,8 @@ +@@ -2528,6 +_,8 @@ return this.passengers.isEmpty(); } @@ -224,7 +224,7 @@ protected boolean couldAcceptPassenger() { return true; } -@@ -2650,7 +_,7 @@ +@@ -2724,7 +_,7 @@ } public boolean isVisuallyCrawling() { @@ -233,7 +233,7 @@ } public void setSwimming(final boolean swimming) { -@@ -2766,7 +_,7 @@ +@@ -2840,7 +_,7 @@ this.igniteForSeconds(8.0F); } @@ -242,7 +242,7 @@ } public void onAboveBubbleColumn(final boolean dragDown, final BlockPos pos) { -@@ -2885,7 +_,7 @@ +@@ -2959,7 +_,7 @@ } protected Component getTypeName() { @@ -251,7 +251,7 @@ } public boolean is(final Entity other) { -@@ -3194,6 +_,7 @@ +@@ -3272,6 +_,7 @@ return this.stringUUID; } @@ -259,7 +259,7 @@ public boolean isPushedByFluid() { return true; } -@@ -3602,6 +_,10 @@ +@@ -3682,6 +_,10 @@ return this.fluidInteraction.getFluidHeight(type); } @@ -270,7 +270,7 @@ public double getFluidJumpThreshold() { return this.getEyeHeight() < 0.4 ? 0.0 : 0.4; } -@@ -3614,7 +_,9 @@ +@@ -3694,7 +_,9 @@ return this.dimensions.height(); } @@ -280,7 +280,7 @@ return new ClientboundAddEntityPacket(this, serverEntity); } -@@ -3753,6 +_,11 @@ +@@ -3833,6 +_,11 @@ } } } @@ -292,8 +292,8 @@ } public void checkDespawn() { -@@ -3927,6 +_,83 @@ - float xRot = (float)Mth.lerp(alpha, (double)this.getXRot(), targetXRot); +@@ -4007,6 +_,83 @@ + float xRot = (float)Mth.lerp(alpha, this.getXRot(), targetXRot); this.setPos(x, y, z); this.setRot(yRot, xRot); + } diff --git a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch index 5e8f236b2f..1289ce6c6c 100644 --- a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1225,6 +_,11 @@ +@@ -73,6 +_,11 @@ private final FeatureFlagSet requiredFeatures; private final boolean allowedInPeaceful; @@ -9,10 +9,10 @@ + private final java.util.function.ToIntFunction> updateIntervalSupplier; + private final java.util.function.BiFunction customClientFactory; + - private static EntityType register(final ResourceKey> id, final EntityType.Builder builder) { - return Registry.register(BuiltInRegistries.ENTITY_TYPE, id, builder.build(id)); + public static Identifier getKey(final EntityType type) { + return BuiltInRegistries.ENTITY_TYPE.getKey(type); } -@@ -1260,7 +_,8 @@ +@@ -92,7 +_,8 @@ final String descriptionId, final Optional> lootTable, final FeatureFlagSet requiredFeatures, @@ -22,7 +22,7 @@ ) { this.factory = factory; this.category = category; -@@ -1277,6 +_,10 @@ +@@ -109,6 +_,10 @@ this.lootTable = lootTable; this.requiredFeatures = requiredFeatures; this.allowedInPeaceful = allowedInPeaceful; @@ -33,7 +33,7 @@ } public @Nullable T spawn( -@@ -1580,14 +_,26 @@ +@@ -424,14 +_,26 @@ } public int clientTrackingRange() { @@ -57,11 +57,11 @@ + } + + private boolean defaultVelocitySupplier() { - return this != PLAYER - && this != LLAMA_SPIT - && this != WITHER -@@ -1638,6 +_,15 @@ - return OP_ONLY_CUSTOM_DATA.contains(this); + return this != EntityTypes.PLAYER + && this != EntityTypes.LLAMA_SPIT + && this != EntityTypes.WITHER +@@ -466,6 +_,15 @@ + return EntityTypes.OP_ONLY_CUSTOM_DATA.contains(this); } + public T customClientSpawn(net.minecraftforge.network.packets.SpawnEntity packet, Level world) { @@ -76,7 +76,7 @@ public static class Builder { private final EntityType.EntityFactory factory; private final MobCategory category; -@@ -1657,6 +_,10 @@ +@@ -485,6 +_,10 @@ ); private final DependantName, String> descriptionId = id -> Util.makeDescriptionId("entity", id.identifier()); private boolean allowedInPeaceful = true; @@ -87,7 +87,7 @@ private Builder(final EntityType.EntityFactory factory, final MobCategory category) { this.factory = factory; -@@ -1775,6 +_,30 @@ +@@ -603,6 +_,30 @@ return this; } @@ -118,7 +118,7 @@ public EntityType build(final ResourceKey> name) { if (this.serialize) { Util.fetchChoiceType(References.ENTITY_TREE, name.identifier().toString()); -@@ -1795,7 +_,8 @@ +@@ -623,7 +_,8 @@ this.descriptionId.get(name), this.lootTable.get(name), this.requiredFeatures, diff --git a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch index 5e125b744e..8ae1b260d8 100644 --- a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -2,15 +2,15 @@ +++ b/net/minecraft/world/entity/ExperienceOrb.java @@ -136,7 +_,8 @@ this.applyEffectsFromBlocks(); - float friction = 0.98F; + float friction = this.getAirDrag(); if (this.onGround()) { -- friction = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- friction *= this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction(); + BlockPos pos = getBlockPosBelowThatAffectsMyMovement(); -+ friction = this.level().getBlockState(pos).getFriction(this.level(), pos, this) * 0.98F; ++ friction *= this.level().getBlockState(pos).getFriction(this.level(), pos, this) * 0.98F; } this.setDeltaMovement(this.getDeltaMovement().scale(friction)); -@@ -277,6 +_,7 @@ +@@ -282,6 +_,7 @@ public void playerTouch(final Player player) { if (player instanceof ServerPlayer serverPlayer) { if (player.takeXpDelay == 0) { diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index b1dadac6e4..903f63c21f 100644 --- a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -139,7 +_,7 @@ +@@ -138,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,16 +9,16 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_ACTIVE_EFFECTS = "active_effects"; public static final String TAG_ATTRIBUTES = "attributes"; -@@ -194,6 +_,8 @@ - private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS = 40; - private static final int DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME = 0; +@@ -209,6 +_,8 @@ + public static final float ELYTRA_VERTICAL_AIR_DRAG = 0.98F; + public static final float BASE_SWIM_SPEED = 0.02F; private int currentImpulseContextResetGraceTime = 0; + /** Forge: Use a variant that calls {@link ItemStack#isMonsterDisguise(Player, net.minecraft.world.entity.monster.Monster)} and {@link net.minecraftforge.event.entity.living.MonsterDisguiseEvent} */ + @Deprecated public static final Predicate PLAYER_NOT_WEARING_DISGUISE_ITEM = livingEntity -> { if (livingEntity instanceof Player player) { ItemStack helmet = player.getItemBySlot(EquipmentSlot.HEAD); -@@ -278,7 +_,7 @@ +@@ -292,7 +_,7 @@ this.reapplyPosition(); this.setYRot(this.random.nextFloat() * (float) (Math.PI * 2)); this.yHeadRot = this.getYRot(); @@ -27,17 +27,17 @@ } @Override -@@ -337,7 +_,8 @@ - .add(Attributes.MOVEMENT_EFFICIENCY) - .add(Attributes.ATTACK_KNOCKBACK) - .add(Attributes.CAMERA_DISTANCE) -- .add(Attributes.WAYPOINT_TRANSMIT_RANGE); -+ .add(Attributes.WAYPOINT_TRANSMIT_RANGE) +@@ -356,7 +_,8 @@ + .add(Attributes.AIR_DRAG_MODIFIER) + .add(Attributes.FRICTION_MODIFIER) + .add(Attributes.NAME_TAG_DISTANCE) +- .add(Attributes.BELOW_NAME_DISTANCE); ++ .add(Attributes.BELOW_NAME_DISTANCE) + .add(Attributes.JUMP_STRENGTH); } @Override -@@ -364,7 +_,8 @@ +@@ -383,7 +_,8 @@ double scale = Math.min(0.2F + power / 15.0, 2.5); int particles = (int)(150.0 * scale); @@ -47,7 +47,7 @@ } } -@@ -374,6 +_,7 @@ +@@ -393,6 +_,7 @@ } } @@ -55,7 +55,7 @@ public boolean canBreatheUnderwater() { return this.is(EntityTypeTags.CAN_BREATHE_UNDER_WATER); } -@@ -414,6 +_,9 @@ +@@ -433,6 +_,9 @@ } } @@ -65,17 +65,17 @@ if (this.isEyeInFluid(FluidTags.WATER) && !level.getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) { boolean canDrownInWater = !this.canBreatheUnderwater() -@@ -763,6 +_,9 @@ - } else { - ItemEntity entity = this.createItemStackToDrop(itemStack, randomly, thrownFromHand); - if (entity != null) { +@@ -788,6 +_,9 @@ + + ItemEntity entity = this.createItemStackToDrop(itemStack, randomly, thrownFromHand); + if (entity != null) { + if (captureDrops() != null) + captureDrops().add(entity); + else - this.level().addFreshEntity(entity); - } + this.level().addFreshEntity(entity); + } -@@ -805,7 +_,7 @@ +@@ -828,7 +_,7 @@ this.setPosToBed(sleepingPos); } }, this::clearSleepingPos); @@ -84,7 +84,7 @@ this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player"); this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0); this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob"); -@@ -831,8 +_,10 @@ +@@ -854,8 +_,10 @@ Holder mobEffect = iterator.next(); MobEffectInstance effect = this.activeEffects.get(mobEffect); if (!effect.tickServer(serverLevel, this, () -> this.onEffectUpdated(effect, true, null))) { @@ -95,7 +95,7 @@ } else if (effect.getDuration() % 600 == 0) { this.onEffectUpdated(effect, false, null); } -@@ -919,6 +_,7 @@ +@@ -942,6 +_,7 @@ } } @@ -103,15 +103,15 @@ return visibilityPercent; } -@@ -992,6 +_,7 @@ - } else { - MobEffectInstance effect = this.activeEffects.get(newEffect.getEffect()); - boolean changed = false; -+ net.minecraftforge.event.ForgeEventFactory.onLivingEffectAdd(this, effect, newEffect, source); - if (effect == null) { - this.activeEffects.put(newEffect.getEffect(), newEffect); - this.onEffectAdded(newEffect, source); -@@ -1008,6 +_,10 @@ +@@ -1018,6 +_,7 @@ + + MobEffectInstance effect = this.activeEffects.get(newEffect.getEffect()); + boolean changed = false; ++ net.minecraftforge.event.ForgeEventFactory.onLivingEffectAdd(this, effect, newEffect, source); + if (effect == null) { + this.activeEffects.put(newEffect.getEffect(), newEffect); + this.onEffectAdded(newEffect, source); +@@ -1033,6 +_,10 @@ } public boolean canBeAffected(final MobEffectInstance newEffect) { @@ -122,7 +122,7 @@ if (this.is(EntityTypeTags.IMMUNE_TO_INFESTED)) { return !newEffect.is(MobEffects.INFESTED); } else if (this.is(EntityTypeTags.IMMUNE_TO_OOZING)) { -@@ -1038,6 +_,9 @@ +@@ -1063,6 +_,9 @@ } public boolean removeEffect(final Holder effect) { @@ -132,7 +132,7 @@ MobEffectInstance effectInstance = this.removeEffectNoUpdate(effect); if (effectInstance != null) { this.onEffectsRemoved(List.of(effectInstance)); -@@ -1082,6 +_,9 @@ +@@ -1107,6 +_,9 @@ this.effectsDirty = true; for (MobEffectInstance effect : effects) { @@ -142,7 +142,7 @@ effect.getEffect().value().removeAttributeModifiers(this.getAttributes()); for (Entity passenger : this.getPassengers()) { -@@ -1129,9 +_,13 @@ +@@ -1154,9 +_,13 @@ } public void heal(final float heal) { @@ -157,7 +157,7 @@ } } -@@ -1149,6 +_,9 @@ +@@ -1174,6 +_,9 @@ @Override public boolean hurtServer(final ServerLevel level, final DamageSource source, float damage) { @@ -166,19 +166,19 @@ + } if (this.isInvulnerableTo(level, source)) { return false; - } else if (this.isDeadOrDying()) { -@@ -1296,6 +_,10 @@ - } + } +@@ -1332,6 +_,10 @@ + } - float damageBlocked = blocksAttacks.resolveBlockedDamage(source, damage, angle); -+ var ev = net.minecraftforge.event.ForgeEventFactory.onShieldBlock(this, source, damageBlocked, blockingWith); -+ if (ev == null) return 0.0F; -+ damageBlocked = ev.getBlockedDamage(); -+ if (ev.shieldTakesDamage()) - blocksAttacks.hurtBlockingItem(this.level(), blockingWith, this, this.getUsedItemHand(), damageBlocked); - if (damageBlocked > 0.0F && !source.is(DamageTypeTags.IS_PROJECTILE) && source.getDirectEntity() instanceof LivingEntity livingEntity) { - this.blockUsingItem(level, livingEntity); -@@ -1329,7 +_,7 @@ + float damageBlocked = blocksAttacks.resolveBlockedDamage(source, damage, angle); ++ var ev = net.minecraftforge.event.ForgeEventFactory.onShieldBlock(this, source, damageBlocked, blockingWith); ++ if (ev == null) return 0.0F; ++ damageBlocked = ev.getBlockedDamage(); ++ if (ev.shieldTakesDamage()) + blocksAttacks.hurtBlockingItem(this.level(), blockingWith, this, this.getUsedItemHand(), damageBlocked); + if (damageBlocked > 0.0F && !source.is(DamageTypeTags.IS_PROJECTILE) && source.getDirectEntity() instanceof LivingEntity livingEntity) { + this.blockUsingItem(level, livingEntity, source, damage); +@@ -1363,7 +_,7 @@ Entity sourceEntity = source.getEntity(); if (sourceEntity instanceof Player playerSource) { this.setLastHurtByPlayer(playerSource, 100); @@ -187,16 +187,16 @@ if (wolf.getOwnerReference() != null) { this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), 100); } else { -@@ -1359,7 +_,7 @@ - for (InteractionHand hand : InteractionHand.values()) { - ItemStack itemStack = this.getItemInHand(hand); - protection = itemStack.get(DataComponents.DEATH_PROTECTION); -- if (protection != null) { -+ if (protection != null && net.minecraftforge.common.ForgeHooks.onLivingUseTotem(this, killingDamage, itemStack, hand)) { - protectionItem = itemStack.copy(); - itemStack.shrink(1); - break; -@@ -1415,6 +_,7 @@ +@@ -1394,7 +_,7 @@ + for (InteractionHand hand : InteractionHand.values()) { + ItemStack itemStack = this.getItemInHand(hand); + protection = itemStack.get(DataComponents.DEATH_PROTECTION); +- if (protection != null) { ++ if (protection != null && net.minecraftforge.common.ForgeHooks.onLivingUseTotem(this, killingDamage, itemStack, hand)) { + protectionItem = itemStack.copy(); + itemStack.shrink(1); + break; +@@ -1449,6 +_,7 @@ } public void die(final DamageSource source) { @@ -204,7 +204,7 @@ if (!this.isRemoved() && !this.dead) { Entity sourceEntity = source.getEntity(); LivingEntity killer = this.getKillCredit(); -@@ -1451,10 +_,10 @@ +@@ -1489,10 +_,10 @@ if (this.level() instanceof ServerLevel serverLevel) { boolean var6 = false; if (killer instanceof WitherBoss) { @@ -217,7 +217,7 @@ this.level().setBlock(pos, state, 3); var6 = true; } -@@ -1469,6 +_,7 @@ +@@ -1507,6 +_,7 @@ } protected void dropAllDeathLoot(final ServerLevel level, final DamageSource source) { @@ -225,7 +225,7 @@ boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0; if (this.shouldDropLoot(level)) { this.dropFromLootTable(level, source, playerKilled); -@@ -1477,6 +_,11 @@ +@@ -1515,6 +_,11 @@ this.dropEquipment(level); this.dropExperience(level, source.getEntity()); @@ -237,7 +237,7 @@ } protected void dropEquipment(final ServerLevel level) { -@@ -1488,7 +_,8 @@ +@@ -1526,7 +_,8 @@ this.isAlwaysExperienceDropper() || this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && level.getGameRules().get(GameRules.MOB_DROPS) )) { @@ -247,10 +247,10 @@ } } -@@ -1601,6 +_,11 @@ +@@ -1639,6 +_,11 @@ } - public void knockback(double power, double xd, double zd) { + public void knockback(double power, double xd, double zd, final DamageSource source, final float damage, final boolean comesFromEffect) { + var event = net.minecraftforge.event.ForgeEventFactory.onLivingKnockBack(this, (float)power, xd, zd); + if (event == null) return; + power = event.getStrength(); @@ -259,7 +259,7 @@ power *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); if (!(power <= 0.0)) { this.needsSync = true; -@@ -1682,6 +_,13 @@ +@@ -1724,6 +_,13 @@ } else { BlockPos ladderCheckPos = this.blockPosition(); BlockState state = this.getInBlockState(); @@ -273,7 +273,7 @@ if (this.isFallFlying() && state.is(BlockTags.CAN_GLIDE_THROUGH)) { return false; } else if (state.is(BlockTags.CLIMBABLE)) { -@@ -1746,9 +_,11 @@ +@@ -1788,9 +_,11 @@ @Override public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { @@ -286,7 +286,7 @@ boolean hasLandedAboveCurrentImpulseImpactPosY = effectiveFallDistance <= 0.0; if (hasLandedAboveCurrentImpulseImpactPosY) { this.resetCurrentImpulseContext(); -@@ -1756,11 +_,11 @@ +@@ -1798,11 +_,11 @@ this.tryResetCurrentImpulseContext(); } } else { @@ -301,7 +301,7 @@ if (dmg > 0) { this.resetCurrentImpulseContext(); this.playSound(this.getFallDamageSound(dmg), 1.0F, 1.0F); -@@ -1823,9 +_,10 @@ +@@ -1864,9 +_,10 @@ int xx = Mth.floor(this.getX()); int yy = Mth.floor(this.getY() - 0.2F); int zz = Mth.floor(this.getZ()); @@ -314,19 +314,19 @@ this.playSound(soundType.getFallSound(), soundType.getVolume() * 0.5F, soundType.getPitch() * 0.75F); } } -@@ -1885,9 +_,9 @@ - float damageResisted = oldDamage - damage; - if (damageResisted > 0.0F && damageResisted < 3.4028235E37F) { - if (this instanceof ServerPlayer) { -- ((ServerPlayer)this).awardStat(Stats.DAMAGE_RESISTED, Math.round(damageResisted * 10.0F)); -+ ((ServerPlayer)this).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_RESISTED), Math.round(damageResisted * 10.0F)); - } else if (damageSource.getEntity() instanceof ServerPlayer) { -- ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(damageResisted * 10.0F)); -+ ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_DEALT_RESISTED), Math.round(damageResisted * 10.0F)); - } +@@ -1927,9 +_,9 @@ + float damageResisted = oldDamage - damage; + if (damageResisted > 0.0F && damageResisted < 3.4028235E37F) { + if (this instanceof ServerPlayer serverPlayer) { +- serverPlayer.awardStat(Stats.DAMAGE_RESISTED, Math.round(damageResisted * 10.0F)); ++ serverPlayer.awardStat(Stats.CUSTOM.get(Stats.DAMAGE_RESISTED), Math.round(damageResisted * 10.0F)); + } else if (damageSource.getEntity() instanceof ServerPlayer) { +- ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(damageResisted * 10.0F)); ++ ((ServerPlayer)damageSource.getEntity()).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_DEALT_RESISTED), Math.round(damageResisted * 10.0F)); } } -@@ -1915,6 +_,8 @@ + } +@@ -1958,6 +_,8 @@ protected void actuallyHurt(final ServerLevel level, final DamageSource source, float dmg) { if (!this.isInvulnerableTo(level, source)) { @@ -334,16 +334,16 @@ + if (dmg <= 0) return; dmg = this.getDamageAfterArmorAbsorb(source, dmg); dmg = this.getDamageAfterMagicAbsorb(source, dmg); - float var10 = Math.max(dmg - this.getAbsorptionAmount(), 0.0F); -@@ -1924,6 +_,7 @@ + float originalDamage = dmg; +@@ -1968,6 +_,7 @@ serverPlayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(absorbedDamage * 10.0F)); } -+ var10 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, var10); - if (var10 != 0.0F) { - this.getCombatTracker().recordDamage(source, var10); - this.setHealth(this.getHealth() - var10); -@@ -1987,6 +_,8 @@ ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, dmg); + if (dmg != 0.0F) { + this.getCombatTracker().recordDamage(source, dmg); + this.setHealth(this.getHealth() - dmg); +@@ -2031,6 +_,8 @@ } public void swing(final InteractionHand hand, final boolean sendToSwingingEntity) { @@ -352,7 +352,7 @@ if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) { this.swingTime = -1; this.swinging = true; -@@ -2128,9 +_,10 @@ +@@ -2172,9 +_,10 @@ } private void swapHandItems() { @@ -366,7 +366,7 @@ } @Override -@@ -2347,15 +_,18 @@ +@@ -2396,15 +_,18 @@ } this.needsSync = true; @@ -387,7 +387,7 @@ } protected float getWaterSlowDown() { -@@ -2377,8 +_,9 @@ +@@ -2427,8 +_,9 @@ } public void travel(final Vec3 input) { @@ -399,7 +399,7 @@ } else if (this.isFallFlying()) { this.travelFallFlying(input); } else { -@@ -2391,7 +_,7 @@ +@@ -2441,7 +_,7 @@ } protected boolean shouldTravelInFluid(final FluidState fluidState) { @@ -408,26 +408,26 @@ } protected void travelFlying(final Vec3 input, final float speed) { -@@ -2416,7 +_,7 @@ - - private void travelInAir(final Vec3 input) { +@@ -2468,7 +_,7 @@ BlockPos posBelow = this.getBlockPosBelowThatAffectsMyMovement(); -- float blockFriction = this.onGround() ? this.level().getBlockState(posBelow).getBlock().getFriction() : 1.0F; -+ float blockFriction = this.onGround() ? this.level().getBlockState(posBelow).getFriction(level(), posBelow, this) : 1.0F; - float friction = blockFriction * 0.91F; + float blockFriction = this.onGround() + ? computeModifiedFriction( +- this.level().getBlockState(posBelow).getBlock().getFriction(), (float)this.getAttributeValue(Attributes.FRICTION_MODIFIER) ++ this.level().getBlockState(posBelow).getFriction(level(), posBelow, this), (float)this.getAttributeValue(Attributes.FRICTION_MODIFIER) + ) + : 1.0F; Vec3 movement = this.handleRelativeFrictionAndCalculateMovement(input, blockFriction); - double movementY = movement.y; -@@ -2439,10 +_,18 @@ - } +@@ -2500,10 +_,18 @@ + return computeModifiedFriction(this.omnidirectionalAirMover() ? 0.91F : 0.98F, (float)this.getAttributeValue(Attributes.AIR_DRAG_MODIFIER)); } -- private void travelInFluid(final Vec3 input) { +- protected void travelInFluid(final Vec3 input) { + @Deprecated // FORGE: Use the version that takes a FluidState -+ private void travelInFluid(Vec3 input) { ++ protected void travelInFluid(Vec3 input) { + this.travelInFluid(input, net.minecraft.world.level.material.Fluids.WATER.defaultFluidState()); + } + -+ private void travelInFluid(Vec3 input, FluidState fluidstate) { ++ protected void travelInFluid(Vec3 input, FluidState fluidstate) { boolean isFalling = this.getDeltaMovement().y <= 0.0; double oldY = this.getY(); double baseGravity = this.getEffectiveGravity(); @@ -437,15 +437,15 @@ if (this.isInWater()) { this.travelInWater(input, baseGravity, isFalling, oldY); this.floatInWaterWhileRidden(); -@@ -2468,6 +_,7 @@ +@@ -2529,6 +_,7 @@ slowDown = 0.96F; } + speed *= this.getAttributeValue(net.minecraftforge.common.ForgeMod.SWIM_SPEED.getHolder().get()); this.moveRelative(speed, input); this.move(MoverType.SELF, this.getDeltaMovement()); - Vec3 ladderMovement = this.getDeltaMovement(); -@@ -2641,7 +_,7 @@ + Vec3 movement = this.getDeltaMovement(); +@@ -2706,7 +_,7 @@ double xd = Mth.clamp(delta.x, -0.15F, 0.15F); double zd = Mth.clamp(delta.z, -0.15F, 0.15F); double yd = Math.max(delta.y, -0.15F); @@ -454,7 +454,7 @@ yd = 0.0; } -@@ -2684,6 +_,7 @@ +@@ -2762,6 +_,7 @@ @Override public void tick() { @@ -462,15 +462,15 @@ super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2882,6 +_,7 @@ - ItemStack previous = this.lastEquipmentItems.get(slot); +@@ -2962,6 +_,7 @@ + ItemStack previous = lastEquipmentItems.get(slot); ItemStack current = this.getItemBySlot(slot); if (this.equipmentHasChanged(previous, current)) { + net.minecraftforge.event.ForgeEventFactory.onLivingEquipmentChange(this, slot, previous, current); if (changedItems == null) { changedItems = Maps.newEnumMap(EquipmentSlot.class); } -@@ -3017,6 +_,10 @@ +@@ -3097,6 +_,10 @@ profiler.push("jump"); if (this.jumping && this.isAffectedByFluids()) { double fluidHeight; @@ -481,10 +481,10 @@ if (this.isInLava()) { fluidHeight = this.getFluidHeight(FluidTags.LAVA); } else { -@@ -3027,15 +_,19 @@ +@@ -3107,15 +_,19 @@ double fluidJumpThreshold = this.getFluidJumpThreshold(); if (!inWaterAndHasFluidHeight || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { - if (!this.isInLava() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { + if (!this.isInLava() || this.onGround() && this.isInShallowFluid(FluidTags.LAVA)) { + if (fluidType.isAir() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { if ((this.onGround() || inWaterAndHasFluidHeight && fluidHeight <= fluidJumpThreshold) && this.noJumpDelay == 0) { this.jumpFromGround(); @@ -503,7 +503,7 @@ } } else { this.noJumpDelay = 0; -@@ -3355,8 +_,11 @@ +@@ -3434,8 +_,11 @@ private void updatingUsingItem() { if (this.isUsingItem()) { @@ -516,7 +516,7 @@ this.updateUsingItem(this.useItem); } else { this.stopUsingItem(); -@@ -3399,8 +_,12 @@ +@@ -3478,8 +_,12 @@ } protected void updateUsingItem(final ItemStack useItem) { @@ -530,7 +530,7 @@ this.completeUsingItem(); } } -@@ -3428,8 +_,10 @@ +@@ -3507,8 +_,10 @@ public void startUsingItem(final InteractionHand hand) { ItemStack itemStack = this.getItemInHand(hand); if (!itemStack.isEmpty() && !this.isUsingItem()) { @@ -542,7 +542,7 @@ if (!this.level().isClientSide()) { this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); -@@ -3487,6 +_,9 @@ +@@ -3566,6 +_,9 @@ p = p.xRot(-this.getXRot() * (float) (Math.PI / 180.0)); p = p.yRot(-this.getYRot() * (float) (Math.PI / 180.0)); p = p.add(this.getX(), this.getEyeY(), this.getZ()); @@ -552,7 +552,7 @@ this.level().addParticle(breakParticle, p.x, p.y, p.z, d.x, d.y + 0.05, d.z); } } -@@ -3499,7 +_,9 @@ +@@ -3578,7 +_,9 @@ this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { @@ -562,7 +562,7 @@ if (result != this.useItem) { this.setItemInHand(hand, result); } -@@ -3533,7 +_,13 @@ +@@ -3612,7 +_,13 @@ ItemStack itemInUsedHand = this.getItemInHand(this.getUsedItemHand()); if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInUsedHand, this.useItem)) { this.useItem = itemInUsedHand; @@ -576,7 +576,7 @@ if (this.useItem.useOnRelease()) { this.updatingUsingItem(); } -@@ -3543,6 +_,7 @@ +@@ -3622,6 +_,7 @@ } public void stopUsingItem() { @@ -584,7 +584,7 @@ if (!this.level().isClientSide()) { boolean wasUsingItem = this.isUsingItem(); this.recentKineticEnemies = null; -@@ -3704,8 +_,8 @@ +@@ -3783,8 +_,8 @@ } BlockState blockState = this.level().getBlockState(bedPosition); @@ -595,7 +595,7 @@ } this.setPose(Pose.SLEEPING); -@@ -3720,15 +_,15 @@ +@@ -3799,15 +_,15 @@ } private boolean checkBedExists() { @@ -614,7 +614,7 @@ Vec3 standUp = BedBlock.findStandUpPosition(this.getType(), this.level(), bedPosition, facing, this.getYRot()).orElseGet(() -> { BlockPos above = bedPosition.above(); return new Vec3(above.getX() + 0.5, above.getY() + 0.1, above.getZ() + 0.5); -@@ -3748,7 +_,9 @@ +@@ -3827,7 +_,9 @@ public @Nullable Direction getBedOrientation() { BlockPos bedPos = this.getSleepingPos().orElse(null); @@ -625,7 +625,7 @@ } @Override -@@ -3757,7 +_,7 @@ +@@ -3836,7 +_,7 @@ } public ItemStack getProjectile(final ItemStack heldWeapon) { @@ -634,16 +634,16 @@ } private static byte entityEventForEquipmentBreak(final EquipmentSlot equipmentSlot) { -@@ -3809,6 +_,8 @@ +@@ -3888,6 +_,8 @@ } - public final EquipmentSlot getEquipmentSlotForItem(final ItemStack itemStack) { + public EquipmentSlot getEquipmentSlotForItem(final ItemStack itemStack) { + final EquipmentSlot slot = itemStack.getEquipmentSlot(); + if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); return equippable != null && this.canUseSlot(equippable.slot()) ? equippable.slot() : EquipmentSlot.MAINHAND; } -@@ -3972,5 +_,42 @@ +@@ -4055,5 +_,42 @@ } public record Fallsounds(SoundEvent small, SoundEvent big) { diff --git a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch index de61e2bbb2..0c49a6994b 100644 --- a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -139,6 +_,9 @@ +@@ -144,6 +_,9 @@ private Leashable.@Nullable LeashData leashData; private BlockPos homePosition = BlockPos.ZERO; private int homeRadius = -1; @@ -10,7 +10,7 @@ protected Mob(final EntityType type, final Level level) { super(type, level); -@@ -244,7 +_,10 @@ +@@ -249,7 +_,10 @@ } public void setTarget(final @Nullable LivingEntity target) { @@ -22,7 +22,7 @@ } @Override -@@ -383,6 +_,10 @@ +@@ -388,6 +_,10 @@ if (this.isNoAi()) { output.putBoolean("NoAI", this.isNoAi()); } @@ -33,7 +33,7 @@ } @Override -@@ -401,6 +_,13 @@ +@@ -406,6 +_,13 @@ this.lootTable = input.read("DeathLootTable", LootTable.KEY_CODEC); this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L); this.setNoAi(input.getBooleanOr("NoAI", false)); @@ -47,7 +47,7 @@ } @Override -@@ -459,7 +_,7 @@ +@@ -464,7 +_,7 @@ && this.canPickUpLoot() && this.isAlive() && !this.dead @@ -56,7 +56,7 @@ Vec3i pickupReach = this.getPickupReach(); for (ItemEntity entity : this.level() -@@ -657,6 +_,14 @@ +@@ -691,6 +_,14 @@ this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { Entity player = this.level().getNearestPlayer(this, -1.0); @@ -71,7 +71,7 @@ if (player != null) { double distSqr = player.distanceToSqr(this); int instantDespawnDistance = this.getType().getCategory().getDespawnDistance(); -@@ -1058,6 +_,16 @@ +@@ -1084,6 +_,16 @@ } } @@ -88,7 +88,7 @@ public @Nullable SpawnGroupData finalizeSpawn( final ServerLevelAccessor level, final DifficultyInstance difficulty, final EntitySpawnReason spawnReason, final @Nullable SpawnGroupData groupData ) { -@@ -1070,6 +_,7 @@ +@@ -1096,6 +_,7 @@ } this.setLeftHanded(random.nextFloat() < 0.05F); @@ -96,7 +96,7 @@ return groupData; } -@@ -1383,15 +_,25 @@ +@@ -1409,15 +_,25 @@ return wasHurt; } @@ -123,7 +123,7 @@ @VisibleForTesting public void removeFreeWill() { this.removeAllGoals(goal -> true); -@@ -1417,6 +_,41 @@ +@@ -1449,6 +_,41 @@ @Override public @Nullable ItemStack getPickResult() { return SpawnEggItem.byId(this.getType()).map(ItemStack::new).orElse(null); diff --git a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch index 3d512b3d11..23e7943d2c 100644 --- a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch @@ -6,12 +6,12 @@ -public enum MobCategory implements StringRepresentable { +public enum MobCategory implements StringRepresentable, net.minecraftforge.common.IExtensibleEnum { - MONSTER("monster", 70, false, false, 128), - CREATURE("creature", 10, true, true, 128), - AMBIENT("ambient", 15, true, false, 128), + MONSTER("monster", "MO", 70, false, false, 128), + CREATURE("creature", "C", 10, true, true, 128), + AMBIENT("ambient", "AM", 15, true, false, 128), @@ -13,7 +_,8 @@ - WATER_AMBIENT("water_ambient", 20, true, false, 64), - MISC("misc", -1, true, true, 128); + WATER_AMBIENT("water_ambient", "WA", 20, true, false, 64), + MISC("misc", "MI", -1, true, true, 128); - public static final Codec CODEC = StringRepresentable.fromEnum(MobCategory::values); + public static final Codec CODEC = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(MobCategory::values, MobCategory::byName); @@ -19,13 +19,13 @@ private final int max; private final boolean isFriendly; private final boolean isPersistent; -@@ -56,5 +_,20 @@ +@@ -64,5 +_,20 @@ public int getNoDespawnDistance() { return 32; + } + -+ public static MobCategory create(String name, String id, int maxNumberOfCreatureIn, boolean isPeacefulCreatureIn, boolean isAnimalIn, int despawnDistance) { ++ public static MobCategory create(String name, String id, String debugAbbreviation, int max, boolean isFriendly, boolean isPersistent, int despawnDistance) { + throw new IllegalStateException("Enum not extended"); + } + diff --git a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch index 5f80753e56..50ecf121cf 100644 --- a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java -@@ -48,6 +_,7 @@ +@@ -50,6 +_,7 @@ public class SpawnPlacements { private static final Map, SpawnPlacements.Data> DATA_BY_TYPE = Maps.newHashMap(); @@ -8,9 +8,9 @@ private static void register( final EntityType type, final SpawnPlacementType placementType, -@@ -78,7 +_,8 @@ - final EntityType type, final ServerLevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random - ) { +@@ -84,7 +_,8 @@ + } + SpawnPlacements.Data data = DATA_BY_TYPE.get(type); - return data == null || data.predicate.test((EntityType)type, level, spawnReason, pos, random); + boolean vanillaResult = data == null || data.predicate.test((EntityType)type, level, spawnReason, pos, random); @@ -18,7 +18,7 @@ } static { -@@ -191,5 +_,13 @@ +@@ -200,5 +_,13 @@ @FunctionalInterface public interface SpawnPredicate { boolean test(EntityType type, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random); diff --git a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch index 420d224ab9..4f22b12555 100644 --- a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java -@@ -135,9 +_,9 @@ +@@ -134,9 +_,9 @@ protected void feed(final Player player, final InteractionHand hand, final ItemStack itemStack, final float healingFactor, final float defaultHeal) { FoodProperties foodProperties = itemStack.get(DataComponents.FOOD); @@ -11,7 +11,7 @@ } public boolean isInSittingPose() { -@@ -222,13 +_,16 @@ +@@ -221,13 +_,16 @@ @Override public void die(final DamageSource source) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch index 768b6b365b..c03cfea791 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/Brain.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java -@@ -256,6 +_,10 @@ +@@ -252,6 +_,10 @@ this.schedule = schedule; } @@ -11,7 +11,7 @@ public void setCoreActivities(final Set activities) { this.coreActivities = activities; } -@@ -457,6 +_,31 @@ +@@ -453,6 +_,31 @@ public boolean isBrainDead() { return this.memories.isEmpty() && this.sensors.isEmpty() && this.availableBehaviorsByPriority.isEmpty(); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch index 1fed431750..7f65824749 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -187,11 +_,12 @@ +@@ -190,11 +_,12 @@ .build(); public static AttributeSupplier getSupplier(final EntityType type) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch index a2b3c1290a..7082259ede 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch @@ -7,9 +7,9 @@ - if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) { + if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, body)) { return false; - } else if (!body.getVillagerData().profession().is(VillagerProfession.FARMER)) { - return false; -@@ -118,6 +_,11 @@ + } + +@@ -120,6 +_,11 @@ level.setBlockAndUpdate(this.aboveFarmlandPos, place); level.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(body, place)); ok = true; diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch index 31e31a0481..f329ae56a8 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch @@ -1,15 +1,14 @@ --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java -@@ -29,7 +_,11 @@ - if (!body.canAttack(targetEntity)) { - return false; - } else { -- attackTarget.set(targetEntity); -+ var changeTargetEvent = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetBehavior(body, targetEntity); -+ if (changeTargetEvent == null) -+ return false; +@@ -32,6 +_,11 @@ + return false; + } + ++ var changeTargetEvent = net.minecraftforge.event.ForgeEventFactory.onLivingChangeTargetBehavior(body, targetEntity); ++ if (changeTargetEvent == null) ++ return false; ++ targetEntity = changeTargetEvent.getNewTarget(); + -+ attackTarget.set(changeTargetEvent.getNewTarget()); - cantReachSince.erase(); - return true; - } + attackTarget.set(targetEntity); + cantReachSince.erase(); + return true; diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch index 9ad3e1ec80..ae288af77b 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch @@ -9,23 +9,24 @@ public MeleeAttackGoal(final PathfinderMob mob, final double speedModifier, final boolean followingTargetEvenIfNotSeen) { this.mob = mob; -@@ -42,6 +_,15 @@ - } else if (!target.isAlive()) { - return false; - } else { -+ if (canPenalize) { -+ if (--this.ticksUntilNextPathRecalculation <= 0) { -+ this.path = this.mob.getNavigation().createPath(target, 0); -+ this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); -+ return this.path != null; -+ } else { -+ return true; -+ } -+ } - this.path = this.mob.getNavigation().createPath(target, 0); - return this.path != null ? true : this.mob.isWithinMeleeAttackRange(target); - } -@@ -104,6 +_,18 @@ +@@ -46,6 +_,16 @@ + return false; + } + ++ if (canPenalize) { ++ if (--this.ticksUntilNextPathRecalculation <= 0) { ++ this.path = this.mob.getNavigation().createPath(target, 0); ++ this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); ++ return this.path != null? true : this.mob.isWithinMeleeAttackRange(target); ++ } else { ++ return true; ++ } ++ } ++ + this.path = this.mob.getNavigation().createPath(target, 0); + return this.path != null ? true : this.mob.isWithinMeleeAttackRange(target); + } +@@ -106,6 +_,18 @@ this.pathedTargetZ = target.getZ(); this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); double targetDistanceSqr = this.mob.distanceToSqr(target); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch index e2a94beb01..ca4da7708f 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch @@ -10,4 +10,4 @@ + if (this.mob != other && other.getTarget() == null - && (!(this.mob instanceof TamableAnimal) || ((TamableAnimal)this.mob).getOwner() == ((TamableAnimal)other).getOwner()) + && (!(this.mob instanceof TamableAnimal tamableAnimal) || tamableAnimal.getOwner() == ((TamableAnimal)other).getOwner()) diff --git a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch index 42a450f176..2864829c1b 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch @@ -1,16 +1,21 @@ --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -244,10 +_,10 @@ +@@ -248,12 +_,13 @@ Vec3 mobPos = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; Vec3i currentNodePos = this.path.getNextNodePos(); - double xDistance = Math.abs(this.mob.getX() - (currentNodePos.getX() + 0.5)); -+ double xDistance = Math.abs(this.mob.getX() - ((double)currentNodePos.getX() + (this.mob.getBbWidth() + 1) / 2D)); //Forge: Fix MC-94054 ++ //Forge: Fix MC-94054 make so jvm doesn't down grade to float math by casting to doubles ++ double xDistance = Math.abs(this.mob.getX() - ((double)currentNodePos.getX() + (this.mob.getBbWidth() + 1) / 2D)); double yDistance = Math.abs(this.mob.getY() - currentNodePos.getY()); - double zDistance = Math.abs(this.mob.getZ() - (currentNodePos.getZ() + 0.5)); -- boolean isCloseEnoughToCurrentNode = xDistance < this.maxDistanceToWaypoint && zDistance < this.maxDistanceToWaypoint && yDistance < 1.0; -+ double zDistance = Math.abs(this.mob.getZ() - ((double)currentNodePos.getZ() + (this.mob.getBbWidth() + 1) / 2D)); //Forge: Fix MC-94054 -+ boolean isCloseEnoughToCurrentNode = xDistance <= (double)this.maxDistanceToWaypoint && zDistance <= (double)this.maxDistanceToWaypoint && yDistance < 1.0D; //Forge: Fix MC-94054 +- boolean isCloseEnoughToCurrentNode = xDistance < this.maxDistanceToWaypoint +- && zDistance < this.maxDistanceToWaypoint +- && yDistance < this.getMaxVerticalDistanceToWaypoint(); ++ double zDistance = Math.abs(this.mob.getZ() - ((double)currentNodePos.getZ() + (this.mob.getBbWidth() + 1) / 2D)); ++ boolean isCloseEnoughToCurrentNode = xDistance <= (double)this.maxDistanceToWaypoint ++ && zDistance <= (double)this.maxDistanceToWaypoint ++ && yDistance < (double)this.getMaxVerticalDistanceToWaypoint(); if (isCloseEnoughToCurrentNode || this.canCutCorner(this.path.getNextNode().type) && this.shouldTargetNextNodeInDirection(mobPos)) { this.path.advance(); } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch index ae05737f6b..e39a203133 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch @@ -17,7 +17,7 @@ Zombie zombie; try { - zombie = new Zombie(level); -+ zombie = EntityType.ZOMBIE.create(level, EntitySpawnReason.EVENT); //Forge: Direct Initialization is deprecated, use EntityType. ++ zombie = EntityTypes.ZOMBIE.create(level, EntitySpawnReason.EVENT); //Forge: Direct Initialization is deprecated, use EntityType. zombie.finalizeSpawn(level, level.getCurrentDifficultyAt(zombie.blockPosition()), EntitySpawnReason.EVENT, null); - } catch (Exception var5) { - LOGGER.warn("Failed to create zombie for village siege at {}", spawnPos, var5); + } catch (Exception e) { + LOGGER.warn("Failed to create zombie for village siege at {}", spawnPos, e); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch index 2d097ed54a..7fe4a5237d 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/village/poi/PoiTypes.java +++ b/net/minecraft/world/entity/ai/village/poi/PoiTypes.java -@@ -80,7 +_,7 @@ +@@ -56,7 +_,7 @@ .stream() .flatMap(block -> block.getStateDefinition().getPossibleStates().stream()) .collect(ImmutableSet.toImmutableSet()); @@ -9,7 +9,7 @@ private static Set getBlockStates(final Block block) { return ImmutableSet.copyOf(block.getStateDefinition().getPossibleStates()); -@@ -95,7 +_,6 @@ +@@ -71,7 +_,6 @@ ) { PoiType value = new PoiType(matchingStates, maxTickets, validRange); Registry.register(registry, id, value); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch index ab3a3e43d2..1b8ffb5728 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -336,7 +_,7 @@ +@@ -341,7 +_,7 @@ public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) { ItemStack itemInHand = this.getItemInHand(InteractionHand.MAIN_HAND); return !itemInHand.isEmpty() diff --git a/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch index 722d03a4dc..c9f7edb036 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/bee/Bee.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/entity/animal/bee/Bee.java +++ b/net/minecraft/world/entity/animal/bee/Bee.java -@@ -482,7 +_,9 @@ +@@ -473,7 +_,9 @@ if (this.hivePos == null) { return null; } else { -- return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); +- return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityTypes.BEEHIVE).orElse(null); + if (!this.isTooFarAway(this.hivePos) && this.level().getBlockEntity(this.hivePos) instanceof BeehiveBlockEntity hiveEntity) + return hiveEntity; + return null; } } -@@ -648,13 +_,22 @@ +@@ -639,13 +_,22 @@ } @Override diff --git a/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch index ae3cf693ef..929afa8956 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/camel/Camel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -359,7 +_,7 @@ +@@ -365,7 +_,7 @@ @Override protected void playStepSound(final BlockPos pos, final BlockState blockState) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch index e03641f8c6..53566746b4 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/cow/MushroomCow.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/cow/MushroomCow.java +++ b/net/minecraft/world/entity/animal/cow/MushroomCow.java -@@ -114,7 +_,7 @@ +@@ -122,7 +_,7 @@ this.playSound(milkSound, 1.0F, 1.0F); return InteractionResult.SUCCESS; @@ -9,7 +9,7 @@ if (this.level() instanceof ServerLevel level) { this.shear(level, SoundSource.PLAYERS, itemStack); this.gameEvent(GameEvent.SHEAR, player); -@@ -170,15 +_,26 @@ +@@ -178,15 +_,26 @@ @Override public void shear(final ServerLevel level, final SoundSource soundSource, final ItemStack tool) { @@ -22,10 +22,10 @@ + + private java.util.List shearInternal(ServerLevel level, SoundSource soundSource, ItemStack tool) { + var ret = new java.util.ArrayList(); -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.COW, time -> {})) ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.COW, time -> {})) + return ret; level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F); - this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), cow -> { + this.convertTo(EntityTypes.COW, ConversionParams.single(this, false, false), cow -> { level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); this.dropFromShearingLootTable(level, BuiltInLootTables.SHEAR_MOOSHROOM, tool, (l, drop) -> { - for (int i = 0; i < drop.getCount(); i++) { @@ -39,7 +39,7 @@ } @Override -@@ -254,6 +_,15 @@ +@@ -267,6 +_,15 @@ } return babyVariant; @@ -54,4 +54,4 @@ + return java.util.Collections.emptyList(); } - public static enum Variant implements StringRepresentable { + public enum Variant implements StringRepresentable { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch index dce7703313..de0805d2b9 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/equine/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/equine/AbstractHorse.java -@@ -143,6 +_,7 @@ +@@ -142,6 +_,7 @@ } this.addBehaviourGoals(); @@ -8,7 +8,7 @@ } protected void addBehaviourGoals() { -@@ -278,16 +_,19 @@ +@@ -277,17 +_,20 @@ @Override public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { @@ -24,14 +24,15 @@ + int dmg = this.calculateFallDamage(event.getDistance(), event.getDamageMultiplier()); if (dmg <= 0) { return false; - } else { - this.hurt(damageSource, dmg); -- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); -+ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); - this.playBlockFallSound(); - return true; } -@@ -343,9 +_,9 @@ + + this.hurt(damageSource, dmg); +- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); ++ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); + this.playBlockFallSound(); + return true; + } +@@ -342,9 +_,9 @@ protected void playStepSound(final BlockPos pos, final BlockState blockState) { if (!blockState.liquid()) { BlockState aboveState = this.level().getBlockState(pos.above()); @@ -43,7 +44,7 @@ } if (this.isVehicle() && this.canGallop) { -@@ -777,6 +_,7 @@ +@@ -778,6 +_,7 @@ float cos = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); this.setDeltaMovement(this.getDeltaMovement().add(-0.4F * sin * amount, 0.0, 0.4F * cos * amount)); } @@ -51,7 +52,7 @@ } protected void playJumpSound() { -@@ -1027,6 +_,26 @@ +@@ -1028,6 +_,26 @@ public boolean hasInventoryChanged(final Container oldInventory) { return this.inventory != oldInventory; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch index ad486fff4a..14b2350f5e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/equine/Llama.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/equine/Llama.java +++ b/net/minecraft/world/entity/animal/equine/Llama.java -@@ -369,13 +_,15 @@ +@@ -370,14 +_,16 @@ @Override public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { @@ -10,12 +10,13 @@ + int dmg = this.calculateFallDamage(event.getDistance(), event.getDamageMultiplier()); if (dmg <= 0) { return false; - } else { -- if (fallDistance >= 6.0) { -+ if (event.getDistance() >= 6.0) { - this.hurt(damageSource, dmg); -- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); -+ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); - } + } - this.playBlockFallSound(); +- if (fallDistance >= 6.0) { ++ if (event.getDistance() >= 6.0) { + this.hurt(damageSource, dmg); +- this.propagateFallToPassengers(fallDistance, damageModifier, damageSource); ++ this.propagateFallToPassengers(event.getDistance(), event.getDamageMultiplier(), damageSource); + } + + this.playBlockFallSound(); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch index 7974832cc4..cb68fc763b 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/feline/Cat.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/feline/Cat.java +++ b/net/minecraft/world/entity/animal/feline/Cat.java -@@ -473,7 +_,7 @@ +@@ -485,7 +_,7 @@ } private void tryToTame(final Player player) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch index 650478cc0a..a7507eaadc 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/feline/Ocelot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/feline/Ocelot.java +++ b/net/minecraft/world/entity/animal/feline/Ocelot.java -@@ -161,7 +_,7 @@ +@@ -168,7 +_,7 @@ if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemStack) && player.distanceToSqr(this) < 9.0) { this.usePlayerItem(player, hand, itemStack); if (!this.level().isClientSide()) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch index 051a109fff..fd188324e4 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/fox/Fox.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/fox/Fox.java +++ b/net/minecraft/world/entity/animal/fox/Fox.java -@@ -878,6 +_,17 @@ +@@ -872,6 +_,17 @@ @Override protected void breed() { Fox offspring = (Fox)this.animal.getBreedOffspring(this.level, this.partner); @@ -18,7 +18,7 @@ if (offspring != null) { ServerPlayer animalLoveCause = this.animal.getLoveCause(); ServerPlayer partnerLoveCause = this.partner.getLoveCause(); -@@ -956,7 +_,7 @@ +@@ -949,7 +_,7 @@ } protected void onReachedTarget() { @@ -27,7 +27,7 @@ BlockState state = Fox.this.level().getBlockState(this.blockPos); if (state.is(Blocks.SWEET_BERRY_BUSH)) { this.pickSweetBerries(state); -@@ -1016,7 +_,7 @@ +@@ -1008,7 +_,7 @@ @Override public boolean canUse() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch index e513a6bc67..09badef295 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch @@ -9,7 +9,7 @@ if (level instanceof ServerLevel serverLevel) { this.shear(serverLevel, SoundSource.PLAYERS, itemStack); this.gameEvent(GameEvent.SHEAR, player); -@@ -427,6 +_,18 @@ +@@ -435,6 +_,18 @@ ItemStack itemStack = this.getItemBySlot(EQUIPMENT_SLOT_ANTENNA); this.setItemSlot(EQUIPMENT_SLOT_ANTENNA, ItemStack.EMPTY); this.spawnAtLocation(level, itemStack, 1.5F); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch index 41465ec44a..53549b8944 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/pig/Pig.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/animal/pig/Pig.java +++ b/net/minecraft/world/entity/animal/pig/Pig.java -@@ -194,10 +_,11 @@ +@@ -200,10 +_,11 @@ @Override public void thunderHit(final ServerLevel level, final LightningBolt lightningBolt) { - if (level.getDifficulty() != Difficulty.PEACEFUL) { -+ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIFIED_PIGLIN, (timer) -> {})) { - ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), zp -> { ++ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIFIED_PIGLIN, (timer) -> {})) { + ZombifiedPiglin zombifiedPiglin = this.convertTo(EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, false, true), zp -> { zp.populateDefaultEquipmentSlots(this.getRandom(), level.getCurrentDifficultyAt(this.blockPosition())); zp.setPersistenceRequired(); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zp); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch index 112bce3741..a855468db0 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java +++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java -@@ -604,7 +_,7 @@ +@@ -603,7 +_,7 @@ @Override public boolean canUse() { if (this.nextStartTick <= 0) { @@ -9,7 +9,7 @@ return false; } -@@ -653,7 +_,7 @@ +@@ -652,7 +_,7 @@ @Override protected boolean isValidTarget(final LevelReader level, final BlockPos pos) { BlockState state = level.getBlockState(pos); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch index f55484dd3e..7c488e36d6 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/sheep/Sheep.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/sheep/Sheep.java +++ b/net/minecraft/world/entity/animal/sheep/Sheep.java -@@ -137,7 +_,7 @@ +@@ -145,7 +_,7 @@ @Override public InteractionResult mobInteract(final Player player, final InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); @@ -9,7 +9,7 @@ if (this.level() instanceof ServerLevel level && this.readyForShearing()) { this.shear(level, SoundSource.PLAYERS, itemStack); this.gameEvent(GameEvent.SHEAR, player); -@@ -153,12 +_,27 @@ +@@ -161,12 +_,27 @@ @Override public void shear(final ServerLevel level, final SoundSource soundSource, final ItemStack tool) { @@ -37,7 +37,7 @@ for (int i = 0; i < drop.getCount(); i++) { ItemEntity entity = this.spawnAtLocation(l, drop.copyWithCount(1), 1.0F); if (entity != null) { -@@ -173,8 +_,14 @@ +@@ -181,8 +_,14 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch index 24a75907c9..588a18f224 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -307,7 +_,7 @@ +@@ -308,7 +_,7 @@ if (this.tickCount % 10 == 0) { this.level() .playLocalSound( diff --git a/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch index ba11d99b33..735cb4dd6e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/wolf/Wolf.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/wolf/Wolf.java +++ b/net/minecraft/world/entity/animal/wolf/Wolf.java -@@ -499,7 +_,7 @@ +@@ -506,7 +_,7 @@ } private void tryToTame(final Player player) { diff --git a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 26800b52d5..3d2e4e1e57 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch @@ -1,22 +1,6 @@ --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -100,6 +_,15 @@ - this.setHealth(this.getMaxHealth()); - this.noPhysics = true; - this.phaseManager = new EnderDragonPhaseManager(this); -+ this.setId(ENTITY_COUNTER.getAndAdd(this.subEntities.length + 1) + 1); // Forge: Fix MC-158205: Make sure part ids are successors of parent mob id -+ } -+ -+ @Override -+ public void setId(int id) { -+ super.setId(id); -+ for (int i = 0; i < this.subEntities.length; i++) { // Forge: Fix MC-158205: Set part ids to successors of parent mob id -+ this.subEntities[i].setId(id + i + 1); -+ } - } - - public void setDragonFight(final EnderDragonFight fight) { -@@ -148,8 +_,26 @@ +@@ -150,8 +_,26 @@ entityData.define(DATA_PHASE, EnderDragonPhase.HOVERING.getId()); } @@ -43,7 +27,7 @@ this.processFlappingMovement(); if (this.level().isClientSide()) { this.setHealth(this.getHealth()); -@@ -434,7 +_,7 @@ +@@ -436,7 +_,7 @@ BlockPos blockPos = new BlockPos(x, y, z); BlockState state = level.getBlockState(blockPos); if (!state.isAir() && !state.is(BlockTags.DRAGON_TRANSPARENT)) { @@ -52,7 +36,7 @@ destroyedBlock = level.removeBlock(blockPos, false) || destroyedBlock; } else { hitWall = true; -@@ -535,7 +_,8 @@ +@@ -540,7 +_,8 @@ if (this.level() instanceof ServerLevel level) { if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && level.getGameRules().get(GameRules.MOB_DROPS)) { @@ -62,7 +46,7 @@ } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -553,7 +_,8 @@ +@@ -558,7 +_,8 @@ if (this.dragonDeathTime >= 200 && this.level() instanceof ServerLevel level) { if (level.getGameRules().get(GameRules.MOB_DROPS)) { @@ -72,15 +56,7 @@ } if (this.dragonFight != null) { -@@ -861,6 +_,7 @@ - @Override - public void recreateFromPacket(final ClientboundAddEntityPacket packet) { - super.recreateFromPacket(packet); -+ if (true) return; // Forge: Fix MC-158205: Moved into setId() - EnderDragonPart[] subEntities = this.getSubEntities(); - - for (int i = 0; i < subEntities.length; i++) { -@@ -876,5 +_,15 @@ +@@ -884,5 +_,15 @@ @Override protected float sanitizeScale(final float scale) { return 1.0F; diff --git a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index a7a2fe46e7..e4c3d2af8c 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -320,7 +_,7 @@ +@@ -319,7 +_,7 @@ if (this.destroyBlocksTick > 0) { this.destroyBlocksTick--; @@ -9,7 +9,7 @@ boolean destroyed = false; int width = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); int height = Mth.floor(this.getBbHeight()); -@@ -334,7 +_,7 @@ +@@ -333,7 +_,7 @@ this.getBlockZ() + width )) { BlockState state = level.getBlockState(blockPos); @@ -18,7 +18,7 @@ destroyed = level.destroyBlock(blockPos, true, this) || destroyed; } } -@@ -353,6 +_,10 @@ +@@ -352,6 +_,10 @@ } } diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch index cc145b6837..50e6838a1e 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -85,6 +_,8 @@ - } else { - boolean isSupported = BlockPos.betweenClosedStream(this.calculateSupportBox()).allMatch(pos -> { - BlockState state = this.level().getBlockState(pos); -+ if (net.minecraft.world.level.block.Block.canSupportCenter(this.level(), pos, this.getDirection())) -+ return true; - return state.isSolid() || DiodeBlock.isDiode(state); - }); - return isSupported && this.canCoexist(false); +@@ -86,6 +_,8 @@ + + boolean isSupported = BlockPos.betweenClosedStream(this.calculateSupportBox()).allMatch(pos -> { + BlockState state = this.level().getBlockState(pos); ++ if (net.minecraft.world.level.block.Block.canSupportCenter(this.level(), pos, this.getDirection())) ++ return true; + return state.isSolid() || DiodeBlock.isDiode(state); + }); + return isSupported && this.canCoexist(false); diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch index 023ddf2829..1a5d3a15d5 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -@@ -75,7 +_,7 @@ - if (this.level().isClientSide()) { +@@ -77,7 +_,7 @@ return InteractionResult.SUCCESS; - } else { -- if (player.getItemInHand(hand).is(Items.SHEARS)) { -+ if (player.getItemInHand(hand).canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { - InteractionResult result = super.interact(player, hand, location); - if (result instanceof InteractionResult.Success success && success.wasItemInteraction()) { - return result; + } + +- if (player.getItemInHand(hand).is(Items.SHEARS)) { ++ if (player.getItemInHand(hand).canPerformAction(net.minecraftforge.common.ToolActions.SHEARS_HARVEST)) { + InteractionResult result = super.interact(player, hand, location); + if (result instanceof InteractionResult.Success success && success.wasItemInteraction()) { + return result; diff --git a/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index 6c13e6ac93..9db3602906 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -157,7 +_,7 @@ +@@ -158,7 +_,7 @@ if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { BlockPos pos = this.blockPosition(); boolean isConcrete = this.blockState.getBlock() instanceof ConcretePowderBlock; @@ -9,7 +9,7 @@ double moveVec = this.getDeltaMovement().lengthSqr(); if (isConcrete && moveVec > 1.0) { BlockHitResult clip = this.level() -@@ -166,7 +_,7 @@ +@@ -167,7 +_,7 @@ new Vec3(this.xo, this.yo, this.zo), this.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this ) ); diff --git a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch index 0a632c420a..8098c345f0 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -51,6 +_,10 @@ +@@ -52,6 +_,10 @@ private @Nullable EntityReference thrower; private @Nullable UUID target; public final float bobOffs = this.random.nextFloat() * (float) Math.PI * 2.0F; @@ -11,7 +11,7 @@ public ItemEntity(final EntityType type, final Level level) { super(type, level); -@@ -78,6 +_,7 @@ +@@ -79,6 +_,7 @@ this.setPos(x, y, z); this.setItem(itemStack); this.setDeltaMovement(deltaX, deltaY, deltaZ); @@ -19,7 +19,7 @@ } @Override -@@ -115,6 +_,7 @@ +@@ -116,6 +_,7 @@ @Override public void tick() { @@ -27,7 +27,7 @@ if (this.getItem().isEmpty()) { this.discard(); } else { -@@ -127,6 +_,10 @@ +@@ -128,6 +_,10 @@ this.yo = this.getY(); this.zo = this.getZ(); Vec3 oldMovement = this.getDeltaMovement(); @@ -38,17 +38,17 @@ if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > 0.1F) { this.setUnderwaterMovement(); } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > 0.1F) { -@@ -151,7 +_,8 @@ - this.applyEffectsFromBlocks(); - float friction = 0.98F; +@@ -153,7 +_,8 @@ + float airDrag = this.getAirDrag(); + float groundFriction = airDrag; if (this.onGround()) { -- friction = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- groundFriction *= this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction(); + BlockPos groundPos = getBlockPosBelowThatAffectsMyMovement(); -+ friction = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; ++ groundFriction *= this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; } - this.setDeltaMovement(this.getDeltaMovement().multiply(friction, 0.98, friction)); -@@ -183,7 +_,16 @@ + this.setDeltaMovement(this.getDeltaMovement().multiply(groundFriction, airDrag, groundFriction)); +@@ -185,7 +_,16 @@ } } @@ -66,16 +66,16 @@ this.discard(); } } -@@ -293,7 +_,7 @@ - this.health = (int)(this.health - damage); - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); - if (this.health <= 0) { -- this.getItem().onDestroyed(this); -+ this.getItem().onDestroyed(this, source); - this.discard(); - } +@@ -300,7 +_,7 @@ + this.health = (int)(this.health - damage); + this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + if (this.health <= 0) { +- this.getItem().onDestroyed(this); ++ this.getItem().onDestroyed(this, source); + this.discard(); + } -@@ -311,6 +_,7 @@ +@@ -317,6 +_,7 @@ output.putShort("Health", (short)this.health); output.putShort("Age", (short)this.age); output.putShort("PickupDelay", (short)this.pickupDelay); @@ -83,7 +83,7 @@ EntityReference.store(this.thrower, output, "Thrower"); output.storeNullable("Owner", UUIDUtil.CODEC, this.target); if (!this.getItem().isEmpty()) { -@@ -323,6 +_,7 @@ +@@ -329,6 +_,7 @@ this.health = input.getShortOr("Health", (short)5); this.age = input.getShortOr("Age", (short)0); this.pickupDelay = input.getShortOr("PickupDelay", (short)0); @@ -91,7 +91,7 @@ this.target = input.read("Owner", UUIDUtil.CODEC).orElse(null); this.thrower = EntityReference.read(input, "Thrower"); this.setItem(input.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY)); -@@ -334,10 +_,17 @@ +@@ -340,10 +_,17 @@ @Override public void playerTouch(final Player player) { if (!this.level().isClientSide()) { @@ -110,7 +110,7 @@ player.take(this, orgCount); if (itemStack.isEmpty()) { this.discard(); -@@ -421,7 +_,7 @@ +@@ -427,7 +_,7 @@ public void makeFakeItem() { this.setNeverPickUp(); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch index 9c67dfdcc4..80686f0291 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Monster.java +++ b/net/minecraft/world/entity/monster/Monster.java -@@ -149,9 +_,9 @@ +@@ -147,9 +_,9 @@ if (heldWeapon.getItem() instanceof ProjectileWeaponItem) { Predicate supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getSupportedHeldProjectiles(); ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedProjectiles); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch index 1b01e8ecf1..1e737394b4 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java -@@ -142,7 +_,7 @@ +@@ -143,7 +_,7 @@ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, baseValue, maxSpeed)); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch index b1f67664dc..512ab3dd79 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java -@@ -390,6 +_,12 @@ +@@ -401,6 +_,12 @@ && this.level().noCollision(this, new AABB(target).deflate(1.0E-6))) { Direction attachmentDirection = this.findAttachableSurface(target); if (attachmentDirection != null) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch index 168299362d..589b3c0372 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/entity/monster/Silverfish.java +++ b/net/minecraft/world/entity/monster/Silverfish.java -@@ -139,7 +_,7 @@ - return false; - } else { - RandomSource random = this.mob.getRandom(); -- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.mob.level()), this.mob) && random.nextInt(reducedTickDelay(10)) == 0) { - this.selectedDirection = Direction.getRandom(random); - BlockPos pos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); - BlockState blockState = this.mob.level().getBlockState(pos); -@@ -210,7 +_,7 @@ +@@ -143,7 +_,7 @@ + } + + RandomSource random = this.mob.getRandom(); +- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(this.mob.level()), this.mob) && random.nextInt(reducedTickDelay(10)) == 0) { + this.selectedDirection = Direction.getRandom(random); + BlockPos pos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); + BlockState blockState = this.mob.level().getBlockState(pos); +@@ -212,7 +_,7 @@ + BlockPos testPos = basePos.offset(xOff, yOff, zOff); BlockState blockState = level.getBlockState(testPos); - Block block = blockState.getBlock(); - if (block instanceof InfestedBlock) { + if (blockState.getBlock() instanceof InfestedBlock infestedBlock) { - if (getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(getServerLevel(level), this.silverfish)) { level.destroyBlock(testPos, true, this.silverfish); } else { - level.setBlock(testPos, ((InfestedBlock)block).hostStateByInfested(level.getBlockState(testPos)), 3); + level.setBlock(testPos, infestedBlock.hostStateByInfested(level.getBlockState(testPos)), 3); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch index eb07ec8326..8568a1f469 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/creaking/Creaking.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -466,7 +_,7 @@ +@@ -468,7 +_,7 @@ for (Player player : players) { if (this.canAttack(player) && !this.isAlliedTo(player)) { hasPotentialTarget = true; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch similarity index 82% rename from patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch rename to patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch index d966a2ff1c..f2922c2523 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/world/entity/monster/Slime.java -+++ b/net/minecraft/world/entity/monster/Slime.java -@@ -139,6 +_,8 @@ +--- a/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java ++++ b/net/minecraft/world/entity/monster/cubemob/AbstractCubeMob.java +@@ -125,6 +_,8 @@ float size = this.getDimensions(this.getPose()).width() * 2.0F; float radius = size / 2.0F; @@ -9,7 +9,7 @@ for (int i = 0; i < size * 16.0F; i++) { float dir = this.random.nextFloat() * (float) (Math.PI * 2); float d = this.random.nextFloat() * 0.5F + 0.5F; -@@ -156,6 +_,12 @@ +@@ -145,6 +_,12 @@ this.wasOnGround = this.onGround(); this.decreaseSquish(); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch similarity index 89% rename from patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch rename to patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch index e4897bd9a6..17ca813544 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/MagmaCube.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/world/entity/monster/MagmaCube.java -+++ b/net/minecraft/world/entity/monster/MagmaCube.java -@@ -71,17 +_,28 @@ +--- a/net/minecraft/world/entity/monster/cubemob/MagmaCube.java ++++ b/net/minecraft/world/entity/monster/cubemob/MagmaCube.java +@@ -96,17 +_,28 @@ float sizeJumpBoostPower = this.getSize() * 0.1F; this.setDeltaMovement(movement.x, this.getJumpPower() + sizeJumpBoostPower, movement.z); this.needsSync = true; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch new file mode 100644 index 0000000000..58c6c94b25 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/monster/cubemob/SulfurCube.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/entity/monster/cubemob/SulfurCube.java ++++ b/net/minecraft/world/entity/monster/cubemob/SulfurCube.java +@@ -181,8 +_,8 @@ + } + + @Override +- protected void travelInFluid(final Vec3 input) { +- super.travelInFluid(input); ++ protected void travelInFluid(final Vec3 input, final net.minecraft.world.level.material.FluidState fluid) { ++ super.travelInFluid(input, fluid); + if (this.hasBodyItem() && this.floatsInLiquids) { + float vibeAmount = 0.2F * Mth.sin(this.tickCount * 0.4F); + double immersion = this.getFluidHeight(this.isInWater() ? FluidTags.WATER : FluidTags.LAVA) - this.getFluidJumpThreshold() + vibeAmount; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index 65f6ef83a6..a2444bba97 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -140,7 +_,7 @@ +@@ -148,7 +_,7 @@ HoglinAi.updateActivity(this); if (this.isConverting()) { this.timeInOverworld++; - if (this.timeInOverworld > 300) { -+ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { ++ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); this.finishConversion(); } -@@ -236,9 +_,7 @@ +@@ -249,9 +_,7 @@ } private void finishConversion() { - this.convertTo( -- EntityType.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) +- EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) - ); -+ this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> { zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zoglin); }); ++ this.convertTo(EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> { zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)); net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zoglin); }); } @Override diff --git a/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch index c4be3cb13f..7fec99db3b 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/illager/Evoker.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/illager/Evoker.java +++ b/net/minecraft/world/entity/monster/illager/Evoker.java -@@ -311,7 +_,7 @@ +@@ -305,7 +_,7 @@ + } + + ServerLevel level = getServerLevel(Evoker.this.level()); +- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, Evoker.this)) { return false; - } else { - ServerLevel level = getServerLevel(Evoker.this.level()); -- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(level, Evoker.this)) { - return false; - } else { - List entities = level.getNearbyEntities( + } + diff --git a/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch index 09b7d0bd19..b2d3cc289a 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/illager/Illusioner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/illager/Illusioner.java +++ b/net/minecraft/world/entity/monster/illager/Illusioner.java -@@ -175,9 +_,12 @@ +@@ -174,9 +_,12 @@ @Override public void performRangedAttack(final LivingEntity target, final float power) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch index e7e7eb7fc8..7cf9d86c38 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java -@@ -84,7 +_,7 @@ +@@ -86,7 +_,7 @@ this.timeInOverworld = 0; } - if (this.timeInOverworld > 300) { -+ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIFIED_PIGLIN, (timer) -> this.timeInOverworld = timer)) { - this.playConvertedSound(); - this.finishConversion(level); - } -@@ -105,7 +_,10 @@ ++ if (this.timeInOverworld > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIFIED_PIGLIN, (timer) -> this.timeInOverworld = timer)) { + if (level.getDifficulty() != Difficulty.PEACEFUL) { + this.playConvertedSound(); + } +@@ -110,7 +_,10 @@ this.convertTo( - EntityType.ZOMBIFIED_PIGLIN, + EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), - zombified -> zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) + zombified -> { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch index 85ee0d7ca4..0b63ebe319 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -322,7 +_,7 @@ +@@ -323,7 +_,7 @@ } else if (this.isChargingCrossbow()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { @@ -9,16 +9,15 @@ } } -@@ -359,7 +_,7 @@ - } +@@ -362,14 +_,14 @@ protected void holdInOffHand(final ItemStack itemStack) { -- if (itemStack.is(PiglinAi.BARTERING_ITEM)) { -+ if (itemStack.isPiglinCurrency()) { - this.setItemSlot(EquipmentSlot.OFFHAND, itemStack); - this.setGuaranteedDrop(EquipmentSlot.OFFHAND); - } else { -@@ -369,7 +_,7 @@ + this.setItemSlotAndDropWhenKilled(EquipmentSlot.OFFHAND, itemStack); +- if (!itemStack.is(PiglinAi.BARTERING_ITEM)) { ++ if (!itemStack.isPiglinCurrency()) { + this.setPersistenceRequired(); + } + } @Override public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch index f5f126308d..6e2e9bdc2b 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java -@@ -652,7 +_,7 @@ +@@ -647,7 +_,7 @@ public static boolean isWearingSafeArmor(final LivingEntity livingEntity) { for (EquipmentSlot slot : EquipmentSlotGroup.ARMOR) { @@ -9,7 +9,7 @@ return true; } } -@@ -803,7 +_,7 @@ +@@ -799,7 +_,7 @@ } private static boolean hasCrossbow(final LivingEntity body) { @@ -18,7 +18,7 @@ } private static void admireGoldItem(final LivingEntity body) { -@@ -815,7 +_,7 @@ +@@ -811,7 +_,7 @@ } private static boolean isBarterCurrency(final ItemStack itemStack) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch index ef78ee63be..2e86aca7c1 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java -@@ -138,7 +_,7 @@ +@@ -133,7 +_,7 @@ if (this.level() != null && !this.level().isClientSide()) { this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); @@ -9,7 +9,7 @@ if (usedWeapon.is(Items.BOW)) { int minAttackInterval = this.getHardAttackInterval(); if (this.level().getDifficulty() != Difficulty.HARD) { -@@ -163,9 +_,12 @@ +@@ -158,9 +_,12 @@ @Override public void performRangedAttack(final LivingEntity target, final float power) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch index a02464845b..aa17c59f6c 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Bogged.java.patch @@ -12,7 +12,7 @@ @@ -137,5 +_,17 @@ @Override public boolean readyForShearing() { - return !this.isSheared() && this.isAlive(); + return !this.isSheared(); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch index f28f495fd9..62ab199b69 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/skeleton/Skeleton.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/skeleton/Skeleton.java +++ b/net/minecraft/world/entity/monster/skeleton/Skeleton.java -@@ -92,6 +_,7 @@ +@@ -93,6 +_,7 @@ } protected void doFreezeConversion() { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.STRAY, (timer) -> this.conversionTime = timer)) return; - this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), stray -> { ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.STRAY, (timer) -> this.conversionTime = timer)) return; + this.convertTo(EntityTypes.STRAY, ConversionParams.single(this, true, true), stray -> { if (!this.isSilent()) { this.level().levelEvent(null, 1048, this.blockPosition(), 0); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch index 272aa837ee..885cb21e25 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/spider/Spider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/spider/Spider.java +++ b/net/minecraft/world/entity/monster/spider/Spider.java -@@ -123,7 +_,10 @@ +@@ -124,7 +_,10 @@ @Override public boolean canBeAffected(final MobEffectInstance newEffect) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch index c4c106ce6e..77619ab765 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Husk.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/zombie/Husk.java +++ b/net/minecraft/world/entity/monster/zombie/Husk.java -@@ -79,6 +_,7 @@ +@@ -80,6 +_,7 @@ @Override protected void doUnderWaterConversion(final ServerLevel level) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.ZOMBIE, (timer) -> this.conversionTime = timer)) return; - this.convertToZombieType(level, EntityType.ZOMBIE); ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.ZOMBIE, (timer) -> this.conversionTime = timer)) return; + this.convertToZombieType(level, EntityTypes.ZOMBIE); if (!this.isSilent()) { level.levelEvent(null, 1041, this.blockPosition(), 0); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch index 8f3035e69f..d1a4f8ed66 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/Zombie.java.patch @@ -20,12 +20,12 @@ @VisibleForTesting public boolean convertVillagerToZombieVillager(final ServerLevel level, final Villager villager) { -+ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(villager, EntityType.ZOMBIE_VILLAGER, (timer) -> {})) ++ if (!net.minecraftforge.event.ForgeEventFactory.canLivingConvert(villager, EntityTypes.ZOMBIE_VILLAGER, (timer) -> {})) + return false; ZombieVillager zombieVillager = villager.convertTo( - EntityType.ZOMBIE_VILLAGER, + EntityTypes.ZOMBIE_VILLAGER, ConversionParams.single(villager, true, true), -@@ -267,6 +_,7 @@ +@@ -268,6 +_,7 @@ zombie.setGossips(villager.getGossips().copy()); zombie.setTradeOffers(villager.getOffers().copy()); zombie.setVillagerXp(villager.getVillagerXp()); @@ -33,25 +33,22 @@ if (!this.isSilent()) { level.levelEvent(null, 1026, this.blockPosition(), 0); } -@@ -289,19 +_,26 @@ - target = (LivingEntity)source.getEntity(); - } +@@ -291,15 +_,26 @@ + target = (LivingEntity)source.getEntity(); + } -- if (target != null -+ var vanilla = (target != null - && level.getDifficulty() == Difficulty.HARD - && this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) -- && level.isSpawningMonsters()) { -+ && level.isSpawningMonsters()); - int x = Mth.floor(this.getX()); - int y = Mth.floor(this.getY()); - int z = Mth.floor(this.getZ()); - EntityType type = this.getType(); -- Zombie reinforcement = type.create(level, EntitySpawnReason.REINFORCEMENT); -- if (reinforcement == null) { -- return true; -- } -- +- if (target != null ++ var vanilla = (target != null + && level.getDifficulty() == Difficulty.HARD + && this.random.nextFloat() < this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE) +- && level.isSpawningMonsters()) { ++ && level.isSpawningMonsters()); ++ { + int x = Mth.floor(this.getX()); + int y = Mth.floor(this.getY()); + int z = Mth.floor(this.getZ()); + EntityType type = this.getType(); +- Zombie reinforcement = type.create(level, EntitySpawnReason.REINFORCEMENT); + + var event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, level(), x, y, z, target, this.getAttributeValue(Attributes.SPAWN_REINFORCEMENTS_CHANCE)); + @@ -63,7 +60,6 @@ + reinforcement = type.create(this.level(), EntitySpawnReason.REINFORCEMENT); + } + -+ if (reinforcement != null) { - for (int i = 0; i < 50; i++) { - int xt = x + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); - int yt = y + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); + if (reinforcement == null) { + return true; + } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch index 2004d22310..2501359c69 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/zombie/ZombieVillager.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java -@@ -156,7 +_,7 @@ +@@ -152,7 +_,7 @@ if (!this.level().isClientSide() && this.isAlive() && this.isConverting()) { int amount = this.getConversionProgress(); this.villagerConversionTime -= amount; - if (this.villagerConversionTime <= 0) { -+ if (this.villagerConversionTime <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.VILLAGER, (timer) -> this.villagerConversionTime = timer)) { ++ if (this.villagerConversionTime <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.VILLAGER, (timer) -> this.villagerConversionTime = timer)) { this.finishConversion((ServerLevel)this.level()); } } -@@ -270,6 +_,7 @@ +@@ -267,6 +_,7 @@ if (!this.isSilent()) { level.levelEvent(null, 1027, this.blockPosition(), 0); } diff --git a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch index 01f58a9ac1..d20a2b3c9a 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/entity/npc/CatSpawner.java @@ -65,12 +_,12 @@ private void spawnCat(final BlockPos spawnPos, final ServerLevel level, final boolean makePersistent) { - Cat cat = EntityType.CAT.create(level, EntitySpawnReason.NATURAL); + Cat cat = EntityTypes.CAT.create(level, EntitySpawnReason.NATURAL); if (cat != null) { + cat.snapTo(spawnPos, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat cat.finalizeSpawn(level, level.getCurrentDifficultyAt(spawnPos), EntitySpawnReason.NATURAL, null); diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch index d138f7bbd4..49b20fbe26 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/villager/AbstractVillager.java +++ b/net/minecraft/world/entity/npc/villager/AbstractVillager.java -@@ -138,6 +_,8 @@ +@@ -139,6 +_,8 @@ if (this.tradingPlayer instanceof ServerPlayer) { CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, offer.getResult()); } diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch index 8fd26e9ce2..cd35c7a612 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/Villager.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/entity/npc/villager/Villager.java +++ b/net/minecraft/world/entity/npc/villager/Villager.java -@@ -298,7 +_,7 @@ +@@ -289,7 +_,7 @@ @Override public InteractionResult mobInteract(final Player player, final InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); - if (itemStack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping()) { + if (itemStack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping() || player.isSecondaryUseActive()) { return super.mobInteract(player, hand); - } else if (this.isBaby()) { - this.setUnhappy(); -@@ -759,7 +_,7 @@ + } + +@@ -761,7 +_,7 @@ @Override public void thunderHit(final ServerLevel level, final LightningBolt lightningBolt) { - if (level.getDifficulty() != Difficulty.PEACEFUL) { -+ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.WITCH, (timer) -> {})) { ++ if (level.getDifficulty() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityTypes.WITCH, (timer) -> {})) { LOGGER.info("Villager {} was struck by lightning {}.", this, lightningBolt); - Witch witch = this.convertTo(EntityType.WITCH, ConversionParams.single(this, false, false), w -> { + Witch witch = this.convertTo(EntityTypes.WITCH, ConversionParams.single(this, false, false), w -> { w.finalizeSpawn(level, level.getCurrentDifficultyAt(w.blockPosition()), EntitySpawnReason.CONVERSION, null); diff --git a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch index 3ca0097a88..edb7fda2f1 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/villager/VillagerType.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/entity/npc/villager/VillagerType.java @@ -79,4 +_,9 @@ public static ResourceKey byBiome(final Holder biome) { - return biome.unwrapKey().map(BY_BIOME::get).orElse(PLAINS); + return biome.unwrapKey().map(BY_BIOME::get).orElse(VillagerData.DEFAULT_TYPE); } + + /** FORGE: Registers the VillagerType that will spawn in the given biome. This method should be called during FMLCommonSetupEvent using event.enqueueWork() */ diff --git a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch index fc24080eb9..fcc33cde89 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch @@ -13,14 +13,14 @@ && ItemStack.isSameItemSameComponents(slotItemStack, newItemStack) @@ -169,7 +_,7 @@ - for (int slotx = 0; slotx < 9; slotx++) { - int index = (this.selected + slotx) % 9; + for (int slot = 0; slot < 9; slot++) { + int index = (this.selected + slot) % 9; - if (!this.items.get(index).isEnchanted()) { + if (!this.items.get(index).isNotReplaceableByPickAction(this.player, index)) { return index; } } -@@ -240,7 +_,7 @@ +@@ -242,7 +_,7 @@ for (int i = 0; i < this.items.size(); i++) { ItemStack itemStack = this.getItem(i); if (!itemStack.isEmpty()) { @@ -29,12 +29,12 @@ } } } -@@ -290,6 +_,8 @@ - } catch (Throwable var6) { - CrashReport report = CrashReport.forThrowable(var6, "Adding item to inventory"); - CrashReportCategory category = report.addCategory("Item being added"); -+ category.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem()))); -+ category.setDetail("Item Class", () -> itemStack.getItem().getClass().getName()); - category.setDetail("Item ID", Item.getId(itemStack.getItem())); - category.setDetail("Item data", itemStack.getDamageValue()); - category.setDetail("Item name", () -> itemStack.getHoverName().getString()); +@@ -293,6 +_,8 @@ + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "Adding item to inventory"); + CrashReportCategory category = report.addCategory("Item being added"); ++ category.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(itemStack.getItem()))); ++ category.setDetail("Item Class", () -> itemStack.getItem().getClass().getName()); + category.setDetail("Item ID", Item.getId(itemStack.getItem())); + category.setDetail("Item data", itemStack.getDamageValue()); + category.setDetail("Item name", () -> itemStack.getHoverName().getString()); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch index b055b4015c..a9f5e2cff1 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch @@ -18,7 +18,7 @@ + @Nullable private Pose forcedPose; public Player(final Level level, final GameProfile gameProfile) { - super(EntityType.PLAYER, level); + super(EntityTypes.PLAYER, level); @@ -179,6 +_,17 @@ this.inventory = new Inventory(this, this.equipment); this.inventoryMenu = new InventoryMenu(this.inventory, !level.isClientSide(), this); @@ -37,7 +37,7 @@ } @Override -@@ -212,7 +_,8 @@ +@@ -216,7 +_,8 @@ .add(Attributes.MINING_EFFICIENCY) .add(Attributes.SWEEPING_DAMAGE_RATIO) .add(Attributes.WAYPOINT_TRANSMIT_RANGE, 6.0E7) @@ -47,7 +47,7 @@ } @Override -@@ -226,6 +_,7 @@ +@@ -230,6 +_,7 @@ @Override public void tick() { @@ -55,7 +55,7 @@ this.noPhysics = this.isSpectator(); if (this.isSpectator() || this.isPassenger()) { this.setOnGround(false); -@@ -242,7 +_,7 @@ +@@ -246,7 +_,7 @@ } if (!this.level().isClientSide() @@ -64,7 +64,7 @@ this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { -@@ -278,6 +_,7 @@ +@@ -282,6 +_,7 @@ this.cooldowns.tick(); this.updatePlayerPose(); @@ -72,7 +72,7 @@ } @Override -@@ -337,6 +_,10 @@ +@@ -341,6 +_,10 @@ } protected void updatePlayerPose() { @@ -83,7 +83,7 @@ if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.SWIMMING)) { Pose desiredPose = this.getDesiredPose(); Pose actualPose; -@@ -521,6 +_,7 @@ +@@ -524,6 +_,7 @@ @Override public void die(final DamageSource source) { @@ -91,7 +91,7 @@ super.die(source); this.reapplyPosition(); if (!this.isSpectator() && this.level() instanceof ServerLevel level) { -@@ -577,10 +_,15 @@ +@@ -580,10 +_,15 @@ } public @Nullable ItemEntity drop(final ItemStack itemStack, final boolean thrownFromHand) { @@ -108,7 +108,7 @@ float speed = this.inventory.getSelectedItem().getDestroySpeed(state); if (speed > 1.0F) { speed += (float)this.getAttributeValue(Attributes.MINING_EFFICIENCY); -@@ -609,11 +_,14 @@ +@@ -612,11 +_,14 @@ speed /= 5.0F; } @@ -124,15 +124,15 @@ } @Override -@@ -674,6 +_,7 @@ +@@ -677,6 +_,7 @@ @Override public boolean hurtServer(final ServerLevel level, final DamageSource source, float damage) { + if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, source, damage)) return false; if (this.isInvulnerableTo(level, source)) { return false; - } else if (this.abilities.invulnerable && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -742,10 +_,13 @@ + } +@@ -747,11 +_,14 @@ @Override protected void actuallyHurt(final ServerLevel level, final DamageSource source, float dmg) { if (!this.isInvulnerableTo(level, source)) { @@ -140,13 +140,14 @@ + if (dmg <= 0) return; dmg = this.getDamageAfterArmorAbsorb(source, dmg); dmg = this.getDamageAfterMagicAbsorb(source, dmg); - float var8 = Math.max(dmg - this.getAbsorptionAmount(), 0.0F); - this.setAbsorptionAmount(this.getAbsorptionAmount() - (dmg - var8)); -+ var8 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, var8); - float absorbedDamage = dmg - var8; + float originalDamage = dmg; + dmg = Math.max(dmg - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (originalDamage - dmg)); ++ dmg = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, source, dmg); + float absorbedDamage = originalDamage - dmg; if (absorbedDamage > 0.0F && absorbedDamage < 3.4028235E37F) { this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(absorbedDamage * 10.0F)); -@@ -823,6 +_,10 @@ +@@ -829,6 +_,10 @@ return InteractionResult.PASS; } else { @@ -157,7 +158,7 @@ ItemStack itemStack = this.getItemInHand(hand); ItemStack itemStackClone = itemStack.copy(); InteractionResult interact = entity.interact(this, hand, location); -@@ -831,6 +_,10 @@ +@@ -837,6 +_,10 @@ itemStack.setCount(itemStackClone.getCount()); } @@ -167,8 +168,8 @@ + return interact; } else { - if (!itemStack.isEmpty() && entity instanceof LivingEntity) { -@@ -842,6 +_,7 @@ + if (!itemStack.isEmpty() && entity instanceof LivingEntity livingEntity) { +@@ -848,6 +_,7 @@ if (interactionResult.consumesAction()) { this.level().gameEvent(GameEvent.ENTITY_INTERACT, entity.position(), GameEvent.Context.of(this)); if (itemStack.isEmpty() && !this.hasInfiniteMaterials()) { @@ -176,7 +177,7 @@ this.setItemInHand(hand, ItemStack.EMPTY); } -@@ -941,6 +_,7 @@ +@@ -949,6 +_,7 @@ } public void attack(final Entity entity) { @@ -184,7 +185,7 @@ if (!this.cannotAttack(entity)) { float baseDamage = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); ItemStack attackingItemStack = this.getWeaponItem(); -@@ -962,8 +_,10 @@ +@@ -970,8 +_,10 @@ baseDamage += attackingItemStack.getItem().getAttackDamageBonus(entity, baseDamage, damageSource); boolean criticalAttack = fullStrengthAttack && this.canCriticalAttack(entity); @@ -196,7 +197,7 @@ } float totalDamage = baseDamage + magicBoost; -@@ -1035,7 +_,7 @@ +@@ -1045,7 +_,7 @@ double approximateSpeedSq = this.getKnownMovement().horizontalDistanceSqr(); double maxSpeedForSweepAttack = this.getSpeed() * 2.5; if (approximateSpeedSq < Mth.square(maxSpeedForSweepAttack)) { @@ -205,18 +206,18 @@ } } -@@ -1078,8 +_,8 @@ +@@ -1088,8 +_,8 @@ private void itemAttackInteraction(final Entity entity, final ItemStack attackingItemStack, final DamageSource damageSource, final boolean applyToTarget) { Entity hurtTarget = entity; -- if (entity instanceof EnderDragonPart) { -- hurtTarget = ((EnderDragonPart)entity).parentMob; +- if (entity instanceof EnderDragonPart enderDragonPart) { +- hurtTarget = enderDragonPart.parentMob; + if (entity instanceof net.minecraftforge.entity.PartEntity pe) { + hurtTarget = pe.getParent(); } boolean itemHurtEnemy = false; -@@ -1104,6 +_,7 @@ +@@ -1114,6 +_,7 @@ } else { this.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); } @@ -224,7 +225,7 @@ } } } -@@ -1144,7 +_,7 @@ +@@ -1166,7 +_,7 @@ if (this.level() instanceof ServerLevel serverLevel) { float var12 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * baseDamage; @@ -233,7 +234,7 @@ if (nearby != this && nearby != entity && !this.isAlliedTo(nearby) -@@ -1310,6 +_,7 @@ +@@ -1339,6 +_,7 @@ } public void stopSleepInBed(final boolean forcefulWakeUp, final boolean updateLevelList) { @@ -241,15 +242,15 @@ super.stopSleeping(); if (this.level() instanceof ServerLevel && updateLevelList) { ((ServerLevel)this.level()).updateSleepingPlayerList(); -@@ -1421,6 +_,7 @@ +@@ -1450,6 +_,7 @@ @Override public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) { if (this.abilities.mayfly) { + net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, fallDistance, damageModifier); return false; - } else { - if (fallDistance >= 2.0) { -@@ -1455,13 +_,13 @@ + } + +@@ -1484,13 +_,13 @@ protected void playStepSound(final BlockPos onPos, final BlockState onState) { if (this.isInWater()) { this.waterSwimSound(); @@ -265,7 +266,7 @@ } else { super.playStepSound(primaryStepSoundPos, primaryStepState); } -@@ -1491,7 +_,13 @@ +@@ -1520,7 +_,13 @@ this.tryResetCurrentImpulseContext(); } @@ -280,7 +281,7 @@ this.increaseScore(i); this.experienceProgress = this.experienceProgress + (float)i / this.getXpNeededForNextLevel(); this.totalExperience = Mth.clamp(this.totalExperience + i, 0, Integer.MAX_VALUE); -@@ -1519,7 +_,7 @@ +@@ -1548,7 +_,7 @@ } public void onEnchantmentPerformed(final ItemStack itemStack, final int enchantmentCost) { @@ -289,7 +290,7 @@ if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; -@@ -1529,7 +_,13 @@ +@@ -1558,7 +_,13 @@ this.enchantmentSeed = this.random.nextInt(); } @@ -304,7 +305,7 @@ this.experienceLevel = IntMath.saturatedAdd(this.experienceLevel, amount); if (this.experienceLevel < 0) { this.experienceLevel = 0; -@@ -1668,7 +_,13 @@ +@@ -1697,7 +_,13 @@ @Override public Component getDisplayName() { @@ -319,30 +320,31 @@ return this.decorateDisplayNameComponent(result); } -@@ -1860,18 +_,19 @@ - Predicate supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getSupportedHeldProjectiles(); - ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedProjectiles); - if (!heldProjectile.isEmpty()) { -- return heldProjectile; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, heldProjectile); - } else { - supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getAllSupportedProjectiles(); +@@ -1882,7 +_,7 @@ + Predicate supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getSupportedHeldProjectiles(); + ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedProjectiles); + if (!heldProjectile.isEmpty()) { +- return heldProjectile; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, heldProjectile); + } - for (int i = 0; i < this.inventory.getContainerSize(); i++) { - ItemStack itemStack = this.inventory.getItem(i); - if (supportedProjectiles.test(itemStack)) { -- return itemStack; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, itemStack); - } - } - -- return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; -+ var vanilla = this.abilities.instabuild ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; -+ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, vanilla); + supportedProjectiles = ((ProjectileWeaponItem)heldWeapon.getItem()).getAllSupportedProjectiles(); +@@ -1890,11 +_,12 @@ + for (int i = 0; i < this.inventory.getContainerSize(); i++) { + ItemStack itemStack = this.inventory.getItem(i); + if (supportedProjectiles.test(itemStack)) { +- return itemStack; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, itemStack); } } + +- return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ var vanilla = this.abilities.instabuild ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ return net.minecraftforge.common.ForgeHooks.getProjectile(this, heldWeapon, vanilla); } -@@ -1992,6 +_,54 @@ + + @Override +@@ -2015,6 +_,54 @@ double maxRange = this.blockInteractionRange() + buffer; return new AABB(pos).distanceToSqr(this.getEyePosition()) < maxRange * maxRange; } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch index d326c5d0c9..d78b9f93df 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java -@@ -253,8 +_,8 @@ +@@ -254,8 +_,8 @@ if (owner.canInteractWithLevel()) { ItemStack selectedItem = owner.getMainHandItem(); ItemStack selectedItemOffHand = owner.getOffhandItem(); @@ -11,7 +11,7 @@ if ((mainHandIsFishing || offHandIsFishing) && this.distanceToSqr(owner) <= 1024.0) { return false; } -@@ -266,6 +_,7 @@ +@@ -267,6 +_,7 @@ private void checkCollision() { HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); @@ -19,7 +19,7 @@ this.hitTargetOrDeflectSelf(hitResult); } -@@ -447,6 +_,7 @@ +@@ -448,6 +_,7 @@ Player owner = this.getPlayerOwner(); if (!this.level().isClientSide() && owner != null && !this.shouldStopFishing(owner)) { int dmg = 0; @@ -27,7 +27,7 @@ if (this.hookedIn != null) { this.pullEntity(this.hookedIn); CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)owner, rod, this, Collections.emptyList()); -@@ -457,10 +_,16 @@ +@@ -458,10 +_,16 @@ .withParameter(LootContextParams.ORIGIN, this.position()) .withParameter(LootContextParams.TOOL, rod) .withParameter(LootContextParams.THIS_ENTITY, this) @@ -44,7 +44,7 @@ CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)owner, rod, this, items); for (ItemStack itemStack : items) { -@@ -486,7 +_,7 @@ +@@ -487,7 +_,7 @@ } this.discard(); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch index a3df8f40cc..12dfb84f1e 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/net/minecraft/world/entity/projectile/LlamaSpit.java -@@ -43,7 +_,8 @@ +@@ -44,7 +_,8 @@ super.tick(); Vec3 movement = this.getDeltaMovement(); HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index 2f3eb5757b..60354ed24f 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java -@@ -217,7 +_,7 @@ +@@ -218,7 +_,7 @@ this.handlePortal(); } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch index 14cc9a55d8..bfe8e60770 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java -@@ -78,6 +_,7 @@ +@@ -79,6 +_,7 @@ private @Nullable List piercedAndKilledEntities; private ItemStack pickupItemStack = this.getDefaultPickupItem(); private @Nullable ItemStack firedFromWeapon = null; @@ -8,7 +8,7 @@ protected AbstractArrow(final EntityType type, final Level level) { super(type, level); -@@ -195,7 +_,7 @@ +@@ -196,7 +_,7 @@ this.shakeTime--; } @@ -17,9 +17,9 @@ this.clearFire(); } -@@ -595,7 +_,7 @@ +@@ -601,7 +_,7 @@ protected boolean canHitEntity(final Entity entity) { - return entity instanceof Player && this.getOwner() instanceof Player player && !player.canHarmPlayer((Player)entity) + return entity instanceof Player playerEntity && this.getOwner() instanceof Player player && !player.canHarmPlayer(playerEntity) ? false - : super.canHitEntity(entity) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(entity.getId())); + : super.canHitEntity(entity) && (this.piercingIgnoreEntityIds == null || !this.piercingIgnoreEntityIds.contains(entity.getId())) && !this.ignoredEntities.contains(entity.getId()); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch index 8570580e42..22cf159ffe 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java -@@ -31,7 +_,7 @@ +@@ -32,7 +_,7 @@ protected void onHit(final HitResult hitResult) { super.onHit(hitResult); if (this.level() instanceof ServerLevel serverLevel) { diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch index 28fb9346af..35452cb788 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java -@@ -51,7 +_,7 @@ +@@ -52,7 +_,7 @@ super.onHitBlock(hitResult); if (this.level() instanceof ServerLevel serverLevel) { Entity owner = this.getOwner(); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch index 2daf337cb4..d9ef30e129 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java +++ b/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java -@@ -51,7 +_,7 @@ +@@ -52,7 +_,7 @@ public float getBlockExplosionResistance( final Explosion explosion, final BlockGetter level, final BlockPos pos, final BlockState block, final FluidState fluid, final float resistance ) { diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch index 1ed3a715c1..7cc436e850 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java -@@ -102,6 +_,13 @@ +@@ -104,6 +_,13 @@ Vec3 teleportPos = this.oldPosition(); if (owner instanceof ServerPlayer player) { if (player.connection.isAcceptingMessages()) { @@ -11,10 +11,10 @@ + } + teleportPos = event.getTarget(); + - if (this.random.nextFloat() < 0.05F && level.isSpawningMonsters()) { - Endermite endermite = EntityType.ENDERMITE.create(level, EntitySpawnReason.TRIGGERED); + if (this.random.nextFloat() < 0.05F && level.isSpawningMonsters() && level.getLevelData().getDifficulty() != Difficulty.PEACEFUL) { + Endermite endermite = EntityTypes.ENDERMITE.create(level, EntitySpawnReason.TRIGGERED); if (endermite != null) { -@@ -122,7 +_,7 @@ +@@ -124,7 +_,7 @@ if (newOwner != null) { newOwner.resetFallDistance(); newOwner.resetCurrentImpulseContext(); diff --git a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch index d8b8991cb5..650d7048c3 100644 --- a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -829,7 +_,7 @@ +@@ -830,7 +_,7 @@ } } -- public static enum RaiderType { -+ public static enum RaiderType implements net.minecraftforge.common.IExtensibleEnum { - VINDICATOR(EntityType.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), - EVOKER(EntityType.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), - PILLAGER(EntityType.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), -@@ -843,6 +_,20 @@ - private RaiderType(final EntityType entityType, final int[] spawnsPerWaveBeforeBonus) { +- public enum RaiderType { ++ public enum RaiderType implements net.minecraftforge.common.IExtensibleEnum { + VINDICATOR(EntityTypes.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), + EVOKER(EntityTypes.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), + PILLAGER(EntityTypes.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), +@@ -844,6 +_,20 @@ + RaiderType(final EntityType entityType, final int[] spawnsPerWaveBeforeBonus) { this.entityType = entityType; this.spawnsPerWaveBeforeBonus = spawnsPerWaveBeforeBonus; + } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch index 543677c903..c9931d4fad 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -101,6 +_,9 @@ +@@ -100,6 +_,9 @@ this.setContainerLootTable(null); LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch index 787936290d..b0daa4861e 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch @@ -34,7 +34,7 @@ - if (fluidState.is(FluidTags.WATER)) { + if (this.canBoatInFluid(fluidState)) { float height = y + fluidState.getHeight(this.level(), pos); - this.waterLevel = Math.max((double)height, this.waterLevel); + this.waterLevel = Math.max(height, this.waterLevel); inWater |= bb.minY < height; @@ -516,7 +_,7 @@ for (int z = z0; z < z1; z++) { @@ -45,7 +45,7 @@ if (!fluidState.isSource()) { return AbstractBoat.Status.UNDER_FLOWING_WATER; } -@@ -722,7 +_,7 @@ +@@ -725,7 +_,7 @@ if (!this.isPassenger()) { if (onGround) { this.resetFallDistance(); @@ -54,7 +54,7 @@ this.fallDistance -= (float)ya; } } -@@ -746,7 +_,7 @@ +@@ -749,7 +_,7 @@ @Override protected boolean canAddPassenger(final Entity passenger) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch index e20144b8d2..a6ea0ec349 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch @@ -36,7 +36,7 @@ } @Override -@@ -367,16 +_,24 @@ +@@ -367,22 +_,31 @@ } protected void comeOffTrack(final ServerLevel level) { @@ -58,12 +58,19 @@ + this.move(MoverType.SELF, this.getDeltaMovement()); if (!this.onGround()) { -- this.setDeltaMovement(this.getDeltaMovement().scale(0.95)); -+ this.setDeltaMovement(this.getDeltaMovement().scale(getDragAir())); + this.setDeltaMovement(this.getDeltaMovement().scale(this.getAirDrag())); } } -@@ -433,7 +_,7 @@ ++ private float airDrag = DEFAULT_AIR_DRAG; + @Override + protected float getAirDrag() { +- return 0.95F; ++ return airDrag; + } + + protected double makeStepAlongTrack(final BlockPos pos, final RailShape shape, final double movementLeft) { +@@ -438,7 +_,7 @@ public Vec3 getRedstoneDirection(final BlockPos pos) { BlockState state = this.level().getBlockState(pos); if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) { @@ -72,7 +79,7 @@ if (shape == RailShape.EAST_WEST) { if (this.isRedstoneConductor(pos.west())) { return new Vec3(1.0, 0.0, 0.0); -@@ -604,5 +_,42 @@ +@@ -609,5 +_,40 @@ public boolean isFurnace() { return false; @@ -96,9 +103,7 @@ + private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL; + @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; } + @Override public void setMaxSpeedAirVertical(float value) { maxSpeedAirVertical = value; } -+ private double dragAir = DEFAULT_AIR_DRAG; -+ @Override public double getDragAir() { return dragAir; } -+ @Override public void setDragAir(double value) { dragAir = value; } ++ @Override public void setAirDrag(float value) { airDrag = value; } + @Override + public double getMaxSpeedWithRail() { //Non-default because getMaximumSpeed is protected + if (!canUseRail()) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch index be62403c6c..20536dbc0b 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java +++ b/net/minecraft/world/entity/vehicle/minecart/MinecartCommandBlock.java -@@ -88,6 +_,8 @@ +@@ -87,6 +_,8 @@ @Override public InteractionResult interact(final Player player, final InteractionHand hand, final Vec3 location) { @@ -8,4 +8,4 @@ + if (ret.consumesAction()) return ret; if (!player.canUseGameMasterBlocks()) { return InteractionResult.PASS; - } else { + } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch index a1dd91697f..ecdf77384e 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java +++ b/net/minecraft/world/entity/vehicle/minecart/MinecartSpawner.java -@@ -24,6 +_,11 @@ +@@ -19,6 +_,11 @@ public void broadcastEvent(final Level level, final BlockPos pos, final int id) { level.broadcastEntityEvent(MinecartSpawner.this, (byte)id); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch index e9461c28f4..e0b8e71275 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java.patch @@ -9,7 +9,7 @@ Pair exits = AbstractMinecart.exits(shape); Vec3 exit0 = new Vec3(exits.getFirst()).scale(0.5); Vec3 exit1 = new Vec3(exits.getSecond()).scale(0.5); -@@ -244,12 +_,12 @@ +@@ -246,12 +_,12 @@ if (onRails) { this.minecart.resetFallDistance(); this.minecart.setOldPosAndRot(); @@ -24,7 +24,7 @@ Vec3 newDeltaMovement = this.calculateTrackSpeed(level, initialStepDeltaMovement.horizontal(), trackIteration, currentPos, currentState, shape); if (trackIteration.firstIteration) { trackIteration.movementLeft = newDeltaMovement.horizontalDistance(); -@@ -384,7 +_,7 @@ +@@ -386,7 +_,7 @@ } private Vec3 calculateHaltTrackSpeed(final Vec3 deltaMovement, final BlockState state) { @@ -33,7 +33,7 @@ return deltaMovement.length() < 0.03 ? Vec3.ZERO : deltaMovement.scale(0.5); } else { return deltaMovement; -@@ -392,7 +_,7 @@ +@@ -394,7 +_,7 @@ } private Vec3 calculateBoostTrackSpeed(final Vec3 deltaMovement, final BlockPos pos, final BlockState state) { @@ -41,13 +41,13 @@ + if (state.getBlock() instanceof PoweredRailBlock powered && !powered.isActivatorRail() && state.getValue(PoweredRailBlock.POWERED)) { if (deltaMovement.length() > 0.01) { return deltaMovement.normalize().scale(deltaMovement.length() + 0.06); - } else { -@@ -444,7 +_,7 @@ - BlockState newBlockState = this.level().getBlockState(BlockPos.containing(newPosition)); - if (inHill) { - if (BaseRailBlock.isRail(newBlockState)) { -- RailShape newRailShape = newBlockState.getValue(((BaseRailBlock)newBlockState.getBlock()).getShapeProperty()); -+ RailShape newRailShape = ((BaseRailBlock)newBlockState.getBlock()).getRailDirection(newBlockState, this.level(), BlockPos.containing(newPosition), this.minecart); - if (this.restAtVShape(shape, newRailShape)) { - return 0.0; - } + } +@@ -448,7 +_,7 @@ + BlockState newBlockState = this.level().getBlockState(BlockPos.containing(newPosition)); + if (inHill) { + if (BaseRailBlock.isRail(newBlockState)) { +- RailShape newRailShape = newBlockState.getValue(((BaseRailBlock)newBlockState.getBlock()).getShapeProperty()); ++ RailShape newRailShape = ((BaseRailBlock)newBlockState.getBlock()).getRailDirection(newBlockState, this.level(), BlockPos.containing(newPosition), this.minecart); + if (this.restAtVShape(shape, newRailShape)) { + return 0.0; + } diff --git a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index e39a21a12f..b7e2243a9e 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -436,6 +_,7 @@ +@@ -435,6 +_,7 @@ ItemStack carried = this.getCarried(); - player.updateTutorialInventoryAction(carried, slotx.getItem(), clickAction); - if (!this.tryItemClickBehaviourOverride(player, clickAction, slotx, clicked, carried)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.onItemStackedOn(carried, clicked, slotx, clickAction, player, createCarriedSlotAccess())) + player.updateTutorialInventoryAction(carried, slot.getItem(), clickAction); + if (!this.tryItemClickBehaviourOverride(player, clickAction, slot, clicked, carried)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onItemStackedOn(carried, clicked, slot, clickAction, player, createCarriedSlotAccess())) if (clicked.isEmpty()) { if (!carried.isEmpty()) { int amount = clickAction == ClickAction.PRIMARY ? carried.getCount() : 1; -@@ -654,7 +_,7 @@ +@@ -648,7 +_,7 @@ ItemStack target = slot.getItem(); if (!target.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, target)) { int totalStack = target.getCount() + itemStack.getCount(); diff --git a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch index 25cc4af7a3..ea2a685a9a 100644 --- a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/BeaconMenu.java +++ b/net/minecraft/world/inventory/BeaconMenu.java -@@ -92,10 +_,8 @@ +@@ -88,10 +_,8 @@ } slot.onQuickCraft(stack, clicked); diff --git a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch index 3b654fc18d..2f1523645e 100644 --- a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -74,7 +_,7 @@ - +@@ -61,7 +_,7 @@ + this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { @Override public boolean mayPlace(final ItemStack itemStack) { - return itemStack.is(Items.LAPIS_LAZULI); @@ -9,7 +9,7 @@ } @Override -@@ -102,23 +_,24 @@ +@@ -89,23 +_,24 @@ if (!itemStack.isEmpty() && itemStack.isEnchantable()) { this.access.execute((level, pos) -> { IdMap> holders = level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).asHolderIdMap(); @@ -37,7 +37,7 @@ } for (int ix = 0; ix < 3; ix++) { -@@ -245,7 +_,7 @@ +@@ -234,7 +_,7 @@ if (!this.moveItemStackTo(stack, 2, 38, true)) { return ItemStack.EMPTY; } diff --git a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch index a5cf3b5bda..ad4727baae 100644 --- a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/net/minecraft/world/inventory/GrindstoneMenu.java -@@ -42,6 +_,7 @@ +@@ -37,6 +_,7 @@ } }; private final ContainerLevelAccess access; @@ -8,8 +8,8 @@ public GrindstoneMenu(final int containerId, final Inventory inventory) { this(containerId, inventory, ContainerLevelAccess.NULL); -@@ -57,7 +_,7 @@ - +@@ -48,13 +_,13 @@ + this.addSlot(new Slot(this.repairSlots, 0, 49, 19) { @Override public boolean mayPlace(final ItemStack itemStack) { - return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack); @@ -17,8 +17,6 @@ } }); this.addSlot(new Slot(this.repairSlots, 1, 49, 40) { -@@ -67,7 +_,7 @@ - @Override public boolean mayPlace(final ItemStack itemStack) { - return itemStack.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(itemStack); @@ -26,15 +24,15 @@ } }); this.addSlot(new Slot(this.resultSlots, 2, 129, 34) { -@@ -82,6 +_,7 @@ +@@ -65,6 +_,7 @@ @Override public void onTake(final Player player, final ItemStack carried) { + if (net.minecraftforge.common.ForgeHooks.onGrindstoneTake(GrindstoneMenu.this.repairSlots, access, this::getExperienceAmount)) return; access.execute((level, pos) -> { - if (level instanceof ServerLevel) { - ExperienceOrb.award((ServerLevel)level, Vec3.atCenterOf(pos), this.getExperienceAmount(level)); -@@ -94,6 +_,7 @@ + if (level instanceof ServerLevel serverLevel) { + ExperienceOrb.award(serverLevel, Vec3.atCenterOf(pos), this.getExperienceAmount(level)); +@@ -77,6 +_,7 @@ } private int getExperienceAmount(final Level level) { @@ -42,7 +40,7 @@ int amount = 0; amount += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0)); amount += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1)); -@@ -137,6 +_,17 @@ +@@ -120,6 +_,17 @@ } private ItemStack computeResult(final ItemStack input, final ItemStack additional) { diff --git a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch index d2b1863b6f..05358614f9 100644 --- a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/ResultSlot.java +++ b/net/minecraft/world/inventory/ResultSlot.java -@@ -50,6 +_,7 @@ +@@ -57,6 +_,7 @@ protected void checkTakeAchievements(final ItemStack carried) { if (this.removeCount > 0) { carried.onCraftedBy(this.player, this.removeCount); @@ -8,7 +8,7 @@ } if (this.container instanceof RecipeCraftingHolder recipeCraftingHolder) { -@@ -85,7 +_,9 @@ +@@ -92,7 +_,9 @@ CraftingInput input = positionedRecipe.input(); int recipeLeft = positionedRecipe.left(); int recipeTop = positionedRecipe.top(); diff --git a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch index ecdf530966..1ea69e510c 100644 --- a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch @@ -9,7 +9,7 @@ } public ItemStack remove(final int amount) { -@@ -160,5 +_,36 @@ +@@ -167,5 +_,36 @@ public boolean isFake() { return false; diff --git a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch index 9172e67b60..08f09afa2a 100644 --- a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java -@@ -64,7 +_,7 @@ - if (playerHasBlockingItemUseIntent(context)) { +@@ -65,7 +_,7 @@ return InteractionResult.PASS; - } else { -- Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos)); -+ Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos), context); - if (newBlock.isEmpty()) { - return InteractionResult.PASS; - } else { + } + +- Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos)); ++ Optional newBlock = this.evaluateNewBlockState(level, pos, player, level.getBlockState(pos), context); + if (newBlock.isEmpty()) { + return InteractionResult.PASS; + } @@ -92,17 +_,24 @@ } diff --git a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch index 0fc126de93..8a01695623 100644 --- a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch @@ -1,19 +1,16 @@ --- a/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java -@@ -76,9 +_,9 @@ - } - } - -- SoundType soundType = placedState.getSoundType(); -+ SoundType soundType = placedState.getSoundType(level, pos, placeContext.getPlayer()); - level.playSound( -- player, pos, this.getPlaceSound(placedState), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F -+ player, pos, this.getPlaceSound(placedState, level, pos, placeContext.getPlayer()), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F - ); - level.gameEvent(GameEvent.BLOCK_PLACE, pos, GameEvent.Context.of(player, placedState)); - itemStack.consume(1, player); -@@ -88,10 +_,16 @@ +@@ -83,17 +_,23 @@ + } } + +- SoundType soundType = placedState.getSoundType(); +- level.playSound(player, pos, this.getPlaceSound(placedState), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); ++ SoundType soundType = placedState.getSoundType(level, pos, placeContext.getPlayer()); ++ level.playSound(player, pos, this.getPlaceSound(placedState, level, pos, placeContext.getPlayer()), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); + level.gameEvent(GameEvent.BLOCK_PLACE, pos, GameEvent.Context.of(player, placedState)); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } + @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) } @@ -29,7 +26,7 @@ public @Nullable BlockPlaceContext updatePlacementContext(final BlockPlaceContext context) { return context; } -@@ -186,6 +_,10 @@ +@@ -188,6 +_,10 @@ public void registerBlocks(final Map map, final Item item) { map.put(this.getBlock(), item); diff --git a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch index 656b388bae..f6bccac981 100644 --- a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch @@ -26,5 +26,5 @@ + int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, level, pos, state, itemStack); + if (hook != 0) return hook > 0; if (state.getBlock() instanceof BonemealableBlock block && block.isValidBonemealTarget(level, pos, state)) { - if (level instanceof ServerLevel) { + if (level instanceof ServerLevel serverLevel) { if (block.isBonemealSuccess(level, level.getRandom(), pos, state)) { diff --git a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch index 49c793e511..4e7b7d26fd 100644 --- a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java -@@ -32,6 +_,9 @@ - return false; - } else { - int timeHeld = this.getUseDuration(itemStack, entity) - remainingTime; -+ timeHeld = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(itemStack, level, player, timeHeld, true); -+ if (timeHeld < 0) return false; +@@ -31,6 +_,9 @@ + } + + int timeHeld = this.getUseDuration(itemStack, entity) - remainingTime; ++ timeHeld = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(itemStack, level, player, timeHeld, true); ++ if (timeHeld < 0) return false; + - float pow = getPowerForTime(timeHeld); - if (pow < 0.1) { - return false; + float pow = getPowerForTime(timeHeld); + if (pow < 0.1) { + return false; @@ -95,6 +_,8 @@ public InteractionResult use(final Level level, final Player player, final InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); @@ -18,4 +18,4 @@ + if (ret != null) return ret; if (!player.hasInfiniteMaterials() && !foundProjectile) { return InteractionResult.FAIL; - } else { + } diff --git a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch index 6da9bf480f..b90ffe3574 100644 --- a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch @@ -1,8 +1,11 @@ --- a/net/minecraft/world/item/BucketItem.java +++ b/net/minecraft/world/item/BucketItem.java -@@ -34,15 +_,29 @@ +@@ -32,17 +_,31 @@ + import org.jspecify.annotations.Nullable; + public class BucketItem extends Item implements DispensibleContainerItem { - private final Fluid content; +- protected final Fluid content; ++ private final Fluid content; // Needs to be private for ASM transformer + // Forge: Use the other constructor that takes a Supplier + @Deprecated @@ -24,33 +27,33 @@ @Override public InteractionResult use(final Level level, final Player player, final InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); - BlockHitResult hitResult = getPlayerPOVHitResult(level, player, this.content == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); + BlockHitResult hitResult = getPlayerPOVHitResult(level, player, this.getFluidContext()); + var ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, level, itemStack, hitResult); + if (ret != null) return ret; if (hitResult.getType() == HitResult.Type.MISS) { return InteractionResult.PASS; - } else if (hitResult.getType() != HitResult.Type.BLOCK) { -@@ -59,7 +_,7 @@ - ItemStack taken = bucketPickupBlock.pickupBlock(player, level, pos, blockState); - if (!taken.isEmpty()) { - player.awardStat(Stats.ITEM_USED.get(this)); -- bucketPickupBlock.getPickupSound().ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); -+ bucketPickupBlock.getPickupSound(blockState).ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); - level.gameEvent(player, GameEvent.FLUID_PICKUP, pos); - ItemStack result = ItemUtils.createFilledResult(itemStack, player, taken); - if (!level.isClientSide()) { -@@ -73,8 +_,8 @@ - return InteractionResult.FAIL; - } else { - BlockState clicked = level.getBlockState(pos); -- BlockPos placePos = clicked.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? pos : directionOffsetPos; -- if (this.emptyContents(player, level, placePos, hitResult)) { -+ BlockPos placePos = canBlockContainFluid(level, pos, clicked) ? pos : directionOffsetPos; -+ if (this.emptyContents(player, level, placePos, hitResult, itemStack)) { - this.checkExtraContent(player, level, itemStack, placePos); - if (player instanceof ServerPlayer) { - CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer)player, placePos, itemStack); -@@ -98,8 +_,13 @@ + } +@@ -56,8 +_,8 @@ + BlockPos directionOffsetPos = pos.relative(direction); + if (level.mayInteract(player, pos) && player.mayUseItemAt(directionOffsetPos, direction, itemStack)) { + BlockState clicked = level.getBlockState(pos); +- BlockPos placePos = clicked.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? pos : directionOffsetPos; +- if (this.emptyContents(player, level, placePos, hitResult)) { ++ BlockPos placePos = canBlockContainFluid(level, pos, clicked) ? pos : directionOffsetPos; ++ if (this.emptyContents(player, level, placePos, hitResult, itemStack)) { + this.checkExtraContent(player, level, itemStack, placePos); + if (player instanceof ServerPlayer serverPlayer && this.content != Fluids.EMPTY) { + CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placePos, itemStack); +@@ -73,7 +_,7 @@ + ItemStack taken = bucketPickupBlock.pickupBlock(player, level, pos, blockState); + if (!taken.isEmpty()) { + player.awardStat(Stats.ITEM_USED.get(this)); +- bucketPickupBlock.getPickupSound().ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); ++ bucketPickupBlock.getPickupSound(blockState).ifPresent(soundEvent -> player.playSound(soundEvent, 1.0F, 1.0F)); + level.gameEvent(player, GameEvent.FLUID_PICKUP, pos); + ItemStack result = ItemUtils.createFilledResult(itemStack, player, taken); + if (!level.isClientSide()) { +@@ -104,8 +_,13 @@ public void checkExtraContent(final @Nullable LivingEntity user, final Level level, final ItemStack itemStack, final BlockPos pos) { } @@ -64,7 +67,7 @@ if (!(this.content instanceof FlowingFluid flowingFluid)) { return false; } else { -@@ -110,8 +_,12 @@ +@@ -116,8 +_,14 @@ boolean placeLiquid = mayReplace || block instanceof LiquidBlockContainer container && container.canPlaceLiquid(user, level, pos, blockState, this.content); boolean canPlaceFluidInsideBlock = blockState.isAir() || placeLiquid && (!shiftKeyDown || hitResult == null); @@ -72,22 +75,24 @@ if (!canPlaceFluidInsideBlock) { - return hitResult != null && this.emptyContents(user, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null); + return hitResult != null && this.emptyContents(user, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, containerItem); -+ } else if (containedFluidStack.isPresent() && this.content.getFluidType().isVaporizedOnPlacement(level, pos, containedFluidStack.get())) { ++ } ++ ++ if (containedFluidStack.isPresent() && this.content.getFluidType().isVaporizedOnPlacement(level, pos, containedFluidStack.get())) { + this.content.getFluidType().onVaporize(user, level, pos, containedFluidStack.get()); + return true; - } else if (level.environmentAttributes().getValue(EnvironmentAttributes.WATER_EVAPORATES, pos) && this.content.is(FluidTags.WATER)) { - int x = pos.getX(); - int y = pos.getY(); -@@ -124,7 +_,7 @@ + } + + if (level.environmentAttributes().getValue(EnvironmentAttributes.WATER_EVAPORATES, pos) && this.content.is(FluidTags.WATER)) { +@@ -132,7 +_,7 @@ } return true; -- } else if (block instanceof LiquidBlockContainer containerx && this.content == Fluids.WATER) { -+ } else if (block instanceof LiquidBlockContainer containerx && containerx.canPlaceLiquid(user, level, pos, blockState, content) && this.content == Fluids.WATER) { - containerx.placeLiquid(level, pos, blockState, flowingFluid.getSource(false)); +- } else if (block instanceof LiquidBlockContainer container && this.content == Fluids.WATER) { ++ } else if (block instanceof LiquidBlockContainer container && container.canPlaceLiquid(user, level, pos, blockState, content) && this.content == Fluids.WATER) { + container.placeLiquid(level, pos, blockState, flowingFluid.getSource(false)); this.playEmptySound(user, level, pos); return true; -@@ -145,8 +_,33 @@ +@@ -153,8 +_,33 @@ protected void playEmptySound(final @Nullable LivingEntity user, final LevelAccessor level, final BlockPos pos) { SoundEvent soundEvent = this.content.is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY; diff --git a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch index 6e9ea0beb1..428c06f7a2 100644 --- a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch @@ -108,7 +108,7 @@ return this; } -@@ -175,11 +_,80 @@ +@@ -175,12 +_,81 @@ return this; } @@ -184,9 +184,10 @@ public CreativeModeTab build() { if ((this.type == CreativeModeTab.Type.HOTBAR || this.type == CreativeModeTab.Type.INVENTORY) && this.displayItemsGenerator != EMPTY_GENERATOR) { throw new IllegalStateException("Special tabs can't have display items"); - } else { -- CreativeModeTab tab = new CreativeModeTab(this.row, this.column, this.type, this.displayName, this.iconGenerator, this.displayItemsGenerator); -+ CreativeModeTab tab = this.tabFactory.apply(this); - tab.alignedRight = this.alignedRight; - tab.showTitle = this.showTitle; - tab.canScroll = this.canScroll; + } + +- CreativeModeTab tab = new CreativeModeTab(this.row, this.column, this.type, this.displayName, this.iconGenerator, this.displayItemsGenerator); ++ CreativeModeTab tab = this.tabFactory.apply(this); + tab.alignedRight = this.alignedRight; + tab.showTitle = this.showTitle; + tab.canScroll = this.canScroll; diff --git a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch index f1376f5fd9..b7f6c100bf 100644 --- a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java -@@ -59,6 +_,8 @@ +@@ -60,6 +_,8 @@ private final int textureDiffuseColor; private final int fireworkColor; private final int textColor; + private final net.minecraft.tags.TagKey dyesTag; + private final net.minecraft.tags.TagKey dyedTag; - private DyeColor(final int id, final String name, final int textureDiffuseColor, final MapColor mapColor, final int fireworkColor, final int textColor) { - this.id = id; -@@ -67,6 +_,8 @@ + DyeColor( + final int id, +@@ -77,6 +_,8 @@ this.textColor = ARGB.opaque(textColor); this.textureDiffuseColor = ARGB.opaque(textureDiffuseColor); this.fireworkColor = fireworkColor; @@ -18,7 +18,7 @@ } public int getId() { -@@ -115,6 +_,27 @@ +@@ -129,6 +_,27 @@ @Override public String getSerializedName() { return this.name; diff --git a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch index db5e52a847..590f71809b 100644 --- a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch @@ -22,7 +22,7 @@ + Pair, Consumer> logicPair = toolModifiedState == null ? null : Pair.of(ctx -> true, changeIntoState(toolModifiedState)); if (logicPair == null) { return InteractionResult.PASS; - } else { + } @@ -84,5 +_,10 @@ public static boolean onlyIfAirAbove(final UseOnContext context) { diff --git a/patches/minecraft/net/minecraft/world/item/Item.java.patch b/patches/minecraft/net/minecraft/world/item/Item.java.patch index 234e298456..6643c1cfdd 100644 --- a/patches/minecraft/net/minecraft/world/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -95,7 +_,7 @@ +@@ -96,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,7 +9,7 @@ public static final Codec> CODEC = BuiltInRegistries.ITEM .holderByNameCodec() .validate(item -> item.is(Items.AIR.builtInRegistryHolder()) ? DataResult.error(() -> "Item must not be minecraft:air") : DataResult.success(item)); -@@ -106,7 +_,7 @@ +@@ -107,7 +_,7 @@ : DataResult.success(item) ); private static final Logger LOGGER = LogUtils.getLogger(); @@ -18,7 +18,7 @@ public static final Identifier BASE_ATTACK_DAMAGE_ID = Identifier.withDefaultNamespace("base_attack_damage"); public static final Identifier BASE_ATTACK_SPEED_ID = Identifier.withDefaultNamespace("base_attack_speed"); public static final int DEFAULT_MAX_STACK_SIZE = 64; -@@ -145,6 +_,7 @@ +@@ -146,6 +_,7 @@ LOGGER.error("Item classes should end with Item and {} doesn't.", className); } } @@ -26,7 +26,7 @@ } @Deprecated -@@ -152,8 +_,15 @@ +@@ -153,8 +_,15 @@ return this.builtInRegistryHolder; } @@ -43,7 +43,7 @@ } public int getDefaultMaxStackSize() { -@@ -163,6 +_,7 @@ +@@ -164,6 +_,7 @@ public void onUseTick(final Level level, final LivingEntity livingEntity, final ItemStack itemStack, final int ticksRemaining) { } @@ -51,7 +51,7 @@ public void onDestroyed(final ItemEntity itemEntity) { } -@@ -281,6 +_,8 @@ +@@ -282,6 +_,8 @@ return BuiltInRegistries.ITEM.wrapAsHolder(this).getRegisteredName(); } @@ -60,7 +60,7 @@ public final @Nullable ItemStackTemplate getCraftingRemainder() { return this.craftingRemainingItem; } -@@ -373,6 +_,30 @@ +@@ -374,6 +_,30 @@ return false; } @@ -91,7 +91,7 @@ public static class Properties { private static final DependantName BLOCK_DESCRIPTION_ID = id -> Util.makeDescriptionId("block", id.identifier()); private static final DependantName ITEM_DESCRIPTION_ID = id -> Util.makeDescriptionId("item", id.identifier()); -@@ -721,6 +_,11 @@ +@@ -722,6 +_,11 @@ boolean isPeaceful(); @@ -103,7 +103,7 @@ static Item.TooltipContext of(final @Nullable Level level) { return level == null ? EMPTY : new Item.TooltipContext() { @Override -@@ -741,6 +_,11 @@ +@@ -742,6 +_,11 @@ @Override public boolean isPeaceful() { return level.getDifficulty() == Difficulty.PEACEFUL; diff --git a/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch b/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch index 08d4cfa626..1edea0db85 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemDisplayContext.java.patch @@ -20,7 +20,7 @@ private byte id; private final String name; - private ItemDisplayContext(final int id, final String name) { + ItemDisplayContext(final int id, final String name) { this.name = name; this.id = (byte)id; + this.isModded = false; diff --git a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch index b787f90009..069037c8ac 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -100,7 +_,7 @@ +@@ -99,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,7 +9,7 @@ private static final List OP_NBT_WARNING = List.of( Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD), Component.translatable("item.op_warning.line2").withStyle(ChatFormatting.RED), -@@ -258,12 +_,15 @@ +@@ -257,12 +_,15 @@ } private ItemStack(final Holder item, final int count, final PatchedDataComponentMap components) { @@ -25,7 +25,7 @@ this.item = null; this.components = new PatchedDataComponentMap(DataComponentMap.EMPTY); } -@@ -356,13 +_,22 @@ +@@ -355,6 +_,15 @@ } public InteractionResult useOn(final UseOnContext context) { @@ -41,15 +41,16 @@ Player player = context.getPlayer(); BlockPos pos = context.getClickedPos(); if (player != null && !player.getAbilities().mayBuild && !this.canPlaceOnBlockInAdventureMode(new BlockInWorld(context.getLevel(), pos, false))) { - return InteractionResult.PASS; - } else { - Item usedItem = this.getItem(); -- InteractionResult result = usedItem.useOn(context); -+ InteractionResult result = callback.apply(context); - if (player != null && result instanceof InteractionResult.Success success && success.wasItemInteraction()) { - player.awardStat(Stats.ITEM_USED.get(usedItem)); - } -@@ -443,18 +_,26 @@ +@@ -362,7 +_,7 @@ + } + + Item usedItem = this.getItem(); +- InteractionResult result = usedItem.useOn(context); ++ InteractionResult result = callback.apply(context); + if (player != null && result instanceof InteractionResult.Success success && success.wasItemInteraction()) { + player.awardStat(Stats.ITEM_USED.get(usedItem)); + } +@@ -442,18 +_,26 @@ } public void hurtAndBreak(final int amount, final ServerLevel level, final @Nullable ServerPlayer player, final Consumer onBreak) { @@ -77,7 +78,7 @@ return amount > 0 ? EnchantmentHelper.processDurabilityChange(level, this, amount) : amount; } } -@@ -491,7 +_,13 @@ +@@ -490,7 +_,13 @@ public void hurtAndBreak(final int amount, final LivingEntity owner, final EquipmentSlot slot) { if (owner.level() instanceof ServerLevel serverLevel) { this.hurtAndBreak( @@ -92,7 +93,7 @@ ); } } -@@ -850,6 +_,7 @@ +@@ -857,6 +_,7 @@ List lines = Lists.newArrayList(); lines.add(this.getStyledHoverName()); this.addDetailsToTooltip(context, display, player, tooltipFlag, lines::add); @@ -100,7 +101,7 @@ return lines; } } -@@ -1097,6 +_,7 @@ +@@ -1105,6 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/world/item/Items.java.patch b/patches/minecraft/net/minecraft/world/item/Items.java.patch index de2393b1e7..3e3e617bf7 100644 --- a/patches/minecraft/net/minecraft/world/item/Items.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Items.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -2358,7 +_,25 @@ +@@ -2099,7 +_,25 @@ } - private static Item registerBlock(final Block block, final Block... alternatives) { -- Item item = registerBlock(block); -+ Item item = registerBlock(block, (block_, prop_) -> { + private static Item registerBlock(final BlockItemId id, final Block block, final Block... alternatives) { +- Item item = registerBlock(id, block); ++ Item item = registerBlock(id, block, (block_, prop_) -> { + return new BlockItem(block_, prop_) { + @Override + public void registerBlocks(java.util.Map map, Item self) { @@ -27,14 +27,14 @@ for (Block alternative : alternatives) { Item.BY_BLOCK.put(alternative, item); -@@ -2401,10 +_,6 @@ +@@ -2140,10 +_,6 @@ - private static Item registerItem(final ResourceKey key, final Function itemFactory, final Item.Properties properties) { - Item item = itemFactory.apply(properties.setId(key)); + private static Item registerItem(final ResourceKey id, final Function itemFactory, final Item.Properties properties) { + Item item = itemFactory.apply(properties.setId(id)); - if (item instanceof BlockItem blockItem) { - blockItem.registerBlocks(Item.BY_BLOCK, item); - } - - return Registry.register(BuiltInRegistries.ITEM, key, item); + return Registry.register(BuiltInRegistries.ITEM, id, item); } } diff --git a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch index f414a50d6f..3201c6da54 100644 --- a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/MobBucketItem.java +++ b/net/minecraft/world/item/MobBucketItem.java -@@ -18,13 +_,18 @@ +@@ -21,13 +_,18 @@ import org.jspecify.annotations.Nullable; public class MobBucketItem extends BucketItem { @@ -24,7 +24,7 @@ } @Override -@@ -37,11 +_,11 @@ +@@ -40,11 +_,11 @@ @Override protected void playEmptySound(final @Nullable LivingEntity user, final LevelAccessor level, final BlockPos pos) { @@ -38,17 +38,22 @@ if (mob instanceof Bucketable bucketable) { CustomData entityData = itemStack.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); bucketable.loadFromBucketTag(entityData.copyTag()); -@@ -52,5 +_,13 @@ - level.addFreshEntityWithPassengers(mob); - mob.playAmbientSound(); +@@ -57,9 +_,17 @@ } -+ } -+ + } + + protected EntityType getFishType() { + return entityTypeSupplier.get(); + } + + protected SoundEvent getEmptySound() { + return emptySoundSupplier.get(); - } - } ++ } ++ + @Override + public boolean emptyContents(final @Nullable LivingEntity user, final Level level, final BlockPos pos, final @Nullable BlockHitResult hitResult) { +- if (this.content == Fluids.EMPTY) { ++ if (this.getContent() == Fluids.EMPTY) { + this.playEmptySound(user, level, pos); + return true; + } else { diff --git a/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch b/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch index e281479691..cc2c0b2383 100644 --- a/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ProjectileWeaponItem.java.patch @@ -3,27 +3,27 @@ @@ -95,6 +_,7 @@ ) { ArrowItem arrowItem = projectile.getItem() instanceof ArrowItem arrow ? arrow : (ArrowItem)Items.ARROW; - AbstractArrow arrowx = arrowItem.createArrow(level, projectile, shooter, weapon); -+ arrowx = customArrow(arrowx); + AbstractArrow arrow = arrowItem.createArrow(level, projectile, shooter, weapon); ++ arrow = customArrow(arrow); if (isCrit) { - arrowx.setCritArrow(true); + arrow.setCritArrow(true); } -@@ -111,9 +_,10 @@ - : 1; - List drawn = new ArrayList<>(numProjectiles); - ItemStack projectileCopy = projectile.copy(); -+ boolean infinite = projectile.getItem() instanceof ArrowItem arrow && arrow.isInfinite(projectile, weapon, shooter); +@@ -110,9 +_,10 @@ + int numProjectiles = shooter.level() instanceof ServerLevel serverLevel ? EnchantmentHelper.processProjectileCount(serverLevel, weapon, shooter, 1) : 1; + List drawn = new ArrayList<>(numProjectiles); + ItemStack projectileCopy = projectile.copy(); ++ boolean infinite = projectile.getItem() instanceof ArrowItem arrow && arrow.isInfinite(projectile, weapon, shooter); - for (int i = 0; i < numProjectiles; i++) { -- ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0); -+ ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0 || infinite); - if (!drawnStack.isEmpty()) { - drawn.add(drawnStack); - } + for (int i = 0; i < numProjectiles; i++) { +- ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0); ++ ItemStack drawnStack = useAmmo(weapon, i == 0 ? projectile : projectileCopy, shooter, i > 0 || infinite); + if (!drawnStack.isEmpty()) { + drawn.add(drawnStack); + } @@ -141,5 +_,9 @@ - - return used; } + + return used; + } + + public AbstractArrow customArrow(AbstractArrow arrow) { diff --git a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch index 800b99c334..8d0bc05084 100644 --- a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/item/ShovelItem.java +++ b/net/minecraft/world/item/ShovelItem.java -@@ -42,9 +_,9 @@ - return InteractionResult.PASS; - } else { - Player player = context.getPlayer(); -- BlockState newState = FLATTENABLES.get(blockState.getBlock()); -+ BlockState newState = blockState.getToolModifiedState(context, net.minecraftforge.common.ToolActions.SHOVEL_FLATTEN, false); - BlockState updatedState = null; -- if (newState != null && level.getBlockState(pos.above()).isAir()) { -+ if (newState != null && level.isEmptyBlock(pos.above())) { - level.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); - updatedState = newState; - } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { +@@ -43,9 +_,9 @@ + } + + Player player = context.getPlayer(); +- BlockState newState = FLATTENABLES.get(blockState.getBlock()); ++ BlockState newState = blockState.getToolModifiedState(context, net.minecraftforge.common.ToolActions.SHOVEL_FLATTEN, false); + BlockState updatedState = null; +- if (newState != null && level.getBlockState(pos.above()).isAir()) { ++ if (newState != null && level.isEmptyBlock(pos.above())) { + level.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); + updatedState = newState; + } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { @@ -70,5 +_,15 @@ - return InteractionResult.PASS; - } + } else { + return InteractionResult.PASS; } + } + diff --git a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch index 3a26d1fdf5..b6321fc02b 100644 --- a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch @@ -78,9 +78,9 @@ + private ItemStack mixVanilla(final ItemStack ingredient, final ItemStack source) { if (source.isEmpty()) { return source; - } else { -@@ -126,9 +_,29 @@ } +@@ -126,9 +_,29 @@ + return source; } + /** diff --git a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch index bf0d8d4359..3defabf390 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -33,7 +33,7 @@ values.unwrap().ifRight(directValues -> { if (directValues.isEmpty()) { throw new UnsupportedOperationException("Ingredients can't be empty"); -@@ -106,5 +_,50 @@ +@@ -113,5 +_,50 @@ } else { return inputDisplay; } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch index c8be94512a..96480b3066 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapedRecipePattern.java +++ b/net/minecraft/world/item/crafting/ShapedRecipePattern.java -@@ -203,18 +_,22 @@ +@@ -203,10 +_,14 @@ return this.ingredients; } @@ -14,16 +14,17 @@ - return DataResult.error(() -> "Invalid pattern: too many rows, 3 is maximum"); + if (strings.size() > ShapedRecipe.MAX_HEIGHT) { + return DataResult.error(() -> "Invalid pattern: too many rows, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); - } else if (strings.isEmpty()) { - return DataResult.error(() -> "Invalid pattern: empty pattern not allowed"); - } else { - int firstLength = strings.getFirst().length(); + } - for (String line : strings) { -- if (line.length() > 3) { -- return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); -+ if (line.length() > ShapedRecipe.MAX_HEIGHT) { -+ return DataResult.error(() -> "Invalid pattern: too many columns, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); - } + if (strings.isEmpty()) { +@@ -216,8 +_,8 @@ + int firstLength = strings.getFirst().length(); - if (firstLength != line.length()) { + for (String line : strings) { +- if (line.length() > 3) { +- return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); ++ if (line.length() > ShapedRecipe.MAX_HEIGHT) { ++ return DataResult.error(() -> "Invalid pattern: too many columns, " + ShapedRecipe.MAX_HEIGHT + " is maximum"); + } + + if (firstLength != line.length()) { diff --git a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch index a58fe4335b..29f5661043 100644 --- a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -146,15 +_,16 @@ +@@ -152,15 +_,16 @@ entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { @@ -21,7 +21,7 @@ } nextSpawnData.getEquipment().ifPresent(mob::equip); -@@ -271,5 +_,14 @@ +@@ -279,5 +_,14 @@ public double getOSpin() { return this.oSpin; diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index 3dc8493f6c..c0ee39b1c6 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -9,7 +9,7 @@ public static final Codec> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, Identifier.withDefaultNamespace("overworld")); public static final ResourceKey NETHER = ResourceKey.create(Registries.DIMENSION, Identifier.withDefaultNamespace("the_nether")); -@@ -130,6 +_,11 @@ +@@ -131,6 +_,11 @@ private final DamageSources damageSources; private final PalettedContainerFactory palettedContainerFactory; private long subTickCount; @@ -21,63 +21,60 @@ protected Level( final WritableLevelData levelData, -@@ -214,7 +_,7 @@ +@@ -219,7 +_,7 @@ } @Override -- public boolean setBlock(final BlockPos pos, final BlockState blockState, @Block.UpdateFlags final int updateFlags, final int updateLimit) { +- public boolean setBlock(final BlockPos pos, final BlockState blockState, final @Block.UpdateFlags int updateFlags, final int updateLimit) { + public boolean setBlock(BlockPos pos, final BlockState blockState, @Block.UpdateFlags final int updateFlags, final int updateLimit) { if (!this.isInValidBounds(pos)) { return false; - } else if (!this.isClientSide() && this.isDebug()) { -@@ -222,11 +_,35 @@ - } else { - LevelChunk chunk = this.getChunkAt(pos); - Block block = blockState.getBlock(); + } +@@ -230,12 +_,31 @@ + + LevelChunk chunk = this.getChunkAt(pos); + Block block = blockState.getBlock(); + -+ pos = pos.immutable(); // Forge - prevent mutable BlockPos leaks -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isClientSide) { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.dimension, this, pos, updateFlags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ - BlockState oldState = chunk.setBlockState(pos, blockState, updateFlags); - if (oldState == null) { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } else { - BlockState newState = this.getBlockState(pos); -+ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates -+ this.markAndNotifyBlock(pos, chunk, oldState, blockState, updateFlags, updateLimit); -+ } -+ -+ return true; -+ } ++ pos = pos.immutable(); // Forge - prevent mutable BlockPos leaks ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isClientSide) { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.create(this.dimension, this, pos, updateFlags); ++ this.capturedBlockSnapshots.add(blockSnapshot); + } ++ + BlockState oldState = chunk.setBlockState(pos, blockState, updateFlags); + if (oldState == null) { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + +- BlockState newState = this.getBlockState(pos); ++ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates ++ this.markAndNotifyBlock(pos, chunk, oldState, blockState, updateFlags, updateLimit); ++ } ++ ++ return true; + } + + // Split off from original setBlockState(BlockPos, BlockState, int, int) method in order to directly send client and physic updates + public void markAndNotifyBlock(final BlockPos pos, final @Nullable LevelChunk chunk, final BlockState oldState, final BlockState blockState, @Block.UpdateFlags final int updateFlags, final int updateLimit) { + Block block = blockState.getBlock(); + BlockState newState = getBlockState(pos); -+ { -+ { - if (newState == blockState) { - if (oldState != newState) { - this.setBlocksDirty(pos, oldState, newState); -@@ -253,9 +_,8 @@ - } - - this.updatePOIOnBlockStateChange(pos, oldState, newState); -+ blockState.onBlockStateChange(this, pos, oldState); - } -- -- return true; + if (newState == blockState) { + if (oldState != newState) { + this.setBlocksDirty(pos, oldState, newState); +@@ -262,9 +_,8 @@ } + + this.updatePOIOnBlockStateChange(pos, oldState, newState); ++ blockState.onBlockStateChange(this, pos, oldState); } +- +- return true; } -@@ -524,8 +_,27 @@ + + public void updatePOIOnBlockStateChange(final BlockPos pos, final BlockState oldState, final BlockState newState) { +@@ -531,8 +_,27 @@ (this.tickingBlockEntities ? this.pendingBlockEntityTickers : this.blockEntityTickers).add(ticker); } @@ -105,14 +102,14 @@ if (!this.pendingBlockEntityTickers.isEmpty()) { this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); this.pendingBlockEntityTickers.clear(); -@@ -548,12 +_,19 @@ +@@ -555,12 +_,19 @@ public void guardEntityTick(final Consumer tick, final T entity) { try { + net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(entity); tick.accept(entity); - } catch (Throwable var6) { - CrashReport report = CrashReport.forThrowable(var6, "Ticking entity"); + } catch (Throwable t) { + CrashReport report = CrashReport.forThrowable(t, "Ticking entity"); CrashReportCategory category = report.addCategory("Entity being ticked"); entity.fillCrashReportCategory(category); + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { @@ -125,7 +122,7 @@ } } -@@ -709,6 +_,7 @@ +@@ -716,6 +_,7 @@ if (this.isInValidBounds(pos)) { this.getChunkAt(pos).removeBlockEntity(pos); } @@ -133,7 +130,7 @@ } public boolean isLoaded(final BlockPos pos) { -@@ -774,8 +_,8 @@ +@@ -781,8 +_,8 @@ } }); @@ -144,7 +141,7 @@ output.add(dragonPart); } } -@@ -808,8 +_,8 @@ +@@ -815,8 +_,8 @@ } } @@ -155,7 +152,7 @@ T castSubPart = type.tryCast(subEntity); if (castSubPart != null && selector.test(castSubPart)) { output.add(castSubPart); -@@ -993,17 +_,16 @@ +@@ -1004,17 +_,16 @@ public abstract Scoreboard getScoreboard(); public void updateNeighbourForOutputSignal(final BlockPos pos, final Block changedBlock) { @@ -178,7 +175,7 @@ } } } -@@ -1088,6 +_,20 @@ +@@ -1099,6 +_,20 @@ } public abstract ClockManager clockManager(); diff --git a/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch b/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch index 9722a00e86..c06f4d8b78 100644 --- a/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/LevelSettings.java.patch @@ -29,8 +29,8 @@ + return new LevelSettings(this.levelName, gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration, this.lifecycle); } - public LevelSettings withDifficulty(final Difficulty difficulty) { -@@ -29,7 +_,8 @@ + public LevelSettings withAllowCommands(final boolean allowCommands) { +@@ -33,7 +_,8 @@ this.gameType, new LevelSettings.DifficultySettings(difficulty, this.difficultySettings.hardcore(), this.difficultySettings.locked()), this.allowCommands, @@ -40,7 +40,7 @@ ); } -@@ -39,16 +_,21 @@ +@@ -43,16 +_,21 @@ this.gameType, new LevelSettings.DifficultySettings(this.difficultySettings.difficulty(), this.difficultySettings.hardcore(), locked), this.allowCommands, diff --git a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch index 5bc9116ad7..42d63762ca 100644 --- a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch @@ -9,7 +9,7 @@ if (category != MobCategory.MISC) { BlockPos pos = entity.blockPosition(); chunkGetter.query(ChunkPos.pack(pos), chunk -> { -@@ -214,7 +_,7 @@ +@@ -211,7 +_,7 @@ groupSize++; level.addFreshEntityWithPassengers(mob); spawnCallback.run(mob, chunk); @@ -18,7 +18,7 @@ return; } -@@ -291,7 +_,7 @@ +@@ -288,7 +_,7 @@ return nearestPlayerDistanceSqr > mob.getType().getCategory().getDespawnDistance() * mob.getType().getCategory().getDespawnDistance() && mob.removeWhenFarAway(nearestPlayerDistanceSqr) ? false @@ -27,7 +27,7 @@ } private static Optional getRandomSpawnMobAt( -@@ -327,9 +_,11 @@ +@@ -324,9 +_,11 @@ final BlockPos pos, final @Nullable Holder biome ) { @@ -42,7 +42,7 @@ } public static boolean isInNetherFortressBounds( -@@ -420,8 +_,7 @@ +@@ -417,8 +_,7 @@ entity.snapTo(fx, pos.getY(), fz, random.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob @@ -52,7 +52,7 @@ groupSpawnData = mob.finalizeSpawn( level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CHUNK_GENERATION, groupSpawnData ); -@@ -530,7 +_,7 @@ +@@ -527,7 +_,7 @@ } this.spawnPotential.addCharge(pos, charge); diff --git a/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch b/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch index 4045707180..57726cd98d 100644 --- a/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch +++ b/patches/minecraft/net/minecraft/world/level/ServerExplosion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -167,7 +_,7 @@ +@@ -169,7 +_,7 @@ return new ObjectArrayList<>(toBlowSet); } @@ -9,7 +9,7 @@ if (!(this.radius < 1.0E-5F)) { float doubleRadius = this.radius * 2.0F; int x0 = Mth.floor(this.center.x - doubleRadius - 1.0); -@@ -177,7 +_,9 @@ +@@ -179,7 +_,9 @@ int z0 = Mth.floor(this.center.z - doubleRadius - 1.0); int z1 = Mth.floor(this.center.z + doubleRadius + 1.0); @@ -20,7 +20,7 @@ if (!entity.ignoreExplosion(this)) { double dist = Math.sqrt(entity.distanceToSqr(this.center)) / doubleRadius; if (!(dist > 1.0)) { -@@ -233,7 +_,7 @@ +@@ -235,7 +_,7 @@ public int explode() { this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center); List toBlow = this.calculateExplodedPositions(); diff --git a/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch index fcab7843ad..8e06992beb 100644 --- a/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch +++ b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch @@ -8,4 +8,4 @@ + return state.shouldCheckWeakPower(this, pos, direction) ? Math.max(signal, this.getDirectSignalTo(pos)) : signal; } - default boolean hasNeighborSignal(final BlockPos blockPos) { + default int getBestOwnOrNeighbourSignal(final BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch index c61d6c873e..f847507ef4 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java -@@ -36,9 +_,9 @@ +@@ -35,9 +_,9 @@ public final class Biome { public static final Codec DIRECT_CODEC = RecordCodecBuilder.create( i -> i.group( @@ -12,7 +12,7 @@ BiomeGenerationSettings.CODEC.forGetter(b -> b.generationSettings), MobSpawnSettings.CODEC.forGetter(b -> b.mobSettings) ) -@@ -66,8 +_,10 @@ +@@ -65,8 +_,10 @@ @Deprecated(forRemoval = true) public static final PerlinSimplexNoise BIOME_INFO_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(2345L)), ImmutableList.of(0)); private static final int TEMPERATURE_CACHE_SIZE = 1024; @@ -23,7 +23,7 @@ private final MobSpawnSettings mobSettings; private final EnvironmentAttributeMap attributes; private final BiomeSpecialEffects specialEffects; -@@ -84,6 +_,7 @@ +@@ -79,6 +_,7 @@ map.defaultReturnValue(Float.NaN); return map; }); @@ -31,7 +31,7 @@ private Biome( final Biome.ClimateSettings climateSettings, -@@ -97,10 +_,11 @@ +@@ -92,10 +_,11 @@ this.mobSettings = mobSettings; this.attributes = attributes; this.specialEffects = specialEffects; @@ -44,7 +44,7 @@ } public boolean hasPrecipitation() { -@@ -202,7 +_,7 @@ +@@ -197,7 +_,7 @@ } public BiomeGenerationSettings getGenerationSettings() { @@ -53,7 +53,7 @@ } public int getGrassColor(final double x, final double z) { -@@ -255,6 +_,31 @@ +@@ -250,6 +_,31 @@ public int getWaterColor() { return this.specialEffects.waterColor(); diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch index b700cd0340..5e4c8d0438 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch @@ -26,7 +26,7 @@ } } -- public static enum GrassColorModifier implements StringRepresentable { +- public enum GrassColorModifier implements StringRepresentable { + public static enum GrassColorModifier implements StringRepresentable, net.minecraftforge.common.IExtensibleEnum { NONE("none") { @Override @@ -48,7 +48,7 @@ + return delegate.modifyGrassColor(x, z, baseColor); + } - private GrassColorModifier(final String name) { + GrassColorModifier(final String name) { this.name = name; @@ -108,6 +_,30 @@ @Override diff --git a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch index 61b0203e7b..fa2f93ca8d 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/MobSpawnSettings.java +++ b/net/minecraft/world/level/biome/MobSpawnSettings.java -@@ -43,6 +_,8 @@ +@@ -44,6 +_,8 @@ private final float creatureGenerationProbability; private final Map> spawners; private final Map, MobSpawnSettings.MobSpawnCost> mobSpawnCosts; @@ -9,7 +9,7 @@ private MobSpawnSettings( final float creatureGenerationProbability, -@@ -52,6 +_,8 @@ +@@ -53,6 +_,8 @@ this.creatureGenerationProbability = creatureGenerationProbability; this.spawners = ImmutableMap.copyOf(spawners); this.mobSpawnCosts = ImmutableMap.copyOf(mobSpawnCosts); @@ -18,7 +18,7 @@ } public WeightedList getMobs(final MobCategory category) { -@@ -64,6 +_,14 @@ +@@ -65,6 +_,14 @@ public float getCreatureProbability() { return this.creatureGenerationProbability; diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch index 8ce4e29514..a3f3d83125 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -8,12 +8,12 @@ if (optionalShape.isPresent()) { optionalShape.get().createPortalBlocks(level); return; -@@ -203,7 +_,7 @@ - boolean hasObsidian = false; +@@ -204,7 +_,7 @@ + boolean hasObsidian = false; - for (Direction face : Direction.values()) { -- if (level.getBlockState(testPos.set(pos).move(face)).is(Blocks.OBSIDIAN)) { -+ if (level.getBlockState(testPos.set(pos).move(face)).isPortalFrame(level, testPos)) { - hasObsidian = true; - break; - } + for (Direction face : Direction.values()) { +- if (level.getBlockState(testPos.set(pos).move(face)).is(Blocks.OBSIDIAN)) { ++ if (level.getBlockState(testPos.set(pos).move(face)).isPortalFrame(level, testPos)) { + hasObsidian = true; + break; + } diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch index 64678f5dc7..9ccda93a2a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -18,7 +18,7 @@ if (shouldBeRemoved(pos, level, shape)) { dropResources(state, level, pos); level.removeBlock(pos, movedByPiston); -@@ -125,7 +_,7 @@ +@@ -120,7 +_,7 @@ @Override protected void affectNeighborsAfterRemoval(final BlockState state, final ServerLevel level, final BlockPos pos, final boolean movedByPiston) { if (!movedByPiston) { @@ -27,7 +27,7 @@ level.updateNeighborsAt(pos.above(), this); } -@@ -146,6 +_,11 @@ +@@ -141,6 +_,11 @@ return state.setValue(this.getShapeProperty(), isEastWest ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).setValue(WATERLOGGED, isWaterSource); } @@ -39,7 +39,7 @@ public abstract Property getShapeProperty(); protected RailShape rotate(final RailShape shape, final Rotation rotation) { -@@ -301,5 +_,15 @@ +@@ -296,5 +_,15 @@ @Override protected FluidState getFluidState(final BlockState state) { return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); diff --git a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch index a0028ac91d..887e3eeda0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -160,7 +_,7 @@ +@@ -161,7 +_,7 @@ boolean hiveEmptied = false; if (honeyLevel >= 5) { Item item = itemStack.getItem(); diff --git a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch index 5da70a8c26..c58c556221 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch @@ -15,7 +15,7 @@ private static final LoadingCache SHAPE_FULL_BLOCK_CACHE = CacheBuilder.newBuilder() .maximumSize(512L) .weakKeys() -@@ -251,6 +_,7 @@ +@@ -247,6 +_,7 @@ LOGGER.error("Block classes should end with Block and {} doesn't.", className); } } @@ -23,7 +23,7 @@ } public static boolean isExceptionForConnection(final BlockState state) { -@@ -301,7 +_,12 @@ +@@ -297,7 +_,12 @@ } } @@ -95,7 +95,7 @@ public void setPlacedBy(final Level level, final BlockPos pos, final BlockState state, final @Nullable LivingEntity by, final ItemStack itemStack) { @@ -495,6 +_,7 @@ - entity.setDeltaMovement(entity.getDeltaMovement().multiply(1.0, 0.0, 1.0)); + return this.bounceRestitution; } + /** @deprecated Forge: use {@link net.minecraftforge.common.extensions.IForgeBlockState#getFriction(LevelReader, BlockPos, Entity)}*/ diff --git a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch index 9bf6f47d87..60a67065f3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -686,7 +_,7 @@ - public static final Block RED_BED = registerBed("red_bed", DyeColor.RED); - public static final Block BLACK_BED = registerBed("black_bed", DyeColor.BLACK); +@@ -705,7 +_,7 @@ + .pushReaction(PushReaction.DESTROY) + ); public static final Block POWERED_RAIL = register( -- "powered_rail", PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) -+ "powered_rail", prop -> new PoweredRailBlock(prop, true), BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) +- BlockItemIds.POWERED_RAIL, PoweredRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) ++ BlockItemIds.POWERED_RAIL, prop -> new PoweredRailBlock(prop, true), BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) ); public static final Block DETECTOR_RAIL = register( - "detector_rail", DetectorRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) -@@ -7218,14 +_,5 @@ + BlockItemIds.DETECTOR_RAIL, DetectorRailBlock::new, BlockBehaviour.Properties.of().noCollision().strength(0.7F).sound(SoundType.METAL) +@@ -5992,14 +_,5 @@ - private static Block register(final String id, final BlockBehaviour.Properties properties) { + private static Block register(final ResourceKey id, final BlockBehaviour.Properties properties) { return register(id, Block::new, properties); - } - diff --git a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch index 1048e0a315..9f3bc3982b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -270,7 +_,7 @@ +@@ -271,7 +_,7 @@ return true; } diff --git a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch index 9e6cb3e253..52d73a8d8b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java -@@ -197,4 +_,16 @@ +@@ -198,4 +_,16 @@ protected void createBlockStateDefinition(final StateDefinition.Builder builder) { builder.add(FACING, MODE, POWERED); } diff --git a/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch index 72c4e0bb36..7f997a1db0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CrafterBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CrafterBlock.java +++ b/net/minecraft/world/level/block/CrafterBlock.java -@@ -193,12 +_,15 @@ +@@ -194,12 +_,15 @@ final RecipeHolder recipe ) { Direction direction = blockState.getValue(ORIENTATION).front(); @@ -16,7 +16,7 @@ if (!itemStack.isEmpty()) { break; } -@@ -209,10 +_,14 @@ +@@ -210,10 +_,14 @@ while (!remaining.isEmpty()) { int oldSize = remaining.getCount(); remaining = HopperBlockEntity.addItem(blockEntity, into, remaining, direction.getOpposite()); diff --git a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch index 36f3e9ceb6..1bb6cc9725 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/DiodeBlock.java +++ b/net/minecraft/world/level/block/DiodeBlock.java -@@ -178,6 +_,9 @@ +@@ -181,6 +_,9 @@ Direction direction = state.getValue(FACING); BlockPos oppositePos = pos.relative(direction.getOpposite()); Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, direction.getOpposite(), Direction.UP); diff --git a/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch index 3e2b355924..445be8a492 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DoublePlantBlock.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/net/minecraft/world/level/block/DoublePlantBlock.java -@@ -79,6 +_,7 @@ - return super.canSurvive(state, level, pos); - } else { - BlockState belowState = level.getBlockState(pos.below()); -+ if (state.getBlock() != this) return super.canSurvive(state, level, pos); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - return belowState.is(this) && belowState.getValue(HALF) == DoubleBlockHalf.LOWER; +@@ -80,6 +_,7 @@ } + + BlockState belowState = level.getBlockState(pos.below()); ++ if (state.getBlock() != this) return super.canSurvive(state, level, pos); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + return belowState.is(this) && belowState.getValue(HALF) == DoubleBlockHalf.LOWER; } + diff --git a/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch index 6607ee5ddc..c87f502932 100644 --- a/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/EnchantingTableBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/EnchantingTableBlock.java +++ b/net/minecraft/world/level/block/EnchantingTableBlock.java -@@ -45,7 +_,7 @@ +@@ -46,7 +_,7 @@ } public static boolean isValidBookShelf(final Level level, final BlockPos pos, final BlockPos offset) { diff --git a/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch index 99255f7d5b..097e64d0ce 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FenceGateBlock.java.patch @@ -25,7 +25,7 @@ this.registerDefaultState(this.stateDefinition.any().setValue(OPEN, false).setValue(POWERED, false).setValue(IN_WALL, false)); } -@@ -160,7 +_,7 @@ +@@ -156,7 +_,7 @@ boolean opens = state.getValue(OPEN); level.playSound( @@ -34,7 +34,7 @@ ); level.gameEvent(player, opens ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); return InteractionResult.SUCCESS; -@@ -174,7 +_,7 @@ +@@ -170,7 +_,7 @@ boolean open = state.getValue(OPEN); level.setBlockAndUpdate(pos, state.setValue(OPEN, !open)); level.playSound( @@ -43,7 +43,7 @@ ); level.gameEvent(open ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, pos, GameEvent.Context.of(state)); } -@@ -194,7 +_,7 @@ +@@ -190,7 +_,7 @@ level.playSound( null, pos, diff --git a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch index d3345ceeed..c3f5c9deec 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch @@ -101,16 +101,15 @@ return true; } } -@@ -274,13 +_,14 @@ +@@ -275,12 +_,13 @@ - for (Direction direction : Direction.values()) { - BlockState blockState = level.getBlockState(pos.relative(direction)); -- odds = Math.max(this.getIgniteOdds(blockState), odds); -+ odds = Math.max(blockState.getFireSpreadSpeed(level, pos.relative(direction), direction.getOpposite()), odds); - } - - return odds; + for (Direction direction : Direction.values()) { + BlockState blockState = level.getBlockState(pos.relative(direction)); +- odds = Math.max(this.getIgniteOdds(blockState), odds); ++ odds = Math.max(blockState.getFireSpreadSpeed(level, pos.relative(direction), direction.getOpposite()), odds); } + + return odds; } + @Deprecated //Forge: Use canCatchFire with more context diff --git a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch index e834b7e983..4ae076fdd6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -43,16 +43,16 @@ : Blocks.AIR) .defaultBlockState(); if (newContents.isAir()) { -@@ -92,7 +_,7 @@ - player.drop(plant, false); - } - -- level.setBlock(pos, Blocks.FLOWER_POT.defaultBlockState(), 3); -+ level.setBlock(pos, getEmptyPot().defaultBlockState(), 3); - level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); - return InteractionResult.SUCCESS; +@@ -95,7 +_,7 @@ + player.drop(plant, false); } -@@ -124,7 +_,7 @@ + +- level.setBlock(pos, Blocks.FLOWER_POT.defaultBlockState(), 3); ++ level.setBlock(pos, getEmptyPot().defaultBlockState(), 3); + level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + return InteractionResult.SUCCESS; + } +@@ -126,7 +_,7 @@ } public Block getPotted() { @@ -61,7 +61,7 @@ } @Override -@@ -159,5 +_,24 @@ +@@ -161,5 +_,24 @@ } else { return state.is(Blocks.POTTED_CLOSED_EYEBLOSSOM) ? Blocks.POTTED_OPEN_EYEBLOSSOM.defaultBlockState() : state; } diff --git a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch index 4cda0bf3ad..09c7d20ef3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -9,15 +9,15 @@ } public boolean growMushroom(final ServerLevel level, final BlockPos pos, final BlockState state, final RandomSource random) { -@@ -91,8 +_,10 @@ - if (feature.isEmpty()) { +@@ -92,8 +_,10 @@ return false; - } else { -+ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(level, random, pos, feature.get()); -+ if (event.getResult().isDenied()) return false; - level.removeBlock(pos, false); -- if (feature.get().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { -+ if (event.getFeature().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { - return true; - } else { - level.setBlock(pos, state, 3); + } + ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(level, random, pos, feature.get()); ++ if (event.getResult().isDenied()) return false; + level.removeBlock(pos, false); +- if (feature.get().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { ++ if (event.getFeature().value().place(level, level.getChunkSource().getGenerator(), random, pos)) { + return true; + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch index 5ec3357886..96ba84c66a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch @@ -4,8 +4,8 @@ if (entity.is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)) { return true; } else { -- return entity instanceof LivingEntity ? ((LivingEntity)entity).getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS) : false; -+ return entity instanceof LivingEntity ? ((LivingEntity)entity).getItemBySlot(EquipmentSlot.FEET).canWalkOnPowderedSnow((LivingEntity)entity) : false; +- return entity instanceof LivingEntity livingEntity ? livingEntity.getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS) : false; ++ return entity instanceof LivingEntity livingEntity ? livingEntity.getItemBySlot(EquipmentSlot.FEET).canWalkOnPowderedSnow((LivingEntity)entity) : false; } } diff --git a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch index 2f6a3bd8ce..f487481ef3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -25,15 +25,15 @@ this.registerDefaultState(this.stateDefinition.any().setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(POWERED, false).setValue(WATERLOGGED, false)); } -@@ -35,7 +_,7 @@ - int y = pos.getY(); - int z = pos.getZ(); - boolean checkBelow = true; -- RailShape shape = state.getValue(SHAPE); -+ RailShape shape = state.getValue(getShapeProperty()); - switch (shape) { - case NORTH_SOUTH: - if (forward) { +@@ -36,7 +_,7 @@ + int y = pos.getY(); + int z = pos.getZ(); + boolean checkBelow = true; +- RailShape shape = state.getValue(SHAPE); ++ RailShape shape = state.getValue(getShapeProperty()); + switch (shape) { + case NORTH_SOUTH: + if (forward) { @@ -104,17 +_,17 @@ protected boolean isSameRailWithPower(final Level level, final BlockPos pos, final boolean forward, final int searchDepth, final RailShape dir) { @@ -41,21 +41,21 @@ - if (!state.is(this)) { + if (!(state.getBlock() instanceof PoweredRailBlock other) || this.isActivatorRail() != other.isActivatorRail()) { return false; - } else { -- RailShape myShape = state.getValue(SHAPE); -+ RailShape myShape = other.getRailDirection(state, level, pos, null); - if (dir != RailShape.EAST_WEST || myShape != RailShape.NORTH_SOUTH && myShape != RailShape.ASCENDING_NORTH && myShape != RailShape.ASCENDING_SOUTH) { - if (dir != RailShape.NORTH_SOUTH - || myShape != RailShape.EAST_WEST && myShape != RailShape.ASCENDING_EAST && myShape != RailShape.ASCENDING_WEST) { - if (!state.getValue(POWERED)) { - return false; - } else { -- return level.hasNeighborSignal(pos) ? true : this.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); -+ return level.hasNeighborSignal(pos) ? true : other.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); - } - } else { + } + +- RailShape myShape = state.getValue(SHAPE); ++ RailShape myShape = other.getRailDirection(state, level, pos, null); + if (dir != RailShape.EAST_WEST || myShape != RailShape.NORTH_SOUTH && myShape != RailShape.ASCENDING_NORTH && myShape != RailShape.ASCENDING_SOUTH) { + if (dir != RailShape.NORTH_SOUTH || myShape != RailShape.EAST_WEST && myShape != RailShape.ASCENDING_EAST && myShape != RailShape.ASCENDING_WEST) { + if (!state.getValue(POWERED)) { return false; -@@ -134,7 +_,7 @@ + } else { +- return level.hasNeighborSignal(pos) ? true : this.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); ++ return level.hasNeighborSignal(pos) ? true : other.findPoweredRailSignal(level, pos, state, forward, searchDepth + 1); + } + } else { + return false; +@@ -133,7 +_,7 @@ if (shouldPower != isPowered) { level.setBlock(pos, state.setValue(POWERED, shouldPower), 3); level.updateNeighborsAt(pos.below(), this); @@ -64,7 +64,7 @@ level.updateNeighborsAt(pos.above(), this); } } -@@ -161,6 +_,10 @@ +@@ -160,6 +_,10 @@ @Override protected void createBlockStateDefinition(final StateDefinition.Builder builder) { diff --git a/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch b/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch index a0bc94aa5f..d952dad891 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RailState.java.patch @@ -19,7 +19,7 @@ this.updateConnections(direction); } -@@ -176,7 +_,7 @@ +@@ -177,7 +_,7 @@ } } @@ -28,7 +28,7 @@ if (BaseRailBlock.isRail(this.level, north.above())) { shape = RailShape.ASCENDING_NORTH; } -@@ -186,7 +_,7 @@ +@@ -187,7 +_,7 @@ } } @@ -37,7 +37,7 @@ if (BaseRailBlock.isRail(this.level, east.above())) { shape = RailShape.ASCENDING_EAST; } -@@ -198,6 +_,11 @@ +@@ -199,6 +_,11 @@ if (shape == null) { shape = RailShape.NORTH_SOUTH; @@ -49,7 +49,7 @@ } this.state = this.state.setValue(this.block.getShapeProperty(), shape); -@@ -302,7 +_,7 @@ +@@ -303,7 +_,7 @@ } } @@ -58,7 +58,7 @@ if (BaseRailBlock.isRail(this.level, north.above())) { shape = RailShape.ASCENDING_NORTH; } -@@ -312,7 +_,7 @@ +@@ -313,7 +_,7 @@ } } @@ -67,7 +67,7 @@ if (BaseRailBlock.isRail(this.level, east.above())) { shape = RailShape.ASCENDING_EAST; } -@@ -322,7 +_,7 @@ +@@ -323,7 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch index 4c76d9a712..5800c0472c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkCatalystBlock.java +++ b/net/minecraft/world/level/block/SculkCatalystBlock.java -@@ -59,8 +_,13 @@ +@@ -60,8 +_,13 @@ @Override protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { super.spawnAfterBreak(state, level, pos, tool, dropExperience); diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch index 51d7f66788..faaa52905c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -287,8 +_,13 @@ +@@ -288,8 +_,13 @@ @Override protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { super.spawnAfterBreak(state, level, pos, tool, dropExperience); diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch index 4b9bbc3160..a04576377c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkShriekerBlock.java +++ b/net/minecraft/world/level/block/SculkShriekerBlock.java -@@ -126,7 +_,7 @@ +@@ -127,7 +_,7 @@ @Override protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { super.spawnAfterBreak(state, level, pos, tool, dropExperience); @@ -9,7 +9,7 @@ this.tryDropExperience(level, pos, tool, ConstantInt.of(5)); } } -@@ -140,5 +_,10 @@ +@@ -141,5 +_,10 @@ (innerLevel, pos, state, entity) -> VibrationSystem.Ticker.tick(innerLevel, entity.getVibrationData(), entity.getVibrationUser()) ) : null; diff --git a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch index 998f15ccf0..f1b8ad2ee5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java -@@ -831,6 +_,7 @@ +@@ -855,6 +_,7 @@ private final SoundEvent hitSound; private final SoundEvent fallSound; diff --git a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch index bf57b5a8f8..19424b9a3a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SpawnerBlock.java +++ b/net/minecraft/world/level/block/SpawnerBlock.java -@@ -39,10 +_,15 @@ +@@ -40,10 +_,15 @@ @Override protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { super.spawnAfterBreak(state, level, pos, tool, dropExperience); diff --git a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch index fac93f9e19..dfb893448b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SpreadingSnowyBlock.java +++ b/net/minecraft/world/level/block/SpreadingSnowyBlock.java -@@ -50,8 +_,10 @@ +@@ -52,8 +_,10 @@ Optional baseBlock = blocks.getOptional(this.baseBlock); if (!baseBlock.isEmpty()) { if (!canStayAlive(state, level, pos)) { diff --git a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch index 07dd2b1c81..9da411aa67 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -34,15 +34,15 @@ BlockState stateBelow = level.getBlockState(pos.below()); if (stateBelow.is(this)) { return true; -@@ -97,7 +_,7 @@ - for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockState blockState = level.getBlockState(below.relative(direction)); - FluidState fluidState = level.getFluidState(below.relative(direction)); -- if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY)) { -+ if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || state.canBeHydrated(level, pos, fluidState, below.relative(direction))) { - return true; - } +@@ -98,7 +_,7 @@ + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockState blockState = level.getBlockState(below.relative(direction)); + FluidState fluidState = level.getFluidState(below.relative(direction)); +- if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY)) { ++ if (fluidState.is(FluidTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || blockState.is(BlockTags.SUPPORTS_SUGAR_CANE_ADJACENTLY) || state.canBeHydrated(level, pos, fluidState, below.relative(direction))) { + return true; } + } @@ -110,5 +_,15 @@ @Override protected void createBlockStateDefinition(final StateDefinition.Builder builder) { diff --git a/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch index 85960d6414..5536967c13 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch @@ -27,7 +27,7 @@ } return super.playerWillDestroy(level, pos, state, player); -@@ -81,10 +_,12 @@ +@@ -80,10 +_,12 @@ } } @@ -41,24 +41,24 @@ if (level instanceof ServerLevel serverLevel && serverLevel.getGameRules().get(GameRules.TNT_EXPLODES)) { PrimedTnt tnt = new PrimedTnt(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, source); @@ -110,7 +_,7 @@ - if (!itemStack.is(Items.FLINT_AND_STEEL) && !itemStack.is(Items.FIRE_CHARGE)) { return super.useItemOn(itemStack, state, level, pos, player, hand, hitResult); - } else { -- if (prime(level, pos, player)) { -+ if (onCaughtFire(state, level, pos, hitResult.getDirection(), player)) { - level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); - Item item = itemStack.getItem(); - if (itemStack.is(Items.FLINT_AND_STEEL)) { -@@ -136,7 +_,7 @@ + } + +- if (prime(level, pos, player)) { ++ if (onCaughtFire(state, level, pos, hitResult.getDirection(), player)) { + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); + Item item = itemStack.getItem(); + if (itemStack.is(Items.FLINT_AND_STEEL)) { +@@ -135,7 +_,7 @@ Entity owner = projectile.getOwner(); if (projectile.isOnFire() && projectile.mayInteract(serverLevel, pos) -- && prime(level, pos, owner instanceof LivingEntity ? (LivingEntity)owner : null)) { -+ && onCaughtFire(state, level, pos, null, owner instanceof LivingEntity livingOwner ? livingOwner : null)) { +- && prime(level, pos, owner instanceof LivingEntity livingEntity ? livingEntity : null)) { ++ && onCaughtFire(state, level, pos, null, owner instanceof LivingEntity livingEntity ? livingEntity : null)) { level.removeBlock(pos, false); } } -@@ -150,5 +_,9 @@ +@@ -149,5 +_,9 @@ @Override protected void createBlockStateDefinition(final StateDefinition.Builder builder) { builder.add(UNSTABLE); diff --git a/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch index b86a6ca924..14dbaea906 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java -@@ -196,4 +_,14 @@ +@@ -192,4 +_,14 @@ protected BlockSetType getType() { return this.type; } diff --git a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch index 37df0fbd33..0fffedd154 100644 --- a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch @@ -9,7 +9,7 @@ public static final MapCodec CODEC = simpleCodec(VineBlock::new); public static final BooleanProperty UP = PipeBlock.UP; public static final BooleanProperty NORTH = PipeBlock.NORTH; -@@ -166,7 +_,7 @@ +@@ -168,7 +_,7 @@ @Override protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { if (level.getGameRules().get(GameRules.SPREAD_VINES)) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 41eb79789e..e82a4b0746 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -58,6 +_,7 @@ +@@ -57,6 +_,7 @@ private static final short DEFAULT_COOKING_TOTAL_TIME = 0; private static final short DEFAULT_LIT_TIME_REMAINING = 0; private static final short DEFAULT_LIT_TOTAL_TIME = 0; @@ -8,7 +8,7 @@ protected NonNullList items = NonNullList.withSize(3, ItemStack.EMPTY); private int litTimeRemaining; private int litTotalTime; -@@ -114,6 +_,7 @@ +@@ -109,6 +_,7 @@ ) { super(type, worldPosition, blockState); this.quickCheck = RecipeManager.createCheck(recipeType); @@ -16,7 +16,7 @@ } @Override -@@ -121,10 +_,10 @@ +@@ -116,10 +_,10 @@ super.loadAdditional(input); this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); ContainerHelper.loadAllItems(input, this.items); @@ -31,7 +31,7 @@ this.recipesUsed.clear(); this.recipesUsed.putAll(input.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of())); } -@@ -132,10 +_,10 @@ +@@ -127,10 +_,10 @@ @Override protected void saveAdditional(final ValueOutput output) { super.saveAdditional(output); @@ -46,7 +46,7 @@ ContainerHelper.saveAllItems(output, this.items); output.store("RecipesUsed", RECIPES_USED_CODEC, this.recipesUsed); } -@@ -164,13 +_,13 @@ +@@ -159,13 +_,13 @@ if (recipe != null) { int maxStackSize = entity.getMaxStackSize(); ItemStack burnResult = recipe.value().assemble(input); @@ -62,7 +62,7 @@ isLit = true; changed = true; } -@@ -181,7 +_,7 @@ +@@ -176,7 +_,7 @@ if (entity.cookingTimer == entity.cookingTotalTime) { entity.cookingTimer = 0; entity.cookingTotalTime = recipe.value().cookingTime(); @@ -71,7 +71,7 @@ entity.setRecipeUsed(recipe); changed = true; } -@@ -210,16 +_,16 @@ +@@ -205,16 +_,16 @@ } } @@ -93,8 +93,8 @@ ItemStack resultItemStack = items.get(2); if (resultItemStack.isEmpty()) { return true; -@@ -232,7 +_,7 @@ - } +@@ -229,7 +_,7 @@ + return resultCount <= maxResultCount; } - private static void burn(final NonNullList items, final ItemStack inputItemStack, final ItemStack result) { @@ -102,7 +102,7 @@ ItemStack resultItemStack = items.get(2); if (resultItemStack.isEmpty()) { items.set(2, result.copy()); -@@ -371,6 +_,35 @@ +@@ -370,6 +_,35 @@ for (ItemStack itemStack : this.items) { contents.accountStack(itemStack); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index 3ef51f39ee..cab4941038 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -140,8 +_,8 @@ +@@ -138,8 +_,8 @@ for (int i = 0; i < 10 && checkPos.getY() <= lastSetBlock; i++) { BlockState state = level.getBlockState(checkPos); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch index a427d27062..688d43d928 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -39,7 +_,7 @@ +@@ -38,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,7 +9,7 @@ private static final Codec> TYPE_CODEC = BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec(); private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; -@@ -54,6 +_,7 @@ +@@ -53,6 +_,7 @@ this.worldPosition = worldPosition.immutable(); this.validateBlockState(blockState); this.blockState = blockState; @@ -17,7 +17,7 @@ } private void validateBlockState(final BlockState blockState) { -@@ -63,7 +_,7 @@ +@@ -62,7 +_,7 @@ } public boolean isValidBlockState(final BlockState blockState) { @@ -26,7 +26,7 @@ } public static BlockPos getPosFromTag(final ChunkPos base, final CompoundTag entityTag) { -@@ -94,6 +_,7 @@ +@@ -93,6 +_,7 @@ } protected void loadAdditional(final ValueInput input) { @@ -34,7 +34,7 @@ } public final void loadWithComponents(final ValueInput input) { -@@ -106,6 +_,7 @@ +@@ -105,6 +_,7 @@ } protected void saveAdditional(final ValueOutput output) { @@ -42,7 +42,7 @@ } public final CompoundTag saveWithFullMetadata(final HolderLookup.Provider registries) { -@@ -239,6 +_,13 @@ +@@ -224,6 +_,13 @@ public void setRemoved() { this.remove = true; diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index dd663455ab..7bc20415f3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -180,9 +_,10 @@ +@@ -177,9 +_,10 @@ for (int dest = 0; dest < 3; dest++) { items.set(dest, potionBrewing.mix(ingredient, items.get(dest))); } @@ -12,7 +12,7 @@ if (remainder != null) { if (ingredient.isEmpty()) { ingredient = remainder.create(); -@@ -221,6 +_,9 @@ +@@ -218,6 +_,9 @@ if (slot == 3) { PotionBrewing potionBrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; return potionBrewing.isIngredient(itemStack); @@ -22,7 +22,7 @@ } else { return slot == 4 ? itemStack.is(ItemTags.BREWING_FUEL) -@@ -251,5 +_,34 @@ +@@ -248,5 +_,34 @@ @Override protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) { return new BrewingStandMenu(containerId, inventory, this, this.dataAccess); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index 71820d3a76..248134efc3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -202,4 +_,43 @@ +@@ -192,4 +_,43 @@ Block block = blockState.getBlock(); level.blockEvent(pos, block, 1, current); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index 3d92102bd2..9bae0e2987 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java -@@ -149,8 +_,8 @@ - BlockPos testPos = worldPosition.offset(ox, oy, ozx); +@@ -150,8 +_,8 @@ + BlockPos testPos = worldPosition.offset(ox, oy, oz); BlockState testBlock = level.getBlockState(testPos); - for (Block type : VALID_BLOCKS) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch index e56b943f39..7a66fc7704 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HangingSignBlockEntity.java @@ -13,6 +_,10 @@ - super(BlockEntityType.HANGING_SIGN, worldPosition, blockState); + super(BlockEntityTypes.HANGING_SIGN, worldPosition, blockState); } + public HangingSignBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch index c702df30ae..e1909e1b8b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch @@ -20,4 +20,4 @@ + return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, Direction.UP); } - public static enum AnimationStatus { + public enum AnimationStatus { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch index cc6abc4d65..70241aed4a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -274,6 +_,11 @@ +@@ -275,6 +_,11 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch index 5cbf076895..caf9bdce3c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java -@@ -37,6 +_,13 @@ +@@ -32,6 +_,13 @@ level.sendBlockUpdated(pos, state, state, 260); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index 2488659999..2cfc4dc425 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -13,10 +13,10 @@ level.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(extendedState)); } else if (b0 == 1 || b0 == 2) { + if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(level, pos, direction, false)) return false; - BlockEntity prevBlockEntity = level.getBlockEntity(pos.relative(direction)); - if (prevBlockEntity instanceof PistonMovingBlockEntity) { - ((PistonMovingBlockEntity)prevBlockEntity).finalTick(); -@@ -221,6 +_,7 @@ + if (level.getBlockEntity(pos.relative(direction)) instanceof PistonMovingBlockEntity pistonMovingBlockEntity) { + pistonMovingBlockEntity.finalTick(); + } +@@ -220,6 +_,7 @@ level.gameEvent(GameEvent.BLOCK_DEACTIVATE, pos, GameEvent.Context.of(movingPistonState)); } @@ -24,7 +24,7 @@ return true; } -@@ -369,6 +_,11 @@ +@@ -376,6 +_,11 @@ @Override protected BlockState rotate(final BlockState state, final Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch index 6e5e4f335d..929b482de9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/piston/PistonStructureResolver.java +++ b/net/minecraft/world/level/block/piston/PistonStructureResolver.java -@@ -50,7 +_,7 @@ - } else { +@@ -52,7 +_,7 @@ + for (int i = 0; i < this.toPush.size(); i++) { BlockPos pos = this.toPush.get(i); - if (isSticky(this.level.getBlockState(pos)) && !this.addBranchingBlocks(pos)) { @@ -9,7 +9,7 @@ return false; } } -@@ -59,21 +_,9 @@ +@@ -61,21 +_,9 @@ } } @@ -30,33 +30,33 @@ - if (nextState.isAir()) { + if (level.isEmptyBlock(start)) { return true; - } else if (!PistonBaseBlock.isPushable(nextState, this.level, start, this.pushDirection, false, direction)) { - return true; -@@ -86,12 +_,12 @@ - if (blockCount + this.toPush.size() > 12) { - return false; - } else { -- while (isSticky(nextState)) { -+ while (nextState.isStickyBlock()) { - BlockPos pos = start.relative(this.pushDirection.getOpposite(), blockCount); - BlockState previousState = nextState; - nextState = this.level.getBlockState(pos); - if (nextState.isAir() -- || !canStickToEachOther(previousState, nextState) -+ || !(previousState.canStickTo(nextState) && nextState.canStickTo(previousState)) - || !PistonBaseBlock.isPushable(nextState, this.level, pos, this.pushDirection, false, this.pushDirection.getOpposite()) - || pos.equals(this.pistonPos)) { - break; -@@ -119,7 +_,7 @@ + } - for (int j = 0; j <= collisionPos + blocksAdded; j++) { - BlockPos blockPos = this.toPush.get(j); -- if (isSticky(this.level.getBlockState(blockPos)) && !this.addBranchingBlocks(blockPos)) { -+ if (this.level.getBlockState(blockPos).isStickyBlock() && !this.addBranchingBlocks(blockPos)) { - return false; - } - } -@@ -173,7 +_,7 @@ +@@ -96,12 +_,12 @@ + return false; + } + +- while (isSticky(nextState)) { ++ while (nextState.isStickyBlock()) { + BlockPos pos = start.relative(this.pushDirection.getOpposite(), blockCount); + BlockState previousState = nextState; + nextState = this.level.getBlockState(pos); + if (nextState.isAir() +- || !canStickToEachOther(previousState, nextState) ++ || !(previousState.canStickTo(nextState) && nextState.canStickTo(previousState)) + || !PistonBaseBlock.isPushable(nextState, this.level, pos, this.pushDirection, false, this.pushDirection.getOpposite()) + || pos.equals(this.pistonPos)) { + break; +@@ -129,7 +_,7 @@ + + for (int j = 0; j <= collisionPos + blocksAdded; j++) { + BlockPos blockPos = this.toPush.get(j); +- if (isSticky(this.level.getBlockState(blockPos)) && !this.addBranchingBlocks(blockPos)) { ++ if (this.level.getBlockState(blockPos).isStickyBlock() && !this.addBranchingBlocks(blockPos)) { + return false; + } + } +@@ -181,7 +_,7 @@ if (direction.getAxis() != this.pushDirection.getAxis()) { BlockPos neighbourPos = fromPos.relative(direction); BlockState neighbourState = this.level.getBlockState(neighbourPos); diff --git a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index 5ebedf6168..4017a55bf9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -180,7 +_,7 @@ +@@ -178,7 +_,7 @@ if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { Block block = state.getBlock(); boolean doDropExperienceHack = explosion.getIndirectSourceEntity() instanceof Player; @@ -9,7 +9,7 @@ BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(pos) : null; LootParams.Builder params = new LootParams.Builder(level) .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) -@@ -195,8 +_,7 @@ +@@ -193,8 +_,7 @@ state.getDrops(params).forEach(stack -> onHit.accept(stack, pos)); } @@ -19,15 +19,14 @@ } } -@@ -357,12 +_,15 @@ - if (destroySpeed == -1.0F) { +@@ -352,11 +_,14 @@ return 0.0F; - } else { -- int modifier = player.hasCorrectToolForDrops(state) ? 30 : 100; -- return player.getDestroySpeed(state) / destroySpeed / modifier; -+ int modifier = net.minecraftforge.common.ForgeHooks.isCorrectToolForDrops(state, player) ? 30 : 100; -+ return player.getDestroySpeed(state, pos) / destroySpeed / (float)modifier; } + +- int modifier = player.hasCorrectToolForDrops(state) ? 30 : 100; +- return player.getDestroySpeed(state) / destroySpeed / modifier; ++ int modifier = net.minecraftforge.common.ForgeHooks.isCorrectToolForDrops(state, player) ? 30 : 100; ++ return player.getDestroySpeed(state, pos) / destroySpeed / (float)modifier; } protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) { @@ -37,7 +36,7 @@ } protected void attack(final BlockState state, final Level level, final BlockPos pos, final Player player) { -@@ -405,6 +_,8 @@ +@@ -407,6 +_,8 @@ return this.isRandomlyTicking; } @@ -46,7 +45,7 @@ protected SoundType getSoundType(final BlockState state) { return this.soundType; } -@@ -425,6 +_,10 @@ +@@ -427,6 +_,10 @@ return this.properties.destroyTime; } @@ -57,7 +56,7 @@ public abstract static class BlockStateBase extends StateHolder implements TypedInstance { private static final Direction[] DIRECTIONS = Direction.values(); private static final VoxelShape[] EMPTY_OCCLUSION_SHAPES = Util.make(new VoxelShape[DIRECTIONS.length], s -> Arrays.fill(s, Shapes.empty())); -@@ -576,12 +_,14 @@ +@@ -582,12 +_,14 @@ return this.useShapeForLightOcclusion; } @@ -73,7 +72,7 @@ } public boolean ignitedByLava() { -@@ -594,9 +_,11 @@ +@@ -600,9 +_,11 @@ } public MapColor getMapColor(final BlockGetter level, final BlockPos pos) { @@ -86,7 +85,7 @@ public BlockState rotate(final Rotation rotation) { return this.getBlock().rotate(this.asState(), rotation); } -@@ -650,6 +_,8 @@ +@@ -660,6 +_,8 @@ } public PushReaction getPistonPushReaction() { @@ -95,7 +94,7 @@ return this.pushReaction; } -@@ -1004,7 +_,7 @@ +@@ -1013,7 +_,7 @@ private BlockBehaviour.StateArgumentPredicate> isValidSpawn = (state, level, pos, entityType) -> state.isFaceSturdy( level, pos, Direction.UP ) diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch index 474b928f65..55fbda9d78 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch @@ -33,7 +33,7 @@ } } } -@@ -493,5 +_,9 @@ +@@ -499,5 +_,9 @@ } public record PackedTicks(List> blocks, List> fluids) { diff --git a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch index 5108f8e047..3de8c270aa 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -64,7 +_,7 @@ +@@ -63,7 +_,7 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; @@ -9,7 +9,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final TickingBlockEntity NULL_TICKER = new TickingBlockEntity() { @Override -@@ -124,6 +_,7 @@ +@@ -123,6 +_,7 @@ this.postLoad = postLoad; this.blockTicks = blockTicks; this.fluidTicks = fluidTicks; @@ -18,15 +18,15 @@ public LevelChunk(final ServerLevel level, final ProtoChunk protoChunk, final LevelChunk.@Nullable PostLoadProcessor postLoad) { @@ -323,7 +_,7 @@ - if (!section.getBlockState(localX, localY, localZ).is(newBlock)) { - return null; - } else { -- if (!this.level.isClientSide() && (flags & 512) == 0) { -+ if (!this.level.isClientSide() && (flags & 512) == 0 && !this.level.captureBlockSnapshots) { - state.onPlace(this.level, pos, oldState, movedByPiston); - } + return null; + } -@@ -370,6 +_,12 @@ +- if (!this.level.isClientSide() && (flags & 512) == 0) { ++ if (!this.level.isClientSide() && (flags & 512) == 0 && !this.level.captureBlockSnapshots) { + state.onPlace(this.level, pos, oldState, movedByPiston); + } + +@@ -367,6 +_,12 @@ public @Nullable BlockEntity getBlockEntity(final BlockPos pos, final LevelChunk.EntityCreationType creationType) { BlockEntity blockEntity = this.blockEntities.get(pos); @@ -39,7 +39,7 @@ if (blockEntity == null) { CompoundTag tag = this.pendingBlockEntities.remove(pos); if (tag != null) { -@@ -387,9 +_,6 @@ +@@ -384,9 +_,6 @@ this.addAndRegisterBlockEntity(blockEntity); } } @@ -49,7 +49,7 @@ } return blockEntity; -@@ -404,6 +_,7 @@ +@@ -401,6 +_,7 @@ this.level.onBlockEntityAdded(blockEntity); this.updateBlockEntityTicker(blockEntity); @@ -57,7 +57,7 @@ } } -@@ -455,9 +_,14 @@ +@@ -452,9 +_,14 @@ public @Nullable CompoundTag getBlockEntityNbtForSaving(final BlockPos blockPos, final HolderLookup.Provider registryAccess) { BlockEntity blockEntity = this.getBlockEntity(blockPos); if (blockEntity != null && !blockEntity.isRemoved()) { @@ -69,10 +69,10 @@ + LOGGER.error("A BlockEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", blockEntity.getClass().getName(), e); + return null; + } - } else { - CompoundTag result = this.pendingBlockEntities.get(blockPos); - if (result != null) { -@@ -538,7 +_,7 @@ + } + + CompoundTag result = this.pendingBlockEntities.get(blockPos); +@@ -534,7 +_,7 @@ blockEntities.accept((pos, type, tag) -> { BlockEntity blockEntity = this.getBlockEntity(pos, LevelChunk.EntityCreationType.IMMEDIATE); if (blockEntity != null && tag != null && blockEntity.getType() == type) { @@ -81,7 +81,7 @@ } }); } -@@ -677,6 +_,7 @@ +@@ -673,6 +_,7 @@ } public void clearAllBlockEntities() { @@ -89,7 +89,7 @@ this.blockEntities.values().forEach(BlockEntity::setRemoved); this.blockEntities.clear(); this.tickersInLevel.values().forEach(ticker -> ticker.rebind(NULL_TICKER)); -@@ -684,6 +_,7 @@ +@@ -680,6 +_,7 @@ } public void registerAllBlockEntitiesAfterLevelLoad() { @@ -97,7 +97,7 @@ this.blockEntities.values().forEach(blockEntity -> { if (this.level instanceof ServerLevel serverLevel) { this.addGameEventListener(blockEntity, serverLevel); -@@ -730,6 +_,24 @@ +@@ -725,6 +_,24 @@ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, ticker); } @@ -122,7 +122,7 @@ private class BoundTickingBlockEntity implements TickingBlockEntity { private final T blockEntity; private final BlockEntityTicker ticker; -@@ -749,6 +_,7 @@ +@@ -742,6 +_,7 @@ if (LevelChunk.this.isTicking(pos)) { try { ProfilerFiller profiler = Profiler.get(); @@ -130,8 +130,8 @@ profiler.push(this::getType); BlockState blockState = LevelChunk.this.getBlockState(pos); if (this.blockEntity.getType().isValid(blockState)) { -@@ -770,6 +_,11 @@ - CrashReport report = CrashReport.forThrowable(var5, "Ticking block entity"); +@@ -763,6 +_,11 @@ + CrashReport report = CrashReport.forThrowable(t, "Ticking block entity"); CrashReportCategory category = report.addCategory("Block entity being ticked"); this.blockEntity.fillCrashReportCategory(category); + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringBlockEntities.get()) { @@ -142,7 +142,7 @@ throw new ReportedException(report); } } -@@ -843,6 +_,33 @@ +@@ -836,6 +_,33 @@ public String toString() { return this.ticker + " "; } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch index 0bf07cc637..3a32c4b84a 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -97,9 +_,13 @@ +@@ -94,9 +_,13 @@ ListTag entities = new ListTag(); chunk.getEntities().forEach(e -> { TagValueOutput output = TagValueOutput.createWithContext(reporter.forChild(e.problemPath()), e.registryAccess()); diff --git a/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch index 820bdd085b..d20866b88c 100644 --- a/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch +++ b/patches/minecraft/net/minecraft/world/level/dimension/end/EnderDragonFight.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/dimension/end/EnderDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EnderDragonFight.java -@@ -581,6 +_,14 @@ +@@ -580,6 +_,14 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch index 9ebf8fde53..02b0eda36e 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -@@ -72,7 +_,18 @@ +@@ -71,7 +_,18 @@ return this.addEntity(entity, false); } @@ -18,19 +18,19 @@ + private boolean addEntityWithoutEvent(final T entity, final boolean loaded) { if (!this.addEntityUuid(entity)) { return false; - } else { + } @@ -93,6 +_,10 @@ - this.startTicking(entity); - } + this.startTicking(entity); + } + if (entity instanceof Entity) { + ((Entity)entity).onAddedToLevel(); + } + - return true; - } + return true; } -@@ -370,6 +_,7 @@ + +@@ -369,11 +_,13 @@ private class Callback implements EntityInLevelCallback { private final T entity; @@ -38,15 +38,13 @@ private long currentSectionKey; private EntitySection currentSection; -@@ -377,6 +_,7 @@ - Objects.requireNonNull(PersistentEntitySectionManager.this); - super(); + private Callback(final T entity, final long currentSectionKey, final EntitySection currentSection) { this.entity = entity; + this.realEntity = entity instanceof Entity e ? e : null; this.currentSectionKey = currentSectionKey; this.currentSection = currentSection; } -@@ -395,9 +_,13 @@ +@@ -392,9 +_,13 @@ PersistentEntitySectionManager.this.removeSectionIfEmpty(this.currentSectionKey, this.currentSection); EntitySection newSection = PersistentEntitySectionManager.this.sectionStorage.getOrCreateSection(newSectionPos); newSection.add(this.entity); diff --git a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch index c163b96882..2c05951f46 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/entity/TransientEntitySectionManager.java +++ b/net/minecraft/world/level/entity/TransientEntitySectionManager.java -@@ -83,6 +_,7 @@ +@@ -82,11 +_,13 @@ private class Callback implements EntityInLevelCallback { private final T entity; @@ -8,15 +8,13 @@ private long currentSectionKey; private EntitySection currentSection; -@@ -90,6 +_,7 @@ - Objects.requireNonNull(TransientEntitySectionManager.this); - super(); + private Callback(final T entity, final long currentSectionKey, final EntitySection currentSection) { this.entity = entity; + this.realEntity = entity instanceof Entity ? (Entity)entity : null; this.currentSectionKey = currentSectionKey; this.currentSection = currentSection; } -@@ -108,6 +_,7 @@ +@@ -105,6 +_,7 @@ TransientEntitySectionManager.this.removeSectionIfEmpty(this.currentSectionKey, this.currentSection); EntitySection newSection = TransientEntitySectionManager.this.sectionStorage.getOrCreateSection(newSectionPos); newSection.add(this.entity); @@ -24,7 +22,7 @@ this.currentSection = newSection; this.currentSectionKey = newSectionPos; TransientEntitySectionManager.this.callbacks.onSectionChange(this.entity); -@@ -119,6 +_,9 @@ +@@ -116,6 +_,9 @@ } else if (!wasTicking && isTicking) { TransientEntitySectionManager.this.callbacks.onTickingStart(this.entity); } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch index 4148998ca7..7f345cfec7 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/Beardifier.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java -@@ -51,6 +_,11 @@ +@@ -52,6 +_,11 @@ - for (StructurePiece piece : start.getPieces()) { - if (piece.isCloseToChunk(chunkPos, 12)) { -+ if (piece instanceof net.minecraftforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { -+ if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { -+ rigids.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); -+ } -+ } else - if (piece instanceof PoolElementStructurePiece poolPiece) { - StructureTemplatePool.Projection projection = poolPiece.getElement().getProjection(); - if (projection == StructureTemplatePool.Projection.RIGID) { + for (StructurePiece piece : start.getPieces()) { + if (piece.isCloseToChunk(chunkPos, 12)) { ++ if (piece instanceof net.minecraftforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { ++ if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { ++ rigids.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); ++ } ++ } else + if (piece instanceof PoolElementStructurePiece poolPiece) { + StructureTemplatePool.Projection projection = poolPiece.getElement().getProjection(); + if (projection == StructureTemplatePool.Projection.RIGID) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch index 5fe72aeda7..7f39b11522 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch @@ -23,10 +23,10 @@ .south(-10 + random.nextInt(21)); @@ -47,7 +_,7 @@ FluidState fluidState = level.getFluidState(spawnPos); - if (NaturalSpawner.isValidEmptySpawnBlock(level, spawnPos, blockState, fluidState, EntityType.PHANTOM)) { + if (NaturalSpawner.isValidEmptySpawnBlock(level, spawnPos, blockState, fluidState, EntityTypes.PHANTOM)) { SpawnGroupData groupData = null; - int groupSize = 1 + random.nextInt(difficulty.getDifficulty().getId() + 1); + int groupSize = event.getPhantomsToSpawn(); for (int i = 0; i < groupSize; i++) { - Phantom phantom = EntityType.PHANTOM.create(level, EntitySpawnReason.NATURAL); + Phantom phantom = EntityTypes.PHANTOM.create(level, EntitySpawnReason.NATURAL); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch index bfc7c3ee04..23d9227307 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java -@@ -128,6 +_,6 @@ +@@ -129,6 +_,6 @@ } private EntityType randomEntityId(final RandomSource random) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 8bf474c925..6c40ecea1b 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java -@@ -82,6 +_,9 @@ +@@ -81,6 +_,9 @@ } public final CompoundTag createTag(final StructurePieceSerializationContext context) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch index c167e58019..22b4f887fa 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java -@@ -7,6 +_,7 @@ +@@ -8,6 +_,7 @@ import org.jspecify.annotations.Nullable; - public abstract class StructureProcessor { + public interface StructureProcessor { + /** @deprecated Use variant with StructureTemplate argument */ - public StructureTemplate.@Nullable StructureBlockInfo processBlock( + default StructureTemplate.@Nullable StructureBlockInfo processBlock( final LevelReader level, final BlockPos targetPosition, -@@ -18,6 +_,18 @@ +@@ -19,6 +_,18 @@ return processedBlockInfo; } -+ public StructureTemplate.@Nullable StructureBlockInfo processBlock( ++ default StructureTemplate.@Nullable StructureBlockInfo processBlock( + final LevelReader level, + final BlockPos targetPosition, + final BlockPos referencePos, -+ final StructureTemplate.StructureBlockInfo originalBlockInfo, ++ final BlockPos templateRelativePos, + final StructureTemplate.StructureBlockInfo processedBlockInfo, + final StructurePlaceSettings settings, + final @Nullable StructureTemplate template + ) { -+ return processBlock(level, targetPosition, referencePos, originalBlockInfo, processedBlockInfo, settings); ++ return processBlock(level, targetPosition, referencePos, templateRelativePos, processedBlockInfo, settings); + } + - protected abstract StructureProcessorType getType(); + MapCodec codec(); - public List finalizeProcessing( -@@ -29,5 +_,20 @@ + default List finalizeProcessing( +@@ -30,6 +_,21 @@ final StructurePlaceSettings settings ) { return processedBlockInfoList; @@ -37,7 +37,7 @@ + * Use this method to process entities from a structure in much the same way as + * blocks, parameters are analogous. + */ -+ public StructureTemplate.@Nullable StructureEntityInfo processEntity( ++ default StructureTemplate.@Nullable StructureEntityInfo processEntity( + final LevelReader level, + final BlockPos targetPosition, + final StructureTemplate.StructureEntityInfo originalEntityInfo, @@ -47,4 +47,5 @@ + ) { + return processedEntityInfo; } - } + + default boolean evaluatesEntirePieceState() { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index 09b212a493..6678e7627e 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -250,6 +_,10 @@ +@@ -249,6 +_,10 @@ return transform(pos, settings.getMirror(), settings.getRotation(), settings.getRotationPivot()); } @@ -12,28 +12,28 @@ final ServerLevelAccessor level, final BlockPos position, @@ -276,7 +_,7 @@ - int maxX = Integer.MIN_VALUE; - int maxY = Integer.MIN_VALUE; - int maxZ = Integer.MIN_VALUE; -- List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList); -+ List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList, this); + int maxX = Integer.MIN_VALUE; + int maxY = Integer.MIN_VALUE; + int maxZ = Integer.MIN_VALUE; +- List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList); ++ List processedBlockInfoList = processBlockInfos(level, position, referencePos, settings, blockInfoList, this); - try (ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(LOGGER)) { - for (StructureTemplate.StructureBlockInfo blockInfo : processedBlockInfoList) { -@@ -396,10 +_,10 @@ - position, - settings.getMirror(), - settings.getRotation(), -- settings.getRotationPivot(), - boundingBox, - settings.shouldFinalizeEntities(), -- reporter -+ reporter, -+ settings - ); - } + try (ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(LOGGER)) { + for (StructureTemplate.StructureBlockInfo blockInfo : processedBlockInfoList) { +@@ -395,10 +_,10 @@ + position, + settings.getMirror(), + settings.getRotation(), +- settings.getRotationPivot(), + boundingBox, + settings.shouldFinalizeEntities(), +- reporter ++ reporter, ++ settings + ); } -@@ -442,12 +_,21 @@ + } +@@ -440,12 +_,21 @@ }); } @@ -56,16 +56,16 @@ ) { List originalBlockInfoList = new ArrayList<>(); List processedBlockInfoList = new ArrayList<>(); -@@ -460,7 +_,7 @@ - Iterator iterator = settings.getProcessors().iterator(); +@@ -469,7 +_,7 @@ + Iterator iterator = settings.getProcessors().iterator(); - while (processedBlockInfo != null && iterator.hasNext()) { -- processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo, processedBlockInfo, settings); -+ processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo, processedBlockInfo, settings, template); - } + while (processedBlockInfo != null && iterator.hasNext()) { +- processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo.pos, processedBlockInfo, settings); ++ processedBlockInfo = iterator.next().processBlock(level, position, referencePos, blockInfo.pos, processedBlockInfo, settings, template); + } - if (processedBlockInfo != null) { -@@ -481,17 +_,17 @@ + if (processedBlockInfo != null) { +@@ -491,17 +_,17 @@ final BlockPos position, final Mirror mirror, final Rotation rotation, @@ -89,7 +89,7 @@ ListTag posTag = new ListTag(); posTag.add(DoubleTag.valueOf(pos.x)); posTag.add(DoubleTag.valueOf(pos.y)); -@@ -513,6 +_,30 @@ +@@ -523,6 +_,30 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch index 1e94362bac..afd6d6b12b 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -169,7 +_,7 @@ +@@ -168,7 +_,7 @@ BlockState blockState = level.getBlockState(relativePos); FluidState fluidState = blockState.getFluidState(); if (fluidState.getType().isSame(this) && canPassThroughWall(direction, level, pos, state, relativePos, blockState)) { @@ -9,7 +9,7 @@ neighbourSources++; } -@@ -177,7 +_,7 @@ +@@ -176,7 +_,7 @@ } } @@ -18,7 +18,7 @@ BlockState belowState = level.getBlockState(mutablePos.setWithOffset(pos, Direction.DOWN)); FluidState belowFluid = belowState.getFluidState(); if (belowState.isSolid() || this.isSourceBlockOfThisType(belowFluid)) { -@@ -262,6 +_,15 @@ +@@ -263,6 +_,15 @@ return this.getSource().defaultFluidState().setValue(FALLING, falling); } diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index 78aa176a4f..48ec5af73f 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -484,6 +_,16 @@ +@@ -494,6 +_,16 @@ for (int dz = -1; dz <= 1; dz++) { if (dx != 0 || dz != 0) { PathType pathType = context.getPathTypeFromState(x + dx, y + dy, z + dz); @@ -17,7 +17,7 @@ if (pathType == PathType.DAMAGING) { return PathType.DAMAGING_IN_NEIGHBOR; } -@@ -510,6 +_,10 @@ +@@ -520,6 +_,10 @@ protected static PathType getPathTypeFromState(final BlockGetter level, final BlockPos pos) { BlockState blockState = level.getBlockState(pos); Block block = blockState.getBlock(); @@ -27,22 +27,22 @@ + if (blockState.isAir()) { return PathType.OPEN; - } else if (blockState.is(BlockTags.TRAPDOORS) || blockState.is(Blocks.LILY_PAD) || blockState.is(Blocks.BIG_DRIPLEAF)) { -@@ -524,6 +_,8 @@ - return PathType.COCOA; - } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) { + } +@@ -546,6 +_,8 @@ + + if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(BlockTags.SPELEOTHEMS)) { FluidState fluidState = blockState.getFluidState(); + var nonLoggableFluidPathType = fluidState.getBlockPathType(level, pos, null, false); + if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; if (fluidState.is(FluidTags.LAVA)) { return PathType.LAVA; - } else if (isBurningBlock(blockState)) { -@@ -544,6 +_,8 @@ - if (!blockState.isPathfindable(PathComputationType.LAND)) { - return PathType.BLOCKED; + } +@@ -558,6 +_,8 @@ + if (blockState.getValue(DoorBlock.OPEN)) { + return PathType.DOOR_OPEN; } else { + var loggableFluidPathType = fluidState.getBlockPathType(level, pos, null, true); + if (loggableFluidPathType != null) return loggableFluidPathType; - return fluidState.is(FluidTags.WATER) ? PathType.WATER : PathType.OPEN; + return door.type().canOpenByHand() ? PathType.DOOR_WOOD_CLOSED : PathType.DOOR_IRON_CLOSED; } } else { diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch index 62ceed9b2e..48ba3f73e7 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -572,6 +_,11 @@ +@@ -566,6 +_,11 @@ return unfixedDataTag; } @@ -12,7 +12,7 @@ public Dynamic getUnfixedDataTag(final boolean useFallback) throws IOException { this.checkLock(); Path dataFile = this.getDataFile(useFallback); -@@ -591,6 +_,7 @@ +@@ -585,6 +_,7 @@ CompoundTag dataTag = levelData.createTag(singleplayerUUID); CompoundTag root = new CompoundTag(); root.put("Data", dataTag); @@ -20,7 +20,7 @@ this.saveLevelData(root); } -@@ -617,6 +_,10 @@ +@@ -611,6 +_,10 @@ public Optional getIconFile() { return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); diff --git a/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch b/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch index d95e213bb1..f2d7fc24aa 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PlayerDataStorage.java.patch @@ -5,7 +5,7 @@ Path oldFile = playerDirPath.resolve(player.getStringUUID() + ".dat_old"); Util.safeReplaceFile(realFile, tmpFile, oldFile); + net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(player, playerDir, player.getStringUUID()); - } catch (Exception var11) { + } catch (Exception ignored) { LOGGER.warn("Failed to save player data for {}", player.getPlainTextName()); } @@ -83,5 +_,9 @@ diff --git a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch index a4a91e9342..c9d019189c 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -26,7 +26,7 @@ } public static void writeLastPlayed(final CompoundTag tag) { -@@ -322,6 +_,16 @@ +@@ -327,6 +_,16 @@ public LevelSettings getLevelSettings() { return this.settings.copy(); } @@ -42,4 +42,4 @@ + @Deprecated - public static enum SpecialWorldProperty { + public enum SpecialWorldProperty { diff --git a/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch b/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch index 0b997fda25..d24788744b 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/SavedDataStorage.java.patch @@ -1,13 +1,12 @@ --- a/net/minecraft/world/level/storage/SavedDataStorage.java +++ b/net/minecraft/world/level/storage/SavedDataStorage.java -@@ -122,6 +_,10 @@ +@@ -121,6 +_,9 @@ } int version = NbtUtils.getDataVersion(tag, 1343); + // Forge: Allow the data fixer to be null, leaving the modder responsible for keeping track of their own data formats + if (type == null) -+ var8 = tag; -+ else - var8 = type.update(this.fixerUpper, tag, version, newVersion); ++ return tag; + return type.update(this.fixerUpper, tag, version, newVersion); } - + } diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch index c5c35e3750..7a75d879de 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -45,7 +45,7 @@ + return this.queriedLootTableId == null ? net.minecraftforge.common.loot.LootTableIdCondition.UNKNOWN_LOOT_TABLE : this.queriedLootTableId; + } + - public static enum BlockEntityTarget implements StringRepresentable, LootContextArg.SimpleGetter { + public enum BlockEntityTarget implements StringRepresentable, LootContextArg.SimpleGetter { BLOCK_ENTITY("block_entity", LootContextParams.BLOCK_ENTITY); @@ -113,11 +_,18 @@ diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch index 9495a14e85..f0e1a9f4d9 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/storage/loot/LootPool.java +++ b/net/minecraft/world/level/storage/loot/LootPool.java -@@ -32,10 +_,13 @@ +@@ -33,10 +_,13 @@ LootItemCondition.DIRECT_CODEC.listOf().optionalFieldOf("conditions", List.of()).forGetter(p -> p.conditions), LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p -> p.functions), NumberProviders.CODEC.fieldOf("rolls").forGetter(p -> p.rolls), -- NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls) -+ NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls), +- NumberProviders.CODEC.optionalFieldOf("bonus_rolls", ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls) ++ NumberProviders.CODEC.optionalFieldOf("bonus_rolls", ConstantValue.exactly(0.0F)).forGetter(p -> p.bonusRolls), + Codec.STRING.optionalFieldOf("name").forGetter(p -> p.name.filter(n -> !n.startsWith("custom#"))), + net.minecraftforge.common.crafting.conditions.ICondition.OPTIONAL_FEILD_CODEC.forGetter(p -> p.forge_condition) ) @@ -15,7 +15,7 @@ private final List entries; private final List conditions; private final Predicate compositeCondition; -@@ -43,6 +_,8 @@ +@@ -44,6 +_,8 @@ private final BiFunction compositeFunction; private NumberProvider rolls; private NumberProvider bonusRolls; @@ -24,7 +24,7 @@ private LootPool( final List entries, -@@ -51,6 +_,18 @@ +@@ -52,6 +_,18 @@ final NumberProvider rolls, final NumberProvider bonusRolls ) { @@ -43,7 +43,7 @@ this.entries = entries; this.conditions = conditions; this.compositeCondition = Util.allOf(conditions); -@@ -58,6 +_,8 @@ +@@ -59,6 +_,8 @@ this.compositeFunction = LootItemFunctions.compose(functions); this.rolls = rolls; this.bonusRolls = bonusRolls; @@ -52,7 +52,7 @@ } private void addRandomItem(final Consumer result, final LootContext context) { -@@ -117,12 +_,35 @@ +@@ -118,12 +_,35 @@ return new LootPool.Builder(); } @@ -88,7 +88,7 @@ public LootPool.Builder setRolls(final NumberProvider rolls) { this.rolls = rolls; -@@ -153,8 +_,18 @@ +@@ -162,8 +_,18 @@ return this; } diff --git a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch b/rejects/net/minecraft/client/model/geom/ModelLayers.java.patch.rej similarity index 91% rename from patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch rename to rejects/net/minecraft/client/model/geom/ModelLayers.java.patch.rej index 7407aaa41c..ae7bea2237 100644 --- a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch +++ b/rejects/net/minecraft/client/model/geom/ModelLayers.java.patch.rej @@ -1,6 +1,5 @@ ---- a/net/minecraft/client/model/geom/ModelLayers.java -+++ b/net/minecraft/client/model/geom/ModelLayers.java -@@ -324,15 +_,18 @@ +++++ REJECTED HUNK: 1 +@@ -324,15 +324,18 @@ } public static ModelLayerLocation createStandingSignModelName(final WoodType type) { @@ -22,3 +21,4 @@ } public static Stream getKnownLocations() { +++++ END HUNK \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch b/rejects/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch similarity index 87% rename from patches/minecraft/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch rename to rejects/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch index bd1f2f3a48..560848f58a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch +++ b/rejects/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java.patch @@ -1,6 +1,7 @@ +++++ Target missing --- a/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java +++ b/net/minecraft/client/renderer/feature/BlockFeatureRenderer.java -@@ -153,7 +_,7 @@ +@@ -153,7 +153,7 @@ this.random.setSeed(submit.seed()); try { @@ -8,4 +9,4 @@ + submit.model().collectParts(this.random, this.parts, submit.data()); for (BlockStateModelPart part : this.parts) { - putPartQuads(part, submit.pose(), this.quadInstance, NO_TINT, buffer, null); + putPartQuads(part, submit.pose(), this.quadInstance, NO_TINT, buffer, null); \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch b/rejects/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch.rej similarity index 100% rename from patches/minecraft/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch rename to rejects/net/minecraft/client/renderer/rendertype/RenderSetup.java.patch.rej diff --git a/src/main/generated/data/c/tags/block/bars/copper.json b/src/main/generated/data/c/tags/block/bars/copper.json index 9364b27774..f11b169128 100644 --- a/src/main/generated/data/c/tags/block/bars/copper.json +++ b/src/main/generated/data/c/tags/block/bars/copper.json @@ -1,12 +1,12 @@ { "values": [ "minecraft:copper_bars", - "minecraft:waxed_copper_bars", "minecraft:exposed_copper_bars", - "minecraft:waxed_exposed_copper_bars", "minecraft:weathered_copper_bars", - "minecraft:waxed_weathered_copper_bars", "minecraft:oxidized_copper_bars", + "minecraft:waxed_copper_bars", + "minecraft:waxed_exposed_copper_bars", + "minecraft:waxed_weathered_copper_bars", "minecraft:waxed_oxidized_copper_bars" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/chains.json b/src/main/generated/data/c/tags/block/chains.json index 58c2b30a5a..daba291fc0 100644 --- a/src/main/generated/data/c/tags/block/chains.json +++ b/src/main/generated/data/c/tags/block/chains.json @@ -2,12 +2,12 @@ "values": [ "minecraft:iron_chain", "minecraft:copper_chain", - "minecraft:waxed_copper_chain", "minecraft:exposed_copper_chain", - "minecraft:waxed_exposed_copper_chain", "minecraft:weathered_copper_chain", - "minecraft:waxed_weathered_copper_chain", "minecraft:oxidized_copper_chain", + "minecraft:waxed_copper_chain", + "minecraft:waxed_exposed_copper_chain", + "minecraft:waxed_weathered_copper_chain", "minecraft:waxed_oxidized_copper_chain" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/chests.json b/src/main/generated/data/c/tags/block/chests.json index 16ea314685..192ace8c7f 100644 --- a/src/main/generated/data/c/tags/block/chests.json +++ b/src/main/generated/data/c/tags/block/chests.json @@ -1,6 +1,13 @@ { "values": [ "minecraft:copper_chest", + "minecraft:exposed_copper_chest", + "minecraft:weathered_copper_chest", + "minecraft:oxidized_copper_chest", + "minecraft:waxed_copper_chest", + "minecraft:waxed_exposed_copper_chest", + "minecraft:waxed_weathered_copper_chest", + "minecraft:waxed_oxidized_copper_chest", "#c:chests/ender", "#c:chests/trapped", "#c:chests/wooden" diff --git a/src/main/generated/data/c/tags/block/skulls.json b/src/main/generated/data/c/tags/block/skulls.json index a9820b074f..063402cdbf 100644 --- a/src/main/generated/data/c/tags/block/skulls.json +++ b/src/main/generated/data/c/tags/block/skulls.json @@ -1,18 +1,18 @@ { "values": [ "minecraft:skeleton_skull", - "minecraft:skeleton_wall_skull", "minecraft:wither_skeleton_skull", - "minecraft:wither_skeleton_wall_skull", "minecraft:player_head", - "minecraft:player_wall_head", "minecraft:zombie_head", - "minecraft:zombie_wall_head", "minecraft:creeper_head", - "minecraft:creeper_wall_head", "minecraft:piglin_head", - "minecraft:piglin_wall_head", "minecraft:dragon_head", + "minecraft:skeleton_wall_skull", + "minecraft:wither_skeleton_wall_skull", + "minecraft:player_wall_head", + "minecraft:zombie_wall_head", + "minecraft:creeper_wall_head", + "minecraft:piglin_wall_head", "minecraft:dragon_wall_head" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/storage_blocks/copper.json b/src/main/generated/data/c/tags/block/storage_blocks/copper.json index 015bec70c3..538486501f 100644 --- a/src/main/generated/data/c/tags/block/storage_blocks/copper.json +++ b/src/main/generated/data/c/tags/block/storage_blocks/copper.json @@ -1,5 +1,12 @@ { "values": [ - "minecraft:copper_block" + "minecraft:copper_block", + "minecraft:exposed_copper", + "minecraft:weathered_copper", + "minecraft:oxidized_copper", + "minecraft:waxed_copper_block", + "minecraft:waxed_exposed_copper", + "minecraft:waxed_weathered_copper", + "minecraft:waxed_oxidized_copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/block/villager_job_sites.json b/src/main/generated/data/c/tags/block/villager_job_sites.json index 859c128fce..714e373cca 100644 --- a/src/main/generated/data/c/tags/block/villager_job_sites.json +++ b/src/main/generated/data/c/tags/block/villager_job_sites.json @@ -5,9 +5,6 @@ "minecraft:brewing_stand", "minecraft:cartography_table", "minecraft:cauldron", - "minecraft:water_cauldron", - "minecraft:lava_cauldron", - "minecraft:powder_snow_cauldron", "minecraft:composter", "minecraft:fletching_table", "minecraft:grindstone", @@ -15,6 +12,9 @@ "minecraft:loom", "minecraft:smithing_table", "minecraft:smoker", - "minecraft:stonecutter" + "minecraft:stonecutter", + "minecraft:water_cauldron", + "minecraft:lava_cauldron", + "minecraft:powder_snow_cauldron" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/bars/copper.json b/src/main/generated/data/c/tags/item/bars/copper.json index 9364b27774..f11b169128 100644 --- a/src/main/generated/data/c/tags/item/bars/copper.json +++ b/src/main/generated/data/c/tags/item/bars/copper.json @@ -1,12 +1,12 @@ { "values": [ "minecraft:copper_bars", - "minecraft:waxed_copper_bars", "minecraft:exposed_copper_bars", - "minecraft:waxed_exposed_copper_bars", "minecraft:weathered_copper_bars", - "minecraft:waxed_weathered_copper_bars", "minecraft:oxidized_copper_bars", + "minecraft:waxed_copper_bars", + "minecraft:waxed_exposed_copper_bars", + "minecraft:waxed_weathered_copper_bars", "minecraft:waxed_oxidized_copper_bars" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/chains.json b/src/main/generated/data/c/tags/item/chains.json index 58c2b30a5a..daba291fc0 100644 --- a/src/main/generated/data/c/tags/item/chains.json +++ b/src/main/generated/data/c/tags/item/chains.json @@ -2,12 +2,12 @@ "values": [ "minecraft:iron_chain", "minecraft:copper_chain", - "minecraft:waxed_copper_chain", "minecraft:exposed_copper_chain", - "minecraft:waxed_exposed_copper_chain", "minecraft:weathered_copper_chain", - "minecraft:waxed_weathered_copper_chain", "minecraft:oxidized_copper_chain", + "minecraft:waxed_copper_chain", + "minecraft:waxed_exposed_copper_chain", + "minecraft:waxed_weathered_copper_chain", "minecraft:waxed_oxidized_copper_chain" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/chests.json b/src/main/generated/data/c/tags/item/chests.json index 16ea314685..192ace8c7f 100644 --- a/src/main/generated/data/c/tags/item/chests.json +++ b/src/main/generated/data/c/tags/item/chests.json @@ -1,6 +1,13 @@ { "values": [ "minecraft:copper_chest", + "minecraft:exposed_copper_chest", + "minecraft:weathered_copper_chest", + "minecraft:oxidized_copper_chest", + "minecraft:waxed_copper_chest", + "minecraft:waxed_exposed_copper_chest", + "minecraft:waxed_weathered_copper_chest", + "minecraft:waxed_oxidized_copper_chest", "#c:chests/ender", "#c:chests/trapped", "#c:chests/wooden" diff --git a/src/main/generated/data/c/tags/item/foods/vegetable.json b/src/main/generated/data/c/tags/item/foods/vegetable.json index 17ecdb1ca6..d48dd4228c 100644 --- a/src/main/generated/data/c/tags/item/foods/vegetable.json +++ b/src/main/generated/data/c/tags/item/foods/vegetable.json @@ -1,8 +1,8 @@ { "values": [ - "minecraft:carrot", "minecraft:golden_carrot", - "minecraft:potato", - "minecraft:beetroot" + "minecraft:beetroot", + "minecraft:carrot", + "minecraft:potato" ] } \ No newline at end of file diff --git a/src/main/generated/data/c/tags/item/storage_blocks/copper.json b/src/main/generated/data/c/tags/item/storage_blocks/copper.json index 015bec70c3..538486501f 100644 --- a/src/main/generated/data/c/tags/item/storage_blocks/copper.json +++ b/src/main/generated/data/c/tags/item/storage_blocks/copper.json @@ -1,5 +1,12 @@ { "values": [ - "minecraft:copper_block" + "minecraft:copper_block", + "minecraft:exposed_copper", + "minecraft:weathered_copper", + "minecraft:oxidized_copper", + "minecraft:waxed_copper_block", + "minecraft:waxed_exposed_copper", + "minecraft:waxed_weathered_copper", + "minecraft:waxed_oxidized_copper" ] } \ No newline at end of file diff --git a/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json index 6b168e6299..76b0651a2d 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/acacia_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json index 728ca83253..e2688d9d93 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json index bc635e84ac..d785dae910 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/birch_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/bush.json b/src/main/generated/data/minecraft/loot_table/blocks/bush.json index f339200a8c..ec187ebbd4 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/bush.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/bush.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json index c5ffbbd7b3..2b06aae023 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/cherry_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json b/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json index 0fc81358f5..dccc612281 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/cobweb.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json index c866e9aa27..835b4f54ba 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/dark_oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, @@ -128,7 +125,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json b/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json index 1f9d8b5378..fa44726bc4 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/dead_bush.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -21,7 +20,6 @@ "type": "minecraft:item", "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/fern.json b/src/main/generated/data/minecraft/loot_table/blocks/fern.json index e89145df53..de279d9d4e 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/fern.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/fern.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json index db47a087d9..d284eafbc5 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/flowering_azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json b/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json index 5415d24862..56563b3457 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/glow_lichen.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json b/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json index 6e84cafd44..da9a870588 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/hanging_roots.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json index d56cdc0697..2901f7814f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/jungle_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -63,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -111,7 +109,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json b/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json index 22b7513724..4dbcfcfd5f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/large_fern.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:large_fern", @@ -38,7 +37,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } @@ -64,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:large_fern", @@ -100,7 +97,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json index 4601627c2a..ab53c93864 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/mangrove_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -54,7 +53,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json b/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json index d0aee8945e..67258724b2 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/nether_sprouts.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json index 59c4a3c458..69933a1855 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, @@ -128,7 +125,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json b/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json index a186e96ba4..ddaef52c33 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/pale_hanging_moss.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json index 8e75c5a242..7e9ae46ff0 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/pale_oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json b/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json index 383923d251..c806404eaa 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/seagrass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json index 84f1103b9b..073531704f 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/short_dry_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json index c75f40d2fe..6c1b1492fb 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/short_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json b/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json index e7bb2ff6d1..c7aa5e9724 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/small_dripleaf.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json b/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json index 70115ff27f..40d83f352e 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/spruce_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -62,7 +61,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -110,7 +108,6 @@ ], "functions": [ { - "add": false, "count": { "type": "minecraft:uniform", "max": 2.0, diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json index 0bf2a9912d..cfc332693c 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_dry_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:any_of", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json index 4391e321ef..d0c7d31e68 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:tall_grass", @@ -38,7 +37,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } @@ -64,7 +62,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "conditions": [ { "block": "minecraft:tall_grass", @@ -100,7 +97,6 @@ ], "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json b/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json index fa8d199f02..452880c35b 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/tall_seagrass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", @@ -14,7 +13,6 @@ "type": "minecraft:item", "functions": [ { - "add": false, "count": 2.0, "function": "minecraft:set_count" } diff --git a/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json b/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json index add7780f43..543c463516 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/twisting_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/vine.json b/src/main/generated/data/minecraft/loot_table/blocks/vine.json index 94c46af2c1..5fc89d2081 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/vine.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/vine.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "action": "shears_dig", diff --git a/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json b/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json index d782c26b41..ab00aeccc5 100644 --- a/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json +++ b/src/main/generated/data/minecraft/loot_table/blocks/weeping_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", diff --git a/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json b/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json index ccdd3c5ead..eb2e6f98f0 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/acacia_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/acacia_fence.json b/src/main/generated/data/minecraft/recipe/acacia_fence.json index abc4d37cba..6c6a000970 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_fence.json +++ b/src/main/generated/data/minecraft/recipe/acacia_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/acacia_sign.json b/src/main/generated/data/minecraft/recipe/acacia_sign.json index 3232b1b89a..8a03c68de4 100644 --- a/src/main/generated/data/minecraft/recipe/acacia_sign.json +++ b/src/main/generated/data/minecraft/recipe/acacia_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:acacia_planks", diff --git a/src/main/generated/data/minecraft/recipe/activator_rail.json b/src/main/generated/data/minecraft/recipe/activator_rail.json index 555bb300db..4fa1b01904 100644 --- a/src/main/generated/data/minecraft/recipe/activator_rail.json +++ b/src/main/generated/data/minecraft/recipe/activator_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:redstone_torch", "S": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/anvil.json b/src/main/generated/data/minecraft/recipe/anvil.json index b6bbfbf821..fc40541868 100644 --- a/src/main/generated/data/minecraft/recipe/anvil.json +++ b/src/main/generated/data/minecraft/recipe/anvil.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "minecraft:iron_block", "i": "#c:ingots/iron" diff --git a/src/main/generated/data/minecraft/recipe/armor_stand.json b/src/main/generated/data/minecraft/recipe/armor_stand.json index 938c8d80c4..09aaff0756 100644 --- a/src/main/generated/data/minecraft/recipe/armor_stand.json +++ b/src/main/generated/data/minecraft/recipe/armor_stand.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "/": "#c:rods/wooden", "_": "minecraft:smooth_stone_slab" diff --git a/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json b/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json index eb6bf0e6c7..bcaa8136ee 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_chest_raft.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/bamboo_fence.json b/src/main/generated/data/minecraft/recipe/bamboo_fence.json index d36413016a..9730b110af 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_fence.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/bamboo_sign.json b/src/main/generated/data/minecraft/recipe/bamboo_sign.json index 79d256d984..ae6b9c61e8 100644 --- a/src/main/generated/data/minecraft/recipe/bamboo_sign.json +++ b/src/main/generated/data/minecraft/recipe/bamboo_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:bamboo_planks", diff --git a/src/main/generated/data/minecraft/recipe/birch_chest_boat.json b/src/main/generated/data/minecraft/recipe/birch_chest_boat.json index fb964e091f..f887571b42 100644 --- a/src/main/generated/data/minecraft/recipe/birch_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/birch_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/birch_fence.json b/src/main/generated/data/minecraft/recipe/birch_fence.json index f340e905c3..ecf986d15e 100644 --- a/src/main/generated/data/minecraft/recipe/birch_fence.json +++ b/src/main/generated/data/minecraft/recipe/birch_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/birch_sign.json b/src/main/generated/data/minecraft/recipe/birch_sign.json index 94b286ed75..f74bb206c3 100644 --- a/src/main/generated/data/minecraft/recipe/birch_sign.json +++ b/src/main/generated/data/minecraft/recipe/birch_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:birch_planks", diff --git a/src/main/generated/data/minecraft/recipe/black_banner.json b/src/main/generated/data/minecraft/recipe/black_banner.json index 20fa2d9737..bbc855b37f 100644 --- a/src/main/generated/data/minecraft/recipe/black_banner.json +++ b/src/main/generated/data/minecraft/recipe/black_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:black_wool", diff --git a/src/main/generated/data/minecraft/recipe/blast_furnace.json b/src/main/generated/data/minecraft/recipe/blast_furnace.json index e6d456e1d3..6aca85ac79 100644 --- a/src/main/generated/data/minecraft/recipe/blast_furnace.json +++ b/src/main/generated/data/minecraft/recipe/blast_furnace.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:smooth_stone", "I": "#c:ingots/iron", diff --git a/src/main/generated/data/minecraft/recipe/blue_banner.json b/src/main/generated/data/minecraft/recipe/blue_banner.json index ef898a8586..e529c7eb88 100644 --- a/src/main/generated/data/minecraft/recipe/blue_banner.json +++ b/src/main/generated/data/minecraft/recipe/blue_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:blue_wool", diff --git a/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json index e5db16797d..628de82168 100644 --- a/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/bolt_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": [ diff --git a/src/main/generated/data/minecraft/recipe/brown_banner.json b/src/main/generated/data/minecraft/recipe/brown_banner.json index 4fe52af768..ff3b670602 100644 --- a/src/main/generated/data/minecraft/recipe/brown_banner.json +++ b/src/main/generated/data/minecraft/recipe/brown_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:brown_wool", diff --git a/src/main/generated/data/minecraft/recipe/bucket.json b/src/main/generated/data/minecraft/recipe/bucket.json index 98599240ce..447b848ac1 100644 --- a/src/main/generated/data/minecraft/recipe/bucket.json +++ b/src/main/generated/data/minecraft/recipe/bucket.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, diff --git a/src/main/generated/data/minecraft/recipe/campfire.json b/src/main/generated/data/minecraft/recipe/campfire.json index 93372c24ec..10da3b72d2 100644 --- a/src/main/generated/data/minecraft/recipe/campfire.json +++ b/src/main/generated/data/minecraft/recipe/campfire.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "C": "#minecraft:coals", "L": "#minecraft:logs", diff --git a/src/main/generated/data/minecraft/recipe/candle.json b/src/main/generated/data/minecraft/recipe/candle.json index 953a680359..9e9b03ea16 100644 --- a/src/main/generated/data/minecraft/recipe/candle.json +++ b/src/main/generated/data/minecraft/recipe/candle.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "H": "minecraft:honeycomb", "S": "#c:strings" diff --git a/src/main/generated/data/minecraft/recipe/cauldron.json b/src/main/generated/data/minecraft/recipe/cauldron.json index 936cc35ecb..e4f76c54fb 100644 --- a/src/main/generated/data/minecraft/recipe/cauldron.json +++ b/src/main/generated/data/minecraft/recipe/cauldron.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, diff --git a/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json b/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json index 841e525c6b..ab5750cbd1 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/cherry_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/cherry_fence.json b/src/main/generated/data/minecraft/recipe/cherry_fence.json index 9866480fe0..b1d0626d72 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_fence.json +++ b/src/main/generated/data/minecraft/recipe/cherry_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/cherry_sign.json b/src/main/generated/data/minecraft/recipe/cherry_sign.json index 000659bd4a..febe767664 100644 --- a/src/main/generated/data/minecraft/recipe/cherry_sign.json +++ b/src/main/generated/data/minecraft/recipe/cherry_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:cherry_planks", diff --git a/src/main/generated/data/minecraft/recipe/chest_minecart.json b/src/main/generated/data/minecraft/recipe/chest_minecart.json index 53958c8406..adbeb2d5cb 100644 --- a/src/main/generated/data/minecraft/recipe/chest_minecart.json +++ b/src/main/generated/data/minecraft/recipe/chest_minecart.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "#c:chests/wooden", "minecraft:minecart" diff --git a/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json index 91af5fbabf..680d59584f 100644 --- a/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/coast_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "#c:cobblestones/normal", diff --git a/src/main/generated/data/minecraft/recipe/copper_bars.json b/src/main/generated/data/minecraft/recipe/copper_bars.json index 57c1a88ba8..20d2045949 100644 --- a/src/main/generated/data/minecraft/recipe/copper_bars.json +++ b/src/main/generated/data/minecraft/recipe/copper_bars.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/copper" }, diff --git a/src/main/generated/data/minecraft/recipe/copper_chain.json b/src/main/generated/data/minecraft/recipe/copper_chain.json index 51909893cd..4abf563b44 100644 --- a/src/main/generated/data/minecraft/recipe/copper_chain.json +++ b/src/main/generated/data/minecraft/recipe/copper_chain.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "#c:ingots/copper", "N": "minecraft:copper_nugget" diff --git a/src/main/generated/data/minecraft/recipe/copper_chest.json b/src/main/generated/data/minecraft/recipe/copper_chest.json index 786c2104a4..440f5201a8 100644 --- a/src/main/generated/data/minecraft/recipe/copper_chest.json +++ b/src/main/generated/data/minecraft/recipe/copper_chest.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/copper", "X": "#c:chests/wooden" diff --git a/src/main/generated/data/minecraft/recipe/copper_nugget.json b/src/main/generated/data/minecraft/recipe/copper_nugget.json index 6309a958a8..43f2d8b76e 100644 --- a/src/main/generated/data/minecraft/recipe/copper_nugget.json +++ b/src/main/generated/data/minecraft/recipe/copper_nugget.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "#c:ingots/copper" ], diff --git a/src/main/generated/data/minecraft/recipe/copper_torch.json b/src/main/generated/data/minecraft/recipe/copper_torch.json index 4bde6043d5..a6d835a1c5 100644 --- a/src/main/generated/data/minecraft/recipe/copper_torch.json +++ b/src/main/generated/data/minecraft/recipe/copper_torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "C": "minecraft:copper_nugget", diff --git a/src/main/generated/data/minecraft/recipe/crimson_fence.json b/src/main/generated/data/minecraft/recipe/crimson_fence.json index 20e9d8a6e3..1bef1ecd26 100644 --- a/src/main/generated/data/minecraft/recipe/crimson_fence.json +++ b/src/main/generated/data/minecraft/recipe/crimson_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/crimson_sign.json b/src/main/generated/data/minecraft/recipe/crimson_sign.json index b175242019..d89fbe0ad2 100644 --- a/src/main/generated/data/minecraft/recipe/crimson_sign.json +++ b/src/main/generated/data/minecraft/recipe/crimson_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:crimson_planks", diff --git a/src/main/generated/data/minecraft/recipe/cyan_banner.json b/src/main/generated/data/minecraft/recipe/cyan_banner.json index 39eab34e3e..b6c3fcb7b0 100644 --- a/src/main/generated/data/minecraft/recipe/cyan_banner.json +++ b/src/main/generated/data/minecraft/recipe/cyan_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:cyan_wool", diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json index 0cb611b14e..cda05e602b 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_fence.json b/src/main/generated/data/minecraft/recipe/dark_oak_fence.json index d5c3933be8..0104840445 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/dark_oak_sign.json b/src/main/generated/data/minecraft/recipe/dark_oak_sign.json index aeb6ace8bf..0905d76807 100644 --- a/src/main/generated/data/minecraft/recipe/dark_oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/dark_oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:dark_oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/detector_rail.json b/src/main/generated/data/minecraft/recipe/detector_rail.json index aa0d8b1f83..b7fc13cdcd 100644 --- a/src/main/generated/data/minecraft/recipe/detector_rail.json +++ b/src/main/generated/data/minecraft/recipe/detector_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:stone_pressure_plate", "R": "minecraft:redstone", diff --git a/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json index a732119fe5..f1a0c7f59c 100644 --- a/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/dune_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:sandstone", diff --git a/src/main/generated/data/minecraft/recipe/enchanting_table.json b/src/main/generated/data/minecraft/recipe/enchanting_table.json index bfe6ac2770..55908f490a 100644 --- a/src/main/generated/data/minecraft/recipe/enchanting_table.json +++ b/src/main/generated/data/minecraft/recipe/enchanting_table.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:obsidian", "B": "minecraft:book", diff --git a/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json index 24c0e2e4ad..30e1a0feb8 100644 --- a/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/eye_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:end_stone", diff --git a/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json index 958fdf6b4c..c625dfd37c 100644 --- a/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/flow_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:breeze_rod", diff --git a/src/main/generated/data/minecraft/recipe/golden_apple.json b/src/main/generated/data/minecraft/recipe/golden_apple.json index bc73ddf140..b7446f43e0 100644 --- a/src/main/generated/data/minecraft/recipe/golden_apple.json +++ b/src/main/generated/data/minecraft/recipe/golden_apple.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/gold", "X": "minecraft:apple" diff --git a/src/main/generated/data/minecraft/recipe/gray_banner.json b/src/main/generated/data/minecraft/recipe/gray_banner.json index 5b383dfe15..a257155230 100644 --- a/src/main/generated/data/minecraft/recipe/gray_banner.json +++ b/src/main/generated/data/minecraft/recipe/gray_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:gray_wool", diff --git a/src/main/generated/data/minecraft/recipe/green_banner.json b/src/main/generated/data/minecraft/recipe/green_banner.json index b39debf52e..05a5f5d812 100644 --- a/src/main/generated/data/minecraft/recipe/green_banner.json +++ b/src/main/generated/data/minecraft/recipe/green_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:green_wool", diff --git a/src/main/generated/data/minecraft/recipe/grindstone.json b/src/main/generated/data/minecraft/recipe/grindstone.json index 7bfe1abe16..92c80c562b 100644 --- a/src/main/generated/data/minecraft/recipe/grindstone.json +++ b/src/main/generated/data/minecraft/recipe/grindstone.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "-": "minecraft:stone_slab", diff --git a/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json index ae84d48cc6..f6c673ad85 100644 --- a/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/host_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/iron_bars.json b/src/main/generated/data/minecraft/recipe/iron_bars.json index e33ecdcc4f..9ff84ac625 100644 --- a/src/main/generated/data/minecraft/recipe/iron_bars.json +++ b/src/main/generated/data/minecraft/recipe/iron_bars.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, diff --git a/src/main/generated/data/minecraft/recipe/iron_chain.json b/src/main/generated/data/minecraft/recipe/iron_chain.json index 6ca1a0bda5..cc7b7e3449 100644 --- a/src/main/generated/data/minecraft/recipe/iron_chain.json +++ b/src/main/generated/data/minecraft/recipe/iron_chain.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "#c:ingots/iron", "N": "minecraft:iron_nugget" diff --git a/src/main/generated/data/minecraft/recipe/item_frame.json b/src/main/generated/data/minecraft/recipe/item_frame.json index 3cbb9b2183..e553296ccd 100644 --- a/src/main/generated/data/minecraft/recipe/item_frame.json +++ b/src/main/generated/data/minecraft/recipe/item_frame.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "minecraft:leather" diff --git a/src/main/generated/data/minecraft/recipe/jukebox.json b/src/main/generated/data/minecraft/recipe/jukebox.json index 389ac126c8..eb3d291fdd 100644 --- a/src/main/generated/data/minecraft/recipe/jukebox.json +++ b/src/main/generated/data/minecraft/recipe/jukebox.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "X": "#c:gems/diamond" diff --git a/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json b/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json index 70883bace5..5478d47d17 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/jungle_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/jungle_fence.json b/src/main/generated/data/minecraft/recipe/jungle_fence.json index dc919dea44..b8b91627bd 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_fence.json +++ b/src/main/generated/data/minecraft/recipe/jungle_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/jungle_sign.json b/src/main/generated/data/minecraft/recipe/jungle_sign.json index 9c22e2bcd1..9033e56d3b 100644 --- a/src/main/generated/data/minecraft/recipe/jungle_sign.json +++ b/src/main/generated/data/minecraft/recipe/jungle_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:jungle_planks", diff --git a/src/main/generated/data/minecraft/recipe/ladder.json b/src/main/generated/data/minecraft/recipe/ladder.json index 0aefdd0268..ffd1098465 100644 --- a/src/main/generated/data/minecraft/recipe/ladder.json +++ b/src/main/generated/data/minecraft/recipe/ladder.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden" }, diff --git a/src/main/generated/data/minecraft/recipe/light_blue_banner.json b/src/main/generated/data/minecraft/recipe/light_blue_banner.json index 94fa7b212c..166356a244 100644 --- a/src/main/generated/data/minecraft/recipe/light_blue_banner.json +++ b/src/main/generated/data/minecraft/recipe/light_blue_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:light_blue_wool", diff --git a/src/main/generated/data/minecraft/recipe/light_gray_banner.json b/src/main/generated/data/minecraft/recipe/light_gray_banner.json index e1a2400e0b..711327e1a9 100644 --- a/src/main/generated/data/minecraft/recipe/light_gray_banner.json +++ b/src/main/generated/data/minecraft/recipe/light_gray_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:light_gray_wool", diff --git a/src/main/generated/data/minecraft/recipe/lime_banner.json b/src/main/generated/data/minecraft/recipe/lime_banner.json index 828ccfcb50..19685f6245 100644 --- a/src/main/generated/data/minecraft/recipe/lime_banner.json +++ b/src/main/generated/data/minecraft/recipe/lime_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:lime_wool", diff --git a/src/main/generated/data/minecraft/recipe/lodestone.json b/src/main/generated/data/minecraft/recipe/lodestone.json index 8b353b4504..d2a7d4a61c 100644 --- a/src/main/generated/data/minecraft/recipe/lodestone.json +++ b/src/main/generated/data/minecraft/recipe/lodestone.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron", "S": "minecraft:chiseled_stone_bricks" diff --git a/src/main/generated/data/minecraft/recipe/loom.json b/src/main/generated/data/minecraft/recipe/loom.json index 21b2fa928a..f4e54b62d5 100644 --- a/src/main/generated/data/minecraft/recipe/loom.json +++ b/src/main/generated/data/minecraft/recipe/loom.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "@": "#c:strings" diff --git a/src/main/generated/data/minecraft/recipe/magenta_banner.json b/src/main/generated/data/minecraft/recipe/magenta_banner.json index b0fee202d5..5eb547b59a 100644 --- a/src/main/generated/data/minecraft/recipe/magenta_banner.json +++ b/src/main/generated/data/minecraft/recipe/magenta_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:magenta_wool", diff --git a/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json b/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json index 47eab0678b..219b9e30e5 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/mangrove_fence.json b/src/main/generated/data/minecraft/recipe/mangrove_fence.json index f939810940..efda31e05f 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_fence.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/mangrove_sign.json b/src/main/generated/data/minecraft/recipe/mangrove_sign.json index 2c1eeab8a2..d232b6519e 100644 --- a/src/main/generated/data/minecraft/recipe/mangrove_sign.json +++ b/src/main/generated/data/minecraft/recipe/mangrove_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:mangrove_planks", diff --git a/src/main/generated/data/minecraft/recipe/minecart.json b/src/main/generated/data/minecraft/recipe/minecart.json index 1ba7653387..5bd1dcdeac 100644 --- a/src/main/generated/data/minecraft/recipe/minecart.json +++ b/src/main/generated/data/minecraft/recipe/minecart.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:ingots/iron" }, diff --git a/src/main/generated/data/minecraft/recipe/netherite_ingot.json b/src/main/generated/data/minecraft/recipe/netherite_ingot.json index b99430fe50..1d8fba0d64 100644 --- a/src/main/generated/data/minecraft/recipe/netherite_ingot.json +++ b/src/main/generated/data/minecraft/recipe/netherite_ingot.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "netherite_ingot", "ingredients": [ "minecraft:netherite_scrap", diff --git a/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json b/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json index aa03072c28..1527cf530b 100644 --- a/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/netherite_upgrade_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:netherrack", diff --git a/src/main/generated/data/minecraft/recipe/oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/oak_chest_boat.json index 135b0d1cb7..35eaedd589 100644 --- a/src/main/generated/data/minecraft/recipe/oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/oak_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/oak_fence.json b/src/main/generated/data/minecraft/recipe/oak_fence.json index b3684fd871..841737af50 100644 --- a/src/main/generated/data/minecraft/recipe/oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/oak_sign.json b/src/main/generated/data/minecraft/recipe/oak_sign.json index 1692e49e39..37d025c615 100644 --- a/src/main/generated/data/minecraft/recipe/oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/orange_banner.json b/src/main/generated/data/minecraft/recipe/orange_banner.json index 22de227ea5..46a0917e02 100644 --- a/src/main/generated/data/minecraft/recipe/orange_banner.json +++ b/src/main/generated/data/minecraft/recipe/orange_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:orange_wool", diff --git a/src/main/generated/data/minecraft/recipe/painting.json b/src/main/generated/data/minecraft/recipe/painting.json index b8497c2de4..6f64524c95 100644 --- a/src/main/generated/data/minecraft/recipe/painting.json +++ b/src/main/generated/data/minecraft/recipe/painting.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "#minecraft:wool" diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json b/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json index b75a6247d3..ab238d2548 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_fence.json b/src/main/generated/data/minecraft/recipe/pale_oak_fence.json index c4a34ad537..a45cc02b9d 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_fence.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/pale_oak_sign.json b/src/main/generated/data/minecraft/recipe/pale_oak_sign.json index ac471218f3..dfa9f8e208 100644 --- a/src/main/generated/data/minecraft/recipe/pale_oak_sign.json +++ b/src/main/generated/data/minecraft/recipe/pale_oak_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:pale_oak_planks", diff --git a/src/main/generated/data/minecraft/recipe/pink_banner.json b/src/main/generated/data/minecraft/recipe/pink_banner.json index b0640cb8ef..1ec35a93c2 100644 --- a/src/main/generated/data/minecraft/recipe/pink_banner.json +++ b/src/main/generated/data/minecraft/recipe/pink_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:pink_wool", diff --git a/src/main/generated/data/minecraft/recipe/powered_rail.json b/src/main/generated/data/minecraft/recipe/powered_rail.json index 40d834f692..98d2889b68 100644 --- a/src/main/generated/data/minecraft/recipe/powered_rail.json +++ b/src/main/generated/data/minecraft/recipe/powered_rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "R": "minecraft:redstone", diff --git a/src/main/generated/data/minecraft/recipe/purple_banner.json b/src/main/generated/data/minecraft/recipe/purple_banner.json index 8f1b072de3..21aae0f5ea 100644 --- a/src/main/generated/data/minecraft/recipe/purple_banner.json +++ b/src/main/generated/data/minecraft/recipe/purple_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:purple_wool", diff --git a/src/main/generated/data/minecraft/recipe/rail.json b/src/main/generated/data/minecraft/recipe/rail.json index b9ed74f2f2..0a3e60e760 100644 --- a/src/main/generated/data/minecraft/recipe/rail.json +++ b/src/main/generated/data/minecraft/recipe/rail.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": "#c:ingots/iron" diff --git a/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json index f49dd8b54a..4fb9ee682a 100644 --- a/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/raiser_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/red_banner.json b/src/main/generated/data/minecraft/recipe/red_banner.json index 16e01ce497..d1a839d900 100644 --- a/src/main/generated/data/minecraft/recipe/red_banner.json +++ b/src/main/generated/data/minecraft/recipe/red_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:red_wool", diff --git a/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json index f99a49c84f..98a267e64d 100644 --- a/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/rib_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:netherrack", diff --git a/src/main/generated/data/minecraft/recipe/scaffolding.json b/src/main/generated/data/minecraft/recipe/scaffolding.json index 1393f3b416..6ca014d1bc 100644 --- a/src/main/generated/data/minecraft/recipe/scaffolding.json +++ b/src/main/generated/data/minecraft/recipe/scaffolding.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "I": "minecraft:bamboo", "~": "#c:strings" diff --git a/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json index e0a1a2a451..a0307a6d17 100644 --- a/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/sentry_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "#c:cobblestones/normal", diff --git a/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json index e1f08a5ca1..db0aa56270 100644 --- a/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/shaper_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/shulker_box.json b/src/main/generated/data/minecraft/recipe/shulker_box.json index 7b35303f6e..fa88e88e2c 100644 --- a/src/main/generated/data/minecraft/recipe/shulker_box.json +++ b/src/main/generated/data/minecraft/recipe/shulker_box.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:chests/wooden", "-": "minecraft:shulker_shell" diff --git a/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json index 364cdd75a6..20a9278cf3 100644 --- a/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/silence_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "#c:cobblestones/deepslate", diff --git a/src/main/generated/data/minecraft/recipe/smithing_table.json b/src/main/generated/data/minecraft/recipe/smithing_table.json index 4642066634..d745c68519 100644 --- a/src/main/generated/data/minecraft/recipe/smithing_table.json +++ b/src/main/generated/data/minecraft/recipe/smithing_table.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:planks", "@": "#c:ingots/iron" diff --git a/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json index 8f24674fdd..f99ecffc0f 100644 --- a/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/snout_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:blackstone", diff --git a/src/main/generated/data/minecraft/recipe/soul_campfire.json b/src/main/generated/data/minecraft/recipe/soul_campfire.json index a5630fbfe5..d683caea06 100644 --- a/src/main/generated/data/minecraft/recipe/soul_campfire.json +++ b/src/main/generated/data/minecraft/recipe/soul_campfire.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#minecraft:soul_fire_base_blocks", "L": "#minecraft:logs", diff --git a/src/main/generated/data/minecraft/recipe/soul_torch.json b/src/main/generated/data/minecraft/recipe/soul_torch.json index 89fba8cfe0..9c373bb794 100644 --- a/src/main/generated/data/minecraft/recipe/soul_torch.json +++ b/src/main/generated/data/minecraft/recipe/soul_torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "S": "#minecraft:soul_fire_base_blocks", diff --git a/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json index a4f55cc155..76ac8903bd 100644 --- a/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/spire_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:purpur_block", diff --git a/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json b/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json index 80f4e6e72b..49c8cf18c8 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json +++ b/src/main/generated/data/minecraft/recipe/spruce_chest_boat.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shapeless", - "category": "misc", "group": "chest_boat", "ingredients": [ "#c:chests/wooden", diff --git a/src/main/generated/data/minecraft/recipe/spruce_fence.json b/src/main/generated/data/minecraft/recipe/spruce_fence.json index f84b63a72b..804b3b538a 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_fence.json +++ b/src/main/generated/data/minecraft/recipe/spruce_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/spruce_sign.json b/src/main/generated/data/minecraft/recipe/spruce_sign.json index 58046b4828..9a020a7592 100644 --- a/src/main/generated/data/minecraft/recipe/spruce_sign.json +++ b/src/main/generated/data/minecraft/recipe/spruce_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:spruce_planks", diff --git a/src/main/generated/data/minecraft/recipe/stonecutter.json b/src/main/generated/data/minecraft/recipe/stonecutter.json index 1d1c6a2e34..596ee798c0 100644 --- a/src/main/generated/data/minecraft/recipe/stonecutter.json +++ b/src/main/generated/data/minecraft/recipe/stonecutter.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "minecraft:stone", "I": "#c:ingots/iron" diff --git a/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json index 4f4f0feec4..802def7aad 100644 --- a/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/tide_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:prismarine", diff --git a/src/main/generated/data/minecraft/recipe/torch.json b/src/main/generated/data/minecraft/recipe/torch.json index 442a61780e..9ed89552aa 100644 --- a/src/main/generated/data/minecraft/recipe/torch.json +++ b/src/main/generated/data/minecraft/recipe/torch.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:rods/wooden", "X": [ diff --git a/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json index 33b599c546..0717a4ef69 100644 --- a/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/vex_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "#c:cobblestones/normal", diff --git a/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json index 9a4b94b40f..78cbdb841a 100644 --- a/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/ward_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "#c:cobblestones/deepslate", diff --git a/src/main/generated/data/minecraft/recipe/warped_fence.json b/src/main/generated/data/minecraft/recipe/warped_fence.json index 54684ffb50..cbc3eb97e5 100644 --- a/src/main/generated/data/minecraft/recipe/warped_fence.json +++ b/src/main/generated/data/minecraft/recipe/warped_fence.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_fence", "key": { "#": "#c:rods/wooden", diff --git a/src/main/generated/data/minecraft/recipe/warped_sign.json b/src/main/generated/data/minecraft/recipe/warped_sign.json index fd63852c3b..b9cc43590e 100644 --- a/src/main/generated/data/minecraft/recipe/warped_sign.json +++ b/src/main/generated/data/minecraft/recipe/warped_sign.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "wooden_sign", "key": { "#": "minecraft:warped_planks", diff --git a/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json index 3c93a650a0..b21c78e691 100644 --- a/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/wayfinder_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:terracotta", diff --git a/src/main/generated/data/minecraft/recipe/white_banner.json b/src/main/generated/data/minecraft/recipe/white_banner.json index fcae720d40..d4061a1300 100644 --- a/src/main/generated/data/minecraft/recipe/white_banner.json +++ b/src/main/generated/data/minecraft/recipe/white_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:white_wool", diff --git a/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json b/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json index 0048eb4531..7a7d4dd58f 100644 --- a/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json +++ b/src/main/generated/data/minecraft/recipe/wild_armor_trim_smithing_template.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "#": "#c:gems/diamond", "C": "minecraft:mossy_cobblestone", diff --git a/src/main/generated/data/minecraft/recipe/yellow_banner.json b/src/main/generated/data/minecraft/recipe/yellow_banner.json index 6b72a8f64a..f33512542b 100644 --- a/src/main/generated/data/minecraft/recipe/yellow_banner.json +++ b/src/main/generated/data/minecraft/recipe/yellow_banner.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "group": "banner", "key": { "#": "minecraft:yellow_wool", diff --git a/src/main/generated/pack.mcmeta b/src/main/generated/pack.mcmeta index 8161ff9d70..ed943be2fb 100644 --- a/src/main/generated/pack.mcmeta +++ b/src/main/generated/pack.mcmeta @@ -3,9 +3,9 @@ "description": { "translate": "pack.forge.description" }, - "max_format": 101, + "max_format": 107, "min_format": [ - 101, + 107, 1 ] } diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index e758aa8aed..0c606ea277 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -16,7 +16,6 @@ import com.mojang.brigadier.tree.RootCommandNode; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.multiplayer.ClientSuggestionProvider; import net.minecraft.client.player.LocalPlayer; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSource; @@ -26,7 +25,6 @@ import net.minecraft.commands.synchronization.SuggestionProviders; import net.minecraft.network.chat.*; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.RegisterClientCommandsEvent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.server.command.CommandHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -71,12 +69,12 @@ public class ClientCommandHandler { copy(serverCommandsRoot, newServerCommands.getRoot()); // Copies the client side commands into the server side commands to be used for suggestions - CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (context) -> 0, (suggestions) -> { + CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (_) -> 0, (suggestions) -> { @SuppressWarnings("unchecked") var shared = (SuggestionProvider)(SuggestionProvider)suggestions; var suggestionProvider = shared; //SuggestionProviders.safelySwap(shared); if (suggestionProvider == SuggestionProviders.ASK_SERVER) { - suggestionProvider = (context, builder) -> { + suggestionProvider = (context, _) -> { ClientCommandSourceStack source = getSource(); StringReader reader = new StringReader(context.getInput()); if (reader.canRead() && reader.peek() == '/') @@ -109,7 +107,7 @@ public class ClientCommandHandler { new CommandSource() { @Override public void sendSystemMessage(Component message) { - mc.gui.getChat().addClientSystemMessage(message); + mc.gui.hud.getChat().addClientSystemMessage(message); } @Override @@ -188,7 +186,7 @@ public class ClientCommandHandler { // in case of unknown command, let the server try and handle it return false; } - mc.gui.getChat().addClientSystemMessage( + mc.gui.hud.getChat().addClientSystemMessage( Component.literal("").append(ComponentUtils.fromMessage(syntax.getRawMessage())).withStyle(ChatFormatting.RED) ); if (syntax.getInput() != null && syntax.getCursor() >= 0) { @@ -205,11 +203,11 @@ public class ClientCommandHandler { details.append(Component.literal(syntax.getInput().substring(position)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE)); details.append(Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); - mc.gui.getChat().addClientSystemMessage(Component.literal("").append(details).withStyle(ChatFormatting.RED)); + mc.gui.hud.getChat().addClientSystemMessage(Component.literal("").append(details).withStyle(ChatFormatting.RED)); } } catch (Exception generic) { // Probably thrown by the command{ MutableComponent message = Component.literal(generic.getMessage() == null ? generic.getClass().getName() : generic.getMessage()); - mc.gui.getChat().addClientSystemMessage( + mc.gui.hud.getChat().addClientSystemMessage( Component.translatable("command.failed") .withStyle(ChatFormatting.RED) .withStyle(style -> style.withHoverEvent(new HoverEvent.ShowText(message))) diff --git a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java index 88cd02a06c..3affac5f77 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java @@ -41,7 +41,7 @@ public class ClientCommandSourceStack extends CommandSourceStack { @SuppressWarnings("resource") @Override public void sendSuccess(Supplier message, boolean sendToAdmins) { - Minecraft.getInstance().gui.getChat().addClientSystemMessage(message.get()); + Minecraft.getInstance().gui.hud.getChat().addClientSystemMessage(message.get()); } /** diff --git a/src/main/java/net/minecraftforge/client/ClientForgeMod.java b/src/main/java/net/minecraftforge/client/ClientForgeMod.java index 2ffd2a691f..265c4b9fa1 100644 --- a/src/main/java/net/minecraftforge/client/ClientForgeMod.java +++ b/src/main/java/net/minecraftforge/client/ClientForgeMod.java @@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.Mod; public class ClientForgeMod { @SubscribeEvent public static void onRegisterGeometryLoaders(ModelEvent.RegisterGeometryLoaders event) { - event.register(forgeRL("empty"), (json, ctx) -> UnbakedGeometry.EMPTY); + event.register(forgeRL("empty"), (_, _) -> UnbakedGeometry.EMPTY); event.register(forgeRL("obj"), ObjLoader.INSTANCE); event.register(forgeRL("fluid_container"), DynamicFluidContainerModel.Loader.INSTANCE); } diff --git a/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java b/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java index 385b519cc5..16f12a6b74 100644 --- a/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java +++ b/src/main/java/net/minecraftforge/client/ConfigScreenHandler.java @@ -33,7 +33,7 @@ public class ConfigScreenHandler * instance.

*/ public ConfigScreenFactory(Function screenFunction) { - this((mcClient, modsScreen) -> screenFunction.apply(modsScreen)); + this((_, modsScreen) -> screenFunction.apply(modsScreen)); } } diff --git a/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java b/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java index e244336b89..da7b16605a 100644 --- a/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java +++ b/src/main/java/net/minecraftforge/client/CreativeModeTabSearchRegistry.java @@ -53,7 +53,7 @@ public class CreativeModeTabSearchRegistry { if (!tab.hasSearchBar()) return null; - return NAME_SEARCH_KEYS.computeIfAbsent(tab, k -> new SessionSearchTrees.Key()); + return NAME_SEARCH_KEYS.computeIfAbsent(tab, _ -> new SessionSearchTrees.Key()); } @Nullable @@ -64,6 +64,6 @@ public class CreativeModeTabSearchRegistry { if (!tab.hasSearchBar()) return null; - return TAG_SEARCH_KEYS.computeIfAbsent(tab, k -> new SessionSearchTrees.Key()); + return TAG_SEARCH_KEYS.computeIfAbsent(tab, _ -> new SessionSearchTrees.Key()); } } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 2ddc9c1e61..ac6ecec55c 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -27,7 +27,6 @@ import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.ChatComponent; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; @@ -42,41 +41,27 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.particle.ParticleEngine; -import net.minecraft.client.particle.ParticleRenderType; import net.minecraft.client.particle.ParticleResources; import net.minecraft.client.player.ClientInput; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.renderer.SubmitNodeCollector; -import net.minecraft.client.renderer.block.BlockAndTintGetter; import net.minecraft.client.renderer.block.FluidModel; -import net.minecraft.client.renderer.block.dispatch.BlockStateModel; -import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart; -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.entity.state.HumanoidRenderState; +import net.minecraft.client.renderer.extract.LevelExtractor; import net.minecraft.client.renderer.fog.FogData; import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; -import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.client.renderer.texture.SpriteContents; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.metadata.animation.FrameSize; -import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.ResolvedModel; import net.minecraft.client.resources.model.geometry.UnbakedGeometry; import net.minecraft.client.resources.model.sprite.MaterialBaker; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.data.AtlasIds; import net.minecraft.locale.Language; import net.minecraft.network.Connection; import net.minecraft.network.chat.ChatType; @@ -89,10 +74,8 @@ import net.minecraft.resources.Identifier; import net.minecraft.server.packs.metadata.MetadataSectionType; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceMetadata; import net.minecraft.util.GsonHelper; import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -131,7 +114,6 @@ import net.minecraftforge.client.event.RenderBlockScreenEffectEvent; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderHighlightEvent; import net.minecraftforge.client.event.RenderTooltipEvent; -import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.ViewportEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; @@ -141,7 +123,6 @@ import net.minecraftforge.client.extensions.common.IClientMobEffectExtensions; import net.minecraftforge.client.gui.ClientTooltipComponentManager; import net.minecraftforge.client.gui.ModMismatchDisconnectedScreen; import net.minecraftforge.client.model.ForgeBlockModelData; -import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.client.model.geometry.GeometryLoaderManager; import net.minecraftforge.client.textures.ForgeTextureMetadata; import net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager; @@ -149,7 +130,6 @@ import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.IExtensionPoint; import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.ModLoader; import net.minecraftforge.network.NetworkContext; import net.minecraftforge.network.NetworkInitialization; import net.minecraftforge.network.NetworkRegistry; @@ -166,19 +146,15 @@ import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; import org.joml.Vector4f; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.Stack; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; @@ -193,53 +169,6 @@ public class ForgeHooksClient { //private static final Identifier ITEM_GLINT = new Identifier("textures/misc/enchanted_item_glint.png"); - /** - * Contains the *extra* GUI layers. - * The current top layer stays in Minecraft#currentScreen, and the rest serve as a background for it. - */ - private static final Stack guiLayers = new Stack<>(); - - public static void resizeGuiLayers(Minecraft minecraft, int width, int height) { - guiLayers.forEach(screen -> screen.resize(width, height)); - } - - public static void clearGuiLayers(Minecraft minecraft) { - while (!guiLayers.isEmpty()) - popGuiLayerInternal(minecraft); - } - - private static void popGuiLayerInternal(Minecraft minecraft) { - if (minecraft.screen != null) - minecraft.screen.removed(); - minecraft.screen = guiLayers.pop(); - } - - public static void pushGuiLayer(Minecraft minecraft, Screen screen) { - if (minecraft.screen != null) - guiLayers.push(minecraft.screen); - minecraft.screen = Objects.requireNonNull(screen); - screen.init(minecraft.getWindow().getGuiScaledWidth(), minecraft.getWindow().getGuiScaledHeight()); - minecraft.getNarrator().saySystemNow(screen.getNarrationMessage()); - } - - public static void popGuiLayer(Minecraft minecraft) { - if (guiLayers.isEmpty()) { - minecraft.setScreen(null); - return; - } - - popGuiLayerInternal(minecraft); - if (minecraft.screen != null) - minecraft.getNarrator().saySystemNow(minecraft.screen.getNarrationMessage()); - } - - public static float getGuiFarPlane() { - // 11000 units for the overlay background, - // and 10000 units for each layered Screen, - - return 11000.0F + 10000.0F * (1 + guiLayers.size()); - } - public static boolean onClientPauseChangePre(boolean pause) { return ClientPauseChangeEvent.Pre.BUS.post(new ClientPauseChangeEvent.Pre(pause)); } @@ -255,9 +184,9 @@ public class ForgeHooksClient { } */ - private static final RenderHighlightEvent.Callback NOOP_HIGHLIGHTER = (source, stack, translucent, state) -> { }; + private static final RenderHighlightEvent.Callback NOOP_HIGHLIGHTER = (_, _, _) -> { }; - public static RenderHighlightEvent.Callback onExtractBlockOutline(LevelRenderer context, Camera camera, LevelRenderState state, HitResult target) { + public static RenderHighlightEvent.Callback onExtractBlockOutline(LevelExtractor context, Camera camera, LevelRenderState state, HitResult target) { if (target instanceof BlockHitResult blockTarget) { var event = new RenderHighlightEvent.Block(context, camera, state, blockTarget); if (RenderHighlightEvent.Block.BUS.post(event)) @@ -327,23 +256,6 @@ public class ForgeHooksClient { return PlaySoundEvent.BUS.fire(new PlaySoundEvent(manager, sound)).getSound(); } - public static void drawScreen(Screen screen, GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { - guiGraphics.pose().pushMatrix(); - for (Screen layer : guiLayers) { - // Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted. - drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); - //guiGraphics.pose().translate(0, 0, 10000); - } - drawScreenInternal(screen, guiGraphics, mouseX, mouseY, partialTick); - guiGraphics.pose().popMatrix(); - } - - private static void drawScreenInternal(Screen screen, GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { - if (!ScreenEvent.Render.Pre.BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick))) - screen.extractRenderStateWithTooltipAndSubtitles(guiGraphics, mouseX, mouseY, partialTick); - ScreenEvent.Render.Post.BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick)); - } - public static Vector3f getFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, float fogRed, float fogGreen, float fogBlue) { // Modify fog color depending on the fluid FluidState state = level.getFluidState(camera.blockPosition()); @@ -456,14 +368,14 @@ public class ForgeHooksClient { InputEvent.Key.BUS.post(new InputEvent.Key(info, action)); } - public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance) { + public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance, double nameTagDistance) { if (entity instanceof LivingEntity living) { var attribute = living.getAttribute(ForgeMod.NAMETAG_DISTANCE.getHolder().get()); if (attribute != null) { return !(squareDistance > (attribute.getValue() * attribute.getValue())); } } - return !(squareDistance > 4096.0f); + return !(squareDistance > Mth.square(nameTagDistance)); } public static boolean shouldRenderEffect(MobEffectInstance effectInstance) { @@ -629,9 +541,8 @@ public class ForgeHooksClient { } public static void onRegisterPictureInPictureRenderers(List> renderers, - MultiBufferSource.BufferSource bufferSource, ImmutableMap.Builder, PictureInPictureRenderer> builder) { - RegisterPictureInPictureRendererEvent.BUS.post(new RegisterPictureInPictureRendererEvent(renderers, bufferSource, builder)); + RegisterPictureInPictureRendererEvent.BUS.post(new RegisterPictureInPictureRendererEvent(renderers, builder)); } @Nullable @@ -689,7 +600,7 @@ public class ForgeHooksClient { // text wrapping int tooltipTextWidth = event.getTooltipElements().stream() - .mapToInt(either -> either.map(font::width, component -> 0)) + .mapToInt(either -> either.map(font::width, _ -> 0)) .max() .orElse(0); @@ -789,7 +700,7 @@ public class ForgeHooksClient { var mismatch = NetworkContext.get(connection).getMismatchs(); if (mismatch == null) return false; - mc.setScreen(new ModMismatchDisconnectedScreen(parent, CommonComponents.CONNECT_FAILED, message, mismatch)); + mc.gui.setScreen(new ModMismatchDisconnectedScreen(parent, CommonComponents.CONNECT_FAILED, message, mismatch)); return true; } diff --git a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java index 42a8e1d283..159035b79d 100644 --- a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java +++ b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java @@ -5,16 +5,15 @@ package net.minecraftforge.client; +import com.mojang.blaze3d.GpuFormat; import com.mojang.blaze3d.pipeline.BlendFunction; import com.mojang.blaze3d.pipeline.ColorTargetState; import com.mojang.blaze3d.pipeline.RenderPipeline; -import com.mojang.blaze3d.platform.DestFactor; -import com.mojang.blaze3d.platform.SourceFactor; +import com.mojang.blaze3d.platform.BlendFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.textures.AddressMode; import com.mojang.blaze3d.textures.FilterMode; import com.mojang.blaze3d.textures.GpuSampler; -import com.mojang.blaze3d.textures.TextureFormat; import net.minecraft.util.Util; import net.minecraft.client.renderer.RenderPipelines; @@ -105,8 +104,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensity(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensity(Identifier locationIn) { - return Internal.TEXT_INTENSITY.apply(locationIn); + public static RenderType getTextGrayscale(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE.apply(locationIn); } /** @@ -123,8 +122,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensityPolygonOffset(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensityPolygonOffset(Identifier locationIn) { - return Internal.TEXT_INTENSITY_POLYGON_OFFSET.apply(locationIn); + public static RenderType getTextGrayscalePolygonOffset(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE_POLYGON_OFFSET.apply(locationIn); } /** @@ -141,8 +140,8 @@ public enum ForgeRenderTypes { * * @return Replacement of {@link RenderType#textIntensitySeeThrough(Identifier)}, but with optional linear texture filtering. */ - public static RenderType getTextIntensitySeeThrough(Identifier locationIn) { - return Internal.TEXT_INTENSITY_SEE_THROUGH.apply(locationIn); + public static RenderType getTextGrayscaleSeeThrough(Identifier locationIn) { + return Internal.TEXT_GRAYSCALE_SEE_THROUGH.apply(locationIn); } /** @@ -179,9 +178,7 @@ public enum ForgeRenderTypes { private static RenderType unsortedTranslucent(Identifier texture) { return RenderType.create("forge_unsorted_translucent", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .withTexture("Sampler0", texture) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .useLightmap() .useOverlay() @@ -194,7 +191,6 @@ public enum ForgeRenderTypes { private static RenderType unlitTranslucentSorted(Identifier texture) { return RenderType.create("forge_unlit_translucent_sorted", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .sortOnUpload() .withTexture("Sampler0", texture) @@ -208,7 +204,6 @@ public enum ForgeRenderTypes { private static RenderType unlitTranslucentUnsorted(Identifier texture) { return RenderType.create("forge_unlit_translucent_sorted", RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useOverlay() @@ -221,7 +216,6 @@ public enum ForgeRenderTypes { private static RenderType layeredItemSolid(Identifier texture) { return RenderType.create("forge_layered_item_soild", RenderSetup.builder(RenderPipelines.ENTITY_SOLID) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useLightmap() @@ -235,7 +229,6 @@ public enum ForgeRenderTypes { private static RenderType layeredItemCutout(Identifier texture) { return RenderType.create("forge_layered_item_cutout", RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .affectsCrumbling() .withTexture("Sampler0", texture) .useLightmap() @@ -252,17 +245,15 @@ public enum ForgeRenderTypes { RenderSetup.builder(RenderPipelines.TEXT) .withTexture("Sampler0", texture) .useLightmap() - .bufferSize(RenderType.SMALL_BUFFER_SIZE) .sortOnUpload() // This is what is different from RenderTypes.TEXT .createRenderSetup() ); } - public static Function TEXT_INTENSITY = Util.memoize(Internal::getTextIntensity); - private static RenderType getTextIntensity(Identifier texture) { - return RenderType.create("forge_text_intensity", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY) - .bufferSize(RenderType.SMALL_BUFFER_SIZE) + public static Function TEXT_GRAYSCALE = Util.memoize(Internal::getTextGrayscale); + private static RenderType getTextGrayscale(Identifier texture) { + return RenderType.create("forge_text_grayscale", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE) .withTexture("Sampler0", texture) .useLightmap() .useOverlay() @@ -274,7 +265,6 @@ public enum ForgeRenderTypes { private static RenderType getTextPolygonOffset(Identifier texture) { return RenderType.create("forge_text_polygon_offset", RenderSetup.builder(RenderPipelines.TEXT_POLYGON_OFFSET) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -282,11 +272,10 @@ public enum ForgeRenderTypes { ); } - public static Function TEXT_INTENSITY_POLYGON_OFFSET = Util.memoize(Internal::getTextIntensityPolygonOffset); - private static RenderType getTextIntensityPolygonOffset(Identifier texture) { - return RenderType.create("forge_text_intensity_polygon_offset", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) + public static Function TEXT_GRAYSCALE_POLYGON_OFFSET = Util.memoize(Internal::getTextGrayscalePolygonOffset); + private static RenderType getTextGrayscalePolygonOffset(Identifier texture) { + return RenderType.create("forge_text_grayscale_polygon_offset", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -298,18 +287,16 @@ public enum ForgeRenderTypes { private static RenderType getTextSeeThrough(Identifier texture) { return RenderType.create("forge_text_see_through", RenderSetup.builder(RenderPipelines.TEXT_SEE_THROUGH) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) .withTexture("Sampler0", texture) .useLightmap() .createRenderSetup() ); } - public static Function TEXT_INTENSITY_SEE_THROUGH = Util.memoize(Internal::getTextIntensitySeeThrough); + public static Function TEXT_GRAYSCALE_SEE_THROUGH = Util.memoize(Internal::getTextIntensitySeeThrough); private static RenderType getTextIntensitySeeThrough(Identifier texture) { - return RenderType.create("forge_text_intensity_see_through", - RenderSetup.builder(RenderPipelines.TEXT_INTENSITY_SEE_THROUGH) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) + return RenderType.create("forge_text_grayscale_see_through", + RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE_SEE_THROUGH) .sortOnUpload() .withTexture("Sampler0", texture) .useLightmap() @@ -319,7 +306,7 @@ public enum ForgeRenderTypes { private static final RenderPipeline LOADING_PIPELINE = RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET) .withLocation("pipeline/forge/loading_overlay") - .withColorTargetState(new ColorTargetState(new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE))) + .withColorTargetState(new ColorTargetState(new BlendFunction(BlendFactor.SRC_ALPHA, BlendFactor.ONE))) .build(); private static final GpuSampler LOADING_SAMPLER = RenderSystem.getSamplerCache().getSampler(AddressMode.REPEAT, AddressMode.REPEAT, FilterMode.NEAREST, FilterMode.NEAREST, false); @@ -327,15 +314,14 @@ public enum ForgeRenderTypes { public static RenderType getLoadingOverlay(DisplayWindow window) { var gpu = RenderSystem.getDevice(); - var texture = gpu.createTexture(LOADING_TEXTURE.toString(), 5, TextureFormat.RGBA8, + var texture = gpu.createTexture(LOADING_TEXTURE.toString(), 5, GpuFormat.RGBA8_UNORM, window.context().width(), window.context().height(), 1, window.getFramebufferTextureId()); var textureView = gpu.createTextureView(texture); return RenderType.create("forge_loading_overlay", RenderSetup.builder(LOADING_PIPELINE) - .bufferSize(RenderType.TRANSIENT_BUFFER_SIZE) - .withTexture("Sampler0", textureView, LOADING_SAMPLER) + .withTexture("Sampler0", LOADING_TEXTURE, () -> LOADING_SAMPLER) .createRenderSetup() ); } diff --git a/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java b/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java index 36a920b3cd..5283c7c8ec 100644 --- a/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java +++ b/src/main/java/net/minecraftforge/client/event/ForgeEventFactoryClient.java @@ -49,12 +49,10 @@ import net.minecraft.client.renderer.entity.state.AvatarRenderState; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.entity.state.ItemFrameRenderState; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; -import net.minecraft.client.renderer.special.SpecialModelRenderer; import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; import net.minecraft.network.Connection; -import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Avatar; import net.minecraft.world.entity.EntityType; @@ -62,7 +60,6 @@ import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.PlayerModelType; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SkullBlock.Type; import net.minecraftforge.client.event.sound.PlaySoundSourceEvent; import net.minecraftforge.client.event.sound.PlayStreamingSourceEvent; diff --git a/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java index 4c69fadb63..2c26b95749 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterItemDecorationsEvent.java @@ -40,7 +40,7 @@ public final class RegisterItemDecorationsEvent extends MutableEvent implements * Register an ItemDecorator to an Item */ public void register(ItemLike itemLike, IItemDecorator decorator) { - List itemDecoratorList = decorators.computeIfAbsent(itemLike.asItem(), item -> new ArrayList<>()); + List itemDecoratorList = decorators.computeIfAbsent(itemLike.asItem(), _ -> new ArrayList<>()); itemDecoratorList.add(decorator); } } diff --git a/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java index a41610388b..57f9f752fa 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterPictureInPictureRendererEvent.java @@ -7,7 +7,6 @@ package net.minecraftforge.client.event; import com.google.common.collect.ImmutableMap; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.MutableEvent; @@ -29,20 +28,14 @@ public final class RegisterPictureInPictureRendererEvent extends MutableEvent im public static final EventBus BUS = EventBus.create(RegisterPictureInPictureRendererEvent.class); private final List> renderers; - private final MultiBufferSource.BufferSource bufferSource; private final ImmutableMap.Builder, PictureInPictureRenderer> builder; @ApiStatus.Internal - public RegisterPictureInPictureRendererEvent(List> renderers, MultiBufferSource.BufferSource bufferSource, ImmutableMap.Builder, PictureInPictureRenderer> builder) { + public RegisterPictureInPictureRendererEvent(List> renderers, ImmutableMap.Builder, PictureInPictureRenderer> builder) { this.renderers = renderers; - this.bufferSource = bufferSource; this.builder = builder; } - public MultiBufferSource.BufferSource getBufferSource() { - return bufferSource; - } - public void register(PictureInPictureRenderer renderer) { var seen = HashSet.newHashSet(renderers.size()); for (var r : renderers) diff --git a/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java index 55e811413a..2c925c98a1 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHighlightEvent.java @@ -7,8 +7,8 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Camera; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.MultiBufferSource.BufferSource; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.extract.LevelExtractor; import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; @@ -33,13 +33,13 @@ import org.jetbrains.annotations.Nullable; public sealed abstract class RenderHighlightEvent extends MutableEvent implements Cancellable, InheritableEvent permits RenderHighlightEvent.Block, RenderHighlightEvent.Entity { CancellableEventBus BUS = CancellableEventBus.create(RenderHighlightEvent.class); - private final LevelRenderer levelRenderer; + private final LevelExtractor levelExtractor; private final Camera camera; private final LevelRenderState levelRenderState; private Callback customRenderer; - private RenderHighlightEvent(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState) { - this.levelRenderer = levelRenderer; + private RenderHighlightEvent(LevelExtractor levelExtractor, Camera camera, LevelRenderState levelRenderState) { + this.levelExtractor = levelExtractor; this.camera = camera; this.levelRenderState = levelRenderState; } @@ -47,8 +47,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement /** * {@return the level renderer} */ - public LevelRenderer getLevelRenderer() { - return this.levelRenderer; + public LevelExtractor getLevelExtractor() { + return this.levelExtractor; } /** @@ -101,8 +101,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement private final BlockHitResult target; @ApiStatus.Internal - public Block(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState, BlockHitResult target) { - super(levelRenderer, camera, levelRenderState); + public Block(LevelExtractor levelExtrctor, Camera camera, LevelRenderState levelRenderState, BlockHitResult target) { + super(levelExtrctor, camera, levelRenderState); this.target = target; } @@ -127,8 +127,8 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement private final EntityHitResult target; @ApiStatus.Internal - public Entity(LevelRenderer levelRenderer, Camera camera, LevelRenderState levelRenderState, EntityHitResult target) { - super(levelRenderer, camera, levelRenderState); + public Entity(LevelExtractor levelExtractor, Camera camera, LevelRenderState levelRenderState, EntityHitResult target) { + super(levelExtractor, camera, levelRenderState); this.target = target; } @@ -142,6 +142,6 @@ public sealed abstract class RenderHighlightEvent extends MutableEvent implement } public interface Callback { - void render(BufferSource source, PoseStack stack, boolean translucent, LevelRenderState state); + void render(SubmitNodeCollector submitNodeCollector, PoseStack stack, LevelRenderState state); } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index 16ab583530..62bd1479aa 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -11,9 +11,7 @@ import com.mojang.blaze3d.audio.Channel; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; -import net.minecraftforge.eventbus.api.event.MutableEvent; import net.minecraftforge.fml.LogicalSide; -import org.jetbrains.annotations.ApiStatus; /** * Superclass for sound related events. diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java index a0d4b4f665..ea8bf45f33 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java @@ -6,45 +6,21 @@ package net.minecraftforge.client.extensions; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.minecraftforge.client.ForgeHooksClient; - import java.util.Locale; /** - * Extension interface for {@link IForgeMinecraft}. + * Extension interface for {@link Minecraft}. */ -public interface IForgeMinecraft -{ - private Minecraft self() - { - return (Minecraft) this; - } - - /** - * Pushes a screen as a new GUI layer. - * - * @param screen the new GUI layer - */ - default void pushGuiLayer(Screen screen) - { - ForgeHooksClient.pushGuiLayer(self(), screen); - } - - /** - * Pops a GUI layer from the screen. - */ - default void popGuiLayer() - { - ForgeHooksClient.popGuiLayer(self()); +public interface IForgeMinecraft { + private Minecraft self() { + return (Minecraft)this; } /** * Retrieves the {@link Locale} set by the player. * Useful for creating string and number formatters. */ - default Locale getLocale() - { + default Locale getLocale() { return self().getLanguageManager().getJavaLocale(); } } diff --git a/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java b/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java index f8b0b1c149..b49d6286db 100644 --- a/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java +++ b/src/main/java/net/minecraftforge/client/extensions/common/IClientFluidTypeExtensions.java @@ -10,8 +10,8 @@ import java.util.function.Consumer; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.ScreenEffectRenderer; +import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.block.BlockAndTintGetter; import net.minecraft.client.renderer.block.FluidModel; import net.minecraft.client.renderer.block.FluidRenderer; @@ -138,7 +138,7 @@ public interface IClientFluidTypeExtensions { * @param mc the client instance * @param poseStack the transformations representing the current rendering position */ - default void renderOverlay(Minecraft mc, PoseStack poseStack, MultiBufferSource buffer) { + default void renderOverlay(Minecraft mc, PoseStack poseStack, SubmitNodeCollector buffer) { Identifier texture = this.getRenderOverlayTexture(mc); if (texture != null) ScreenEffectRenderer.renderFluid(mc, poseStack, buffer, texture); diff --git a/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java b/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java index 8ebe973a29..856e72ff45 100644 --- a/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java +++ b/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java @@ -5,8 +5,8 @@ package net.minecraftforge.client.extensions.common; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.Hud; import net.minecraft.client.gui.screens.inventory.EffectsInInventory; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; @@ -51,12 +51,6 @@ public interface IClientMobEffectExtensions { /** * Renders the text and icon of the specified effect in the player's inventory. * - * @param instance The effect instance - * @param effects The effect-rendering screen - * @param graphics The gui graphics - * @param x The x coordinate - * @param y The y coordinate - * @param blitOffset The blit offset * @return true to prevent default rendering, false otherwise */ default boolean extractInventory(MobEffectInstance instance, EffectsInInventory effects, GuiGraphicsExtractor graphics, int x, int y, int blitOffset) { @@ -67,16 +61,10 @@ public interface IClientMobEffectExtensions { * Renders the icon of the specified effect on the player's HUD. * This can be used to render icons from your own texture sheet. * - * @param instance The effect instance - * @param gui The gui - * @param graphics The gui graphics - * @param x The x coordinate - * @param y The y coordinate - * @param z The z depth * @param alpha The alpha value. Blinks when the effect is about to run out * @return true to prevent default rendering, false otherwise */ - default boolean extractGuiIcon(MobEffectInstance instance, Gui gui, GuiGraphicsExtractor graphics, int x, int y, float z, float alpha) { + default boolean extractGuiIcon(MobEffectInstance instance, Hud hud, GuiGraphicsExtractor graphics, int x, int y, float z, float alpha) { return false; } } diff --git a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java index 9eb58ee701..fd0f42538a 100644 --- a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java @@ -56,12 +56,12 @@ public class LoadingErrorScreen extends ErrorScreen { this.warningHeader = Component.literal(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadWarnings.size()) + ChatFormatting.RESET); int yOffset = 46; - this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getPlatform().openFile(modsDir.toFile()))); - this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getPlatform().openFile(logFile.toFile()))); + this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile()))); if (this.modLoadErrors.isEmpty()) - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> this.minecraft.setScreen(null))); + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), _ -> this.minecraft.gui.setScreen(null))); else - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getPlatform().openFile(dumpedLocation.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), _ -> Util.getPlatform().openFile(dumpedLocation.toFile()))); this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings); this.addWidget(this.entryList); diff --git a/src/main/java/net/minecraftforge/client/gui/ModListScreen.java b/src/main/java/net/minecraftforge/client/gui/ModListScreen.java index 303aeaaa50..357fa6fa83 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModListScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModListScreen.java @@ -227,16 +227,16 @@ public class ModListScreen extends Screen { final int doneButtonWidth = Math.min(modInfoWidth, 200); int y = this.height - BUTTON_HEIGHT - PADDING; - doneButton = Button.builder(Component.translatable("gui.done"), b -> ModListScreen.this.onClose()) + doneButton = Button.builder(Component.translatable("gui.done"), _ -> ModListScreen.this.onClose()) .bounds(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, BUTTON_HEIGHT) .build(); - openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), b -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())) + openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), _ -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())) .bounds(6, y, this.listWidth, BUTTON_HEIGHT) .build(); y -= BUTTON_HEIGHT + PADDING; - configButton = Button.builder(Component.translatable("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig()) + configButton = Button.builder(Component.translatable("fml.menu.mods.config"), _ -> ModListScreen.this.displayModConfig()) .bounds(6, y, this.listWidth, BUTTON_HEIGHT) .build(); @@ -266,17 +266,17 @@ public class ModListScreen extends Screen { width = listWidth / NUM_BUTTONS; int x = PADDING; - addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)) + addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), _ -> resortMods(SortType.NORMAL)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); x += width + BUTTON_MARGIN; - addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)) + addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), _ -> resortMods(SortType.A_TO_Z)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); x += width + BUTTON_MARGIN; - addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)) + addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), _ -> resortMods(SortType.Z_TO_A)) .bounds(x, PADDING, width - BUTTON_MARGIN, BUTTON_HEIGHT) .build()); @@ -291,7 +291,7 @@ public class ModListScreen extends Screen { try { ConfigScreenHandler.getScreenFactoryFor(selected.getInfo()) .map(f -> f.apply(this.minecraft, this)) - .ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); + .ifPresent(newScreen -> this.minecraft.gui.setScreen(newScreen)); } catch (final Exception e) { LOGGER.error("There was a critical issue trying to build the config GUI for {}", selected.getInfo().getModId(), e); } @@ -486,6 +486,6 @@ public class ModListScreen extends Screen { @Override public void onClose() { - this.minecraft.setScreen(this.parentScreen); + this.minecraft.gui.setScreen(this.parentScreen); } } diff --git a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java index 5c05861988..5f4215ec3b 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java @@ -86,13 +86,13 @@ public class ModMismatchDisconnectedScreen extends Screen { this.addRenderableWidget(new MismatchInfoPanel(minecraft, listWidth, listHeight, (this.height - this.listHeight) / 2, listLeft)); int buttonWidth = Math.min(210, this.width / 2 - 20); - this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), button -> Util.getPlatform().openFile(logFile.toFile())) + this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile())) .bounds(Math.max(this.width / 4 - buttonWidth / 2, listLeft), upperButtonHeight, buttonWidth, 20) .build()); - this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), button -> Util.getPlatform().openFile(modsDir.toFile())) + this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile())) .bounds(Math.min(this.width * 3 / 4 - buttonWidth / 2, listLeft + listWidth - buttonWidth), upperButtonHeight, buttonWidth, 20) .build()); - this.addRenderableWidget(Button.builder(Component.translatable("gui.toMenu"), button -> this.minecraft.setScreen(this.parent)) + this.addRenderableWidget(Button.builder(Component.translatable("gui.toMenu"), _ -> this.minecraft.gui.setScreen(this.parent)) .bounds((this.width - buttonWidth) / 2, lowerButtonHeight, buttonWidth, 20) .build()); } @@ -284,7 +284,7 @@ public class ModMismatchDisconnectedScreen extends Screen { int slotIndex = (int)(relativeY + (border / 2)) / 12; if (slotIndex < contentSize) { //The relative x needs to take the potentially missing indent of the row into account. It does that by checking if the line has a version associated to it - double relativeX = x - left - border - (lineTable.get(slotIndex).getRight() == null ? 0 : nameIndent); + //double relativeX = x - left - border - (lineTable.get(slotIndex).getRight() == null ? 0 : nameIndent); //if (relativeX >= 0) // return font.getSplitter().componentStyleAtWidth(lineTable.get(slotIndex).getLeft(), (int)relativeX); } diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java new file mode 100644 index 0000000000..35b3a11255 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayerInstance.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.client.gui.overlay; + +import java.util.Objects; +import java.util.Stack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphicsExtractor; +import net.minecraft.client.gui.screens.Screen; +import net.minecraftforge.client.event.ScreenEvent; + +import org.jetbrains.annotations.ApiStatus; + +// This should be accessed via Gui +public abstract class ForgeLayerInstance { + public void pushLayer(Screen screen) { + if (screen() != null) + guiLayers.push(screen()); + setScreenInternal(Objects.requireNonNull(screen)); + screen.init(minecraft.getWindow().getGuiScaledWidth(), minecraft.getWindow().getGuiScaledHeight()); + minecraft.getNarrator().saySystemNow(screen.getNarrationMessage()); + } + + public void popLayer() { + if (guiLayers.isEmpty()) { + minecraft.gui.setScreen(null); + return; + } + + popLayerInternal(); + if (screen() != null) + minecraft.getNarrator().saySystemNow(screen().getNarrationMessage()); + } + + // Below here is private implementation details + + /** + * Contains the *extra* GUI layers. + * The current top layer stays in Minecraft#currentScreen, and the rest serve as a background for it. + */ + private final Stack guiLayers = new Stack<>(); + private final Minecraft minecraft; + + @ApiStatus.Internal + protected ForgeLayerInstance(Minecraft minecraft) { + this.minecraft = minecraft; + } + + @ApiStatus.Internal + protected abstract Screen screen(); + @ApiStatus.Internal + protected abstract void setScreenInternal(Screen value); + + @ApiStatus.Internal + public void resizeLayers(int width, int height) { + guiLayers.forEach(screen -> screen.resize(width, height)); + } + + @ApiStatus.Internal + protected void clearLayers() { + while (!guiLayers.isEmpty()) + popLayerInternal(); + } + + @ApiStatus.Internal + private void popLayerInternal() { + if (screen() != null) + screen().removed(); + setScreenInternal(guiLayers.pop()); + } + + @ApiStatus.Internal + protected void drawScreen(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { + guiGraphics.pose().pushMatrix(); + for (Screen layer : guiLayers) { + // Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted. + drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); + //guiGraphics.pose().translate(0, 0, 10000); + } + drawScreenInternal(screen(), guiGraphics, mouseX, mouseY, partialTick); + guiGraphics.pose().popMatrix(); + } + + @ApiStatus.Internal + private static void drawScreenInternal(Screen screen, GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) { + if (!ScreenEvent.Render.Pre.BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick))) + screen.extractRenderStateWithTooltipAndSubtitles(guiGraphics, mouseX, mouseY, partialTick); + ScreenEvent.Render.Post.BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick)); + } +} diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java index 31fd022204..f25c9804c1 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeLayeredDraw.java @@ -8,9 +8,9 @@ package net.minecraftforge.client.gui.overlay; import com.mojang.logging.LogUtils; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphicsExtractor; -import net.minecraft.client.gui.contextualbar.ContextualBarRenderer; +import net.minecraft.client.gui.Hud; +import net.minecraft.client.gui.contextualbar.ContextualBar; import net.minecraft.resources.Identifier; import net.minecraftforge.client.event.ForgeEventFactoryClient; import net.minecraftforge.client.event.AddGuiOverlayLayersEvent; @@ -117,7 +117,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * Add a layer to the layer list. This layer will be at the end of the list, which means * it will be rendered last (on top) of already added layers. * @param name RL for other mods to order against. - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw add(Identifier targetStack, Identifier name, ForgeLayer layer) { @@ -130,7 +130,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * Use any of the non-deprecated add methods if you want a specific instance, * or call {@linkplain ForgeLayeredDraw#locateStack(Identifier)} to get a reference to an instance. * @param name RL of layer to add - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw add(Identifier name, ForgeLayer layer) { @@ -198,7 +198,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * If the current stack does not contain otherLayer, no changes will be made. * @param newLayer name of the layer to be added * @param otherLayer name of the layer being ordered against - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw addAbove(Identifier expectedStack, Identifier newLayer, Identifier otherLayer, ForgeLayer layer) { @@ -225,7 +225,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { * If the current stack does not contain otherLayer, no changes will be made. * @param newLayer name of the layer to be added * @param otherLayer name of the layer being ordered against - * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Gui} + * @param layer layer render code, see {@linkplain ForgeLayer} and example usages in {@linkplain Hud} * @return this */ public ForgeLayeredDraw addBelow(Identifier expectedStack, Identifier newLayer, Identifier otherLayer, ForgeLayer layer) { @@ -294,7 +294,7 @@ public final class ForgeLayeredDraw implements ForgeLayer { */ public ForgeLayeredDraw addConditionTo(Identifier targetLayer, BooleanSupplier condition) { var result = namedLayers.computeIfPresent(targetLayer, - (name, layer) -> (guiGraphics, deltaTracker) -> { + (_, layer) -> (guiGraphics, deltaTracker) -> { if (condition.getAsBoolean()) { layer.extract(guiGraphics, deltaTracker); } @@ -428,22 +428,22 @@ public final class ForgeLayeredDraw implements ForgeLayer { } @ApiStatus.Internal - public static void init(Gui gui, Minecraft minecraft) { + public static void init(Hud gui, Minecraft minecraft) { BooleanSupplier spectator = () -> minecraft.gameMode.isSpectator(); var hotbarCluster = new ForgeLayeredDraw(HOTBAR_AND_DECOS) - .addWithCondition(SPECTATOR_HOTBAR, (gg, dt) -> gui.getSpectatorGui().extractHotbar(gg), spectator) + .addWithCondition(SPECTATOR_HOTBAR, (gg, _) -> gui.getSpectatorGui().extractHotbar(gg), spectator) .addWithCondition(ITEM_HOTBAR, gui::extractItemHotbar, () -> !spectator.getAsBoolean()) - .addWithCondition(HEALTH_BAR, (gg, dt) -> gui.extractPlayerHealth(gg), () -> minecraft.gameMode.canHurtPlayer()) - .add(VEHICLE_HEALTH, (gg, dt) -> gui.extractVehicleHealth(gg)) + .addWithCondition(HEALTH_BAR, (gg, _) -> gui.extractPlayerHealth(gg), () -> minecraft.gameMode.canHurtPlayer()) + .add(VEHICLE_HEALTH, (gg, _) -> gui.extractVehicleHealth(gg)) .add(BACKGROUND, gui::updateContextualInfo) - .addWithCondition(EXPERIENCE_LEVEL, (gg, dt) -> ContextualBarRenderer.extractExperienceLevel(gg, minecraft.font, minecraft.player.experienceLevel), () -> minecraft.gameMode.hasExperience() && minecraft.player.experienceLevel > 0) + .addWithCondition(EXPERIENCE_LEVEL, (gg, _) -> ContextualBar.extractExperienceLevel(gg, minecraft.font, minecraft.player.experienceLevel), () -> minecraft.gameMode.hasExperience() && minecraft.player.experienceLevel > 0) .add(CONTEXTUAL_INFO, gui::extractContextualInfoState) - .addWithCondition(SELECTED_ITEM_NAME, (gg, dt) -> gui.extractSelectedItemName(gg), () -> !spectator.getAsBoolean()) - .addWithCondition(SPECTATOR_ACTION, (gg, dt) -> gui.getSpectatorGui().extractAction(gg), spectator); + .addWithCondition(SELECTED_ITEM_NAME, (gg, _) -> gui.extractSelectedItemName(gg), () -> !spectator.getAsBoolean()) + .addWithCondition(SPECTATOR_ACTION, (gg, _) -> gui.getSpectatorGui().extractAction(gg), spectator); var preSleepDraw = new ForgeLayeredDraw(PRE_SLEEP_STACK) .add(CAMERA_OVERLAY, gui::extractCameraOverlays) .add(CROSSHAIR, gui::extractCrosshair) - .add(CHANGE_STRATUM, (gg, dt) -> gg.nextStratum()) + .add(CHANGE_STRATUM, (gg, _) -> gg.nextStratum()) .add(HOTBAR_AND_DECOS, hotbarCluster) .add(POTION_EFFECTS, gui::extractEffects) .add(BOSS_OVERLAY, gui::extractBossOverlay); @@ -454,13 +454,13 @@ public final class ForgeLayeredDraw implements ForgeLayer { .add(TITLE_OVERLAY, gui::extractTitle) .add(CHAT_OVERLAY, gui::extractChat) .add(TAB_LIST, gui::extractTabList) - .add(SUBTITLE_OVERLAY, (gfx, delta) -> gui.extractSubtitleOverlay(gfx, minecraft.screen != null && minecraft.screen.isInGameUi())); + .add(SUBTITLE_OVERLAY, (gfx, _) -> gui.extractSubtitleOverlay(gfx, minecraft.gui.screen() != null && minecraft.gui.screen().isInGameUi())); instance - .add(PRE_SLEEP_STACK, preSleepDraw, () -> !minecraft.options.hideGui) + .add(PRE_SLEEP_STACK, preSleepDraw, () -> !gui.isHidden()) .add(SLEEP_OVERLAY, gui::extractSleepOverlay) - .add(POST_SLEEP_STACK, postSleepDraw, () -> !minecraft.options.hideGui) - .add(SUBTITLE_OVERLAY, (gfx, delta) -> { - if (minecraft.options.hideGui && minecraft.screen != null && minecraft.screen.isInGameUi()) + .add(POST_SLEEP_STACK, postSleepDraw, () -> !gui.isHidden()) + .add(SUBTITLE_OVERLAY, (gfx, _) -> { + if (!gui.isHidden() && minecraft.gui.screen() != null && minecraft.gui.screen().isInGameUi()) gui.extractSubtitleOverlay(gfx, true); }); instance.resolveLayers(); diff --git a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java index cbd4e5e76c..88a633898e 100644 --- a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java @@ -114,7 +114,7 @@ public final class ClientModLoader { if (error != null || !warnings.isEmpty()) { BusGroup.DEFAULT.shutdown(); - mc.setScreen(new LoadingErrorScreen(error, warnings, dumpedLocation)); + mc.gui.setScreen(new LoadingErrorScreen(error, warnings, dumpedLocation)); return true; } diff --git a/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java b/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java index 65ccf9fa46..7feac00250 100644 --- a/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java +++ b/src/main/java/net/minecraftforge/client/model/data/ModelDataManager.java @@ -44,7 +44,7 @@ public class ModelDataManager { public void requestRefresh(@NotNull BlockEntity blockEntity) { Preconditions.checkNotNull(blockEntity, "Block entity must not be null"); - needModelDataRefresh.computeIfAbsent(ChunkPos.containing(blockEntity.getBlockPos()), $ -> Collections.synchronizedSet(new HashSet<>())) + needModelDataRefresh.computeIfAbsent(ChunkPos.containing(blockEntity.getBlockPos()), _ -> Collections.synchronizedSet(new HashSet<>())) .add(blockEntity.getBlockPos()); } @@ -52,7 +52,7 @@ public class ModelDataManager { Set needUpdate = needModelDataRefresh.remove(chunk); if (needUpdate != null) { - Map data = modelDataCache.computeIfAbsent(chunk, $ -> new ConcurrentHashMap<>()); + Map data = modelDataCache.computeIfAbsent(chunk, _ -> new ConcurrentHashMap<>()); for (BlockPos pos : needUpdate) { BlockEntity toUpdate = level.getBlockEntity(pos); if (toUpdate != null && !toUpdate.isRemoved()) diff --git a/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java b/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java index 751f0215e8..9dd4bcedf8 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/StandaloneGeometryBakingContext.java @@ -120,7 +120,7 @@ public class StandaloneGeometryBakingContext implements IGeometryBakingContext { private Identifier renderTypeHint; @Nullable private Identifier renderTypeFastHint; - private BiPredicate visibilityTest = (c, def) -> def; + private BiPredicate visibilityTest = (_, def) -> def; private Builder() { } diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java b/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java index 9a8bc7b1ee..6e53e5f904 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java @@ -64,7 +64,7 @@ public class ObjLoader implements IGeometryLoader, ResourceManagerReloadListener } public ObjModel loadModel(ObjModel.ModelSettings settings) { - return modelCache.computeIfAbsent(settings, (data) -> { + return modelCache.computeIfAbsent(settings, (_) -> { Resource resource = manager.getResource(settings.modelLocation()).orElseThrow(); try (ObjTokenizer tokenizer = new ObjTokenizer(resource.open())) { return ObjModel.parse(tokenizer, settings); diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java b/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java index 16a68f25c3..6625068cdb 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjMaterialLibrary.java @@ -6,7 +6,6 @@ package net.minecraftforge.client.model.obj; import com.google.common.collect.Maps; -import net.minecraft.client.resources.model.ModelDebugName; import org.joml.Vector4f; import java.io.IOException; diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java b/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java index 747ca6a389..c3d675da33 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjTokenizer.java @@ -5,38 +5,34 @@ package net.minecraftforge.client.model.obj; -import com.google.common.base.Charsets; -import joptsimple.internal.Strings; import org.jetbrains.annotations.Nullable; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; /** * A tokenizer for OBJ and MTL files. *

* Joins split lines and ignores comments. */ -public class ObjTokenizer implements AutoCloseable -{ +public class ObjTokenizer implements AutoCloseable { + private static final Pattern TABS = Pattern.compile("[\t ]+"); private final BufferedReader lineReader; - public ObjTokenizer(InputStream inputStream) - { - this.lineReader = new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8)); + public ObjTokenizer(InputStream inputStream) { + this.lineReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); } @Nullable - public String[] readAndSplitLine(boolean ignoreEmptyLines) throws IOException - { + public String[] readAndSplitLine(boolean ignoreEmptyLines) throws IOException { //noinspection LoopConditionNotUpdatedInsideLoop - do - { + do { String currentLine = lineReader.readLine(); if (currentLine == null) return null; @@ -46,19 +42,19 @@ public class ObjTokenizer implements AutoCloseable if (currentLine.startsWith("#")) currentLine = ""; - if (!currentLine.isEmpty()) - { + if (!currentLine.isEmpty()) { boolean hasContinuation; - do - { + do { hasContinuation = currentLine.endsWith("\\"); String tmp = hasContinuation ? currentLine.substring(0, currentLine.length() - 1) : currentLine; - Arrays.stream(tmp.split("[\t ]+")).filter(s -> !Strings.isNullOrEmpty(s)).forEach(lineParts::add); + for (var part : TABS.split(tmp)) { + if (part != null && !part.isEmpty()) + lineParts.add(part); + } - if (hasContinuation) - { + if (hasContinuation) { currentLine = lineReader.readLine(); if (currentLine == null) break; @@ -78,8 +74,7 @@ public class ObjTokenizer implements AutoCloseable } @Override - public void close() throws IOException - { + public void close() throws IOException { lineReader.close(); } } diff --git a/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java b/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java index 9150aa121a..321b508f1c 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/BakedModelRenderable.java @@ -3,13 +3,13 @@ * SPDX-License-Identifier: LGPL-2.1-only */ +/* package net.minecraftforge.client.model.renderable; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.QuadInstance; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.dispatch.BlockStateModel; import net.minecraft.client.renderer.block.dispatch.BlockStateModelPart; import net.minecraft.client.renderer.texture.TextureAtlas; @@ -31,21 +31,21 @@ import java.util.Arrays; * a {@link ModelData} instance, and a {@link Vector4f tint}. * * @see Context - */ + * / public class BakedModelRenderable implements IRenderable { /** * Constructs a {@link BakedModelRenderable} from the given model location. * The model is expected to have been baked ahead of time. * * @see net.minecraftforge.client.event.ModelEvent.RegisterModelStateDefinitions - */ + * / public static BakedModelRenderable of(BlockState state) { return of(Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(state)); } /** * Constructs a {@link BakedModelRenderable} from the given baked model. - */ + * / public static BakedModelRenderable of(BlockStateModel model) { return new BakedModelRenderable(model); } @@ -57,7 +57,7 @@ public class BakedModelRenderable implements IRenderable withModelDataContext() { - return (poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, context) -> - render(poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, new Context(context)); + return (poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, context) -> + render(poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, new Context(context)); } public record Context(@Nullable BlockState state, Direction[] faces, RandomSource randomSource, long seed, ModelData data, Vector4f tint) { @@ -100,3 +100,4 @@ public class BakedModelRenderable implements IRenderable { * @param partialTick The current time expressed in the fraction of a tick elapsed since the last client tick * @param context The context used for rendering */ - void render(PoseStack poseStack, MultiBufferSource bufferSource, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay, float partialTick, T context); + void render(PoseStack poseStack, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay, float partialTick, T context); /** * Wraps the current renderable along with a context. @@ -37,7 +36,7 @@ public interface IRenderable { * @return A renderable that accepts {@link Unit#INSTANCE} as context, but uses the provided {@code context} instead */ default IRenderable withContext(T context) { - return (poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, unused) -> - this.render(poseStack, bufferSource, textureRenderTypeLookup, lightmap, overlay, partialTick, context); + return (poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, _) -> + this.render(poseStack, textureRenderTypeLookup, lightmap, overlay, partialTick, context); } } diff --git a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java index 53d492a367..67cc790aa8 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyConflictContext.java @@ -29,10 +29,9 @@ public enum KeyConflictContext implements IKeyConflictContext { * Gui key bindings are only used when a {@link Screen} is open. */ GUI { - @SuppressWarnings("resource") @Override public boolean isActive() { - return Minecraft.getInstance().screen != null; + return Minecraft.getInstance().gui.screen() != null; } @Override diff --git a/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java b/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java index b17144259e..0400caa236 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyMappingLookup.java @@ -7,8 +7,6 @@ package net.minecraftforge.client.settings; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.client.KeyMapping; -import org.jetbrains.annotations.Nullable; - import java.util.ArrayList; import java.util.Collections; import java.util.EnumMap; @@ -60,7 +58,7 @@ public class KeyMappingLookup { public void put(InputConstants.Key keyCode, KeyMapping keyBinding) { var bindingsMap = map.get(keyBinding.getKeyModifier()); - var bindingsForKey = bindingsMap.computeIfAbsent(keyCode, k -> new ArrayList()); + var bindingsForKey = bindingsMap.computeIfAbsent(keyCode, _ -> new ArrayList()); bindingsForKey.add(keyBinding); } diff --git a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java index bc9af0186e..6ab9124cd7 100644 --- a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java +++ b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java @@ -160,7 +160,7 @@ public final class CreativeModeTabRegistry { } private static void setCreativeModeTabOrder(List tierList) { - runInServerThreadIfPossible(hasServer -> { + runInServerThreadIfPossible(_ -> { SORTED_TABS.clear(); SORTED_TABS.addAll(tierList); }); diff --git a/src/main/java/net/minecraftforge/common/DungeonHooks.java b/src/main/java/net/minecraftforge/common/DungeonHooks.java index 9696286e3e..38680af611 100644 --- a/src/main/java/net/minecraftforge/common/DungeonHooks.java +++ b/src/main/java/net/minecraftforge/common/DungeonHooks.java @@ -10,12 +10,13 @@ import java.util.ArrayList; import net.minecraft.util.RandomSource; import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; public class DungeonHooks { private static WeightedList> dungeonMobs = WeightedList.>builder() - .add(EntityType.SKELETON, 100) - .add(EntityType.ZOMBIE, 200) - .add(EntityType.SPIDER, 100) + .add(EntityTypes.SKELETON, 100) + .add(EntityTypes.ZOMBIE, 200) + .add(EntityTypes.SPIDER, 100) .build(); /** diff --git a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java index b7373a5aa2..1348e75a95 100644 --- a/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java +++ b/src/main/java/net/minecraftforge/common/FarmlandWaterManager.java @@ -45,7 +45,7 @@ public class FarmlandWaterManager { @SuppressWarnings("unchecked") public static> T addCustomTicket(Level level, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks) { Preconditions.checkArgument(!level.isClientSide(), "Water region is only determined server-side"); - Map> ticketMap = customWaterHandler.computeIfAbsent(level, id -> new MapMaker().weakValues().makeMap()); + Map> ticketMap = customWaterHandler.computeIfAbsent(level, _ -> new MapMaker().weakValues().makeMap()); ChunkTicketManager[] additionalTickets = new ChunkTicketManager[additionalChunks.length]; for (int i = 0; i < additionalChunks.length; i++) additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new); diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index c109a9bed1..5ab0f771e6 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -82,9 +82,9 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper + (_, path, incorrectValue, correctedValue) -> LOGGER.warn(Logging.CORE, "Incorrect key {} was corrected from {} to its default, {}. {}", DOT_JOINER.join( path ), incorrectValue, correctedValue, incorrectValue == correctedValue ? "This seems to be an error." : ""), - (action, path, incorrectValue, correctedValue) -> + (_, path, _, _) -> LOGGER.debug(Logging.CORE, "The comment on key {} does not match the spec. This may create a backup.", DOT_JOINER.join( path ))); if (config instanceof FileConfig fileConfig) { @@ -140,12 +140,12 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper parentPath = new LinkedList<>(); - return correct(this.config, config, parentPath, Collections.unmodifiableList( parentPath ), (a, b, c, d) -> {}, null, true) == 0; + return correct(this.config, config, parentPath, Collections.unmodifiableList( parentPath ), (_, _, _, _) -> {}, null, true) == 0; } @Override public int correct(CommentedConfig config) { - return correct(config, (action, path, incorrectValue, correctedValue) -> {}, null); + return correct(config, (_, _, _, _) -> {}, null); } public synchronized int correct(CommentedConfig config, CorrectionListener listener) { diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 2dedcabe8a..2b791f6682 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -1046,7 +1046,7 @@ public final class ForgeHooks { } final var entries = new MutableHashedLinkedMap(ItemStackLinkedSet.TYPE_AND_TAG, - (key, left, right) -> { + (_, _, _) -> { //throw new IllegalStateException("Accidentally adding the same item stack twice " + key.getDisplayName().getString() + " to a Creative Mode Tab: " + tab.getDisplayName().getString()); // Vanilla adds enchanting books twice in both visibilities. // This is just code cleanliness for them. For us lets just increase the visibility and merge the entries. diff --git a/src/main/java/net/minecraftforge/common/ForgeI18n.java b/src/main/java/net/minecraftforge/common/ForgeI18n.java index 163a94a067..27ab8def28 100644 --- a/src/main/java/net/minecraftforge/common/ForgeI18n.java +++ b/src/main/java/net/minecraftforge/common/ForgeI18n.java @@ -40,21 +40,21 @@ public class ForgeI18n { static { customFactories = new HashMap<>(); // {0,modinfo,id} -> modid from ModInfo object; {0,modinfo,name} -> displayname from ModInfo object - customFactories.put("modinfo", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseModInfo(formatString, stringBuffer, objectToParse))); + customFactories.put("modinfo", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseModInfo(formatString, stringBuffer, objectToParse))); // {0,lower} -> lowercase supplied string - customFactories.put("lower", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toLowerCase(String.valueOf(objectToParse))))); + customFactories.put("lower", (_, _, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toLowerCase(String.valueOf(objectToParse))))); // {0,upper> -> uppercase supplied string - customFactories.put("upper", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toUpperCase(String.valueOf(objectToParse))))); + customFactories.put("upper", (_, _, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toUpperCase(String.valueOf(objectToParse))))); // {0,exc,cls} -> class of exception; {0,exc,msg} -> message from exception - customFactories.put("exc", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseException(formatString, stringBuffer, objectToParse))); + customFactories.put("exc", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseException(formatString, stringBuffer, objectToParse))); // {0,vr} -> transform VersionRange into cleartext string using fml.messages.version.restriction.* strings - customFactories.put("vr", (name, formatString, locale) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseVersionRange)); + customFactories.put("vr", (_, _, _) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseVersionRange)); // {0,featurebound} -> transform feature bound to cleartext string - customFactories.put("featurebound", (name, formatString, locale) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseFeatureBoundValue)); + customFactories.put("featurebound", (_, _, _) -> new CustomReadOnlyFormat(MavenVersionStringHelper::parseFeatureBoundValue)); // {0,i18n,fml.message} -> pass object to i18n string 'fml.message' - customFactories.put("i18n", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(ForgeI18n.parseMessage(formatString, o)))); + customFactories.put("i18n", (_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(ForgeI18n.parseMessage(formatString, o)))); // {0,ornull,fml.absent} -> append String value of o, or i18n string 'fml.absent' (message format transforms nulls into the string literal "null") - customFactories.put("ornull", ((name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(Objects.equals(String.valueOf(o),"null") ? ForgeI18n.parseMessage(formatString) : String.valueOf(o))))); + customFactories.put("ornull", ((_, formatString, _) -> new CustomReadOnlyFormat((stringBuffer, o) -> stringBuffer.append(Objects.equals(String.valueOf(o),"null") ? ForgeI18n.parseMessage(formatString) : String.valueOf(o))))); } private static void parseException(final String formatString, final StringBuffer stringBuffer, final Object objectToParse) { diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index fe1b61d363..cf0b5a8dd0 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -49,7 +49,6 @@ import net.minecraftforge.common.data.ForgeFluidTagsProvider; import net.minecraftforge.common.data.ForgeItemTagsProvider; import net.minecraftforge.common.data.ForgeLootTableProvider; import net.minecraftforge.common.data.ForgeRecipeProvider; -import net.minecraftforge.common.data.ForgeSpriteSourceProvider; import net.minecraftforge.common.data.ForgeStructureTagsProvider; import net.minecraftforge.common.data.VanillaSoundDefinitionsProvider; import net.minecraftforge.common.loot.CanToolPerformAction; @@ -512,7 +511,7 @@ public class ForgeMod { } public static final PermissionNode USE_SELECTORS_PERMISSION = new PermissionNode<>("forge", "use_entity_selectors", - PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && Commands.LEVEL_GAMEMASTERS.check(player.permissions())); + PermissionTypes.BOOLEAN, (player, _, _) -> player != null && Commands.LEVEL_GAMEMASTERS.check(player.permissions())); /** * TODO: Remove when {@link ForgeRegistry#addAlias(Identifier, Identifier)} is elevated to {@link IForgeRegistry}. diff --git a/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java b/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java index e620898253..6139b6674d 100644 --- a/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java +++ b/src/main/java/net/minecraftforge/common/LenientUnboundedMapCodec.java @@ -52,17 +52,17 @@ public class LenientUnboundedMapCodec implements BaseMapCodec, Codec final DataResult v = elementCodec().parse(ops, pair.getSecond()); final DataResult> entry = k.apply2stable(Pair::of, v); - entry.error().ifPresent(e -> failed.add(pair)); + entry.error().ifPresent(_ -> failed.add(pair)); entry.result().ifPresent(e -> read.put(e.getFirst(), e.getSecond())); // FORGE: This line moved outside the below apply2stable condition - return r.apply2stable((u, p) -> u, entry); + return r.apply2stable((u, _) -> u, entry); }, - (r1, r2) -> r1.apply2stable((u1, u2) -> u1, r2) + (r1, r2) -> r1.apply2stable((u1, _) -> u1, r2) ); final Map elements = read.build(); final T errors = ops.createMap(failed.build().stream()); - return result.map(unit -> elements).setPartial(elements).mapError(e -> e + " missed input: " + errors); + return result.map(_ -> elements).setPartial(elements).mapError(e -> e + " missed input: " + errors); } @Override diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index efc38caa0e..2a6093a3ca 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -67,7 +67,7 @@ public class MinecraftForge { * @see ModLoadingContext#registerConfig(ModConfig.Type, IConfigSpec) */ public static void registerConfigScreen(Function screenFunction) { - registerConfigScreen((mcClient, modsScreen) -> screenFunction.apply(modsScreen)); + registerConfigScreen((_, modsScreen) -> screenFunction.apply(modsScreen)); } /** diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index 8e77c1397b..7977a14959 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -8,6 +8,7 @@ package net.minecraftforge.common; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.tags.BlockItemTagId; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; @@ -31,6 +32,7 @@ import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper; public class Tags { public static void init() { + BlockItems.init(); Blocks.init(); EntityTypes.init(); Items.init(); @@ -40,6 +42,223 @@ public class Tags { Structures.init(); } + public static class BlockItems { + private static void init() {} + //region forge specific tags + public static final BlockItemTagId STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); + public static final BlockItemTagId STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); + //endregion + + + //region `c` tags for common conventions + // Note: Other loaders have additional `c` tags that are exclusive to their loader. + // Forge only adopts `c` tags that are common across all loaders. + public static final BlockItemTagId BARRELS = cTag("barrels"); + public static final BlockItemTagId BARRELS_WOODEN = cTag("barrels/wooden"); + /** + * Equivalent to the "minecraft:bars" block tag. + */ + public static final BlockItemTagId BARS = cTag("bars"); + public static final BlockItemTagId BARS_COPPER = cTag("bars/copper"); + public static final BlockItemTagId BARS_IRON = cTag("bars/iron"); + public static final BlockItemTagId BOOKSHELVES = cTag("bookshelves"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final BlockItemTagId BUDDING_BLOCKS = cTag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final BlockItemTagId BUDS = cTag("buds"); + public static final BlockItemTagId CHAINS = cTag("chains"); + public static final BlockItemTagId CHESTS = cTag("chests"); + public static final BlockItemTagId CHESTS_ENDER = cTag("chests/ender"); + public static final BlockItemTagId CHESTS_TRAPPED = cTag("chests/trapped"); + public static final BlockItemTagId CHESTS_WOODEN = cTag("chests/wooden"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final BlockItemTagId CLUSTERS = cTag("clusters"); + public static final BlockItemTagId COBBLESTONES = cTag("cobblestones"); + public static final BlockItemTagId COBBLESTONES_DEEPSLATE = cTag("cobblestones/deepslate"); + public static final BlockItemTagId COBBLESTONES_INFESTED = cTag("cobblestones/infested"); + public static final BlockItemTagId COBBLESTONES_MOSSY = cTag("cobblestones/mossy"); + public static final BlockItemTagId COBBLESTONES_NORMAL = cTag("cobblestones/normal"); + public static final BlockItemTagId CONCRETES = cTag("concretes"); + + public static final BlockItemTagId END_STONES = cTag("end_stones"); + + public static final BlockItemTagId FENCE_GATES = cTag("fence_gates"); + public static final BlockItemTagId FENCE_GATES_WOODEN = cTag("fence_gates/wooden"); + + public static final BlockItemTagId FENCES = cTag("fences"); + public static final BlockItemTagId FENCES_NETHER_BRICK = cTag("fences/nether_brick"); + public static final BlockItemTagId FENCES_WOODEN = cTag("fences/wooden"); + + /** + * Contains living ground-based flowers that are 1 block tall such as Dandelions or Poppy. + * Equivalent to the {@code minecraft:small_flowers} block tag. + * This is NOT aliased with {@link BlockTags#SMALL_FLOWERS} because the vanilla tag is used to make the block weak to swords. + */ + public static final BlockItemTagId FLOWERS_SMALL = cTag("flowers/small"); + /** + * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. + * Equivalent to the {@code minecraft:tall_flowers} block tag in past Minecraft versions. + */ + public static final BlockItemTagId FLOWERS_TALL = cTag("flowers/tall"); + /** + * Contains any living plant block that contains flowers or is a flower itself. + * Equivalent to the {@code minecraft:flowers} block tag. + * Aliased with {@link BlockTags#FLOWERS}. + */ + public static final BlockItemTagId FLOWERS = cTag("flowers"); + + public static final BlockItemTagId GRAVELS = cTag("gravels"); + + public static final BlockItemTagId GLASS_BLOCKS = cTag("glass_blocks"); + public static final BlockItemTagId GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final BlockItemTagId GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); + public static final BlockItemTagId GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + + public static final BlockItemTagId GLASS_PANES = cTag("glass_panes"); + public static final BlockItemTagId GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); + public static final BlockItemTagId GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + + public static final BlockItemTagId NATURAL_LOGS = cTag("natural_logs"); + public static final BlockItemTagId NATURAL_LOGS_NETHER = cTag("natural_logs/nether"); + public static final BlockItemTagId NATURAL_LOGS_OVERWORLD = cTag("natural_logs/overworld"); + + public static final BlockItemTagId NATURAL_WOODS = cTag("natural_woods"); + + public static final BlockItemTagId NETHERRACKS = cTag("netherracks"); + + public static final BlockItemTagId OBSIDIANS = cTag("obsidians"); + /** + * For common obsidian that has no special quirks or behaviours - ideal for recipe use. + * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. + */ + public static final BlockItemTagId OBSIDIANS_NORMAL = cTag("obsidians/normal"); + public static final BlockItemTagId OBSIDIANS_CRYING = cTag("obsidians/crying"); + /** + * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_DEEPSLATE = cTag("ore_bearing_ground/deepslate"); + /** + * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_NETHERRACK = cTag("ore_bearing_ground/netherrack"); + /** + * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation + */ + public static final BlockItemTagId ORE_BEARING_GROUND_STONE = cTag("ore_bearing_ground/stone"); + /** + * Ores which on average result in more than one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_DENSE = cTag("ore_rates/dense"); + /** + * Ores which on average result in one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_SINGULAR = cTag("ore_rates/singular"); + /** + * Ores which on average result in less than one resource worth of materials + */ + public static final BlockItemTagId ORE_RATES_SPARSE = cTag("ore_rates/sparse"); + public static final BlockItemTagId ORES = cTag("ores"); + public static final BlockItemTagId ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); + public static final BlockItemTagId ORES_QUARTZ = cTag("ores/quartz"); + public static final BlockItemTagId ORES_COAL = cTag("ores/coal"); + public static final BlockItemTagId ORES_COPPER = cTag("ores/copper"); + public static final BlockItemTagId ORES_DIAMOND = cTag("ores/diamond"); + public static final BlockItemTagId ORES_EMERALD = cTag("ores/emerald"); + public static final BlockItemTagId ORES_GOLD = cTag("ores/gold"); + public static final BlockItemTagId ORES_IRON = cTag("ores/iron"); + public static final BlockItemTagId ORES_LAPIS = cTag("ores/lapis"); + public static final BlockItemTagId ORES_REDSTONE = cTag("ores/redstone"); + /** + * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_DEEPSLATE = cTag("ores_in_ground/deepslate"); + /** + * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_NETHERRACK = cTag("ores_in_ground/netherrack"); + /** + * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output + */ + public static final BlockItemTagId ORES_IN_GROUND_STONE = cTag("ores_in_ground/stone"); + public static final BlockItemTagId PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); + public static final BlockItemTagId PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); + public static final BlockItemTagId PUMPKINS = cTag("pumpkins"); + /** For pumpkins that are not carved. */ + public static final BlockItemTagId PUMPKINS_NORMAL = cTag("pumpkins/normal"); + /** For pumpkins that are already carved but not a light source. */ + public static final BlockItemTagId PUMPKINS_CARVED = cTag("pumpkins/carved"); + /** For pumpkins that are already carved and a light source. */ + public static final BlockItemTagId PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final BlockItemTagId ROPES = cTag("ropes"); + + public static final BlockItemTagId SANDS = cTag("sands"); + public static final BlockItemTagId SANDS_COLORLESS = cTag("sands/colorless"); + public static final BlockItemTagId SANDS_RED = cTag("sands/red"); + + public static final BlockItemTagId SANDSTONE_BLOCKS = cTag("sandstone/blocks"); + public static final BlockItemTagId SANDSTONE_SLABS = cTag("sandstone/slabs"); + public static final BlockItemTagId SANDSTONE_STAIRS = cTag("sandstone/stairs"); + public static final BlockItemTagId SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); + public static final BlockItemTagId SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); + public static final BlockItemTagId SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); + public static final BlockItemTagId SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final BlockItemTagId STONES = cTag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ + public static final BlockItemTagId STORAGE_BLOCKS = cTag("storage_blocks"); + public static final BlockItemTagId STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); + public static final BlockItemTagId STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); + public static final BlockItemTagId STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); + public static final BlockItemTagId STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); + public static final BlockItemTagId STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); + public static final BlockItemTagId STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); + public static final BlockItemTagId STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); + public static final BlockItemTagId STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); + public static final BlockItemTagId STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); + public static final BlockItemTagId STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); + public static final BlockItemTagId STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); + public static final BlockItemTagId STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); + public static final BlockItemTagId STORAGE_BLOCKS_RESIN = cTag("storage_blocks/resin"); + public static final BlockItemTagId STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); + public static final BlockItemTagId STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); + public static final BlockItemTagId STRIPPED_LOGS = cTag("stripped_logs"); + public static final BlockItemTagId STRIPPED_WOODS = cTag("stripped_woods"); + //endregion + + private static BlockItemTagId cTag(String name) { + return create(Identifier.fromNamespaceAndPath("c", name)); + } + + private static BlockItemTagId forgeTag(String name) { + return create(Identifier.fromNamespaceAndPath("forge", name)); + } + + private static BlockItemTagId create(Identifier id) { + return BlockItemTagId.create(id, id); + } + } + public static class Blocks { private static void init() {} @@ -53,45 +272,45 @@ public class Tags { public static final TagKey NEEDS_WOOD_TOOL = forgeTag("needs_wood_tool"); public static final TagKey NEEDS_GOLD_TOOL = forgeTag("needs_gold_tool"); public static final TagKey NEEDS_NETHERITE_TOOL = forgeTag("needs_netherite_tool"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); + public static final TagKey STORAGE_BLOCKS_AMETHYST = BlockItems.STORAGE_BLOCKS_AMETHYST.block(); + public static final TagKey STORAGE_BLOCKS_QUARTZ = BlockItems.STORAGE_BLOCKS_QUARTZ.block(); //endregion //region `c` tags for common conventions // Note: Other loaders have additional `c` tags that are exclusive to their loader. // Forge only adopts `c` tags that are common across all loaders. - public static final TagKey BARRELS = cTag("barrels"); - public static final TagKey BARRELS_WOODEN = cTag("barrels/wooden"); + public static final TagKey BARRELS = BlockItems.BARRELS.block(); + public static final TagKey BARRELS_WOODEN = BlockItems.BARRELS_WOODEN.block(); /** * Equivalent to the "minecraft:bars" block tag. */ - public static final TagKey BARS = cTag("bars"); - public static final TagKey BARS_COPPER = cTag("bars/copper"); - public static final TagKey BARS_IRON = cTag("bars/iron"); - public static final TagKey BOOKSHELVES = cTag("bookshelves"); + public static final TagKey BARS = BlockItems.BARS.block(); + public static final TagKey BARS_COPPER = BlockItems.BARS_COPPER.block(); + public static final TagKey BARS_IRON = BlockItems.BARS_IRON.block(); + public static final TagKey BOOKSHELVES = BlockItems.BOOKSHELVES.block(); /** * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks */ - public static final TagKey BUDDING_BLOCKS = cTag("budding_blocks"); + public static final TagKey BUDDING_BLOCKS = BlockItems.BUDDING_BLOCKS.block(); /** * For blocks that are similar to amethyst where they have buddings forming from budding blocks */ - public static final TagKey BUDS = cTag("buds"); - public static final TagKey CHAINS = cTag("chains"); - public static final TagKey CHESTS = cTag("chests"); - public static final TagKey CHESTS_ENDER = cTag("chests/ender"); - public static final TagKey CHESTS_TRAPPED = cTag("chests/trapped"); - public static final TagKey CHESTS_WOODEN = cTag("chests/wooden"); + public static final TagKey BUDS = BlockItems.BUDS.block(); + public static final TagKey CHAINS = BlockItems.CHAINS.block(); + public static final TagKey CHESTS = BlockItems.CHESTS.block(); + public static final TagKey CHESTS_ENDER = BlockItems.CHESTS_ENDER.block(); + public static final TagKey CHESTS_TRAPPED = BlockItems.CHESTS_TRAPPED.block(); + public static final TagKey CHESTS_WOODEN = BlockItems.CHESTS_WOODEN.block(); /** * For blocks that are similar to amethyst where they have clusters forming from budding blocks */ - public static final TagKey CLUSTERS = cTag("clusters"); - public static final TagKey COBBLESTONES = cTag("cobblestones"); - public static final TagKey COBBLESTONES_DEEPSLATE = cTag("cobblestones/deepslate"); - public static final TagKey COBBLESTONES_INFESTED = cTag("cobblestones/infested"); - public static final TagKey COBBLESTONES_MOSSY = cTag("cobblestones/mossy"); - public static final TagKey COBBLESTONES_NORMAL = cTag("cobblestones/normal"); - public static final TagKey CONCRETES = cTag("concretes"); + public static final TagKey CLUSTERS = BlockItems.CLUSTERS.block(); + public static final TagKey COBBLESTONES = BlockItems.COBBLESTONES.block(); + public static final TagKey COBBLESTONES_DEEPSLATE = BlockItems.COBBLESTONES_DEEPSLATE.block(); + public static final TagKey COBBLESTONES_INFESTED = BlockItems.COBBLESTONES_INFESTED.block(); + public static final TagKey COBBLESTONES_MOSSY = BlockItems.COBBLESTONES_MOSSY.block(); + public static final TagKey COBBLESTONES_NORMAL = BlockItems.COBBLESTONES_NORMAL.block(); + public static final TagKey CONCRETES = BlockItems.CONCRETES.block(); /** * Tag that holds all blocks that can be dyed a specific color. @@ -115,46 +334,46 @@ public class Tags { public static final TagKey DYED_WHITE = cTag("dyed/white"); public static final TagKey DYED_YELLOW = cTag("dyed/yellow"); - public static final TagKey END_STONES = cTag("end_stones"); + public static final TagKey END_STONES = BlockItems.END_STONES.block(); - public static final TagKey FENCE_GATES = cTag("fence_gates"); - public static final TagKey FENCE_GATES_WOODEN = cTag("fence_gates/wooden"); + public static final TagKey FENCE_GATES = BlockItems.FENCE_GATES.block(); + public static final TagKey FENCE_GATES_WOODEN = BlockItems.FENCE_GATES_WOODEN.block(); - public static final TagKey FENCES = cTag("fences"); - public static final TagKey FENCES_NETHER_BRICK = cTag("fences/nether_brick"); - public static final TagKey FENCES_WOODEN = cTag("fences/wooden"); + public static final TagKey FENCES = BlockItems.FENCES.block(); + public static final TagKey FENCES_NETHER_BRICK = BlockItems.FENCES_NETHER_BRICK.block(); + public static final TagKey FENCES_WOODEN = BlockItems.FENCES_WOODEN.block(); /** * Contains living ground-based flowers that are 1 block tall such as Dandelions or Poppy. * Equivalent to the {@code minecraft:small_flowers} block tag. * This is NOT aliased with {@link BlockTags#SMALL_FLOWERS} because the vanilla tag is used to make the block weak to swords. */ - public static final TagKey FLOWERS_SMALL = cTag("flowers/small"); + public static final TagKey FLOWERS_SMALL = BlockItems.FLOWERS_SMALL.block(); /** * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. * Equivalent to the {@code minecraft:tall_flowers} block tag in past Minecraft versions. */ - public static final TagKey FLOWERS_TALL = cTag("flowers/tall"); + public static final TagKey FLOWERS_TALL = BlockItems.FLOWERS_TALL.block(); /** * Contains any living plant block that contains flowers or is a flower itself. * Equivalent to the {@code minecraft:flowers} block tag. * Aliased with {@link BlockTags#FLOWERS}. */ - public static final TagKey FLOWERS = cTag("flowers"); + public static final TagKey FLOWERS = BlockItems.FLOWERS.block(); - public static final TagKey GRAVELS = cTag("gravels"); + public static final TagKey GRAVELS = BlockItems.GRAVELS.block(); - public static final TagKey GLASS_BLOCKS = cTag("glass_blocks"); - public static final TagKey GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + public static final TagKey GLASS_BLOCKS = BlockItems.GLASS_BLOCKS.block(); + public static final TagKey GLASS_BLOCKS_COLORLESS = BlockItems.GLASS_BLOCKS_COLORLESS.block(); /** * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes */ - public static final TagKey GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); - public static final TagKey GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + public static final TagKey GLASS_BLOCKS_CHEAP = BlockItems.GLASS_BLOCKS_CHEAP.block(); + public static final TagKey GLASS_BLOCKS_TINTED = BlockItems.GLASS_BLOCKS_TINTED.block(); - public static final TagKey GLASS_PANES = cTag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); - public static final TagKey GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + public static final TagKey GLASS_PANES = BlockItems.GLASS_PANES.block(); + public static final TagKey GLASS_PANES_COLORLESS = BlockItems.GLASS_PANES_COLORLESS.block(); + public static final TagKey GLAZED_TERRACOTTAS = BlockItems.GLAZED_TERRACOTTAS.block(); /** * Tag that holds all blocks that recipe viewers should not show to users. @@ -162,77 +381,77 @@ public class Tags { */ public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = cTag("hidden_from_recipe_viewers"); - public static final TagKey NATURAL_LOGS = cTag("natural_logs"); - public static final TagKey NATURAL_LOGS_NETHER = cTag("natural_logs/nether"); - public static final TagKey NATURAL_LOGS_OVERWORLD = cTag("natural_logs/overworld"); + public static final TagKey NATURAL_LOGS = BlockItems.NATURAL_LOGS.block(); + public static final TagKey NATURAL_LOGS_NETHER = BlockItems.NATURAL_LOGS_NETHER.block(); + public static final TagKey NATURAL_LOGS_OVERWORLD = BlockItems.NATURAL_LOGS_OVERWORLD.block(); - public static final TagKey NATURAL_WOODS = cTag("natural_woods"); + public static final TagKey NATURAL_WOODS = BlockItems.NATURAL_WOODS.block(); - public static final TagKey NETHERRACKS = cTag("netherracks"); + public static final TagKey NETHERRACKS = BlockItems.NETHERRACKS.block(); - public static final TagKey OBSIDIANS = cTag("obsidians"); + public static final TagKey OBSIDIANS = BlockItems.OBSIDIANS.block(); /** * For common obsidian that has no special quirks or behaviours - ideal for recipe use. * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. */ - public static final TagKey OBSIDIANS_NORMAL = cTag("obsidians/normal"); - public static final TagKey OBSIDIANS_CRYING = cTag("obsidians/crying"); + public static final TagKey OBSIDIANS_NORMAL = BlockItems.OBSIDIANS_NORMAL.block(); + public static final TagKey OBSIDIANS_CRYING = BlockItems.OBSIDIANS_CRYING.block(); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = cTag("ore_bearing_ground/deepslate"); + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = BlockItems.ORE_BEARING_GROUND_DEEPSLATE.block(); /** * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_NETHERRACK = cTag("ore_bearing_ground/netherrack"); + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = BlockItems.ORE_BEARING_GROUND_NETHERRACK.block(); /** * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_STONE = cTag("ore_bearing_ground/stone"); + public static final TagKey ORE_BEARING_GROUND_STONE = BlockItems.ORE_BEARING_GROUND_STONE.block(); /** * Ores which on average result in more than one resource worth of materials */ - public static final TagKey ORE_RATES_DENSE = cTag("ore_rates/dense"); + public static final TagKey ORE_RATES_DENSE = BlockItems.ORE_RATES_DENSE.block(); /** * Ores which on average result in one resource worth of materials */ - public static final TagKey ORE_RATES_SINGULAR = cTag("ore_rates/singular"); + public static final TagKey ORE_RATES_SINGULAR = BlockItems.ORE_RATES_SINGULAR.block(); /** * Ores which on average result in less than one resource worth of materials */ - public static final TagKey ORE_RATES_SPARSE = cTag("ore_rates/sparse"); - public static final TagKey ORES = cTag("ores"); - public static final TagKey ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); - public static final TagKey ORES_QUARTZ = cTag("ores/quartz"); - public static final TagKey ORES_COAL = cTag("ores/coal"); - public static final TagKey ORES_COPPER = cTag("ores/copper"); - public static final TagKey ORES_DIAMOND = cTag("ores/diamond"); - public static final TagKey ORES_EMERALD = cTag("ores/emerald"); - public static final TagKey ORES_GOLD = cTag("ores/gold"); - public static final TagKey ORES_IRON = cTag("ores/iron"); - public static final TagKey ORES_LAPIS = cTag("ores/lapis"); - public static final TagKey ORES_REDSTONE = cTag("ores/redstone"); + public static final TagKey ORE_RATES_SPARSE = BlockItems.ORE_RATES_SPARSE.block(); + public static final TagKey ORES = BlockItems.ORES.block(); + public static final TagKey ORES_NETHERITE_SCRAP = BlockItems.ORES_NETHERITE_SCRAP.block(); + public static final TagKey ORES_QUARTZ = BlockItems.ORES_QUARTZ.block(); + public static final TagKey ORES_COAL = BlockItems.ORES_COAL.block(); + public static final TagKey ORES_COPPER = BlockItems.ORES_COPPER.block(); + public static final TagKey ORES_DIAMOND = BlockItems.ORES_DIAMOND.block(); + public static final TagKey ORES_EMERALD = BlockItems.ORES_EMERALD.block(); + public static final TagKey ORES_GOLD = BlockItems.ORES_GOLD.block(); + public static final TagKey ORES_IRON = BlockItems.ORES_IRON.block(); + public static final TagKey ORES_LAPIS = BlockItems.ORES_LAPIS.block(); + public static final TagKey ORES_REDSTONE = BlockItems.ORES_REDSTONE.block(); /** * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output */ - public static final TagKey ORES_IN_GROUND_DEEPSLATE = cTag("ores_in_ground/deepslate"); + public static final TagKey ORES_IN_GROUND_DEEPSLATE = BlockItems.ORES_IN_GROUND_DEEPSLATE.block(); /** * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output */ - public static final TagKey ORES_IN_GROUND_NETHERRACK = cTag("ores_in_ground/netherrack"); + public static final TagKey ORES_IN_GROUND_NETHERRACK = BlockItems.ORES_IN_GROUND_NETHERRACK.block(); /** * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ - public static final TagKey ORES_IN_GROUND_STONE = cTag("ores_in_ground/stone"); - public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); - public static final TagKey PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); - public static final TagKey PUMPKINS = cTag("pumpkins"); + public static final TagKey ORES_IN_GROUND_STONE = BlockItems.ORES_IN_GROUND_STONE.block(); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = BlockItems.PLAYER_WORKSTATIONS_CRAFTING_TABLES.block(); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = BlockItems.PLAYER_WORKSTATIONS_FURNACES.block(); + public static final TagKey PUMPKINS = BlockItems.PUMPKINS.block(); /** For pumpkins that are not carved. */ - public static final TagKey PUMPKINS_NORMAL = cTag("pumpkins/normal"); + public static final TagKey PUMPKINS_NORMAL = BlockItems.PUMPKINS_NORMAL.block(); /** For pumpkins that are already carved but not a light source. */ - public static final TagKey PUMPKINS_CARVED = cTag("pumpkins/carved"); + public static final TagKey PUMPKINS_CARVED = BlockItems.PUMPKINS_CARVED.block(); /** For pumpkins that are already carved and a light source. */ - public static final TagKey PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final TagKey PUMPKINS_JACK_O_LANTERNS = BlockItems.PUMPKINS_JACK_O_LANTERNS.block(); /** * Blocks should be included in this tag if their movement/relocation can cause serious issues such * as world corruption upon being moved or for balance reason where the block should not be able to be relocated. @@ -240,21 +459,21 @@ public class Tags { * {@link BlockBehaviour.BlockStateBase#getPistonPushReaction}. */ public static final TagKey RELOCATION_NOT_SUPPORTED = cTag("relocation_not_supported"); - public static final TagKey ROPES = cTag("ropes"); + public static final TagKey ROPES = BlockItems.ROPES.block(); - public static final TagKey SANDS = cTag("sands"); - public static final TagKey SANDS_COLORLESS = cTag("sands/colorless"); - public static final TagKey SANDS_RED = cTag("sands/red"); + public static final TagKey SANDS = BlockItems.SANDS.block(); + public static final TagKey SANDS_COLORLESS = BlockItems.SANDS_COLORLESS.block(); + public static final TagKey SANDS_RED = BlockItems.SANDS_RED.block(); - public static final TagKey SANDSTONE_BLOCKS = cTag("sandstone/blocks"); - public static final TagKey SANDSTONE_SLABS = cTag("sandstone/slabs"); - public static final TagKey SANDSTONE_STAIRS = cTag("sandstone/stairs"); - public static final TagKey SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); - public static final TagKey SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); - public static final TagKey SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); - public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); - public static final TagKey SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); - public static final TagKey SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + public static final TagKey SANDSTONE_BLOCKS = BlockItems.SANDSTONE_BLOCKS.block(); + public static final TagKey SANDSTONE_SLABS = BlockItems.SANDSTONE_SLABS.block(); + public static final TagKey SANDSTONE_STAIRS = BlockItems.SANDSTONE_STAIRS.block(); + public static final TagKey SANDSTONE_RED_BLOCKS = BlockItems.SANDSTONE_RED_BLOCKS.block(); + public static final TagKey SANDSTONE_RED_SLABS = BlockItems.SANDSTONE_RED_SLABS.block(); + public static final TagKey SANDSTONE_RED_STAIRS = BlockItems.SANDSTONE_RED_STAIRS.block(); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = BlockItems.SANDSTONE_UNCOLORED_BLOCKS.block(); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = BlockItems.SANDSTONE_UNCOLORED_SLABS.block(); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = BlockItems.SANDSTONE_UNCOLORED_STAIRS.block(); /** * Tag that holds all head based blocks such as Skeleton Skull or Player Head. (Named skulls to match minecraft:skulls item tag) */ @@ -262,7 +481,7 @@ public class Tags { /** * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. */ - public static final TagKey STONES = cTag("stones"); + public static final TagKey STONES = BlockItems.STONES.block(); /** * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block * and has a mirror recipe to reverse the crafting with no loss in resources. @@ -270,26 +489,26 @@ public class Tags { * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe * and so, it is considered a special case and not given a storage block tag. */ - public static final TagKey STORAGE_BLOCKS = cTag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); - public static final TagKey STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); - public static final TagKey STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); - public static final TagKey STORAGE_BLOCKS_RESIN = cTag("storage_blocks/resin"); - public static final TagKey STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); - public static final TagKey STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); - public static final TagKey STRIPPED_LOGS = cTag("stripped_logs"); - public static final TagKey STRIPPED_WOODS = cTag("stripped_woods"); + public static final TagKey STORAGE_BLOCKS = BlockItems.STORAGE_BLOCKS.block(); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = BlockItems.STORAGE_BLOCKS_BONE_MEAL.block(); + public static final TagKey STORAGE_BLOCKS_COAL = BlockItems.STORAGE_BLOCKS_COAL.block(); + public static final TagKey STORAGE_BLOCKS_COPPER = BlockItems.STORAGE_BLOCKS_COPPER.block(); + public static final TagKey STORAGE_BLOCKS_DIAMOND = BlockItems.STORAGE_BLOCKS_DIAMOND.block(); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = BlockItems.STORAGE_BLOCKS_DRIED_KELP.block(); + public static final TagKey STORAGE_BLOCKS_EMERALD = BlockItems.STORAGE_BLOCKS_EMERALD.block(); + public static final TagKey STORAGE_BLOCKS_GOLD = BlockItems.STORAGE_BLOCKS_GOLD.block(); + public static final TagKey STORAGE_BLOCKS_IRON = BlockItems.STORAGE_BLOCKS_IRON.block(); + public static final TagKey STORAGE_BLOCKS_LAPIS = BlockItems.STORAGE_BLOCKS_LAPIS.block(); + public static final TagKey STORAGE_BLOCKS_NETHERITE = BlockItems.STORAGE_BLOCKS_NETHERITE.block(); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = BlockItems.STORAGE_BLOCKS_RAW_COPPER.block(); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = BlockItems.STORAGE_BLOCKS_RAW_GOLD.block(); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = BlockItems.STORAGE_BLOCKS_RAW_IRON.block(); + public static final TagKey STORAGE_BLOCKS_REDSTONE = BlockItems.STORAGE_BLOCKS_REDSTONE.block(); + public static final TagKey STORAGE_BLOCKS_RESIN = BlockItems.STORAGE_BLOCKS_RESIN.block(); + public static final TagKey STORAGE_BLOCKS_SLIME = BlockItems.STORAGE_BLOCKS_SLIME.block(); + public static final TagKey STORAGE_BLOCKS_WHEAT = BlockItems.STORAGE_BLOCKS_WHEAT.block(); + public static final TagKey STRIPPED_LOGS = BlockItems.STRIPPED_LOGS.block(); + public static final TagKey STRIPPED_WOODS = BlockItems.STRIPPED_WOODS.block(); public static final TagKey VILLAGER_JOB_SITES = cTag("villager_job_sites"); //endregion @@ -346,23 +565,23 @@ public class Tags { */ public static final TagKey ENCHANTING_FUELS = forgeTag("enchanting_fuels"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = forgeTag("storage_blocks/amethyst"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = forgeTag("storage_blocks/quartz"); + public static final TagKey STORAGE_BLOCKS_AMETHYST = BlockItems.STORAGE_BLOCKS_AMETHYST.item(); + public static final TagKey STORAGE_BLOCKS_QUARTZ = BlockItems.STORAGE_BLOCKS_QUARTZ.item(); //endregion //region `c` tags for common conventions // Note: Other loaders have additional `c` tags that are exclusive to their loader. // Forge only adopts `c` tags that are common across all loaders. - public static final TagKey BARRELS = cTag("barrels"); - public static final TagKey BARRELS_WOODEN = cTag("barrels/wooden"); + public static final TagKey BARRELS = BlockItems.BARRELS.item(); + public static final TagKey BARRELS_WOODEN = BlockItems.BARRELS_WOODEN.item(); /** * Equivalent to the "minecraft:bars" item tag. */ - public static final TagKey BARS = cTag("bars"); - public static final TagKey BARS_COPPER = cTag("bars/copper"); - public static final TagKey BARS_IRON = cTag("bars/iron"); + public static final TagKey BARS = BlockItems.BARS.item(); + public static final TagKey BARS_COPPER = BlockItems.BARS_COPPER.item(); + public static final TagKey BARS_IRON = BlockItems.BARS_IRON.item(); public static final TagKey BONES = cTag("bones"); - public static final TagKey BOOKSHELVES = cTag("bookshelves"); + public static final TagKey BOOKSHELVES = BlockItems.BOOKSHELVES.item(); public static final TagKey BRICKS = cTag("bricks"); public static final TagKey BRICKS_NORMAL = cTag("bricks/normal"); public static final TagKey BRICKS_NETHER = cTag("bricks/nether"); @@ -384,22 +603,22 @@ public class Tags { /** * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks */ - public static final TagKey BUDDING_BLOCKS = cTag("budding_blocks"); + public static final TagKey BUDDING_BLOCKS = BlockItems.BUDDING_BLOCKS.item(); /** * For blocks that are similar to amethyst where they have buddings forming from budding blocks */ - public static final TagKey BUDS = cTag("buds"); - public static final TagKey CHAINS = cTag("chains"); - public static final TagKey CHESTS = cTag("chests"); - public static final TagKey CHESTS_WOODEN = cTag("chests/wooden"); - public static final TagKey CHESTS_ENDER = cTag("chests/ender"); - public static final TagKey CHESTS_TRAPPED = cTag("chests/trapped"); - public static final TagKey COBBLESTONES = cTag("cobblestones"); - public static final TagKey COBBLESTONES_NORMAL = cTag("cobblestones/normal"); - public static final TagKey COBBLESTONES_INFESTED = cTag("cobblestones/infested"); - public static final TagKey COBBLESTONES_MOSSY = cTag("cobblestones/mossy"); - public static final TagKey COBBLESTONES_DEEPSLATE = cTag("cobblestones/deepslate"); - public static final TagKey CONCRETES = cTag("concretes"); + public static final TagKey BUDS = BlockItems.BUDS.item(); + public static final TagKey CHAINS = BlockItems.CHAINS.item(); + public static final TagKey CHESTS = BlockItems.CHESTS.item(); + public static final TagKey CHESTS_WOODEN = BlockItems.CHESTS_WOODEN.item(); + public static final TagKey CHESTS_ENDER = BlockItems.CHESTS_ENDER.item(); + public static final TagKey CHESTS_TRAPPED = BlockItems.CHESTS_TRAPPED.item(); + public static final TagKey COBBLESTONES = BlockItems.COBBLESTONES.item(); + public static final TagKey COBBLESTONES_NORMAL = BlockItems.COBBLESTONES_NORMAL.item(); + public static final TagKey COBBLESTONES_INFESTED = BlockItems.COBBLESTONES_INFESTED.item(); + public static final TagKey COBBLESTONES_MOSSY = BlockItems.COBBLESTONES_MOSSY.item(); + public static final TagKey COBBLESTONES_DEEPSLATE = BlockItems.COBBLESTONES_DEEPSLATE.item(); + public static final TagKey CONCRETES = BlockItems.CONCRETES.item(); /** * Block tag equivalent is {@link BlockTags#CONCRETE_POWDER} */ @@ -407,7 +626,7 @@ public class Tags { /** * For blocks that are similar to amethyst where they have clusters forming from budding blocks */ - public static final TagKey CLUSTERS = cTag("clusters"); + public static final TagKey CLUSTERS = BlockItems.CLUSTERS.item(); public static final TagKey CLUMPS = cTag("clumps"); public static final TagKey CLUMPS_RESIN = cTag("clumps/resin"); /** @@ -514,15 +733,15 @@ public class Tags { public static final TagKey DYES_WHITE = DyeColor.WHITE.getTag(); public static final TagKey EGGS = cTag("eggs"); - public static final TagKey END_STONES = cTag("end_stones"); + public static final TagKey END_STONES = BlockItems.END_STONES.item(); public static final TagKey ENDER_PEARLS = cTag("ender_pearls"); public static final TagKey FEATHERS = cTag("feathers"); - public static final TagKey FENCE_GATES = cTag("fence_gates"); - public static final TagKey FENCE_GATES_WOODEN = cTag("fence_gates/wooden"); - public static final TagKey FENCES = cTag("fences"); - public static final TagKey FENCES_NETHER_BRICK = cTag("fences/nether_brick"); - public static final TagKey FENCES_WOODEN = cTag("fences/wooden"); + public static final TagKey FENCE_GATES = BlockItems.FENCE_GATES.item(); + public static final TagKey FENCE_GATES_WOODEN = BlockItems.FENCE_GATES_WOODEN.item(); + public static final TagKey FENCES = BlockItems.FENCES.item(); + public static final TagKey FENCES_NETHER_BRICK = BlockItems.FENCES_NETHER_BRICK.item(); + public static final TagKey FENCES_WOODEN = BlockItems.FENCES_WOODEN.item(); /** * For bonemeal-like items that can grow plants. */ @@ -532,17 +751,17 @@ public class Tags { * Equivalent to the {@code minecraft:small_flowers} item tag. * Aliased with {@link ItemTags#SMALL_FLOWERS}. */ - public static final TagKey FLOWERS_SMALL = cTag("flowers/small"); + public static final TagKey FLOWERS_SMALL = BlockItems.FLOWERS_SMALL.item(); /** * Contains living ground-based flowers that are 2 block tall such as Rose Bush or Peony. * Equivalent to the {@code minecraft:tall_flowers} item tag in past Minecraft versions. */ - public static final TagKey FLOWERS_TALL = cTag("flowers/tall"); + public static final TagKey FLOWERS_TALL = BlockItems.FLOWERS_TALL.item(); /** * Contains any living plant block that contains flowers or is a flower itself. * Equivalent to the {@code minecraft:flowers} item tag in past Minecraft versions. */ - public static final TagKey FLOWERS = cTag("flowers"); + public static final TagKey FLOWERS = BlockItems.FLOWERS.item(); public static final TagKey FOODS = cTag("foods"); /** * Apples and other foods that are considered fruits in the culinary field belong in this tag. @@ -616,76 +835,79 @@ public class Tags { public static final TagKey GEMS_PRISMARINE = cTag("gems/prismarine"); public static final TagKey GEMS_QUARTZ = cTag("gems/quartz"); - public static final TagKey GLASS_BLOCKS = cTag("glass_blocks"); - public static final TagKey GLASS_BLOCKS_COLORLESS = cTag("glass_blocks/colorless"); + public static final TagKey GLASS_BLOCKS = BlockItems.GLASS_BLOCKS.item(); + public static final TagKey GLASS_BLOCKS_COLORLESS = BlockItems.GLASS_BLOCKS_COLORLESS.item(); /** * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes */ - public static final TagKey GLASS_BLOCKS_CHEAP = cTag("glass_blocks/cheap"); - public static final TagKey GLASS_BLOCKS_TINTED = cTag("glass_blocks/tinted"); + public static final TagKey GLASS_BLOCKS_CHEAP = BlockItems.GLASS_BLOCKS_CHEAP.item(); + public static final TagKey GLASS_BLOCKS_TINTED = BlockItems.GLASS_BLOCKS_TINTED.item(); - public static final TagKey GLASS_PANES = cTag("glass_panes"); - public static final TagKey GLASS_PANES_COLORLESS = cTag("glass_panes/colorless"); - public static final TagKey GLAZED_TERRACOTTAS = cTag("glazed_terracottas"); + public static final TagKey GLASS_PANES = BlockItems.GLASS_PANES.item(); + public static final TagKey GLASS_PANES_COLORLESS = BlockItems.GLASS_PANES_COLORLESS.item(); + public static final TagKey GLAZED_TERRACOTTAS = BlockItems.GLAZED_TERRACOTTAS.item(); - public static final TagKey GRAVELS = cTag("gravels"); + public static final TagKey GRAVELS = BlockItems.GRAVELS.item(); public static final TagKey GUNPOWDERS = cTag("gunpowders"); /** * Tag that holds all items that recipe viewers should not show to users. */ public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = cTag("hidden_from_recipe_viewers"); - public static final TagKey OBSIDIANS = cTag("obsidians"); + public static final TagKey OBSIDIANS = BlockItems.OBSIDIANS.item(); /** * For common obsidian that has no special quirks or behaviours - ideal for recipe use. * Crying Obsidian, for example, is a light block and harder to obtain. So it gets its own tag instead of being under normal tag. */ - public static final TagKey OBSIDIANS_NORMAL = cTag("obsidians/normal"); - public static final TagKey OBSIDIANS_CRYING = cTag("obsidians/crying"); + public static final TagKey OBSIDIANS_NORMAL = BlockItems.OBSIDIANS_NORMAL.item(); + public static final TagKey OBSIDIANS_CRYING = BlockItems.OBSIDIANS_CRYING.item(); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = cTag("ore_bearing_ground/deepslate"); + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = BlockItems.ORE_BEARING_GROUND_DEEPSLATE.item(); /** * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_NETHERRACK = cTag("ore_bearing_ground/netherrack"); + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = BlockItems.ORE_BEARING_GROUND_NETHERRACK.item(); /** * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation */ - public static final TagKey ORE_BEARING_GROUND_STONE = cTag("ore_bearing_ground/stone"); + public static final TagKey ORE_BEARING_GROUND_STONE = BlockItems.ORE_BEARING_GROUND_STONE.item(); /** * Ores which on average result in more than one resource worth of materials */ - public static final TagKey ORE_RATES_DENSE = cTag("ore_rates/dense"); + public static final TagKey ORE_RATES_DENSE = BlockItems.ORE_RATES_DENSE.item(); /** * Ores which on average result in one resource worth of materials */ - public static final TagKey ORE_RATES_SINGULAR = cTag("ore_rates/singular"); + public static final TagKey ORE_RATES_SINGULAR = BlockItems.ORE_RATES_SINGULAR.item(); /** * Ores which on average result in less than one resource worth of materials */ - public static final TagKey ORE_RATES_SPARSE = cTag("ore_rates/sparse"); - public static final TagKey ORES_COAL = cTag("ores/coal"); - public static final TagKey ORES_COPPER = cTag("ores/copper"); - public static final TagKey ORES_DIAMOND = cTag("ores/diamond"); - public static final TagKey ORES_EMERALD = cTag("ores/emerald"); - public static final TagKey ORES_GOLD = cTag("ores/gold"); - public static final TagKey ORES_IRON = cTag("ores/iron"); - public static final TagKey ORES_LAPIS = cTag("ores/lapis"); - public static final TagKey ORES_REDSTONE = cTag("ores/redstone"); + public static final TagKey ORE_RATES_SPARSE = BlockItems.ORE_RATES_SPARSE.item(); + public static final TagKey ORES = BlockItems.ORES.item(); + public static final TagKey ORES_COAL = BlockItems.ORES_COAL.item(); + public static final TagKey ORES_COPPER = BlockItems.ORES_COPPER.item(); + public static final TagKey ORES_DIAMOND = BlockItems.ORES_DIAMOND.item(); + public static final TagKey ORES_EMERALD = BlockItems.ORES_EMERALD.item(); + public static final TagKey ORES_GOLD = BlockItems.ORES_GOLD.item(); + public static final TagKey ORES_IRON = BlockItems.ORES_IRON.item(); + public static final TagKey ORES_LAPIS = BlockItems.ORES_LAPIS.item(); + public static final TagKey ORES_NETHERITE_SCRAP = BlockItems.ORES_NETHERITE_SCRAP.item(); + public static final TagKey ORES_QUARTZ = BlockItems.ORES_QUARTZ.item(); + public static final TagKey ORES_REDSTONE = BlockItems.ORES_REDSTONE.item(); /** * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output */ - public static final TagKey ORES_IN_GROUND_DEEPSLATE = cTag("ores_in_ground/deepslate"); + public static final TagKey ORES_IN_GROUND_DEEPSLATE = BlockItems.ORES_IN_GROUND_DEEPSLATE.item(); /** * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output */ - public static final TagKey ORES_IN_GROUND_NETHERRACK = cTag("ores_in_ground/netherrack"); + public static final TagKey ORES_IN_GROUND_NETHERRACK = BlockItems.ORES_IN_GROUND_NETHERRACK.item(); /** * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ - public static final TagKey ORES_IN_GROUND_STONE = cTag("ores_in_ground/stone"); + public static final TagKey ORES_IN_GROUND_STONE = BlockItems.ORES_IN_GROUND_STONE.item(); public static final TagKey INGOTS = cTag("ingots"); public static final TagKey INGOTS_COPPER = cTag("ingots/copper"); public static final TagKey INGOTS_GOLD = cTag("ingots/gold"); @@ -698,30 +920,27 @@ public class Tags { * A pancake with a JUKEBOX_PLAYABLE component attached to play in Jukeboxes as an Easter Egg is not a music disc and would not go in this tag. */ public static final TagKey MUSIC_DISCS = cTag("music_discs"); - public static final TagKey NATURAL_LOGS = cTag("natural_logs"); - public static final TagKey NATURAL_LOGS_NETHER = cTag("natural_logs/nether"); - public static final TagKey NATURAL_LOGS_OVERWORLD = cTag("natural_logs/overworld"); - public static final TagKey NATURAL_WOODS = cTag("natural_woods"); + public static final TagKey NATURAL_LOGS = BlockItems.NATURAL_LOGS.item(); + public static final TagKey NATURAL_LOGS_NETHER = BlockItems.NATURAL_LOGS_NETHER.item(); + public static final TagKey NATURAL_LOGS_OVERWORLD = BlockItems.NATURAL_LOGS_OVERWORLD.item(); + public static final TagKey NATURAL_WOODS = BlockItems.NATURAL_WOODS.item(); public static final TagKey NETHER_STARS = cTag("nether_stars"); - public static final TagKey NETHERRACKS = cTag("netherracks"); + public static final TagKey NETHERRACKS = BlockItems.NETHERRACKS.item(); public static final TagKey NUGGETS = cTag("nuggets"); public static final TagKey NUGGETS_COPPER = cTag("nuggets/copper"); public static final TagKey NUGGETS_GOLD = cTag("nuggets/gold"); public static final TagKey NUGGETS_IRON = cTag("nuggets/iron"); - public static final TagKey ORES = cTag("ores"); - public static final TagKey ORES_NETHERITE_SCRAP = cTag("ores/netherite_scrap"); - public static final TagKey ORES_QUARTZ = cTag("ores/quartz"); public static final TagKey POTIONS = cTag("potions"); public static final TagKey POTIONS_BOTTLE = cTag("potions/bottle"); - public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = cTag("player_workstations/crafting_tables"); - public static final TagKey PLAYER_WORKSTATIONS_FURNACES = cTag("player_workstations/furnaces"); - public static final TagKey PUMPKINS = cTag("pumpkins"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = BlockItems.PLAYER_WORKSTATIONS_CRAFTING_TABLES.item(); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = BlockItems.PLAYER_WORKSTATIONS_FURNACES.item(); + public static final TagKey PUMPKINS = BlockItems.PUMPKINS.item(); /** For pumpkins that are not carved. */ - public static final TagKey PUMPKINS_NORMAL = cTag("pumpkins/normal"); + public static final TagKey PUMPKINS_NORMAL = BlockItems.PUMPKINS_NORMAL.item(); /** For pumpkins that are already carved but not a light source. */ - public static final TagKey PUMPKINS_CARVED = cTag("pumpkins/carved"); + public static final TagKey PUMPKINS_CARVED = BlockItems.PUMPKINS_CARVED.item(); /** For pumpkins that are already carved and a light source. */ - public static final TagKey PUMPKINS_JACK_O_LANTERNS = cTag("pumpkins/jack_o_lanterns"); + public static final TagKey PUMPKINS_JACK_O_LANTERNS = BlockItems.PUMPKINS_JACK_O_LANTERNS.item(); public static final TagKey RAW_MATERIALS = cTag("raw_materials"); public static final TagKey RAW_MATERIALS_COPPER = cTag("raw_materials/copper"); public static final TagKey RAW_MATERIALS_GOLD = cTag("raw_materials/gold"); @@ -737,11 +956,11 @@ public class Tags { * One example is a mod adds stick variants such as Spruce Sticks but would like stick recipes to be able to use it. */ public static final TagKey RODS_WOODEN = cTag("rods/wooden"); - public static final TagKey ROPES = cTag("ropes"); + public static final TagKey ROPES = BlockItems.ROPES.item(); - public static final TagKey SANDS = cTag("sands"); - public static final TagKey SANDS_COLORLESS = cTag("sands/colorless"); - public static final TagKey SANDS_RED = cTag("sands/red"); + public static final TagKey SANDS = BlockItems.SANDS.item(); + public static final TagKey SANDS_COLORLESS = BlockItems.SANDS_COLORLESS.item(); + public static final TagKey SANDS_RED = BlockItems.SANDS_RED.item(); public static final TagKey SEEDS = cTag("seeds"); public static final TagKey SEEDS_BEETROOT = cTag("seeds/beetroot"); @@ -751,15 +970,15 @@ public class Tags { public static final TagKey SEEDS_TORCHFLOWER = cTag("seeds/torchflower"); public static final TagKey SEEDS_WHEAT = cTag("seeds/wheat"); - public static final TagKey SANDSTONE_BLOCKS = cTag("sandstone/blocks"); - public static final TagKey SANDSTONE_SLABS = cTag("sandstone/slabs"); - public static final TagKey SANDSTONE_STAIRS = cTag("sandstone/stairs"); - public static final TagKey SANDSTONE_RED_BLOCKS = cTag("sandstone/red_blocks"); - public static final TagKey SANDSTONE_RED_SLABS = cTag("sandstone/red_slabs"); - public static final TagKey SANDSTONE_RED_STAIRS = cTag("sandstone/red_stairs"); - public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = cTag("sandstone/uncolored_blocks"); - public static final TagKey SANDSTONE_UNCOLORED_SLABS = cTag("sandstone/uncolored_slabs"); - public static final TagKey SANDSTONE_UNCOLORED_STAIRS = cTag("sandstone/uncolored_stairs"); + public static final TagKey SANDSTONE_BLOCKS = BlockItems.SANDSTONE_BLOCKS.item(); + public static final TagKey SANDSTONE_SLABS = BlockItems.SANDSTONE_SLABS.item(); + public static final TagKey SANDSTONE_STAIRS = BlockItems.SANDSTONE_STAIRS.item(); + public static final TagKey SANDSTONE_RED_BLOCKS = BlockItems.SANDSTONE_RED_BLOCKS.item(); + public static final TagKey SANDSTONE_RED_SLABS = BlockItems.SANDSTONE_RED_SLABS.item(); + public static final TagKey SANDSTONE_RED_STAIRS = BlockItems.SANDSTONE_RED_STAIRS.item(); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = BlockItems.SANDSTONE_UNCOLORED_BLOCKS.item(); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = BlockItems.SANDSTONE_UNCOLORED_SLABS.item(); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = BlockItems.SANDSTONE_UNCOLORED_STAIRS.item(); /** * Block tag equivalent is {@link BlockTags#SHULKER_BOXES} @@ -769,7 +988,7 @@ public class Tags { /** * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. */ - public static final TagKey STONES = cTag("stones"); + public static final TagKey STONES = BlockItems.STONES.item(); /** * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block * and has a mirror recipe to reverse the crafting with no loss in resources. @@ -777,27 +996,27 @@ public class Tags { * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe * and so, it is considered a special case and not given a storage block tag. */ - public static final TagKey STORAGE_BLOCKS = cTag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_BONE_MEAL = cTag("storage_blocks/bone_meal"); - public static final TagKey STORAGE_BLOCKS_COAL = cTag("storage_blocks/coal"); - public static final TagKey STORAGE_BLOCKS_COPPER = cTag("storage_blocks/copper"); - public static final TagKey STORAGE_BLOCKS_DIAMOND = cTag("storage_blocks/diamond"); - public static final TagKey STORAGE_BLOCKS_DRIED_KELP = cTag("storage_blocks/dried_kelp"); - public static final TagKey STORAGE_BLOCKS_EMERALD = cTag("storage_blocks/emerald"); - public static final TagKey STORAGE_BLOCKS_GOLD = cTag("storage_blocks/gold"); - public static final TagKey STORAGE_BLOCKS_IRON = cTag("storage_blocks/iron"); - public static final TagKey STORAGE_BLOCKS_LAPIS = cTag("storage_blocks/lapis"); - public static final TagKey STORAGE_BLOCKS_NETHERITE = cTag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_RAW_COPPER = cTag("storage_blocks/raw_copper"); - public static final TagKey STORAGE_BLOCKS_RAW_GOLD = cTag("storage_blocks/raw_gold"); - public static final TagKey STORAGE_BLOCKS_RAW_IRON = cTag("storage_blocks/raw_iron"); - public static final TagKey STORAGE_BLOCKS_REDSTONE = cTag("storage_blocks/redstone"); - public static final TagKey STORAGE_BLOCKS_RESIN = cTag("storage_blocks/resin"); - public static final TagKey STORAGE_BLOCKS_SLIME = cTag("storage_blocks/slime"); - public static final TagKey STORAGE_BLOCKS_WHEAT = cTag("storage_blocks/wheat"); + public static final TagKey STORAGE_BLOCKS = BlockItems.STORAGE_BLOCKS.item(); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = BlockItems.STORAGE_BLOCKS_BONE_MEAL.item(); + public static final TagKey STORAGE_BLOCKS_COAL = BlockItems.STORAGE_BLOCKS_COAL.item(); + public static final TagKey STORAGE_BLOCKS_COPPER = BlockItems.STORAGE_BLOCKS_COPPER.item(); + public static final TagKey STORAGE_BLOCKS_DIAMOND = BlockItems.STORAGE_BLOCKS_DIAMOND.item(); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = BlockItems.STORAGE_BLOCKS_DRIED_KELP.item(); + public static final TagKey STORAGE_BLOCKS_EMERALD = BlockItems.STORAGE_BLOCKS_EMERALD.item(); + public static final TagKey STORAGE_BLOCKS_GOLD = BlockItems.STORAGE_BLOCKS_GOLD.item(); + public static final TagKey STORAGE_BLOCKS_IRON = BlockItems.STORAGE_BLOCKS_IRON.item(); + public static final TagKey STORAGE_BLOCKS_LAPIS = BlockItems.STORAGE_BLOCKS_LAPIS.item(); + public static final TagKey STORAGE_BLOCKS_NETHERITE = BlockItems.STORAGE_BLOCKS_NETHERITE.item(); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = BlockItems.STORAGE_BLOCKS_RAW_COPPER.item(); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = BlockItems.STORAGE_BLOCKS_RAW_GOLD.item(); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = BlockItems.STORAGE_BLOCKS_RAW_IRON.item(); + public static final TagKey STORAGE_BLOCKS_REDSTONE = BlockItems.STORAGE_BLOCKS_REDSTONE.item(); + public static final TagKey STORAGE_BLOCKS_RESIN = BlockItems.STORAGE_BLOCKS_RESIN.item(); + public static final TagKey STORAGE_BLOCKS_SLIME = BlockItems.STORAGE_BLOCKS_SLIME.item(); + public static final TagKey STORAGE_BLOCKS_WHEAT = BlockItems.STORAGE_BLOCKS_WHEAT.item(); public static final TagKey STRINGS = cTag("strings"); - public static final TagKey STRIPPED_LOGS = cTag("stripped_logs"); - public static final TagKey STRIPPED_WOODS = cTag("stripped_woods"); + public static final TagKey STRIPPED_LOGS = BlockItems.STRIPPED_LOGS.item(); + public static final TagKey STRIPPED_WOODS = BlockItems.STRIPPED_WOODS.item(); public static final TagKey VILLAGER_JOB_SITES = cTag("villager_job_sites"); // Tools and Armors diff --git a/src/main/java/net/minecraftforge/common/UsernameCache.java b/src/main/java/net/minecraftforge/common/UsernameCache.java index 41a4219976..d328ed15ad 100644 --- a/src/main/java/net/minecraftforge/common/UsernameCache.java +++ b/src/main/java/net/minecraftforge/common/UsernameCache.java @@ -16,7 +16,6 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; -import com.google.common.base.Charsets; import net.minecraftforge.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,7 +38,6 @@ import org.jetbrains.annotations.Nullable; * the caches underlying map. */ public final class UsernameCache { - private static Map map = new HashMap<>(); private static final Path saveFile = FMLLoader.getGamePath().resolve("usernamecache.json"); @@ -58,8 +56,7 @@ public final class UsernameCache { * @param username * the player's username */ - protected static void setUsername(UUID uuid, String username) - { + protected static void setUsername(UUID uuid, String username) { Objects.requireNonNull(uuid); Objects.requireNonNull(username); @@ -76,12 +73,10 @@ public final class UsernameCache { * the player's {@link java.util.UUID UUID} * @return if the cache contained the user */ - protected static boolean removeUsername(UUID uuid) - { + protected static boolean removeUsername(UUID uuid) { Objects.requireNonNull(uuid); - if (map.remove(uuid) != null) - { + if (map.remove(uuid) != null) { save(); return true; } @@ -100,8 +95,7 @@ public final class UsernameCache { * cache doesn't have a record of the last username */ @Nullable - public static String getLastKnownUsername(UUID uuid) - { + public static String getLastKnownUsername(UUID uuid) { Objects.requireNonNull(uuid); return map.get(uuid); } @@ -113,8 +107,7 @@ public final class UsernameCache { * the player's {@link java.util.UUID UUID} * @return if the cache contains a username for the given player */ - public static boolean containsUUID(UUID uuid) - { + public static boolean containsUUID(UUID uuid) { Objects.requireNonNull(uuid); return map.containsKey(uuid); } @@ -124,51 +117,37 @@ public final class UsernameCache { * * @return the map */ - public static Map getMap() - { + public static Map getMap() { return ImmutableMap.copyOf(map); } /** * Save the cache to file */ - protected static void save() - { + protected static void save() { new SaveThread(gson.toJson(map)).start(); } /** * Load the cache from file */ - protected static void load() - { + protected static void load() { if (!Files.exists(saveFile)) return; - try (final BufferedReader reader = Files.newBufferedReader(saveFile, Charsets.UTF_8)) - { - @SuppressWarnings("serial") + try (final BufferedReader reader = Files.newBufferedReader(saveFile, StandardCharsets.UTF_8)) { Type type = new TypeToken>(){}.getType(); map = gson.fromJson(reader, type); - } - catch (JsonSyntaxException | IOException e) - { + } catch (JsonSyntaxException | IOException e) { LOGGER.error(USRCACHE,"Could not parse username cache file as valid json, deleting file {}", saveFile, e); - try - { + try { Files.delete(saveFile); - } - catch (IOException e1) - { + } catch (IOException e1) { LOGGER.error(USRCACHE,"Could not delete file {}", saveFile.toString()); } - } - finally - { + } finally { // Can sometimes occur when the json file is malformed if (map == null) - { map = new HashMap<>(); - } } } @@ -181,24 +160,18 @@ public final class UsernameCache { /** The data that will be saved to disk */ private final String data; - public SaveThread(String data) - { + public SaveThread(String data) { this.data = data; } @Override - public void run() - { - try - { + public void run() { + try { // Make sure we don't save when another thread is still saving - synchronized (saveFile) - { + synchronized (saveFile) { Files.write(saveFile, data.getBytes(StandardCharsets.UTF_8)); } - } - catch (IOException e) - { + } catch (IOException e) { LOGGER.error(USRCACHE, "Failed to save username cache to file!", e); } } diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java index ac45196c25..89fbe670d0 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java @@ -51,14 +51,14 @@ public final class CapabilityManager { Capability cap; synchronized (providers) { - final var parent = (Capability)providers.computeIfAbsent(new Key(type, null), k -> new Capability<>(type.intern())); + final var parent = (Capability)providers.computeIfAbsent(new Key(type, null), _ -> new Capability<>(type.intern())); if (name == null) { cap = parent; } else { // A Named child - cap = (Capability)providers.computeIfAbsent(new Key(type, name), k -> { + cap = (Capability)providers.computeIfAbsent(new Key(type, name), _ -> { var ret = new Capability<>((parent.getName() + '#' + name.toString()).intern()); - parent.addListener(p -> ret.onRegister()); + parent.addListener(_ -> ret.onRegister()); return ret; }); } diff --git a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java index 57cc4862e5..20cedb7996 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java +++ b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java @@ -286,8 +286,8 @@ public class ConditionalRecipe { public static final RecipeSerializer> SERIALZIER = new RecipeSerializer>(CODEC, StreamCodec.of( - (o, v) -> new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"), - i -> { throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); } + (_, _) -> new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"), + _ -> { throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); } ) ); diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java index b3829f7d7b..a32cc96c85 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionCodec.java @@ -45,7 +45,7 @@ public class ConditionCodec { public DataResult> decode(DynamicOps ops, T input) { var ret = normal.decode(ops, input); if (!ret.result().isPresent() || !ret.result().get().getFirst().isPresent()) - return ret.map(p -> p.mapFirst(e -> _default.get())); + return ret.map(p -> p.mapFirst(_ -> _default.get())); return ret.map(p -> p.mapFirst(Optional::get)); } } diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java index 91cd54af38..6ce9566780 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/CompoundIngredient.java @@ -93,12 +93,12 @@ public class CompoundIngredient extends AbstractIngredient { @Override public void write(RegistryFriendlyByteBuf buffer, CompoundIngredient value) { - buffer.writeCollection(value.children, (buf, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); + buffer.writeCollection(value.children, (_, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); } @Override public CompoundIngredient read(RegistryFriendlyByteBuf buffer) { - var children = buffer.readCollection(ArrayList::new, buf -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); + var children = buffer.readCollection(ArrayList::new, _ -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); return new CompoundIngredient(children); } }; diff --git a/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java b/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java index 1d40e180ae..98fec62695 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/ingredients/IntersectionIngredient.java @@ -108,13 +108,13 @@ public class IntersectionIngredient extends AbstractIngredient { @Override public IntersectionIngredient read(RegistryFriendlyByteBuf buffer) { - var children = buffer.readCollection(ArrayList::new, buf -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); + var children = buffer.readCollection(ArrayList::new, _ -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer)); return new IntersectionIngredient(children); } @Override public void write(RegistryFriendlyByteBuf buffer, IntersectionIngredient value) { - buffer.writeCollection(value.children, (b, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); + buffer.writeCollection(value.children, (_, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child)); } }; } diff --git a/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java deleted file mode 100644 index e5800223ec..0000000000 --- a/src/main/java/net/minecraftforge/common/data/BlockTagsProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import java.util.concurrent.CompletableFuture; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.registries.Registries; -import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.IntrinsicHolderTagsProvider; -import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.Nullable; - -public abstract class BlockTagsProvider extends IntrinsicHolderTagsProvider { - @SuppressWarnings("deprecation") - public BlockTagsProvider(PackOutput output, CompletableFuture lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper) { - super(output, Registries.BLOCK, lookupProvider, block -> block.builtInRegistryHolder().key(), modId, existingFileHelper); - } -} diff --git a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index 9960dc169b..c82cf63278 100644 --- a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -106,7 +106,7 @@ public class ExistingFileHelper { candidateServerResources.add(ServerPacksSource.createVanillaPackSource()); var symlinks = new ArrayList(); - var folder = new FolderRepositorySource.FolderPackDetector(new DirectoryValidator(p -> true)); + var folder = new FolderRepositorySource.FolderPackDetector(new DirectoryValidator(_ -> true)); for (Path existing : existingPacks) { try { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java index 2414204102..868099b1ea 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBiomeTagsProvider.java @@ -8,13 +8,8 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.BiomeTagsProvider; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.Identifier; import net.minecraft.tags.BiomeTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; -import net.minecraftforge.common.Tags; import org.jetbrains.annotations.ApiStatus; import java.util.concurrent.CompletableFuture; @@ -27,6 +22,7 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override protected void addTags(HolderLookup.Provider lookupProvider) { tag(NO_DEFAULT_MONSTERS).add(Biomes.MUSHROOM_FIELDS).add(Biomes.DEEP_DARK); @@ -287,17 +283,6 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider { tag(IS_OUTER_END_ISLAND).add(Biomes.END_HIGHLANDS).add(Biomes.END_MIDLANDS).add(Biomes.END_BARRENS); } - @SafeVarargs - private void tag(ResourceKey biome, TagKey... tags) { - for (TagKey key : tags) { - tag(key).add(biome); - } - } - - private static TagKey forgeTagKey(String path) { - return BiomeTags.create(Identifier.fromNamespaceAndPath("forge", path)); - } - @Override public String getName() { return "Forge Biome Tags"; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java index e7e52085f0..ccf86f1f03 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockItemTagsProvider.java @@ -5,650 +5,476 @@ package net.minecraftforge.common.data; -import java.util.Locale; -import java.util.function.Consumer; - +import java.util.function.Function; import net.minecraft.data.tags.BlockItemTagsProvider; -import net.minecraft.data.tags.TagAppender; -import net.minecraft.resources.Identifier; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; +import net.minecraft.references.BlockItemIds; +import net.minecraft.tags.BlockItemTagId; +import net.minecraft.tags.BlockItemTags; import net.minecraftforge.common.Tags; -import net.minecraftforge.registries.ForgeRegistries; - -public abstract class ForgeBlockItemTagsProvider extends BlockItemTagsProvider { - @Override - @SuppressWarnings({ "unchecked", "removal" }) - protected void run() { - tag(Tags.Blocks.BARRELS, Tags.Items.BARRELS) - .addTag(Tags.Blocks.BARRELS_WOODEN); - tag(Tags.Blocks.BARRELS_WOODEN, Tags.Items.BARRELS_WOODEN) - .add(Blocks.BARREL); - tag(Tags.Blocks.BARS_COPPER, Tags.Items.BARS_COPPER) - .addAll(Blocks.COPPER_BARS.asList()); - tag(Tags.Blocks.BARS_IRON, Tags.Items.BARS_IRON) - .add(Blocks.IRON_BARS); - tag(Tags.Blocks.BARS, Tags.Items.BARS) - .addTags(Tags.Blocks.BARS_COPPER, Tags.Blocks.BARS_IRON, BlockTags.BARS); - tag(Tags.Blocks.BOOKSHELVES, Tags.Items.BOOKSHELVES) - .add(Blocks.BOOKSHELF); - tag(Tags.Blocks.BUDDING_BLOCKS, Tags.Items.BUDDING_BLOCKS) - .add(Blocks.BUDDING_AMETHYST); - tag(Tags.Blocks.BUDS, Tags.Items.BUDS) - .add(Blocks.SMALL_AMETHYST_BUD) - .add(Blocks.MEDIUM_AMETHYST_BUD) - .add(Blocks.LARGE_AMETHYST_BUD); - tag(Tags.Blocks.CHAINS, Tags.Items.CHAINS) - .add(Blocks.IRON_CHAIN) - .addAll(Blocks.COPPER_CHAIN.asList()); - tag(Tags.Blocks.CHESTS_ENDER, Tags.Items.CHESTS_ENDER) - .add(Blocks.ENDER_CHEST); - tag(Tags.Blocks.CHESTS_TRAPPED, Tags.Items.CHESTS_TRAPPED) - .add(Blocks.TRAPPED_CHEST); - tag(Tags.Blocks.CHESTS_WOODEN, Tags.Items.CHESTS_WOODEN) - .add(Blocks.CHEST, Blocks.TRAPPED_CHEST); - tag(Tags.Blocks.CHESTS, Tags.Items.CHESTS) - .add(Blocks.COPPER_CHEST) - .addTags( - Tags.Blocks.CHESTS_ENDER, - Tags.Blocks.CHESTS_TRAPPED, - Tags.Blocks.CHESTS_WOODEN - ); - tag(Tags.Blocks.CLUSTERS, Tags.Items.CLUSTERS) - .add(Blocks.AMETHYST_CLUSTER); - tag(Tags.Blocks.COBBLESTONES_NORMAL, Tags.Items.COBBLESTONES_NORMAL) - .add(Blocks.COBBLESTONE); - tag(Tags.Blocks.COBBLESTONES_INFESTED, Tags.Items.COBBLESTONES_INFESTED) - .add(Blocks.INFESTED_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONES_MOSSY, Tags.Items.COBBLESTONES_MOSSY) - .add(Blocks.MOSSY_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONES_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE) - .add(Blocks.COBBLED_DEEPSLATE); - tag(Tags.Blocks.COBBLESTONES, Tags.Items.COBBLESTONES) - .addTags( - Tags.Blocks.COBBLESTONES_NORMAL, - Tags.Blocks.COBBLESTONES_INFESTED, - Tags.Blocks.COBBLESTONES_MOSSY, - Tags.Blocks.COBBLESTONES_DEEPSLATE - ); - tag(Tags.Blocks.CONCRETES, Tags.Items.CONCRETES) - .add( - Blocks.WHITE_CONCRETE, - Blocks.ORANGE_CONCRETE, - Blocks.MAGENTA_CONCRETE, - Blocks.LIGHT_BLUE_CONCRETE, - Blocks.YELLOW_CONCRETE, - Blocks.LIME_CONCRETE, - Blocks.PINK_CONCRETE, - Blocks.GRAY_CONCRETE, - Blocks.LIGHT_GRAY_CONCRETE, - Blocks.CYAN_CONCRETE, - Blocks.PURPLE_CONCRETE, - Blocks.BLUE_CONCRETE, - Blocks.BROWN_CONCRETE, - Blocks.GREEN_CONCRETE, - Blocks.RED_CONCRETE, - Blocks.BLACK_CONCRETE - ); - tag(Tags.Blocks.END_STONES, Tags.Items.END_STONES) - .add(Blocks.END_STONE); - tag(Tags.Blocks.FENCE_GATES, Tags.Items.FENCE_GATES) - .addTags(Tags.Blocks.FENCE_GATES_WOODEN); - tag(Tags.Blocks.FENCE_GATES_WOODEN, Tags.Items.FENCE_GATES_WOODEN) - .add( - Blocks.OAK_FENCE_GATE, - Blocks.SPRUCE_FENCE_GATE, - Blocks.BIRCH_FENCE_GATE, - Blocks.JUNGLE_FENCE_GATE, - Blocks.ACACIA_FENCE_GATE, - Blocks.DARK_OAK_FENCE_GATE, - Blocks.CRIMSON_FENCE_GATE, - Blocks.WARPED_FENCE_GATE, - Blocks.MANGROVE_FENCE_GATE, - Blocks.BAMBOO_FENCE_GATE, - Blocks.CHERRY_FENCE_GATE - ); - tag(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Items.FENCES_NETHER_BRICK) - .add(Blocks.NETHER_BRICK_FENCE); - tag(Tags.Blocks.FENCES_WOODEN, Tags.Items.FENCES_WOODEN) - .addTag(BlockTags.WOODEN_FENCES); - tag(Tags.Blocks.FENCES, Tags.Items.FENCES) - .addTags( - Tags.Blocks.FENCES_NETHER_BRICK, - Tags.Blocks.FENCES_WOODEN - ); - tag(Tags.Blocks.FLOWERS_SMALL, Tags.Items.FLOWERS_SMALL) - .add( - Blocks.DANDELION, - Blocks.POPPY, - Blocks.BLUE_ORCHID, - Blocks.ALLIUM, - Blocks.AZURE_BLUET, - Blocks.RED_TULIP, - Blocks.ORANGE_TULIP, - Blocks.WHITE_TULIP, - Blocks.PINK_TULIP, - Blocks.OXEYE_DAISY, - Blocks.CORNFLOWER, - Blocks.LILY_OF_THE_VALLEY, - Blocks.WITHER_ROSE, - Blocks.TORCHFLOWER, - Blocks.OPEN_EYEBLOSSOM, - Blocks.CLOSED_EYEBLOSSOM - ); - tag(Tags.Blocks.FLOWERS_TALL, Tags.Items.FLOWERS_TALL) - .add( - Blocks.SUNFLOWER, - Blocks.LILAC, - Blocks.PEONY, - Blocks.ROSE_BUSH, - Blocks.PITCHER_PLANT - ); - tag(Tags.Blocks.FLOWERS, Tags.Items.FLOWERS) - .add( - Blocks.FLOWERING_AZALEA_LEAVES, - Blocks.FLOWERING_AZALEA, - Blocks.MANGROVE_PROPAGULE, - Blocks.PINK_PETALS, - Blocks.CHORUS_FLOWER, - Blocks.SPORE_BLOSSOM - ) - .addTags( - Tags.Blocks.FLOWERS_SMALL, - Tags.Blocks.FLOWERS_TALL - ) - .addOptionalTag(BlockTags.FLOWERS); - tag(Tags.Blocks.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS) - .addTags( - Tags.Blocks.GLASS_BLOCKS_COLORLESS, - Tags.Blocks.GLASS_BLOCKS_CHEAP, - Tags.Blocks.GLASS_BLOCKS_TINTED - ); - tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Items.GLASS_BLOCKS_COLORLESS) - .add(Blocks.GLASS); - tag(Tags.Blocks.GLASS_BLOCKS_TINTED, Tags.Items.GLASS_BLOCKS_TINTED) - .add(Blocks.TINTED_GLASS); - - tag(Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Items.GLASS_BLOCKS_CHEAP) - .add( - Blocks.GLASS, - Blocks.WHITE_STAINED_GLASS, - Blocks.ORANGE_STAINED_GLASS, - Blocks.MAGENTA_STAINED_GLASS, - Blocks.LIGHT_BLUE_STAINED_GLASS, - Blocks.YELLOW_STAINED_GLASS, - Blocks.LIME_STAINED_GLASS, - Blocks.PINK_STAINED_GLASS, - Blocks.GRAY_STAINED_GLASS, - Blocks.LIGHT_GRAY_STAINED_GLASS, - Blocks.CYAN_STAINED_GLASS, - Blocks.PURPLE_STAINED_GLASS, - Blocks.BLUE_STAINED_GLASS, - Blocks.BROWN_STAINED_GLASS, - Blocks.GREEN_STAINED_GLASS, - Blocks.RED_STAINED_GLASS, - Blocks.BLACK_STAINED_GLASS - ); - tag(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES) - .addTags(Tags.Blocks.GLASS_PANES_COLORLESS) - .add( - Blocks.WHITE_STAINED_GLASS_PANE, - Blocks.ORANGE_STAINED_GLASS_PANE, - Blocks.MAGENTA_STAINED_GLASS_PANE, - Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, - Blocks.YELLOW_STAINED_GLASS_PANE, - Blocks.LIME_STAINED_GLASS_PANE, - Blocks.PINK_STAINED_GLASS_PANE, - Blocks.GRAY_STAINED_GLASS_PANE, - Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, - Blocks.CYAN_STAINED_GLASS_PANE, - Blocks.PURPLE_STAINED_GLASS_PANE, - Blocks.BLUE_STAINED_GLASS_PANE, - Blocks.BROWN_STAINED_GLASS_PANE, - Blocks.GREEN_STAINED_GLASS_PANE, - Blocks.RED_STAINED_GLASS_PANE, - Blocks.BLACK_STAINED_GLASS_PANE - ); - tag(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS) - .add(Blocks.GLASS_PANE); - tag(Tags.Blocks.GLAZED_TERRACOTTAS, Tags.Items.GLAZED_TERRACOTTAS) - .add( - Blocks.WHITE_GLAZED_TERRACOTTA, - Blocks.ORANGE_GLAZED_TERRACOTTA, - Blocks.MAGENTA_GLAZED_TERRACOTTA, - Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA, - Blocks.YELLOW_GLAZED_TERRACOTTA, - Blocks.LIME_GLAZED_TERRACOTTA, - Blocks.PINK_GLAZED_TERRACOTTA, - Blocks.GRAY_GLAZED_TERRACOTTA, - Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA, - Blocks.CYAN_GLAZED_TERRACOTTA, - Blocks.PURPLE_GLAZED_TERRACOTTA, - Blocks.BLUE_GLAZED_TERRACOTTA, - Blocks.BROWN_GLAZED_TERRACOTTA, - Blocks.GREEN_GLAZED_TERRACOTTA, - Blocks.RED_GLAZED_TERRACOTTA, - Blocks.BLACK_GLAZED_TERRACOTTA - ); - tag(Tags.Blocks.GRAVELS, Tags.Items.GRAVELS) - .add(Blocks.GRAVEL); - tag(Tags.Blocks.NATURAL_LOGS_NETHER, Tags.Items.NATURAL_LOGS_NETHER) - .add(Blocks.CRIMSON_STEM, Blocks.WARPED_STEM); - tag(Tags.Blocks.NATURAL_LOGS_OVERWORLD, Tags.Items.NATURAL_LOGS_OVERWORLD) - .add( - Blocks.ACACIA_LOG, - Blocks.BIRCH_LOG, - Blocks.CHERRY_LOG, - Blocks.DARK_OAK_LOG, - Blocks.JUNGLE_LOG, - Blocks.MANGROVE_LOG, - Blocks.OAK_LOG, - Blocks.PALE_OAK_LOG, - Blocks.SPRUCE_LOG - ); - tag(Tags.Blocks.NATURAL_LOGS, Tags.Items.NATURAL_LOGS) - .addTags(Tags.Blocks.NATURAL_LOGS_NETHER, Tags.Blocks.NATURAL_LOGS_OVERWORLD); - tag(Tags.Blocks.NATURAL_WOODS, Tags.Items.NATURAL_WOODS) - .add( - Blocks.ACACIA_WOOD, - Blocks.BIRCH_WOOD, - Blocks.CHERRY_WOOD, - Blocks.CRIMSON_HYPHAE, - Blocks.DARK_OAK_WOOD, - Blocks.JUNGLE_WOOD, - Blocks.MANGROVE_WOOD, - Blocks.OAK_WOOD, - Blocks.PALE_OAK_WOOD, - Blocks.SPRUCE_WOOD, - Blocks.WARPED_HYPHAE - ); - tag(Tags.Blocks.NETHERRACKS, Tags.Items.NETHERRACKS) - .add(Blocks.NETHERRACK); - tag(Tags.Blocks.OBSIDIANS, Tags.Items.OBSIDIANS) - .addTags( - Tags.Blocks.OBSIDIANS_NORMAL, - Tags.Blocks.OBSIDIANS_CRYING - ); - tag(Tags.Blocks.OBSIDIANS_NORMAL, Tags.Items.OBSIDIANS_NORMAL) - .add(Blocks.OBSIDIAN); - tag(Tags.Blocks.OBSIDIANS_CRYING, Tags.Items.OBSIDIANS_CRYING) - .add(Blocks.CRYING_OBSIDIAN); - tag(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, Tags.Items.ORE_BEARING_GROUND_DEEPSLATE) - .add(Blocks.DEEPSLATE); - tag(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, Tags.Items.ORE_BEARING_GROUND_NETHERRACK) - .add(Blocks.NETHERRACK); - tag(Tags.Blocks.ORE_BEARING_GROUND_STONE, Tags.Items.ORE_BEARING_GROUND_STONE) - .add(Blocks.STONE); - tag(Tags.Blocks.ORE_RATES_DENSE, Tags.Items.ORE_RATES_DENSE) - .add( - Blocks.COPPER_ORE, - Blocks.DEEPSLATE_COPPER_ORE, - Blocks.DEEPSLATE_LAPIS_ORE, - Blocks.DEEPSLATE_REDSTONE_ORE, - Blocks.LAPIS_ORE, - Blocks.REDSTONE_ORE - ); - tag(Tags.Blocks.ORE_RATES_SINGULAR, Tags.Items.ORE_RATES_SINGULAR) - .add( - Blocks.ANCIENT_DEBRIS, - Blocks.COAL_ORE, - Blocks.DEEPSLATE_COAL_ORE, - Blocks.DEEPSLATE_DIAMOND_ORE, - Blocks.DEEPSLATE_EMERALD_ORE, - Blocks.DEEPSLATE_GOLD_ORE, - Blocks.DEEPSLATE_IRON_ORE, - Blocks.DIAMOND_ORE, - Blocks.EMERALD_ORE, - Blocks.GOLD_ORE, - Blocks.IRON_ORE, - Blocks.NETHER_QUARTZ_ORE - ); - tag(Tags.Blocks.ORE_RATES_SPARSE, Tags.Items.ORE_RATES_SPARSE) - .add(Blocks.NETHER_GOLD_ORE); - tag(Tags.Blocks.ORES_COAL, Tags.Items.ORES_COAL) - .addTag(BlockTags.COAL_ORES); - tag(Tags.Blocks.ORES_COPPER, Tags.Items.ORES_COPPER) - .addTag(BlockTags.COPPER_ORES); - tag(Tags.Blocks.ORES_DIAMOND, Tags.Items.ORES_DIAMOND) - .addTag(BlockTags.DIAMOND_ORES); - tag(Tags.Blocks.ORES_EMERALD, Tags.Items.ORES_EMERALD) - .addTag(BlockTags.EMERALD_ORES); - tag(Tags.Blocks.ORES_GOLD, Tags.Items.ORES_GOLD) - .addTag(BlockTags.GOLD_ORES); - tag(Tags.Blocks.ORES_IRON, Tags.Items.ORES_IRON) - .addTag(BlockTags.IRON_ORES); - tag(Tags.Blocks.ORES_LAPIS, Tags.Items.ORES_LAPIS) - .addTag(BlockTags.LAPIS_ORES); - tag(Tags.Blocks.ORES_QUARTZ, Tags.Items.ORES_QUARTZ) - .add(Blocks.NETHER_QUARTZ_ORE); - tag(Tags.Blocks.ORES_REDSTONE, Tags.Items.ORES_REDSTONE) - .addTag(BlockTags.REDSTONE_ORES); - tag(Tags.Blocks.ORES_NETHERITE_SCRAP, Tags.Items.ORES_NETHERITE_SCRAP) - .add(Blocks.ANCIENT_DEBRIS); - tag(Tags.Blocks.ORES, Tags.Items.ORES) - .addTags( - Tags.Blocks.ORES_COAL, - Tags.Blocks.ORES_COPPER, - Tags.Blocks.ORES_DIAMOND, - Tags.Blocks.ORES_EMERALD, - Tags.Blocks.ORES_GOLD, - Tags.Blocks.ORES_IRON, - Tags.Blocks.ORES_LAPIS, - Tags.Blocks.ORES_NETHERITE_SCRAP, - Tags.Blocks.ORES_REDSTONE, - Tags.Blocks.ORES_QUARTZ - ); - tag(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, Tags.Items.ORES_IN_GROUND_DEEPSLATE) - .add( - Blocks.DEEPSLATE_COAL_ORE, - Blocks.DEEPSLATE_COPPER_ORE, - Blocks.DEEPSLATE_DIAMOND_ORE, - Blocks.DEEPSLATE_EMERALD_ORE, - Blocks.DEEPSLATE_GOLD_ORE, - Blocks.DEEPSLATE_IRON_ORE, - Blocks.DEEPSLATE_LAPIS_ORE, - Blocks.DEEPSLATE_REDSTONE_ORE - ); - tag(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, Tags.Items.ORES_IN_GROUND_NETHERRACK) - .add( - Blocks.NETHER_GOLD_ORE, - Blocks.NETHER_QUARTZ_ORE - ); - tag(Tags.Blocks.ORES_IN_GROUND_STONE, Tags.Items.ORES_IN_GROUND_STONE) - .add( - Blocks.COAL_ORE, - Blocks.COPPER_ORE, - Blocks.DIAMOND_ORE, - Blocks.EMERALD_ORE, - Blocks.GOLD_ORE, - Blocks.IRON_ORE, - Blocks.LAPIS_ORE, - Blocks.REDSTONE_ORE - ); - tag(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES) - .add(Blocks.CRAFTING_TABLE); - tag(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, Tags.Items.PLAYER_WORKSTATIONS_FURNACES) - .add(Blocks.FURNACE); - tag(Tags.Blocks.PUMPKINS, Tags.Items.PUMPKINS) - .addTags( - Tags.Blocks.PUMPKINS_NORMAL, - Tags.Blocks.PUMPKINS_CARVED, - Tags.Blocks.PUMPKINS_JACK_O_LANTERNS - ); - tag(Tags.Blocks.PUMPKINS_NORMAL, Tags.Items.PUMPKINS_NORMAL) - .add(Blocks.PUMPKIN); - tag(Tags.Blocks.PUMPKINS_CARVED, Tags.Items.PUMPKINS_CARVED) - .add(Blocks.CARVED_PUMPKIN); - tag(Tags.Blocks.PUMPKINS_JACK_O_LANTERNS, Tags.Items.PUMPKINS_JACK_O_LANTERNS) - .add(Blocks.JACK_O_LANTERN); - tag(Tags.Blocks.ROPES, Tags.Items.ROPES); - tag(Tags.Blocks.SANDS, Tags.Items.SANDS) - .addTags( - Tags.Blocks.SANDS_COLORLESS, - Tags.Blocks.SANDS_RED - ); - tag(Tags.Blocks.SANDS_COLORLESS, Tags.Items.SANDS_COLORLESS) - .add(Blocks.SAND); - tag(Tags.Blocks.SANDS_RED, Tags.Items.SANDS_RED) - .add(Blocks.RED_SAND); - tag(Tags.Blocks.SANDSTONE_BLOCKS, Tags.Items.SANDSTONE_BLOCKS) - .addTags( - Tags.Blocks.SANDSTONE_RED_BLOCKS, - Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS - ); - tag(Tags.Blocks.SANDSTONE_SLABS, Tags.Items.SANDSTONE_SLABS) - .addTags( - Tags.Blocks.SANDSTONE_RED_SLABS, - Tags.Blocks.SANDSTONE_UNCOLORED_SLABS - ); - tag(Tags.Blocks.SANDSTONE_STAIRS, Tags.Items.SANDSTONE_STAIRS) - .addTags( - Tags.Blocks.SANDSTONE_RED_STAIRS, - Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS - ); - tag(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Items.SANDSTONE_RED_BLOCKS) - .add( - Blocks.RED_SANDSTONE, - Blocks.CUT_RED_SANDSTONE, - Blocks.CHISELED_RED_SANDSTONE, - Blocks.SMOOTH_RED_SANDSTONE - ); - tag(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Items.SANDSTONE_RED_SLABS) - .add( - Blocks.RED_SANDSTONE_SLAB, - Blocks.CUT_RED_SANDSTONE_SLAB, - Blocks.SMOOTH_RED_SANDSTONE_SLAB - ); - tag(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Items.SANDSTONE_RED_STAIRS) - .add( - Blocks.RED_SANDSTONE_STAIRS, - Blocks.SMOOTH_RED_SANDSTONE_STAIRS - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, Tags.Items.SANDSTONE_UNCOLORED_BLOCKS) - .add( - Blocks.SANDSTONE, - Blocks.CUT_SANDSTONE, - Blocks.CHISELED_SANDSTONE, - Blocks.SMOOTH_SANDSTONE - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, Tags.Items.SANDSTONE_UNCOLORED_SLABS) - .add( - Blocks.SANDSTONE_SLAB, - Blocks.CUT_SANDSTONE_SLAB, - Blocks.SMOOTH_SANDSTONE_SLAB - ); - tag(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, Tags.Items.SANDSTONE_UNCOLORED_STAIRS) - .add( - Blocks.SANDSTONE_STAIRS, - Blocks.SMOOTH_SANDSTONE_STAIRS - ); - tag(Tags.Blocks.STONES, Tags.Items.STONES) - .add( - Blocks.ANDESITE, - Blocks.DIORITE, - Blocks.GRANITE, - Blocks.STONE, - Blocks.DEEPSLATE, - Blocks.TUFF - ); - tag(Tags.Blocks.STORAGE_BLOCKS, Tags.Items.STORAGE_BLOCKS) - .addTags( - Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, - Tags.Blocks.STORAGE_BLOCKS_COAL, - Tags.Blocks.STORAGE_BLOCKS_COPPER, - Tags.Blocks.STORAGE_BLOCKS_DIAMOND, - Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, - Tags.Blocks.STORAGE_BLOCKS_EMERALD, - Tags.Blocks.STORAGE_BLOCKS_GOLD, - Tags.Blocks.STORAGE_BLOCKS_IRON, - Tags.Blocks.STORAGE_BLOCKS_LAPIS, - Tags.Blocks.STORAGE_BLOCKS_NETHERITE, - Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, - Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, - Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, - Tags.Blocks.STORAGE_BLOCKS_REDSTONE, - Tags.Blocks.STORAGE_BLOCKS_SLIME, - Tags.Blocks.STORAGE_BLOCKS_WHEAT, - Tags.Blocks.STORAGE_BLOCKS_RESIN - ); - tag(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Items.STORAGE_BLOCKS_AMETHYST) - .add(Blocks.AMETHYST_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Items.STORAGE_BLOCKS_BONE_MEAL) - .add(Blocks.BONE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Items.STORAGE_BLOCKS_COAL) - .add(Blocks.COAL_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Items.STORAGE_BLOCKS_COPPER) - .add(Blocks.COPPER_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Items.STORAGE_BLOCKS_DIAMOND) - .add(Blocks.DIAMOND_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, Tags.Items.STORAGE_BLOCKS_DRIED_KELP) - .add(Blocks.DRIED_KELP_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Items.STORAGE_BLOCKS_EMERALD) - .add(Blocks.EMERALD_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Items.STORAGE_BLOCKS_GOLD) - .add(Blocks.GOLD_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Items.STORAGE_BLOCKS_IRON) - .add(Blocks.IRON_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Items.STORAGE_BLOCKS_LAPIS) - .add(Blocks.LAPIS_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE) - .add(Blocks.NETHERITE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Items.STORAGE_BLOCKS_QUARTZ) - .add(Blocks.QUARTZ_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Items.STORAGE_BLOCKS_RAW_COPPER) - .add(Blocks.RAW_COPPER_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Items.STORAGE_BLOCKS_RAW_GOLD) - .add(Blocks.RAW_GOLD_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON) - .add(Blocks.RAW_IRON_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_RESIN, Tags.Items.STORAGE_BLOCKS_RESIN) - .add(Blocks.RESIN_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE) - .add(Blocks.REDSTONE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Items.STORAGE_BLOCKS_SLIME) - .add(Blocks.SLIME_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_WHEAT, Tags.Items.STORAGE_BLOCKS_WHEAT) - .add(Blocks.HAY_BLOCK); - tag(Tags.Blocks.STRIPPED_LOGS, Tags.Items.STRIPPED_LOGS) - .add( - Blocks.STRIPPED_ACACIA_LOG, - Blocks.STRIPPED_BAMBOO_BLOCK, - Blocks.STRIPPED_BIRCH_LOG, - Blocks.STRIPPED_CHERRY_LOG, - Blocks.STRIPPED_CRIMSON_STEM, - Blocks.STRIPPED_DARK_OAK_LOG, - Blocks.STRIPPED_JUNGLE_LOG, - Blocks.STRIPPED_MANGROVE_LOG, - Blocks.STRIPPED_OAK_LOG, - Blocks.STRIPPED_PALE_OAK_LOG, - Blocks.STRIPPED_SPRUCE_LOG, - Blocks.STRIPPED_WARPED_STEM - ); - tag(Tags.Blocks.STRIPPED_WOODS, Tags.Items.STRIPPED_WOODS) - .add( - Blocks.STRIPPED_ACACIA_WOOD, - Blocks.STRIPPED_BIRCH_WOOD, - Blocks.STRIPPED_CHERRY_WOOD, - Blocks.STRIPPED_CRIMSON_HYPHAE, - Blocks.STRIPPED_DARK_OAK_WOOD, - Blocks.STRIPPED_JUNGLE_WOOD, - Blocks.STRIPPED_MANGROVE_WOOD, - Blocks.STRIPPED_OAK_WOOD, - Blocks.STRIPPED_PALE_OAK_WOOD, - Blocks.STRIPPED_SPRUCE_WOOD, - Blocks.STRIPPED_WARPED_HYPHAE - ); - } - - private static TagKey forgeTagKey(String path) { - return BlockTags.create(Identifier.fromNamespaceAndPath("forge", path)); - } - - private static TagKey tagKey(String name) { - return BlockTags.create(Identifier.withDefaultNamespace(name)); - } - - private void addColored(Consumer consumer, TagKey group, String pattern) { - String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; - for (DyeColor color : DyeColor.values()) { - Identifier key = Identifier.fromNamespaceAndPath("minecraft", pattern.replace("{color}", color.getName())); - TagKey blockTag = getForgeTag(Tags.Blocks.class, prefix + color.getName()); - TagKey itemTag = getForgeTag(Tags.Items.class, prefix + color.getName()); - Block block = ForgeRegistries.BLOCKS.getValue(key); - if (block == null || block == Blocks.AIR) - throw new IllegalStateException("Unknown vanilla block: " + key.toString()); - tag(blockTag, itemTag).add(block); - consumer.accept(block); - } - } +import static net.minecraftforge.common.Tags.BlockItems.*; +import static net.minecraft.references.BlockItemIds.*; +public class ForgeBlockItemTagsProvider extends BlockItemTagsProvider { @SuppressWarnings("unchecked") - private static TagKey getForgeTag(Class cls, String name) { - try { - name = name.toUpperCase(Locale.ENGLISH); - return (TagKey)cls.getDeclaredField(name).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { - throw new IllegalStateException(cls.getName() + " is missing tag name: " + name); - } + protected ForgeBlockItemTagsProvider(final Function tagSupplier) { + super((Function)tagSupplier); } - private static Identifier forgeRl(String path) { - return Identifier.fromNamespaceAndPath("forge", path); + @Override + protected WrappedCombinedAppender tag(final BlockItemTagId tag) { + return (WrappedCombinedAppender)super.tag(tag); } - private TagAppender tag(TagKey block, TagKey item, TagKey oldBlock, TagKey oldItem) { - var tag = tag(block, item); - var old = tag(oldBlock, oldItem); - return wrap(tag, old, oldBlock); - } - - private static TagAppender wrap(TagAppender tag, TagAppender old, TagKey oldBlock) { - return new TagAppender() { - @Override - public TagAppender add(Block value) { - tag.add(value); - old.add(value); - return this; - } - - @Override - public TagAppender addOptional(Block value) { - tag.addOptional(value); - old.addOptional(value); - return this; - } - - @Override - public TagAppender addTag(TagKey value) { - tag.addTag(value); - old.addTag(value); - return this; - } - - @Override - public TagAppender addOptionalTag(TagKey value) { - tag.addOptionalTag(value); - if (value != oldBlock) - old.addOptionalTag(value); - return this; - } - - @Override - public TagAppender replace(boolean value) { - tag.replace(value); - old.replace(value); - return this; - } - - @Override - public TagAppender remove(Identifier value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public TagAppender remove(TagKey value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public TagAppender remove(Block value) { - tag.remove(value); - old.remove(value); - return this; - } - - @Override - public String getSourceName() { - return tag.getSourceName(); - } - }; + @Override + protected void run() { + tag(BARRELS) + .addTag(BARRELS_WOODEN); + tag(BARRELS_WOODEN) + .add(BARREL); + tag(BARS_COPPER) + .addAll(COPPER_BARS.asList()); + tag(BARS_IRON) + .add(IRON_BARS); + tag(BARS) + .add(BARS_COPPER, BARS_IRON, BlockItemTags.BARS); + tag(BOOKSHELVES) + .add(BOOKSHELF); + tag(BUDDING_BLOCKS) + .add(BUDDING_AMETHYST); + tag(BUDS) + .add(SMALL_AMETHYST_BUD) + .add(MEDIUM_AMETHYST_BUD) + .add(LARGE_AMETHYST_BUD); + tag(CHAINS) + .add(IRON_CHAIN) + .addAll(COPPER_CHAIN.asList()); + tag(CHESTS_ENDER) + .add(ENDER_CHEST); + tag(CHESTS_TRAPPED) + .add(TRAPPED_CHEST); + tag(CHESTS_WOODEN) + .add(CHEST, TRAPPED_CHEST); + tag(CHESTS) + .addAll(COPPER_CHEST.asList()) + .add( + CHESTS_ENDER, + CHESTS_TRAPPED, + CHESTS_WOODEN + ); + tag(CLUSTERS) + .add(AMETHYST_CLUSTER); + tag(COBBLESTONES_NORMAL) + .add(COBBLESTONE); + tag(COBBLESTONES_INFESTED) + .add(INFESTED_COBBLESTONE); + tag(COBBLESTONES_MOSSY) + .add(MOSSY_COBBLESTONE); + tag(COBBLESTONES_DEEPSLATE) + .add(COBBLED_DEEPSLATE); + tag(COBBLESTONES) + .add( + COBBLESTONES_NORMAL, + COBBLESTONES_INFESTED, + COBBLESTONES_MOSSY, + COBBLESTONES_DEEPSLATE + ); + tag(CONCRETES) + .addAll(CONCRETE.asList()); + tag(END_STONES) + .add(END_STONE); + tag(FENCE_GATES) + .add(FENCE_GATES_WOODEN); + tag(FENCE_GATES_WOODEN) + .add( + OAK_FENCE_GATE, + SPRUCE_FENCE_GATE, + BIRCH_FENCE_GATE, + JUNGLE_FENCE_GATE, + ACACIA_FENCE_GATE, + DARK_OAK_FENCE_GATE, + CRIMSON_FENCE_GATE, + WARPED_FENCE_GATE, + MANGROVE_FENCE_GATE, + BAMBOO_FENCE_GATE, + CHERRY_FENCE_GATE + ); + tag(FENCES_NETHER_BRICK) + .add(NETHER_BRICK_FENCE); + tag(FENCES_WOODEN) + .addTag(BlockItemTags.WOODEN_FENCES); + tag(FENCES) + .add( + FENCES_NETHER_BRICK, + FENCES_WOODEN + ); + tag(FLOWERS_SMALL) + .add( + DANDELION, + POPPY, + BLUE_ORCHID, + ALLIUM, + AZURE_BLUET, + RED_TULIP, + ORANGE_TULIP, + WHITE_TULIP, + PINK_TULIP, + OXEYE_DAISY, + CORNFLOWER, + LILY_OF_THE_VALLEY, + WITHER_ROSE, + TORCHFLOWER, + OPEN_EYEBLOSSOM, + CLOSED_EYEBLOSSOM + ); + tag(FLOWERS_TALL) + .add( + SUNFLOWER, + LILAC, + PEONY, + ROSE_BUSH, + PITCHER_PLANT + ); + tag(FLOWERS) + .add( + FLOWERING_AZALEA_LEAVES, + FLOWERING_AZALEA, + MANGROVE_PROPAGULE, + PINK_PETALS, + CHORUS_FLOWER, + SPORE_BLOSSOM + ) + .add( + FLOWERS_SMALL, + FLOWERS_TALL + ) + .addOptional(BlockItemTags.FLOWERS); + tag(GLASS_BLOCKS) + .add( + GLASS_BLOCKS_COLORLESS, + GLASS_BLOCKS_CHEAP, + GLASS_BLOCKS_TINTED + ); + tag(GLASS_BLOCKS_COLORLESS) + .add(GLASS); + tag(GLASS_BLOCKS_TINTED) + .add(TINTED_GLASS); + tag(GLASS_BLOCKS_CHEAP) + .add(GLASS) + .addAll(STAINED_GLASS.asList()); + tag(GLASS_PANES) + .add(GLASS_PANES_COLORLESS) + .addAll(STAINED_GLASS_PANE.asList()); + tag(GLASS_PANES_COLORLESS) + .add(GLASS_PANE); + tag(GLAZED_TERRACOTTAS) + .addAll(GLAZED_TERRACOTTA.asList()); + tag(GRAVELS) + .add(GRAVEL); + tag(NATURAL_LOGS_NETHER) + .add(CRIMSON_STEM, WARPED_STEM); + tag(NATURAL_LOGS_OVERWORLD) + .add( + ACACIA_LOG, + BIRCH_LOG, + CHERRY_LOG, + DARK_OAK_LOG, + JUNGLE_LOG, + MANGROVE_LOG, + OAK_LOG, + PALE_OAK_LOG, + SPRUCE_LOG + ); + tag(NATURAL_LOGS) + .add(NATURAL_LOGS_NETHER, NATURAL_LOGS_OVERWORLD); + tag(NATURAL_WOODS) + .add( + ACACIA_WOOD, + BIRCH_WOOD, + CHERRY_WOOD, + CRIMSON_HYPHAE, + DARK_OAK_WOOD, + JUNGLE_WOOD, + MANGROVE_WOOD, + OAK_WOOD, + PALE_OAK_WOOD, + SPRUCE_WOOD, + WARPED_HYPHAE + ); + tag(NETHERRACKS) + .add(NETHERRACK); + tag(OBSIDIANS) + .add( + OBSIDIANS_NORMAL, + OBSIDIANS_CRYING + ); + tag(OBSIDIANS_NORMAL) + .add(OBSIDIAN); + tag(OBSIDIANS_CRYING) + .add(CRYING_OBSIDIAN); + tag(ORE_BEARING_GROUND_DEEPSLATE) + .add(DEEPSLATE); + tag(ORE_BEARING_GROUND_NETHERRACK) + .add(NETHERRACK); + tag(ORE_BEARING_GROUND_STONE) + .add(STONE); + tag(ORE_RATES_DENSE) + .add( + COPPER_ORE, + DEEPSLATE_COPPER_ORE, + DEEPSLATE_LAPIS_ORE, + DEEPSLATE_REDSTONE_ORE, + LAPIS_ORE, + REDSTONE_ORE + ); + tag(ORE_RATES_SINGULAR) + .add( + ANCIENT_DEBRIS, + COAL_ORE, + DEEPSLATE_COAL_ORE, + DEEPSLATE_DIAMOND_ORE, + DEEPSLATE_EMERALD_ORE, + DEEPSLATE_GOLD_ORE, + DEEPSLATE_IRON_ORE, + DIAMOND_ORE, + EMERALD_ORE, + GOLD_ORE, + IRON_ORE, + NETHER_QUARTZ_ORE + ); + tag(ORE_RATES_SPARSE) + .add(NETHER_GOLD_ORE); + tag(ORES_COAL) + .add(BlockItemTags.COAL_ORES); + tag(ORES_COPPER) + .add(BlockItemTags.COPPER_ORES); + tag(ORES_DIAMOND) + .add(BlockItemTags.DIAMOND_ORES); + tag(ORES_EMERALD) + .add(BlockItemTags.EMERALD_ORES); + tag(ORES_GOLD) + .add(BlockItemTags.GOLD_ORES); + tag(ORES_IRON) + .add(BlockItemTags.IRON_ORES); + tag(ORES_LAPIS) + .add(BlockItemTags.LAPIS_ORES); + tag(ORES_QUARTZ) + .add(NETHER_QUARTZ_ORE); + tag(ORES_REDSTONE) + .addTag(BlockItemTags.REDSTONE_ORES); + tag(ORES_NETHERITE_SCRAP) + .add(ANCIENT_DEBRIS); + tag(ORES) + .add( + ORES_COAL, + ORES_COPPER, + ORES_DIAMOND, + ORES_EMERALD, + ORES_GOLD, + ORES_IRON, + ORES_LAPIS, + ORES_NETHERITE_SCRAP, + ORES_REDSTONE, + ORES_QUARTZ + ); + tag(ORES_IN_GROUND_DEEPSLATE) + .add( + DEEPSLATE_COAL_ORE, + DEEPSLATE_COPPER_ORE, + DEEPSLATE_DIAMOND_ORE, + DEEPSLATE_EMERALD_ORE, + DEEPSLATE_GOLD_ORE, + DEEPSLATE_IRON_ORE, + DEEPSLATE_LAPIS_ORE, + DEEPSLATE_REDSTONE_ORE + ); + tag(ORES_IN_GROUND_NETHERRACK) + .add( + NETHER_GOLD_ORE, + NETHER_QUARTZ_ORE + ); + tag(ORES_IN_GROUND_STONE) + .add( + COAL_ORE, + COPPER_ORE, + DIAMOND_ORE, + EMERALD_ORE, + GOLD_ORE, + IRON_ORE, + LAPIS_ORE, + REDSTONE_ORE + ); + tag(PLAYER_WORKSTATIONS_CRAFTING_TABLES) + .add(CRAFTING_TABLE); + tag(PLAYER_WORKSTATIONS_FURNACES) + .add(FURNACE); + tag(PUMPKINS) + .add( + PUMPKINS_NORMAL, + PUMPKINS_CARVED, + PUMPKINS_JACK_O_LANTERNS + ); + tag(PUMPKINS_NORMAL) + .add(PUMPKIN); + tag(PUMPKINS_CARVED) + .add(CARVED_PUMPKIN); + tag(PUMPKINS_JACK_O_LANTERNS) + .add(JACK_O_LANTERN); + tag(ROPES); + tag(SANDS) + .add( + SANDS_COLORLESS, + SANDS_RED + ); + tag(SANDS_COLORLESS) + .add(SAND); + tag(SANDS_RED) + .add(RED_SAND); + tag(SANDSTONE_BLOCKS) + .add( + SANDSTONE_RED_BLOCKS, + SANDSTONE_UNCOLORED_BLOCKS + ); + tag(SANDSTONE_SLABS) + .add( + SANDSTONE_RED_SLABS, + SANDSTONE_UNCOLORED_SLABS + ); + tag(Tags.BlockItems.SANDSTONE_STAIRS) + .add( + SANDSTONE_RED_STAIRS, + SANDSTONE_UNCOLORED_STAIRS + ); + tag(SANDSTONE_RED_BLOCKS) + .add( + RED_SANDSTONE, + CUT_RED_SANDSTONE, + CHISELED_RED_SANDSTONE, + SMOOTH_RED_SANDSTONE + ); + tag(SANDSTONE_RED_SLABS) + .add( + RED_SANDSTONE_SLAB, + CUT_RED_SANDSTONE_SLAB, + SMOOTH_RED_SANDSTONE_SLAB + ); + tag(SANDSTONE_RED_STAIRS) + .add( + RED_SANDSTONE_STAIRS, + SMOOTH_RED_SANDSTONE_STAIRS + ); + tag(SANDSTONE_UNCOLORED_BLOCKS) + .add( + SANDSTONE, + CUT_SANDSTONE, + CHISELED_SANDSTONE, + SMOOTH_SANDSTONE + ); + tag(SANDSTONE_UNCOLORED_SLABS) + .add( + SANDSTONE_SLAB, + CUT_SANDSTONE_SLAB, + SMOOTH_SANDSTONE_SLAB + ); + tag(SANDSTONE_UNCOLORED_STAIRS) + .add( + BlockItemIds.SANDSTONE_STAIRS, + SMOOTH_SANDSTONE_STAIRS + ); + tag(STONES) + .add( + ANDESITE, + DIORITE, + GRANITE, + STONE, + DEEPSLATE, + TUFF + ); + tag(STORAGE_BLOCKS) + .add( + STORAGE_BLOCKS_BONE_MEAL, + STORAGE_BLOCKS_COAL, + STORAGE_BLOCKS_COPPER, + STORAGE_BLOCKS_DIAMOND, + STORAGE_BLOCKS_DRIED_KELP, + STORAGE_BLOCKS_EMERALD, + STORAGE_BLOCKS_GOLD, + STORAGE_BLOCKS_IRON, + STORAGE_BLOCKS_LAPIS, + STORAGE_BLOCKS_NETHERITE, + STORAGE_BLOCKS_RAW_COPPER, + STORAGE_BLOCKS_RAW_GOLD, + STORAGE_BLOCKS_RAW_IRON, + STORAGE_BLOCKS_REDSTONE, + STORAGE_BLOCKS_SLIME, + STORAGE_BLOCKS_WHEAT, + STORAGE_BLOCKS_RESIN + ); + tag(STORAGE_BLOCKS_AMETHYST) + .add(AMETHYST_BLOCK); + tag(STORAGE_BLOCKS_BONE_MEAL) + .add(BONE_BLOCK); + tag(STORAGE_BLOCKS_COAL) + .add(COAL_BLOCK); + tag(STORAGE_BLOCKS_COPPER) + .addAll(COPPER_BLOCK.asList()); + tag(STORAGE_BLOCKS_DIAMOND) + .add(DIAMOND_BLOCK); + tag(STORAGE_BLOCKS_DRIED_KELP) + .add(DRIED_KELP_BLOCK); + tag(STORAGE_BLOCKS_EMERALD) + .add(EMERALD_BLOCK); + tag(STORAGE_BLOCKS_GOLD) + .add(GOLD_BLOCK); + tag(STORAGE_BLOCKS_IRON) + .add(IRON_BLOCK); + tag(STORAGE_BLOCKS_LAPIS) + .add(LAPIS_BLOCK); + tag(STORAGE_BLOCKS_NETHERITE) + .add(NETHERITE_BLOCK); + tag(STORAGE_BLOCKS_QUARTZ) + .add(QUARTZ_BLOCK); + tag(STORAGE_BLOCKS_RAW_COPPER) + .add(RAW_COPPER_BLOCK); + tag(STORAGE_BLOCKS_RAW_GOLD) + .add(RAW_GOLD_BLOCK); + tag(STORAGE_BLOCKS_RAW_IRON) + .add(RAW_IRON_BLOCK); + tag(STORAGE_BLOCKS_RESIN) + .add(RESIN_BLOCK); + tag(STORAGE_BLOCKS_REDSTONE) + .add(REDSTONE_BLOCK); + tag(STORAGE_BLOCKS_SLIME) + .add(SLIME_BLOCK); + tag(STORAGE_BLOCKS_WHEAT) + .add(HAY_BLOCK); + tag(STRIPPED_LOGS) + .add( + STRIPPED_ACACIA_LOG, + STRIPPED_BAMBOO_BLOCK, + STRIPPED_BIRCH_LOG, + STRIPPED_CHERRY_LOG, + STRIPPED_CRIMSON_STEM, + STRIPPED_DARK_OAK_LOG, + STRIPPED_JUNGLE_LOG, + STRIPPED_MANGROVE_LOG, + STRIPPED_OAK_LOG, + STRIPPED_PALE_OAK_LOG, + STRIPPED_SPRUCE_LOG, + STRIPPED_WARPED_STEM + ); + tag(STRIPPED_WOODS) + .add( + STRIPPED_ACACIA_WOOD, + STRIPPED_BIRCH_WOOD, + STRIPPED_CHERRY_WOOD, + STRIPPED_CRIMSON_HYPHAE, + STRIPPED_DARK_OAK_WOOD, + STRIPPED_JUNGLE_WOOD, + STRIPPED_MANGROVE_WOOD, + STRIPPED_OAK_WOOD, + STRIPPED_PALE_OAK_WOOD, + STRIPPED_SPRUCE_WOOD, + STRIPPED_WARPED_HYPHAE + ); } } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 43c50a105b..989af417d3 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -6,14 +6,14 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.TagAppender; import net.minecraft.data.tags.VanillaBlockTagsProvider; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.Tags; @@ -25,7 +25,8 @@ import java.util.Locale; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -// We typically don't do static imports as S2S can't remap them {as they are not qualified}, however this conflicts with vanilla and our tag class names, and our tags don't get obfed so its one line of warning. +import static net.minecraft.references.BlockIds.*; +import static net.minecraft.references.BlockItemIds.*; import static net.minecraftforge.common.Tags.Blocks.*; @ApiStatus.Internal @@ -35,13 +36,8 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { } @Override - public void addTags(HolderLookup.Provider p_256380_) { - (new ForgeBlockItemTagsProvider() { - @Override - protected TagAppender tag(TagKey p_406922_, TagKey p_408417_) { - return ForgeBlockTagsProvider.this.tag(p_406922_); - } - }).run(); + public void addTags(HolderLookup.Provider p_256380_) { + new ForgeBlockItemTagsProvider(tagId -> WrappedCombinedAppender.block(this.tag(tagId.block()))).run(); addColored(DYED, "{color}_banner"); addColored(DYED, "{color}_bed"); addColored(DYED, "{color}_candle"); @@ -57,14 +53,48 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { addColored(DYED, "{color}_wool"); addColoredTags(tag(DYED)::addTag, DYED); tag(ENDERMAN_PLACE_ON_BLACKLIST); // forge:enderman_place_on_blacklist - tag(SKULLS).add(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD); + tag(SKULLS) + .add( // Has Items + SKELETON_SKULL, + WITHER_SKELETON_SKULL, + PLAYER_HEAD, + ZOMBIE_HEAD, + CREEPER_HEAD, + PIGLIN_HEAD, + DRAGON_HEAD + ) + .add( // Doesn't have items + SKELETON_WALL_SKULL, + WITHER_SKELETON_WALL_SKULL, + PLAYER_WALL_HEAD, + ZOMBIE_WALL_HEAD, + CREEPER_WALL_HEAD, + PIGLIN_WALL_HEAD, + DRAGON_WALL_HEAD + ); tag(HIDDEN_FROM_RECIPE_VIEWERS); tag(RELOCATION_NOT_SUPPORTED); - tag(VILLAGER_JOB_SITES).add( - Blocks.BARREL, Blocks.BLAST_FURNACE, Blocks.BREWING_STAND, Blocks.CARTOGRAPHY_TABLE, - Blocks.CAULDRON, Blocks.WATER_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.POWDER_SNOW_CAULDRON, - Blocks.COMPOSTER, Blocks.FLETCHING_TABLE, Blocks.GRINDSTONE, Blocks.LECTERN, - Blocks.LOOM, Blocks.SMITHING_TABLE, Blocks.SMOKER, Blocks.STONECUTTER); + tag(VILLAGER_JOB_SITES) + .add( // Has items + BARREL, + BLAST_FURNACE, + BREWING_STAND, + CARTOGRAPHY_TABLE, + CAULDRON, + COMPOSTER, + FLETCHING_TABLE, + GRINDSTONE, + LECTERN, + LOOM, + SMITHING_TABLE, + SMOKER, + STONECUTTER + ) + .add( // Doesn't have items + WATER_CAULDRON, + LAVA_CAULDRON, + POWDER_SNOW_CAULDRON + ); } private void addColored(TagKey group, String pattern) { @@ -75,7 +105,8 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { var block = ForgeRegistries.BLOCKS.getValue(key); if (block == null || block == Blocks.AIR) throw new IllegalStateException("Unknown vanilla block: " + key); - tag(tag).add(block); + tag(tag) + .add(ResourceKey.create(Registries.BLOCK, key)); } } @@ -91,12 +122,13 @@ public final class ForgeBlockTagsProvider extends VanillaBlockTagsProvider { private static TagKey getTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (TagKey) Tags.Blocks.class.getDeclaredField(name).get(null); + return (TagKey)Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new IllegalStateException(Tags.Blocks.class.getName() + " is missing tag name: " + name); } } + @SuppressWarnings("unused") private static TagKey forgeTagKey(String path) { return BlockTags.create(Identifier.fromNamespaceAndPath("forge", path)); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java index a936c23bbb..53a4b33232 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeEntityTypeTagsProvider.java @@ -12,6 +12,7 @@ import net.minecraft.resources.Identifier; import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypeIds; import org.jetbrains.annotations.ApiStatus; import java.util.concurrent.CompletableFuture; @@ -24,46 +25,48 @@ public final class ForgeEntityTypeTagsProvider extends EntityTypeTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override public void addTags(HolderLookup.Provider lookupProvider) { tag(BOSSES) - .add(EntityType.ENDER_DRAGON, EntityType.WITHER); + .add(EntityTypeIds.ENDER_DRAGON, EntityTypeIds.WITHER); tag(MINECARTS).add( - EntityType.MINECART, - EntityType.CHEST_MINECART, - EntityType.FURNACE_MINECART, - EntityType.HOPPER_MINECART, - EntityType.SPAWNER_MINECART, - EntityType.TNT_MINECART, - EntityType.COMMAND_BLOCK_MINECART + EntityTypeIds.MINECART, + EntityTypeIds.CHEST_MINECART, + EntityTypeIds.FURNACE_MINECART, + EntityTypeIds.HOPPER_MINECART, + EntityTypeIds.SPAWNER_MINECART, + EntityTypeIds.TNT_MINECART, + EntityTypeIds.COMMAND_BLOCK_MINECART ); tag(BOATS).add( - EntityType.ACACIA_BOAT, - EntityType.ACACIA_CHEST_BOAT, - EntityType.BAMBOO_CHEST_RAFT, - EntityType.BAMBOO_RAFT, - EntityType.BIRCH_BOAT, - EntityType.BIRCH_CHEST_BOAT, - EntityType.CHERRY_BOAT, - EntityType.CHERRY_CHEST_BOAT, - EntityType.DARK_OAK_BOAT, - EntityType.DARK_OAK_CHEST_BOAT, - EntityType.JUNGLE_BOAT, - EntityType.JUNGLE_CHEST_BOAT, - EntityType.MANGROVE_BOAT, - EntityType.MANGROVE_CHEST_BOAT, - EntityType.OAK_BOAT, - EntityType.OAK_CHEST_BOAT, - EntityType.PALE_OAK_BOAT, - EntityType.PALE_OAK_CHEST_BOAT, - EntityType.SPRUCE_BOAT, - EntityType.SPRUCE_CHEST_BOAT + EntityTypeIds.ACACIA_BOAT, + EntityTypeIds.ACACIA_CHEST_BOAT, + EntityTypeIds.BAMBOO_CHEST_RAFT, + EntityTypeIds.BAMBOO_RAFT, + EntityTypeIds.BIRCH_BOAT, + EntityTypeIds.BIRCH_CHEST_BOAT, + EntityTypeIds.CHERRY_BOAT, + EntityTypeIds.CHERRY_CHEST_BOAT, + EntityTypeIds.DARK_OAK_BOAT, + EntityTypeIds.DARK_OAK_CHEST_BOAT, + EntityTypeIds.JUNGLE_BOAT, + EntityTypeIds.JUNGLE_CHEST_BOAT, + EntityTypeIds.MANGROVE_BOAT, + EntityTypeIds.MANGROVE_CHEST_BOAT, + EntityTypeIds.OAK_BOAT, + EntityTypeIds.OAK_CHEST_BOAT, + EntityTypeIds.PALE_OAK_BOAT, + EntityTypeIds.PALE_OAK_CHEST_BOAT, + EntityTypeIds.SPRUCE_BOAT, + EntityTypeIds.SPRUCE_CHEST_BOAT ); - tag(ITEM_FRAMES).add(EntityType.ITEM_FRAME, EntityType.GLOW_ITEM_FRAME); + tag(ITEM_FRAMES).add(EntityTypeIds.ITEM_FRAME, EntityTypeIds.GLOW_ITEM_FRAME); tag(CAPTURING_NOT_SUPPORTED); tag(TELEPORTING_NOT_SUPPORTED); } + @SuppressWarnings("unused") private static TagKey> forgeTagKey(String path) { return EntityTypeTags.create(Identifier.fromNamespaceAndPath("forge", path)); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java index af7df178c0..b63f67cdb9 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java @@ -8,10 +8,7 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.FluidTagsProvider; -import net.minecraft.resources.Identifier; -import net.minecraft.tags.FluidTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidIds; import net.minecraftforge.common.ForgeMod; import org.jetbrains.annotations.ApiStatus; @@ -24,10 +21,19 @@ public final class ForgeFluidTagsProvider extends FluidTagsProvider { super(output, lookupProvider, "forge", existingFileHelper); } + @SuppressWarnings("unchecked") @Override public void addTags(HolderLookup.Provider lookupProvider) { - tag(WATER).add(net.minecraft.world.level.material.Fluids.WATER).add(net.minecraft.world.level.material.Fluids.FLOWING_WATER); - tag(LAVA).add(net.minecraft.world.level.material.Fluids.LAVA).add(net.minecraft.world.level.material.Fluids.FLOWING_LAVA); + tag(WATER) + .add( + FluidIds.WATER, + FluidIds.FLOWING_WATER + ); + tag(LAVA) + .add( + FluidIds.LAVA, + FluidIds.FLOWING_LAVA + ); tag(MILK) .addOptional(ForgeMod.MILK.getKey().identifier()) .addOptional(ForgeMod.FLOWING_MILK.getKey().identifier()); @@ -42,10 +48,6 @@ public final class ForgeFluidTagsProvider extends FluidTagsProvider { tag(EXPERIENCE); } - private static TagKey forgeTagKey(String path) { - return FluidTags.create(Identifier.fromNamespaceAndPath("forge", path)); - } - @Override public String getName() { return "Forge Fluid Tags"; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index 18d8b40e04..e692ba0599 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -7,16 +7,18 @@ package net.minecraftforge.common.data; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.TagAppender; import net.minecraft.data.tags.VanillaItemTagsProvider; +import net.minecraft.references.BlockItemId; +import net.minecraft.references.BlockItemIds; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Block; import net.minecraftforge.common.Tags; import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; @@ -25,6 +27,10 @@ import java.util.Locale; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; +import static net.minecraft.references.ItemIds.*; +import static net.minecraft.references.BlockItemIds.*; +import static net.minecraftforge.common.Tags.Items.*; + @ApiStatus.Internal public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { public ForgeItemTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { @@ -34,272 +40,523 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { @SuppressWarnings({ "unchecked", "removal" }) @Override public void addTags(HolderLookup.Provider lookupProvider) { - (new ForgeBlockItemTagsProvider() { - @Override - protected TagAppender tag(TagKey p_409856_, TagKey p_406371_) { - return new VanillaItemTagsProvider.BlockToItemConverter(ForgeItemTagsProvider.this.tag(p_406371_)); - } - }).run(); - tag(Tags.Items.BONES).add(Items.BONE); - tag(Tags.Items.BRICKS).addTags(Tags.Items.BRICKS_NORMAL, Tags.Items.BRICKS_NETHER, Tags.Items.BRICKS_RESIN); - tag(Tags.Items.BRICKS_NORMAL).add(Items.BRICK); - tag(Tags.Items.BRICKS_NETHER).add(Items.NETHER_BRICK); - tag(Tags.Items.BRICKS_RESIN).add(Items.RESIN_BRICK); - tag(Tags.Items.BUCKETS_EMPTY).add(Items.BUCKET); - tag(Tags.Items.BUCKETS_WATER).add(Items.WATER_BUCKET); - tag(Tags.Items.BUCKETS_LAVA).add(Items.LAVA_BUCKET); - tag(Tags.Items.BUCKETS_MILK).add(Items.MILK_BUCKET); - tag(Tags.Items.BUCKETS_POWDER_SNOW).add(Items.POWDER_SNOW_BUCKET); - tag(Tags.Items.BUCKETS_ENTITY_WATER).add(Items.AXOLOTL_BUCKET, Items.COD_BUCKET, Items.PUFFERFISH_BUCKET, Items.TADPOLE_BUCKET, Items.TROPICAL_FISH_BUCKET, Items.SALMON_BUCKET); - tag(Tags.Items.BUCKETS).addTags(Tags.Items.BUCKETS_EMPTY, Tags.Items.BUCKETS_WATER, Tags.Items.BUCKETS_LAVA, Tags.Items.BUCKETS_MILK, Tags.Items.BUCKETS_POWDER_SNOW, Tags.Items.BUCKETS_ENTITY_WATER); - tag(Tags.Items.CLUMPS) - .addTag(Tags.Items.CLUMPS_RESIN); - tag(Tags.Items.CLUMPS_RESIN) - .add(Items.RESIN_CLUMP); - tag(Tags.Items.CONCRETE_POWDERS) - .add(Items.WHITE_CONCRETE_POWDER, Items.ORANGE_CONCRETE_POWDER, Items.MAGENTA_CONCRETE_POWDER, - Items.LIGHT_BLUE_CONCRETE_POWDER, Items.YELLOW_CONCRETE_POWDER, Items.LIME_CONCRETE_POWDER, - Items.PINK_CONCRETE_POWDER, Items.GRAY_CONCRETE_POWDER, Items.LIGHT_GRAY_CONCRETE_POWDER, - Items.CYAN_CONCRETE_POWDER, Items.PURPLE_CONCRETE_POWDER, Items.BLUE_CONCRETE_POWDER, - Items.BROWN_CONCRETE_POWDER, Items.GREEN_CONCRETE_POWDER, Items.RED_CONCRETE_POWDER, - Items.BLACK_CONCRETE_POWDER); - tag(Tags.Items.CROPS).addTags( - Tags.Items.CROPS_BEETROOT, Tags.Items.CROPS_CACTUS, Tags.Items.CROPS_CARROT, - Tags.Items.CROPS_COCOA_BEAN, Tags.Items.CROPS_MELON, Tags.Items.CROPS_NETHER_WART, - Tags.Items.CROPS_POTATO, Tags.Items.CROPS_PUMPKIN, Tags.Items.CROPS_SUGAR_CANE, - Tags.Items.CROPS_WHEAT - ); - tag(Tags.Items.CROPS_BEETROOT) - .add(Items.BEETROOT); - tag(Tags.Items.CROPS_CACTUS).add(Items.CACTUS); - tag(Tags.Items.CROPS_CARROT) - .add(Items.CARROT); - tag(Tags.Items.CROPS_COCOA_BEAN).add(Items.COCOA_BEANS); - tag(Tags.Items.CROPS_MELON).add(Items.MELON); - tag(Tags.Items.CROPS_NETHER_WART) - .add(Items.NETHER_WART); - tag(Tags.Items.CROPS_POTATO) - .add(Items.POTATO); - tag(Tags.Items.CROPS_PUMPKIN).add(Items.PUMPKIN); - tag(Tags.Items.CROPS_SUGAR_CANE).add(Items.SUGAR_CANE); - tag(Tags.Items.CROPS_WHEAT) - .add(Items.WHEAT); - tag(Tags.Items.DRINK_CONTAINING_BOTTLE) - .add(Items.POTION, Items.HONEY_BOTTLE, Items.OMINOUS_BOTTLE); - tag(Tags.Items.DRINK_CONTAINING_BUCKET) - .add(Items.MILK_BUCKET); - tag(Tags.Items.DRINKS) - .addTags(Tags.Items.DRINKS_HONEY, Tags.Items.DRINKS_JUICE, Tags.Items.DRINKS_MAGIC, Tags.Items.DRINKS_MILK, - Tags.Items.DRINKS_OMINOUS, Tags.Items.DRINKS_WATER, Tags.Items.DRINKS_WATERY); - tag(Tags.Items.DRINKS_HONEY) - .add(Items.HONEY_BOTTLE); - tag(Tags.Items.DRINKS_JUICE); - tag(Tags.Items.DRINKS_MAGIC) - .add(Items.OMINOUS_BOTTLE, Items.POTION); - tag(Tags.Items.DRINKS_MILK) - .add(Items.MILK_BUCKET); - tag(Tags.Items.DRINKS_OMINOUS) - .add(Items.OMINOUS_BOTTLE); - tag(Tags.Items.DRINKS_WATER); - tag(Tags.Items.DRINKS_WATERY) - .add(Items.POTION); - addColored(Tags.Items.DYED, "{color}_banner"); - addColored(Tags.Items.DYED, "{color}_bed"); - addColored(Tags.Items.DYED, "{color}_candle"); - addColored(Tags.Items.DYED, "{color}_carpet"); - addColored(Tags.Items.DYED, "{color}_concrete"); - addColored(Tags.Items.DYED, "{color}_concrete_powder"); - addColored(Tags.Items.DYED, "{color}_glazed_terracotta"); - addColored(Tags.Items.DYED, "{color}_shulker_box"); - addColored(Tags.Items.DYED, "{color}_stained_glass"); - addColored(Tags.Items.DYED, "{color}_stained_glass_pane"); - addColored(Tags.Items.DYED, "{color}_terracotta"); - addColored(Tags.Items.DYED, "{color}_wool"); - addColoredTags(tag(Tags.Items.DYED)::addTags, Tags.Items.DYED); - tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_REDSTONE); - tag(Tags.Items.DUSTS_GLOWSTONE) - .add(Items.GLOWSTONE_DUST); - tag(Tags.Items.DUSTS_REDSTONE) - .add(Items.REDSTONE); - addColored(Tags.Items.DYES, "{color}_dye"); - addColoredTags(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES); - tag(Tags.Items.EGGS).add(Items.EGG, Items.BLUE_EGG, Items.BROWN_EGG); - tag(Tags.Items.ENCHANTING_FUELS).addTag(Tags.Items.GEMS_LAPIS); // forge:enchanting_fuels - tag(Tags.Items.ENDER_PEARLS) - .add(Items.ENDER_PEARL); - tag(Tags.Items.FEATHERS) - .add(Items.FEATHER); - tag(Tags.Items.FERTILIZERS).add(Items.BONE_MEAL); - tag(Tags.Items.FOODS_FRUIT).add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.CHORUS_FRUIT, Items.MELON_SLICE); - tag(Tags.Items.FOODS_VEGETABLE).add(Items.CARROT, Items.GOLDEN_CARROT, Items.POTATO, Items.BEETROOT); - tag(Tags.Items.FOODS_BERRY).add(Items.SWEET_BERRIES, Items.GLOW_BERRIES); - tag(Tags.Items.FOODS_BREAD).add(Items.BREAD); - tag(Tags.Items.FOODS_COOKIE).add(Items.COOKIE); - tag(Tags.Items.FOODS_DOUGH); - tag(Tags.Items.FOODS_RAW_MEAT).add(Items.BEEF, Items.PORKCHOP, Items.CHICKEN, Items.RABBIT, Items.MUTTON); - tag(Tags.Items.FOODS_RAW_FISH).add(Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH); - tag(Tags.Items.FOODS_COOKED_MEAT).add(Items.COOKED_BEEF, Items.COOKED_PORKCHOP, Items.COOKED_CHICKEN, Items.COOKED_RABBIT, Items.COOKED_MUTTON); - tag(Tags.Items.FOODS_COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON); - tag(Tags.Items.FOODS_SOUP).add(Items.BEETROOT_SOUP, Items.MUSHROOM_STEW, Items.RABBIT_STEW, Items.SUSPICIOUS_STEW); - tag(Tags.Items.FOODS_CANDY); - tag(Tags.Items.FOODS_PIE).add(Items.PUMPKIN_PIE); - tag(Tags.Items.FOODS_EDIBLE_WHEN_PLACED).add(Items.CAKE); - tag(Tags.Items.FOODS_FOOD_POISONING).add(Items.POISONOUS_POTATO, Items.PUFFERFISH, Items.SPIDER_EYE, Items.CHICKEN, Items.ROTTEN_FLESH); - tag(Tags.Items.FOODS_GOLDEN).add(Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_CARROT); - tag(Tags.Items.FOODS) - .add(Items.BAKED_POTATO, Items.HONEY_BOTTLE, Items.OMINOUS_BOTTLE, Items.DRIED_KELP) - .addTags(Tags.Items.FOODS_FRUIT, Tags.Items.FOODS_VEGETABLE, Tags.Items.FOODS_BERRY, Tags.Items.FOODS_BREAD, Tags.Items.FOODS_COOKIE, - Tags.Items.FOODS_RAW_MEAT, Tags.Items.FOODS_RAW_FISH, Tags.Items.FOODS_COOKED_MEAT, Tags.Items.FOODS_COOKED_FISH, - Tags.Items.FOODS_SOUP, Tags.Items.FOODS_CANDY, Tags.Items.FOODS_PIE, Tags.Items.FOODS_GOLDEN, - Tags.Items.FOODS_EDIBLE_WHEN_PLACED, Tags.Items.FOODS_FOOD_POISONING); - tag(Tags.Items.ANIMAL_FOODS) - .addTags(ItemTags.ARMADILLO_FOOD, ItemTags.AXOLOTL_FOOD, ItemTags.BEE_FOOD, ItemTags.CAMEL_FOOD, - ItemTags.CAT_FOOD, ItemTags.CHICKEN_FOOD, ItemTags.COW_FOOD, ItemTags.FOX_FOOD, ItemTags.FROG_FOOD, - ItemTags.GOAT_FOOD, ItemTags.HOGLIN_FOOD, ItemTags.HORSE_FOOD, ItemTags.LLAMA_FOOD, ItemTags.OCELOT_FOOD, - ItemTags.PANDA_FOOD, ItemTags.PARROT_FOOD, ItemTags.PIG_FOOD, ItemTags.PIGLIN_FOOD, ItemTags.RABBIT_FOOD, - ItemTags.SHEEP_FOOD, ItemTags.SNIFFER_FOOD, ItemTags.STRIDER_FOOD, ItemTags.TURTLE_FOOD, ItemTags.WOLF_FOOD); - tag(Tags.Items.GEMS) - .addTags(Tags.Items.GEMS_AMETHYST, Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_EMERALD, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_PRISMARINE, Tags.Items.GEMS_QUARTZ); - tag(Tags.Items.GEMS_AMETHYST) - .add(Items.AMETHYST_SHARD); - tag(Tags.Items.GEMS_DIAMOND) - .add(Items.DIAMOND); - tag(Tags.Items.GEMS_EMERALD) - .add(Items.EMERALD); - tag(Tags.Items.GEMS_LAPIS) - .add(Items.LAPIS_LAZULI); - tag(Tags.Items.GEMS_PRISMARINE) - .add(Items.PRISMARINE_CRYSTALS); - tag(Tags.Items.GEMS_QUARTZ) - .add(Items.QUARTZ); - tag(Tags.Items.GUNPOWDERS).add(Items.GUNPOWDER); - tag(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS); - tag(Tags.Items.INGOTS) - .addTags(Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE); - tag(Tags.Items.INGOTS_COPPER) - .add(Items.COPPER_INGOT); - tag(Tags.Items.INGOTS_GOLD) - .add(Items.GOLD_INGOT); - tag(Tags.Items.INGOTS_IRON) - .add(Items.IRON_INGOT); - tag(Tags.Items.INGOTS_NETHERITE) - .add(Items.NETHERITE_INGOT); - tag(Tags.Items.LEATHERS) - .add(Items.LEATHER); - tag(Tags.Items.MUSHROOMS) - .add(Items.BROWN_MUSHROOM, Items.RED_MUSHROOM); - tag(Tags.Items.MUSIC_DISCS).add(Items.MUSIC_DISC_13, Items.MUSIC_DISC_CAT, Items.MUSIC_DISC_BLOCKS, Items.MUSIC_DISC_CHIRP, - Items.MUSIC_DISC_FAR, Items.MUSIC_DISC_MALL, Items.MUSIC_DISC_MELLOHI, Items.MUSIC_DISC_STAL, Items.MUSIC_DISC_STRAD, - Items.MUSIC_DISC_WARD, Items.MUSIC_DISC_11, Items.MUSIC_DISC_WAIT, Items.MUSIC_DISC_OTHERSIDE, Items.MUSIC_DISC_5, - Items.MUSIC_DISC_PIGSTEP, Items.MUSIC_DISC_RELIC, Items.MUSIC_DISC_CREATOR, Items.MUSIC_DISC_CREATOR_MUSIC_BOX, - Items.MUSIC_DISC_PRECIPICE, Items.MUSIC_DISC_LAVA_CHICKEN, Items.MUSIC_DISC_TEARS); - tag(Tags.Items.NETHER_STARS) - .add(Items.NETHER_STAR); - tag(Tags.Items.NUGGETS) - .addTags(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_COPPER); - tag(Tags.Items.NUGGETS_COPPER) - .add(Items.COPPER_NUGGET); - tag(Tags.Items.NUGGETS_IRON) - .add(Items.IRON_NUGGET); - tag(Tags.Items.NUGGETS_GOLD) - .add(Items.GOLD_NUGGET); - tag(Tags.Items.POTIONS_BOTTLE).add(Items.POTION, Items.SPLASH_POTION, Items.LINGERING_POTION); - tag(Tags.Items.POTIONS).addTags(Tags.Items.POTIONS_BOTTLE); - tag(Tags.Items.RAW_MATERIALS) - .addTags(Tags.Items.RAW_MATERIALS_COPPER, Tags.Items.RAW_MATERIALS_GOLD, Tags.Items.RAW_MATERIALS_IRON); - tag(Tags.Items.RAW_MATERIALS_COPPER) - .add(Items.RAW_COPPER); - tag(Tags.Items.RAW_MATERIALS_GOLD) - .add(Items.RAW_GOLD); - tag(Tags.Items.RAW_MATERIALS_IRON) - .add(Items.RAW_IRON); - tag(Tags.Items.RODS) - .addTags(Tags.Items.RODS_WOODEN, Tags.Items.RODS_BLAZE, Tags.Items.RODS_BREEZE); - tag(Tags.Items.RODS_BLAZE) - .add(Items.BLAZE_ROD); - tag(Tags.Items.RODS_BREEZE).add(Items.BREEZE_ROD); - tag(Tags.Items.RODS_WOODEN) - .add(Items.STICK); - tag(Tags.Items.SEEDS).addTags(Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, Tags.Items.SEEDS_WHEAT); - tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); - tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); - tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); - tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(Tags.Items.SLIME_BALLS) - .add(Items.SLIME_BALL); - tag(Tags.Items.SHULKER_BOXES) - .add(Items.SHULKER_BOX, Items.WHITE_SHULKER_BOX, Items.ORANGE_SHULKER_BOX, - Items.MAGENTA_SHULKER_BOX, Items.LIGHT_BLUE_SHULKER_BOX, Items.YELLOW_SHULKER_BOX, - Items.LIME_SHULKER_BOX, Items.PINK_SHULKER_BOX, Items.GRAY_SHULKER_BOX, - Items.LIGHT_GRAY_SHULKER_BOX, Items.CYAN_SHULKER_BOX, Items.PURPLE_SHULKER_BOX, - Items.BLUE_SHULKER_BOX, Items.BROWN_SHULKER_BOX, Items.GREEN_SHULKER_BOX, - Items.RED_SHULKER_BOX, Items.BLACK_SHULKER_BOX); - tag(Tags.Items.STRINGS) - .add(Items.STRING); - tag(Tags.Items.VILLAGER_JOB_SITES).add( - Items.BARREL, Items.BLAST_FURNACE, Items.BREWING_STAND, Items.CARTOGRAPHY_TABLE, - Items.CAULDRON, Items.COMPOSTER, Items.FLETCHING_TABLE, Items.GRINDSTONE, - Items.LECTERN, Items.LOOM, Items.SMITHING_TABLE, Items.SMOKER, Items.STONECUTTER); + new ForgeBlockItemTagsProvider(tagId -> WrappedCombinedAppender.item(this.tag(tagId.item()))).run(); + tag(BONES).add(BONE); + tag(Tags.Items.BRICKS) + .addTags( + BRICKS_NORMAL, + BRICKS_NETHER, + BRICKS_RESIN + ); + tag(BRICKS_NORMAL).add(BRICK); + tag(BRICKS_NETHER).add(NETHER_BRICK); + tag(BRICKS_RESIN).add(RESIN_BRICK); + tag(BUCKETS_EMPTY).add(BUCKET); + tag(BUCKETS_WATER).add(WATER_BUCKET); + tag(BUCKETS_LAVA).add(LAVA_BUCKET); + tag(BUCKETS_MILK).add(MILK_BUCKET); + tag(BUCKETS_POWDER_SNOW).add(POWDER_SNOW); + tag(BUCKETS_ENTITY_WATER) + .add( + AXOLOTL_BUCKET, + COD_BUCKET, + PUFFERFISH_BUCKET, + TADPOLE_BUCKET, + TROPICAL_FISH_BUCKET, + SALMON_BUCKET + ); + tag(BUCKETS) + .addTags( + BUCKETS_EMPTY, + BUCKETS_WATER, + BUCKETS_LAVA, + BUCKETS_MILK, + BUCKETS_POWDER_SNOW, + BUCKETS_ENTITY_WATER + ); + tag(CLUMPS) + .addTag(CLUMPS_RESIN); + tag(CLUMPS_RESIN) + .add(RESIN_CLUMP); + tag(CONCRETE_POWDERS) + .addAll(BlockItemIds.CONCRETE_POWDER.map(BlockItemId::item).asList()); + tag(CROPS) + .addTags( + CROPS_BEETROOT, + CROPS_CACTUS, + CROPS_CARROT, + CROPS_COCOA_BEAN, + CROPS_MELON, + CROPS_NETHER_WART, + CROPS_POTATO, + CROPS_PUMPKIN, + CROPS_SUGAR_CANE, + CROPS_WHEAT + ); + tag(CROPS_BEETROOT).add(BEETROOT); + tag(CROPS_CACTUS).add(CACTUS); + tag(CROPS_CARROT).add(CARROT_CROP); + tag(CROPS_COCOA_BEAN).add(COCOA_CROP); + tag(CROPS_MELON).add(MELON); + tag(CROPS_NETHER_WART).add(NETHER_WART); + tag(CROPS_POTATO).add(POTATO_CROP); + tag(CROPS_PUMPKIN).add(PUMPKIN); + tag(CROPS_SUGAR_CANE).add(SUGAR_CANE); + tag(CROPS_WHEAT).add(WHEAT); + tag(DRINK_CONTAINING_BOTTLE) + .add( + POTION, + HONEY_BOTTLE, + OMINOUS_BOTTLE + ); + tag(DRINK_CONTAINING_BUCKET).add(MILK_BUCKET); + tag(DRINKS) + .addTags( + DRINKS_HONEY, + DRINKS_JUICE, + DRINKS_MAGIC, + DRINKS_MILK, + DRINKS_OMINOUS, + DRINKS_WATER, + DRINKS_WATERY + ); + tag(DRINKS_HONEY).add(HONEY_BOTTLE); + tag(DRINKS_JUICE); + tag(DRINKS_MAGIC) + .add( + OMINOUS_BOTTLE, + POTION + ); + tag(DRINKS_MILK).add(MILK_BUCKET); + tag(DRINKS_OMINOUS).add(OMINOUS_BOTTLE); + tag(DRINKS_WATER); + tag(DRINKS_WATERY).add(POTION); + addColored(DYED, "{color}_banner"); + addColored(DYED, "{color}_bed"); + addColored(DYED, "{color}_candle"); + addColored(DYED, "{color}_carpet"); + addColored(DYED, "{color}_concrete"); + addColored(DYED, "{color}_concrete_powder"); + addColored(DYED, "{color}_glazed_terracotta"); + addColored(DYED, "{color}_shulker_box"); + addColored(DYED, "{color}_stained_glass"); + addColored(DYED, "{color}_stained_glass_pane"); + addColored(DYED, "{color}_terracotta"); + addColored(DYED, "{color}_wool"); + addColoredTags(tag(DYED)::addTags, DYED); + tag(DUSTS) + .addTags( + DUSTS_GLOWSTONE, + DUSTS_REDSTONE + ); + tag(DUSTS_GLOWSTONE).add(GLOWSTONE_DUST); + tag(DUSTS_REDSTONE).add(REDSTONE_DUST); + addColored(DYES, "{color}_dye"); + addColoredTags(tag(DYES)::addTags, DYES); + tag(EGGS) + .add( + EGG, + BLUE_EGG, + BROWN_EGG + ); + tag(ENCHANTING_FUELS).addTag(GEMS_LAPIS); // forge:enchanting_fuels + tag(ENDER_PEARLS).add(ENDER_PEARL); + tag(FEATHERS).add(FEATHER); + tag(FERTILIZERS).add(BONE_MEAL); + tag(FOODS_FRUIT) + .add( + APPLE, + GOLDEN_APPLE, + ENCHANTED_GOLDEN_APPLE, + CHORUS_FRUIT, + MELON_SLICE + ); + tag(FOODS_VEGETABLE) + .add( + GOLDEN_CARROT, + BEETROOT + ) + .add( + CARROT_CROP, + POTATO_CROP + ); + tag(FOODS_BERRY) + .add( + SWEET_BERRY_CROP, + GLOW_BERRY_CROP + ); + tag(FOODS_BREAD).add(BREAD); + tag(FOODS_COOKIE).add(COOKIE); + tag(FOODS_DOUGH); + tag(FOODS_RAW_MEAT) + .add( + BEEF, + PORKCHOP, + CHICKEN, + RABBIT, + MUTTON + ); + tag(FOODS_RAW_FISH) + .add( + COD, + SALMON, + TROPICAL_FISH, + PUFFERFISH + ); + tag(FOODS_COOKED_MEAT) + .add( + COOKED_BEEF, + COOKED_PORKCHOP, + COOKED_CHICKEN, + COOKED_RABBIT, + COOKED_MUTTON + ); + tag(FOODS_COOKED_FISH) + .add( + COOKED_COD, + COOKED_SALMON + ); + tag(FOODS_SOUP) + .add( + BEETROOT_SOUP, + MUSHROOM_STEW, + RABBIT_STEW, + SUSPICIOUS_STEW + ); + tag(FOODS_CANDY); + tag(FOODS_PIE).add(PUMPKIN_PIE); + tag(FOODS_EDIBLE_WHEN_PLACED).add(CAKE); + tag(FOODS_FOOD_POISONING) + .add( + POISONOUS_POTATO, + PUFFERFISH, + SPIDER_EYE, + CHICKEN, + ROTTEN_FLESH + ); + tag(FOODS_GOLDEN) + .add( + GOLDEN_APPLE, + ENCHANTED_GOLDEN_APPLE, + GOLDEN_CARROT + ); + tag(FOODS) + .add( + BAKED_POTATO, + HONEY_BOTTLE, + OMINOUS_BOTTLE, + DRIED_KELP + ) + .addTags( + FOODS_FRUIT, + FOODS_VEGETABLE, + FOODS_BERRY, + FOODS_BREAD, + FOODS_COOKIE, + FOODS_RAW_MEAT, + FOODS_RAW_FISH, + FOODS_COOKED_MEAT, + FOODS_COOKED_FISH, + FOODS_SOUP, + FOODS_CANDY, + FOODS_PIE, + FOODS_GOLDEN, + FOODS_EDIBLE_WHEN_PLACED, + FOODS_FOOD_POISONING + ); + tag(ANIMAL_FOODS) + .addTags( + ItemTags.ARMADILLO_FOOD, + ItemTags.AXOLOTL_FOOD, + ItemTags.BEE_FOOD, + ItemTags.CAMEL_FOOD, + ItemTags.CAT_FOOD, + ItemTags.CHICKEN_FOOD, + ItemTags.COW_FOOD, + ItemTags.FOX_FOOD, + ItemTags.FROG_FOOD, + ItemTags.GOAT_FOOD, + ItemTags.HOGLIN_FOOD, + ItemTags.HORSE_FOOD, + ItemTags.LLAMA_FOOD, + ItemTags.OCELOT_FOOD, + ItemTags.PANDA_FOOD, + ItemTags.PARROT_FOOD, + ItemTags.PIG_FOOD, + ItemTags.PIGLIN_FOOD, + ItemTags.RABBIT_FOOD, + ItemTags.SHEEP_FOOD, + ItemTags.SNIFFER_FOOD, + ItemTags.STRIDER_FOOD, + ItemTags.TURTLE_FOOD, + ItemTags.WOLF_FOOD + ); + tag(GEMS) + .addTags( + GEMS_AMETHYST, + GEMS_DIAMOND, + GEMS_EMERALD, + GEMS_LAPIS, + GEMS_PRISMARINE, + GEMS_QUARTZ + ); + tag(GEMS_AMETHYST).add(AMETHYST_SHARD); + tag(GEMS_DIAMOND).add(DIAMOND); + tag(GEMS_EMERALD).add(EMERALD); + tag(GEMS_LAPIS).add(LAPIS_LAZULI); + tag(GEMS_PRISMARINE).add(PRISMARINE_CRYSTALS); + tag(GEMS_QUARTZ).add(QUARTZ); + tag(GUNPOWDERS).add(GUNPOWDER); + tag(HIDDEN_FROM_RECIPE_VIEWERS); + tag(INGOTS) + .addTags( + INGOTS_COPPER, + INGOTS_GOLD, + INGOTS_IRON, + INGOTS_NETHERITE + ); + tag(INGOTS_COPPER).add(COPPER_INGOT); + tag(INGOTS_GOLD).add(GOLD_INGOT); + tag(INGOTS_IRON).add(IRON_INGOT); + tag(INGOTS_NETHERITE).add(NETHERITE_INGOT); + tag(LEATHERS).add(LEATHER); + tag(MUSHROOMS) + .add( + BROWN_MUSHROOM, + RED_MUSHROOM + ); + tag(MUSIC_DISCS) + .add( + MUSIC_DISC_13, + MUSIC_DISC_CAT, + MUSIC_DISC_BLOCKS, + MUSIC_DISC_CHIRP, + MUSIC_DISC_FAR, + MUSIC_DISC_MALL, + MUSIC_DISC_MELLOHI, + MUSIC_DISC_STAL, + MUSIC_DISC_STRAD, + MUSIC_DISC_WARD, + MUSIC_DISC_11, + MUSIC_DISC_WAIT, + MUSIC_DISC_OTHERSIDE, + MUSIC_DISC_5, + MUSIC_DISC_PIGSTEP, + MUSIC_DISC_RELIC, + MUSIC_DISC_CREATOR, + MUSIC_DISC_CREATOR_MUSIC_BOX, + MUSIC_DISC_PRECIPICE, + MUSIC_DISC_LAVA_CHICKEN, + MUSIC_DISC_TEARS + ); + tag(NETHER_STARS).add(NETHER_STAR); + tag(NUGGETS) + .addTags( + NUGGETS_GOLD, + NUGGETS_IRON, + NUGGETS_COPPER + ); + tag(NUGGETS_COPPER).add(COPPER_NUGGET); + tag(NUGGETS_IRON).add(IRON_NUGGET); + tag(NUGGETS_GOLD).add(GOLD_NUGGET); + tag(POTIONS_BOTTLE) + .add( + POTION, + SPLASH_POTION, + LINGERING_POTION + ); + tag(POTIONS).addTags(POTIONS_BOTTLE); + tag(RAW_MATERIALS) + .addTags( + RAW_MATERIALS_COPPER, + RAW_MATERIALS_GOLD, + RAW_MATERIALS_IRON + ); + tag(RAW_MATERIALS_COPPER).add(RAW_COPPER); + tag(RAW_MATERIALS_GOLD).add(RAW_GOLD); + tag(RAW_MATERIALS_IRON).add(RAW_IRON); + tag(RODS) + .addTags( + RODS_WOODEN, + RODS_BLAZE, + RODS_BREEZE + ); + tag(RODS_BLAZE).add(BLAZE_ROD); + tag(RODS_BREEZE).add(BREEZE_ROD); + tag(RODS_WOODEN).add(STICK); + tag(SEEDS) + .addTags( + SEEDS_BEETROOT, + SEEDS_MELON, + SEEDS_PUMPKIN, + SEEDS_WHEAT + ); + tag(SEEDS_BEETROOT).add(BEETROOT_CROP); + tag(SEEDS_MELON).add(MELON_CROP); + tag(SEEDS_PUMPKIN).add(PUMPKIN_CROP); + tag(SEEDS_WHEAT).add(WHEAT_CROP); + tag(SLIME_BALLS).add(SLIME_BALL); + tag(SHULKER_BOXES) + .add( + SHULKER_BOX + ) + .addAll(BlockItemIds.DYED_SHULKER_BOX.map(BlockItemId::item).asList()); + tag(STRINGS).add(TRIPWIRE); + tag(VILLAGER_JOB_SITES) + .add( + BARREL, + BLAST_FURNACE, + BREWING_STAND, + CARTOGRAPHY_TABLE, + CAULDRON, + COMPOSTER, + FLETCHING_TABLE, + GRINDSTONE, + LECTERN, + LOOM, + SMITHING_TABLE, + SMOKER, + STONECUTTER + ); // Tools and Armors - tag(Tags.Items.TOOLS_SHIELD) - .add(Items.SHIELD); - tag(Tags.Items.TOOLS_BOW) - .add(Items.BOW); - tag(Tags.Items.TOOLS_BRUSH).add(Items.BRUSH); - tag(Tags.Items.TOOLS_CROSSBOW) - .add(Items.CROSSBOW); - tag(Tags.Items.TOOLS_FISHING_ROD) - .add(Items.FISHING_ROD); - tag(Tags.Items.TOOLS_SHEAR) - .add(Items.SHEARS); - tag(Tags.Items.TOOLS_TRIDENT).add(Items.TRIDENT); - tag(Tags.Items.TOOLS_MACE).add(Items.MACE); - tag(Tags.Items.TOOLS_IGNITER).add(Items.FLINT_AND_STEEL); - tag(Tags.Items.MINING_TOOL_TOOLS).add(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.COPPER_PICKAXE, Items.IRON_PICKAXE, Items.GOLDEN_PICKAXE, Items.DIAMOND_PICKAXE, Items.NETHERITE_PICKAXE); - tag(Tags.Items.MELEE_WEAPON_TOOLS).add( - Items.MACE, Items.TRIDENT, - Items.WOODEN_SWORD, Items.STONE_SWORD, Items.COPPER_SWORD, Items.GOLDEN_SWORD, Items.IRON_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD, - Items.WOODEN_AXE, Items.STONE_AXE, Items.COPPER_AXE, Items.GOLDEN_AXE, Items.IRON_AXE, Items.DIAMOND_AXE, Items.NETHERITE_AXE, - Items.WOODEN_SPEAR, Items.STONE_SPEAR, Items.COPPER_SPEAR, Items.IRON_SPEAR, Items.GOLDEN_SPEAR, Items.DIAMOND_SPEAR, Items.NETHERITE_SPEAR - ); - tag(Tags.Items.RANGED_WEAPON_TOOLS).add(Items.BOW, Items.CROSSBOW, Items.TRIDENT); - tag(Tags.Items.TOOLS_WRENCH); - tag(Tags.Items.TOOLS) - .addTags(ItemTags.AXES, ItemTags.HOES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.SWORDS) - .addTags(Tags.Items.TOOLS_BOW, Tags.Items.TOOLS_BRUSH, Tags.Items.TOOLS_CROSSBOW, Tags.Items.TOOLS_FISHING_ROD, Tags.Items.TOOLS_SHEAR, Tags.Items.TOOLS_IGNITER, Tags.Items.TOOLS_SHIELD, Tags.Items.TOOLS_TRIDENT, Tags.Items.TOOLS_MACE, Tags.Items.MINING_TOOL_TOOLS, Tags.Items.MELEE_WEAPON_TOOLS, Tags.Items.RANGED_WEAPON_TOOLS, Tags.Items.TOOLS_WRENCH); - tag(Tags.Items.ARMORS_HORSE) - .add( - Items.COPPER_HORSE_ARMOR, - Items.DIAMOND_HORSE_ARMOR, - Items.GOLDEN_HORSE_ARMOR, - Items.IRON_HORSE_ARMOR, - Items.LEATHER_HORSE_ARMOR, - Items.NETHERITE_HORSE_ARMOR - ); - tag(Tags.Items.ARMORS_NAUTILUS) - .add( - Items.COPPER_NAUTILUS_ARMOR, - Items.DIAMOND_NAUTILUS_ARMOR, - Items.GOLDEN_NAUTILUS_ARMOR, - Items.IRON_NAUTILUS_ARMOR, - Items.NETHERITE_NAUTILUS_ARMOR - ); - tag(Tags.Items.ARMORS_HUMANOID) - .add(Items.CHAINMAIL_BOOTS, Items.CHAINMAIL_CHESTPLATE, Items.CHAINMAIL_HELMET, Items.CHAINMAIL_LEGGINGS, - Items.COPPER_BOOTS, Items.COPPER_CHESTPLATE, Items.COPPER_HELMET, Items.COPPER_LEGGINGS, - Items.DIAMOND_BOOTS, Items.DIAMOND_CHESTPLATE, Items.DIAMOND_HELMET, Items.DIAMOND_LEGGINGS, - Items.GOLDEN_BOOTS, Items.GOLDEN_CHESTPLATE, Items.GOLDEN_HELMET, Items.GOLDEN_LEGGINGS, - Items.IRON_BOOTS, Items.IRON_CHESTPLATE, Items.IRON_HELMET, Items.IRON_LEGGINGS, - Items.LEATHER_BOOTS, Items.LEATHER_CHESTPLATE, Items.LEATHER_HELMET, Items.LEATHER_LEGGINGS, - Items.NETHERITE_BOOTS, Items.NETHERITE_CHESTPLATE, Items.NETHERITE_HELMET, Items.NETHERITE_LEGGINGS, - Items.TURTLE_HELMET); - tag(Tags.Items.ARMORS_WOLF) - .add(Items.WOLF_ARMOR); - tag(Tags.Items.ARMORS) - .addTags(ItemTags.HEAD_ARMOR, ItemTags.CHEST_ARMOR, ItemTags.LEG_ARMOR, ItemTags.FOOT_ARMOR, - Tags.Items.ARMORS_HORSE, Tags.Items.ARMORS_NAUTILUS, Tags.Items.ARMORS_WOLF, Tags.Items.ARMORS_HUMANOID); - tag(Tags.Items.ENCHANTABLES) + tag(TOOLS_SHIELD).add(SHIELD); + tag(TOOLS_BOW).add(BOW); + tag(TOOLS_BRUSH).add(BRUSH); + tag(TOOLS_CROSSBOW).add(CROSSBOW); + tag(TOOLS_FISHING_ROD).add(FISHING_ROD); + tag(TOOLS_SHEAR).add(SHEARS); + tag(TOOLS_TRIDENT).add(TRIDENT); + tag(TOOLS_MACE).add(MACE); + tag(TOOLS_IGNITER).add(FLINT_AND_STEEL); + tag(MINING_TOOL_TOOLS) + .add( + WOODEN_PICKAXE, + STONE_PICKAXE, + COPPER_PICKAXE, + IRON_PICKAXE, + GOLDEN_PICKAXE, + DIAMOND_PICKAXE, + NETHERITE_PICKAXE + ); + tag(MELEE_WEAPON_TOOLS) + .add( + MACE, + TRIDENT, + WOODEN_SWORD, + STONE_SWORD, + COPPER_SWORD, + GOLDEN_SWORD, + IRON_SWORD, + DIAMOND_SWORD, + NETHERITE_SWORD, + WOODEN_AXE, + STONE_AXE, + COPPER_AXE, + GOLDEN_AXE, + IRON_AXE, + DIAMOND_AXE, + NETHERITE_AXE, + WOODEN_SPEAR, + STONE_SPEAR, + COPPER_SPEAR, + IRON_SPEAR, + GOLDEN_SPEAR, + DIAMOND_SPEAR, + NETHERITE_SPEAR + ); + tag(RANGED_WEAPON_TOOLS) + .add( + BOW, + CROSSBOW, + TRIDENT + ); + tag(TOOLS_WRENCH); + tag(TOOLS) + .addTags( + ItemTags.AXES, + ItemTags.HOES, + ItemTags.PICKAXES, + ItemTags.SHOVELS, + ItemTags.SWORDS + ) + .addTags( + TOOLS_BOW, + TOOLS_BRUSH, + TOOLS_CROSSBOW, + TOOLS_FISHING_ROD, + TOOLS_SHEAR, + TOOLS_IGNITER, + TOOLS_SHIELD, + TOOLS_TRIDENT, + TOOLS_MACE, + MINING_TOOL_TOOLS, + MELEE_WEAPON_TOOLS, + RANGED_WEAPON_TOOLS, + TOOLS_WRENCH + ); + tag(ARMORS_HORSE) + .add( + COPPER_HORSE_ARMOR, + DIAMOND_HORSE_ARMOR, + GOLDEN_HORSE_ARMOR, + IRON_HORSE_ARMOR, + LEATHER_HORSE_ARMOR, + NETHERITE_HORSE_ARMOR + ); + tag(ARMORS_NAUTILUS) + .add( + COPPER_NAUTILUS_ARMOR, + DIAMOND_NAUTILUS_ARMOR, + GOLDEN_NAUTILUS_ARMOR, + IRON_NAUTILUS_ARMOR, + NETHERITE_NAUTILUS_ARMOR + ); + tag(ARMORS_HUMANOID) + .add( + CHAINMAIL_BOOTS, + CHAINMAIL_CHESTPLATE, + CHAINMAIL_HELMET, + CHAINMAIL_LEGGINGS, + COPPER_BOOTS, + COPPER_CHESTPLATE, + COPPER_HELMET, + COPPER_LEGGINGS, + DIAMOND_BOOTS, + DIAMOND_CHESTPLATE, + DIAMOND_HELMET, + DIAMOND_LEGGINGS, + GOLDEN_BOOTS, + GOLDEN_CHESTPLATE, + GOLDEN_HELMET, + GOLDEN_LEGGINGS, + IRON_BOOTS, + IRON_CHESTPLATE, + IRON_HELMET, + IRON_LEGGINGS, + LEATHER_BOOTS, + LEATHER_CHESTPLATE, + LEATHER_HELMET, + LEATHER_LEGGINGS, + NETHERITE_BOOTS, + NETHERITE_CHESTPLATE, + NETHERITE_HELMET, + NETHERITE_LEGGINGS, + TURTLE_HELMET + ); + tag(ARMORS_WOLF).add(WOLF_ARMOR); + tag(ARMORS) + .addTags( + ItemTags.HEAD_ARMOR, + ItemTags.CHEST_ARMOR, + ItemTags.LEG_ARMOR, + ItemTags.FOOT_ARMOR, + ARMORS_HORSE, + ARMORS_NAUTILUS, + ARMORS_WOLF, + ARMORS_HUMANOID + ); + tag(ENCHANTABLES) .addTags( ItemTags.ARMOR_ENCHANTABLE, ItemTags.EQUIPPABLE_ENCHANTABLE, @@ -316,18 +573,22 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { ItemTags.DURABILITY_ENCHANTABLE, ItemTags.VANISHING_ENCHANTABLE ); - tag(Tags.Items.SEEDS) - .addTags( - Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, - Tags.Items.SEEDS_WHEAT, Tags.Items.SEEDS_PITCHER_PLANT, Tags.Items.SEEDS_TORCHFLOWER); - tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); - tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); - tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); - tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(Tags.Items.SEEDS_PITCHER_PLANT).add(Items.PITCHER_POD); - tag(Tags.Items.SEEDS_TORCHFLOWER).add(Items.TORCHFLOWER_SEEDS); - - tag(Tags.Items.BONES).add(Items.BONE); + tag(SEEDS) + .addTags( + SEEDS_BEETROOT, + SEEDS_MELON, + SEEDS_PUMPKIN, + SEEDS_WHEAT, + SEEDS_PITCHER_PLANT, + SEEDS_TORCHFLOWER + ); + tag(SEEDS_BEETROOT).add(BEETROOT_CROP); + tag(SEEDS_MELON).add(MELON_CROP); + tag(SEEDS_PUMPKIN).add(PUMPKIN_CROP); + tag(SEEDS_WHEAT).add(WHEAT_CROP); + tag(SEEDS_PITCHER_PLANT).add(PITCHER_CROP); + tag(SEEDS_TORCHFLOWER).add(TORCHFLOWER_CROP); + tag(BONES).add(BONE); // Backwards compat definitions for pre-1.21 legacy `forge:` tags. // TODO: Remove backwards compat tag entries in 1.22 addColored(tag(forgeItemTagKey("dyes"))::addTags, forgeItemTagKey("dyes"), "{color}_dye"); @@ -341,7 +602,8 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { Item item = BuiltInRegistries.ITEM.getValue(key); if (item == null || item == Items.AIR) throw new IllegalStateException("Unknown vanilla item: " + key); - tag(tag).add(item); + tag(tag) + .add(ResourceKey.create(Registries.ITEM, key)); } } @@ -353,7 +615,8 @@ public final class ForgeItemTagsProvider extends VanillaItemTagsProvider { Item item = ForgeRegistries.ITEMS.getValue(key); if (item == null || item == Items.AIR) throw new IllegalStateException("Unknown vanilla item: " + key); - tag(tag).add(item); + tag(tag) + .add(ResourceKey.create(Registries.ITEM, key)); consumer.accept(tag); } } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java index 2e8fe381cd..13d6ff36c7 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java @@ -5,7 +5,7 @@ package net.minecraftforge.common.data; -import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; import net.minecraft.data.PackOutput; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java index d5f8b1113d..e35675b7bd 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java @@ -22,6 +22,7 @@ import net.minecraft.data.recipes.packs.VanillaRecipeProvider; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.Identifier; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -89,7 +90,7 @@ public final class ForgeRecipeProvider extends VanillaRecipeProvider { replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); replace(Items.STRING, Tags.Items.STRINGS); - exclude(getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); + exclude(getConversionRecipeName(Blocks.WOOL.pick(DyeColor.WHITE), Items.STRING)); exclude(Blocks.GOLD_BLOCK); exclude(Items.GOLD_NUGGET); @@ -98,7 +99,7 @@ public final class ForgeRecipeProvider extends VanillaRecipeProvider { exclude(Blocks.DIAMOND_BLOCK); exclude(Blocks.EMERALD_BLOCK); exclude(Blocks.NETHERITE_BLOCK); - exclude(Blocks.COPPER_BLOCK); + Blocks.COPPER_BLOCK.forEach(this::exclude); exclude(Blocks.AMETHYST_BLOCK); exclude(Blocks.COBBLESTONE_STAIRS); diff --git a/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java deleted file mode 100644 index 2990d98cad..0000000000 --- a/src/main/java/net/minecraftforge/common/data/ForgeSpriteSourceProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import net.minecraft.client.renderer.texture.atlas.sources.SingleFile; -import net.minecraft.data.PackOutput; -import net.minecraft.resources.Identifier; - -import java.util.Optional; - -/** -* @deprecated Use Vanilla's {@link net.minecraft.client.data.AtlasProvider AtlasProvider} -*/ -@Deprecated(forRemoval = true, since = "26.1.2") -public class ForgeSpriteSourceProvider extends SpriteSourceProvider -{ - public ForgeSpriteSourceProvider(PackOutput output, ExistingFileHelper fileHelper) - { - super(output, fileHelper, "forge"); - } - - @Override - protected void addSources() - { - atlas(SpriteSourceProvider.BLOCKS_ATLAS).addSource(new SingleFile(Identifier.parse("forge:white"), Optional.empty())); - } -} diff --git a/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java b/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java index 3ee39c34a7..d4395ca4aa 100644 --- a/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java +++ b/src/main/java/net/minecraftforge/common/data/JsonCodecProvider.java @@ -7,7 +7,6 @@ package net.minecraftforge.common.data; import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; -import com.mojang.logging.LogUtils; import com.mojang.serialization.Codec; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; @@ -25,7 +24,6 @@ import net.minecraft.resources.Identifier; import net.minecraft.server.packs.PackType; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.data.ExistingFileHelper.ResourceType; -import org.slf4j.Logger; /** *

Dataprovider for using a Codec to generate jsons. @@ -36,9 +34,7 @@ import org.slf4j.Logger; * * @param the type of thing being generated. */ -public class JsonCodecProvider implements DataProvider -{ - private static final Logger LOGGER = LogUtils.getLogger(); +public class JsonCodecProvider implements DataProvider { protected final PackOutput output; protected final ExistingFileHelper existingFileHelper; protected final String modid; @@ -58,14 +54,11 @@ public class JsonCodecProvider implements DataProvider * @param entries Map of named entries to serialize to jsons. Paths for values are derived from the Identifier's entryid:entrypath as specified above. */ public JsonCodecProvider(PackOutput output, ExistingFileHelper existingFileHelper, String modid, DynamicOps dynamicOps, PackType packType, - String directory, Codec codec, Map entries) - { + String directory, Codec codec, Map entries) { // Track generated data so other dataproviders can validate if needed. final ResourceType resourceType = new ResourceType(packType, ".json", directory); for (Identifier id : entries.keySet()) - { existingFileHelper.trackGenerated(id, resourceType); - } this.output = output; this.existingFileHelper = existingFileHelper; this.modid = modid; @@ -77,8 +70,7 @@ public class JsonCodecProvider implements DataProvider } @Override - public CompletableFuture run(final CachedOutput cache) - { + public CompletableFuture run(final CachedOutput cache) { final Path outputFolder = this.output.getOutputFolder(this.packType == PackType.CLIENT_RESOURCES ? PackOutput.Target.RESOURCE_PACK : PackOutput.Target.DATA_PACK); @@ -108,14 +100,12 @@ public class JsonCodecProvider implements DataProvider return CompletableFuture.allOf(futuresBuilder.build().toArray(CompletableFuture[]::new)); } - protected void gather(BiConsumer consumer) - { + protected void gather(BiConsumer consumer) { this.entries.forEach(consumer); } @Override - public String getName() - { + public String getName() { return String.format("%s generator for %s", this.directory, this.modid); } @@ -125,8 +115,7 @@ public class JsonCodecProvider implements DataProvider * Null or empty arrays will not be written, and if the top-level json type is not JsonObject, attempting to add conditions will error. * @param conditions The name->condition map to apply. */ - public JsonCodecProvider setConditions(Map conditions) - { + public JsonCodecProvider setConditions(Map conditions) { this.conditions = conditions; return this; } diff --git a/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java b/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java deleted file mode 100644 index 42998af099..0000000000 --- a/src/main/java/net/minecraftforge/common/data/SpriteSourceProvider.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.data; - -import com.mojang.serialization.JsonOps; -import net.minecraft.client.renderer.texture.atlas.SpriteSource; -import net.minecraft.client.renderer.texture.atlas.SpriteSources; -import net.minecraft.data.PackOutput; -import net.minecraft.resources.Identifier; -import net.minecraft.server.packs.PackType; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.BiConsumer; - -/** - *

Data provider for atlas configuration files.
- * An atlas configuration is bound to a specific texture atlas such as the {@code minecraft:blocks} atlas and - * allows adding additional textures to the atlas by adding {@link SpriteSource}s to the configuration.

- *

See {@link SpriteSources} for the available sources and the constants in this class for the - * atlases used in vanilla Minecraft

- * - * @deprecated Use Vanilla's {@link net.minecraft.client.data.AtlasProvider AtlasProvider} - */ -@Deprecated(forRemoval = true, since = "26.1.2") -public abstract class SpriteSourceProvider extends JsonCodecProvider> -{ - protected static final Identifier BLOCKS_ATLAS = Identifier.withDefaultNamespace("blocks"); - protected static final Identifier BANNER_PATTERNS_ATLAS = Identifier.withDefaultNamespace("banner_patterns"); - protected static final Identifier BEDS_ATLAS = Identifier.withDefaultNamespace("beds"); - protected static final Identifier CHESTS_ATLAS = Identifier.withDefaultNamespace("chests"); - protected static final Identifier SHIELD_PATTERNS_ATLAS = Identifier.withDefaultNamespace("shield_patterns"); - protected static final Identifier SHULKER_BOXES_ATLAS = Identifier.withDefaultNamespace("shulker_boxes"); - protected static final Identifier SIGNS_ATLAS = Identifier.withDefaultNamespace("signs"); - protected static final Identifier MOB_EFFECTS_ATLAS = Identifier.withDefaultNamespace("mob_effects"); - protected static final Identifier PAINTINGS_ATLAS = Identifier.withDefaultNamespace("paintings"); - protected static final Identifier PARTICLES_ATLAS = Identifier.withDefaultNamespace("particles"); - - private final Map atlases = new HashMap<>(); - - public SpriteSourceProvider(PackOutput output, ExistingFileHelper fileHelper, String modid) - { - super(output, fileHelper, modid, JsonOps.INSTANCE, PackType.CLIENT_RESOURCES, "atlases", SpriteSources.FILE_CODEC, Map.of()); - } - - @Override - protected final void gather(BiConsumer> consumer) - { - addSources(); - for (var entry : atlases.entrySet()) { - Identifier atlas = entry.getKey(); - SourceList srcList = entry.getValue(); - consumer.accept(atlas, srcList.sources); - } - } - - protected abstract void addSources(); - - /** - * Get or create a {@link SourceList} for the given atlas - * @param atlas The texture atlas the sources should be added to, see constants at the top for the format - * and the vanilla atlases - * @return an existing {@code SourceList} for the given atlas or a new one if not present yet - */ - protected final SourceList atlas(Identifier atlas) - { - return atlases.computeIfAbsent(atlas, $ -> new SourceList()); - } - - protected static final class SourceList - { - private final List sources = new ArrayList<>(); - - /** - * Add the given {@link SpriteSource} to this atlas configuration - * @param source The {@code SpriteSource} to be added - */ - public SourceList addSource(SpriteSource source) - { - sources.add(source); - return this; - } - } -} diff --git a/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java b/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java new file mode 100644 index 0000000000..d8f35f59ab --- /dev/null +++ b/src/main/java/net/minecraftforge/common/data/WrappedCombinedAppender.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.data; + +import java.util.Arrays; +import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Stream; + +import net.minecraft.data.tags.BlockItemTagsProvider.CombinedAppender; +import net.minecraft.data.tags.TagAppender; +import net.minecraft.references.BlockItemId; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.BlockItemTagId; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public class WrappedCombinedAppender implements CombinedAppender { + private final Function> mapper; + private final Function> tagMapper; + private final TagAppender appender; + + public static WrappedCombinedAppender item(TagAppender appender) { + return new WrappedCombinedAppender(appender, BlockItemId::item, BlockItemTagId::item); + } + public static WrappedCombinedAppender block(TagAppender appender) { + return new WrappedCombinedAppender(appender, BlockItemId::block, BlockItemTagId::block); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected WrappedCombinedAppender( + TagAppender appender, + Function> mapper, + Function> tagMapper + ) { + this.appender = (TagAppender)appender; + this.mapper = (Function>)(Function)mapper; + this.tagMapper = (Function>)(Function)tagMapper; + } + + @Override + public WrappedCombinedAppender add(final BlockItemId... ids) { + return this.addAll(Arrays.stream(ids)); + } + + @Override + public WrappedCombinedAppender add(final BlockItemTagId... ids) { + for (var id : ids) + addTag(id); + return this; + } + + @Override + public WrappedCombinedAppender addAll(final Collection ids) { + return this.addAll(ids.stream()); + } + + @Override + public WrappedCombinedAppender addAll(Stream ids) { + appender.addAll(ids.map(mapper)); + return this; + } + + @Override + public WrappedCombinedAppender addTag(BlockItemTagId id) { + appender.addTag(tagMapper.apply(id)); + return this; + } + + public WrappedCombinedAppender addOptional(BlockItemId... ids) { + for (var id : ids) + appender.addOptional(mapper.apply(id)); + return this; + } + + public WrappedCombinedAppender addOptional(BlockItemTagId... ids) { + for (var id : ids) + appender.addOptionalTag(tagMapper.apply(id)); + return this; + } + +} diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java index 9705384ea1..95fe90bacd 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java @@ -13,7 +13,7 @@ import net.minecraft.util.Mth; public interface IForgeAbstractMinecart { public static float DEFAULT_MAX_SPEED_AIR_LATERAL = 0.4f; public static float DEFAULT_MAX_SPEED_AIR_VERTICAL = -1.0f; - public static double DEFAULT_AIR_DRAG = 0.95f; + public static float DEFAULT_AIR_DRAG = 0.95f; private AbstractMinecart self() { return (AbstractMinecart)this; @@ -72,8 +72,7 @@ public interface IForgeAbstractMinecart { void setMaxSpeedAirLateral(float value); float getMaxSpeedAirVertical(); void setMaxSpeedAirVertical(float value); - double getDragAir(); - void setDragAir(double value); + void setAirDrag(float value); /** * Called from Detector Rails to retrieve a redstone power level for comparators. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java index 6139cae4e3..2647f0d75b 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java @@ -6,7 +6,6 @@ package net.minecraftforge.common.extensions; import net.minecraft.network.Connection; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java index e342d011f7..20f444e0a7 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java @@ -9,7 +9,6 @@ import java.util.Collection; import java.util.function.BiPredicate; import net.minecraft.sounds.SoundEvent; -import net.minecraft.tags.TagKey; import net.minecraft.util.ProblemReporter; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.player.Player; @@ -23,7 +22,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; -import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.storage.TagValueInput; import net.minecraft.world.level.storage.TagValueOutput; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java b/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java index 05227969b7..ebe3958717 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeGameTestHelper.java @@ -18,7 +18,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.util.Util; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.state.BlockState; @@ -151,17 +151,17 @@ public interface IForgeGameTestHelper { * Create a mock server player in creative mode */ default ServerPlayer makeMockServerPlayer() { - return makeMockServerPlayer(GameType.CREATIVE); + return makeMockServerPlayerFull(GameType.CREATIVE); } /** * Create a mock server player in creative mode */ default ServerPlayer makeMockServerPlayer(boolean creative) { - return makeMockServerPlayer(creative ? GameType.CREATIVE : GameType.SURVIVAL); + return makeMockServerPlayerFull(creative ? GameType.CREATIVE : GameType.SURVIVAL); } - default ServerPlayer makeMockServerPlayer(GameType type) { + default ServerPlayer makeMockServerPlayerFull(GameType type) { var level = self().getLevel(); var cookie = CommonListenerCookie.createInitial(new GameProfile(UUID.randomUUID(), "test-mock-player"), false); var player = new ServerPlayer(level.getServer(), level, cookie.gameProfile(), cookie.clientInformation()); @@ -182,7 +182,7 @@ public interface IForgeGameTestHelper { */ default void addEventListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -190,7 +190,7 @@ public interface IForgeGameTestHelper { */ default void addMutableListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -198,7 +198,7 @@ public interface IForgeGameTestHelper { */ default void addRecordListener(EventBus bus, Consumer consumer) { var key = bus.addListener(consumer); - self().addCleanup(success -> bus.removeListener(key)); + self().addCleanup(_ -> bus.removeListener(key)); } /** @@ -206,7 +206,7 @@ public interface IForgeGameTestHelper { */ default void registerEventListener(Object handler) { var keys = MinecraftForge.EVENT_BUS.register(handler); - self().addCleanup(success -> MinecraftForge.EVENT_BUS.unregister(keys)); + self().addCleanup(_ -> MinecraftForge.EVENT_BUS.unregister(keys)); } /** @@ -276,7 +276,7 @@ public interface IForgeGameTestHelper { default void removeAllItemEntitiesInRange(BlockPos pos, double range) { BlockPos blockpos = this.self().absolutePos(pos); - for (ItemEntity itemEntity : this.self().getLevel().getEntities(EntityType.ITEM, new AABB(blockpos).inflate(range), Entity::isAlive)) { + for (ItemEntity itemEntity : this.self().getLevel().getEntities(EntityTypes.ITEM, new AABB(blockpos).inflate(range), Entity::isAlive)) { itemEntity.remove(Entity.RemovalReason.DISCARDED); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java b/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java index 15e3dbd64e..9180ca134f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeHolderSet.java @@ -32,13 +32,13 @@ public interface IForgeHolderSet { return this instanceof ListBacked listBacked ? listBacked.unwrap().map( // serializes as tag name if this holderset is named - tag -> SerializationType.STRING, + _ -> SerializationType.STRING, list -> list.size() == 1 // if list has exactly one element then we have to check what kind, otherwise it's a list ? list.get(0).unwrap().map( // if holder has a key bound then it's serialized as that string, otherwise it's inlined as an object key -> key == null ? SerializationType.OBJECT : SerializationType.STRING, - value -> SerializationType.OBJECT) + _ -> SerializationType.OBJECT) : SerializationType.LIST) : SerializationType.UNKNOWN; // unsupported holderset impl, could be anything } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java index f8754549bf..411783fb40 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java @@ -11,9 +11,9 @@ import net.minecraft.resources.Identifier; import net.minecraft.tags.TagBuilder; import net.minecraft.tags.TagKey; -public interface IForgeTagAppender { - private TagAppender self() { - return (TagAppender)this; +public interface IForgeTagAppender { + private TagAppender self() { + return (TagAppender)this; } /** @@ -28,33 +28,8 @@ public interface IForgeTagAppender { return "unknown"; } - /** - * Adds a registry entry to the tag json's remove list. Callable during datageneration. - * - * @param entry The entry to remove - * @return The builder for chaining - */ - default TagAppender remove(final E entry) { - throw new UnsupportedOperationException("TagAppender.remove is not implemented in class: " + this.getClass()); - } - - /** - * Adds multiple registry entries to the tag json's remove list. Callable during datageneration. - * - * @param entries The entries to remove - * @return The builder for chaining - */ @SuppressWarnings("unchecked") - default TagAppender remove(final E first, final E...entries) { - this.remove(first); - for (E entry : entries) - this.remove(entry); - return self(); - } - - - @SuppressWarnings("unchecked") - default TagAppender addTags(TagKey... values) { + default TagAppender addTags(TagKey... values) { var builder = self(); for (TagKey value : values) { builder.addTag(value); @@ -62,24 +37,24 @@ public interface IForgeTagAppender { return builder; } - default TagAppender addOptional(Identifier location) { + default TagAppender addOptional(Identifier location) { self().getInternalBuilder().addOptionalElement(location); return self(); } @SuppressWarnings("unchecked") - default TagAppenderaddOptionalTags(TagKey... values) { + default TagAppender addOptionalTags(TagKey... values) { var builder = self(); for (var value : values) builder.addOptionalTag(value); return builder; } - default TagAppender replace() { + default TagAppender replace() { return replace(true); } - default TagAppender replace(boolean value) { + default TagAppender replace(boolean value) { self().getInternalBuilder().setReplace(value); return self(); } @@ -89,7 +64,7 @@ public interface IForgeTagAppender { * @param location The ID of the element to remove * @return The builder for chaining */ - default TagAppender remove(final Identifier location) { + default TagAppender remove(final Identifier location) { var builder = self(); builder.getInternalBuilder().removeElement(location, builder.getSourceName()); return builder; @@ -100,7 +75,7 @@ public interface IForgeTagAppender { * @param locations The IDs of the elements to remove * @return The builder for chaining */ - default TagAppender remove(final Identifier first, final Identifier... locations) { + default TagAppender remove(final Identifier first, final Identifier... locations) { this.remove(first); for (var location : locations) this.remove(location); @@ -113,7 +88,7 @@ public interface IForgeTagAppender { * @param resourceKey The resource key of the element to remove * @return The appender for chaining */ - default TagAppender remove(final ResourceKey resourceKey) { + default TagAppender remove(final ResourceKey resourceKey) { this.remove(resourceKey.identifier()); return self(); } @@ -123,7 +98,7 @@ public interface IForgeTagAppender { * @param tag The ID of the tag to remove * @return The builder for chaining */ - default TagAppender remove(TagKey tag) { + default TagAppender remove(TagKey tag) { var builder = self(); builder.getInternalBuilder().removeTag(tag.location(), builder.getSourceName()); return builder; @@ -135,7 +110,7 @@ public interface IForgeTagAppender { * @return The builder for chaining */ @SuppressWarnings("unchecked") - default TagAppender remove(TagKey first, TagKey...tags) { + default TagAppender remove(TagKey first, TagKey...tags) { this.remove(first); for (var tag : tags) this.remove(tag); diff --git a/src/main/java/net/minecraftforge/common/util/BrainBuilder.java b/src/main/java/net/minecraftforge/common/util/BrainBuilder.java index 365d7d6fee..096198c3f4 100644 --- a/src/main/java/net/minecraftforge/common/util/BrainBuilder.java +++ b/src/main/java/net/minecraftforge/common/util/BrainBuilder.java @@ -110,7 +110,7 @@ public class BrainBuilder { /** You may use this as a helper method for adding a behavior to an Activity by priority to an entity's brain. */ public void addBehaviorToActivityByPriority(Integer priority, Activity activity, BehaviorControl behaviorControl) { - this.availableBehaviorsByPriority.computeIfAbsent(priority, (i) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).add(behaviorControl); + this.availableBehaviorsByPriority.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).add(behaviorControl); } /** You may use this as a helper method for adding memory requirements for an Activity to an entity's brain. */ @@ -129,12 +129,12 @@ public class BrainBuilder { @ApiStatus.Internal public void addAvailableBehaviorsByPriorityFrom(Map>>> addFrom) { - addFrom.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> this.availableBehaviorsByPriority.computeIfAbsent(priority, (p) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); + addFrom.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> this.availableBehaviorsByPriority.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); } @ApiStatus.Internal public void addAvailableBehaviorsByPriorityTo(Map>>> addTo){ - this.availableBehaviorsByPriority.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> addTo.computeIfAbsent(priority, (p) -> Maps.newHashMap()).computeIfAbsent(activity, (a) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); + this.availableBehaviorsByPriority.forEach(((priority, activitySetMap) -> activitySetMap.forEach(((activity, behaviorControls) -> addTo.computeIfAbsent(priority, (_) -> Maps.newHashMap()).computeIfAbsent(activity, (_) -> Sets.newLinkedHashSet()).addAll(behaviorControls))))); } @ApiStatus.Internal @@ -158,11 +158,11 @@ public class BrainBuilder { } private static void addMemoriesToEraseWhenActivityStoppedInternal(Map>> activityMemoriesToEraseWhenStopped, Activity activity, Collection> memories) { - activityMemoriesToEraseWhenStopped.computeIfAbsent(activity, (a) -> Sets.newHashSet()).addAll(memories); + activityMemoriesToEraseWhenStopped.computeIfAbsent(activity, (_) -> Sets.newHashSet()).addAll(memories); } private static void addRequirementsToActivityInternal(Map, MemoryStatus>>> activityRequirements, Activity activity, Collection, MemoryStatus>> requirements) { - activityRequirements.computeIfAbsent(activity, (a) -> Sets.newHashSet()).addAll(requirements); + activityRequirements.computeIfAbsent(activity, (_) -> Sets.newHashSet()).addAll(requirements); } @ApiStatus.Internal diff --git a/src/main/java/net/minecraftforge/common/util/JsonUtils.java b/src/main/java/net/minecraftforge/common/util/JsonUtils.java index cbb5beabff..302e86d8e1 100644 --- a/src/main/java/net/minecraftforge/common/util/JsonUtils.java +++ b/src/main/java/net/minecraftforge/common/util/JsonUtils.java @@ -24,7 +24,6 @@ import com.google.gson.JsonSerializer; import com.google.gson.JsonSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.serialization.JsonOps; import net.minecraft.nbt.TagParser; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.GsonHelper; diff --git a/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java b/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java index 8020174ac0..f7db8ee650 100644 --- a/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java +++ b/src/main/java/net/minecraftforge/common/util/LogicalSidedProvider.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus; public class LogicalSidedProvider { public static final LogicalSidedProvider> WORKQUEUE = new LogicalSidedProvider<>(Supplier::get, Supplier::get); - public static final LogicalSidedProvider> CLIENTWORLD = new LogicalSidedProvider<>((c)-> Optional.of(c.get().level), (s)->Optional.empty()); + public static final LogicalSidedProvider> CLIENTWORLD = new LogicalSidedProvider<>((c)-> Optional.of(c.get().level), (_)->Optional.empty()); public T get(LogicalSide side) { return side == LogicalSide.CLIENT ? clientSide.apply(client) : serverSide.apply(server); diff --git a/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java b/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java index 5cea000ae2..fdc4d70e39 100644 --- a/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java +++ b/src/main/java/net/minecraftforge/common/util/MutableHashedLinkedMap.java @@ -60,7 +60,7 @@ public class MutableHashedLinkedMap implements Iterable> */ public MutableHashedLinkedMap(Strategy strategy) { - this(strategy, (k, v1, v2) -> v2); + this(strategy, (_, _, v2) -> v2); } /** diff --git a/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java index 4356ef8353..5e62fcc7d8 100644 --- a/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java +++ b/src/main/java/net/minecraftforge/common/world/StructureSettingsBuilder.java @@ -76,7 +76,7 @@ public class StructureSettingsBuilder { * @param category Mob category */ public StructureSpawnOverrideBuilder getOrAddSpawnOverrides(MobCategory category) { - return spawnOverrides.computeIfAbsent(category, c -> new StructureSpawnOverrideBuilder(StructureSpawnOverride.BoundingBoxType.PIECE, Collections.emptyList())); + return spawnOverrides.computeIfAbsent(category, _ -> new StructureSpawnOverrideBuilder(StructureSpawnOverride.BoundingBoxType.PIECE, Collections.emptyList())); } /** diff --git a/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java b/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java index 5f99a9daef..f4ef0e774f 100644 --- a/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java +++ b/src/main/java/net/minecraftforge/data/event/GatherDataEvent.java @@ -107,7 +107,7 @@ public final class GatherDataEvent implements IModBusEvent { paths.values().forEach(LamdbaExceptionUtils.rethrowConsumer(lst -> { DataGenerator parent = lst.get(0); for (int x = 1; x < lst.size(); x++) - lst.get(x).getProvidersView().forEach((name, provider) -> parent.addProvider(true, provider)); + lst.get(x).getProvidersView().forEach((_, provider) -> parent.addProvider(true, provider)); parent.run(); })); } diff --git a/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java b/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java index 1cb7823e49..54d8f1342a 100644 --- a/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java +++ b/src/main/java/net/minecraftforge/event/GatherComponentsEvent.java @@ -7,8 +7,6 @@ package net.minecraftforge.event; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; -import net.minecraft.core.component.DataComponents; -import net.minecraft.world.item.Item; import net.minecraftforge.eventbus.api.bus.EventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; import net.minecraftforge.eventbus.api.event.MutableEvent; diff --git a/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java index bb18a9040e..bb60c18578 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityAttributeModificationEvent.java @@ -41,7 +41,7 @@ public final class EntityAttributeModificationEvent extends MutableEvent { } public void add(EntityType entityType, Holder attribute, double value) { - var attributes = entityAttributes.computeIfAbsent(entityType, (type) -> new AttributeSupplier.Builder()); + var attributes = entityAttributes.computeIfAbsent(entityType, (_) -> new AttributeSupplier.Builder()); attributes.add(attribute, value); } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java index 495b8fcb3b..205e9475e0 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java @@ -11,7 +11,6 @@ import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownEnder import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.bus.CancellableEventBus; import net.minecraftforge.eventbus.api.event.InheritableEvent; import net.minecraftforge.eventbus.api.event.characteristic.Cancellable; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 4eb6993cf5..a75afa4cd2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -7,7 +7,6 @@ package net.minecraftforge.event.entity.player; import com.google.common.base.Preconditions; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java b/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java index bd990c7fda..60c941005e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/SleepingTimeCheckEvent.java @@ -7,7 +7,6 @@ package net.minecraftforge.event.entity.player; import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; import net.minecraftforge.common.util.HasResult; import net.minecraftforge.common.util.Result; import net.minecraftforge.eventbus.api.bus.EventBus; diff --git a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java index 071068ad1b..51f59dcc55 100644 --- a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java @@ -9,7 +9,6 @@ import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.core.dispenser.BlockSource; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.DispenserBlockEntity; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.core.BlockPos; diff --git a/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java index ed23c0ce8c..889182e6cc 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidInteractionRegistry.java @@ -44,7 +44,7 @@ public final class FluidInteractionRegistry */ public static synchronized void addInteraction(FluidType source, InteractionInformation interaction) { - INTERACTIONS.computeIfAbsent(source, s -> new ArrayList<>()).add(interaction); + INTERACTIONS.computeIfAbsent(source, _ -> new ArrayList<>()).add(interaction); } /** @@ -86,7 +86,7 @@ public final class FluidInteractionRegistry // Lava + Soul Soil (Below) + Blue Ice = Basalt addInteraction(ForgeMod.LAVA_TYPE.get(), new InteractionInformation( - (level, currentPos, relativePos, currentState) -> level.getBlockState(currentPos.below()).is(Blocks.SOUL_SOIL) && level.getBlockState(relativePos).is(Blocks.BLUE_ICE), + (level, currentPos, relativePos, _) -> level.getBlockState(currentPos.below()).is(Blocks.SOUL_SOIL) && level.getBlockState(relativePos).is(Blocks.BLUE_ICE), Blocks.BASALT.defaultBlockState() )); } @@ -109,7 +109,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(FluidType type, BlockState state) { - this(type, fluidState -> state); + this(type, _ -> state); } /** @@ -120,7 +120,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(HasFluidInteraction predicate, BlockState state) { - this(predicate, fluidState -> state); + this(predicate, _ -> state); } /** @@ -132,7 +132,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(FluidType type, Function getState) { - this((level, currentPos, relativePos, currentState) -> level.getFluidState(relativePos).getFluidType() == type, getState); + this((level, _, relativePos, _) -> level.getFluidState(relativePos).getFluidType() == type, getState); } /** @@ -143,7 +143,7 @@ public final class FluidInteractionRegistry */ public InteractionInformation(HasFluidInteraction predicate, Function getState) { - this(predicate, (level, currentPos, relativePos, currentState) -> + this(predicate, (level, currentPos, _, currentState) -> { level.setBlockAndUpdate(currentPos, ForgeEventFactory.fireFluidPlaceBlockEvent(level, currentPos, currentPos, getState.apply(currentState))); level.levelEvent(1501, currentPos, 0); diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java index ae4057b339..6691466196 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java @@ -25,7 +25,7 @@ public class FluidTank implements IFluidHandler, IFluidTank { protected int capacity; public FluidTank(int capacity) { - this(capacity, e -> true); + this(capacity, _ -> true); } public FluidTank(int capacity, Predicate validator) { diff --git a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java index f6266850af..7d9f873153 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java @@ -55,11 +55,11 @@ public class SidedInvWrapper implements IItemHandlerModifiable if (inv instanceof BrewingStandBlockEntity) this.slotLimit = wrapperSlot -> getSlot(inv, wrapperSlot, side) < 3 ? 1 : inv.getMaxStackSize(); else - this.slotLimit = wrapperSlot -> inv.getMaxStackSize(); + this.slotLimit = _ -> inv.getMaxStackSize(); if (inv instanceof AbstractFurnaceBlockEntity) this.newStackInsertLimit = (wrapperSlot, invSlot, stack) -> invSlot == 1 && stack.is(Items.BUCKET) ? 1 : Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); else - this.newStackInsertLimit = (wrapperSlot, invSlot, stack) -> Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); + this.newStackInsertLimit = (wrapperSlot, _, stack) -> Math.min(stack.getMaxStackSize(), getSlotLimit(wrapperSlot)); } public static int getSlot(WorldlyContainer inv, int slot, @Nullable Direction side) diff --git a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java index acea58bf7f..4f951fbbac 100644 --- a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java +++ b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java @@ -26,7 +26,7 @@ public class CrashReportExtender { public static void extendSystemReport(final SystemReport systemReport) { for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables()) { if (call.isActive()) - systemReport.setDetail(call.getLabel(), call); + systemReport.setDetail(call.getLabel(), call::get); } } diff --git a/src/main/java/net/minecraftforge/network/Channel.java b/src/main/java/net/minecraftforge/network/Channel.java index 29d1894313..70b6a35da8 100644 --- a/src/main/java/net/minecraftforge/network/Channel.java +++ b/src/main/java/net/minecraftforge/network/Channel.java @@ -116,8 +116,8 @@ public abstract class Channel { @FunctionalInterface public static interface VersionTest { - public static final VersionTest ACCEPT_MISSING = (status, version) -> status == Status.MISSING; - public static final VersionTest ACCEPT_VANILLA = (status, version) -> status == Status.VANILLA; + public static final VersionTest ACCEPT_MISSING = (status, _) -> status == Status.MISSING; + public static final VersionTest ACCEPT_VANILLA = (status, _) -> status == Status.VANILLA; public static VersionTest exact(int version) { return (status, remoteVersion) -> status == Status.PRESENT && version == remoteVersion; } diff --git a/src/main/java/net/minecraftforge/network/ChannelBuilder.java b/src/main/java/net/minecraftforge/network/ChannelBuilder.java index 809f1cadb3..ec9860d1ce 100644 --- a/src/main/java/net/minecraftforge/network/ChannelBuilder.java +++ b/src/main/java/net/minecraftforge/network/ChannelBuilder.java @@ -143,7 +143,7 @@ public class ChannelBuilder { * @param factory A factory that creates a new instance of the context data */ public ChannelBuilder attribute(AttributeKey key, Supplier factory) { - return this.attribute(key, con -> factory.get()); + return this.attribute(key, _ -> factory.get()); } /** diff --git a/src/main/java/net/minecraftforge/network/ServerStatusPing.java b/src/main/java/net/minecraftforge/network/ServerStatusPing.java index 32c99337e5..65f50192e4 100644 --- a/src/main/java/net/minecraftforge/network/ServerStatusPing.java +++ b/src/main/java/net/minecraftforge/network/ServerStatusPing.java @@ -87,8 +87,8 @@ public record ServerStatusPing( ServerStatusPing.BYTE_BUF_CODEC.optionalFieldOf("d").forGetter(ping -> Optional.of(ping.toBuf())), - ChannelData.CODEC.listOf().optionalFieldOf("channels").forGetter(ping -> Optional.of(List.of())), - ModInfo.CODEC.listOf().optionalFieldOf("mods").forGetter(ping -> Optional.of(List.of())), + ChannelData.CODEC.listOf().optionalFieldOf("channels").forGetter(_ -> Optional.of(List.of())), + ModInfo.CODEC.listOf().optionalFieldOf("mods").forGetter(_ -> Optional.of(List.of())), // legacy versions see truncated lists, modern versions ignore this truncated flag (binary data has its own) Codec.BOOL.optionalFieldOf("truncated").forGetter(ping -> Optional.of(ping.isTruncated())) diff --git a/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java b/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java index a92b980ff0..d1ac6c817a 100644 --- a/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java +++ b/src/main/java/net/minecraftforge/network/config/SimpleConfigurationTask.java @@ -23,7 +23,7 @@ public class SimpleConfigurationTask implements ConfigurationTask { } public SimpleConfigurationTask(Type type, Runnable task) { - this(type, c -> task.run()); + this(type, _ -> task.run()); } @Override diff --git a/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java b/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java index a70e4959c3..91c39f5d06 100644 --- a/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java +++ b/src/main/java/net/minecraftforge/network/filters/NetworkFilters.java @@ -20,7 +20,7 @@ public class NetworkFilters { private static final Logger LOGGER = LogManager.getLogger(); private static final Map> instances = ImmutableMap.of( - "forge:vanilla_filter", manager -> new VanillaConnectionNetworkFilter()/*, + "forge:vanilla_filter", _ -> new VanillaConnectionNetworkFilter()/*, "forge:forge_fixes", ForgeConnectionNetworkFilter::new*/ ); diff --git a/src/main/java/net/minecraftforge/network/packets/OpenContainer.java b/src/main/java/net/minecraftforge/network/packets/OpenContainer.java index f4aa4bd3ee..ed8332e09c 100644 --- a/src/main/java/net/minecraftforge/network/packets/OpenContainer.java +++ b/src/main/java/net/minecraftforge/network/packets/OpenContainer.java @@ -70,7 +70,7 @@ public class OpenContainer { var s = ((MenuScreens.ScreenConstructor)f).create(c, inv, msg.getName()); mc.player.containerMenu = s.getMenu(); - mc.setScreen(s); + mc.gui.setScreen(s); }); } finally { msg.getAdditionalData().release(); diff --git a/src/main/java/net/minecraftforge/network/packets/RegistryList.java b/src/main/java/net/minecraftforge/network/packets/RegistryList.java index 8b0109ca0f..531c363e09 100644 --- a/src/main/java/net/minecraftforge/network/packets/RegistryList.java +++ b/src/main/java/net/minecraftforge/network/packets/RegistryList.java @@ -28,7 +28,7 @@ public record RegistryList( public static RegistryList decode(FriendlyByteBuf buf) { var token = buf.readVarInt(); var normal = buf.readList(FriendlyByteBuf::readIdentifier); - List>> datapacks = buf.readList(b -> ResourceKey.createRegistryKey(buf.readIdentifier())); + List>> datapacks = buf.readList(_ -> ResourceKey.createRegistryKey(buf.readIdentifier())); return new RegistryList(token, normal, datapacks); } diff --git a/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java b/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java index 8555028689..3e4a2e2cf7 100644 --- a/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java +++ b/src/main/java/net/minecraftforge/registries/DeferredRegisterData.java @@ -155,7 +155,7 @@ public class DeferredRegisterData implements RegistryBootstrap { * @see #register(String, Supplier) */ public RegistryObject register(final String name, final Supplier factory) { - return register(name, ctx -> factory.get()); + return register(name, _ -> factory.get()); } /** diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 6c10c9b8cc..1be1a30af7 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntRBTreeMap; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; -import net.minecraft.nbt.Tag; import net.minecraft.tags.TagKey; import net.minecraftforge.common.util.LogMessageAdapter; import net.minecraftforge.fml.ModLoadingContext; @@ -498,7 +497,7 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist } private Holder.Reference bindDelegate(ResourceKey rkey, V value) { - Holder.Reference delegate = delegatesByName.computeIfAbsent(rkey.identifier(), k -> Holder.Reference.createStandAlone(this.getWrapperOrThrow(), rkey)); + Holder.Reference delegate = delegatesByName.computeIfAbsent(rkey.identifier(), _ -> Holder.Reference.createStandAlone(this.getWrapperOrThrow(), rkey)); delegate.bindKey(rkey); delegate.bindValue(value); delegatesByValue.put(value, delegate); diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index ea39ca668b..626daf0ebf 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -88,7 +88,7 @@ public class GameData { private static boolean hasInit = false; private static final boolean DISABLE_VANILLA_REGISTRIES = Boolean.parseBoolean(System.getProperty("forge.disableVanillaGameData", "false")); // Use for unit tests/debugging - private static final BiConsumer> LOCK_VANILLA = (name, reg) -> reg.slaves.values().stream().filter(o -> o instanceof ILockableRegistry).forEach(o -> ((ILockableRegistry)o).lock()); + private static final BiConsumer> LOCK_VANILLA = (_, reg) -> reg.slaves.values().stream().filter(o -> o instanceof ILockableRegistry).forEach(o -> ((ILockableRegistry)o).lock()); private static Set vanillaRegistryOrder = null; static { @@ -301,13 +301,13 @@ public class GameData { LOGGER.warn(REGISTRIES, "Can't revert to {} GameData state without a valid snapshot.", target.getName()); return; } - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.resetDelegates()); LOGGER.debug(REGISTRIES, "Reverting to {} data state.", target.getName()); for (var r : RegistryManager.ACTIVE.registries.entrySet()) loadRegistry(r.getKey(), target, RegistryManager.ACTIVE, true); - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.bake()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.bake()); // the id mapping has reverted, fire remap events for those that care about id changes if (fireEvents) { fireRemapEvent(ImmutableMap.of(), true); @@ -570,12 +570,12 @@ public class GameData { LOGGER.info(REGISTRIES, "Injecting existing registry data into this {} instance", EffectiveSide.get()); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.validateContent(name)); RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.dump(name)); - RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); + RegistryManager.ACTIVE.registries.forEach((_, reg) -> reg.resetDelegates()); // Update legacy names snapshot = snapshot.entrySet().stream() .sorted(Map.Entry.comparingByKey()) // FIXME Registries need dependency ordering, this makes sure blocks are done before items (for ItemCallbacks) but it's lazy as hell - .collect(Collectors.toMap(e -> RegistryManager.ACTIVE.updateLegacyName(e.getKey()), Map.Entry::getValue, (k1, k2) -> k1, LinkedHashMap::new)); + .collect(Collectors.toMap(e -> RegistryManager.ACTIVE.updateLegacyName(e.getKey()), Map.Entry::getValue, (k1, _) -> k1, LinkedHashMap::new)); if (isLocalWorld) { Identifier[] missingRegs = snapshot.keySet().stream().filter(name -> !RegistryManager.ACTIVE.registries.containsKey(name)).toArray(Identifier[]::new); @@ -667,7 +667,7 @@ public class GameData { if (injectFrozenData) { // If we're loading up the world from disk, we want to add in the new data that might have been provisioned by mods // So we load it from the frozen persistent registry - RegistryManager.ACTIVE.registries.forEach((name, reg) -> { + RegistryManager.ACTIVE.registries.forEach((name, _) -> { loadFrozenDataToStagingRegistry(STAGING, name, remaps.get(name)); }); } @@ -677,7 +677,7 @@ public class GameData { // Load the STAGING registry into the ACTIVE registry //for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) - RegistryManager.ACTIVE.registries.forEach((key, value) -> { + RegistryManager.ACTIVE.registries.forEach((key, _) -> { loadRegistry(key, STAGING, RegistryManager.ACTIVE, true); }); diff --git a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java index b17fd4d574..6b993e36d9 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java @@ -250,7 +250,7 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr } protected Holder.Reference getOrCreateHolderOrThrow(ResourceKey key) { - return this.holdersByName.computeIfAbsent(key.identifier(), k -> { + return this.holdersByName.computeIfAbsent(key.identifier(), _ -> { if (this.isIntrusive()) { throw new IllegalStateException("This registry can't create new holders without value"); } else { @@ -526,7 +526,7 @@ class NamespacedWrapper extends MappedRegistry implements ILockableRegistr if (this.isIntrusive()) return this.intrusiveHolderCallback.apply(value); - return this.holdersByName.computeIfAbsent(key.identifier(), k -> Holder.Reference.createStandAlone(this, key)); + return this.holdersByName.computeIfAbsent(key.identifier(), _ -> Holder.Reference.createStandAlone(this, key)); } private List> getSortedHolders() { diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java index 8af55397ba..53da06fb0a 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java @@ -54,7 +54,7 @@ class ObjectHolderRegistry { static void applyObjectHolders() { try { LOGGER.debug(ForgeRegistry.REGISTRIES, "Applying holder lookups"); - applyObjectHolders(key -> true); + applyObjectHolders(_ -> true); LOGGER.debug(ForgeRegistry.REGISTRIES, "Holder lookups applied"); } catch (RuntimeException e) { // It is more important that the calling contexts continue without exception to prevent further cascading errors diff --git a/src/main/java/net/minecraftforge/registries/tags/ITag.java b/src/main/java/net/minecraftforge/registries/tags/ITag.java index bf5675d83c..cb5aa57e57 100644 --- a/src/main/java/net/minecraftforge/registries/tags/ITag.java +++ b/src/main/java/net/minecraftforge/registries/tags/ITag.java @@ -9,7 +9,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.RandomSource; import java.util.Optional; -import java.util.Random; import java.util.stream.Stream; /** diff --git a/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java b/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java index 078f25eecb..5f92b1bbe6 100644 --- a/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java +++ b/src/main/java/net/minecraftforge/resource/DelegatingPackResources.java @@ -49,9 +49,9 @@ public class DelegatingPackResources extends AbstractPackResources { Map> map = new HashMap<>(); for (PackResources pack : packList) { for (String namespace : pack.getNamespaces(type)) - map.computeIfAbsent(namespace, k -> new ArrayList<>()).add(pack); + map.computeIfAbsent(namespace, _ -> new ArrayList<>()).add(pack); } - map.replaceAll((k, list) -> ImmutableList.copyOf(list)); + map.replaceAll((_, list) -> ImmutableList.copyOf(list)); return ImmutableMap.copyOf(map); } diff --git a/src/main/java/net/minecraftforge/server/LanguageHook.java b/src/main/java/net/minecraftforge/server/LanguageHook.java index aef19ffb38..2bcaac981b 100644 --- a/src/main/java/net/minecraftforge/server/LanguageHook.java +++ b/src/main/java/net/minecraftforge/server/LanguageHook.java @@ -73,7 +73,7 @@ public class LanguageHook { } for (var namespace : pack.getNamespaces(PackType.CLIENT_RESOURCES)) { - byNamespace.computeIfAbsent(namespace, k -> new ArrayList<>()).add(pack); + byNamespace.computeIfAbsent(namespace, _ -> new ArrayList<>()).add(pack); } } diff --git a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java index 8b39580af9..dd46e3e2fb 100644 --- a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java @@ -32,7 +32,7 @@ class DimensionsCommand { Map> types = new HashMap<>(); for (ServerLevel dim : ctx.getSource().getServer().getAllLevels()) { - types.computeIfAbsent(reg.getKey(dim.dimensionType()), k -> new ArrayList<>()).add(dim.dimension().identifier()); + types.computeIfAbsent(reg.getKey(dim.dimensionType()), _ -> new ArrayList<>()).add(dim.dimension().identifier()); } types.keySet().stream().sorted().forEach(key -> { diff --git a/src/main/java/net/minecraftforge/server/command/EntityCommand.java b/src/main/java/net/minecraftforge/server/command/EntityCommand.java index 7ae07c2557..e1cce7ad99 100644 --- a/src/main/java/net/minecraftforge/server/command/EntityCommand.java +++ b/src/main/java/net/minecraftforge/server/command/EntityCommand.java @@ -52,7 +52,7 @@ class EntityCommand return Commands.literal("list") .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)) .then(Commands.argument("filter", StringArgumentType.string()) - .suggests((ctx, builder) -> SharedSuggestionProvider.suggest(ForgeRegistries.ENTITY_TYPES.getKeys().stream().map(Identifier::toString).map(StringArgumentType::escapeIfRequired), builder)) + .suggests((_, builder) -> SharedSuggestionProvider.suggest(ForgeRegistries.ENTITY_TYPES.getKeys().stream().map(Identifier::toString).map(StringArgumentType::escapeIfRequired), builder)) .then(Commands.argument("dim", DimensionArgument.dimension()) .executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), DimensionArgument.getDimension(ctx, "dim").dimension())) ) @@ -76,7 +76,7 @@ class EntityCommand Map>> list = Maps.newHashMap(); level.getEntities().getAll().forEach(e -> { - MutablePair> info = list.computeIfAbsent(ForgeRegistries.ENTITY_TYPES.getKey(e.getType()), k -> MutablePair.of(0, Maps.newHashMap())); + MutablePair> info = list.computeIfAbsent(ForgeRegistries.ENTITY_TYPES.getKey(e.getType()), _ -> MutablePair.of(0, Maps.newHashMap())); ChunkPos chunk = ChunkPos.containing(e.blockPosition()); info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); diff --git a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java index 3488ff22e8..cca380e653 100644 --- a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java +++ b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java @@ -9,7 +9,6 @@ import net.minecraft.IdentifierException; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.ForgeConfig; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.server.ServerLifecycleHooks; import net.minecraftforge.server.permission.events.PermissionGatherEvent; import net.minecraftforge.server.permission.exceptions.UnregisteredPermissionException; diff --git a/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java b/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java index 8a218a0fef..bc1f62b19c 100644 --- a/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java +++ b/src/main/java/net/minecraftforge/server/permission/handler/IPermissionHandler.java @@ -7,7 +7,6 @@ package net.minecraftforge.server.permission.handler; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.StringRepresentable; import net.minecraftforge.server.permission.PermissionAPI; import net.minecraftforge.server.permission.events.PermissionGatherEvent; import net.minecraftforge.server.permission.nodes.PermissionDynamicContext; diff --git a/src/main/java/net/minecraftforge/server/timings/TimeTracker.java b/src/main/java/net/minecraftforge/server/timings/TimeTracker.java index 1a3c322aa6..2499b92952 100644 --- a/src/main/java/net/minecraftforge/server/timings/TimeTracker.java +++ b/src/main/java/net/minecraftforge/server/timings/TimeTracker.java @@ -108,7 +108,7 @@ public class TimeTracker currentlyTracking = null; return; } - int[] timings = this.timings.computeIfAbsent(object, k -> new int[101]); + int[] timings = this.timings.computeIfAbsent(object, _ -> new int[101]); int idx = timings[100] = (timings[100] + 1) % 100; timings[idx] = (int) (nanoTime - timing); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index d71939bda1..e8e53a3ff5 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,4 +1,4 @@ -public net.minecraft.advancements.CriteriaTriggers register(Ljava/lang/String;Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; +public net.minecraft.advancements.triggers.CriteriaTriggers register(Ljava/lang/String;Lnet/minecraft/advancements/triggers/CriterionTrigger;)Lnet/minecraft/advancements/triggers/CriterionTrigger; default net.minecraft.client.KeyMapping isDown public net.minecraft.client.Minecraft textureManager public-f net.minecraft.client.Options keyMappings @@ -44,14 +44,13 @@ protected net.minecraft.client.data.models.BlockModelGenerators createAxisAligne protected net.minecraft.client.data.models.BlockModelGenerators createAzalea(Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createBamboo()V protected net.minecraft.client.data.models.BlockModelGenerators createBambooModels(I)Lnet/minecraft/client/data/models/MultiVariant; -protected net.minecraft.client.data.models.BlockModelGenerators createBanner(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V -protected net.minecraft.client.data.models.BlockModelGenerators createBanners()V +protected net.minecraft.client.data.models.BlockModelGenerators createBanner(Lnet/minecraft/world/item/DyeColor;)V protected net.minecraft.client.data.models.BlockModelGenerators createBarrel()V protected net.minecraft.client.data.models.BlockModelGenerators createBars(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;Lnet/minecraft/resources/Identifier;)V protected net.minecraft.client.data.models.BlockModelGenerators createBarsAndItem(Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createBarsAndItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V -protected net.minecraft.client.data.models.BlockModelGenerators createBed(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V -protected net.minecraft.client.data.models.BlockModelGenerators createBeds()V +protected net.minecraft.client.data.models.BlockModelGenerators createBed(Lnet/minecraft/world/item/DyeColor;)V +protected net.minecraft.client.data.models.BlockModelGenerators createBed(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createBeeNest(Lnet/minecraft/world/level/block/Block;Ljava/util/function/Function;)V protected net.minecraft.client.data.models.BlockModelGenerators createBell()V protected net.minecraft.client.data.models.BlockModelGenerators createBigDripLeafBlock()V @@ -74,8 +73,8 @@ protected net.minecraft.client.data.models.BlockModelGenerators createChiseledBo protected net.minecraft.client.data.models.BlockModelGenerators createChorusFlower()V protected net.minecraft.client.data.models.BlockModelGenerators createChorusPlant()V protected net.minecraft.client.data.models.BlockModelGenerators createCocoa()V -protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithRandomRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;[Lnet/minecraft/world/level/block/Block;)V -protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithStateRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;[Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithRandomRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Ljava/util/List;)V +protected net.minecraft.client.data.models.BlockModelGenerators createColoredBlockWithStateRotations(Lnet/minecraft/client/data/models/model/TexturedModel$Provider;Ljava/util/List;)V protected net.minecraft.client.data.models.BlockModelGenerators createCommandBlock(Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createComparator()V protected net.minecraft.client.data.models.BlockModelGenerators createComposter()V @@ -131,6 +130,7 @@ protected net.minecraft.client.data.models.BlockModelGenerators createGrassLikeB protected net.minecraft.client.data.models.BlockModelGenerators createGrindstone()V protected net.minecraft.client.data.models.BlockModelGenerators createGrowingPlant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V protected net.minecraft.client.data.models.BlockModelGenerators createHangingMoss(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createHangingSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createHead(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/resources/Identifier;)V protected net.minecraft.client.data.models.BlockModelGenerators createHeads()V protected net.minecraft.client.data.models.BlockModelGenerators createHopper()V @@ -179,8 +179,6 @@ protected net.minecraft.client.data.models.BlockModelGenerators createPitcherCro protected net.minecraft.client.data.models.BlockModelGenerators createPitcherPlant()V protected net.minecraft.client.data.models.BlockModelGenerators createPlant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V protected net.minecraft.client.data.models.BlockModelGenerators createPlantWithDefaultItem(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/BlockModelGenerators$PlantType;)V -protected net.minecraft.client.data.models.BlockModelGenerators createPointedDripstone()V -protected net.minecraft.client.data.models.BlockModelGenerators createPointedDripstoneVariant(Lnet/minecraft/core/Direction;Lnet/minecraft/world/level/block/state/properties/DripstoneThickness;)Lnet/minecraft/client/data/models/MultiVariant; protected net.minecraft.client.data.models.BlockModelGenerators createPottedAzalea(Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createPressurePlate(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createPumpkinVariant(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/model/TextureMapping;)V @@ -207,6 +205,7 @@ protected net.minecraft.client.data.models.BlockModelGenerators createSegmentedB protected net.minecraft.client.data.models.BlockModelGenerators createShelf(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createShulkerBox(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/DyeColor;)V protected net.minecraft.client.data.models.BlockModelGenerators createSideFireModels(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; +protected net.minecraft.client.data.models.BlockModelGenerators createSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createSimpleBlock(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/MultiVariantGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createSlab(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createSmallDripleaf()V @@ -215,6 +214,8 @@ protected net.minecraft.client.data.models.BlockModelGenerators createSmoothSton protected net.minecraft.client.data.models.BlockModelGenerators createSnifferEgg()V protected net.minecraft.client.data.models.BlockModelGenerators createSnowBlocks()V protected net.minecraft.client.data.models.BlockModelGenerators createSoulFire()V +protected net.minecraft.client.data.models.BlockModelGenerators createSpeleothem(Lnet/minecraft/world/level/block/Block;)V +protected net.minecraft.client.data.models.BlockModelGenerators createSpeleothemVariant(Lnet/minecraft/core/Direction;Lnet/minecraft/world/level/block/state/properties/SpeleothemThickness;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/MultiVariant; protected net.minecraft.client.data.models.BlockModelGenerators createStairs(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;Lnet/minecraft/client/data/models/MultiVariant;)Lnet/minecraft/client/data/models/blockstates/BlockModelDefinitionGenerator; protected net.minecraft.client.data.models.BlockModelGenerators createStems(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.client.data.models.BlockModelGenerators createStonecutter()V @@ -267,6 +268,8 @@ public net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider door(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider fullBlockVariant(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider getOrCreateModel(Lnet/minecraft/client/data/models/model/ModelTemplate;Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/resources/Identifier; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider hangingSign(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/data/BlockFamily$Variant;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; +protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider pillar(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/client/data/models/BlockModelGenerators$BlockFamilyProvider; protected net.minecraft.client.data.models.BlockModelGenerators$BlockFamilyProvider trapdoor(Lnet/minecraft/world/level/block/Block;)V #endgroup public net.minecraft.client.data.models.BlockModelGenerators$PlantType @@ -317,53 +320,53 @@ public net.minecraft.client.data.models.ModelProvider$ItemInfoCollector public net.minecraft.client.data.models.ModelProvider$ItemInfoCollector ()V public net.minecraft.client.data.models.ModelProvider$SimpleModelCollector public net.minecraft.client.data.models.ModelProvider$SimpleModelCollector ()V -#group public net.minecraft.client.gui.Gui *() -public net.minecraft.client.gui.Gui canRenderCrosshairForSpectator(Lnet/minecraft/world/phys/HitResult;)Z -public net.minecraft.client.gui.Gui displayScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/scores/Objective;)V -public net.minecraft.client.gui.Gui extractAirBubbles(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;III)V -public net.minecraft.client.gui.Gui extractArmor(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIII)V -public net.minecraft.client.gui.Gui extractBossOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractCameraOverlays(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractChat(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractConfusionOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V -public net.minecraft.client.gui.Gui extractCrosshair(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractDemoOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractEffects(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractFood(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;II)V -public net.minecraft.client.gui.Gui extractHeart(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/gui/Gui$HeartType;IIZZZ)V -public net.minecraft.client.gui.Gui extractHearts(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V -public net.minecraft.client.gui.Gui extractHotbarAndDecorations(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractItemHotbar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractOverlayMessage(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractPlayerHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V -public net.minecraft.client.gui.Gui extractPortalOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V -public net.minecraft.client.gui.Gui extractScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractSelectedItemName(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V -public net.minecraft.client.gui.Gui extractSleepOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractSlot(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V -public net.minecraft.client.gui.Gui extractSpyglassOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V -public net.minecraft.client.gui.Gui extractSubtitleOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Z)V -public net.minecraft.client.gui.Gui extractTabList(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractTextureOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/resources/Identifier;F)V -public net.minecraft.client.gui.Gui extractTitle(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V -public net.minecraft.client.gui.Gui extractVehicleHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V -public net.minecraft.client.gui.Gui extractVignette(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/Entity;)V -public net.minecraft.client.gui.Gui getAirBubbleYLine(II)I -public net.minecraft.client.gui.Gui getCameraPlayer()Lnet/minecraft/world/entity/player/Player; -public net.minecraft.client.gui.Gui getCurrentAirSupplyBubble(III)I -public net.minecraft.client.gui.Gui getEmptyBubbleDelayDuration(IZ)I -public net.minecraft.client.gui.Gui getPlayerVehicleWithHealth()Lnet/minecraft/world/entity/LivingEntity; -public net.minecraft.client.gui.Gui getVehicleMaxHearts(Lnet/minecraft/world/entity/LivingEntity;)I -public net.minecraft.client.gui.Gui getVisibleVehicleHeartRows(I)I -public net.minecraft.client.gui.Gui nextContextualInfoState()Lnet/minecraft/client/gui/Gui$ContextualInfo; -public net.minecraft.client.gui.Gui playAirBubblePoppedSound(ILnet/minecraft/world/entity/player/Player;I)V -public net.minecraft.client.gui.Gui tick()V -public net.minecraft.client.gui.Gui tickAutosaveIndicator()V -public net.minecraft.client.gui.Gui updateVignetteBrightness(Lnet/minecraft/world/entity/Entity;)V -public net.minecraft.client.gui.Gui willPrioritizeExperienceInfo()Z -public net.minecraft.client.gui.Gui willPrioritizeJumpInfo()Z -#endgroup public net.minecraft.client.gui.GuiGraphicsExtractor componentHoverEffect(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Style;II)V +#group public net.minecraft.client.gui.Hud *() +public net.minecraft.client.gui.Hud canRenderCrosshairForSpectator(Lnet/minecraft/world/phys/HitResult;)Z +public net.minecraft.client.gui.Hud displayScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/scores/Objective;)V +public net.minecraft.client.gui.Hud extractAirBubbles(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;III)V +public net.minecraft.client.gui.Hud extractArmor(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIII)V +public net.minecraft.client.gui.Hud extractBossOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractCameraOverlays(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractChat(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractConfusionOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractCrosshair(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractDemoOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractEffects(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractFood(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;II)V +public net.minecraft.client.gui.Hud extractHeart(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/gui/Hud$HeartType;IIZZZ)V +public net.minecraft.client.gui.Hud extractHearts(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V +public net.minecraft.client.gui.Hud extractHotbarAndDecorations(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractItemHotbar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractOverlayMessage(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractPlayerHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractPortalOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractSelectedItemName(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractSleepOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractSlot(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V +public net.minecraft.client.gui.Hud extractSpyglassOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V +public net.minecraft.client.gui.Hud extractSubtitleOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Z)V +public net.minecraft.client.gui.Hud extractTabList(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractTextureOverlay(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/resources/Identifier;F)V +public net.minecraft.client.gui.Hud extractTitle(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/client/DeltaTracker;)V +public net.minecraft.client.gui.Hud extractVehicleHealth(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V +public net.minecraft.client.gui.Hud extractVignette(Lnet/minecraft/client/gui/GuiGraphicsExtractor;Lnet/minecraft/world/entity/Entity;)V +public net.minecraft.client.gui.Hud getAirBubbleYLine(II)I +public net.minecraft.client.gui.Hud getCameraPlayer()Lnet/minecraft/world/entity/player/Player; +public net.minecraft.client.gui.Hud getCurrentAirSupplyBubble(III)I +public net.minecraft.client.gui.Hud getEmptyBubbleDelayDuration(IZ)I +public net.minecraft.client.gui.Hud getPlayerVehicleWithHealth()Lnet/minecraft/world/entity/LivingEntity; +public net.minecraft.client.gui.Hud getVehicleMaxHearts(Lnet/minecraft/world/entity/LivingEntity;)I +public net.minecraft.client.gui.Hud getVisibleVehicleHeartRows(I)I +public net.minecraft.client.gui.Hud nextContextualInfoState()Lnet/minecraft/client/gui/Hud$ContextualInfo; +public net.minecraft.client.gui.Hud playAirBubblePoppedSound(ILnet/minecraft/world/entity/player/Player;I)V +public net.minecraft.client.gui.Hud tick()V +public net.minecraft.client.gui.Hud tickAutosaveIndicator()V +public net.minecraft.client.gui.Hud updateVignetteBrightness(Lnet/minecraft/world/entity/Entity;)V +public net.minecraft.client.gui.Hud willPrioritizeExperienceInfo()Z +public net.minecraft.client.gui.Hud willPrioritizeJumpInfo()Z +#endgroup protected net.minecraft.client.gui.components.AbstractButton SPRITES protected net.minecraft.client.gui.components.AbstractSelectionList$Entry list protected net.minecraft.client.gui.components.AbstractSliderButton getHandleSprite()Lnet/minecraft/resources/Identifier; @@ -387,9 +390,10 @@ public net.minecraft.client.particle.ParticleResources register(Lnet/minecraft/c public net.minecraft.client.particle.ParticleResources register(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleResources$SpriteParticleRegistration;)V public net.minecraft.client.particle.ParticleResources$SpriteParticleRegistration public net.minecraft.client.player.ClientInput moveVector -public net.minecraft.client.renderer.LevelRenderer shouldShowEntityOutlines()Z private-f net.minecraft.client.renderer.LevelRenderer weatherEffectRenderer #group public net.minecraft.client.renderer.RenderPipelines * +public net.minecraft.client.renderer.RenderPipelines ALPHA_CUTOUT_THRESHOLD_CUTOUT_TERRAIN +public net.minecraft.client.renderer.RenderPipelines ALPHA_CUTOUT_THRESHOLD_DEFAULT public net.minecraft.client.renderer.RenderPipelines BEACON_BEAM_SNIPPET public net.minecraft.client.renderer.RenderPipelines BLOCK_SNIPPET public net.minecraft.client.renderer.RenderPipelines CLOUDS_SNIPPET @@ -397,7 +401,6 @@ public net.minecraft.client.renderer.RenderPipelines DEBUG_FILLED_SNIPPET public net.minecraft.client.renderer.RenderPipelines END_PORTAL_SNIPPET public net.minecraft.client.renderer.RenderPipelines ENTITY_EMISSIVE_SNIPPET public net.minecraft.client.renderer.RenderPipelines ENTITY_SNIPPET -public net.minecraft.client.renderer.RenderPipelines FOG_SNIPPET public net.minecraft.client.renderer.RenderPipelines GENERIC_BLOCKS_SNIPPET public net.minecraft.client.renderer.RenderPipelines GLOBALS_SNIPPET public net.minecraft.client.renderer.RenderPipelines GUI_SNIPPET @@ -407,13 +410,13 @@ public net.minecraft.client.renderer.RenderPipelines ITEM_SNIPPET public net.minecraft.client.renderer.RenderPipelines LINES_SNIPPET public net.minecraft.client.renderer.RenderPipelines MATRICES_FOG_LIGHT_DIR_SNIPPET public net.minecraft.client.renderer.RenderPipelines MATRICES_FOG_SNIPPET -public net.minecraft.client.renderer.RenderPipelines MATRICES_PROJECTION_SNIPPET public net.minecraft.client.renderer.RenderPipelines OUTLINE_SNIPPET public net.minecraft.client.renderer.RenderPipelines PARTICLE_SNIPPET public net.minecraft.client.renderer.RenderPipelines PIPELINES_BY_LOCATION public net.minecraft.client.renderer.RenderPipelines TERRAIN_SNIPPET public net.minecraft.client.renderer.RenderPipelines TEXT_SNIPPET public net.minecraft.client.renderer.RenderPipelines WEATHER_SNIPPET +public net.minecraft.client.renderer.RenderPipelines WORLD_TEXT_SNIPPET #endgroup public net.minecraft.client.renderer.blockentity.BlockEntityRenderers register(Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/client/renderer/blockentity/BlockEntityRendererProvider;)V protected net.minecraft.client.renderer.blockentity.ChestRenderer getChestMaterial(Lnet/minecraft/world/level/block/entity/BlockEntity;Z)Lnet/minecraft/client/renderer/blockentity/state/ChestRenderState$ChestMaterialType; @@ -466,14 +469,17 @@ protected net.minecraft.data.recipes.RecipeProvider cutBuilder(Lnet/minecraft/da protected net.minecraft.data.recipes.RecipeProvider fenceBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; protected net.minecraft.data.recipes.RecipeProvider fenceGateBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; protected net.minecraft.data.recipes.RecipeProvider generateCraftingRecipe(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/ItemLike;)V +protected net.minecraft.data.recipes.RecipeProvider generateSmeltingRecipe(Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/ItemLike;)V protected net.minecraft.data.recipes.RecipeProvider generateStonecutterRecipe(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/block/Block;)V protected net.minecraft.data.recipes.RecipeProvider getBaseBlockForCrafting(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;)Lnet/minecraft/world/level/block/Block; -protected net.minecraft.data.recipes.RecipeProvider has(Lnet/minecraft/advancements/criterion/MinMaxBounds$Ints;Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/advancements/Criterion; -protected net.minecraft.data.recipes.RecipeProvider insideOf(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/advancements/Criterion; -protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/criterion/ItemPredicate$Builder;)Lnet/minecraft/advancements/Criterion; -protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/criterion/ItemPredicate;)Lnet/minecraft/advancements/Criterion; +protected net.minecraft.data.recipes.RecipeProvider getCraftingCriterionName(Lnet/minecraft/data/BlockFamily;Lnet/minecraft/data/BlockFamily$Variant;Lnet/minecraft/world/level/ItemLike;)Ljava/lang/String; +protected net.minecraft.data.recipes.RecipeProvider has(Lnet/minecraft/advancements/predicates/MinMaxBounds$Ints;Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider insideOf(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/predicates/ItemPredicate$Builder;)Lnet/minecraft/advancements/triggers/Criterion; +protected net.minecraft.data.recipes.RecipeProvider inventoryTrigger([Lnet/minecraft/advancements/predicates/ItemPredicate;)Lnet/minecraft/advancements/triggers/Criterion; protected net.minecraft.data.recipes.RecipeProvider nineBlockStorageRecipes(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V protected net.minecraft.data.recipes.RecipeProvider oreCooking(Lnet/minecraft/world/item/crafting/AbstractCookingRecipe$Factory;Ljava/util/List;Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/item/crafting/CookingBookCategory;Lnet/minecraft/world/level/ItemLike;FILjava/lang/String;Ljava/lang/String;)V +protected net.minecraft.data.recipes.RecipeProvider pillarBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; protected net.minecraft.data.recipes.RecipeProvider polishedBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; protected net.minecraft.data.recipes.RecipeProvider pressurePlateBuilder(Lnet/minecraft/data/recipes/RecipeCategory;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; protected net.minecraft.data.recipes.RecipeProvider signBuilder(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/item/crafting/Ingredient;)Lnet/minecraft/data/recipes/RecipeBuilder; @@ -494,7 +500,6 @@ public net.minecraft.data.recipes.packs.VanillaRecipeProvider REDSTONE_SMELTABLE public-f net.minecraft.data.registries.RegistriesDatapackGenerator getName()Ljava/lang/String; protected net.minecraft.data.tags.TagsProvider builders public-f net.minecraft.data.tags.TagsProvider getName()Ljava/lang/String; -public net.minecraft.data.tags.VanillaItemTagsProvider$BlockToItemConverter public net.minecraft.resources.Identifier validNamespaceChar(C)Z public net.minecraft.resources.RegistryDataLoader$RegistryData (Lnet/minecraft/resources/ResourceKey;Lcom/mojang/serialization/Codec;)V protected net.minecraft.server.MinecraftServer nextTickTimeNanos @@ -517,7 +522,6 @@ public net.minecraft.util.thread.BlockableEventLoop submitAsync(Ljava/lang/Runna #group public net.minecraft.world.damagesource.DamageSource *() #All methods public, most are already public net.minecraft.world.damagesource.DamageSource (Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;)V #endgroup -protected net.minecraft.world.entity.Entity ENTITY_COUNTER public net.minecraft.world.entity.Entity LOGGER public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String; public net.minecraft.world.entity.Mob goalSelector diff --git a/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json b/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json index b94b56867e..e31ac7bd9e 100644 --- a/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json +++ b/src/test/generated/conditional_loot_test/data/conditional_loot_test/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", @@ -15,7 +14,6 @@ "rolls": 1.0 }, { - "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json index 7691fc96a8..28864758b4 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_doesnt_load_empty.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:dirt" ], diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json index e850d76310..3555d79245 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/conditional_recipe_choice.json @@ -7,7 +7,6 @@ }, "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, @@ -27,7 +26,6 @@ }, "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:oak_log" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json index 21ad90f7a1..20abbe0ff3 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_false_conditions.json @@ -7,8 +7,6 @@ { "recipe": { "type": "minecraft:smelting", - "category": "misc", - "cookingtime": 200, "experience": 0.1, "ingredient": "minecraft:dirt", "result": { diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json index e0bed48e3d..2cba199ad6 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/cooking_true_conditions.json @@ -7,8 +7,6 @@ { "recipe": { "type": "minecraft:smelting", - "category": "misc", - "cookingtime": 200, "experience": 0.1, "ingredient": "minecraft:bee_nest", "result": { diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json index 45f9b7db70..f5ab62d51d 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_false_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json index 87e16af726..bafc16fe6a 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shaped_true_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:oak_log" }, diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json index 5cff1ede06..dfd27c1f91 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_false_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:redstone_ore", "minecraft:redstone_ore", diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json index 6b9cfe24bb..e2b9cc1e38 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/shapeless_true_conditions.json @@ -7,7 +7,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:redstone_ore", "minecraft:redstone_ore", diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json index f1097b17ab..aed90aac7d 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_doesnt_load.json @@ -8,7 +8,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:iron_ore", "minecraft:iron_ore", diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json index a44c94be44..fc6f8db17a 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/tag_empty_condition_loads.json @@ -8,7 +8,6 @@ { "recipe": { "type": "minecraft:crafting_shapeless", - "category": "misc", "ingredients": [ "minecraft:gold_ore", "minecraft:gold_ore", diff --git a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json index 72939248d3..159452af28 100644 --- a/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json +++ b/src/test/generated/conditional_recipe/data/conditional_recipe/recipe/test_encode_all_conditions.json @@ -35,7 +35,6 @@ { "recipe": { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": "minecraft:dirt" }, diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json index 2033323d40..8c38c4c5f2 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/compound_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:compound", diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json index e31647aef7..b4d51b4867 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/difference_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:difference", diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json index 1a9e18fe0c..67d91348ce 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/intersection_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:intersection", diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json index fcc8a2a829..005938a3fd 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_damage_only.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:nbt", diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json index 43438d9249..95e0518b01 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/partial_nbt_name_only.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:nbt", diff --git a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json index 58c92c3e6e..38bf02b628 100644 --- a/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json +++ b/src/test/generated/custom_ingredients/data/custom_ingredients/recipe/strict_nbt_ingredient.json @@ -1,6 +1,5 @@ { "type": "minecraft:crafting_shaped", - "category": "misc", "key": { "X": { "type": "forge:nbt", diff --git a/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json b/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json index 9a0c146055..8004016926 100644 --- a/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json +++ b/src/test/generated/global_loot_test/data/global_loot_test/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:survives_explosion" diff --git a/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json b/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json index 252f3538fc..95deedae5d 100644 --- a/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json +++ b/src/test/generated/loot_events/data/loot_events/loot_table/blocks/test.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:survives_explosion" diff --git a/src/test/generated/mdk_datagen/pack.mcmeta b/src/test/generated/mdk_datagen/pack.mcmeta index 2af8be3823..e0bd3459be 100644 --- a/src/test/generated/mdk_datagen/pack.mcmeta +++ b/src/test/generated/mdk_datagen/pack.mcmeta @@ -1,9 +1,9 @@ { "pack": { "description": "${mod_id} resources", - "max_format": 101, + "max_format": 107, "min_format": [ - 101, + 107, 1 ] } diff --git a/src/test/generated/test_helper_mod/pack.mcmeta b/src/test/generated/test_helper_mod/pack.mcmeta index d8608adf1e..46d7c8bc4e 100644 --- a/src/test/generated/test_helper_mod/pack.mcmeta +++ b/src/test/generated/test_helper_mod/pack.mcmeta @@ -1,9 +1,9 @@ { "pack": { "description": "Forge tests resource pack", - "max_format": 101, + "max_format": 107, "min_format": [ - 101, + 107, 1 ] } diff --git a/src/test/java/com/example/examplemod/ExampleMod.java b/src/test/java/com/example/examplemod/ExampleMod.java index 3b914dbdfb..86a8af6ba1 100644 --- a/src/test/java/com/example/examplemod/ExampleMod.java +++ b/src/test/java/com/example/examplemod/ExampleMod.java @@ -68,7 +68,7 @@ public final class ExampleMod { public static final RegistryObject EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() .withTabsBefore(CreativeModeTabs.COMBAT) .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { + .displayItems((_, output) -> { output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event }).build()); diff --git a/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java b/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java index 6603ac65d1..220d8eb750 100644 --- a/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java +++ b/src/test/java/net/minecraftforge/debug/chunk/LightingEventTest.java @@ -35,7 +35,7 @@ public class LightingEventTest extends BaseTestMod { @GameTest public static void testLightingEventFires(GameTestHelper helper) { var eventFired = helper.boolFlag("eventFired"); - helper.addEventListener(ChunkEvent.LightingCalculated.BUS, event -> eventFired.set(true)); + helper.addEventListener(ChunkEvent.LightingCalculated.BUS, _ -> eventFired.set(true)); var random = RandomSource.create(); var level = helper.getLevel(); diff --git a/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java b/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java index e9ad288f81..6ace81ca45 100644 --- a/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/AdditionalModelTest.java @@ -16,7 +16,6 @@ import net.minecraft.client.model.animal.cow.CowModel; import net.minecraft.client.model.animal.pig.PigModel; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.block.MovingBlockRenderState; -import net.minecraft.client.renderer.block.model.BlockStateModelWrapper; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; @@ -27,7 +26,7 @@ import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.animal.cow.Cow; import net.minecraft.world.entity.animal.pig.Pig; import net.minecraft.world.item.Item; @@ -119,7 +118,7 @@ public class AdditionalModelTest extends BaseTestMod { // An example on how to render both the item and block model variants public void onAddLayers(EntityRenderersEvent.AddLayers event) { // Pigs get a block on their head, this is a test of going through the ItemModel loader - LivingEntityRenderer pig = event.getEntityRenderer(EntityType.PIG); + LivingEntityRenderer pig = event.getEntityRenderer(EntityTypes.PIG); pig.addLayer(new RenderLayer<>(pig) { @Override public void submit(PoseStack stack, SubmitNodeCollector source, int light, PigRenderState state, float xRot, float yRot) { @@ -143,7 +142,7 @@ public class AdditionalModelTest extends BaseTestMod { // Cows get a block on their head, this is a test of going through the BlockModel loader - LivingEntityRenderer cow = event.getEntityRenderer(EntityType.COW); + LivingEntityRenderer cow = event.getEntityRenderer(EntityTypes.COW); cow.addLayer(new RenderLayer<>(cow) { @Override public void submit(PoseStack stack, SubmitNodeCollector source, int light, LivingEntityRenderState cowState, float xRot, float yRot) { @@ -159,7 +158,7 @@ public class AdditionalModelTest extends BaseTestMod { var state = new MovingBlockRenderState(); state.blockState = COW_HEAD_STATE.any(); - source.submitMovingBlock(stack, state); + source.submitMovingBlock(stack, state, 0); stack.popPose(); } } diff --git a/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java b/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java index e7805e2eec..20576bda84 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomParticleTypeTest.java @@ -25,9 +25,9 @@ import java.util.Map; @Mod(CustomParticleTypeTest.MOD_ID) public class CustomParticleTypeTest extends BaseTestMod { public static final String MOD_ID = "custom_particle_type_test"; - private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("GRP_ONE"); - private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("GRP_TWO"); - private static final ParticleRenderType CUSTOM_TYPE_DUP = new ParticleRenderType("GRP_DUP"); + private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("GRP_ONE", "G1"); + private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("GRP_TWO", "G2"); + private static final ParticleRenderType CUSTOM_TYPE_DUP = new ParticleRenderType("GRP_DUP", "GD"); public CustomParticleTypeTest(FMLJavaModLoadingContext context) { super(context, false, false); diff --git a/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java b/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java index 7a4b2ebc14..c5e117e7eb 100644 --- a/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/FluidBucketModelTest.java @@ -101,7 +101,7 @@ public class FluidBucketModelTest extends BaseTestMod { public FluidBucketModelTest(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> BUCKET.get().getDefaultInstance()); + this.testItem(_ -> BUCKET.get().getDefaultInstance()); BakeFluidModels.BUS.addListener(this::registerFluidModels); } diff --git a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java index 73e70c7c91..cb11d6a649 100644 --- a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java +++ b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java @@ -35,11 +35,11 @@ public class GuiLayeringTest { public static void guiOpen(ScreenEvent.Init.Post event) { if (event.getScreen() instanceof AbstractContainerScreen && ENABLED) { event.addListener(Button.builder(Component.literal("Test Gui Layering"), btn -> { - Minecraft.getInstance().pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); + Minecraft.getInstance().gui.pushLayer(new TestLayer(Component.literal("LayerScreen"))); }).pos(2,2).size(150, 20).build()); event.addListener(Button.builder(Component.literal("Test Gui Normal"), btn -> { - Minecraft.getInstance().setScreen(new TestLayer(Component.literal("LayerScreen"))); + Minecraft.getInstance().gui.setScreen(new TestLayer(Component.literal("LayerScreen"))); }).pos(2, 25).size(150, 20).build()); } } @@ -78,15 +78,15 @@ public class GuiLayeringTest { } private void closeStack(Button button) { - this.minecraft.setScreen(null); + this.minecraft.gui.setScreen(null); } private void popLayerButton(Button button) { - this.minecraft.popGuiLayer(); + this.minecraft.gui.popLayer(); } private void pushLayerButton(Button button) { - this.minecraft.pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); + this.minecraft.gui.pushLayer(new TestLayer(Component.literal("LayerScreen"))); } } } diff --git a/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java b/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java index 269b9f6e9e..dfe6e7c623 100644 --- a/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java +++ b/src/test/java/net/minecraftforge/debug/client/ModifyOverlayTest.java @@ -5,10 +5,7 @@ package net.minecraftforge.debug.client; -import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.resources.Identifier; import net.minecraftforge.client.event.AddGuiOverlayLayersEvent; @@ -35,18 +32,18 @@ public class ModifyOverlayTest extends BaseTestMod { private static final Identifier myStackName = name("my_stack_name"); private static final ForgeLayeredDraw myLayerStack = new ForgeLayeredDraw(myStackName); - private static final ForgeLayer notAddedLayer = (gg, tr) -> {}; - private static final ForgeLayer layerA = (gg,tr) -> {}; + private static final ForgeLayer notAddedLayer = (_, _) -> {}; + private static final ForgeLayer layerA = (_,_) -> {}; private static final Identifier layerAName = name("layer_a"); - private static final ForgeLayer layerB = (gg,tr) -> {}; + private static final ForgeLayer layerB = (_,_) -> {}; private static final Identifier layerBName = name("layer_b"); - private static final ForgeLayer layerC = (gg,tr) -> {}; + private static final ForgeLayer layerC = (_,_) -> {}; private static final Identifier layerCName = name("layer_c"); private static final IForgeGameTestHelper.BoolFlag detectReplaceFlag = new IForgeGameTestHelper.BoolFlag("det_replace_flag"); // Wrapper renderer since we just need to change the callee location to test private static final ForgeLayer replacementRenderer = (gg, tracker) -> { - Minecraft.getInstance().gui.extractEffects(gg, tracker); + Minecraft.getInstance().gui.hud.extractEffects(gg, tracker); detectReplaceFlag.set(true); }; @@ -88,6 +85,7 @@ public class ModifyOverlayTest extends BaseTestMod { }); } + @SuppressWarnings("unchecked") @GameTest public static void ordered_layers(GameTestHelper helper) { // Test that layers are in the correct order. @@ -99,9 +97,9 @@ public class ModifyOverlayTest extends BaseTestMod { var field1 = cls.getDeclaredField("namedLayers"); field.setAccessible(true); field1.setAccessible(true); - Map> VROOT = ((Map>) field.get(drawStack)); - var PSS = ((ForgeLayeredDraw) VROOT.get(PRE_SLEEP_STACK).getKey()); - check = ((Map) field1.get(PSS)); + var VROOT = ((Map>) field.get(drawStack)); + var PSS = ((ForgeLayeredDraw)VROOT.get(PRE_SLEEP_STACK).getKey()); + check = ((Map)field1.get(PSS)); internalLayersList = getInternalLayersList(PSS); } catch (Exception e) { helper.fail("Threw a " + e.getMessage() + " when trying to get the inner layer list."); @@ -157,7 +155,7 @@ public class ModifyOverlayTest extends BaseTestMod { } }); - myLayerStack.add(name("my_inner_layer_name"), (gg, tr) -> { + myLayerStack.add(name("my_inner_layer_name"), (_, _) -> { detectConditionStackFlag.set(true); }); // Demonstrates that entire stacks can have conditions attached diff --git a/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java b/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java index ac8e27618d..30cf1ab57f 100644 --- a/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java +++ b/src/test/java/net/minecraftforge/debug/client/PictureInPictureTest.java @@ -11,7 +11,7 @@ import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.navigation.ScreenPosition; import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; -import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraftforge.client.event.RegisterPictureInPictureRendererEvent; @@ -80,21 +80,17 @@ public class PictureInPictureTest extends BaseTestMod { } private void registerTestPip(RegisterPictureInPictureRendererEvent event) { - event.register(new TestPipRenderer(event.getBufferSource())); + event.register(new TestPipRenderer()); } static class TestPipRenderer extends PictureInPictureRenderer { - protected TestPipRenderer(MultiBufferSource.BufferSource bufferSource) { - super(bufferSource); - } - @Override public Class getRenderStateClass() { return TestPipRendererState.class; } @Override - protected void renderToTexture(TestPipRendererState state, PoseStack poseStack) { + protected void renderToTexture(TestPipRendererState state, PoseStack poseStack, SubmitNodeCollector collector) { var graphics = state.graphics(); int red = Color.red.getRGB(); int x1 = state.x0 - 1; diff --git a/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java b/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java index d8faa016e0..e41c175078 100644 --- a/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java +++ b/src/test/java/net/minecraftforge/debug/client/RenderTooltipTest.java @@ -61,10 +61,10 @@ public class RenderTooltipTest extends BaseTestMod { helper.addRecordListener(TickEvent.RenderTickEvent.Pre.BUS, (event) -> { if (shouldOpen == 1) { - Minecraft.getInstance().setScreen(new InventoryScreen(Minecraft.getInstance().player)); + Minecraft.getInstance().gui.setScreen(new InventoryScreen(Minecraft.getInstance().player)); shouldOpen = 2; } else if (shouldOpen == 2) { - Minecraft.getInstance().setScreen(null); + Minecraft.getInstance().gui.setScreen(null); shouldOpen = 0; } }); diff --git a/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java b/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java index 8b7df7b3d6..7a02eb32a9 100644 --- a/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java +++ b/src/test/java/net/minecraftforge/debug/creativetabs/CreativeModeTabTest.java @@ -53,7 +53,7 @@ public class CreativeModeTabTest { helper.register(LOGS, CreativeModeTab.builder().icon(() -> new ItemStack(Blocks.ACACIA_LOG)) .title(Component.literal("Logs")) .withLabelColor(0x00FF00) - .displayItems((params, output) -> { + .displayItems((_, output) -> { output.accept(new ItemStack(Blocks.ACACIA_LOG)); output.accept(new ItemStack(Blocks.BIRCH_LOG)); output.accept(new ItemStack(Blocks.DARK_OAK_LOG)); @@ -67,7 +67,7 @@ public class CreativeModeTabTest { .icon(() -> new ItemStack(Blocks.STONE)) .title(Component.literal("Stone")) .withLabelColor(0x0000FF) - .displayItems((params, output) -> { + .displayItems((_, output) -> { output.accept(new ItemStack(Blocks.STONE)); output.accept(new ItemStack(Blocks.GRANITE)); output.accept(new ItemStack(Blocks.DIORITE)); @@ -78,7 +78,7 @@ public class CreativeModeTabTest { helper.register(COLORS, CreativeModeTab.builder() .title(Component.literal("Colors")) - .displayItems((params, output) -> output.acceptAll(getDyes())) + .displayItems((_, output) -> output.acceptAll(getDyes())) .withTabFactory(CreativeModeColorTab::new) .withTabsBefore(STONE) .build() @@ -87,7 +87,7 @@ public class CreativeModeTabTest { helper.register(SEARCH, CreativeModeTab.builder() .title(Component.literal("Search")) .icon(() -> new ItemStack(Items.BOOKSHELF)) - .displayItems((params, output) -> output.acceptAll(getDyes())) + .displayItems((_, output) -> output.acceptAll(getDyes())) .withTabsBefore(COLORS) .withSearchBar() .build() @@ -99,7 +99,7 @@ public class CreativeModeTabTest { helper.register(Identifier.fromNamespaceAndPath(MOD_ID, "dummy" + i), CreativeModeTab.builder() .title(Component.literal("Dummy " + i)) .icon(() -> new ItemStack(block)) - .displayItems((params, output) -> output.accept(block)) + .displayItems((_, output) -> output.accept(block)) .build() ); } @@ -108,7 +108,7 @@ public class CreativeModeTabTest { helper.register(Identifier.fromNamespaceAndPath(MOD_ID, "with_tabs_image"), CreativeModeTab.builder() .title(Component.translatable("itemGroup.with_tabs_image")) .icon(() -> new ItemStack(Blocks.BRICKS)) - .displayItems((params, output) -> output.accept(Blocks.BRICKS)) + .displayItems((_, output) -> output.accept(Blocks.BRICKS)) //.withTabsImage(custom_tabs_image) .build()); }); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java b/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java index b3f9aa54ac..dc64ab8251 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/block/ChorusBlockPlacementTest.java @@ -7,11 +7,11 @@ package net.minecraftforge.debug.gameplay.block; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; +import net.minecraft.data.tags.VanillaBlockTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -51,14 +51,14 @@ public class ChorusBlockPlacementTest extends BaseTestMod { event.getGenerator().addProvider(event.includeServer(), new BlockTagProvider(event)); } - private static final class BlockTagProvider extends BlockTagsProvider { + private static final class BlockTagProvider extends VanillaBlockTagsProvider { public BlockTagProvider(GatherDataEvent event) { super(event.getGenerator().getPackOutput(), event.getLookupProvider(), MOD_ID, event.getExistingFileHelper()); } @Override protected void addTags(HolderLookup.Provider provider) { - this.tag(BlockTags.SUPPORTS_CHORUS_PLANT).add(BLOCK.get()); + this.tag(BlockTags.SUPPORTS_CHORUS_PLANT).add(BLOCK.getKey()); } } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java b/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java index f1b4dd6e10..b62099e71f 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/block/PlantTypePlacementTest.java @@ -45,7 +45,9 @@ public class PlantTypePlacementTest extends BaseTestMod { map.put(BlockTags.MOSS_BLOCKS, List.of(MOSS_BLOCK, PALE_MOSS_BLOCK)); map.put(BlockTags.GRASS_BLOCKS, List.of(GRASS_BLOCK, PODZOL, MYCELIUM)); map.put(BlockTags.SAND, List.of(SAND, RED_SAND, SUSPICIOUS_SAND)); - map.put(BlockTags.TERRACOTTA, List.of(TERRACOTTA, WHITE_TERRACOTTA, ORANGE_TERRACOTTA, MAGENTA_TERRACOTTA, LIGHT_BLUE_TERRACOTTA, YELLOW_TERRACOTTA, LIME_TERRACOTTA, PINK_TERRACOTTA, GRAY_TERRACOTTA, LIGHT_GRAY_TERRACOTTA, CYAN_TERRACOTTA, PURPLE_TERRACOTTA, BLUE_TERRACOTTA, BROWN_TERRACOTTA, GREEN_TERRACOTTA, RED_TERRACOTTA, BLACK_TERRACOTTA)); + var terracotta = new ArrayList(Blocks.DYED_TERRACOTTA.asList()); + terracotta.add(TERRACOTTA); + map.put(BlockTags.TERRACOTTA, terracotta); map.put(BlockTags.NYLIUM, List.of(CRIMSON_NYLIUM, WARPED_NYLIUM)); map.put(BlockTags.OVERRIDES_MUSHROOM_LIGHT_REQUIREMENT, List.of(MYCELIUM, PODZOL, CRIMSON_NYLIUM, WARPED_NYLIUM)); }); @@ -411,7 +413,7 @@ public class PlantTypePlacementTest extends BaseTestMod { } @SafeVarargs - private static Collection join(GameTestHelper helper, @SuppressWarnings("unchecked") TagKey... tags) { + private static Collection join(GameTestHelper helper, TagKey... tags) { var ret = new HashSet(); for (var tag : tags) ret.addAll(known(helper, tag)); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java b/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java index 05553d29eb..f6e849c1d7 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/crafting/ConditionalRecipeTest.java @@ -18,10 +18,10 @@ import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; import net.minecraft.data.recipes.SingleItemRecipeBuilder; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.references.ItemIds; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.CookingBookCategory; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; @@ -33,7 +33,6 @@ import net.minecraftforge.common.Tags; import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.SimpleCraftingContainer; import net.minecraftforge.common.crafting.conditions.IConditionBuilder; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.fml.common.Mod; @@ -55,8 +54,6 @@ public class ConditionalRecipeTest extends BaseTestMod { public void gatherData(GatherDataEvent event) { var gen = event.getGenerator(); gen.addProvider(event.includeServer(), new Recipes.Runner(gen.getPackOutput(), event.getLookupProvider())); - var testBlockTags = new TestBlockTags(gen.getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper()); - gen.addProvider(event.includeServer(), testBlockTags); gen.addProvider(event.includeServer(), new TestItemTags(gen.getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper())); } @@ -171,17 +168,6 @@ public class ConditionalRecipeTest extends BaseTestMod { ); } - public static class TestBlockTags extends BlockTagsProvider { - public TestBlockTags(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, MODID, existingFileHelper); - } - - @Override - protected void addTags(HolderLookup.Provider registries) { - // No block tags needed; just need a block provider content-getter to supply to the item tags generator - } - } - public static class TestItemTags extends VanillaItemTagsProvider { public TestItemTags(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { super(output, lookupProvider, MODID, existingFileHelper); @@ -190,7 +176,7 @@ public class ConditionalRecipeTest extends BaseTestMod { @Override protected void addTags(HolderLookup.Provider registries) { // Empty out the Forge eggs tag for purposes of testing the tag-empty recipe condition - this.tag(Tags.Items.EGGS).remove(Items.EGG); + this.tag(Tags.Items.EGGS).remove(ItemIds.EGG); } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java b/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java index e0afa34fe8..68bd6ae49a 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/crafting/CustomIngredientsTest.java @@ -9,8 +9,6 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.jetbrains.annotations.Nullable; - import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup.Provider; import net.minecraft.core.component.DataComponents; @@ -23,6 +21,7 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.nbt.CompoundTag; +import net.minecraft.references.BlockItemIds; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; @@ -38,7 +37,6 @@ import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.crafting.SimpleCraftingContainer; import net.minecraftforge.common.crafting.conditions.IConditionBuilder; import net.minecraftforge.common.crafting.ingredients.IIngredientBuilder; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.util.INBTBuilder; import net.minecraftforge.data.event.GatherDataEvent; @@ -69,9 +67,7 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { var look = event.getLookupProvider(); var exist = event.getExistingFileHelper(); - var blockTags = new BlockTagsGen(out, look, exist); - gen.addProvider(event.includeServer(), blockTags); - gen.addProvider(event.includeServer(), new ItemTagsGen(out, look, blockTags, exist)); + gen.addProvider(event.includeServer(), new ItemTagsGen(out, look, exist)); gen.addProvider(event.includeServer(), new Recipes.Runner(out, event.getLookupProvider())); } @@ -226,25 +222,15 @@ public class CustomIngredientsTest extends BaseTestMod implements INBTBuilder { assertRecipeMatch(helper, RecipeType.CRAFTING, container.apply(stack(Items.DIRT)), "difference_ingredient"); assertRecipeMiss(helper, RecipeType.CRAFTING, container.apply(stack(Items.STONE))); } - - private static class BlockTagsGen extends BlockTagsProvider { - public BlockTagsGen(PackOutput out, CompletableFuture look, @Nullable ExistingFileHelper exist) { - super(out, look, MODID, exist); - } - - @Override - public void addTags(HolderLookup.Provider lookup) { } - } - private static class ItemTagsGen extends VanillaItemTagsProvider { - public ItemTagsGen(PackOutput out, CompletableFuture lookup, BlockTagsProvider blocks, ExistingFileHelper existing) { - super(out, lookup, /*blocks.contentsGetter(),*/ MODID, existing); + public ItemTagsGen(PackOutput out, CompletableFuture lookup, ExistingFileHelper existing) { + super(out, lookup, MODID, existing); } @Override public void addTags(HolderLookup.Provider lookup) { - tag(LEFT).add(Items.DIRT, Items.STONE); - tag(RIGHT).add(Items.STONE, Items.GRAVEL); + tag(LEFT).add(BlockItemIds.DIRT.item(), BlockItemIds.STONE.item()); + tag(RIGHT).add(BlockItemIds.STONE.item(), BlockItemIds.GRAVEL.item()); } } diff --git a/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java b/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java index a7d239b1ce..669a39095b 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/criterion/BreakWithItemCriterion.java @@ -8,11 +8,12 @@ package net.minecraftforge.debug.gameplay.criterion; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import org.jspecify.annotations.NullMarked; -import net.minecraft.advancements.Criterion; -import net.minecraft.advancements.criterion.BlockPredicate; -import net.minecraft.advancements.criterion.ContextAwarePredicate; -import net.minecraft.advancements.criterion.ItemPredicate; -import net.minecraft.advancements.criterion.SimpleCriterionTrigger; + +import net.minecraft.advancements.predicates.BlockPredicate; +import net.minecraft.advancements.predicates.ContextAwarePredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.triggers.Criterion; +import net.minecraft.advancements.triggers.SimpleCriterionTrigger; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; diff --git a/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java b/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java index 3b0e0452c5..e6f38e19cf 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/criterion/CriterionTest.java @@ -9,9 +9,9 @@ import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementType; -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.advancements.criterion.BlockPredicate; -import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.predicates.BlockPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.triggers.CriterionTrigger; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; @@ -19,6 +19,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.tags.VanillaItemTagsProvider; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.network.chat.Component; +import net.minecraft.references.ItemIds; import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; @@ -107,12 +108,12 @@ public final class CriterionTest extends BaseTestMod { @Override protected void addTags(HolderLookup.Provider lookup) { this.tag(tag) - .add(Items.COD) - .add(Items.SALMON) - .add(Items.TROPICAL_FISH) - .add(Items.PUFFERFISH) - .add(Items.COOKED_COD) - .add(Items.COOKED_SALMON) + .add(ItemIds.COD) + .add(ItemIds.SALMON) + .add(ItemIds.TROPICAL_FISH) + .add(ItemIds.PUFFERFISH) + .add(ItemIds.COOKED_COD) + .add(ItemIds.COOKED_SALMON) ; } }); @@ -124,7 +125,7 @@ public final class CriterionTest extends BaseTestMod { event.getGenerator().getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper(), - List.of(((registries, saver, existingFileHelper) -> { + List.of(((registries, saver, _) -> { var blocks = registries.lookup(Registries.BLOCK).get(); var items = registries.lookup(Registries.ITEM).get(); saver.accept(new Advancement.Builder() diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java index fea2567fb5..5c804f61b2 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/PreventItemDamageTest.java @@ -17,7 +17,7 @@ import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -50,7 +50,7 @@ public class PreventItemDamageTest extends BaseTestMod { public PreventItemDamageTest(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> FAKE_SHIELD.get().getDefaultInstance()); + this.testItem(_ -> FAKE_SHIELD.get().getDefaultInstance()); } @GameTest @@ -90,7 +90,7 @@ public class PreventItemDamageTest extends BaseTestMod { int initialDamage = shield.getDamageValue(); // setup enemy - var enemy = helper.spawnWithNoFreeWill(EntityType.HUSK, new BlockPos(2, 0, 2)); + var enemy = helper.spawnWithNoFreeWill(EntityTypes.HUSK, new BlockPos(2, 0, 2)); player.lookAt(EntityAnchorArgument.Anchor.EYES, enemy.position()); // hit the player @@ -117,7 +117,7 @@ public class PreventItemDamageTest extends BaseTestMod { helper.makeFloor(); // setup player - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // setup shield var shield = FAKE_SHIELD.get().getDefaultInstance(); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java index e7b7276abb..e38a9de241 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/ShearsBehaviorTest.java @@ -8,7 +8,7 @@ package net.minecraftforge.debug.gameplay.item; import net.minecraft.core.BlockPos; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.animal.golem.CopperGolem; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; import net.minecraft.world.item.Item; @@ -44,8 +44,8 @@ public class ShearsBehaviorTest extends BaseTestMod { public ShearsBehaviorTest(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> CUSTOM_SHEARS_ITEM.get().getDefaultInstance()); - this.testItem(lookup -> CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance()); + this.testItem(_ -> CUSTOM_SHEARS_ITEM.get().getDefaultInstance()); + this.testItem(_ -> CUSTOM_SHEARS_HARVEST_ITEM.get().getDefaultInstance()); } @GameTest @@ -56,7 +56,7 @@ public class ShearsBehaviorTest extends BaseTestMod { var fencePos = new BlockPos(1, 1, 1); var cowPos = new BlockPos(0, 1, 1); helper.setBlock(fencePos, Blocks.OAK_FENCE); - var cow = helper.spawnWithNoFreeWill(EntityType.COW, cowPos); + var cow = helper.spawnWithNoFreeWill(EntityTypes.COW, cowPos); var knot = LeashFenceKnotEntity.getOrCreateKnot(helper.getLevel(), helper.absolutePos(fencePos)); cow.setLeashedTo(knot, true); helper.assertTrue(cow.isLeashed(), "Cow should start leashed"); @@ -84,7 +84,7 @@ public class ShearsBehaviorTest extends BaseTestMod { var fencePos = new BlockPos(1, 1, 1); var cowPos = new BlockPos(0, 1, 1); helper.setBlock(fencePos, Blocks.OAK_FENCE); - var cow = helper.spawnWithNoFreeWill(EntityType.COW, cowPos); + var cow = helper.spawnWithNoFreeWill(EntityTypes.COW, cowPos); var knot = LeashFenceKnotEntity.getOrCreateKnot(helper.getLevel(), helper.absolutePos(fencePos)); cow.setLeashedTo(knot, true); helper.assertTrue(cow.isLeashed(), "Cow should start leashed"); @@ -109,7 +109,7 @@ public class ShearsBehaviorTest extends BaseTestMod { // setup: copper golem with poppy var golemPos = new BlockPos(1, 1, 1); - var golem = helper.spawnWithNoFreeWill(EntityType.COPPER_GOLEM, golemPos); + var golem = helper.spawnWithNoFreeWill(EntityTypes.COPPER_GOLEM, golemPos); golem.setItemSlot(CopperGolem.EQUIPMENT_SLOT_ANTENNA, new ItemStack(Items.POPPY)); helper.assertTrue(golem.readyForShearing(), "Golem should start shearable (has poppy)"); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java b/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java index cc9f1c2f8d..6a26db4c71 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/item/ShieldDisablingTest.java @@ -13,7 +13,7 @@ import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -39,14 +39,14 @@ public final class ShieldDisablingTest extends BaseTestMod { @GameTest public static void player_shield_disabled_by_axe(GameTestHelper helper) { player_shield_disabled_common(helper, h -> Util.make( - h.spawnWithNoFreeWill(EntityType.HUSK, new BlockPos(2, 0, 2)), + h.spawnWithNoFreeWill(EntityTypes.HUSK, new BlockPos(2, 0, 2)), enemy -> enemy.setItemInHand(InteractionHand.MAIN_HAND, new ItemStack(Items.IRON_AXE)) )); } @GameTest public static void player_shield_disabled_by_warden(GameTestHelper helper) { - player_shield_disabled_common(helper, h -> h.spawnWithNoFreeWill(EntityType.WARDEN, new BlockPos(2, 0, 2))); + player_shield_disabled_common(helper, h -> h.spawnWithNoFreeWill(EntityTypes.WARDEN, new BlockPos(2, 0, 2))); } private static void player_shield_disabled_common(GameTestHelper helper, Function enemyGetter) { diff --git a/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java b/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java index 4252c3c7db..6010a38474 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/level/TrySleepTest.java @@ -11,12 +11,13 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.world.clock.ClockTimeMarker; import net.minecraft.world.clock.ClockTimeMarkers; import net.minecraft.world.clock.WorldClocks; -import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.GameType; import net.minecraft.world.level.block.BedBlock; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.properties.BedPart; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.gametest.GameTest; @@ -34,7 +35,7 @@ public class TrySleepTest extends BaseTestMod { @GameTest public static void sleep_obstructed(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bed = putBed(helper); helper.setAndAssertBlock(bed.above(), Blocks.STONE); @@ -43,22 +44,22 @@ public class TrySleepTest extends BaseTestMod { @GameTest public static void sleep_daytime(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bed = putBed(helper); setTimeAndTest(helper, ClockTimeMarkers.DAY, bed, player, false, "Player was able to sleep during daytime."); } @GameTest public static void sleep_unsafe(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bed = putBed(helper); - helper.spawn(EntityType.ZOMBIE, bed.east()); + helper.spawn(EntityTypes.ZOMBIE, bed.east()); setTimeAndTest(helper, ClockTimeMarkers.NIGHT, bed, player, false, "Player was able to sleep in an unsafe bed."); } @GameTest public static void sleep_normally(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bed = putBed(helper); setTimeAndTest(helper, ClockTimeMarkers.NIGHT, bed, player, true, "Player was not able to sleep. There might be a slime or something causing this to fail."); } @@ -66,8 +67,8 @@ public class TrySleepTest extends BaseTestMod { private static BlockPos putBed(GameTestHelper helper) { var mid = new BlockPos(0,0,0); var south = mid.south(); - helper.setAndAssertBlock(south, Blocks.BLACK_BED.defaultBlockState()); - helper.setAndAssertBlock(mid, Blocks.BLACK_BED.defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD)); + helper.setAndAssertBlock(south, Blocks.BED.black().defaultBlockState()); + helper.setAndAssertBlock(mid, Blocks.BED.black().defaultBlockState().setValue(BedBlock.PART, BedPart.HEAD)); return mid; } @@ -76,7 +77,7 @@ public class TrySleepTest extends BaseTestMod { var overworld = helper.getLevel().registryAccess().getOrThrow(WorldClocks.OVERWORLD); var origTime = manager.getTotalTicks(overworld); - player.setPos(helper.absolutePos(bed).getCenter()); + player.setPos(Vec3.atBottomCenterOf(helper.absolutePos(bed))); manager.moveToTimeMarker(overworld, time); helper.getLevel().tick(() -> true); helper.useBlock(bed, player); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java index 160e3a5529..257ada2f9b 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/ConditionalLootPools.java @@ -60,7 +60,7 @@ public class ConditionalLootPools extends BaseTestMod { helper.setBlock(center, TEST_BLOCK.get()); helper.assertBlock(center, block -> block == TEST_BLOCK.get(), block -> Component.literal("Failed to set block, was " + block.getDescriptionId())); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); player.gameMode.destroyBlock(helper.absolutePos(center)); helper.assertItemEntityPresent(Items.GOLDEN_APPLE, center, 1.0); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java index 3d8449d36d..eedf7503d1 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java @@ -10,10 +10,10 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.advancements.criterion.DataComponentMatchers; -import net.minecraft.advancements.criterion.EnchantmentPredicate; -import net.minecraft.advancements.criterion.ItemPredicate; -import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.advancements.predicates.DataComponentMatchers; +import net.minecraft.advancements.predicates.EnchantmentPredicate; +import net.minecraft.advancements.predicates.ItemPredicate; +import net.minecraft.advancements.predicates.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistrySetBuilder; @@ -138,7 +138,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { // Tests the Enchantment condition, as well as the ability to completely override the returned values. @GameTest public static void smellting(GameTestHelper helper) { - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var center = new BlockPos(1, 1, 1); var enchants = helper.getLevel().holderLookup(Registries.ENCHANTMENT); var smelt = getSmelterAxe(enchants, true); @@ -166,7 +166,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { @GameTest public static void condition_table_name(GameTestHelper helper) { var center = new BlockPos(1, 1, 1); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // Should be doubled helper.setBlock(center, TEST_BLOCK.get()); @@ -185,7 +185,7 @@ public class GlobalLootModifiersTest extends BaseTestMod { @GameTest public static void silk_reentrant(GameTestHelper helper) { var center = new BlockPos(1, 1, 1); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); var bamboo = new ItemStack(Items.BAMBOO); var normal = new ItemStack(Items.IRON_AXE); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java index a9f5438953..feecc983ff 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/LootEventsTest.java @@ -69,7 +69,7 @@ public class LootEventsTest extends BaseTestMod { helper.setBlock(center, TEST_BLOCK.get()); helper.assertBlock(center, block -> block == TEST_BLOCK.get(), block -> Component.literal("Failed to set block, was " + block.getDescriptionId())); - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); player.gameMode.destroyBlock(helper.absolutePos(center)); helper.assertItemEntityPresent(Items.GOLDEN_APPLE, center, 1.0); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java index 8a163dac86..15ccc31886 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/ShearsLootTests.java @@ -44,7 +44,7 @@ public class ShearsLootTests extends BaseTestMod { public ShearsLootTests(FMLJavaModLoadingContext context) { super(context, false, true); - this.testItem(lookup -> MODDED_SHEARS.get().getDefaultInstance()); + this.testItem(_ -> MODDED_SHEARS.get().getDefaultInstance()); } @GameTest @@ -86,7 +86,7 @@ public class ShearsLootTests extends BaseTestMod { }; helper.makeFloor(); // Seagrass makes water - var player = helper.makeMockServerPlayer(GameType.SURVIVAL); // Plants prevent loot for creative players + var player = helper.makeMockServerPlayerFull(GameType.SURVIVAL); // Plants prevent loot for creative players var center = new BlockPos(1, 1, 1); player.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(MODDED_SHEARS.get())); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java b/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java index 04d06b8a82..6fb46d29b9 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/redstone/UpdateOrder.java @@ -44,7 +44,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -58,7 +58,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -72,7 +72,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(4, () -> { var expectedPos = new BlockPos(3, 1, 2); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -86,7 +86,7 @@ public class UpdateOrder extends BaseTestMod { helper.runAfterDelay(PISTON_DELAY, () -> { var expectedPos = new BlockPos(2, 1, 3); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); } @@ -103,8 +103,8 @@ public class UpdateOrder extends BaseTestMod { barrel.setItem(0, new ItemStack(Items.DIRT)); helper.runAfterDelay(10, () -> { // There are a lot of things happening, give it a few ticks - helper.assertBlockNotPresent(Blocks.WHITE_WOOL, unexpectedPos); - helper.assertBlockPresent(Blocks.WHITE_WOOL, expectedPos); + helper.assertBlockNotPresent(Blocks.WOOL.white(), unexpectedPos); + helper.assertBlockPresent(Blocks.WOOL.white(), expectedPos); helper.succeed(); }); }