mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +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;
|
||||
|
||||
Reference in new issue
Block a user