Optimise chunk tick checking during chunk tick
We don't need to check for this with the chunk system, as ticking chunks are actually guaranteed to ticking. Additionally, ticking chunks may only become non-ticking during the chunk holder manager tick - which will not happen during chunk ticking.
This commit is contained in:
@@ -86,8 +86,7 @@ public abstract class DistanceManagerMixin implements ChunkSystemDistanceManager
|
||||
value = "RETURN"
|
||||
)
|
||||
)
|
||||
private void destroyFields(final Executor executor, final Executor executor2,
|
||||
final CallbackInfo ci) {
|
||||
private void destroyFields(final CallbackInfo ci) {
|
||||
this.tickets = null;
|
||||
this.ticketTracker = null;
|
||||
this.tickingTicketsTracker = null;
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.server.level.ChunkResult;
|
||||
import net.minecraft.server.level.FullChunkStatus;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
@@ -298,4 +299,36 @@ public abstract class ServerChunkCacheMixin extends ChunkSource implements Chunk
|
||||
|
||||
((ChunkSystemMinecraftServer)this.level.getServer()).moonrise$executeMidTickTasks();
|
||||
}
|
||||
|
||||
/**
|
||||
* @reason In the chunk system, ticking chunks always have loaded entities. Of course, they are also always
|
||||
* marked to be as ticking as well.
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Redirect(
|
||||
method = "tickChunks",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/ServerLevel;isNaturalSpawningAllowed(Lnet/minecraft/world/level/ChunkPos;)Z"
|
||||
)
|
||||
)
|
||||
private boolean shortNaturalSpawning(final ServerLevel instance, final ChunkPos chunkPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @reason In the chunk system, ticking chunks always have loaded entities. Of course, they are also always
|
||||
* marked to be as ticking as well.
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Redirect(
|
||||
method = "tickChunks",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/ServerLevel;shouldTickBlocksAt(J)Z"
|
||||
)
|
||||
)
|
||||
private boolean shortShouldTickBlocks(final ServerLevel instance, final long pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user