Skip to content

Commit

Permalink
build: 1.20.2-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Sep 6, 2023
1 parent 590bf39 commit fdbc3bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
package com.ishland.c2me.notickvd.mixin;

import com.ishland.c2me.notickvd.common.IChunkHolder;
import com.mojang.datafixers.util.Either;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.WorldChunk;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.concurrent.CompletableFuture;

@Mixin(ChunkHolder.class)
public abstract class MixinChunkHolder implements IChunkHolder {
public abstract class MixinChunkHolder {

@Shadow public abstract CompletableFuture<Either<WorldChunk, ChunkHolder.Unloaded>> getAccessibleFuture();

@Shadow @Nullable public abstract WorldChunk getWorldChunk();

@Shadow public abstract ChunkPos getPos();

@Unique
@Override
public WorldChunk getAccessibleChunk() {
final Either<WorldChunk, ChunkHolder.Unloaded> either = this.getAccessibleFuture().getNow(null);
return either == null ? null : either.left().orElseGet(this::getWorldChunk);
}
@Shadow @Nullable public abstract WorldChunk getAccessibleChunk();

@Redirect(method = {"markForBlockUpdate", "markForLightUpdate"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ChunkHolder;getWorldChunk()Lnet/minecraft/world/chunk/WorldChunk;"), require = 2)
private WorldChunk redirectWorldChunk(ChunkHolder chunkHolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.ishland.c2me.base.mixin.access.IServerChunkManager;
import com.ishland.c2me.notickvd.common.Config;
import com.ishland.c2me.notickvd.common.IChunkHolder;
import com.ishland.c2me.notickvd.common.IChunkTicketManager;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.mojang.datafixers.util.Either;
Expand Down Expand Up @@ -37,16 +36,16 @@ public abstract class MixinThreadedAnvilChunkStorage {

@Shadow @Final private PlayerChunkWatchingManager playerChunkWatchingManager;

@Shadow(aliases = "method_53686") protected abstract void sendToPlayers(WorldChunk chunk);
@Shadow protected abstract void sendToPlayers(WorldChunk chunk);

@ModifyArg(method = "setViewDistance", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(III)I"), index = 2)
private int modifyMaxVD(int max) {
return 251;
}

@Redirect(method = "method_53688", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ChunkHolder;method_53682()Lnet/minecraft/world/chunk/WorldChunk;"))
@Redirect(method = "getPostProcessedChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ChunkHolder;getPostProcessedChunk()Lnet/minecraft/world/chunk/WorldChunk;"))
private WorldChunk redirectSendWatchPacketsGetWorldChunk(ChunkHolder chunkHolder) {
return ((IChunkHolder) chunkHolder).getAccessibleChunk();
return chunkHolder.getAccessibleChunk();
}

@Inject(method = "makeChunkAccessible", at = @At("RETURN"))
Expand All @@ -71,12 +70,12 @@ private void onMakeChunkAccessible(ChunkHolder chunkHolder, CallbackInfoReturnab
// this.sendChunkDataPackets(player, mutableObject, worldChunk);
// }

@WrapWithCondition(method = "method_53684", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;method_53686(Lnet/minecraft/world/chunk/WorldChunk;)V"))
@WrapWithCondition(method = "method_53684", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;sendToPlayers(Lnet/minecraft/world/chunk/WorldChunk;)V"))
private boolean controlDuplicateChunkSending(ThreadedAnvilChunkStorage instance, WorldChunk worldChunk) {
return Config.ensureChunkCorrectness;
}

@WrapWithCondition(method = "method_53687", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;method_53686(Lnet/minecraft/world/chunk/WorldChunk;)V"))
@WrapWithCondition(method = "method_53687", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;sendToPlayers(Lnet/minecraft/world/chunk/WorldChunk;)V"))
private boolean controlDuplicateChunkSending1(ThreadedAnvilChunkStorage instance, WorldChunk worldChunk) {
return Config.ensureChunkCorrectness; // TODO config set to false unfixes MC-264947
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=23w35a
yarn_mappings=23w35a+build.5
minecraft_version=1.20.2-pre1
yarn_mappings=1.20.2-pre1+build.3
loader_version=0.14.22
# Mod Properties
mod_version=0.2.0+alpha.10
Expand Down

0 comments on commit fdbc3bf

Please sign in to comment.