-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.20.4] Snapshot ModelDataManager in RenderChunkRegion instead of ex…
…posing original ModelDataManager owned by ClientLevel (#433)
- Loading branch information
Showing
8 changed files
with
224 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 27 additions & 5 deletions
32
patches/net/minecraft/client/renderer/chunk/RenderChunkRegion.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java | ||
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java | ||
@@ -74,4 +_,14 @@ | ||
@@ -20,12 +_,19 @@ | ||
private final int centerZ; | ||
protected final RenderChunk[][] chunks; | ||
protected final Level level; | ||
+ @Nullable | ||
+ private final net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot modelDataManager; | ||
|
||
+ @Deprecated | ||
RenderChunkRegion(Level p_200456_, int p_200457_, int p_200458_, RenderChunk[][] p_200459_) { | ||
+ this(p_200456_, p_200457_, p_200458_, p_200459_, null); | ||
+ } | ||
+ RenderChunkRegion(Level p_200456_, int p_200457_, int p_200458_, RenderChunk[][] p_200459_, @Nullable net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot modelDataManager) { | ||
this.level = p_200456_; | ||
this.centerX = p_200457_; | ||
this.centerZ = p_200458_; | ||
this.chunks = p_200459_; | ||
+ this.modelDataManager = modelDataManager; | ||
} | ||
|
||
@Override | ||
@@ -73,5 +_,16 @@ | ||
@Override | ||
public int getHeight() { | ||
return this.level.getHeight(); | ||
} | ||
+ } | ||
+ | ||
+ @Override | ||
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) { | ||
+ return this.level.getShade(normalX, normalY, normalZ, shade); | ||
+ } | ||
+ | ||
+ @Override | ||
+ public net.neoforged.neoforge.client.model.data.ModelDataManager getModelDataManager() { | ||
+ return level.getModelDataManager(); | ||
+ } | ||
+ @Nullable | ||
+ public net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot getModelDataManager() { | ||
+ return modelDataManager; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
patches/net/minecraft/client/renderer/chunk/RenderRegionCache.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/net/minecraft/client/renderer/chunk/RenderRegionCache.java | ||
+++ b/net/minecraft/client/renderer/chunk/RenderRegionCache.java | ||
@@ -44,7 +_,10 @@ | ||
} | ||
} | ||
|
||
- return new RenderChunkRegion(p_200466_, i, j, arenderchunk); | ||
+ int sectionMinY = SectionPos.blockToSectionCoord(p_200467_.getY() - p_200469_); | ||
+ int sectionMaxY = SectionPos.blockToSectionCoord(p_200468_.getY() + p_200469_); | ||
+ var modelDataManager = p_200466_.getModelDataManager().snapshotSectionRegion(i, sectionMinY, j, k, sectionMaxY, l); | ||
+ return new RenderChunkRegion(p_200466_, i, j, arenderchunk, modelDataManager); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.