diff --git a/gradle.properties b/gradle.properties index 442a9e6..77d7a24 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=net.gensokyoreimagined.nitori -version=1.5-SNAPSHOT +version=1.6-SNAPSHOT description=Converting patches into mixins, for the Ignite Framework org.gradle.parallel=true diff --git a/src/main/java/net/gensokyoreimagined/nitori/access/ITypeFilterableList.java b/src/main/java/net/gensokyoreimagined/nitori/access/ITypeFilterableList.java deleted file mode 100644 index 57583d2..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/access/ITypeFilterableList.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.gensokyoreimagined.nitori.access; - -public interface ITypeFilterableList { - - Object[] getBackingArray(); - - -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/common/chunkwatching/PlayerClientVDTracking.java b/src/main/java/net/gensokyoreimagined/nitori/common/chunkwatching/PlayerClientVDTracking.java index 251fba9..02d2192 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/common/chunkwatching/PlayerClientVDTracking.java +++ b/src/main/java/net/gensokyoreimagined/nitori/common/chunkwatching/PlayerClientVDTracking.java @@ -1,9 +1,9 @@ package net.gensokyoreimagined.nitori.common.chunkwatching; -public interface PlayerClientVDTracking { - - boolean isClientViewDistanceChanged(); - - int getClientViewDistance(); - -} \ No newline at end of file +//public interface PlayerClientVDTracking { +// +// boolean isClientViewDistanceChanged(); +// +// int getClientViewDistance(); +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/common/world/chunk/ChunkStatusTracker.java b/src/main/java/net/gensokyoreimagined/nitori/common/world/chunk/ChunkStatusTracker.java index 85e5d17..4281087 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/common/world/chunk/ChunkStatusTracker.java +++ b/src/main/java/net/gensokyoreimagined/nitori/common/world/chunk/ChunkStatusTracker.java @@ -1,26 +1,26 @@ package net.gensokyoreimagined.nitori.common.world.chunk; -import net.minecraft.server.level.FullChunkStatus; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; - -import java.util.ArrayList; -import java.util.function.BiConsumer; - -public class ChunkStatusTracker { - - //Add other callback types in the future when needed - private static final ArrayList> UNLOAD_CALLBACKS = new ArrayList<>(); - public static void onChunkStatusChange(ServerLevel serverWorld, ChunkPos pos, FullChunkStatus levelType) { - boolean loaded = levelType.isOrAfter(FullChunkStatus.FULL); - if (!loaded) { - for (int i = 0; i < UNLOAD_CALLBACKS.size(); i++) { - UNLOAD_CALLBACKS.get(i).accept(serverWorld, pos); - } - } - } - - public static void registerUnloadCallback(BiConsumer callback) { - UNLOAD_CALLBACKS.add(callback); - } -} \ No newline at end of file +//import net.minecraft.server.level.FullChunkStatus; +//import net.minecraft.server.level.ServerLevel; +//import net.minecraft.world.level.ChunkPos; +// +//import java.util.ArrayList; +//import java.util.function.BiConsumer; +// +//public class ChunkStatusTracker { +// +// //Add other callback types in the future when needed +// private static final ArrayList> UNLOAD_CALLBACKS = new ArrayList<>(); +// public static void onChunkStatusChange(ServerLevel serverWorld, ChunkPos pos, FullChunkStatus levelType) { +// boolean loaded = levelType.isOrAfter(FullChunkStatus.FULL); +// if (!loaded) { +// for (int i = 0; i < UNLOAD_CALLBACKS.size(); i++) { +// UNLOAD_CALLBACKS.get(i).accept(serverWorld, pos); +// } +// } +// } +// +// public static void registerUnloadCallback(BiConsumer callback) { +// UNLOAD_CALLBACKS.add(callback); +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/common/world/listeners/WorldBorderListenerOnce.java b/src/main/java/net/gensokyoreimagined/nitori/common/world/listeners/WorldBorderListenerOnce.java new file mode 100644 index 0000000..2dedc4f --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/common/world/listeners/WorldBorderListenerOnce.java @@ -0,0 +1,48 @@ +package net.gensokyoreimagined.nitori.common.world.listeners; + +import net.minecraft.world.level.border.WorldBorder; +import net.minecraft.world.level.border.BorderChangeListener; + +public interface WorldBorderListenerOnce extends BorderChangeListener { + + void lithium$onWorldBorderShapeChange(WorldBorder worldBorder); + + default void onAreaReplaced(WorldBorder border) { + this.lithium$onWorldBorderShapeChange(border); + } + + @Override + default void onBorderSizeSet(WorldBorder border, double size) { + this.lithium$onWorldBorderShapeChange(border); + } + + @Override + default void onBorderSizeLerping(WorldBorder border, double fromSize, double toSize, long time) { + this.lithium$onWorldBorderShapeChange(border); + } + + @Override + default void onBorderCenterSet(WorldBorder border, double centerX, double centerZ) { + this.lithium$onWorldBorderShapeChange(border); + } + + @Override + default void onBorderSetWarningTime(WorldBorder border, int warningTime) { + + } + + @Override + default void onBorderSetWarningBlocks(WorldBorder border, int warningBlockDistance) { + + } + + @Override + default void onBorderSetDamagePerBlock(WorldBorder border, double damagePerBlock) { + + } + + @Override + default void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) { + + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/MixinEntityTickList.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/MixinEntityTickList.java deleted file mode 100644 index 805a458..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/MixinEntityTickList.java +++ /dev/null @@ -1,70 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin; - -import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.entity.EntityTickList; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.function.Consumer; - -@Mixin(EntityTickList.class) -public class MixinEntityTickList { - @Unique - private Int2ObjectLinkedOpenHashMap nitori$entities = new Int2ObjectLinkedOpenHashMap<>(); - @Unique - private Int2ObjectLinkedOpenHashMap nitori$iteratorPointer = null; - - // I've decided I hate Paper's design. - // All of these are effectively Overwrites. - - @Unique - private void nitori$ensureActiveIsNotIterated() { - if (nitori$iteratorPointer == nitori$entities) { - // Avoid a ConcurrentModificationException by cloning the map before modifying it. - // Side effect is that it allocates more memory to avoid blocking the main thread, but it's all pointers anyway. - nitori$entities = nitori$entities.clone(); - } - } - - @Inject(method = "add", at = @At("HEAD"), cancellable = true) - public void add(Entity entity, CallbackInfo ci) { - nitori$ensureActiveIsNotIterated(); - nitori$entities.put(entity.getId(), entity); - ci.cancel(); - } - - @Inject(method = "remove", at = @At("HEAD"), cancellable = true) - public void remove(Entity entity, CallbackInfo ci) { - nitori$ensureActiveIsNotIterated(); - nitori$entities.remove(entity.getId()); - ci.cancel(); - } - - @Inject(method = "contains", at = @At("HEAD"), cancellable = true) - public void contains(Entity entity, CallbackInfoReturnable ci) { - ci.setReturnValue(nitori$entities.containsKey(entity.getId())); - ci.cancel(); - } - - @Inject(method = "forEach", at = @At("HEAD"), cancellable = true) - public void forEach(Consumer action, CallbackInfo ci) { - if (nitori$iteratorPointer == nitori$entities) { - nitori$entities = nitori$entities.clone(); // Avoid a ConcurrentModificationException by cloning the map before iterating over it. - } - - nitori$iteratorPointer = nitori$entities; // Mark the map as being iterated. - - try { - nitori$iteratorPointer.values().forEach(action); // Iterate over the map. - } finally { - nitori$iteratorPointer = null; // Mark the map as no longer being iterated. - } - - ci.cancel(); - } -} diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/alloc/chunk_random/WorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/alloc/chunk_random/WorldMixin.java deleted file mode 100644 index 00c1911..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/alloc/chunk_random/WorldMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.alloc.chunk_random; - -import net.gensokyoreimagined.nitori.common.world.ChunkRandomSource; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(Level.class) -public class WorldMixin implements ChunkRandomSource { - @Shadow - protected int randValue; - - /** - * {@inheritDoc} - */ - @Override - public void nitori$getRandomPosInChunk(int x, int y, int z, int mask, BlockPos.MutableBlockPos out) { - this.randValue = this.randValue * 3 + 1013904223; - int rand = this.randValue >> 2; - out.set(x + (rand & 15), y + (rand >> 16 & mask), z + (rand >> 8 & 15)); - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/collections/goals/GoalSelectorMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/collections/goals/GoalSelectorMixin.java deleted file mode 100644 index b5a5ed7..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/collections/goals/GoalSelectorMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.collections.goals; - -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -import net.minecraft.world.entity.ai.goal.GoalSelector; -import net.minecraft.world.entity.ai.goal.WrappedGoal; -import net.minecraft.util.profiling.ProfilerFiller; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.Set; -import java.util.function.Supplier; - -@Mixin(GoalSelector.class) -public abstract class GoalSelectorMixin { - - @Mutable - @Shadow - @Final - private Set availableGoals; - - /** - * Replace the goal set with an optimized collection type which performs better for iteration. - */ - @Inject(method = "", at = @At("RETURN")) - private void reinit(Supplier supplier, CallbackInfo ci) { - this.availableGoals = new ObjectLinkedOpenHashSet<>(this.availableGoals); - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/EntityNavigationMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/EntityNavigationMixin.java deleted file mode 100644 index 5f9bb3c..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/EntityNavigationMixin.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.entity.inactive_navigations; - -import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; -import net.gensokyoreimagined.nitori.common.world.ServerWorldExtended; -import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.level.pathfinder.Path; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(PathNavigation.class) -public abstract class EntityNavigationMixin { - - @Shadow - @Final - protected Level level; - - @Shadow - protected Path path; - - @Shadow - @Final - protected Mob mob; - - @Inject( - method = "recomputePath", - at = @At( - value = "INVOKE_ASSIGN", - target = "Lnet/minecraft/world/entity/ai/navigation/PathNavigation;createPath(Lnet/minecraft/core/BlockPos;I)Lnet/minecraft/world/level/pathfinder/Path;", - shift = At.Shift.AFTER - ) - ) - private void updateListeningState(CallbackInfo ci) { - if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { - if (this.path == null) { - ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); - } else { - ((ServerWorldExtended) this.level).lithium$setNavigationActive(this.mob); - } - } - } - - @Inject(method = "moveTo(Lnet/minecraft/world/level/pathfinder/Path;D)Z", at = @At(value = "RETURN")) - private void updateListeningState2(Path path, double speed, CallbackInfoReturnable cir) { - if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { - if (this.path == null) { - ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); - } else { - ((ServerWorldExtended) this.level).lithium$setNavigationActive(this.mob); - } - } - } - - @Inject(method = "stop", at = @At(value = "RETURN")) - private void stopListening(CallbackInfo ci) { - if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { - ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); - } - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/MobEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/MobEntityMixin.java deleted file mode 100644 index 4baeabe..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/MobEntityMixin.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.entity.inactive_navigations; - -import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; -import net.gensokyoreimagined.nitori.common.world.ServerWorldExtended; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.Intrinsic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(Mob.class) -public abstract class MobEntityMixin extends Entity implements NavigatingEntity { - private PathNavigation nitori$registeredNavigation; - - public MobEntityMixin(EntityType type, Level world) { - super(type, world); - } - - @Shadow - public abstract PathNavigation getNavigation(); - - @Override - public boolean lithium$isRegisteredToWorld() { - return this.nitori$registeredNavigation != null; - } - - @Override - public void lithium$setRegisteredToWorld(PathNavigation navigation) { - this.nitori$registeredNavigation = navigation; - } - - @Override - public PathNavigation lithium$getRegisteredNavigation() { - return this.nitori$registeredNavigation; - } - - @Inject(method = "startRiding", at = @At("RETURN")) - private void onNavigationReplacement(Entity entity, boolean force, CallbackInfoReturnable cir) { - this.lithium$updateNavigationRegistration(); - } - - @Override - @Intrinsic - public void stopRiding() { - super.stopRiding(); - } - - @SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"}) - @Inject(method = "stopRiding()V", at = @At("RETURN")) - private void updateOnStopRiding(CallbackInfo ci) { - this.lithium$updateNavigationRegistration(); - } - - @Override - public void lithium$updateNavigationRegistration() { - if (this.lithium$isRegisteredToWorld()) { - PathNavigation navigation = this.getNavigation(); - if (this.nitori$registeredNavigation != navigation) { - ((ServerWorldExtended) this.level()).lithium$setNavigationInactive((Mob) (Object) this); - this.nitori$registeredNavigation = navigation; - - if (navigation.getPath() != null) { - ((ServerWorldExtended) this.level()).lithium$setNavigationActive((Mob) (Object) this); - } - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java deleted file mode 100644 index 257d81c..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.logic.fast_bits_blockpos; - -import net.minecraft.core.SectionPos; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(SectionPos.class) -public interface ChunkSectionPosAccessor { - @Invoker("") - public static SectionPos invokeChunkSectionPos(int i, int j, int k) { - throw new AssertionError(); - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java deleted file mode 100644 index 10a259e..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.logic.fast_bits_blockpos; - -import net.minecraft.core.BlockPos; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -/** - * Credit to PaperMC Patch #0421 - */ -@Mixin(BlockPos.class) -public class OptimizedBlockPosBitsMixin { - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static long offset(long value, int x, int y, int z) { - return asLong((int) (value >> 38) + x, (int) ((value << 52) >> 52) + y, (int) ((value << 26) >> 38) + z); - } - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static int getX(long packedPos) { - return (int) (packedPos >> 38); - } - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static int getY(long packedPos) { - return (int) ((packedPos << 52) >> 52); - } - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static int getZ(long packedPos) { - return (int) ((packedPos << 26) >> 38); - } - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static BlockPos of(long packedPos) { - return new BlockPos((int) (packedPos >> 38), (int) ((packedPos << 52) >> 52), (int) ((packedPos << 26) >> 38)); - } - - /** - * @author QPCrummer - * @reason Inline - */ - @Overwrite - public static long asLong(int x, int y, int z) { - return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); - } - -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/BlockPosMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/BlockPosMixin.java deleted file mode 100644 index 62ce3ec..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/BlockPosMixin.java +++ /dev/null @@ -1,127 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.math.fast_blockops; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - - -@Mixin(BlockPos.class) -public abstract class BlockPosMixin extends Vec3i { - - public BlockPosMixin(int x, int y, int z) { - super(x, y, z); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Override - @Overwrite - public BlockPos above() { - return new BlockPos(this.getX(), this.getY() + 1, this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Override - @Overwrite - public BlockPos above(int distance) { - return new BlockPos(this.getX(), this.getY() + distance, this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Override - @Overwrite - public BlockPos below() { - return new BlockPos(this.getX(), this.getY() - 1, this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Override - @Overwrite - public BlockPos below(int distance) { - return new BlockPos(this.getX(), this.getY() - distance, this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos north() { - return new BlockPos(this.getX(), this.getY(), this.getZ() - 1); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos north(int distance) { - return new BlockPos(this.getX(), this.getY(), this.getZ() - distance); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos south() { - return new BlockPos(this.getX(), this.getY(), this.getZ() + 1); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos south(int distance) { - return new BlockPos(this.getX(), this.getY(), this.getZ() + distance); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos west() { - return new BlockPos(this.getX() - 1, this.getY(), this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos west(int distance) { - return new BlockPos(this.getX() - distance, this.getY(), this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos east() { - return new BlockPos(this.getX() + 1, this.getY(), this.getZ()); - } - - /** - * @author JellySquid - * @reason Simplify and inline - */ - @Overwrite - public BlockPos east(int distance) { - return new BlockPos(this.getX() + distance, this.getY(), this.getZ()); - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/DirectionMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/DirectionMixin.java deleted file mode 100644 index 6f41cff..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/fast_blockops/DirectionMixin.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.math.fast_blockops; - -import net.minecraft.core.Direction; -import net.minecraft.core.Vec3i; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -/** - * The vector of each Direction is usually stored inside another object, which introduces indirection and makes things - * harder for the JVM to optimize. This patch simply hoists the offset fields to the Direction enum itself. - */ -@Mixin(Direction.class) -public class DirectionMixin { - @Unique - private int nitori$getStepX, nitori$getStepY, nitori$getStepZ; - - @Inject(method = "", at = @At("RETURN")) - private void reinit(String enumName, int ordinal, int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector, CallbackInfo ci) { - this.nitori$getStepX = vector.getX(); - this.nitori$getStepY = vector.getY(); - this.nitori$getStepZ = vector.getZ(); - } - - /** - * @reason Avoid indirection to aid inlining - * @author JellySquid - */ - @Overwrite - public int getStepX() { - return this.nitori$getStepX; - } - - /** - * @reason Avoid indirection to aid inlining - * @author JellySquid - */ - @Overwrite - public int getStepY() { - return this.nitori$getStepY; - } - - /** - * @reason Avoid indirection to aid inlining - * @author JellySquid - */ - @Overwrite - public int getStepZ() { - return this.nitori$getStepZ; - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomMixin.java deleted file mode 100644 index f1570fa..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.math.random; - -import net.gensokyoreimagined.nitori.common.math.random.RandomGeneratorRandom; -import io.netty.util.internal.ThreadLocalRandom; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.levelgen.RandomSupport; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(RandomSource.class) -public interface RandomMixin { - @Inject(method = "create(J)Lnet/minecraft/util/RandomSource;", at = @At(value = "HEAD"), cancellable = true) - private static void fasterrandom$createInject(long seed, @NotNull CallbackInfoReturnable cir) { - cir.setReturnValue(new RandomGeneratorRandom(seed)); - } - - @Inject(method = "createNewThreadLocalInstance", at = @At(value = "HEAD"), cancellable = true) - private static void fasterrandom$createLocalInject(@NotNull CallbackInfoReturnable cir) { - cir.setReturnValue(new RandomGeneratorRandom(ThreadLocalRandom.current().nextLong())); - } - - @Inject(method = "createThreadSafe", at = @At(value = "HEAD"), cancellable = true) - private static void fasterrandom$createThreadSafeInject(@NotNull CallbackInfoReturnable cir) { - cir.setReturnValue(new RandomGeneratorRandom(RandomSupport.generateUniqueSeed())); - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/entity/move_zero_velocity/MixinEntity.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/network/move_zero_velocity/MixinEntity.java similarity index 93% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/entity/move_zero_velocity/MixinEntity.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/network/move_zero_velocity/MixinEntity.java index e21d7b5..cd53b67 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/entity/move_zero_velocity/MixinEntity.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/network/move_zero_velocity/MixinEntity.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.vmp.entity.move_zero_velocity; +package net.gensokyoreimagined.nitori.mixin.network.move_zero_velocity; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.MoverType; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/MixinEntityTickList.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/MixinEntityTickList.java new file mode 100644 index 0000000..4429258 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/MixinEntityTickList.java @@ -0,0 +1,70 @@ +package net.gensokyoreimagined.nitori.mixin.removed; + +//import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.level.entity.EntityTickList; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Unique; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//import java.util.function.Consumer; +// +//@Mixin(EntityTickList.class) +//public class MixinEntityTickList { +// @Unique +// private Int2ObjectLinkedOpenHashMap nitori$entities = new Int2ObjectLinkedOpenHashMap<>(); +// @Unique +// private Int2ObjectLinkedOpenHashMap nitori$iteratorPointer = null; +// +// // I've decided I hate Paper's design. +// // All of these are effectively Overwrites. +// +// @Unique +// private void nitori$ensureActiveIsNotIterated() { +// if (nitori$iteratorPointer == nitori$entities) { +// // Avoid a ConcurrentModificationException by cloning the map before modifying it. +// // Side effect is that it allocates more memory to avoid blocking the main thread, but it's all pointers anyway. +// nitori$entities = nitori$entities.clone(); +// } +// } +// +// @Inject(method = "add", at = @At("HEAD"), cancellable = true) +// public void add(Entity entity, CallbackInfo ci) { +// nitori$ensureActiveIsNotIterated(); +// nitori$entities.put(entity.getId(), entity); +// ci.cancel(); +// } +// +// @Inject(method = "remove", at = @At("HEAD"), cancellable = true) +// public void remove(Entity entity, CallbackInfo ci) { +// nitori$ensureActiveIsNotIterated(); +// nitori$entities.remove(entity.getId()); +// ci.cancel(); +// } +// +// @Inject(method = "contains", at = @At("HEAD"), cancellable = true) +// public void contains(Entity entity, CallbackInfoReturnable ci) { +// ci.setReturnValue(nitori$entities.containsKey(entity.getId())); +// ci.cancel(); +// } +// +// @Inject(method = "forEach", at = @At("HEAD"), cancellable = true) +// public void forEach(Consumer action, CallbackInfo ci) { +// if (nitori$iteratorPointer == nitori$entities) { +// nitori$entities = nitori$entities.clone(); // Avoid a ConcurrentModificationException by cloning the map before iterating over it. +// } +// +// nitori$iteratorPointer = nitori$entities; // Mark the map as being iterated. +// +// try { +// nitori$iteratorPointer.values().forEach(action); // Iterate over the map. +// } finally { +// nitori$iteratorPointer = null; // Mark the map as no longer being iterated. +// } +// +// ci.cancel(); +// } +//} diff --git a/src/main/java/net/gensokyoreimagined/nitori/access/IMixinChunkEntitySlicesAccess.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinChunkEntitySlicesAccess.java similarity index 93% rename from src/main/java/net/gensokyoreimagined/nitori/access/IMixinChunkEntitySlicesAccess.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinChunkEntitySlicesAccess.java index c554562..fc80645 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/access/IMixinChunkEntitySlicesAccess.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinChunkEntitySlicesAccess.java @@ -12,7 +12,7 @@ // // You should have received a copy of the GNU General Public License // along with this program. If not, see . -package net.gensokyoreimagined.nitori.access; +package net.gensokyoreimagined.nitori.mixin.removed.access; //import ca.spottedleaf.moonrise.common.list.EntityList; // diff --git a/src/main/java/net/gensokyoreimagined/nitori/access/IMixinIteratorSafeOrderedReferenceSetAccess.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinIteratorSafeOrderedReferenceSetAccess.java similarity index 93% rename from src/main/java/net/gensokyoreimagined/nitori/access/IMixinIteratorSafeOrderedReferenceSetAccess.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinIteratorSafeOrderedReferenceSetAccess.java index e71d1c5..bc5b8fe 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/access/IMixinIteratorSafeOrderedReferenceSetAccess.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/IMixinIteratorSafeOrderedReferenceSetAccess.java @@ -12,7 +12,7 @@ // // You should have received a copy of the GNU General Public License // along with this program. If not, see . -package net.gensokyoreimagined.nitori.access; +package net.gensokyoreimagined.nitori.mixin.removed.access; //public interface IMixinIteratorSafeOrderedReferenceSetAccess { // @SuppressWarnings("EmptyMethod") diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/ITypeFilterableList.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/ITypeFilterableList.java new file mode 100644 index 0000000..f1727bc --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/access/ITypeFilterableList.java @@ -0,0 +1,8 @@ +package net.gensokyoreimagined.nitori.mixin.removed.access; + +//public interface ITypeFilterableList { +// +// Object[] getBackingArray(); +// +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/alloc/chunk_random/ServerWorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/ServerWorldMixin.java similarity index 97% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/alloc/chunk_random/ServerWorldMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/ServerWorldMixin.java index 1665522..e56ce72 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/alloc/chunk_random/ServerWorldMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/ServerWorldMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.unapplied.alloc.chunk_random; +package net.gensokyoreimagined.nitori.mixin.removed.alloc.chunk_random; //import net.gensokyoreimagined.nitori.common.world.ChunkRandomSource; //import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/WorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/WorldMixin.java new file mode 100644 index 0000000..00015ef --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/alloc/chunk_random/WorldMixin.java @@ -0,0 +1,23 @@ +package net.gensokyoreimagined.nitori.mixin.removed.alloc.chunk_random; + +//import net.gensokyoreimagined.nitori.common.world.ChunkRandomSource; +//import net.minecraft.core.BlockPos; +//import net.minecraft.world.level.Level; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +// +//@Mixin(Level.class) +//public class WorldMixin implements ChunkRandomSource { +// @Shadow +// protected int randValue; +// +// /** +// * {@inheritDoc} +// */ +// @Override +// public void nitori$getRandomPosInChunk(int x, int y, int z, int mask, BlockPos.MutableBlockPos out) { +// this.randValue = this.randValue * 3 + 1013904223; +// int rand = this.randValue >> 2; +// out.set(x + (rand & 15), y + (rand >> 16 & mask), z + (rand >> 8 & 15)); +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/collections/goals/GoalSelectorMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/collections/goals/GoalSelectorMixin.java new file mode 100644 index 0000000..899d151 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/collections/goals/GoalSelectorMixin.java @@ -0,0 +1,33 @@ +package net.gensokyoreimagined.nitori.mixin.removed.collections.goals; + +//import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; +//import net.minecraft.world.entity.ai.goal.GoalSelector; +//import net.minecraft.world.entity.ai.goal.WrappedGoal; +//import net.minecraft.util.profiling.ProfilerFiller; +//import org.spongepowered.asm.mixin.Final; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Mutable; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//import java.util.Set; +//import java.util.function.Supplier; +// +//@Mixin(GoalSelector.class) +//public abstract class GoalSelectorMixin { +// +// @Mutable +// @Shadow +// @Final +// private Set availableGoals; +// +// /** +// * Replace the goal set with an optimized collection type which performs better for iteration. +// */ +// @Inject(method = "", at = @At("RETURN")) +// private void reinit(Supplier supplier, CallbackInfo ci) { +// this.availableGoals = new ObjectLinkedOpenHashSet<>(this.availableGoals); +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/EntityNavigationMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/EntityNavigationMixin.java new file mode 100644 index 0000000..1f422c4 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/EntityNavigationMixin.java @@ -0,0 +1,66 @@ +package net.gensokyoreimagined.nitori.mixin.removed.entity.inactive_navigations; + +//import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; +//import net.gensokyoreimagined.nitori.common.world.ServerWorldExtended; +//import net.minecraft.world.entity.ai.navigation.PathNavigation; +//import net.minecraft.world.level.pathfinder.Path; +//import net.minecraft.world.entity.Mob; +//import net.minecraft.world.level.Level; +//import org.spongepowered.asm.mixin.Final; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//@Mixin(PathNavigation.class) +//public abstract class EntityNavigationMixin { +// +// @Shadow +// @Final +// protected Level level; +// +// @Shadow +// protected Path path; +// +// @Shadow +// @Final +// protected Mob mob; +// +// @Inject( +// method = "recomputePath", +// at = @At( +// value = "INVOKE_ASSIGN", +// target = "Lnet/minecraft/world/entity/ai/navigation/PathNavigation;createPath(Lnet/minecraft/core/BlockPos;I)Lnet/minecraft/world/level/pathfinder/Path;", +// shift = At.Shift.AFTER +// ) +// ) +// private void updateListeningState(CallbackInfo ci) { +// if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { +// if (this.path == null) { +// ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); +// } else { +// ((ServerWorldExtended) this.level).lithium$setNavigationActive(this.mob); +// } +// } +// } +// +// @Inject(method = "moveTo(Lnet/minecraft/world/level/pathfinder/Path;D)Z", at = @At(value = "RETURN")) +// private void updateListeningState2(Path path, double speed, CallbackInfoReturnable cir) { +// if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { +// if (this.path == null) { +// ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); +// } else { +// ((ServerWorldExtended) this.level).lithium$setNavigationActive(this.mob); +// } +// } +// } +// +// @Inject(method = "stop", at = @At(value = "RETURN")) +// private void stopListening(CallbackInfo ci) { +// if (((NavigatingEntity) this.mob).lithium$isRegisteredToWorld()) { +// ((ServerWorldExtended) this.level).lithium$setNavigationInactive(this.mob); +// } +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/MobEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/MobEntityMixin.java new file mode 100644 index 0000000..68e30e3 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/MobEntityMixin.java @@ -0,0 +1,76 @@ +package net.gensokyoreimagined.nitori.mixin.removed.entity.inactive_navigations; + +//import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; +//import net.gensokyoreimagined.nitori.common.world.ServerWorldExtended; +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.ai.navigation.PathNavigation; +//import net.minecraft.world.entity.Mob; +//import net.minecraft.world.level.Level; +//import org.spongepowered.asm.mixin.Intrinsic; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//@Mixin(Mob.class) +//public abstract class MobEntityMixin extends Entity implements NavigatingEntity { +// private PathNavigation nitori$registeredNavigation; +// +// public MobEntityMixin(EntityType type, Level world) { +// super(type, world); +// } +// +// @Shadow +// public abstract PathNavigation getNavigation(); +// +// @Override +// public boolean lithium$isRegisteredToWorld() { +// return this.nitori$registeredNavigation != null; +// } +// +// @Override +// public void lithium$setRegisteredToWorld(PathNavigation navigation) { +// this.nitori$registeredNavigation = navigation; +// } +// +// @Override +// public PathNavigation lithium$getRegisteredNavigation() { +// return this.nitori$registeredNavigation; +// } +// +// @Inject(method = "startRiding", at = @At("RETURN")) +// private void onNavigationReplacement(Entity entity, boolean force, CallbackInfoReturnable cir) { +// this.lithium$updateNavigationRegistration(); +// } +// +// @Override +// @Intrinsic +// public void stopRiding() { +// super.stopRiding(); +// } +// +// @SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"}) +// @Inject(method = "stopRiding()V", at = @At("RETURN")) +// private void updateOnStopRiding(CallbackInfo ci) { +// this.lithium$updateNavigationRegistration(); +// } +// +// @Override +// public void lithium$updateNavigationRegistration() { +// if (this.lithium$isRegisteredToWorld()) { +// PathNavigation navigation = this.getNavigation(); +// if (this.nitori$registeredNavigation != navigation) { +// ((ServerWorldExtended) this.level()).lithium$setNavigationInactive((Mob) (Object) this); +// this.nitori$registeredNavigation = navigation; +// +// if (navigation.getPath() != null) { +// ((ServerWorldExtended) this.level()).lithium$setNavigationActive((Mob) (Object) this); +// } +// } +// } +// } +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerEntityHandlerMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerEntityHandlerMixin.java similarity index 96% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerEntityHandlerMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerEntityHandlerMixin.java index 920a5ae..543c18b 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerEntityHandlerMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerEntityHandlerMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.entity.inactive_navigations; +package net.gensokyoreimagined.nitori.mixin.removed.entity.inactive_navigations; //import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; //import net.gensokyoreimagined.nitori.common.world.ServerWorldExtended; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerWorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerWorldMixin.java similarity index 98% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerWorldMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerWorldMixin.java index 00cf60e..9ff923e 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/entity/inactive_navigations/ServerWorldMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/entity/inactive_navigations/ServerWorldMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.entity.inactive_navigations; +package net.gensokyoreimagined.nitori.mixin.removed.entity.inactive_navigations; //import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; //import net.gensokyoreimagined.nitori.common.entity.NavigatingEntity; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java new file mode 100644 index 0000000..70253a5 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/ChunkSectionPosAccessor.java @@ -0,0 +1,13 @@ +package net.gensokyoreimagined.nitori.mixin.removed.logic.fast_bits_blockpos; + +//import net.minecraft.core.SectionPos; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.gen.Invoker; +// +//@Mixin(SectionPos.class) +//public interface ChunkSectionPosAccessor { +// @Invoker("") +// public static SectionPos invokeChunkSectionPos(int i, int j, int k) { +// throw new AssertionError(); +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java new file mode 100644 index 0000000..42c1c7b --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedBlockPosBitsMixin.java @@ -0,0 +1,67 @@ +package net.gensokyoreimagined.nitori.mixin.removed.logic.fast_bits_blockpos; + +//import net.minecraft.core.BlockPos; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Overwrite; +// +///** +// * Credit to PaperMC Patch #0421 +// */ +//@Mixin(BlockPos.class) +//public class OptimizedBlockPosBitsMixin { +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static long offset(long value, int x, int y, int z) { +// return asLong((int) (value >> 38) + x, (int) ((value << 52) >> 52) + y, (int) ((value << 26) >> 38) + z); +// } +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static int getX(long packedPos) { +// return (int) (packedPos >> 38); +// } +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static int getY(long packedPos) { +// return (int) ((packedPos << 52) >> 52); +// } +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static int getZ(long packedPos) { +// return (int) ((packedPos << 26) >> 38); +// } +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static BlockPos of(long packedPos) { +// return new BlockPos((int) (packedPos >> 38), (int) ((packedPos << 52) >> 52), (int) ((packedPos << 26) >> 38)); +// } +// +// /** +// * @author QPCrummer +// * @reason Inline +// */ +// @Overwrite +// public static long asLong(int x, int y, int z) { +// return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java similarity index 97% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java index 3515375..3a25a28 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_bits_blockpos/OptimizedChunkSecPosBitsMixin.java @@ -1,6 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.logic.fast_bits_blockpos; - -//TODO: impl this +package net.gensokyoreimagined.nitori.mixin.removed.logic.fast_bits_blockpos; //import net.minecraft.core.BlockPos; //import net.minecraft.world.level.ChunkPos; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_rotations/EulerAngleMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_rotations/EulerAngleMixin.java similarity index 97% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_rotations/EulerAngleMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_rotations/EulerAngleMixin.java index ebbf1b8..f5ed8bb 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/fast_rotations/EulerAngleMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/fast_rotations/EulerAngleMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.logic.fast_rotations; +package net.gensokyoreimagined.nitori.mixin.removed.logic.fast_rotations; import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.nbt.FloatTag; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/recipe_manager/RecipeManagerMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/recipe_manager/recipe_manager/RecipeManagerMixin.java similarity index 92% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/logic/recipe_manager/RecipeManagerMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/recipe_manager/recipe_manager/RecipeManagerMixin.java index f4535fb..59ff257 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/logic/recipe_manager/RecipeManagerMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/logic/recipe_manager/recipe_manager/RecipeManagerMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.logic.recipe_manager; +package net.gensokyoreimagined.nitori.mixin.removed.logic.recipe_manager.recipe_manager; //import net.minecraft.world.Container; //import net.minecraft.world.item.crafting.Recipe; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomEntityMixin.java similarity index 88% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomEntityMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomEntityMixin.java index 5956396..1f3127c 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/RandomEntityMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomEntityMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.math.random; +package net.gensokyoreimagined.nitori.mixin.removed.math.random; //import net.gensokyoreimagined.nitori.common.math.random.RandomGeneratorRandom; //import net.minecraft.world.entity.Entity; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomMixin.java new file mode 100644 index 0000000..b05d588 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/RandomMixin.java @@ -0,0 +1,29 @@ +package net.gensokyoreimagined.nitori.mixin.removed.math.random; + +//import net.gensokyoreimagined.nitori.common.math.random.RandomGeneratorRandom; +//import io.netty.util.internal.ThreadLocalRandom; +//import net.minecraft.util.RandomSource; +//import net.minecraft.world.level.levelgen.RandomSupport; +//import org.jetbrains.annotations.NotNull; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//@Mixin(RandomSource.class) +//public interface RandomMixin { +// @Inject(method = "create(J)Lnet/minecraft/util/RandomSource;", at = @At(value = "HEAD"), cancellable = true) +// private static void fasterrandom$createInject(long seed, @NotNull CallbackInfoReturnable cir) { +// cir.setReturnValue(new RandomGeneratorRandom(seed)); +// } +// +// @Inject(method = "createNewThreadLocalInstance", at = @At(value = "HEAD"), cancellable = true) +// private static void fasterrandom$createLocalInject(@NotNull CallbackInfoReturnable cir) { +// cir.setReturnValue(new RandomGeneratorRandom(ThreadLocalRandom.current().nextLong())); +// } +// +// @Inject(method = "createThreadSafe", at = @At(value = "HEAD"), cancellable = true) +// private static void fasterrandom$createThreadSafeInject(@NotNull CallbackInfoReturnable cir) { +// cir.setReturnValue(new RandomGeneratorRandom(RandomSupport.generateUniqueSeed())); +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/QueryResponseHandlerMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/QueryResponseHandlerMixin.java similarity index 91% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/QueryResponseHandlerMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/QueryResponseHandlerMixin.java index 92f26fc..3dd29a6 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/QueryResponseHandlerMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/QueryResponseHandlerMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.math.random.creation; +package net.gensokyoreimagined.nitori.mixin.removed.math.random.creation; //import net.gensokyoreimagined.nitori.mixin.math.random.math.GetRandomInterface; //import net.minecraft.server.rcon.thread.QueryThreadGs4; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/ServerPlayerEntityRandomMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/ServerPlayerEntityRandomMixin.java similarity index 91% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/ServerPlayerEntityRandomMixin.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/ServerPlayerEntityRandomMixin.java index fab7b9b..256adb3 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/creation/ServerPlayerEntityRandomMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/creation/ServerPlayerEntityRandomMixin.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.math.random.creation; +package net.gensokyoreimagined.nitori.mixin.removed.math.random.creation; //import net.minecraft.server.level.ServerPlayer; //import net.minecraft.server.level.ServerLevel; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/math/GetRandomInterface.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/math/GetRandomInterface.java similarity index 83% rename from src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/math/GetRandomInterface.java rename to src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/math/GetRandomInterface.java index a5bdfe3..9167a60 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/math/random/math/GetRandomInterface.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/math/random/math/GetRandomInterface.java @@ -1,4 +1,4 @@ -package net.gensokyoreimagined.nitori.mixin.math.random.math; +package net.gensokyoreimagined.nitori.mixin.removed.math.random.math; //import net.minecraft.util.Mth; //import net.minecraft.util.RandomSource; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/general/collections/MixinTypeFilterableList.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/general/collections/MixinTypeFilterableList.java new file mode 100644 index 0000000..c649d3f --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/general/collections/MixinTypeFilterableList.java @@ -0,0 +1,76 @@ +package net.gensokyoreimagined.nitori.mixin.removed.vmp.general.collections; + +//import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +//import it.unimi.dsi.fastutil.objects.ObjectArrayList; +//import net.gensokyoreimagined.nitori.access.ITypeFilterableList; +//import net.minecraft.util.ClassInstanceMultiMap; +//import org.objectweb.asm.Opcodes; +//import org.spongepowered.asm.mixin.*; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Redirect; +// +//import java.util.*; +// +//@Mixin(value = ClassInstanceMultiMap.class, priority = 1005) // priority compatibility hack for lithium +//public abstract class MixinTypeFilterableList extends AbstractCollection implements ITypeFilterableList { +// +// @Mutable +// @Shadow @Final private Map, List> byClass; +// +// @Mutable +// @Shadow @Final private List allInstances; +// +// @Shadow @Final private Class baseClass; +// +// @Redirect(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ClassInstanceMultiMap;byClass:Ljava/util/Map;", opcode = Opcodes.PUTFIELD)) +// private void redirectSetElementsByType(ClassInstanceMultiMap instance, Map, List> value) { +// this.byClass = new Object2ObjectLinkedOpenHashMap<>(); +// } +// +// @Redirect(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ClassInstanceMultiMap;allInstances:Ljava/util/List;", opcode = Opcodes.PUTFIELD)) +// private void redirectSetAllElements(ClassInstanceMultiMap instance, List value) { +// this.allInstances = new ObjectArrayList<>(); +// } +// +// @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;", remap = false)) +// private HashMap redirectNewHashMap() { +// return null; // avoid unnecessary alloc +// } +// +// @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Lists;newArrayList()Ljava/util/ArrayList;", remap = false)) +// private ArrayList redirectNewArrayList() { +// return null; +// } +// +// @Override +// public Object[] getBackingArray() { +// return ((ObjectArrayList) this.allInstances).elements(); +// } +// +// /** +// * @author ishland +// * @reason use fastutil array list for faster iteration & use array for filtering iteration +// */ +// @Overwrite +// public Collection find(Class type) { +// List cached = this.byClass.get(type); +// if (cached != null) return (Collection) cached; +// +// if (!this.baseClass.isAssignableFrom(type)) { +// throw new IllegalArgumentException("Don't know how to search for " + type); +// } else { +// List list = this.byClass.computeIfAbsent(type, +// typeClass -> { +// ObjectArrayList ts = new ObjectArrayList<>(this.allInstances.size()); +// for (Object _allElement : ((ObjectArrayList) this.allInstances).elements()) { +// if (typeClass.isInstance(_allElement)) { +// ts.add((T) _allElement); +// } +// } +// return ts; +// } +// ); +// return (Collection) list; +// } +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinChunkFilter.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinChunkFilter.java new file mode 100644 index 0000000..3d8a873 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinChunkFilter.java @@ -0,0 +1,22 @@ +package net.gensokyoreimagined.nitori.mixin.removed.vmp.playerwatching; + +//import net.minecraft.server.level.ChunkTrackingView; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Overwrite; +// +//@Mixin(ChunkTrackingView.class) +//public interface MixinChunkFilter { +// +// /** +// * @author ishland +// * @reason use chebyshev distance +// */ +// @Overwrite +// static boolean isWithinDistance(int centerX, int centerZ, int viewDistance, int x, int z, boolean includeEdge) { +// int actualViewDistance = viewDistance + (includeEdge ? 1 : 0); +// int xDistance = Math.abs(centerX - x); +// int zDistance = Math.abs(centerZ - z); +// return xDistance <= actualViewDistance && zDistance <= actualViewDistance; +// } +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinServerPlayerEntity.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinServerPlayerEntity.java new file mode 100644 index 0000000..6788795 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/MixinServerPlayerEntity.java @@ -0,0 +1,46 @@ +package net.gensokyoreimagined.nitori.mixin.removed.vmp.playerwatching; + +//import net.gensokyoreimagined.nitori.common.chunkwatching.PlayerClientVDTracking; +//import net.minecraft.server.level.ClientInformation; +//import net.minecraft.server.level.ServerPlayer; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Unique; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//@Mixin(ServerPlayer.class) +//public class MixinServerPlayerEntity implements PlayerClientVDTracking { +// +// @Unique +// private boolean vdChanged = false; +// +// @Unique +// private int clientVD = 2; +// +// @Inject(method = "updateOptions", at = @At("HEAD")) +// private void onClientSettingsChanged(ClientInformation packet, CallbackInfo ci) { +// final int currentVD = packet.viewDistance(); +// if (currentVD != this.clientVD) this.vdChanged = true; +// this.clientVD = Math.max(2, currentVD); +// } +// +// @Inject(method = "restoreFrom", at = @At("RETURN")) +// private void onPlayerCopy(ServerPlayer oldPlayer, boolean alive, CallbackInfo ci) { +// this.clientVD = ((PlayerClientVDTracking) oldPlayer).getClientViewDistance(); +// this.vdChanged = true; +// } +// +// @Unique +// @Override +// public boolean isClientViewDistanceChanged() { +// return this.vdChanged; +// } +// +// @Unique +// @Override +// public int getClientViewDistance() { +// this.vdChanged = false; +// return this.clientVD; +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java new file mode 100644 index 0000000..a778e04 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java @@ -0,0 +1,35 @@ +package net.gensokyoreimagined.nitori.mixin.removed.vmp.playerwatching.optimize_nearby_player_lookups; + +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.entity.EntityType; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.entity.Mob; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.level.Level; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Redirect; +// +//import java.util.List; +//import java.util.function.Predicate; +// +//@Mixin(Mob.class) +//public abstract class MixinMobEntity extends LivingEntity { +// +// protected MixinMobEntity(EntityType entityType, Level world) { +// super(entityType, world); +// } +// +// @Redirect(method = "checkDespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;findNearbyPlayer(Lnet/minecraft/world/entity/Entity;DLjava/util/function/Predicate;)Lnet/minecraft/world/entity/player/Player;")) +// private Player redirectGetClosestPlayer(Level instance, Entity entity, double v, Predicate predicate) { +// final Player closestPlayer = instance.getNearestPlayer(entity, this.getType().getCategory().getDespawnDistance()); +// if (closestPlayer != null) { +// return closestPlayer; +// } else { +// final List players = this.level().players(); +// if (players.isEmpty()) return null; +// return players.get(0); +// } +// } +// +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/portal_checks/DisablePortalChecksMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/portal_checks/DisablePortalChecksMixin.java new file mode 100644 index 0000000..36cfac0 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/portal_checks/DisablePortalChecksMixin.java @@ -0,0 +1,23 @@ +package net.gensokyoreimagined.nitori.mixin.removed.world.portal_checks; + +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.level.portal.PortalShape; +//import net.minecraft.world.phys.Vec3; +//import net.minecraft.server.level.ServerLevel; +//import net.minecraft.world.entity.EntityDimensions; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//@Mixin({PortalShape.class}) +//public class DisablePortalChecksMixin { +// @Inject( +// at = {@At("HEAD")}, +// method = {"findCollisionFreePosition"}, +// cancellable = true +// ) +// private static void init(Vec3 fallback, ServerLevel world, Entity entity, EntityDimensions dimensions, CallbackInfoReturnable cir) { +// cir.setReturnValue(fallback); +// } +//} diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/tick_scheduler/ChunkTickSchedulerMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/tick_scheduler/ChunkTickSchedulerMixin.java index eda7060..de8e08d 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/tick_scheduler/ChunkTickSchedulerMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/removed/world/tick_scheduler/ChunkTickSchedulerMixin.java @@ -1,8 +1,5 @@ package net.gensokyoreimagined.nitori.mixin.removed.world.tick_scheduler; -//TODO: Make this work with paper - - //import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //import it.unimi.dsi.fastutil.longs.Long2ReferenceAVLTreeMap; //import it.unimi.dsi.fastutil.objects.ObjectIterator; diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/lazy_shape_context/EntityShapeContextMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/lazy_shape_context/EntityShapeContextMixin.java deleted file mode 100644 index 8312240..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/lazy_shape_context/EntityShapeContextMixin.java +++ /dev/null @@ -1,110 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.shapes.lazy_shape_context; - -import net.minecraft.world.phys.shapes.EntityCollisionContext; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyConstant; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.function.Predicate; - -@Mixin(EntityCollisionContext.class) -public class EntityShapeContextMixin { - @Mutable - @Shadow - @Final - private ItemStack heldItem; - - @Mutable - @Shadow - @Final - private Predicate canStandOnFluid; - - @Shadow - @Final - @Nullable - private Entity entity; - - /** - * Mixin the instanceof to always return false to avoid the expensive inventory access. - * No need to use Opcodes.INSTANCEOF or similar. - */ - @SuppressWarnings("InvalidInjectorMethodSignature") - @ModifyConstant( - method = "(Lnet/minecraft/world/entity/Entity;)V", - constant = @Constant(classValue = LivingEntity.class, ordinal = 0) - ) - private static boolean redirectInstanceOf(Object ignored, Class constant) { - return false; - } - - @SuppressWarnings("InvalidInjectorMethodSignature") - @ModifyConstant( - method = "(Lnet/minecraft/world/entity/Entity;)V", - constant = @Constant(classValue = LivingEntity.class, ordinal = 2) - ) - private static boolean redirectInstanceOf2(Object ignored, Class constant) { - return false; - } - - @Inject( - method = "(Lnet/minecraft/world/entity/Entity;)V", - at = @At("TAIL") - ) - private void initFields(Entity entity, CallbackInfo ci) { - this.heldItem = null; - this.canStandOnFluid = null; - } - - @Inject( - method = "isHoldingItem", - at = @At("HEAD") - ) - public void isHolding(Item item, CallbackInfoReturnable cir) { - this.nitori$initHeldItem(); - } - - @Intrinsic - public ItemStack getHeldItem() { - return this.heldItem; - } - - @SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget"}) - @Inject( - method = "getHeldItem", - at = @At("HEAD") - ) - private void nitori$initHeldItem(CallbackInfoReturnable callbackInfoReturnable) { - this.nitori$initHeldItem(); - } - - @Unique - private void nitori$initHeldItem() { - if (this.heldItem == null) { - this.heldItem = this.entity instanceof LivingEntity ? ((LivingEntity) this.entity).getMainHandItem() : ItemStack.EMPTY; - } - } - - @Inject( - method = "canStandOnFluid", - at = @At("HEAD") - ) - public void canWalkOnFluid(FluidState state, FluidState fluidState, CallbackInfoReturnable cir) { - if (this.canStandOnFluid == null) { - if (this.entity instanceof LivingEntity livingEntity) { - this.canStandOnFluid = livingEntity::canStandOnFluid; - } else { - this.canStandOnFluid = (liquid) -> false; - } - } - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java deleted file mode 100644 index d24dfa9..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.shapes.precompute_shape_arrays; - -import net.minecraft.world.phys.shapes.CubePointRange; -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.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(CubePointRange.class) -public class FractionalDoubleListMixin { - @Shadow - @Final - private int parts; - - private double scale; - - @Inject(method = "(I)V", at = @At("RETURN")) - public void initScale(int sectionCount, CallbackInfo ci) { - this.scale = 1.0D / this.parts; - } - - /** - * @author JellySquid - * @reason Replace division with multiplication - */ - @Overwrite - public double getDouble(int position) { - return position * this.scale; - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/lazy_shape_context/EntityShapeContextMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/lazy_shape_context/EntityShapeContextMixin.java new file mode 100644 index 0000000..fb2ba96 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/lazy_shape_context/EntityShapeContextMixin.java @@ -0,0 +1,110 @@ +package net.gensokyoreimagined.nitori.mixin.unapplied.shapes.lazy_shape_context; + +//import net.minecraft.world.phys.shapes.EntityCollisionContext; +//import net.minecraft.world.entity.Entity; +//import net.minecraft.world.entity.LivingEntity; +//import net.minecraft.world.level.material.FluidState; +//import net.minecraft.world.item.Item; +//import net.minecraft.world.item.ItemStack; +//import org.jetbrains.annotations.Nullable; +//import org.spongepowered.asm.mixin.*; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Constant; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.ModifyConstant; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//import java.util.function.Predicate; +// +//@Mixin(EntityCollisionContext.class) +//public class EntityShapeContextMixin { +// @Mutable +// @Shadow +// @Final +// private ItemStack heldItem; +// +// @Mutable +// @Shadow +// @Final +// private Predicate canStandOnFluid; +// +// @Shadow +// @Final +// @Nullable +// private Entity entity; +// +// /** +// * Mixin the instanceof to always return false to avoid the expensive inventory access. +// * No need to use Opcodes.INSTANCEOF or similar. +// */ +// @SuppressWarnings("InvalidInjectorMethodSignature") +// @ModifyConstant( +// method = "(Lnet/minecraft/world/entity/Entity;)V", +// constant = @Constant(classValue = LivingEntity.class, ordinal = 0) +// ) +// private static boolean redirectInstanceOf(Object ignored, Class constant) { +// return false; +// } +// +// @SuppressWarnings("InvalidInjectorMethodSignature") +// @ModifyConstant( +// method = "(Lnet/minecraft/world/entity/Entity;)V", +// constant = @Constant(classValue = LivingEntity.class, ordinal = 2) +// ) +// private static boolean redirectInstanceOf2(Object ignored, Class constant) { +// return false; +// } +// +// @Inject( +// method = "(Lnet/minecraft/world/entity/Entity;)V", +// at = @At("TAIL") +// ) +// private void initFields(Entity entity, CallbackInfo ci) { +// this.heldItem = null; +// this.canStandOnFluid = null; +// } +// +// @Inject( +// method = "isHoldingItem", +// at = @At("HEAD") +// ) +// public void isHolding(Item item, CallbackInfoReturnable cir) { +// this.nitori$initHeldItem(); +// } +// +// @Intrinsic +// public ItemStack getHeldItem() { +// return this.heldItem; +// } +// +// @SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget"}) +// @Inject( +// method = "getHeldItem", +// at = @At("HEAD") +// ) +// private void nitori$initHeldItem(CallbackInfoReturnable callbackInfoReturnable) { +// this.nitori$initHeldItem(); +// } +// +// @Unique +// private void nitori$initHeldItem() { +// if (this.heldItem == null) { +// this.heldItem = this.entity instanceof LivingEntity ? ((LivingEntity) this.entity).getMainHandItem() : ItemStack.EMPTY; +// } +// } +// +// @Inject( +// method = "canStandOnFluid", +// at = @At("HEAD") +// ) +// public void canWalkOnFluid(FluidState state, FluidState fluidState, CallbackInfoReturnable cir) { +// if (this.canStandOnFluid == null) { +// if (this.entity instanceof LivingEntity livingEntity) { +// this.canStandOnFluid = livingEntity::canStandOnFluid; +// } else { +// this.canStandOnFluid = (liquid) -> false; +// } +// } +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java new file mode 100644 index 0000000..58dc00a --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/unapplied/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java @@ -0,0 +1,33 @@ +package net.gensokyoreimagined.nitori.mixin.unapplied.shapes.precompute_shape_arrays; + +//import net.minecraft.world.phys.shapes.CubePointRange; +//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.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//@Mixin(CubePointRange.class) +//public class FractionalDoubleListMixin { +// @Shadow +// @Final +// private int parts; +// +// private double scale; +// +// @Inject(method = "(I)V", at = @At("RETURN")) +// public void initScale(int sectionCount, CallbackInfo ci) { +// this.scale = 1.0D / this.parts; +// } +// +// /** +// * @author JellySquid +// * @reason Replace division with multiplication +// */ +// @Overwrite +// public double getDouble(int position) { +// return position * this.scale; +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/general/collections/MixinTypeFilterableList.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/general/collections/MixinTypeFilterableList.java deleted file mode 100644 index 21c74eb..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/general/collections/MixinTypeFilterableList.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.vmp.general.collections; - -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.gensokyoreimagined.nitori.access.ITypeFilterableList; -import net.minecraft.util.ClassInstanceMultiMap; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.*; - -@Mixin(value = ClassInstanceMultiMap.class, priority = 1005) // priority compatibility hack for lithium -public abstract class MixinTypeFilterableList extends AbstractCollection implements ITypeFilterableList { - - @Mutable - @Shadow @Final private Map, List> byClass; - - @Mutable - @Shadow @Final private List allInstances; - - @Shadow @Final private Class baseClass; - - @Redirect(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ClassInstanceMultiMap;byClass:Ljava/util/Map;", opcode = Opcodes.PUTFIELD)) - private void redirectSetElementsByType(ClassInstanceMultiMap instance, Map, List> value) { - this.byClass = new Object2ObjectLinkedOpenHashMap<>(); - } - - @Redirect(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ClassInstanceMultiMap;allInstances:Ljava/util/List;", opcode = Opcodes.PUTFIELD)) - private void redirectSetAllElements(ClassInstanceMultiMap instance, List value) { - this.allInstances = new ObjectArrayList<>(); - } - - @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;", remap = false)) - private HashMap redirectNewHashMap() { - return null; // avoid unnecessary alloc - } - - @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Lists;newArrayList()Ljava/util/ArrayList;", remap = false)) - private ArrayList redirectNewArrayList() { - return null; - } - - @Override - public Object[] getBackingArray() { - return ((ObjectArrayList) this.allInstances).elements(); - } - - /** - * @author ishland - * @reason use fastutil array list for faster iteration & use array for filtering iteration - */ - @Overwrite - public Collection find(Class type) { - List cached = this.byClass.get(type); - if (cached != null) return (Collection) cached; - - if (!this.baseClass.isAssignableFrom(type)) { - throw new IllegalArgumentException("Don't know how to search for " + type); - } else { - List list = this.byClass.computeIfAbsent(type, - typeClass -> { - ObjectArrayList ts = new ObjectArrayList<>(this.allInstances.size()); - for (Object _allElement : ((ObjectArrayList) this.allInstances).elements()) { - if (typeClass.isInstance(_allElement)) { - ts.add((T) _allElement); - } - } - return ts; - } - ); - return (Collection) list; - } - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinChunkFilter.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinChunkFilter.java deleted file mode 100644 index 2a6da58..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinChunkFilter.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.vmp.playerwatching; - -import net.minecraft.server.level.ChunkTrackingView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -@Mixin(ChunkTrackingView.class) -public interface MixinChunkFilter { - - /** - * @author ishland - * @reason use chebyshev distance - */ - @Overwrite - static boolean isWithinDistance(int centerX, int centerZ, int viewDistance, int x, int z, boolean includeEdge) { - int actualViewDistance = viewDistance + (includeEdge ? 1 : 0); - int xDistance = Math.abs(centerX - x); - int zDistance = Math.abs(centerZ - z); - return xDistance <= actualViewDistance && zDistance <= actualViewDistance; - } - -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinServerPlayerEntity.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinServerPlayerEntity.java deleted file mode 100644 index 36d5eff..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/MixinServerPlayerEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.vmp.playerwatching; - -import net.gensokyoreimagined.nitori.common.chunkwatching.PlayerClientVDTracking; -import net.minecraft.server.level.ClientInformation; -import net.minecraft.server.level.ServerPlayer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ServerPlayer.class) -public class MixinServerPlayerEntity implements PlayerClientVDTracking { - - @Unique - private boolean vdChanged = false; - - @Unique - private int clientVD = 2; - - @Inject(method = "updateOptions", at = @At("HEAD")) - private void onClientSettingsChanged(ClientInformation packet, CallbackInfo ci) { - final int currentVD = packet.viewDistance(); - if (currentVD != this.clientVD) this.vdChanged = true; - this.clientVD = Math.max(2, currentVD); - } - - @Inject(method = "restoreFrom", at = @At("RETURN")) - private void onPlayerCopy(ServerPlayer oldPlayer, boolean alive, CallbackInfo ci) { - this.clientVD = ((PlayerClientVDTracking) oldPlayer).getClientViewDistance(); - this.vdChanged = true; - } - - @Unique - @Override - public boolean isClientViewDistanceChanged() { - return this.vdChanged; - } - - @Unique - @Override - public int getClientViewDistance() { - this.vdChanged = false; - return this.clientVD; - } -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java deleted file mode 100644 index 24b16cc..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/vmp/playerwatching/optimize_nearby_player_lookups/MixinMobEntity.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.vmp.playerwatching.optimize_nearby_player_lookups; - -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.List; -import java.util.function.Predicate; - -@Mixin(Mob.class) -public abstract class MixinMobEntity extends LivingEntity { - - protected MixinMobEntity(EntityType entityType, Level world) { - super(entityType, world); - } - - @Redirect(method = "checkDespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;findNearbyPlayer(Lnet/minecraft/world/entity/Entity;DLjava/util/function/Predicate;)Lnet/minecraft/world/entity/player/Player;")) - private Player redirectGetClosestPlayer(Level instance, Entity entity, double v, Predicate predicate) { - final Player closestPlayer = instance.getNearestPlayer(entity, this.getType().getCategory().getDespawnDistance()); - if (closestPlayer != null) { - return closestPlayer; - } else { - final List players = this.level().players(); - if (players.isEmpty()) return null; - return players.get(0); - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/HashedReferenceListMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/HashedReferenceListMixin.java new file mode 100644 index 0000000..fa4d0db --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/HashedReferenceListMixin.java @@ -0,0 +1,35 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking; + +import com.google.common.collect.Lists; +import net.gensokyoreimagined.nitori.common.util.collections.HashedReferenceList; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.List; + +@Mixin(Level.class) +public class HashedReferenceListMixin { + // Implementation of 0006-lithium-HashedReferenceList.patch + @Mutable + @Final @Shadow + public List blockEntityTickers; + + // Implementation of 0006-lithium-HashedReferenceList.patch + @Mutable + @Final @Shadow + private List pendingBlockEntityTickers; + + // Implementation of 0006-lithium-HashedReferenceList.patch + @Inject(method = "", at = @At("RETURN")) + private void onInit(CallbackInfo ci) { + this.blockEntityTickers = new HashedReferenceList<>(Lists.newArrayList()); + this.pendingBlockEntityTickers = new HashedReferenceList<>(Lists.newArrayList()); + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/ServerWorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/ServerWorldMixin.java new file mode 100644 index 0000000..edde2de --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/ServerWorldMixin.java @@ -0,0 +1,24 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(ServerLevel.class) +public class ServerWorldMixin { + + @Redirect( + method = "dumpBlockEntityTickers", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/TickingBlockEntity;getPos()Lnet/minecraft/core/BlockPos;") + ) + private BlockPos getPosOrOrigin(TickingBlockEntity instance) { + BlockPos pos = instance.getPos(); + if (pos == null) { + return BlockPos.ZERO; + } + return pos; + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldChunkMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldChunkMixin.java new file mode 100644 index 0000000..a5743a9 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldChunkMixin.java @@ -0,0 +1,41 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping; + +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import net.minecraft.world.level.chunk.LevelChunk; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Coerce; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(LevelChunk.class) +public class WorldChunkMixin { + + @Inject( + method = "lambda$updateBlockEntityTicker$5", + at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;addBlockEntityTicker(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V" ), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private void setBlockEntityTickingOrder(BlockEntity blockEntity, BlockEntityTicker blockEntityTicker, BlockPos pos, @Coerce Object wrappedBlockEntityTickInvoker, CallbackInfoReturnable cir, TickingBlockEntity blockEntityTickInvoker, @Coerce Object wrappedBlockEntityTickInvoker2) { + if (blockEntity instanceof SleepingBlockEntity sleepingBlockEntity) { + sleepingBlockEntity.lithium$setTickWrapper((WrappedBlockEntityTickInvokerAccessor) wrappedBlockEntityTickInvoker2); + } + } + + @Inject( + method = "lambda$updateBlockEntityTicker$5", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunk$RebindableTickingBlockEntityWrapper;rebind(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V" ), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private void setBlockEntityTickingOrder(BlockEntity blockEntity, BlockEntityTicker blockEntityTicker, BlockPos pos, @Coerce Object wrappedBlockEntityTickInvoker, CallbackInfoReturnable cir, TickingBlockEntity blockEntityTickInvoker) { + if (blockEntity instanceof SleepingBlockEntity sleepingBlockEntity) { + sleepingBlockEntity.lithium$setTickWrapper((WrappedBlockEntityTickInvokerAccessor) wrappedBlockEntityTickInvoker); + } + } + +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldMixin.java new file mode 100644 index 0000000..f621e22 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/WorldMixin.java @@ -0,0 +1,22 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Level.class) +public class WorldMixin { + + @Redirect( + method = "tickBlockEntities", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;shouldTickBlocksAt(Lnet/minecraft/core/BlockPos;)Z" ) + ) + private boolean shouldTickBlockPosFilterNull(Level instance, BlockPos pos) { + if (pos == null) { + return false; + } + return instance.shouldTickBlocksAt(pos); + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/brewing_stand/BrewingStandBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/brewing_stand/BrewingStandBlockEntityMixin.java new file mode 100644 index 0000000..e347f88 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/brewing_stand/BrewingStandBlockEntityMixin.java @@ -0,0 +1,90 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.brewing_stand; + +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import org.spongepowered.asm.mixin.Intrinsic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(BrewingStandBlockEntity.class) +public class BrewingStandBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { + + @Shadow + int brewTime; + + private WrappedBlockEntityTickInvokerAccessor tickWrapper = null; + private TickingBlockEntity sleepingTicker = null; + + public BrewingStandBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + public WrappedBlockEntityTickInvokerAccessor lithium$getTickWrapper() { + return tickWrapper; + } + + @Override + public void lithium$setTickWrapper(WrappedBlockEntityTickInvokerAccessor tickWrapper) { + this.tickWrapper = tickWrapper; + this.lithium$setSleepingTicker(null); + } + + @Override + public TickingBlockEntity lithium$getSleepingTicker() { + return sleepingTicker; + } + + @Override + public void lithium$setSleepingTicker(TickingBlockEntity sleepingTicker) { + this.sleepingTicker = sleepingTicker; + } + + @Inject(method = "serverTick", at = @At("HEAD")) + private static void checkSleep(Level world, BlockPos pos, BlockState state, BrewingStandBlockEntity blockEntity, CallbackInfo ci) { + ((BrewingStandBlockEntityMixin) (Object) blockEntity).checkSleep(state); + } + + @Inject(method = "serverTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BrewingStandBlockEntity;setChanged(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V")) + private static void wakeUpOnMarkDirty(Level world, BlockPos pos, BlockState state, BrewingStandBlockEntity blockEntity, CallbackInfo ci) { + ((BrewingStandBlockEntityMixin) (Object) blockEntity).wakeUpNow(); + } + + private void checkSleep(BlockState state) { + if (this.brewTime == 0 && state.is(Blocks.BREWING_STAND) && this.level != null) { + this.nitori$startSleeping(); + } + } + + @Inject(method = "loadAdditional", at = @At("RETURN")) + private void wakeUpAfterFromTag(CallbackInfo ci) { + if (this.isSleeping() && this.level != null && !this.level.isClientSide()) { + this.wakeUpNow(); + } + } + + @Override + @Intrinsic + public void setChanged() { + super.setChanged(); + } + + @SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"}) + @Inject(method = "markDirty()V", at = @At("RETURN")) + private void wakeOnMarkDirty(CallbackInfo ci) { + if (this.isSleeping() && this.level != null && !this.level.isClientSide) { + this.wakeUpNow(); + } + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/CampfireBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/CampfireBlockEntityMixin.java index cbe1e4c..f6fa0ce 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/CampfireBlockEntityMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/CampfireBlockEntityMixin.java @@ -1,69 +1,69 @@ package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.campfire; -//import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; -//import net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor; -//import net.minecraft.world.entity.Entity; -//import net.minecraft.world.level.block.state.BlockState; -//import net.minecraft.world.level.block.entity.BlockEntity; -//import net.minecraft.world.level.block.entity.BlockEntityType; -//import net.minecraft.world.level.block.entity.CampfireBlockEntity; -//import net.minecraft.world.entity.LivingEntity; -//import net.minecraft.world.item.ItemStack; -//import net.minecraft.nbt.CompoundTag; -//import net.minecraft.core.HolderLookup; -//import net.minecraft.core.BlockPos; -//import net.minecraft.world.level.block.entity.TickingBlockEntity; -//import org.spongepowered.asm.mixin.Mixin; -//import org.spongepowered.asm.mixin.injection.At; -//import org.spongepowered.asm.mixin.injection.Inject; -//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -// -//@Mixin(CampfireBlockEntity.class) -//public class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { -// -// private WrappedBlockEntityTickInvokerAccessor tickWrapper = null; -// private TickingBlockEntity sleepingTicker = null; -// -// public CampfireBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { -// super(type, pos, state); -// } -// -// @Override -// public WrappedBlockEntityTickInvokerAccessor lithium$getTickWrapper() { -// return tickWrapper; -// } -// -// @Override -// public void lithium$setTickWrapper(WrappedBlockEntityTickInvokerAccessor tickWrapper) { -// this.tickWrapper = tickWrapper; -// this.lithium$setSleepingTicker(null); -// } -// -// @Override -// public TickingBlockEntity lithium$getSleepingTicker() { -// return sleepingTicker; -// } -// -// @Override -// public void lithium$setSleepingTicker(TickingBlockEntity sleepingTicker) { -// this.sleepingTicker = sleepingTicker; -// } -// -// -// @Inject( -// method = "placeFood", -// at = @At(value = "INVOKE", target = "Lnet/minecraft/core/NonNullList;set(ILjava/lang/Object;)Ljava/lang/Object;") -// ) -// private void wakeUpOnAddItem(LivingEntity user, ItemStack stack, int cookTime, CallbackInfoReturnable cir) { -// this.wakeUpNow(); -// } -// -// @Inject( -// method = "loadAdditional", -// at = @At(value = "RETURN") -// ) -// private void wakeUpOnReadNbt(CompoundTag nbt, HolderLookup.Provider registryLookup, CallbackInfo ci) { -// this.wakeUpNow(); -// } -//} \ No newline at end of file +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.CampfireBlockEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(CampfireBlockEntity.class) +public class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { + + private WrappedBlockEntityTickInvokerAccessor tickWrapper = null; + private TickingBlockEntity sleepingTicker = null; + + public CampfireBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + public WrappedBlockEntityTickInvokerAccessor lithium$getTickWrapper() { + return tickWrapper; + } + + @Override + public void lithium$setTickWrapper(WrappedBlockEntityTickInvokerAccessor tickWrapper) { + this.tickWrapper = tickWrapper; + this.lithium$setSleepingTicker(null); + } + + @Override + public TickingBlockEntity lithium$getSleepingTicker() { + return sleepingTicker; + } + + @Override + public void lithium$setSleepingTicker(TickingBlockEntity sleepingTicker) { + this.sleepingTicker = sleepingTicker; + } + + + @Inject( + method = "placeFood", + at = @At(value = "INVOKE", target = "Lnet/minecraft/core/NonNullList;set(ILjava/lang/Object;)Ljava/lang/Object;") + ) + private void wakeUpOnAddItem(LivingEntity user, ItemStack stack, int cookTime, CallbackInfoReturnable cir) { + this.wakeUpNow(); + } + + @Inject( + method = "loadAdditional", + at = @At(value = "RETURN") + ) + private void wakeUpOnReadNbt(CompoundTag nbt, HolderLookup.Provider registryLookup, CallbackInfo ci) { + this.wakeUpNow(); + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/lit/CampfireBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/lit/CampfireBlockEntityMixin.java index 7457abd..913b1f3 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/lit/CampfireBlockEntityMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/lit/CampfireBlockEntityMixin.java @@ -1,40 +1,34 @@ package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.campfire.lit; -//import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; -//import net.minecraft.core.BlockPos; -//import net.minecraft.world.SimpleContainer; -//import net.minecraft.world.item.ItemStack; -//import net.minecraft.world.level.Level; -//import net.minecraft.world.level.block.entity.BlockEntity; -//import net.minecraft.world.level.block.entity.BlockEntityType; -//import net.minecraft.world.level.block.entity.CampfireBlockEntity; -//import net.minecraft.world.level.block.state.BlockState; -//import org.bukkit.craftbukkit.inventory.CraftItemStack; -//import org.bukkit.event.block.BlockCookEvent; -//import org.spongepowered.asm.mixin.Mixin; -//import org.spongepowered.asm.mixin.injection.At; -//import org.spongepowered.asm.mixin.injection.Inject; -//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -//import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -// -//import java.util.Optional; -// -//@Mixin(CampfireBlockEntity.class) -//public abstract class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { -// -// public CampfireBlockEntityMixin(BlockPos pos, BlockState state) { -// super(BlockEntityType.CAMPFIRE, pos, state); -// } -// -// @Inject( -// method = "cookTick", -// at = @At("RETURN"), -// locals = LocalCapture.CAPTURE_FAILHARD -// ) -// private static void trySleepLit(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire, CallbackInfo ci, boolean flag) { -// if (!flag) { -// CampfireBlockEntityMixin self = (CampfireBlockEntityMixin) (Object) campfire; -// self.nitori$startSleeping(); -// } -// } -//} +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.CampfireBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(CampfireBlockEntity.class) +public abstract class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { + + public CampfireBlockEntityMixin(BlockPos pos, BlockState state) { + super(BlockEntityType.CAMPFIRE, pos, state); + } + + @Inject( + method = "cookTick", + at = @At("RETURN"), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private static void trySleepLit(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire, CallbackInfo ci, boolean flag) { + if (!flag) { + CampfireBlockEntityMixin self = (CampfireBlockEntityMixin) (Object) campfire; + self.nitori$startSleeping(); + } + } +} diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/unlit/CampfireBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/unlit/CampfireBlockEntityMixin.java index 4f2ae1e..c2cda7b 100644 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/unlit/CampfireBlockEntityMixin.java +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/campfire/unlit/CampfireBlockEntityMixin.java @@ -1,34 +1,34 @@ package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.campfire.unlit; -//import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; -//import net.minecraft.core.BlockPos; -//import net.minecraft.world.level.Level; -//import net.minecraft.world.level.block.entity.BlockEntity; -//import net.minecraft.world.level.block.entity.BlockEntityType; -//import net.minecraft.world.level.block.entity.CampfireBlockEntity; -//import net.minecraft.world.level.block.state.BlockState; -//import org.spongepowered.asm.mixin.Mixin; -//import org.spongepowered.asm.mixin.injection.At; -//import org.spongepowered.asm.mixin.injection.Inject; -//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -//import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -// -//@Mixin(CampfireBlockEntity.class) -//public abstract class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { -// -// public CampfireBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { -// super(type, pos, state); -// } -// -// @Inject( -// method = "cooldownTick", -// at = @At("RETURN"), -// locals = LocalCapture.CAPTURE_FAILHARD -// ) -// private static void trySleepLit(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire, CallbackInfo ci, boolean flag) { -// if (!flag) { -// CampfireBlockEntityMixin self = (CampfireBlockEntityMixin) (Object) campfire; -// self.nitori$startSleeping(); -// } -// } -//} \ No newline at end of file +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.CampfireBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(CampfireBlockEntity.class) +public abstract class CampfireBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { + + public CampfireBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Inject( + method = "cooldownTick", + at = @At("RETURN"), + locals = LocalCapture.CAPTURE_FAILHARD + ) + private static void trySleepLit(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire, CallbackInfo ci, boolean flag) { + if (!flag) { + CampfireBlockEntityMixin self = (CampfireBlockEntityMixin) (Object) campfire; + self.nitori$startSleeping(); + } + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/hopper/HopperBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/hopper/HopperBlockEntityMixin.java new file mode 100644 index 0000000..4432bd7 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/hopper/HopperBlockEntityMixin.java @@ -0,0 +1,106 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.hopper; + +//import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +//import net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor; +//import net.minecraft.world.level.block.state.BlockState; +//import net.minecraft.world.level.block.HopperBlock; +//import net.minecraft.world.level.block.entity.BlockEntity; +//import net.minecraft.world.level.block.entity.BlockEntityType; +//import net.minecraft.world.level.block.entity.HopperBlockEntity; +//import net.minecraft.core.BlockPos; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.level.block.entity.TickingBlockEntity; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// +//import java.util.function.BooleanSupplier; +// +//@Mixin(HopperBlockEntity.class) +//public class HopperBlockEntityMixin extends BlockEntity implements SleepingBlockEntity { +// +// @Shadow +// private long tickedGameTime; +// +// @Shadow +// private native boolean isOnCooldown(); +// +// private WrappedBlockEntityTickInvokerAccessor tickWrapper = null; +// private TickingBlockEntity sleepingTicker = null; +// +// @Inject( +// method = "tryMoveItems", +// at = @At(value = "RETURN", ordinal = 2) +// ) +// private static void sleepIfNoCooldownAndLocked(Level world, BlockPos pos, BlockState state, HopperBlockEntity blockEntity, BooleanSupplier booleanSupplier, CallbackInfoReturnable cir) { +// if (!((HopperBlockEntityMixin) (Object) blockEntity).isOnCooldown() && +// !((HopperBlockEntityMixin) (Object) blockEntity).isSleeping() && +// !state.get(HopperBlock.ENABLED)) { +// ((HopperBlockEntityMixin) (Object) blockEntity).lithium$startSleeping(); +// } +// } +// +// @Override +// public WrappedBlockEntityTickInvokerAccessor lithium$getTickWrapper() { +// return tickWrapper; +// } +// +// @Override +// public void lithium$setTickWrapper(WrappedBlockEntityTickInvokerAccessor tickWrapper) { +// this.tickWrapper = tickWrapper; +// this.lithium$setSleepingTicker(null); +// } +// +// @Override +// public TickingBlockEntity lithium$getSleepingTicker() { +// return sleepingTicker; +// } +// +// public HopperBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockState state) { +// super(type, pos, state); +// } +// +// @Override +// public void lithium$setSleepingTicker(TickingBlockEntity sleepingTicker) { +// this.sleepingTicker = sleepingTicker; +// } +// +// @Override +// public boolean nitori$startSleeping() { +// if (this.isSleeping()) { +// return false; +// } +// +// WrappedBlockEntityTickInvokerAccessor tickWrapper = this.lithium$getTickWrapper(); +// if (tickWrapper != null) { +// this.lithium$setSleepingTicker(tickWrapper.getWrapped()); +// tickWrapper.callSetWrapped(SleepingBlockEntity.SLEEPING_BLOCK_ENTITY_TICKER); +// +// // Set the last tick time to max value, so other hoppers transferring into this hopper will set it to 7gt +// // cooldown. Then when waking up, we make sure to not tick this hopper in the same gametick. +// // This makes the observable hopper cooldown not be different from vanilla. +// this.tickedGameTime = Long.MAX_VALUE; +// return true; +// } +// return false; +// } +// +// @Inject( +// method = "setTransferCooldown", +// at = @At("HEAD" ) +// ) +// private void wakeUpOnCooldownSet(int transferCooldown, CallbackInfo ci) { +// if (transferCooldown == 7) { +// if (this.tickedGameTime == Long.MAX_VALUE) { +// this.sleepOnlyCurrentTick(); +// } else { +// this.wakeUpNow(); +// } +// } else if (transferCooldown > 0 && this.sleepingTicker != null) { +// this.wakeUpNow(); +// } +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/shulker_box/ShulkerBoxBlockEntityMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/shulker_box/ShulkerBoxBlockEntityMixin.java new file mode 100644 index 0000000..0772058 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/sleeping/shulker_box/ShulkerBoxBlockEntityMixin.java @@ -0,0 +1,67 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.shulker_box; + +import net.gensokyoreimagined.nitori.common.block.entity.SleepingBlockEntity; +import net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.TickingBlockEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(ShulkerBoxBlockEntity.class) +public class ShulkerBoxBlockEntityMixin implements SleepingBlockEntity { + @Shadow + private ShulkerBoxBlockEntity.AnimationStatus animationStatus; + @Shadow + private float progress; + @Shadow + private float progressOld; + private WrappedBlockEntityTickInvokerAccessor tickWrapper = null; + private TickingBlockEntity sleepingTicker = null; + + @Override + public WrappedBlockEntityTickInvokerAccessor lithium$getTickWrapper() { + return tickWrapper; + } + + @Override + public void lithium$setTickWrapper(WrappedBlockEntityTickInvokerAccessor tickWrapper) { + this.tickWrapper = tickWrapper; + } + + @Override + public TickingBlockEntity lithium$getSleepingTicker() { + return sleepingTicker; + } + + @Override + public void lithium$setSleepingTicker(TickingBlockEntity sleepingTicker) { + this.sleepingTicker = sleepingTicker; + } + + @Inject( + method = "triggerEvent", + at = @At("HEAD") + ) + private void wakeUpOnSyncedBlockEvent(int type, int data, CallbackInfoReturnable cir) { + if (this.sleepingTicker != null) { + this.wakeUpNow(); + } + } + + @Inject( + method = "updateAnimation", + at = @At(value = "RETURN") + ) + private void sleepOnAnimationEnd(Level world, BlockPos pos, BlockState state, CallbackInfo ci) { + if (this.animationStatus == animationStatus.CLOSED && this.progressOld == 0.0f && this.progress == 0.0f) { + this.nitori$startSleeping(); + } + } +} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/world_border/DirectBlockEntityTickInvokerMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/world_border/DirectBlockEntityTickInvokerMixin.java new file mode 100644 index 0000000..2a6b264 --- /dev/null +++ b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/block_entity_ticking/world_border/DirectBlockEntityTickInvokerMixin.java @@ -0,0 +1,81 @@ +package net.gensokyoreimagined.nitori.mixin.world.block_entity_ticking.world_border; + +//import net.gensokyoreimagined.nitori.common.world.listeners.WorldBorderListenerOnce; +//import net.minecraft.server.level.FullChunkStatus; +//import net.minecraft.server.level.ServerLevel; +//import net.minecraft.core.BlockPos; +//import net.minecraft.world.level.ChunkPos; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.level.border.WorldBorder; +//import net.minecraft.world.level.border.BorderStatus; +//import net.minecraft.world.level.chunk.LevelChunk; +//import org.spongepowered.asm.mixin.Final; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Redirect; +// +//@Mixin(targets = "net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity") +//public abstract class DirectBlockEntityTickInvokerMixin implements WorldBorderListenerOnce { +// +// @Shadow +// @Final +// LevelChunk LevelChunk; +// +// @Shadow +// public abstract BlockPos getPos(); +// +// private byte worldBorderState = 0; +// +// @Redirect( +// method = "tick", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/world/chunk/WorldChunk;canTickBlockEntity(Lnet/minecraft/util/math/BlockPos;)Z" +// ) +// ) +// private boolean cachedCanTickBlockEntity(LevelChunk instance, BlockPos pos) { +// if (this.isInsideWorldBorder()) { +// Level world = this.LevelChunk.getLevel(); +// if (world instanceof ServerLevel serverWorld) { +// return this.LevelChunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING) && serverWorld.areEntitiesLoaded(ChunkPos.asLong(pos)); +// } +// return true; +// } else { +// return false; +// } +// } +// +// private boolean isInsideWorldBorder() { +// if (this.worldBorderState == (byte) 0) { +// this.startWorldBorderCaching(); +// } +// +// int worldBorderState = this.worldBorderState; +// if ((worldBorderState & 3) == 3) { +// return (worldBorderState & 4) != 0; +// } +// return this.LevelChunk.getLevel().getWorldBorder().isWithinBounds(this.getPos()); +// } +// +// private void startWorldBorderCaching() { +// this.worldBorderState = (byte) 1; +// WorldBorder worldBorder = this.LevelChunk.getLevel().getWorldBorder(); +// worldBorder.addListener(this); +// boolean isStationary = worldBorder.getStatus() == BorderStatus.STATIONARY; +// if (worldBorder.isWithinBounds(this.getPos())) { +// if (isStationary || worldBorder.getStatus() == BorderStatus.GROWING) { +// this.worldBorderState |= (byte) 6; +// } +// } else { +// if (isStationary || worldBorder.getStatus() == BorderStatus.SHRINKING) { +// this.worldBorderState |= (byte) 2; +// } +// } +// } +// +// @Override +// public void lithium$onWorldBorderShapeChange(WorldBorder worldBorder) { +// this.worldBorderState = (byte) 0; +// } +//} \ No newline at end of file diff --git a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/portal_checks/DisablePortalChecksMixin.java b/src/main/java/net/gensokyoreimagined/nitori/mixin/world/portal_checks/DisablePortalChecksMixin.java deleted file mode 100644 index 3b25743..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/mixin/world/portal_checks/DisablePortalChecksMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.gensokyoreimagined.nitori.mixin.world.portal_checks; - -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.portal.PortalShape; -import net.minecraft.world.phys.Vec3; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.EntityDimensions; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin({PortalShape.class}) -public class DisablePortalChecksMixin { - @Inject( - at = {@At("HEAD")}, - method = {"findCollisionFreePosition"}, - cancellable = true - ) - private static void init(Vec3 fallback, ServerLevel world, Entity entity, EntityDimensions dimensions, CallbackInfoReturnable cir) { - cir.setReturnValue(fallback); - } -} diff --git a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/DirectVirtualThreadService.java b/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/DirectVirtualThreadService.java deleted file mode 100644 index 86fe01f..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/DirectVirtualThreadService.java +++ /dev/null @@ -1,50 +0,0 @@ -// Gale - virtual thread support - -package net.gensokyoreimagined.nitori.virtual_thread; - -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.ThreadFactory; - -/** - * An implementation of {@link VirtualThreadService} that can create virtual threads directly. - * - * @author Martijn Muijsers - */ -final class DirectVirtualThreadService extends VirtualThreadService { - - private DirectVirtualThreadService() { - super(); - } - - @Override - public @NotNull ThreadFactory createFactory() { - // Disabled until Minecraft requires servers to have a Java version that can read class files compiled with functionality from Java 19+ on preview / Java 21+ on stable - throw new UnsupportedOperationException(); -// return Thread.ofVirtual().factory(); - } - - @Override - public @NotNull Thread start(@NotNull Runnable task) { - // Disabled until Minecraft requires servers to have a Java version that can read class files compiled with functionality from Java 19+ on preview / Java 21+ on stable - throw new UnsupportedOperationException(); -// Objects.requireNonNull(task, "The task to start a virtual thread cannot be null"); -// return Thread.ofVirtual().start(task); - } - - /** - * @return A functional {@link DirectVirtualThreadService}. - * @throws Throwable If creating virtual threads directly is not supported by the current runtime. - * This could be any {@link Throwable}, including an {@link Exception} or an {@link Error}. - */ - static @NotNull DirectVirtualThreadService create() throws Throwable { - // Disabled until Minecraft requires servers to have a Java version that can read class files compiled with functionality from Java 19+ on preview / Java 21+ on stable - throw new UnsupportedOperationException(); -// var service = new DirectVirtualThreadService(); -// // Run some tests to verify -// service.runTest(); -// // If we end up here, it works -// return service; - } - -} diff --git a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/ReflectionVirtualThreadService.java b/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/ReflectionVirtualThreadService.java deleted file mode 100644 index b2fd6b2..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/ReflectionVirtualThreadService.java +++ /dev/null @@ -1,76 +0,0 @@ -// Gale - virtual thread support - -package net.gensokyoreimagined.nitori.virtual_thread; - -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Method; -import java.util.Objects; -import java.util.concurrent.ThreadFactory; - -/** - * An implementation of {@link VirtualThreadService} that can create virtual threads using Java reflection. - * - * @author Martijn Muijsers - */ -final class ReflectionVirtualThreadService extends VirtualThreadService { - - /** - * The {@link Thread}#ofVirtual() method. - */ - private final @NotNull Method Thread_ofVirtual_method; - - /** - * The {@link Thread}.Builder#factory() method. - */ - private final @NotNull Method Thread_Builder_factory_method; - - /** - * The {@link Thread}.Builder#start(Runnable) method. - */ - private final @NotNull Method Thread_Builder_start_method; - - private ReflectionVirtualThreadService() throws Throwable { - this.Thread_ofVirtual_method = Objects.requireNonNull(Thread.class.getMethod("ofVirtual")); - // The Thread.Builder class - var Thread_Builder_class = Objects.requireNonNull(Class.forName("java.lang.Thread$Builder")); - this.Thread_Builder_factory_method = Objects.requireNonNull(Thread_Builder_class.getMethod("factory")); - this.Thread_Builder_start_method = Objects.requireNonNull(Thread_Builder_class.getMethod("start", Runnable.class)); - } - - @Override - public @NotNull ThreadFactory createFactory() { - try { - return (ThreadFactory) this.Thread_Builder_factory_method.invoke(this.Thread_ofVirtual_method.invoke(null)); - } catch (Exception e) { - // This should not be possible because it was tested in create() - throw new RuntimeException(e); - } - } - - @Override - public @NotNull Thread start(@NotNull Runnable task) { - Objects.requireNonNull(task, "The task to start a virtual thread cannot be null"); - try { - return (Thread) this.Thread_Builder_start_method.invoke(this.Thread_ofVirtual_method.invoke(null), task); - } catch (Exception e) { - // This should not be possible because it was tested in create() - throw new RuntimeException(e); - } - } - - /** - * @return A functional {@link ReflectionVirtualThreadService}. - * @throws Throwable If creating virtual threads via reflection is not supported by the current runtime. - * This could be any {@link Throwable}, including an {@link Exception} or an {@link Error}. - */ - static @NotNull ReflectionVirtualThreadService create() throws Throwable { - // This will already throw something if the reflection fails - var service = new ReflectionVirtualThreadService(); - // Run some tests to verify - service.runTest(); - // If we end up here, it works - return service; - } - -} diff --git a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/VirtualThreadService.java b/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/VirtualThreadService.java deleted file mode 100644 index 132de81..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/VirtualThreadService.java +++ /dev/null @@ -1,101 +0,0 @@ -// Gale - virtual thread support - -package net.gensokyoreimagined.nitori.virtual_thread; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.concurrent.ThreadFactory; - -/** - * An abstract service to create virtual threads. - * - * @author Martijn Muijsers - */ -public sealed abstract class VirtualThreadService permits ReflectionVirtualThreadService, DirectVirtualThreadService { - - /** - * @return A {@link ThreadFactory} that produces virtual threads. - */ - public abstract @NotNull ThreadFactory createFactory(); - - /** - * @param task The runnable for the thread to execute. - * @return A virtual thread that has been started with the given task. - */ - public abstract @NotNull Thread start(Runnable task); - - /** - * Runs a test on the {@link #createFactory} and {@link #start} methods, - * which certainly throws some {@link Throwable} if something goes wrong. - */ - protected void runTest() throws Throwable { - // This will definitely throw something if it doesn't work - try { - this.start(() -> {}).join(); - } catch (InterruptedException ignored) {} // Except InterruptedException, we don't care about that one - try { - var thread = this.createFactory().newThread(() -> {}); - thread.start(); - thread.join(); - } catch (InterruptedException ignored) {} // Except InterruptedException, we don't care about that one - // If we end up here, it works - } - - private static boolean initialized = false; - - /** - * The {@link VirtualThreadService} for the current runtime, - * or null if virtual threads are not supported, or if not {@link #initialized} yet. - */ - private static @Nullable VirtualThreadService implementation; - - /** - * @return Whether virtual threads are supported on the current runtime. - */ - public static boolean isSupported() { - return get() != null; - } - - /** - * @return The {@link VirtualThreadService} for the current runtime, - * or null if virtual threads are not {@linkplain #isSupported() supported}. - * - * This method is thread-safe only after the first time it has been fully run. - */ - public static @Nullable VirtualThreadService get() { - if (!initialized) { - initialized = true; - try { - implementation = DirectVirtualThreadService.create(); - } catch (Throwable ignored) { - try { - implementation = ReflectionVirtualThreadService.create(); - } catch (Throwable ignored2) {} - } - } - return implementation; - } - - /** - * The minimum major version of Java that is known to support using virtual threads - * (although possibly behind a feature preview flag). - */ - public static final int minimumJavaMajorVersionWithFeaturePreview = 19; - - /** - * The minimum major version of Java that is known to support using virtual threads - * even without any feature preview flags. - */ - public static final int minimumJavaMajorVersionWithoutFeaturePreview = 21; - - public static int getJavaMajorVersion() { - var version = System.getProperty("java.version"); - if (version.startsWith("1.")) { - return version.charAt(2) - '0'; - } - int dotIndex = version.indexOf("."); - return Integer.parseInt(dotIndex == -1 ? version : version.substring(0, dotIndex)); - } - -} diff --git a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/package-info.java b/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/package-info.java deleted file mode 100644 index 9c0c7e7..0000000 --- a/src/main/java/net/gensokyoreimagined/nitori/virtual_thread/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -package net.gensokyoreimagined.nitori.virtual_thread; - -/* -Original patch: -https://github.com/GaleMC/Gale/blob/ver/1.20.2/patches/server/0145-Virtual-thread-support.patch - */ \ No newline at end of file diff --git a/src/main/resources/ignite.mod.json b/src/main/resources/ignite.mod.json index 3900fff..f338786 100755 --- a/src/main/resources/ignite.mod.json +++ b/src/main/resources/ignite.mod.json @@ -1,6 +1,6 @@ { "id": "Nitori", - "version": "1.5-SNAPSHOT", + "version": "1.6-SNAPSHOT", "mixins": [ "mixins.core.json" ] diff --git a/src/main/resources/mixins.core.json b/src/main/resources/mixins.core.json index 229985d..34a9c69 100755 --- a/src/main/resources/mixins.core.json +++ b/src/main/resources/mixins.core.json @@ -25,7 +25,6 @@ "collections.chunk_tickets.SortedArraySetMixin", "collections.entity_by_type.TypeFilterableListMixin", "collections.entity_filtering.TypeFilterableListMixin", - "collections.goals.GoalSelectorMixin", "collections.mob_spawning.SpawnSettingsMixin", "collections.fluid_submersion.EntityMixin", "collections.brain.BrainMixin", @@ -41,13 +40,7 @@ "entity.replace_entitytype_predicates.AbstractDecorationEntityMixin", "entity.replace_entitytype_predicates.ItemFrameEntityMixin", "entity.pathfinding.TargetPredicateMixin", - "entity.inactive_navigations.EntityNavigationMixin", - "entity.inactive_navigations.MobEntityMixin", - "logic.fast_bits_blockpos.OptimizedBlockPosBitsMixin", - "logic.fast_rotations.EulerAngleMixin", "logic.reduce_ray_casting.BlockViewCastingMixin", - "math.fast_blockops.BlockPosMixin", - "math.fast_blockops.DirectionMixin", "math.fast_util.AxisCycleDirectionMixin$BackwardMixin", "math.fast_util.AxisCycleDirectionMixin$ForwardMixin", "math.fast_util.DirectionMixin", @@ -61,30 +54,29 @@ "math.rounding.FastRoundingSurfaceBuildMixin", "math.sine_lut.MixinMth", "math.vec.FastMathVec3DMixin", - "math.random.RandomMixin", "network.microopt.VarIntsMixin", "network.microopt.StringEncodingMixin", "network.block_breaking.CacheBlockBreakPacketMixin", - "vmp.playerwatching.MixinChunkFilter", - "vmp.playerwatching.MixinServerPlayerEntity", - "vmp.playerwatching.optimize_nearby_player_lookups.MixinMobEntity", - "vmp.general.collections.MixinTypeFilterableList", - "vmp.entity.move_zero_velocity.MixinEntity", + "network.move_zero_velocity.MixinEntity", "shapes.blockstate_cache.BlockMixin", - "shapes.lazy_shape_context.EntityShapeContextMixin", - "shapes.precompute_shape_arrays.FractionalDoubleListMixin", "shapes.precompute_shape_arrays.SimpleVoxelShapeMixin", "shapes.specialized_shapes.VoxelShapeMixin", "util.MixinLevelBlockEntityRetrieval", "util.accessors.EntityTrackingSectionAccessor", "util.block_tracking.AbstractBlockStateMixin", "util.block_entity_retrieval.WorldMixin", - "world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor", "world.block_entity_ticking.sleeping.furnace.AbstractFurnaceBlockEntityMixin", + "world.block_entity_ticking.sleeping.brewing_stand.BrewingStandBlockEntityMixin", + "world.block_entity_ticking.sleeping.shulker_box.ShulkerBoxBlockEntityMixin", + "world.block_entity_ticking.sleeping.campfire.unlit.CampfireBlockEntityMixin", + "world.block_entity_ticking.sleeping.campfire.lit.CampfireBlockEntityMixin", + "world.block_entity_ticking.sleeping.campfire.CampfireBlockEntityMixin", + "world.block_entity_ticking.sleeping.ServerWorldMixin", + "world.block_entity_ticking.sleeping.WorldMixin", + "world.block_entity_ticking.sleeping.WrappedBlockEntityTickInvokerAccessor", "world.block_entity_ticking.support_cache.BlockEntityMixin", "world.block_entity_ticking.support_cache.DirectBlockEntityTickInvokerMixin", "world.block_entity_ticking.support_cache.WorldChunkMixin", - "world.portal_checks.DisablePortalChecksMixin", "world.blending.BlendMixin", "world.farmland.FarmlandBlockMixin", "world.biome_access.BiomeAccessMixin"