Skip to content

Commit 75ff154

Browse files
committed
Mark the section compile optimization as not required for better compat
1 parent 4946445 commit 75ff154

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/chunk_meshing/RebuildTaskMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
import net.minecraft.client.renderer.chunk.RenderChunkRegion;
55
import net.minecraft.core.BlockPos;
66
import net.minecraft.world.level.block.state.BlockState;
7+
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
78
import org.embeddedt.modernfix.util.blockpos.SectionBlockPosIterator;
89
import org.spongepowered.asm.mixin.Mixin;
910
import org.spongepowered.asm.mixin.injection.At;
1011
import org.spongepowered.asm.mixin.injection.Redirect;
1112

1213
@Mixin(targets = { "net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$RebuildTask"}, priority = 2000)
14+
@ClientOnlyMixin
1315
public class RebuildTaskMixin {
1416
/**
1517
* @author embeddedt
1618
* @reason Use a much faster iterator implementation than vanilla's Guava-based one.
1719
*/
18-
@Redirect(method = "compile", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;betweenClosed(Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)Ljava/lang/Iterable;"))
20+
@Redirect(method = "compile", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;betweenClosed(Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)Ljava/lang/Iterable;"), require = 0)
1921
private Iterable<BlockPos> fastBetweenClosed(BlockPos firstPos, BlockPos secondPos) {
2022
return () -> new SectionBlockPosIterator(firstPos);
2123
}
@@ -24,7 +26,7 @@ private Iterable<BlockPos> fastBetweenClosed(BlockPos firstPos, BlockPos secondP
2426
* @author embeddedt
2527
* @reason RenderChunkRegion.getBlockState is expensive, avoid calling it multiple times for the same position
2628
*/
27-
@Redirect(method = "compile", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/chunk/RenderChunkRegion;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", ordinal = 1))
29+
@Redirect(method = "compile", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/chunk/RenderChunkRegion;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", ordinal = 1), require = 0)
2830
private BlockState useExistingBlockState(RenderChunkRegion instance, BlockPos pos, @Local(ordinal = 0) BlockState state) {
2931
return state;
3032
}

0 commit comments

Comments
 (0)