Skip to content

Commit

Permalink
Cleanup MixinAsyncChunk_ServerChunkManager
Browse files Browse the repository at this point in the history
  • Loading branch information
james58899 committed Aug 17, 2024
1 parent a004530 commit f15f2d5
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@

package one.oktw.galaxy.mixin.tweak;

import net.minecraft.server.world.ChunkHolder;
import net.minecraft.server.world.ServerChunkLoadingManager;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.*;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.ChunkGenerationStep;
import net.minecraft.world.chunk.ChunkGenerationSteps;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.WorldChunk;
import one.oktw.galaxy.mixin.accessor.ServerChunkLoadingManagerAccessor;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

Expand All @@ -38,10 +36,6 @@

@Mixin(ServerChunkManager.class)
public abstract class MixinAsyncChunk_ServerChunkManager {
// From ChunkLevels.class
@Unique
private static final ChunkGenerationStep FULL_GENERATION_STEP = ChunkGenerationSteps.GENERATION.get(ChunkStatus.FULL);

@Shadow
@Final
ServerWorld world;
Expand All @@ -59,7 +53,7 @@ public abstract class MixinAsyncChunk_ServerChunkManager {
*/
@Overwrite
public boolean isChunkLoaded(int x, int z) {
return !this.isMissingForLevel(this.getChunkHolder(ChunkPos.toLong(x, z)), 33 + FULL_GENERATION_STEP.getAdditionalLevel(ChunkStatus.FULL));
return !this.isMissingForLevel(this.getChunkHolder(ChunkPos.toLong(x, z)), ChunkLevels.getLevelFromStatus(ChunkStatus.FULL));
}

@Redirect(method = "tickChunks", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerChunkLoadingManager;entryIterator()Ljava/lang/Iterable;"))
Expand Down

0 comments on commit f15f2d5

Please sign in to comment.