Search in sources :

Example 1 with TrackedEntity

use of net.minecraft.server.level.ChunkMap.TrackedEntity in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    ServerLevel server = (ServerLevel) NMSImpl.getHandle(player).level;
    TrackedEntity entry = server.getChunkProvider().chunkMap.G.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().chunkMap, entry);
    server.getChunkProvider().chunkMap.G.put(player.getEntityId(), replace);
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) TrackedEntity(net.minecraft.server.level.ChunkMap.TrackedEntity) EntityHumanNPC(net.citizensnpcs.nms.v1_17_R1.entity.EntityHumanNPC)

Example 2 with TrackedEntity

use of net.minecraft.server.level.ChunkMap.TrackedEntity in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    ServerLevel server = (ServerLevel) NMSImpl.getHandle(player).level;
    TrackedEntity entry = server.getChunkSource().chunkMap.entityMap.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTracker replace = new PlayerlistTracker(server.getChunkSource().chunkMap, entry);
    server.getChunkSource().chunkMap.entityMap.put(player.getEntityId(), replace);
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) TrackedEntity(net.minecraft.server.level.ChunkMap.TrackedEntity) EntityHumanNPC(net.citizensnpcs.nms.v1_18_R2.entity.EntityHumanNPC)

Aggregations

TrackedEntity (net.minecraft.server.level.ChunkMap.TrackedEntity)2 ServerLevel (net.minecraft.server.level.ServerLevel)2 EntityHumanNPC (net.citizensnpcs.nms.v1_17_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_18_R2.entity.EntityHumanNPC)1