Search in sources :

Example 1 with EntityTrackerEntry

use of net.minecraft.server.v1_13_R2.EntityTrackerEntry in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
    server.getTracker().trackedEntities.a(player.getEntityId(), replace);
    if (TRACKED_ENTITY_SET != null) {
        try {
            Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
            set.remove(entry);
            set.add(replace);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked();
    }
}
Also used : EntityTrackerEntry(net.minecraft.server.v1_10_R1.EntityTrackerEntry) EnumSet(java.util.EnumSet) Set(java.util.Set) WorldServer(net.minecraft.server.v1_10_R1.WorldServer) DataWatcherObject(net.minecraft.server.v1_10_R1.DataWatcherObject) EntityHumanNPC(net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC)

Example 2 with EntityTrackerEntry

use of net.minecraft.server.v1_13_R2.EntityTrackerEntry in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
    server.getTracker().trackedEntities.a(player.getEntityId(), replace);
    if (TRACKED_ENTITY_SET != null) {
        try {
            Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
            set.remove(entry);
            set.add(replace);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : EntityTrackerEntry(net.minecraft.server.v1_13_R2.EntityTrackerEntry) EnumSet(java.util.EnumSet) Set(java.util.Set) WorldServer(net.minecraft.server.v1_13_R2.WorldServer) DataWatcherObject(net.minecraft.server.v1_13_R2.DataWatcherObject) EntityHumanNPC(net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC)

Example 3 with EntityTrackerEntry

use of net.minecraft.server.v1_13_R2.EntityTrackerEntry in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
    server.getTracker().trackedEntities.a(player.getEntityId(), replace);
    if (TRACKED_ENTITY_SET != null) {
        try {
            Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
            set.remove(entry);
            set.add(replace);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : EntityTrackerEntry(net.minecraft.server.v1_12_R1.EntityTrackerEntry) EnumSet(java.util.EnumSet) Set(java.util.Set) WorldServer(net.minecraft.server.v1_12_R1.WorldServer) DataWatcherObject(net.minecraft.server.v1_12_R1.DataWatcherObject) EntityHumanNPC(net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)

Example 4 with EntityTrackerEntry

use of net.minecraft.server.v1_13_R2.EntityTrackerEntry in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
    server.getTracker().trackedEntities.a(player.getEntityId(), replace);
    if (TRACKED_ENTITY_SET != null) {
        try {
            Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
            set.remove(entry);
            set.add(replace);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : EntityTrackerEntry(net.minecraft.server.v1_8_R3.EntityTrackerEntry) EnumSet(java.util.EnumSet) Set(java.util.Set) WorldServer(net.minecraft.server.v1_8_R3.WorldServer) EntityHumanNPC(net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC)

Example 5 with EntityTrackerEntry

use of net.minecraft.server.v1_13_R2.EntityTrackerEntry in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTrackerEntry entry = server.getTracker().trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTrackerEntry replace = new PlayerlistTrackerEntry(entry);
    server.getTracker().trackedEntities.a(player.getEntityId(), replace);
    if (TRACKED_ENTITY_SET != null) {
        try {
            Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
            set.remove(entry);
            set.add(replace);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked();
    }
}
Also used : EntityTrackerEntry(net.minecraft.server.v1_11_R1.EntityTrackerEntry) EnumSet(java.util.EnumSet) Set(java.util.Set) WorldServer(net.minecraft.server.v1_11_R1.WorldServer) DataWatcherObject(net.minecraft.server.v1_11_R1.DataWatcherObject) EntityHumanNPC(net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)

Aggregations

EnumSet (java.util.EnumSet)5 Set (java.util.Set)5 EntityHumanNPC (net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC)1 DataWatcherObject (net.minecraft.server.v1_10_R1.DataWatcherObject)1 EntityTrackerEntry (net.minecraft.server.v1_10_R1.EntityTrackerEntry)1 WorldServer (net.minecraft.server.v1_10_R1.WorldServer)1 DataWatcherObject (net.minecraft.server.v1_11_R1.DataWatcherObject)1 EntityTrackerEntry (net.minecraft.server.v1_11_R1.EntityTrackerEntry)1 WorldServer (net.minecraft.server.v1_11_R1.WorldServer)1 DataWatcherObject (net.minecraft.server.v1_12_R1.DataWatcherObject)1 EntityTrackerEntry (net.minecraft.server.v1_12_R1.EntityTrackerEntry)1 WorldServer (net.minecraft.server.v1_12_R1.WorldServer)1 DataWatcherObject (net.minecraft.server.v1_13_R2.DataWatcherObject)1 EntityTrackerEntry (net.minecraft.server.v1_13_R2.EntityTrackerEntry)1 WorldServer (net.minecraft.server.v1_13_R2.WorldServer)1 EntityTrackerEntry (net.minecraft.server.v1_8_R3.EntityTrackerEntry)1