Skip to content

Commit

Permalink
Merge branch '1.21.x' into l10n_1.21.x
Browse files Browse the repository at this point in the history
  • Loading branch information
marchermans authored Feb 6, 2025
2 parents 0f55ebe + 840719e commit 33a0ddc
Show file tree
Hide file tree
Showing 84 changed files with 1,836 additions and 394 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit (PR)
if: ${{ github.event_name == 'pull_request' }}
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}

- name: Create branch for commit
if: ${{ github.event_name != 'pull_request' }}
run:
git switch -C ${{ github.ref_name }}
uses: neoforged/actions/checkout@main

- name: Setup JDK 21
uses: neoforged/actions/setup-java@main
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/check-local-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: neoforged/actions/checkout@main

- name: Setup JDK 21
uses: neoforged/actions/setup-java@main
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/test-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
uses: neoforged/actions/checkout@main

- name: Setup JDK 21
uses: neoforged/actions/setup-java@main
Expand Down
13 changes: 12 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ repositories {
includeGroup "net.neoforged"
}
}
maven {
name = "MojangMeta"
url = "https://maven.neoforged.net/mojang-meta"
content {
includeModule("net.neoforged", "minecraft-dependencies")
}
}
}

dependencies {
// buildSrc is an includedbuild of the parent directory (gradle.parent)
// ../settings.gradle sets these version properties accordingly
implementation "net.neoforged:moddev-gradle:${gradle.parent.ext.moddevgradle_plugin_version}"

implementation "com.google.code.gson:gson:${gradle.parent.ext.gson_version}"
implementation(platform("net.neoforged:minecraft-dependencies:${gradle.parent.ext.minecraft_version}") {
exclude group: 'org.ow2.asm' // The platform requests a strictly lower version of ASM and we bump it
})

implementation "com.google.code.gson:gson"
implementation "io.codechicken:DiffPatch:${gradle.parent.ext.diffpatch_version}"

implementation "org.ow2.asm:asm:${gradle.parent.ext.asm_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private NeoDevConfigurations(Project project) {

// Libraries & module libraries & MC dependencies need to be available when compiling in NeoDev,
// and on the runtime classpath too for IDE debugging support.
configurations.getByName("implementation").extendsFrom(libraries, moduleLibraries, neoFormDependencies);
configurations.getByName("api").extendsFrom(libraries, moduleLibraries, neoFormDependencies);

// runtimeClasspath is our reference for all MC dependency versions.
// Make sure that any classpath we resolve is consistent with it.
Expand Down
6 changes: 4 additions & 2 deletions coremods/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ java {
}

dependencies {
compileOnly(platform("net.neoforged:minecraft-dependencies:${project.minecraft_version}"))
compileOnly "org.slf4j:slf4j-api"
compileOnly "com.google.code.gson:gson"

compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
compileOnly "com.google.code.gson:gson:${gson_version}"
compileOnly "org.slf4j:slf4j-api:${slf4j_api_version}"
compileOnly "net.neoforged.fancymodloader:loader:${project.fancy_mod_loader_version}"
}

Expand Down
8 changes: 0 additions & 8 deletions coremods/settings.gradle

This file was deleted.

15 changes: 3 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,13 @@ bootstraplauncher_version=2.0.2
asm_version=9.7
mixin_version=0.15.2+mixin.0.8.7
terminalconsoleappender_version=1.3.0
nightconfig_version=3.8.0
nightconfig_version=3.8.1
jetbrains_annotations_version=24.0.1
slf4j_api_version=2.0.7
apache_maven_artifact_version=3.8.5
apache_maven_artifact_version=3.9.9
jarjar_version=0.4.1
fancy_mod_loader_version=6.0.4
mojang_logging_version=1.1.1
log4j_version=2.22.1
guava_version=31.1.2-jre
gson_version=2.10.1
apache_commons_lang3_version=3.13.0
jopt_simple_version=5.0.4
commons_io_version=2.13.0
fancy_mod_loader_version=6.0.6
typetools_version=0.6.3
nashorn_core_version=15.3
lwjgl_glfw_version=3.3.2
mixin_extras_version=0.4.1

jupiter_api_version=5.10.2
Expand Down
42 changes: 42 additions & 0 deletions patches/com/mojang/blaze3d/pipeline/MainTarget.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--- a/com/mojang/blaze3d/pipeline/MainTarget.java
+++ b/com/mojang/blaze3d/pipeline/MainTarget.java
@@ -16,7 +_,10 @@
static final MainTarget.Dimension DEFAULT_DIMENSIONS = new MainTarget.Dimension(854, 480);

public MainTarget(int p_166137_, int p_166138_) {
- super(true);
+ this(p_166137_, p_166138_, false);
+ }
+ public MainTarget(int p_166137_, int p_166138_, boolean enableStencil) {
+ super(true, enableStencil);
this.createFrameBuffer(p_166137_, p_166138_);
}

@@ -37,6 +_,14 @@
GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071);
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
+ if (this.useStencil) {
+ GlStateManager._glFramebufferTexture2D(
+ org.lwjgl.opengl.GL32.GL_FRAMEBUFFER,
+ org.lwjgl.opengl.GL32.GL_STENCIL_ATTACHMENT,
+ org.lwjgl.opengl.GL32.GL_TEXTURE_2D,
+ this.depthBufferId,
+ 0);
+ }
GlStateManager._bindTexture(0);
this.viewWidth = maintarget$dimension.width;
this.viewHeight = maintarget$dimension.height;
@@ -82,7 +_,11 @@
RenderSystem.assertOnRenderThreadOrInit();
GlStateManager._getError();
GlStateManager._bindTexture(this.depthBufferId);
- GlStateManager._texImage2D(3553, 0, 6402, p_166145_.width, p_166145_.height, 0, 6402, 5126, null);
+ if (!this.useStencil) {
+ GlStateManager._texImage2D(3553, 0, 6402, p_166145_.width, p_166145_.height, 0, 6402, 5126, null);
+ } else {
+ net.neoforged.neoforge.client.ClientHooks.texImageDepthStencil(p_166145_.width, p_166145_.height);
+ }
return GlStateManager._getError() != 1285;
}

66 changes: 66 additions & 0 deletions patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -25,6 +_,7 @@
public int viewWidth;
public int viewHeight;
public final boolean useDepth;
+ public final boolean useStencil;
public int frameBufferId;
protected int colorTextureId;
protected int depthBufferId;
@@ -32,7 +_,15 @@
public int filterMode;

public RenderTarget(boolean p_166199_) {
- this.useDepth = p_166199_;
+ this(p_166199_, false);
+ }
+
+ public RenderTarget(boolean useDepth, boolean useStencil) {
+ if (useStencil && !useDepth) {
+ throw new IllegalArgumentException("Stencil can only be enabled if depth is enabled.");
+ }
+ this.useDepth = useDepth;
+ this.useStencil = useStencil;
this.frameBufferId = -1;
this.colorTextureId = -1;
this.depthBufferId = -1;
@@ -96,7 +_,11 @@
GlStateManager._texParameter(3553, 34892, 0);
GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071);
- GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null);
+ if (!this.useStencil) {
+ GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null);
+ } else {
+ net.neoforged.neoforge.client.ClientHooks.texImageDepthStencil(this.width, this.height);
+ }
}

this.setFilterMode(9728, true);
@@ -109,6 +_,14 @@
if (this.useDepth) {
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
}
+ if (this.useStencil) {
+ GlStateManager._glFramebufferTexture2D(
+ org.lwjgl.opengl.GL32.GL_FRAMEBUFFER,
+ org.lwjgl.opengl.GL32.GL_STENCIL_ATTACHMENT,
+ org.lwjgl.opengl.GL32.GL_TEXTURE_2D,
+ this.depthBufferId,
+ 0);
+ }

this.checkStatus();
this.clear();
@@ -217,6 +_,10 @@
if (this.useDepth) {
GlStateManager._clearDepth(1.0);
i |= 256;
+ }
+ if (this.useStencil) {
+ GlStateManager._clearStencil(0);
+ i |= org.lwjgl.opengl.GL32.GL_STENCIL_BUFFER_BIT;
}

GlStateManager._clear(i);
14 changes: 14 additions & 0 deletions patches/com/mojang/blaze3d/pipeline/TextureTarget.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/com/mojang/blaze3d/pipeline/TextureTarget.java
+++ b/com/mojang/blaze3d/pipeline/TextureTarget.java
@@ -7,7 +_,10 @@
@OnlyIn(Dist.CLIENT)
public class TextureTarget extends RenderTarget {
public TextureTarget(int p_166213_, int p_166214_, boolean p_166215_) {
- super(p_166215_);
+ this(p_166213_, p_166214_, p_166215_, false);
+ }
+ public TextureTarget(int p_166213_, int p_166214_, boolean p_166215_, boolean useStencil) {
+ super(p_166215_, useStencil);
RenderSystem.assertOnRenderThreadOrInit();
this.resize(p_166213_, p_166214_);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/com/mojang/blaze3d/resource/RenderTargetDescriptor.java
+++ b/com/mojang/blaze3d/resource/RenderTargetDescriptor.java
@@ -6,9 +_,13 @@
import net.neoforged.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
-public record RenderTargetDescriptor(int width, int height, boolean useDepth) implements ResourceDescriptor<RenderTarget> {
+public record RenderTargetDescriptor(int width, int height, boolean useDepth, boolean useStencil) implements ResourceDescriptor<RenderTarget> {
+ public RenderTargetDescriptor(int width, int height, boolean useDepth) {
+ this(width, height, useDepth, false);
+ }
+
public RenderTarget allocate() {
- return new TextureTarget(this.width, this.height, this.useDepth);
+ return new TextureTarget(this.width, this.height, this.useDepth, this.useStencil);
}

public void free(RenderTarget p_363223_) {
21 changes: 16 additions & 5 deletions patches/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
this.demo = p_91084_.game.demo;
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
this.allowsChat = !p_91084_.game.disableChat;
@@ -483,15 +_,17 @@
@@ -483,15 +_,18 @@
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
}

Expand All @@ -18,11 +18,13 @@
this.keyboardHandler = new KeyboardHandler(this);
- this.keyboardHandler.setup(this.window.getWindow());
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
- this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
+ net.neoforged.neoforge.client.loading.ClientModLoader.begin(this);
+ this.mainRenderTarget = net.neoforged.neoforge.client.ClientHooks.instantiateMainTarget(this.window.getWidth(), this.window.getHeight());
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
this.mainRenderTarget.clear();
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.neoforged.neoforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
+ net.neoforged.neoforge.client.loading.ClientModLoader.finish(this.resourcePackRepository, this.resourceManager);
+ //Move client bootstrap to after mod loading so that events can be fired for it.
+ ClientBootstrap.bootstrap();
this.resourcePackRepository.reload();
Expand Down Expand Up @@ -322,22 +324,31 @@
this.level = p_91157_;
this.updateLevelInEngines(p_91157_);
if (!this.isLocalServer) {
@@ -2030,6 +_,7 @@
@@ -2030,13 +_,16 @@
IntegratedServer integratedserver = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
+ net.neoforged.neoforge.client.ClientHooks.firePlayerLogout(this.gameMode, this.player);
this.gameMode = null;
this.narrator.clear();
this.clientLevelTeardownInProgress = true;
@@ -2037,6 +_,7 @@

+ var shouldRevertRegistriesToFrozen = this.getConnection() != null && this.getConnection().getConnection() != null; // Neo: Track whether to revert registries after disconnect
try {
this.updateScreenAndTick(p_320248_);
if (this.level != null) {
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(this.level));
if (integratedserver != null) {
ProfilerFiller profilerfiller = Profiler.get();
profilerfiller.push("waitForServer");
@@ -2060,6 +_,7 @@
}

SkullBlockEntity.clear();
+ if(shouldRevertRegistriesToFrozen) net.neoforged.neoforge.registries.RegistryManager.revertToFrozen(); // Neo: Revert registries to frozen on disconnect
}

public void clearDownloadedResourcePacks() {
@@ -2197,6 +_,7 @@

private void pickBlock() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@
this.connection.send(p_295097_);
}

@@ -285,6 +_,9 @@
public void onDisconnect(DisconnectionDetails p_350760_) {
this.telemetryManager.onDisconnect();
this.minecraft.disconnect(this.createDisconnectScreen(p_350760_), this.isTransferring);
+ if (!this.connection.isMemoryConnection()) {
+ net.neoforged.neoforge.registries.RegistryManager.revertToFrozen();
+ }
LOGGER.warn("Client disconnected with reason: {}", p_350760_.reason().getString());
}

@@ -409,5 +_,10 @@
@OnlyIn(Dist.CLIENT)
static record PendingRequest(UUID id, URL url, String hash) {
Expand Down
16 changes: 15 additions & 1 deletion patches/net/minecraft/client/renderer/LevelRenderer.java.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--- a/net/minecraft/client/renderer/LevelRenderer.java
+++ b/net/minecraft/client/renderer/LevelRenderer.java
@@ -459,7 +_,7 @@
this.targets.main = framegraphbuilder.importExternal("main", this.minecraft.getMainRenderTarget());
int i = this.minecraft.getMainRenderTarget().width;
int j = this.minecraft.getMainRenderTarget().height;
- RenderTargetDescriptor rendertargetdescriptor = new RenderTargetDescriptor(i, j, true);
+ RenderTargetDescriptor rendertargetdescriptor = new RenderTargetDescriptor(i, j, true, this.minecraft.getMainRenderTarget().useStencil);
PostChain postchain = this.getTransparencyChain();
if (postchain != null) {
this.targets.translucent = framegraphbuilder.createInternal("translucent", rendertargetdescriptor);
@@ -473,6 +_,9 @@
this.targets.entityOutline = framegraphbuilder.importExternal("entity_outline", this.entityOutlineTarget);
}
Expand Down Expand Up @@ -240,7 +249,7 @@
if (j < k) {
j = k;
}
@@ -1449,5 +_,22 @@
@@ -1449,5 +_,27 @@

public CloudRenderer getCloudRenderer() {
return this.cloudRenderer;
Expand All @@ -261,5 +270,10 @@
+ synchronized (this.globalBlockEntities) {
+ this.globalBlockEntities.forEach(blockEntityConsumer);
+ }
+ }
+
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public Iterable<? extends net.neoforged.neoforge.client.IRenderableSection> getRenderableSections() {
+ return this.visibleSections;
}
}
Loading

0 comments on commit 33a0ddc

Please sign in to comment.