Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 8ac9f9c
Author: Minecraftschurli <[email protected]>
Date:   Tue May 21 15:25:59 2024 +0200

    [Testframework] Fix wrapping GameTestAssertException (neoforged#988)

commit 66197fe
Author: Max <[email protected]>
Date:   Sat May 18 20:11:00 2024 +0200

    Add a Fluid Ingredient system as an analogue to vanilla's Ingredient (neoforged#789)

commit b1c3fe0
Author: NeoForged Localizations <[email protected]>
Date:   Sun May 19 00:43:32 2024 +0800

    New Crowdin updates (neoforged#972)

commit a7edbae
Author: Sara Freimer <[email protected]>
Date:   Fri May 17 01:32:34 2024 -0500

    Implement equals and hashCode for SizedIngredients (neoforged#965)

commit e9e8af0
Author: Dennis C <[email protected]>
Date:   Fri May 17 08:31:55 2024 +0200

    [1.20.6] Use extensible enum codec and streamcodec for rarity enum (neoforged#958)

commit 986e0e3
Author: TelepathicGrunt <[email protected]>
Date:   Fri May 17 02:28:12 2024 -0400

    Patch in missing LivingJumpEvent for Slime and Camel (neoforged#966)

commit 2bf3073
Author: TelepathicGrunt <[email protected]>
Date:   Fri May 17 02:26:49 2024 -0400

    Pass growing plant blockstate into onCropsGrowPre for various vine blocks (neoforged#967)

commit 0033435
Author: embeddedt <[email protected]>
Date:   Fri May 17 02:25:24 2024 -0400

    Fix ComputeCameraAngles event applying roll in global space (neoforged#968)

commit bb3537b
Author: TelepathicGrunt <[email protected]>
Date:   Wed May 15 23:02:02 2024 -0400

    [no ci] Remove PitcherCrop patch TODO (neoforged#963)

commit d80f154
Author: TelepathicGrunt <[email protected]>
Date:   Wed May 15 23:01:36 2024 -0400

    [no ci] Fixed Bubble Column gametest template size (neoforged#964)

commit c888a68
Author: Luke Bemish <[email protected]>
Date:   Wed May 15 01:29:03 2024 -0500

    [1.20.6] Add KnownPacks for mods (neoforged#901)

commit a28986f
Author: shartte <[email protected]>
Date:   Mon May 13 09:13:19 2024 +0200

    Update FML to 3.0.29 (neoforged#957)

commit 2aadb61
Author: TelepathicGrunt <[email protected]>
Date:   Sat May 11 14:11:06 2024 -0400

    Make StructureTemplate's Palette caches thread safe (neoforged#954)

commit 2bced72
Author: TelepathicGrunt <[email protected]>
Date:   Sat May 11 13:49:18 2024 -0400

    Address POI memory leak and Generate Command issues (neoforged#937)

    Co-authored-by: embeddedt <[email protected]>

commit abc54b7
Author: Sirttas <[email protected]>
Date:   Sat May 11 19:48:09 2024 +0200

    [Test Framework] Add a check in `StructureTemplateBuilder#set` to prevent placing block outside template bondaries (neoforged#950)

commit 2d93ce5
Author: embeddedt <[email protected]>
Date:   Sat May 11 01:28:34 2024 -0400

    Delete ItemModelShaper patch (neoforged#952)

commit 018e104
Author: embeddedt <[email protected]>
Date:   Fri May 10 19:58:05 2024 -0400

    Fix more particle culling issues (neoforged#951)

commit 03e346b
Author: TelepathicGrunt <[email protected]>
Date:   Fri May 10 12:14:37 2024 -0400

    Fix MC-268617 to allow valid filepaths in Minecraft (neoforged#767)

commit fe57823
Author: TelepathicGrunt <[email protected]>
Date:   Fri May 10 12:02:54 2024 -0400

    Fire Villager/Wandering Trader trade events on /reload (neoforged#922)

commit d0ed10a
Author: TelepathicGrunt <[email protected]>
Date:   Fri May 10 12:02:04 2024 -0400

    Remove Unnecessary Stitcher patch (neoforged#948)

commit a598489
Author: Matyrobbrt <[email protected]>
Date:   Fri May 10 14:44:48 2024 +0300

    Bump Mixin to 0.13.4 to fix local variable issues (neoforged#945)

    Fixes neoforged#768

commit 212f760
Author: sciwhiz12 <[email protected]>
Date:   Fri May 10 10:29:47 2024 +0800

    Fix dedicated server GUI never showing up (neoforged#946)

commit 238a273
Author: embeddedt <[email protected]>
Date:   Thu May 9 17:07:08 2024 -0400

    Add more accurate culling for single quad particles (neoforged#885)

commit 27c5d7a
Author: Brennan Ward <[email protected]>
Date:   Thu May 9 10:50:55 2024 -0700

    Fix FinalizeSpawnEvent for trial spawners and fix SpawnGroupData propagation (neoforged#880)

    Closes neoforged#783
    Closes neoforged#939

commit 989ed3b
Author: TelepathicGrunt <[email protected]>
Date:   Thu May 9 13:40:34 2024 -0400

    [1.20.6] Fix several NeoForge command crashes and allow chat OpenFile click action on Integrated Server  (neoforged#915)
  • Loading branch information
CodexAdrian committed Jun 14, 2024
1 parent bc53b71 commit 383957f
Show file tree
Hide file tree
Showing 39 changed files with 646 additions and 811 deletions.
12 changes: 6 additions & 6 deletions patches/net/minecraft/FileUtil.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
+ private static final Pattern RESERVED_WINDOWS_FILENAMES_NEOFORGE = Pattern.compile(".*\\.|(?:CON|PRN|AUX|NUL|CLOCK\\$|CONIN\\$|CONOUT\\$|(?:COM|LPT)[¹²³0-9])(?:\\..*)?", 2); // Neo: Fix MC-268617 - See PR #767
private static final Pattern STRICT_PATH_SEGMENT_CHECK = Pattern.compile("[-._a-z0-9]+");

public static String sanitizeName(String p_352262_) {
@@ -31,7 +_,7 @@

public static String findAvailableName(Path p_133731_, String p_133732_, String p_133733_) throws IOException {
p_133732_ = sanitizeName(p_133732_);
@@ -27,7 +_,7 @@
}

p_133732_ = p_133732_.replaceAll("[./\"]", "_");
- if (RESERVED_WINDOWS_FILENAMES.matcher(p_133732_).matches()) {
+ if ((net.neoforged.neoforge.common.NeoForgeMod.getProperFilenameValidation() ? RESERVED_WINDOWS_FILENAMES_NEOFORGE : RESERVED_WINDOWS_FILENAMES).matcher(p_133732_).matches()) {
p_133732_ = "_" + p_133732_ + "_";
}

@@ -78,7 +_,7 @@
@@ -74,7 +_,7 @@

public static boolean isPathPortable(Path p_133735_) {
for (Path path : p_133735_) {
for(Path path : p_133735_) {
- if (RESERVED_WINDOWS_FILENAMES.matcher(path.toString()).matches()) {
+ if ((net.neoforged.neoforge.common.NeoForgeMod.getProperFilenameValidation() ? RESERVED_WINDOWS_FILENAMES_NEOFORGE : RESERVED_WINDOWS_FILENAMES).matcher(path.toString()).matches()) {
return false;
Expand Down
45 changes: 23 additions & 22 deletions patches/net/minecraft/client/particle/ParticleEngine.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -81,11 +_,11 @@
@@ -79,11 +_,11 @@
ParticleRenderType.CUSTOM
);
protected ClientLevel level;
Expand All @@ -14,7 +14,7 @@
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
private final TextureAtlas textureAtlas;
@@ -216,10 +_,14 @@
@@ -214,10 +_,14 @@
this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new);
}

Expand All @@ -30,7 +30,7 @@
public <T extends ParticleOptions> void register(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
this.register(
p_273423_,
@@ -236,10 +_,12 @@
@@ -234,10 +_,12 @@
);
}

Expand All @@ -44,7 +44,7 @@
}

@Override
@@ -365,7 +_,7 @@
@@ -363,7 +_,7 @@
private <T extends ParticleOptions> Particle makeParticle(
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
) {
Expand All @@ -53,37 +53,38 @@
return particleprovider == null
? null
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
@@ -441,11 +_,20 @@
@@ -439,11 +_,21 @@
}
}

+ /** @deprecated Neo: use {@link #render(LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter */
+ @Deprecated
public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_) {
+ render(p_107339_, p_107340_, p_107341_, null, type -> true);
+ render(p_107339_, p_107340_, p_107341_, null);
+ }
+
+ public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum frustum, java.util.function.Predicate<ParticleRenderType> renderTypePredicate) {
+ public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum frustum) {
p_107339_.turnOnLightLayer();
RenderSystem.enableDepthTest();
+ //TODO porting: is this even needed with the particle render order fix???
+ RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE2);
+ RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE0);

- for (ParticleRenderType particlerendertype : RENDER_ORDER) {
+ for (ParticleRenderType particlerendertype : this.particles.keySet()) { // Neo: allow custom IParticleRenderType's
+ if (particlerendertype == ParticleRenderType.NO_RENDER || !renderTypePredicate.test(particlerendertype)) continue;
Queue<Particle> queue = this.particles.get(particlerendertype);
if (queue != null && !queue.isEmpty()) {
+ for(ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's
+ if (particlerendertype == ParticleRenderType.NO_RENDER) continue;
Iterable<Particle> iterable = this.particles.get(particlerendertype);
if (iterable != null) {
RenderSystem.setShader(GameRenderer::getParticleShader);
@@ -453,6 +_,7 @@
BufferBuilder bufferbuilder = particlerendertype.begin(tesselator, this.textureManager);
if (bufferbuilder != null) {
for (Particle particle : queue) {
+ if (frustum != null && !frustum.isVisible(particle.getRenderBoundingBox(p_107341_))) continue;
try {
particle.render(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -484,7 +_,7 @@
@@ -452,6 +_,7 @@
particlerendertype.begin(bufferbuilder, this.textureManager);

for (Particle particle : iterable) {
+ if (frustum != null && !frustum.isVisible(particle.getRenderBoundingBox(p_107341_))) continue;
try {
particle.render(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -479,7 +_,7 @@
}

public void destroy(BlockPos p_107356_, BlockState p_107357_) {
Expand All @@ -92,7 +93,7 @@
VoxelShape voxelshape = p_107357_.getShape(this.level, p_107356_);
double d0 = 0.25;
voxelshape.forAllBoxes(
@@ -516,7 +_,7 @@
@@ -511,7 +_,7 @@
d6 - 0.5,
p_107357_,
p_107356_
Expand All @@ -101,7 +102,7 @@
);
}
}
@@ -561,12 +_,28 @@
@@ -556,12 +_,28 @@
d0 = (double)i + aabb.maxX + 0.1F;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/particle/SingleQuadParticle.java
+++ b/net/minecraft/client/particle/SingleQuadParticle.java
@@ -80,6 +_,12 @@
.setLight(p_345037_);
@@ -81,6 +_,12 @@
.endVertex();
}

+ @Override
Expand Down
30 changes: 15 additions & 15 deletions patches/net/minecraft/client/renderer/GameRenderer.java.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -311,6 +_,8 @@
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json"));
@@ -310,6 +_,8 @@
this.loadEffect(new ResourceLocation("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json"));
this.loadEffect(new ResourceLocation("shaders/post/invert.json"));
+ } else {
+ net.neoforged.neoforge.client.ClientHooks.loadEntityShader(p_109107_, this);
}
}

@@ -714,6 +_,7 @@
@@ -735,6 +_,7 @@
)
);
this.loadBlurEffect(p_250719_);
+ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.RegisterShadersEvent(p_250719_, list1));
} catch (IOException ioexception) {
list1.forEach(p_172729_ -> p_172729_.getFirst().close());
throw new RuntimeException("could not reload shaders", ioexception);
@@ -872,7 +_,7 @@
@@ -893,7 +_,7 @@
d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F);
}

Expand All @@ -26,7 +26,7 @@
}
}

@@ -888,6 +_,10 @@
@@ -909,6 +_,10 @@
return;
}

Expand All @@ -37,7 +37,7 @@
f2 /= (float)livingentity.hurtDuration;
f2 = Mth.sin(f2 * f2 * f2 * f2 * (float) Math.PI);
float f3 = livingentity.getHurtDir();
@@ -1036,12 +_,12 @@
@@ -1058,12 +_,12 @@
(float)((double)window.getHeight() / window.getGuiScale()),
0.0F,
1000.0F,
Expand All @@ -52,29 +52,29 @@
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
@@ -1079,7 +_,7 @@
@@ -1097,7 +_,7 @@
}
} else if (flag && this.minecraft.screen != null) {
try {
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_348648_.getRealtimeDeltaTicks());
+ net.neoforged.neoforge.client.ClientHooks.drawScreen(this.minecraft.screen, guigraphics, i, j, this.minecraft.getTimer().getRealtimeDeltaTicks());
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, this.minecraft.getDeltaFrameTime());
+ net.neoforged.neoforge.client.ClientHooks.drawScreen(this.minecraft.screen, guigraphics, i, j, this.minecraft.getDeltaFrameTime());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
@@ -1253,12 +_,18 @@
@@ -1273,12 +_,18 @@
}

this.resetProjectionMatrix(matrix4f);
+ net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.neoforged.neoforge.client.ClientHooks.onCameraSetup(this, camera, f);
+ net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.neoforged.neoforge.client.ClientHooks.onCameraSetup(this, camera, p_109090_);
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf());
Matrix4f matrix4f1 = new Matrix4f().rotation(quaternionf);
Matrix4f matrix4f1 = new Matrix4f()
.rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F);
+ // Neo: Use matrix multiplication so roll is stacked on top of vanilla XY rotations
+ matrix4f1 = new Matrix4f().rotationZ(cameraSetup.getRoll() * (float) (Math.PI / 180.0)).mul(matrix4f1);
this.minecraft
.levelRenderer
.prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue())));
this.minecraft.levelRenderer.renderLevel(p_348589_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
+ this.minecraft.getProfiler().popPush("neoforge_render_last");
+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.minecraft.levelRenderer, null, matrix4f1, matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum());
this.minecraft.getProfiler().popPush("hand");
Expand Down
57 changes: 40 additions & 17 deletions patches/net/minecraft/server/level/ChunkMap.java.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -395,6 +_,7 @@
@@ -422,6 +_,7 @@
this.modified = true;
}

+ net.neoforged.neoforge.event.EventHooks.fireChunkTicketLevelUpdated(this.level, p_140177_, p_140180_, p_140178_, p_140179_);
return p_140179_;
}
}
@@ -508,8 +_,11 @@
@@ -533,8 +_,11 @@
this.scheduleUnload(p_140182_, p_140183_);
} else {
ChunkAccess chunkaccess = p_140183_.getLatestChunk();
if (this.pendingUnloads.remove(p_140182_, p_140183_) && chunkaccess != null) {
+ net.neoforged.neoforge.common.CommonHooks.onChunkUnload(this.poiManager, chunkaccess); // Neo: Must be called for all chunk unloading. Not just LevelChunks.
+ this.chunkTypeCache.remove(chunkaccess.getPos().toLong()); // Neo: Prevent chunk type cache from permanently retaining data for unloaded chunks
if (chunkaccess instanceof LevelChunk levelchunk) {
levelchunk.setLoaded(false);
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Unload(chunkaccess));
if (this.pendingUnloads.remove(p_140182_, p_140183_) && p_203002_ != null) {
+ net.neoforged.neoforge.common.CommonHooks.onChunkUnload(this.poiManager, p_203002_); // Neo: Must be called for all chunk unloading. Not just LevelChunks.
+ this.chunkTypeCache.remove(p_203002_.getPos().toLong()); // Neo: Prevent chunk type cache from permanently retaining data for unloaded chunks
if (p_203002_ instanceof LevelChunk) {
((LevelChunk)p_203002_).setLoaded(false);
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Unload(p_203002_));
}

this.save(chunkaccess);
@@ -756,6 +_,7 @@
this.save(p_203002_);
@@ -735,11 +_,22 @@
}

levelchunk.setFullStatus(() -> ChunkLevel.fullStatus(p_140384_.getTicketLevel()));
+ try {
+ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks.
levelchunk.runPostLoad();
+ } finally {
+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain.
+ }
if (this.entitiesInLevel.add(chunkpos.toLong())) {
levelchunk.setLoaded(true);
+ try {
+ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks.
levelchunk.registerAllBlockEntitiesAfterLevelLoad();
levelchunk.registerTickContainerInLevel(this.level);
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Load(levelchunk, !(protochunk instanceof ImposterProtoChunk)));
+ } finally {
+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain.
+ }
}

return levelchunk;
@@ -839,6 +_,7 @@

this.level.getProfiler().incrementCounter("chunkSave");
CompoundTag compoundtag = ChunkSerializer.write(this.level, p_140259_);
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Save(p_140259_, p_140259_.getLevel() != null ? p_140259_.getLevel() : this.level, compoundtag));
this.write(chunkpos, compoundtag).exceptionally(p_351776_ -> {
this.level.getServer().reportChunkSaveFailure(p_351776_, this.storageInfo(), chunkpos);
this.write(chunkpos, compoundtag).exceptionallyAsync(p_329914_ -> {
this.level.getServer().reportChunkSaveFailure(chunkpos);
return null;
@@ -817,9 +_,11 @@
@@ -901,9 +_,11 @@

private static void markChunkPendingToSend(ServerPlayer p_295834_, LevelChunk p_296281_) {
p_295834_.connection.chunkSender.markChunkPendingToSend(p_296281_);
Expand All @@ -40,15 +63,15 @@
p_294215_.connection.chunkSender.dropChunk(p_294215_, p_294758_);
}

@@ -1018,6 +_,7 @@
@@ -1102,6 +_,7 @@
this.playerMap.unIgnorePlayer(p_140185_);
}

+ //PATCH 1.20.2: Figure out the firing of the watch and unwatch events when chunk tracking updates.
this.updateChunkTracking(p_140185_);
}
}
@@ -1069,7 +_,7 @@
@@ -1153,7 +_,7 @@
}

protected void addEntity(Entity p_140200_) {
Expand All @@ -57,7 +80,7 @@
EntityType<?> entitytype = p_140200_.getType();
int i = entitytype.clientTrackingRange() * 16;
if (i != 0) {
@@ -1313,5 +_,20 @@
@@ -1397,5 +_,20 @@
this.updatePlayer(serverplayer);
}
}
Expand Down
Loading

0 comments on commit 383957f

Please sign in to comment.