Sodium breaking Revelationary Block Revealing
DaFuqs opened this issue · 5 comments
Version information
fabric-0.4.1
Expected Behavior
The mod Revelationary gates the drops & rendering of blocks via advancements.
For example an ore could look and drop like stone, as long as the player does not have a specific advancement.
As soon as the player get's that advancement, the block get's revealed and the player will be able to see and harvest it.
Technically speaking, Revelationary hooks Block.getModel() to return a different model, depending on the advancements of the player.
If the player get's an advancement that reveals new blocks, all chunks will be triggered to get rebuild, showing the newly revealed blocks.
Actual Behavior
With Sodium, these "instant revelations" / chunk rebuilds do not work. Chunks will only be rebuild after a player changes something in the chunk, like harvesting a close-by block, or placing a light.
Reproduction Steps
- Install Reveleationary 1.0.0, Spectrum 1.5.0 & Sodium 0.4.1.
- Look at one of Spectrums colored trees in the world (they will have the textures & color provider of oak trees)
- Give yourself all advancements via command
- The tree stays looking like an Oak Tree. Colored Leaves in the players hand show their new texture immediately.
- Break one of the leaves of the Tree
- Only now the tree changes textures to the colorful one
Java version
Java 17
CPU
AMD Ryzen 7 3700X
GPU
AMD Radeon RX 5700
Additional information
No response
Sodium "disables" vanilla chunk handling in the mixin method nullifyBuiltChunkStorage
:
Instead, you should use WorldRenderer::scheduleChunkRender(x, y, z, false);
or sibling methods for each chunk section to be reloaded.
I am not sure I got that correctly, but using scheduleChunkRender(x, y, z, false)
results in the same outcome. As before, blocks only update when broken/with light update.
static void rebuildAllChunks() {
World world = MinecraftClient.getInstance().world;
WorldRenderer worldRenderer = MinecraftClient.getInstance().worldRenderer;
WorldRendererMixinAccessor wra = (de.dafuqs.revelationary.mixin.client.WorldRendererMixinAccessor) worldRenderer;
for (ChunkBuilder.BuiltChunk chunk : wra.getChunks().chunks) {
int startY = world.getBottomSectionCoord();
int endY = world.getTopSectionCoord();
for (int y = startY; y <= endY; y++) {
wra.invokeScheduleChunkRender(
ChunkSectionPos.getSectionCoord(chunk.getOrigin().getX()), y, ChunkSectionPos.getSectionCoord(chunk.getOrigin().getZ()), false);
}
}
}
Fetching them from the chunk manager now. This, too, is kind of cursed, but ¯\_(ツ)_/¯
The way Sodium disables vanilla chunk handling it by setting the render distance to 0
. This means that wra.getChunks().chunks
is always empty so that loop never runs.