Search in sources :

Example 6 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving in project FunnyGuilds by FunnyGuilds.

the class V1_12R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_12_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 7 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving in project FunnyGuilds by FunnyGuilds.

the class V1_16R3EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity);
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_16_R3.Entity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 8 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving in project FunnyGuilds by FunnyGuilds.

the class V1_10R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_10_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_10_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 9 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving in project Denizen-For-Bukkit by DenizenScript.

the class BossBar_v1_8_R3 method showBossBar.

public static void showBossBar(Player player, String text, int health) {
    wither.setCustomName(text);
    wither.setHealth(health);
    Location location = player.getLocation().clone();
    location.add(player.getLocation().getDirection().multiply(30));
    wither.setPosition(location.getX(), location.getY(), location.getZ());
    PacketHelper_v1_8_R3.sendPacket(player, new PacketPlayOutSpawnEntityLiving(wither));
    hasHealthBar.put(player.getName(), true);
    playersWithHealthBar.add(player);
}
Also used : PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) Location(org.bukkit.Location)

Example 10 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving in project FunnyGuilds by FunnyGuilds.

the class V1_8R3EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity) Entity(net.minecraft.server.v1_8_R3.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_8_R3.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Aggregations

FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)9 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving)4 PacketPlayOutEntityLook (net.minecraft.server.v1_10_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)2 Location (org.bukkit.Location)2 Player (org.bukkit.entity.Player)2 ArrayList (java.util.ArrayList)1 Entity (net.minecraft.server.v1_10_R1.Entity)1 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_11_R1.Entity)1 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_12_R1.Entity)1 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)1 PacketPlayOutSpawnEntity (net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity)1 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving)1 Entity (net.minecraft.server.v1_13_R2.Entity)1 EntityLiving (net.minecraft.server.v1_13_R2.EntityLiving)1