From ebb316a15c866b5dc109462356fea3bf87ab59e4 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 17 Jul 2023 17:26:28 -0700 Subject: [PATCH] Cleanup usages of static imports and build script so that our build doesn't spam useless error like messages. So that it is easier to see real errors. Add compatibility checking to standard testing tasks. --- build.gradle | 18 ++- .../client/RecipeBookManager.java | 10 +- .../client/loading/ClientModLoader.java | 19 ++- .../client/loading/ForgeLoadingOverlay.java | 20 ++- .../client/loading/NoVizFallback.java | 14 ++- .../client/model/lighting/QuadLighter.java | 16 +-- .../pipeline/QuadBakingVertexConsumer.java | 21 ++-- .../minecraftforge/common/ForgeConfig.java | 10 +- .../common/ForgeConfigSpec.java | 30 ++--- .../net/minecraftforge/common/ForgeI18n.java | 7 +- .../java/net/minecraftforge/common/Tags.java | 3 - .../capabilities/CapabilityManager.java | 7 +- .../capabilities/ForgeCapabilities.java | 10 +- .../common/data/ForgeBlockTagsProvider.java | 3 +- .../common/data/ForgeFluidTagsProvider.java | 5 +- .../RegisterStructureConversionsEvent.java | 11 +- .../entity/player/PlayerInteractEvent.java | 71 ++++++----- .../network/HandshakeHandler.java | 4 +- .../minecraftforge/registries/GameData.java | 114 ++++++------------ .../registries/ObjectHolderRegistry.java | 12 +- .../server/ServerLifecycleHooks.java | 5 +- .../console/ConsoleCommandCompleter.java | 5 +- .../server/loading/ServerModLoader.java | 6 +- .../versions/forge/ForgeVersion.java | 11 +- .../versions/mcp/MCPVersion.java | 9 +- .../debug/DataGeneratorTest.java | 4 +- .../item/LazyCapabilitiesOnItemsTest.java | 6 +- .../minecraftforge/test/LazyOptionalTest.java | 9 +- 28 files changed, 202 insertions(+), 258 deletions(-) diff --git a/build.gradle b/build.gradle index 54f180582c..0ad03c1982 100644 --- a/build.gradle +++ b/build.gradle @@ -209,6 +209,11 @@ subprojects { maven gradleutils.getPublishingForgeMaven() } } + + tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation + options.warnings = false // Shutup deprecated for removal warnings + } } project(':mcp') { @@ -1774,10 +1779,10 @@ project(':forge') { } // Since we need the modules in the bootstrap, we need to make sure they are compiled before we do each run afterEvaluate { prepareRuns.dependsOn(PACKED_DEPS) } - - tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation - } + + // Make sure we run bin compat checking during local testing. + if (!System.env.MAVEN_USER || !System.env.MAVEN_PASSWORD) + publish.dependsOn(':forge:checkJarCompatibility') } //evaluationDependsOnChildren() @@ -1788,6 +1793,11 @@ task setup() { //These must be strings so that we can do lazy resolution. Else dependsOn ':forge:extractMapped' } +task doChecks { + dependsOn ':forge:checkJarCompatibility' + dependsOn ':forge:publish' +} + if (symlinkValid) project.gradle.startParameter.excludedTaskNames.add(':fmlonly:genPatches') project.gradle.startParameter.excludedTaskNames.add(':clean:genPatches') diff --git a/src/main/java/net/minecraftforge/client/RecipeBookManager.java b/src/main/java/net/minecraftforge/client/RecipeBookManager.java index 3de9594a33..3eeb7fefcc 100644 --- a/src/main/java/net/minecraftforge/client/RecipeBookManager.java +++ b/src/main/java/net/minecraftforge/client/RecipeBookManager.java @@ -22,8 +22,6 @@ import java.util.List; import java.util.Map; import java.util.function.Function; -import static net.minecraft.client.RecipeBookCategories.*; - /** * Manager for {@link RecipeBookType recipe book types} and {@link RecipeBookCategories categories}. *

@@ -63,7 +61,13 @@ public final class RecipeBookManager public static void init() { // The ImmutableMap is the patched out value of AGGREGATE_CATEGORIES - var aggregateCategories = new HashMap<>(ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD))); + var aggregateCategories = new HashMap<>(ImmutableMap.of( + RecipeBookCategories.CRAFTING_SEARCH, ImmutableList.of(RecipeBookCategories.CRAFTING_EQUIPMENT, RecipeBookCategories.CRAFTING_BUILDING_BLOCKS, RecipeBookCategories.CRAFTING_MISC, RecipeBookCategories.CRAFTING_REDSTONE), + RecipeBookCategories.FURNACE_SEARCH, ImmutableList.of(RecipeBookCategories.FURNACE_FOOD, RecipeBookCategories.FURNACE_BLOCKS, RecipeBookCategories.FURNACE_MISC), + RecipeBookCategories.BLAST_FURNACE_SEARCH, ImmutableList.of(RecipeBookCategories.BLAST_FURNACE_BLOCKS, RecipeBookCategories.BLAST_FURNACE_MISC), + RecipeBookCategories.SMOKER_SEARCH, ImmutableList.of(RecipeBookCategories.SMOKER_FOOD) + )); + var typeCategories = new HashMap>(); var recipeCategoryLookups = new HashMap, Function, RecipeBookCategories>>(); var event = new RegisterRecipeBookCategoriesEvent(aggregateCategories, typeCategories, recipeCategoryLookups); diff --git a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java index 788f03c580..43a9471f8c 100644 --- a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java @@ -5,11 +5,11 @@ package net.minecraftforge.client.loading; -import static net.minecraftforge.fml.Logging.CORE; -import static net.minecraftforge.fml.Logging.LOADING; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.*; import java.util.function.Consumer; @@ -34,11 +34,8 @@ import net.minecraftforge.resource.PathPackResources; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.SharedConstants; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.ClientPackSource; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; @@ -121,7 +118,7 @@ public class ClientModLoader public static boolean completeModLoading() { - List warnings = ModLoader.get().getWarnings(); + var warnings = ModLoader.get().getWarnings(); boolean showWarnings = true; try { showWarnings = ForgeConfig.CLIENT.showLoadWarnings.get(); @@ -131,8 +128,8 @@ public class ClientModLoader if (!showWarnings) { //User disabled warning screen, as least log them if (!warnings.isEmpty()) { - LOGGER.warn(LOADING, "Mods loaded with {} warning(s)", warnings.size()); - warnings.forEach(warning -> LOGGER.warn(LOADING, warning.formatToString())); + LOGGER.warn(Logging.LOADING, "Mods loaded with {} warning(s)", warnings.size()); + warnings.forEach(warning -> LOGGER.warn(Logging.LOADING, warning.formatToString())); } warnings = Collections.emptyList(); //Clear warnings, as the user does not want to see them } @@ -163,7 +160,7 @@ public class ClientModLoader } private static void clientPackFinder(Map modResourcePacks, Consumer packAcceptor) { - List hiddenPacks = new ArrayList<>(); + var hiddenPacks = new ArrayList(); for (Entry e : modResourcePacks.entrySet()) { IModInfo mod = e.getKey().getModInfos().get(0); @@ -174,7 +171,7 @@ public class ClientModLoader ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey())); continue; } - LOGGER.debug(CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); + LOGGER.debug(Logging.CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); if (mod.getOwningFile().showAsResourcePack()) { packAcceptor.accept(modPack); } else { diff --git a/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java b/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java index affe3ffeb0..cac0704515 100644 --- a/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java +++ b/src/main/java/net/minecraftforge/client/loading/ForgeLoadingOverlay.java @@ -5,6 +5,7 @@ package net.minecraftforge.client.loading; +import com.mojang.blaze3d.platform.GlConst; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; @@ -28,15 +29,12 @@ import net.minecraftforge.fml.earlydisplay.DisplayWindow; import net.minecraftforge.fml.loading.progress.ProgressMeter; import org.jetbrains.annotations.NotNull; import org.joml.Matrix4f; +import org.lwjgl.opengl.GL30C; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Supplier; -import static com.mojang.blaze3d.platform.GlConst.*; -import static org.lwjgl.opengl.GL30C.glViewport; -import static org.lwjgl.opengl.GL30C.glTexParameterIi; - /** * This is an implementation of the LoadingOverlay that calls back into the early window rendering, as part of the * game loading cycle. We completely replace the {@link #render(GuiGraphics, int, int, float)} call from the parent @@ -82,14 +80,14 @@ public class ForgeLoadingOverlay extends LoadingOverlay { displayWindow.render(0xff); } else { GlStateManager._clearColor(colour.redf(), colour.greenf(), colour.bluef(), 1f); - GlStateManager._clear(GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX); + GlStateManager._clear(GlConst.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX); displayWindow.render(0xFF); } RenderSystem.enableBlend(); - RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(GlConst.GL_SRC_ALPHA, GlConst.GL_ONE_MINUS_SRC_ALPHA); var fbWidth = this.minecraft.getWindow().getWidth(); var fbHeight = this.minecraft.getWindow().getHeight(); - glViewport(0, 0, fbWidth, fbHeight); + GL30C.glViewport(0, 0, fbWidth, fbHeight); final var twidth = this.displayWindow.context().width(); final var theight = this.displayWindow.context().height(); var wscale = (float)fbWidth / twidth; @@ -99,7 +97,7 @@ public class ForgeLoadingOverlay extends LoadingOverlay { var wtop = Mth.clamp(fbHeight * 0.5f - scale * theight, 0, fbHeight); var wright = Mth.clamp(fbWidth * 0.5f + scale * twidth, 0, fbWidth); var wbottom = Mth.clamp(fbHeight * 0.5f + scale * theight, 0, fbHeight); - GlStateManager.glActiveTexture(GL_TEXTURE0); + GlStateManager.glActiveTexture(GlConst.GL_TEXTURE0); RenderSystem.disableCull(); BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, fade); @@ -120,7 +118,7 @@ public class ForgeLoadingOverlay extends LoadingOverlay { // This is the actual screen data from the loading screen RenderSystem.enableBlend(); - RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(GlConst.GL_SRC_ALPHA, GlConst.GL_ONE_MINUS_SRC_ALPHA); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderTexture(0, displayWindow.getFramebufferTextureId()); bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); @@ -128,8 +126,8 @@ public class ForgeLoadingOverlay extends LoadingOverlay { bufferbuilder.vertex(wright, wbottom, 0f).uv(1, 0).color(1f, 1f, 1f, fade).endVertex(); bufferbuilder.vertex(wright, wtop, 0f).uv(1, 1).color(1f, 1f, 1f, fade).endVertex(); bufferbuilder.vertex(wleft, wtop, 0f).uv(0, 1).color(1f, 1f, 1f, fade).endVertex(); - glTexParameterIi(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterIi(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_NEAREST); + GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_NEAREST); BufferUploader.drawWithShader(bufferbuilder.end()); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); diff --git a/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java b/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java index 5ded74cf1e..887121e295 100644 --- a/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java +++ b/src/main/java/net/minecraftforge/client/loading/NoVizFallback.java @@ -11,14 +11,18 @@ import net.minecraft.client.gui.screens.LoadingOverlay; import net.minecraft.server.packs.resources.ReloadInstance; import java.util.Optional; -import java.util.function.*; +import java.util.function.Consumer; +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; +import java.util.function.LongSupplier; +import java.util.function.Supplier; -import static org.lwjgl.glfw.GLFW.*; +import org.lwjgl.glfw.GLFW; public final class NoVizFallback { private static long WINDOW; public static LongSupplier windowHandoff(IntSupplier width, IntSupplier height, Supplier title, LongSupplier monitor) { - return () -> WINDOW = glfwCreateWindow(width.getAsInt(), height.getAsInt(), title.get(), monitor.getAsLong(), 0L); + return () -> WINDOW = GLFW.glfwCreateWindow(width.getAsInt(), height.getAsInt(), title.get(), monitor.getAsLong(), 0L); } public static Supplier loadingOverlay(Supplier mc, Supplier ri, Consumer> ex, boolean fadein) { @@ -31,8 +35,8 @@ public final class NoVizFallback { public static String glVersion() { if (WINDOW != 0) { - var maj = glfwGetWindowAttrib(WINDOW, GLFW_CONTEXT_VERSION_MAJOR); - var min = glfwGetWindowAttrib(WINDOW, GLFW_CONTEXT_VERSION_MINOR); + var maj = GLFW.glfwGetWindowAttrib(WINDOW, GLFW.GLFW_CONTEXT_VERSION_MAJOR); + var min = GLFW.glfwGetWindowAttrib(WINDOW, GLFW.GLFW_CONTEXT_VERSION_MINOR); return maj+"."+min; } else { return "3.2"; diff --git a/src/main/java/net/minecraftforge/client/model/lighting/QuadLighter.java b/src/main/java/net/minecraftforge/client/model/lighting/QuadLighter.java index 3f61c52cce..b3f0141643 100644 --- a/src/main/java/net/minecraftforge/client/model/lighting/QuadLighter.java +++ b/src/main/java/net/minecraftforge/client/model/lighting/QuadLighter.java @@ -14,12 +14,12 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.model.IQuadTransformer; + import org.joml.Vector3f; import java.util.Objects; -import static net.minecraftforge.client.model.IQuadTransformer.*; - /** * Base class for all quad lighting providers. *

@@ -84,15 +84,15 @@ public abstract class QuadLighter var vertices = quad.getVertices(); for (int i = 0; i < 4; i++) { - int offset = i * STRIDE; - positions[i][0] = Float.intBitsToFloat(vertices[offset + POSITION]); - positions[i][1] = Float.intBitsToFloat(vertices[offset + POSITION + 1]); - positions[i][2] = Float.intBitsToFloat(vertices[offset + POSITION + 2]); - int packedNormal = vertices[offset + NORMAL]; + int offset = i * IQuadTransformer.STRIDE; + positions[i][0] = Float.intBitsToFloat(vertices[offset + IQuadTransformer.POSITION]); + positions[i][1] = Float.intBitsToFloat(vertices[offset + IQuadTransformer.POSITION + 1]); + positions[i][2] = Float.intBitsToFloat(vertices[offset + IQuadTransformer.POSITION + 2]); + int packedNormal = vertices[offset + IQuadTransformer.NORMAL]; normals[i][0] = (byte) (packedNormal & 0xFF); normals[i][1] = (byte) ((packedNormal >> 8) & 0xFF); normals[i][2] = (byte) ((packedNormal >> 16) & 0xFF); - packedLightmaps[i] = vertices[offset + UV2]; + packedLightmaps[i] = vertices[offset + IQuadTransformer.UV2]; } if (normals[0][0] == 0 && normals[0][1] == 0 && normals[0][2] == 0) { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java index 7d5d433655..ffdd28c47e 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/QuadBakingVertexConsumer.java @@ -13,14 +13,13 @@ import net.minecraft.Util; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; +import net.minecraftforge.client.model.IQuadTransformer; import net.minecraftforge.client.textures.UnitTextureAtlasSprite; import java.util.IdentityHashMap; import java.util.Map; import java.util.function.Consumer; -import static net.minecraftforge.client.model.IQuadTransformer.*; - /** * Vertex consumer that outputs {@linkplain BakedQuad baked quads}. *

@@ -34,7 +33,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer for (var element : DefaultVertexFormat.BLOCK.getElements()) map.put(element, DefaultVertexFormat.BLOCK.getOffset(i++) / 4); // Int offset }); - private static final int QUAD_DATA_SIZE = STRIDE * 4; + private static final int QUAD_DATA_SIZE = IQuadTransformer.STRIDE * 4; private final Consumer quadConsumer; @@ -55,7 +54,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer vertex(double x, double y, double z) { - int offset = vertexIndex * STRIDE + POSITION; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.POSITION; quadData[offset] = Float.floatToRawIntBits((float) x); quadData[offset + 1] = Float.floatToRawIntBits((float) y); quadData[offset + 2] = Float.floatToRawIntBits((float) z); @@ -65,7 +64,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer normal(float x, float y, float z) { - int offset = vertexIndex * STRIDE + NORMAL; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.NORMAL; quadData[offset] = ((int) (x * 127.0f) & 0xFF) | (((int) (y * 127.0f) & 0xFF) << 8) | (((int) (z * 127.0f) & 0xFF) << 16); @@ -75,7 +74,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer color(int r, int g, int b, int a) { - int offset = vertexIndex * STRIDE + COLOR; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.COLOR; quadData[offset] = ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((g & 0xFF) << 8) | @@ -86,7 +85,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer uv(float u, float v) { - int offset = vertexIndex * STRIDE + UV0; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.UV0; quadData[offset] = Float.floatToRawIntBits(u); quadData[offset + 1] = Float.floatToRawIntBits(v); return this; @@ -95,9 +94,9 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer overlayCoords(int u, int v) { - if (UV1 >= 0) // Vanilla doesn't support this, but it may be added by a 3rd party + if (IQuadTransformer.UV1 >= 0) // Vanilla doesn't support this, but it may be added by a 3rd party { - int offset = vertexIndex * STRIDE + UV1; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.UV1; quadData[offset] = (u & 0xFFFF) | ((v & 0xFFFF) << 16); } return this; @@ -106,7 +105,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer @Override public VertexConsumer uv2(int u, int v) { - int offset = vertexIndex * STRIDE + UV2; + int offset = vertexIndex * IQuadTransformer.STRIDE + IQuadTransformer.UV2; quadData[offset] = (u & 0xFFFF) | ((v & 0xFFFF) << 16); return this; } @@ -117,7 +116,7 @@ public class QuadBakingVertexConsumer implements VertexConsumer Integer baseOffset = ELEMENT_OFFSETS.get(element); if (baseOffset != null) { - int offset = vertexIndex * STRIDE + baseOffset; + int offset = vertexIndex * IQuadTransformer.STRIDE + baseOffset; System.arraycopy(rawData, 0, quadData, offset, rawData.length); } return this; diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index c2435e6381..c76c7019e2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -5,9 +5,8 @@ package net.minecraftforge.common; -import static net.minecraftforge.fml.Logging.FORGEMOD; - import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.event.config.ModConfigEvent; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; @@ -16,7 +15,6 @@ import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; - public class ForgeConfig { public static class Server { public final BooleanValue removeErroringBlockEntities; @@ -135,7 +133,7 @@ public class ForgeConfig { .define("useCombinedDepthStencilAttachment", false); compressLanIPv6Addresses = builder - .comment("[DEPRECATED] [NOW IN COMMON CONFIG] When enabled, Forge will convert discovered 'Open to LAN' IPv6 addresses to their more compact, compressed representation") + .comment("[DEPRECATED] Does nothing anymore, IPv6 addresses will be compressed always") .translation("forge.configgui.compressLanIPv6Addresses") .define("compressLanIPv6Addresses", true); @@ -171,12 +169,12 @@ public class ForgeConfig { @SubscribeEvent public static void onLoad(final ModConfigEvent.Loading configEvent) { - LogManager.getLogger().debug(FORGEMOD, "Loaded forge config file {}", configEvent.getConfig().getFileName()); + LogManager.getLogger().debug(Logging.FORGEMOD, "Loaded forge config file {}", configEvent.getConfig().getFileName()); } @SubscribeEvent public static void onFileChange(final ModConfigEvent.Reloading configEvent) { - LogManager.getLogger().debug(FORGEMOD, "Forge config just got changed on the file system!"); + LogManager.getLogger().debug(Logging.FORGEMOD, "Forge config just got changed on the file system!"); } //General diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index 6484558248..c86050d71f 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -5,11 +5,6 @@ package net.minecraftforge.common; -import static com.electronwill.nightconfig.core.ConfigSpec.CorrectionAction.ADD; -import static com.electronwill.nightconfig.core.ConfigSpec.CorrectionAction.REMOVE; -import static com.electronwill.nightconfig.core.ConfigSpec.CorrectionAction.REPLACE; -import static net.minecraftforge.fml.Logging.CORE; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -26,6 +21,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.config.IConfigSpec; import net.minecraftforge.fml.loading.FMLEnvironment; import org.apache.commons.lang3.tuple.Pair; @@ -82,12 +78,12 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper - LOGGER.warn(CORE, "Incorrect key {} was corrected from {} to its default, {}. {}", DOT_JOINER.join( path ), incorrectValue, correctedValue, incorrectValue == correctedValue ? "This seems to be an error." : ""), + 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) -> - LOGGER.debug(CORE, "The comment on key {} does not match the spec. This may create a backup.", DOT_JOINER.join( 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) config).save(); @@ -178,7 +174,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper)value).isEmpty()) { - LOGGER.debug(CORE, "List on key {} is deemed to need correction. It is null, not a list, or an empty list. Modders, consider defineListAllowEmpty?", path.get(path.size() - 1)); + LOGGER.debug(Logging.CORE, "List on key {} is deemed to need correction. It is null, not a list, or an empty list. Modders, consider defineListAllowEmpty?", path.get(path.size() - 1)); return getDefault(); } List list = Lists.newArrayList((List) value); list.removeIf(elementValidator.negate()); if (list.isEmpty()) { - LOGGER.debug(CORE, "List on key {} is deemed to need correction. It failed validation.", path.get(path.size() - 1)); + LOGGER.debug(Logging.CORE, "List on key {} is deemed to need correction. It failed validation.", path.get(path.size() - 1)); return getDefault(); } return list; @@ -395,13 +391,13 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper list = Lists.newArrayList((List) value); list.removeIf(elementValidator.negate()); if (list.isEmpty()) { - LOGGER.debug(CORE, "List on key {} is deemed to need correction. It failed validation.", path.get(path.size() - 1)); + LOGGER.debug(Logging.CORE, "List on key {} is deemed to need correction. It failed validation.", path.get(path.size() - 1)); return getDefault(); } return list; @@ -654,7 +650,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper= 0 && c.compareTo(max) <= 0; if(!result) { - LOGGER.debug(CORE, "Range value {} is not within its bounds {}-{}", c, min, max); + LOGGER.debug(Logging.CORE, "Range value {} is not within its bounds {}-{}", c, min, max); } return result; } diff --git a/src/main/java/net/minecraftforge/common/ForgeI18n.java b/src/main/java/net/minecraftforge/common/ForgeI18n.java index 1501ef29d9..4d043727b0 100644 --- a/src/main/java/net/minecraftforge/common/ForgeI18n.java +++ b/src/main/java/net/minecraftforge/common/ForgeI18n.java @@ -7,6 +7,7 @@ package net.minecraftforge.common; import com.google.common.base.CharMatcher; import net.minecraftforge.common.util.MavenVersionStringHelper; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.loading.StringUtils; import net.minecraftforge.forgespi.language.IModInfo; import org.apache.commons.lang3.text.ExtendedMessageFormat; @@ -23,8 +24,6 @@ import java.util.Objects; import java.util.function.BiConsumer; import java.util.regex.Pattern; -import static net.minecraftforge.fml.Logging.CORE; - //TODO, this should be re-evaluated now that ITextComponents are passed everywhere instaed of strings. public class ForgeI18n { private static final Logger LOGGER = LogManager.getLogger(); @@ -81,7 +80,7 @@ public class ForgeI18n { } public static void loadLanguageData(final Map properties) { - LOGGER.debug(CORE,"Loading I18N data entries: {}", properties.size()); + LOGGER.debug(Logging.CORE,"Loading I18N data entries: {}", properties.size()); i18n = properties; } @@ -90,7 +89,7 @@ public class ForgeI18n { try { return parseFormat(pattern, args); } catch (IllegalArgumentException e) { - LOGGER.error(CORE,"Illegal format found `{}`", pattern); + LOGGER.error(Logging.CORE,"Illegal format found `{}`", pattern); return pattern; } } diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index cfec0f2137..aedba1f96d 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -5,10 +5,8 @@ package net.minecraftforge.common; -import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BiomeTags; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; @@ -19,7 +17,6 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; -import net.minecraftforge.registries.ForgeRegistries; public class Tags { diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java index a2469ebd5a..2bd10c6d8b 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java @@ -5,6 +5,7 @@ package net.minecraftforge.common.capabilities; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; @@ -15,8 +16,6 @@ import java.util.Comparator; import java.util.IdentityHashMap; import java.util.List; -import static net.minecraftforge.fml.Logging.CAPABILITIES; - public enum CapabilityManager { INSTANCE; @@ -46,7 +45,7 @@ public enum CapabilityManager { if (cap.isRegistered()) { - LOGGER.error(CAPABILITIES, "Cannot register capability implementation multiple times : {}", realName); + LOGGER.error(Logging.CAPABILITIES, "Cannot register capability implementation multiple times : {}", realName); throw new IllegalArgumentException("Cannot register a capability implementation multiple times : "+ realName); } else @@ -74,7 +73,7 @@ public enum CapabilityManager for (var auto : autos) { - LOGGER.debug(CAPABILITIES, "Attempting to automatically register: " + auto); + LOGGER.debug(Logging.CAPABILITIES, "Attempting to automatically register: " + auto); get(auto.getInternalName(), true); } diff --git a/src/main/java/net/minecraftforge/common/capabilities/ForgeCapabilities.java b/src/main/java/net/minecraftforge/common/capabilities/ForgeCapabilities.java index dd381708e4..490d41527e 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/ForgeCapabilities.java +++ b/src/main/java/net/minecraftforge/common/capabilities/ForgeCapabilities.java @@ -10,8 +10,6 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.items.IItemHandler; -import static net.minecraftforge.common.capabilities.CapabilityManager.get; - /* * References to Forge's built in capabilities. * Modders are recommended to use their own CapabilityTokens for 3rd party caps to maintain soft dependencies. @@ -19,8 +17,8 @@ import static net.minecraftforge.common.capabilities.CapabilityManager.get; */ public class ForgeCapabilities { - public static final Capability ENERGY = get(new CapabilityToken<>(){}); - public static final Capability FLUID_HANDLER = get(new CapabilityToken<>(){}); - public static final Capability FLUID_HANDLER_ITEM = get(new CapabilityToken<>(){}); - public static final Capability ITEM_HANDLER = get(new CapabilityToken<>(){}); + public static final Capability ENERGY = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability FLUID_HANDLER = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability FLUID_HANDLER_ITEM = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability ITEM_HANDLER = CapabilityManager.get(new CapabilityToken<>(){}); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 08f3447119..6ce75c6a8d 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -6,9 +6,7 @@ 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.IntrinsicHolderTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; @@ -23,6 +21,7 @@ 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.minecraftforge.common.Tags.Blocks.*; public final class ForgeBlockTagsProvider extends BlockTagsProvider diff --git a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java index 152ac09b6e..00cac5b083 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeFluidTagsProvider.java @@ -9,11 +9,10 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.FluidTagsProvider; import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.common.Tags.Fluids; import java.util.concurrent.CompletableFuture; -import static net.minecraftforge.common.Tags.Fluids.MILK; - public final class ForgeFluidTagsProvider extends FluidTagsProvider { public ForgeFluidTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) @@ -24,7 +23,7 @@ public final class ForgeFluidTagsProvider extends FluidTagsProvider @Override public void addTags(HolderLookup.Provider lookupProvider) { - tag(MILK).addOptional(ForgeMod.MILK.getId()).addOptional(ForgeMod.FLOWING_MILK.getId()); + tag(Fluids.MILK).addOptional(ForgeMod.MILK.getId()).addOptional(ForgeMod.FLOWING_MILK.getId()); } @Override diff --git a/src/main/java/net/minecraftforge/event/RegisterStructureConversionsEvent.java b/src/main/java/net/minecraftforge/event/RegisterStructureConversionsEvent.java index 2844136219..1be8b28e78 100644 --- a/src/main/java/net/minecraftforge/event/RegisterStructureConversionsEvent.java +++ b/src/main/java/net/minecraftforge/event/RegisterStructureConversionsEvent.java @@ -14,8 +14,7 @@ import net.minecraftforge.eventbus.api.Event; import java.util.Locale; import java.util.Map; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.base.Preconditions; /** * Fired for registering structure conversions for pre-1.18.2 worlds. This is used by {@link StructuresBecomeConfiguredFix} @@ -92,11 +91,11 @@ public class RegisterStructureConversionsEvent extends Event */ public void register(String oldStructureID, StructuresBecomeConfiguredFix.Conversion conversion) { - checkNotNull(oldStructureID, "Original structure ID must not be null"); - checkArgument(oldStructureID.toLowerCase(Locale.ROOT).equals(oldStructureID), + Preconditions.checkNotNull(oldStructureID, "Original structure ID must not be null"); + Preconditions.checkArgument(oldStructureID.toLowerCase(Locale.ROOT).equals(oldStructureID), "Original structure ID should be in all lowercase"); - checkNotNull(conversion, "Structure conversion must not be null"); - checkNotNull(conversion.fallback(), "Fallback structure ID in structure conversion must not be null"); + Preconditions.checkNotNull(conversion, "Structure conversion must not be null"); + Preconditions.checkNotNull(conversion.fallback(), "Fallback structure ID in structure conversion must not be null"); if (map.putIfAbsent(oldStructureID.toLowerCase(Locale.ROOT), conversion) != null) { throw new IllegalArgumentException("Conversion has already been registered for structure " + oldStructureID); 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 e828b7359d..812817c879 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -26,9 +26,6 @@ import net.minecraft.world.level.Level; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; -import static net.minecraftforge.eventbus.api.Event.Result.DEFAULT; -import static net.minecraftforge.eventbus.api.Event.Result.DENY; - import net.minecraftforge.fml.LogicalSide; import org.jetbrains.annotations.ApiStatus; @@ -141,8 +138,8 @@ public class PlayerInteractEvent extends PlayerEvent @Cancelable public static class RightClickBlock extends PlayerInteractEvent { - private Result useBlock = DEFAULT; - private Result useItem = DEFAULT; + private Result useBlock = Result.DEFAULT; + private Result useItem = Result.DEFAULT; private BlockHitResult hitVec; public RightClickBlock(Player player, InteractionHand hand, BlockPos pos, BlockHitResult hitVec) { @@ -201,8 +198,8 @@ public class PlayerInteractEvent extends PlayerEvent super.setCanceled(canceled); if (canceled) { - useBlock = DENY; - useItem = DENY; + useBlock = Result.DENY; + useItem = Result.DENY; } } } @@ -254,8 +251,8 @@ public class PlayerInteractEvent extends PlayerEvent @Cancelable public static class LeftClickBlock extends PlayerInteractEvent { - private Result useBlock = DEFAULT; - private Result useItem = DEFAULT; + private Result useBlock = Result.DEFAULT; + private Result useItem = Result.DEFAULT; private final Action action; @Deprecated(since = "1.20.1", forRemoval = true) @@ -292,7 +289,7 @@ public class PlayerInteractEvent extends PlayerEvent */ @NotNull public Action getAction() { - return this.action; + return this.action; } public void setUseBlock(Result triggerBlock) @@ -311,38 +308,38 @@ public class PlayerInteractEvent extends PlayerEvent super.setCanceled(canceled); if (canceled) { - useBlock = DENY; - useItem = DENY; + useBlock = Result.DENY; + useItem = Result.DENY; } } public static enum Action { - /** - * When the player first left clicks a block - */ - START, - /** - * When the player stops left clicking a block by completely breaking it - */ - STOP, - /** - * When the player stops left clicking a block by releasing the button, or no longer targeting the same block before it breaks. - */ - ABORT, - /** - * When the player is actively mining a block on the client side - * Warning: The event is fired every tick on the client - */ - CLIENT_HOLD; + /** + * When the player first left clicks a block + */ + START, + /** + * When the player stops left clicking a block by completely breaking it + */ + STOP, + /** + * When the player stops left clicking a block by releasing the button, or no longer targeting the same block before it breaks. + */ + ABORT, + /** + * When the player is actively mining a block on the client side + * Warning: The event is fired every tick on the client + */ + CLIENT_HOLD; - public static Action convert(ServerboundPlayerActionPacket.Action action) { - return switch (action) { - default -> START; - case START_DESTROY_BLOCK -> START; - case STOP_DESTROY_BLOCK -> STOP; - case ABORT_DESTROY_BLOCK -> ABORT; - }; - } + public static Action convert(ServerboundPlayerActionPacket.Action action) { + return switch (action) { + default -> START; + case START_DESTROY_BLOCK -> START; + case STOP_DESTROY_BLOCK -> STOP; + case ABORT_DESTROY_BLOCK -> ABORT; + }; + } } } diff --git a/src/main/java/net/minecraftforge/network/HandshakeHandler.java b/src/main/java/net/minecraftforge/network/HandshakeHandler.java index 9f5415ebf8..b1365dc069 100644 --- a/src/main/java/net/minecraftforge/network/HandshakeHandler.java +++ b/src/main/java/net/minecraftforge/network/HandshakeHandler.java @@ -46,8 +46,6 @@ import java.util.function.IntSupplier; import java.util.function.Supplier; import java.util.stream.Collectors; -import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES; - /** * Instance responsible for handling the overall FML impl handshake. * @@ -218,7 +216,7 @@ public class HandshakeHandler this.registriesToReceive = new HashSet<>(serverModList.getRegistries()); this.registrySnapshots = Maps.newHashMap(); - LOGGER.debug(REGISTRIES, "Expecting {} registries: {}", ()->this.registriesToReceive.size(), ()->this.registriesToReceive); + LOGGER.debug(ForgeRegistry.REGISTRIES, "Expecting {} registries: {}", ()->this.registriesToReceive.size(), ()->this.registriesToReceive); } void handleModData(HandshakeMessages.S2CModData serverModData, Supplier c) diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index 263dbed618..2f806d19fa 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -11,7 +11,6 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.mojang.serialization.Codec; import com.mojang.serialization.Lifecycle; -import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.HashMap; @@ -23,7 +22,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.function.BiConsumer; -import java.util.function.Predicate; import java.util.stream.Collectors; import net.minecraft.core.IdMapper; import net.minecraft.core.MappedRegistry; @@ -58,48 +56,15 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.StartupMessageManager; import net.minecraftforge.fml.util.EnhancedRuntimeException; import net.minecraftforge.fml.util.thread.EffectiveSide; +import net.minecraftforge.registries.ForgeRegistries.Keys; import net.minecraftforge.registries.holdersets.HolderSetType; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ACTIVITIES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ATTRIBUTES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.BIOMES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.BLOCKS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.BLOCK_ENTITY_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.BLOCK_STATE_PROVIDER_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.CHUNK_STATUS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ENCHANTMENTS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ENTITY_DATA_SERIALIZERS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ENTITY_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.FEATURES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.FLUIDS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.FLUID_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.FOLIAGE_PLACER_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.ITEMS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.MEMORY_MODULE_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.MENU_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.MOB_EFFECTS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.PAINTING_VARIANTS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.PARTICLE_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.POI_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.POTIONS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.RECIPE_SERIALIZERS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.RECIPE_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.SCHEDULES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.SENSOR_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.SOUND_EVENTS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.STAT_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.TREE_DECORATOR_TYPES; -import static net.minecraftforge.registries.ForgeRegistries.Keys.VILLAGER_PROFESSIONS; -import static net.minecraftforge.registries.ForgeRegistries.Keys.WORLD_CARVERS; -import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES; - /** * INTERNAL ONLY * MODDERS SHOULD HAVE NO REASON TO USE THIS CLASS @@ -108,6 +73,7 @@ import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES; public class GameData { private static final Logger LOGGER = LogManager.getLogger(); + private static Marker REGISTRIES = ForgeRegistry.REGISTRIES; private static final int MAX_VARINT = Integer.MAX_VALUE - 1; //We were told it is their intention to have everything in a reg be unlimited, so assume that until we find cases where it isnt. private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); @@ -134,52 +100,52 @@ public class GameData hasInit = true; // Game objects - makeRegistry(BLOCKS, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").intrusiveHolderCallback(Block::builtInRegistryHolder).create(); - makeRegistry(FLUIDS, "empty").intrusiveHolderCallback(Fluid::builtInRegistryHolder).create(); - makeRegistry(ITEMS, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").intrusiveHolderCallback(Item::builtInRegistryHolder).create(); - makeRegistry(MOB_EFFECTS).legacyName("potions").create(); - makeRegistry(SOUND_EVENTS).legacyName("soundevents").create(); - makeRegistry(POTIONS, "empty").legacyName("potiontypes").create(); - makeRegistry(ENCHANTMENTS).legacyName("enchantments").create(); - makeRegistry(ENTITY_TYPES, "pig").legacyName("entities").intrusiveHolderCallback(EntityType::builtInRegistryHolder).create(); - makeRegistry(BLOCK_ENTITY_TYPES).disableSaving().legacyName("blockentities").create(); - makeRegistry(PARTICLE_TYPES).disableSaving().create(); - makeRegistry(MENU_TYPES).disableSaving().create(); - makeRegistry(PAINTING_VARIANTS, "kebab").create(); - makeRegistry(RECIPE_TYPES).disableSaving().disableSync().create(); - makeRegistry(RECIPE_SERIALIZERS).disableSaving().create(); - makeRegistry(ATTRIBUTES).onValidate(AttributeCallbacks.INSTANCE).disableSaving().disableSync().create(); - makeRegistry(STAT_TYPES).create(); - makeRegistry(COMMAND_ARGUMENT_TYPES).disableSaving().create(); + makeRegistry(Keys.BLOCKS, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").intrusiveHolderCallback(Block::builtInRegistryHolder).create(); + makeRegistry(Keys.FLUIDS, "empty").intrusiveHolderCallback(Fluid::builtInRegistryHolder).create(); + makeRegistry(Keys.ITEMS, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").intrusiveHolderCallback(Item::builtInRegistryHolder).create(); + makeRegistry(Keys.MOB_EFFECTS).legacyName("potions").create(); + makeRegistry(Keys.SOUND_EVENTS).legacyName("soundevents").create(); + makeRegistry(Keys.POTIONS, "empty").legacyName("potiontypes").create(); + makeRegistry(Keys.ENCHANTMENTS).legacyName("enchantments").create(); + makeRegistry(Keys.ENTITY_TYPES, "pig").legacyName("entities").intrusiveHolderCallback(EntityType::builtInRegistryHolder).create(); + makeRegistry(Keys.BLOCK_ENTITY_TYPES).disableSaving().legacyName("blockentities").create(); + makeRegistry(Keys.PARTICLE_TYPES).disableSaving().create(); + makeRegistry(Keys.MENU_TYPES).disableSaving().create(); + makeRegistry(Keys.PAINTING_VARIANTS, "kebab").create(); + makeRegistry(Keys.RECIPE_TYPES).disableSaving().disableSync().create(); + makeRegistry(Keys.RECIPE_SERIALIZERS).disableSaving().create(); + makeRegistry(Keys.ATTRIBUTES).onValidate(AttributeCallbacks.INSTANCE).disableSaving().disableSync().create(); + makeRegistry(Keys.STAT_TYPES).create(); + makeRegistry(Keys.COMMAND_ARGUMENT_TYPES).disableSaving().create(); // Villagers - makeRegistry(VILLAGER_PROFESSIONS, "none").create(); - makeRegistry(POI_TYPES).addCallback(PointOfInterestTypeCallbacks.INSTANCE).disableSync().create(); - makeRegistry(MEMORY_MODULE_TYPES, "dummy").disableSync().create(); - makeRegistry(SENSOR_TYPES, "dummy").disableSaving().disableSync().create(); - makeRegistry(SCHEDULES).disableSaving().disableSync().create(); - makeRegistry(ACTIVITIES).disableSaving().disableSync().create(); + makeRegistry(Keys.VILLAGER_PROFESSIONS, "none").create(); + makeRegistry(Keys.POI_TYPES).addCallback(PointOfInterestTypeCallbacks.INSTANCE).disableSync().create(); + makeRegistry(Keys.MEMORY_MODULE_TYPES, "dummy").disableSync().create(); + makeRegistry(Keys.SENSOR_TYPES, "dummy").disableSaving().disableSync().create(); + makeRegistry(Keys.SCHEDULES).disableSaving().disableSync().create(); + makeRegistry(Keys.ACTIVITIES).disableSaving().disableSync().create(); // Worldgen - makeRegistry(WORLD_CARVERS).disableSaving().disableSync().create(); - makeRegistry(FEATURES).disableSaving().disableSync().create(); - makeRegistry(CHUNK_STATUS, "empty").disableSaving().disableSync().create(); - makeRegistry(BLOCK_STATE_PROVIDER_TYPES).disableSaving().disableSync().create(); - makeRegistry(FOLIAGE_PLACER_TYPES).disableSaving().disableSync().create(); - makeRegistry(TREE_DECORATOR_TYPES).disableSaving().disableSync().create(); + makeRegistry(Keys.WORLD_CARVERS).disableSaving().disableSync().create(); + makeRegistry(Keys.FEATURES).disableSaving().disableSync().create(); + makeRegistry(Keys.CHUNK_STATUS, "empty").disableSaving().disableSync().create(); + makeRegistry(Keys.BLOCK_STATE_PROVIDER_TYPES).disableSaving().disableSync().create(); + makeRegistry(Keys.FOLIAGE_PLACER_TYPES).disableSaving().disableSync().create(); + makeRegistry(Keys.TREE_DECORATOR_TYPES).disableSaving().disableSync().create(); // Dynamic Worldgen - makeRegistry(BIOMES).disableSync().create(); + makeRegistry(Keys.BIOMES).disableSync().create(); } static RegistryBuilder> getDataSerializersRegistryBuilder() { - return makeRegistry(ENTITY_DATA_SERIALIZERS, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides(); + return makeRegistry(Keys.ENTITY_DATA_SERIALIZERS, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides(); } static RegistryBuilder> getGLMSerializersRegistryBuilder() { - return makeRegistry(GLOBAL_LOOT_MODIFIER_SERIALIZERS).disableSaving().disableSync(); + return makeRegistry(Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS).disableSaving().disableSync(); } static RegistryBuilder> getBiomeModifierSerializersRegistryBuilder() @@ -194,7 +160,7 @@ public class GameData static RegistryBuilder getFluidTypeRegistryBuilder() { - return makeRegistry(FLUID_TYPES).disableSaving(); + return makeRegistry(Keys.FLUID_TYPES).disableSaving(); } static RegistryBuilder getHolderSetTypeRegistryBuilder() @@ -246,19 +212,19 @@ public class GameData @SuppressWarnings("unchecked") public static Map getBlockItemMap() { - return RegistryManager.ACTIVE.getRegistry(ITEMS).getSlaveMap(BLOCK_TO_ITEM, Map.class); + return RegistryManager.ACTIVE.getRegistry(Keys.ITEMS).getSlaveMap(BLOCK_TO_ITEM, Map.class); } @SuppressWarnings("unchecked") public static IdMapper getBlockStateIDMap() { - return RegistryManager.ACTIVE.getRegistry(BLOCKS).getSlaveMap(BLOCKSTATE_TO_ID, IdMapper.class); + return RegistryManager.ACTIVE.getRegistry(Keys.BLOCKS).getSlaveMap(BLOCKSTATE_TO_ID, IdMapper.class); } @SuppressWarnings("unchecked") public static Map getBlockStatePointOfInterestTypeMap() { - return RegistryManager.ACTIVE.getRegistry(POI_TYPES).getSlaveMap(BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE, Map.class); + return RegistryManager.ACTIVE.getRegistry(Keys.POI_TYPES).getSlaveMap(BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE, Map.class); } @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -532,7 +498,7 @@ public class GameData public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) { // We share the blockItem map between items and blocks registries - Map map = stage.getRegistry(BLOCKS).getSlaveMap(BLOCK_TO_ITEM, Map.class); + Map map = stage.getRegistry(Keys.BLOCKS).getSlaveMap(BLOCK_TO_ITEM, Map.class); owner.setSlaveMap(BLOCK_TO_ITEM, map); } } diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java index 93fe517aa8..166dc04e30 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java @@ -29,8 +29,6 @@ import org.jetbrains.annotations.Nullable; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; -import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES; - /** * Internal registry for tracking {@link ObjectHolder} references */ @@ -84,7 +82,7 @@ public class ObjectHolderRegistry public static void findObjectHolders() { - LOGGER.debug(REGISTRIES,"Processing ObjectHolder annotations"); + LOGGER.debug(ForgeRegistry.REGISTRIES,"Processing ObjectHolder annotations"); final List annotations = ModList.get().getAllScanData().stream() .map(ModFileScanData::getAnnotations) .flatMap(Collection::stream) @@ -123,7 +121,7 @@ public class ObjectHolderRegistry data.memberName(), null, (String)data.annotationData().get("registryName"), (String)data.annotationData().get("value"), false, false)); - LOGGER.debug(REGISTRIES,"Found {} ObjectHolder annotations", objectHolders.size()); + LOGGER.debug(ForgeRegistry.REGISTRIES,"Found {} ObjectHolder annotations", objectHolders.size()); } private static void scanTarget(Map classModIds, Map> classCache, Type type, @@ -159,7 +157,7 @@ public class ObjectHolderRegistry String prefix = classModIds.get(type); if (prefix == null) { - LOGGER.warn(REGISTRIES,"Found an unqualified ObjectHolder annotation ({}) without a modid context at {}.{}, ignoring", value, type, annotationTarget); + LOGGER.warn(ForgeRegistry.REGISTRIES,"Found an unqualified ObjectHolder annotation ({}) without a modid context at {}.{}, ignoring", value, type, annotationTarget); throw new IllegalStateException("Unqualified reference to ObjectHolder"); } value = prefix + ':' + value; @@ -210,9 +208,9 @@ public class ObjectHolderRegistry { try { - LOGGER.debug(REGISTRIES, "Applying holder lookups"); + LOGGER.debug(ForgeRegistry.REGISTRIES, "Applying holder lookups"); applyObjectHolders(key -> true); - LOGGER.debug(REGISTRIES, "Holder lookups applied"); + 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/server/ServerLifecycleHooks.java b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java index 304077f297..aa56259254 100644 --- a/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java +++ b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java @@ -5,8 +5,6 @@ package net.minecraftforge.server; -import static net.minecraftforge.fml.Logging.CORE; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -30,6 +28,7 @@ import net.minecraft.server.packs.repository.RepositorySource; import net.minecraft.world.level.storage.LevelResource; import net.minecraftforge.common.world.StructureModifier; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.Logging; import net.minecraftforge.common.util.LogicalSidedProvider; import net.minecraftforge.common.world.BiomeModifier; import net.minecraftforge.fml.ModLoader; @@ -215,7 +214,7 @@ public class ServerLifecycleHooks ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey())); continue; } - LOGGER.debug(CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); + LOGGER.debug(Logging.CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath()); packAcceptor.accept(modPack); } } diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java index 4f55eebccc..170a8bd66e 100644 --- a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -5,6 +5,7 @@ package net.minecraftforge.server.console; +import com.google.common.base.Preconditions; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestion; @@ -21,8 +22,6 @@ import org.jline.reader.ParsedLine; import java.util.List; import java.util.concurrent.ExecutionException; -import static com.google.common.base.Preconditions.checkNotNull; - final class ConsoleCommandCompleter implements Completer { private static final Logger logger = LogManager.getLogger(); @@ -30,7 +29,7 @@ final class ConsoleCommandCompleter implements Completer public ConsoleCommandCompleter(DedicatedServer server) { - this.server = checkNotNull(server, "server"); + this.server = Preconditions.checkNotNull(server, "server"); } @Override diff --git a/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java b/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java index fba66a4646..e3248d7fee 100644 --- a/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java +++ b/src/main/java/net/minecraftforge/server/loading/ServerModLoader.java @@ -16,8 +16,6 @@ import org.apache.logging.log4j.Logger; import java.io.File; import java.util.List; -import static net.minecraftforge.fml.Logging.LOADING; - public class ServerModLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -41,8 +39,8 @@ public class ServerModLoader } List warnings = ModLoader.get().getWarnings(); if (!warnings.isEmpty()) { - LOGGER.warn(LOADING, "Mods loaded with {} warnings", warnings.size()); - warnings.forEach(warning -> LOGGER.warn(LOADING, warning.formatToString())); + LOGGER.warn(Logging.LOADING, "Mods loaded with {} warnings", warnings.size()); + warnings.forEach(warning -> LOGGER.warn(Logging.LOADING, warning.formatToString())); } MinecraftForge.EVENT_BUS.start(); } diff --git a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java index 330eacc6d0..0729bfae68 100644 --- a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java @@ -5,6 +5,7 @@ package net.minecraftforge.versions.forge; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.loading.FMLLoader; @@ -13,8 +14,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; -import static net.minecraftforge.fml.Logging.CORE; - public class ForgeVersion { private static final Logger LOGGER = LogManager.getLogger(); @@ -26,7 +25,7 @@ public class ForgeVersion private static final String forgeGroup; static { - LOGGER.debug(CORE, "Forge Version package {} from {}", ForgeVersion.class.getPackage(), ForgeVersion.class.getClassLoader()); + LOGGER.debug(Logging.CORE, "Forge Version package {} from {}", ForgeVersion.class.getPackage(), ForgeVersion.class.getClassLoader()); String vers = JarVersionLookupHandler.getImplementationVersion(ForgeVersion.class).orElse(FMLLoader.versionInfo().forgeVersion()); if (vers == null) throw new RuntimeException("Missing forge version, cannot continue"); String spec = JarVersionLookupHandler.getSpecificationVersion(ForgeVersion.class).orElse(System.getenv("FORGE_SPEC")); @@ -38,9 +37,9 @@ public class ForgeVersion forgeVersion = vers; forgeSpec = spec; forgeGroup = group; - LOGGER.debug(CORE, "Found Forge version {}", forgeVersion); - LOGGER.debug(CORE, "Found Forge spec {}", forgeSpec); - LOGGER.debug(CORE, "Found Forge group {}", forgeGroup); + LOGGER.debug(Logging.CORE, "Found Forge version {}", forgeVersion); + LOGGER.debug(Logging.CORE, "Found Forge spec {}", forgeSpec); + LOGGER.debug(Logging.CORE, "Found Forge group {}", forgeGroup); } public static String getVersion() diff --git a/src/main/java/net/minecraftforge/versions/mcp/MCPVersion.java b/src/main/java/net/minecraftforge/versions/mcp/MCPVersion.java index 80e341a2d8..af2990f46b 100644 --- a/src/main/java/net/minecraftforge/versions/mcp/MCPVersion.java +++ b/src/main/java/net/minecraftforge/versions/mcp/MCPVersion.java @@ -8,25 +8,24 @@ package net.minecraftforge.versions.mcp; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import net.minecraftforge.fml.Logging; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.JarVersionLookupHandler; -import static net.minecraftforge.fml.Logging.CORE; - public class MCPVersion { private static final Logger LOGGER = LogManager.getLogger(); private static final String mcVersion; private static final String mcpVersion; static { - LOGGER.debug(CORE, "MCP Version package {} from {}", MCPVersion.class.getPackage(), MCPVersion.class.getClassLoader()); + LOGGER.debug(Logging.CORE, "MCP Version package {} from {}", MCPVersion.class.getPackage(), MCPVersion.class.getClassLoader()); mcVersion = JarVersionLookupHandler.getSpecificationVersion(MCPVersion.class).orElse(FMLLoader.versionInfo().mcVersion()); if (mcVersion == null) throw new RuntimeException("Missing MC version, cannot continue"); mcpVersion = JarVersionLookupHandler.getImplementationVersion(MCPVersion.class).orElse(FMLLoader.versionInfo().mcpVersion()); if (mcpVersion == null) throw new RuntimeException("Missing MCP version, cannot continue"); - LOGGER.debug(CORE, "Found MC version information {}", mcVersion); - LOGGER.debug(CORE, "Found MCP version information {}", mcpVersion); + LOGGER.debug(Logging.CORE, "Found MC version information {}", mcVersion); + LOGGER.debug(Logging.CORE, "Found MCP version information {}", mcpVersion); } public static String getMCVersion() { return mcVersion; diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index a7bb9dbc7a..3259ff0751 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -5,8 +5,6 @@ package net.minecraftforge.debug; -import static net.minecraftforge.debug.DataGeneratorTest.MODID; - import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -130,7 +128,7 @@ import net.minecraft.world.level.block.StairBlock; import net.minecraft.world.level.block.TrapDoorBlock; @SuppressWarnings("deprecation") -@Mod(MODID) +@Mod(DataGeneratorTest.MODID) @Mod.EventBusSubscriber(bus = Bus.MOD) public class DataGeneratorTest { diff --git a/src/test/java/net/minecraftforge/debug/world/item/LazyCapabilitiesOnItemsTest.java b/src/test/java/net/minecraftforge/debug/world/item/LazyCapabilitiesOnItemsTest.java index fdc6443a9e..1c11501a33 100644 --- a/src/test/java/net/minecraftforge/debug/world/item/LazyCapabilitiesOnItemsTest.java +++ b/src/test/java/net/minecraftforge/debug/world/item/LazyCapabilitiesOnItemsTest.java @@ -28,8 +28,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -import static net.minecraftforge.common.util.TextTable.column; - @Mod(LazyCapabilitiesOnItemsTest.MOD_ID) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = LazyCapabilitiesOnItemsTest.MOD_ID) public class LazyCapabilitiesOnItemsTest @@ -146,8 +144,8 @@ public class LazyCapabilitiesOnItemsTest bus.unregister(capAttachmentHandler); TextTable table = new TextTable(Lists.newArrayList( - column("Test type", TextTable.Alignment.LEFT), - column("Total time", TextTable.Alignment.CENTER) + TextTable.column("Test type", TextTable.Alignment.LEFT), + TextTable.column("Total time", TextTable.Alignment.CENTER) )); table.add("Lazy: Disabled / Caps: None", simpleNoCapsLazyDisabledElapsed + " ms."); diff --git a/src/test/java/net/minecraftforge/test/LazyOptionalTest.java b/src/test/java/net/minecraftforge/test/LazyOptionalTest.java index 734ed95777..ce46bd414d 100644 --- a/src/test/java/net/minecraftforge/test/LazyOptionalTest.java +++ b/src/test/java/net/minecraftforge/test/LazyOptionalTest.java @@ -8,14 +8,13 @@ package net.minecraftforge.test; import com.mojang.datafixers.util.Unit; import net.minecraftforge.common.util.LazyOptional; import org.apache.commons.lang3.mutable.MutableInt; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class LazyOptionalTest { @Test @@ -49,8 +48,8 @@ public class LazyOptionalTest { thread.join(); } - assertEquals(threads.size(), successfulThreads.get()); - assertEquals(1, supplierCalls.get()); + Assertions.assertEquals(threads.size(), successfulThreads.get()); + Assertions.assertEquals(1, supplierCalls.get()); } @Test @@ -62,6 +61,6 @@ public class LazyOptionalTest }); badLazy.ifPresent(u -> {}); badLazy.ifPresent(u -> {}); - assertEquals(1, supplierCalls.intValue()); + Assertions.assertEquals(1, supplierCalls.intValue()); } }