mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
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.
This commit is contained in:
28 files changed
+202
-258
No files matched your search
@@ -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}.
|
||||
* <p>
|
||||
@@ -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<RecipeBookType, ImmutableList<RecipeBookCategories>>();
|
||||
var recipeCategoryLookups = new HashMap<RecipeType<?>, Function<Recipe<?>, RecipeBookCategories>>();
|
||||
var event = new RegisterRecipeBookCategoriesEvent(aggregateCategories, typeCategories, recipeCategoryLookups);
|
||||
|
||||
@@ -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<ModLoadingWarning> 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<IModFile, ? extends PathPackResources> modResourcePacks, Consumer<Pack> packAcceptor) {
|
||||
List<PathPackResources> hiddenPacks = new ArrayList<>();
|
||||
var hiddenPacks = new ArrayList<PathPackResources>();
|
||||
for (Entry<IModFile, ? extends PathPackResources> 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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<String> 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> loadingOverlay(Supplier<Minecraft> mc, Supplier<ReloadInstance> ri, Consumer<Optional<Throwable>> 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";
|
||||
|
||||
@@ -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.
|
||||
* <p>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+10
-11
@@ -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}.
|
||||
* <p>
|
||||
@@ -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<BakedQuad> 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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<UnmodifiableConfi
|
||||
this.childConfig = config;
|
||||
if (config != null && !isCorrect(config)) {
|
||||
String configName = config instanceof FileConfig ? ((FileConfig) config).getNioPath().toString() : config.toString();
|
||||
LOGGER.warn(CORE, "Configuration file {} is not correct. Correcting", configName);
|
||||
LOGGER.warn(Logging.CORE, "Configuration file {} is not correct. Correcting", configName);
|
||||
correct(config,
|
||||
(action, path, incorrectValue, correctedValue) ->
|
||||
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<UnmodifiableConfi
|
||||
final String key = specEntry.getKey();
|
||||
final Object specValue = specEntry.getValue();
|
||||
final Object configValue = configMap.get(key);
|
||||
final CorrectionAction action = configValue == null ? ADD : REPLACE;
|
||||
final CorrectionAction action = configValue == null ? CorrectionAction.ADD : CorrectionAction.REPLACE;
|
||||
|
||||
parentPath.addLast(key);
|
||||
|
||||
@@ -256,7 +252,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
|
||||
ittr.remove();
|
||||
parentPath.addLast(entry.getKey());
|
||||
listener.onCorrect(REMOVE, parentPathUnmodifiable, entry.getValue(), null);
|
||||
listener.onCorrect(CorrectionAction.REMOVE, parentPathUnmodifiable, entry.getValue(), null);
|
||||
parentPath.removeLast();
|
||||
count++;
|
||||
}
|
||||
@@ -367,13 +363,13 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
@Override
|
||||
public Object correct(Object value) {
|
||||
if (value == null || !(value instanceof List) || ((List<?>)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<UnmodifiableConfi
|
||||
@Override
|
||||
public Object correct(Object value) {
|
||||
if (value == null || !(value instanceof List)) {
|
||||
LOGGER.debug(CORE, "List on key {} is deemed to need correction, as it is null or not a list.", path.get(path.size() - 1));
|
||||
LOGGER.debug(Logging.CORE, "List on key {} is deemed to need correction, as it is null or not a list.", 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;
|
||||
@@ -654,7 +650,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
if (comment.stream().allMatch(String::isBlank))
|
||||
{
|
||||
if (FMLEnvironment.production)
|
||||
LOGGER.warn(CORE, "Detected a comment that is all whitespace for config option {}, which causes obscure bugs in Forge's config system and will cause a crash in the future. Please report this to the mod author.",
|
||||
LOGGER.warn(Logging.CORE, "Detected a comment that is all whitespace for config option {}, which causes obscure bugs in Forge's config system and will cause a crash in the future. Please report this to the mod author.",
|
||||
DOT_JOINER.join(path));
|
||||
else
|
||||
throw new IllegalStateException("Can not build comment for config option " + DOT_JOINER.join(path) + " as it comprises entirely of blank lines/whitespace. This is not allowed as it causes a \"constantly correcting config\" bug with NightConfig in Forge's config system.");
|
||||
@@ -730,7 +726,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
boolean result = ((Number)min).doubleValue() <= n.doubleValue() && n.doubleValue() <= ((Number)max).doubleValue();
|
||||
if(!result)
|
||||
{
|
||||
LOGGER.debug(CORE, "Range value {} is not within its bounds {}-{}", n.doubleValue(), ((Number)min).doubleValue(), ((Number)max).doubleValue());
|
||||
LOGGER.debug(Logging.CORE, "Range value {} is not within its bounds {}-{}", n.doubleValue(), ((Number)min).doubleValue(), ((Number)max).doubleValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -740,7 +736,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
|
||||
boolean result = c.compareTo(min) >= 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;
|
||||
}
|
||||
|
||||
@@ -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<String, String> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<IEnergyStorage> ENERGY = get(new CapabilityToken<>(){});
|
||||
public static final Capability<IFluidHandler> FLUID_HANDLER = get(new CapabilityToken<>(){});
|
||||
public static final Capability<IFluidHandlerItem> FLUID_HANDLER_ITEM = get(new CapabilityToken<>(){});
|
||||
public static final Capability<IItemHandler> ITEM_HANDLER = get(new CapabilityToken<>(){});
|
||||
public static final Capability<IEnergyStorage> ENERGY = CapabilityManager.get(new CapabilityToken<>(){});
|
||||
public static final Capability<IFluidHandler> FLUID_HANDLER = CapabilityManager.get(new CapabilityToken<>(){});
|
||||
public static final Capability<IFluidHandlerItem> FLUID_HANDLER_ITEM = CapabilityManager.get(new CapabilityToken<>(){});
|
||||
public static final Capability<IItemHandler> ITEM_HANDLER = CapabilityManager.get(new CapabilityToken<>(){});
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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<HolderLookup.Provider> 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<NetworkEvent.Context> c)
|
||||
|
||||
@@ -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<EntityDataSerializer<?>> 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<Codec<? extends IGlobalLootModifier>> getGLMSerializersRegistryBuilder()
|
||||
{
|
||||
return makeRegistry(GLOBAL_LOOT_MODIFIER_SERIALIZERS).disableSaving().disableSync();
|
||||
return makeRegistry(Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS).disableSaving().disableSync();
|
||||
}
|
||||
|
||||
static RegistryBuilder<Codec<? extends BiomeModifier>> getBiomeModifierSerializersRegistryBuilder()
|
||||
@@ -194,7 +160,7 @@ public class GameData
|
||||
|
||||
static RegistryBuilder<FluidType> getFluidTypeRegistryBuilder()
|
||||
{
|
||||
return makeRegistry(FLUID_TYPES).disableSaving();
|
||||
return makeRegistry(Keys.FLUID_TYPES).disableSaving();
|
||||
}
|
||||
|
||||
static RegistryBuilder<HolderSetType> getHolderSetTypeRegistryBuilder()
|
||||
@@ -246,19 +212,19 @@ public class GameData
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<Block,Item> 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<BlockState> 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<BlockState, PoiType> 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<Item> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ModFileScanData.AnnotationData> 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<Type, String> classModIds, Map<Type, Class<?>> 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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ModLoadingWarning> 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();
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user