Backport Starlight patch to lazily init emptiness maps
This commit is contained in:
parent
274c41d637
commit
7df692da1a
|
|
@ -99,6 +99,7 @@ dependencies {
|
||||||
modCompileOnly("team.chisel.ctm:CTM:${ctm_version}")
|
modCompileOnly("team.chisel.ctm:CTM:${ctm_version}")
|
||||||
modCompileOnly("curse.maven:supermartijncore-454372:4455378")
|
modCompileOnly("curse.maven:supermartijncore-454372:4455378")
|
||||||
modCompileOnly("curse.maven:valhesiastructures-347488:3476252")
|
modCompileOnly("curse.maven:valhesiastructures-347488:3476252")
|
||||||
|
modCompileOnly files("deps/starlight-1.2.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
|
|
||||||
BIN
deps/starlight-1.2.jar
vendored
Normal file
BIN
deps/starlight-1.2.jar
vendored
Normal file
Binary file not shown.
|
|
@ -46,6 +46,7 @@ public class ModernFixEarlyConfig {
|
||||||
this.addMixinRule("perf.compress_blockstate", false);
|
this.addMixinRule("perf.compress_blockstate", false);
|
||||||
this.addMixinRule("bugfix.concurrency", true);
|
this.addMixinRule("bugfix.concurrency", true);
|
||||||
this.addMixinRule("bugfix.edge_chunk_not_saved", true);
|
this.addMixinRule("bugfix.edge_chunk_not_saved", true);
|
||||||
|
this.addMixinRule("bugfix.starlight_emptiness", modPresent("starlight"));
|
||||||
this.addMixinRule("bugfix.packet_leak", false);
|
this.addMixinRule("bugfix.packet_leak", false);
|
||||||
this.addMixinRule("perf.dynamic_structure_manager", true);
|
this.addMixinRule("perf.dynamic_structure_manager", true);
|
||||||
this.addMixinRule("bugfix.mc218112", true);
|
this.addMixinRule("bugfix.mc218112", true);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.embeddedt.modernfix.mixin.bugfix.starlight_emptiness;
|
||||||
|
|
||||||
|
import ca.spottedleaf.starlight.common.light.StarLightEngine;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
|
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||||
|
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(StarLightEngine.class)
|
||||||
|
public abstract class StarLightEngineMixin {
|
||||||
|
@Shadow protected abstract LevelChunkSection getChunkSection(int chunkX, int chunkY, int chunkZ);
|
||||||
|
|
||||||
|
@Shadow @Final protected int minSection;
|
||||||
|
|
||||||
|
@Inject(method = "handleEmptySectionChanges(Lnet/minecraft/world/level/chunk/LightChunkGetter;Lnet/minecraft/world/level/chunk/ChunkAccess;[Ljava/lang/Boolean;Z)[Z",
|
||||||
|
at = @At(value = "INVOKE", target = "Lca/spottedleaf/starlight/common/light/StarLightEngine;setEmptinessMapCache(II[Z)V",
|
||||||
|
shift = At.Shift.AFTER))
|
||||||
|
private void lazyInitMapIfNeeded(LightChunkGetter lightAccess, ChunkAccess chunk, Boolean[] emptinessChanges, boolean unlit, CallbackInfoReturnable<int[]> cir) {
|
||||||
|
final int chunkX = chunk.getPos().x;
|
||||||
|
final int chunkZ = chunk.getPos().z;
|
||||||
|
for (int sectionIndex = (emptinessChanges.length - 1); sectionIndex >= 0; --sectionIndex) {
|
||||||
|
if(emptinessChanges[sectionIndex] == null) {
|
||||||
|
final LevelChunkSection section = this.getChunkSection(chunkX, sectionIndex + this.minSection, chunkZ);
|
||||||
|
emptinessChanges[sectionIndex] = section == null || section.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
"refmap": "modernfix.refmap.json",
|
"refmap": "modernfix.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"bugfix.edge_chunk_not_saved.ChunkManagerMixin",
|
"bugfix.edge_chunk_not_saved.ChunkManagerMixin",
|
||||||
|
"bugfix.starlight_emptiness.StarLightEngineMixin",
|
||||||
"perf.dynamic_structure_manager.StructureManagerMixin",
|
"perf.dynamic_structure_manager.StructureManagerMixin",
|
||||||
"bugfix.tf_cme_on_load.TwilightForestModMixin",
|
"bugfix.tf_cme_on_load.TwilightForestModMixin",
|
||||||
"bugfix.refinedstorage.te_bug.ItemExternalStorageProviderMixin",
|
"bugfix.refinedstorage.te_bug.ItemExternalStorageProviderMixin",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user