-
Notifications
You must be signed in to change notification settings - Fork 1
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
16 changed files
with
111 additions
and
83 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
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: 0 additions & 12 deletions
12
src/main/java/me/jellysquid/mods/phosphor/mixins/ChunkSectionAccessor.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/main/java/me/jellysquid/mods/phosphor/mixins/PaletteContainerAccessor.java
This file was deleted.
Oops, something went wrong.
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
13 changes: 13 additions & 0 deletions
13
src/main/java/me/jellysquid/mods/phosphor/mixins/common/ClientChunkProviderAccessor.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,13 @@ | ||
package me.jellysquid.mods.phosphor.mixins.common; | ||
|
||
import net.minecraft.util.collection.LongObjectStorage; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.ClientChunkProvider; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(ClientChunkProvider.class) | ||
public interface ClientChunkProviderAccessor { | ||
@Accessor("chunkStorage") | ||
LongObjectStorage<Chunk> getChunkStorage(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/me/jellysquid/mods/phosphor/mixins/common/ServerChunkProviderAccessor.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,13 @@ | ||
package me.jellysquid.mods.phosphor.mixins.common; | ||
|
||
import net.minecraft.util.collection.LongObjectStorage; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.ServerChunkProvider; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(ServerChunkProvider.class) | ||
public interface ServerChunkProviderAccessor { | ||
@Accessor("chunkMap") | ||
LongObjectStorage<Chunk> getChunkStorage(); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/main/java/me/jellysquid/mods/phosphor/mod/world/ChunkHelper.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,26 @@ | ||
package me.jellysquid.mods.phosphor.mod.world; | ||
|
||
import me.jellysquid.mods.phosphor.mixins.common.ClientChunkProviderAccessor; | ||
import me.jellysquid.mods.phosphor.mixins.common.ServerChunkProviderAccessor; | ||
import net.minecraft.util.collection.LongObjectStorage; | ||
import net.minecraft.util.math.ChunkPos; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.ChunkProvider; | ||
import net.minecraft.world.chunk.ClientChunkProvider; | ||
import net.minecraft.world.chunk.ServerChunkProvider; | ||
|
||
public class ChunkHelper { | ||
public static Chunk getLoadedChunk(ChunkProvider chunkProvider, int x, int z) { | ||
if (chunkProvider instanceof ServerChunkProvider) { | ||
LongObjectStorage<Chunk> chunkStorage = ((ServerChunkProviderAccessor) chunkProvider).getChunkStorage(); | ||
return chunkStorage.get(ChunkPos.getIdFromCoords(x, z)); | ||
} | ||
if (chunkProvider instanceof ClientChunkProvider) { | ||
LongObjectStorage<Chunk> chunkStorage = ((ClientChunkProviderAccessor) chunkProvider).getChunkStorage(); | ||
return chunkStorage.get(ChunkPos.getIdFromCoords(x, z)); | ||
} | ||
|
||
// Fallback for other providers, hopefully this doesn't break... | ||
return chunkProvider.getChunk(x, z); | ||
} | ||
} |
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
Oops, something went wrong.