-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sodium 0.5 support; bump version to 2.3.0-beta.5 (#778)
- Loading branch information
Showing
18 changed files
with
200 additions
and
295 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
12 changes: 7 additions & 5 deletions
12
common/src/main/java/org/valkyrienskies/mod/compat/SodiumCompat.java
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
51 changes: 43 additions & 8 deletions
51
common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/sodium/MixinChunkTracker.java
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,27 +1,62 @@ | ||
package org.valkyrienskies.mod.mixin.mod_compat.sodium; | ||
|
||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; | ||
import me.jellysquid.mods.sodium.client.render.chunk.ChunkTracker; | ||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; | ||
import it.unimi.dsi.fastutil.longs.LongSet; | ||
import me.jellysquid.mods.sodium.client.render.chunk.map.ChunkStatus; | ||
import me.jellysquid.mods.sodium.client.render.chunk.map.ChunkTracker; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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.CallbackInfo; | ||
import org.valkyrienskies.mod.common.VSGameUtilsKt; | ||
|
||
@Mixin(value = ChunkTracker.class, remap = false) | ||
@Mixin(ChunkTracker.class) | ||
public class MixinChunkTracker { | ||
|
||
@Shadow | ||
@Final | ||
private Long2IntOpenHashMap chunkStatus; | ||
|
||
@Shadow | ||
@Final | ||
private LongOpenHashSet chunkReady; | ||
|
||
@Shadow | ||
@Final | ||
private LongSet unloadQueue; | ||
|
||
@Shadow | ||
@Final | ||
private Long2IntOpenHashMap single; | ||
private LongSet loadQueue; | ||
|
||
@Inject(method = "updateMerged", at = @At("HEAD"), cancellable = true, remap = false) | ||
public void beforeUpdateMerged(final int x, final int z, final CallbackInfo ci) { | ||
final Level level = Minecraft.getInstance().level; | ||
if (level == null || !VSGameUtilsKt.isChunkInShipyard(level, x, z)) { | ||
return; | ||
} | ||
|
||
@Inject(method = "onLightDataAdded", at = @At("HEAD"), cancellable = true) | ||
private void cancelDataLight(final int x, final int z, final CallbackInfo ci) { | ||
final long key = ChunkPos.asLong(x, z); | ||
final int existingFlags = this.single.get(key); | ||
if ((existingFlags & 1) == 0) { | ||
ci.cancel(); // Cancel instead of throwing an error for now | ||
|
||
final int flags = this.chunkStatus.get(key); | ||
|
||
if (flags == ChunkStatus.FLAG_ALL) { | ||
if (this.chunkReady.add(key) && !this.unloadQueue.remove(key)) { | ||
this.loadQueue.add(key); | ||
} | ||
} else { | ||
if (this.chunkReady.remove(key) && !this.loadQueue.remove(key)) { | ||
this.unloadQueue.add(key); | ||
} | ||
} | ||
|
||
ci.cancel(); | ||
} | ||
|
||
} |
104 changes: 0 additions & 104 deletions
104
...rc/main/java/org/valkyrienskies/mod/mixin/mod_compat/sodium/MixinRegionChunkRenderer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.