Compare commits
1 Commits
section-oc
...
join-ticke
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a523823513 |
@@ -1,11 +1,14 @@
|
|||||||
package ca.spottedleaf.moonrise.mixin.chunk_system;
|
package ca.spottedleaf.moonrise.mixin.chunk_system;
|
||||||
|
|
||||||
|
import ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel;
|
||||||
import ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer;
|
import ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer;
|
||||||
|
import ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader;
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.network.CommonListenerCookie;
|
import net.minecraft.server.network.CommonListenerCookie;
|
||||||
import net.minecraft.server.players.PlayerList;
|
import net.minecraft.server.players.PlayerList;
|
||||||
|
import net.minecraft.util.Unit;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -30,6 +33,26 @@ abstract class PlayerListMixin {
|
|||||||
((ChunkSystemServerPlayer)serverPlayer).moonrise$setRealPlayer(true);
|
((ChunkSystemServerPlayer)serverPlayer).moonrise$setRealPlayer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @reason prevent chunk load cycling on join
|
||||||
|
* @author jpenilla
|
||||||
|
*/
|
||||||
|
@Inject(
|
||||||
|
method = "placeNewPlayer",
|
||||||
|
at = @At(
|
||||||
|
target = "Lnet/minecraft/server/level/ServerLevel;addNewPlayer(Lnet/minecraft/server/level/ServerPlayer;)V",
|
||||||
|
value = "INVOKE"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private void addJoinTicket(final Connection connection, final ServerPlayer serverPlayer,
|
||||||
|
final CommonListenerCookie commonListenerCookie, final CallbackInfo ci) {
|
||||||
|
((ChunkSystemServerLevel) serverPlayer.serverLevel()).moonrise$getChunkTaskScheduler().chunkHolderManager.addTicketAtLevel(
|
||||||
|
RegionizedPlayerChunkLoader.PLAYER_JOIN,
|
||||||
|
serverPlayer.chunkPosition(),
|
||||||
|
RegionizedPlayerChunkLoader.TICK_TICKET_LEVEL,
|
||||||
|
Unit.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @reason The RegionizedPlayerChunkLoader will handle the VD packet
|
* @reason The RegionizedPlayerChunkLoader will handle the VD packet
|
||||||
* @author Spottedleaf
|
* @author Spottedleaf
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.level.TicketType;
|
import net.minecraft.server.level.TicketType;
|
||||||
import net.minecraft.server.network.PlayerChunkSender;
|
import net.minecraft.server.network.PlayerChunkSender;
|
||||||
|
import net.minecraft.util.Unit;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.GameRules;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
@@ -52,6 +53,7 @@ public final class RegionizedPlayerChunkLoader {
|
|||||||
|
|
||||||
public static final TicketType<Long> PLAYER_TICKET = TicketType.create("chunk_system:player_ticket", Long::compareTo);
|
public static final TicketType<Long> PLAYER_TICKET = TicketType.create("chunk_system:player_ticket", Long::compareTo);
|
||||||
public static final TicketType<Long> PLAYER_TICKET_DELAYED = TicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 5 * 20);
|
public static final TicketType<Long> PLAYER_TICKET_DELAYED = TicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 5 * 20);
|
||||||
|
public static final TicketType<Unit> PLAYER_JOIN = TicketType.create("chunk_system:player_join", (a, b) -> 0, 5 * 20);
|
||||||
|
|
||||||
public static final int MIN_VIEW_DISTANCE = 2;
|
public static final int MIN_VIEW_DISTANCE = 2;
|
||||||
public static final int MAX_VIEW_DISTANCE = 32;
|
public static final int MAX_VIEW_DISTANCE = 32;
|
||||||
|
|||||||
Reference in New Issue
Block a user