forked from CaffeineMC/lithium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/java/me/jellysquid/mods/lithium/common/world/ChunkView.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package me.jellysquid.mods.lithium.common.world; | ||
|
||
import net.minecraft.world.chunk.Chunk; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface ChunkView { | ||
|
||
@Nullable | ||
Chunk getLoadedChunk(int chunkX, int chunkZ); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/me/jellysquid/mods/lithium/mixin/util/chunk_access/ChunkCacheMixin.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package me.jellysquid.mods.lithium.mixin.util.chunk_access; | ||
|
||
import me.jellysquid.mods.lithium.common.world.ChunkView; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.ChunkCache; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(ChunkCache.class) | ||
public abstract class ChunkCacheMixin implements ChunkView { | ||
|
||
@Shadow | ||
protected abstract Chunk getChunk(int chunkX, int chunkZ); | ||
|
||
@Override | ||
public @Nullable Chunk getLoadedChunk(int chunkX, int chunkZ) { | ||
return this.getChunk(chunkX, chunkZ); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/me/jellysquid/mods/lithium/mixin/util/chunk_access/WorldViewMixin.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package me.jellysquid.mods.lithium.mixin.util.chunk_access; | ||
|
||
import me.jellysquid.mods.lithium.common.world.ChunkView; | ||
import net.minecraft.world.WorldView; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.ChunkStatus; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(WorldView.class) | ||
public interface WorldViewMixin extends ChunkView { | ||
|
||
@Shadow | ||
@Nullable Chunk getChunk(int var1, int var2, ChunkStatus var3, boolean var4); | ||
|
||
@Override | ||
default @Nullable Chunk getLoadedChunk(int chunkX, int chunkZ) { | ||
return this.getChunk(chunkX, chunkZ, ChunkStatus.FULL, false); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/me/jellysquid/mods/lithium/mixin/util/chunk_access/package-info.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@MixinConfigOption( | ||
description = "Access chunks of worlds, chunk caches and chunk regions directly." | ||
) | ||
package me.jellysquid.mods.lithium.mixin.util.chunk_access; | ||
|
||
import net.caffeinemc.gradle.MixinConfigOption; |
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