Search in sources :

Example 86 with WorldServer

use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.

the class FallingBlockController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
    Block id = Blocks.STONE;
    int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
    // TODO: how to incorporate this - probably delete?
    if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
        id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
    }
    final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.getBlockData());
    return handle.getBukkitEntity();
}
Also used : CraftFallingBlock(org.bukkit.craftbukkit.v1_15_R1.entity.CraftFallingBlock) EntityFallingBlock(net.minecraft.server.v1_15_R1.EntityFallingBlock) Block(net.minecraft.server.v1_15_R1.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_15_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 87 with WorldServer

use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.

the class LlamaSpitController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
    final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(NMSImpl.<EntityLlamaSpit>getEntityType(EntityLlamaSpitNPC.class), ws, npc);
    handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
    return handle.getBukkitEntity();
}
Also used : WorldServer(net.minecraft.server.v1_15_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 88 with WorldServer

use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.

the class NMSImpl method getCollisionBox.

@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
    WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
    VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
    return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}
Also used : VoxelShape(net.minecraft.server.v1_16_R3.VoxelShape) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 89 with WorldServer

use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.

the class NMSImpl method updateNavigationWorld.

@Override
public void updateNavigationWorld(org.bukkit.entity.Entity entity, World world) {
    if (NAVIGATION_WORLD_FIELD == null)
        return;
    Entity en = NMSImpl.getHandle(entity);
    if (en == null || !(en instanceof EntityInsentient))
        return;
    EntityInsentient handle = (EntityInsentient) en;
    WorldServer worldHandle = ((CraftWorld) world).getHandle();
    try {
        NAVIGATION_WORLD_FIELD.invoke(handle.getNavigation(), worldHandle);
    } catch (Exception e) {
        Messaging.logTr(Messages.ERROR_UPDATING_NAVIGATION_WORLD, e.getMessage());
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : Entity(net.minecraft.server.v1_16_R3.Entity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) EntityInsentient(net.minecraft.server.v1_16_R3.EntityInsentient) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) ReportedException(net.minecraft.server.v1_16_R3.ReportedException) CommandException(net.citizensnpcs.api.command.exception.CommandException)

Example 90 with WorldServer

use of net.minecraft.server.v1_8_R1.WorldServer in project Citizens2 by CitizensDev.

the class NMSImpl method replaceTrackerEntry.

@Override
public void replaceTrackerEntry(Player player) {
    WorldServer server = (WorldServer) NMSImpl.getHandle(player).getWorld();
    EntityTracker entry = server.getChunkProvider().playerChunkMap.trackedEntities.get(player.getEntityId());
    if (entry == null)
        return;
    PlayerlistTracker replace = new PlayerlistTracker(server.getChunkProvider().playerChunkMap, entry);
    server.getChunkProvider().playerChunkMap.trackedEntities.put(player.getEntityId(), replace);
    if (getHandle(player) instanceof EntityHumanNPC) {
        ((EntityHumanNPC) getHandle(player)).setTracked(replace);
    }
}
Also used : EntityTracker(net.minecraft.server.v1_16_R3.PlayerChunkMap.EntityTracker) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) EntityHumanNPC(net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC)

Aggregations

WorldServer (net.minecraft.server.v1_16_R3.WorldServer)24 WorldServer (net.minecraft.server.v1_12_R1.WorldServer)20 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)19 ArrayList (java.util.ArrayList)18 List (java.util.List)16 UUID (java.util.UUID)16 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)16 GameProfile (com.mojang.authlib.GameProfile)15 WorldServer (net.minecraft.server.v1_11_R1.WorldServer)15 Material (org.bukkit.Material)15 WorldServer (net.minecraft.server.v1_14_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_15_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_10_R1.WorldServer)13 Block (org.bukkit.block.Block)13 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)13 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)12 WorldServer (net.minecraft.server.v1_8_R3.WorldServer)12 LivingEntity (org.bukkit.entity.LivingEntity)12 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)11 WorldServer (net.minecraft.server.v1_13_R2.WorldServer)10