From b2e3ae82eb25470ae634b1c8930e86fd16f7db28 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:39:03 -0400 Subject: [PATCH] Remove optimization that is obsolete in snapshots --- .../ticking_chunk_alloc/ChunkHolderMixin.java | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/ticking_chunk_alloc/ChunkHolderMixin.java diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/ticking_chunk_alloc/ChunkHolderMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/ticking_chunk_alloc/ChunkHolderMixin.java deleted file mode 100644 index 2ea7c2de..00000000 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/ticking_chunk_alloc/ChunkHolderMixin.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.embeddedt.modernfix.common.mixin.perf.ticking_chunk_alloc; - -import com.mojang.datafixers.util.Either; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.world.level.chunk.LevelChunk; -import org.embeddedt.modernfix.util.EitherUtil; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.concurrent.CompletableFuture; - -@Mixin(value = ChunkHolder.class, priority = 500) -public abstract class ChunkHolderMixin { - @Shadow public abstract CompletableFuture> getTickingChunkFuture(); - - @Shadow public abstract CompletableFuture> getFullChunkFuture(); - - /** - * @author embeddedt - * @reason avoid Optional allocation - */ - @Overwrite - public LevelChunk getTickingChunk() { - CompletableFuture> completableFuture = this.getTickingChunkFuture(); - Either either = completableFuture.getNow(null); - return either == null ? null : EitherUtil.leftOrNull(either); - } - - /** - * @author embeddedt - * @reason avoid Optional allocation - */ - @Overwrite - public LevelChunk getFullChunk() { - CompletableFuture> completableFuture = this.getFullChunkFuture(); - Either either = completableFuture.getNow(null); - return either == null ? null : EitherUtil.leftOrNull(either); - } -}