Search in sources :

Example 1 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving in project FireAPI by FireBlade-Serv.

the class FireBossBar method gen.

public void gen(String title) {
    EntityEnderDragon ew = new EntityEnderDragon(((CraftWorld) this.p.getWorld()).getHandle());
    Location loc = this.p.getLocation();
    ew.setInvisible(true);
    ew.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw());
    ew.setCustomName(title);
    PacketPlayOutSpawnEntityLiving pel = new PacketPlayOutSpawnEntityLiving(ew);
    ((CraftPlayer) this.p).getHandle().playerConnection.sendPacket(pel);
}
Also used : EntityEnderDragon(net.minecraft.server.v1_8_R3.EntityEnderDragon) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) Location(org.bukkit.Location)

Example 2 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving in project MechanicsMain by WeaponMechanics.

the class FakeEntity_1_13_R2 method show.

public void show() {
    // Construct the packets out of the loop to save resources, they will
    // be the same for each Player.
    Packet<?> spawn = type.isAlive() ? new PacketPlayOutSpawnEntityLiving((EntityLiving) entity) : new PacketPlayOutSpawnEntity(entity, type == EntityType.FALLING_BLOCK ? Block.getCombinedId(block) : 0);
    PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata(cache, entity.getDataWatcher(), true);
    PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entity, convertYaw(getYaw()));
    PacketPlayOutEntityLook look = new PacketPlayOutEntityLook(cache, convertYaw(getYaw()), convertPitch(getPitch()), false);
    PacketPlayOutEntityVelocity velocity = new PacketPlayOutEntityVelocity(cache, motion.getX(), motion.getY(), motion.getZ());
    for (Player temp : DistanceUtil.getPlayersInRange(location)) {
        PlayerConnection connection = ((CraftPlayer) temp).getHandle().playerConnection;
        if (connections.contains(connection)) {
            continue;
        }
        connection.sendPacket(spawn);
        connection.sendPacket(meta);
        connection.sendPacket(head);
        connection.sendPacket(velocity);
        connection.sendPacket(look);
        PacketPlayOutEntityEquipment[] equipment = getEquipmentPacket();
        if (equipment != null) {
            for (PacketPlayOutEntityEquipment packet : equipment) {
                connection.sendPacket(packet);
            }
        }
        connections.add(connection);
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) Player(org.bukkit.entity.Player) PacketPlayOutEntityLook(net.minecraft.server.v1_13_R2.PacketPlayOutEntity.PacketPlayOutEntityLook)

Example 3 with PacketPlayOutSpawnEntityLiving

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

the class V1_13R2EntityAccessor 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) Entity(net.minecraft.server.v1_13_R2.Entity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_13_R2.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 4 with PacketPlayOutSpawnEntityLiving

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

the class V1_9R2EntityAccessor 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) Entity(net.minecraft.server.v1_9_R2.Entity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_9_R2.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 5 with PacketPlayOutSpawnEntityLiving

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

the class V1_11R1EntityAccessor 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) Entity(net.minecraft.server.v1_11_R1.Entity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Aggregations

FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)9 PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving)4 Location (org.bukkit.Location)3 Player (org.bukkit.entity.Player)3 PacketPlayOutEntityLook (net.minecraft.server.v1_13_R2.PacketPlayOutEntity.PacketPlayOutEntityLook)2 Vector (org.bukkit.util.Vector)2 UltraCosmeticsData (be.isach.ultracosmetics.UltraCosmeticsData)1 ChestType (be.isach.ultracosmetics.treasurechests.ChestType)1 TreasureChestDesign (be.isach.ultracosmetics.treasurechests.TreasureChestDesign)1 MathUtils (be.isach.ultracosmetics.util.MathUtils)1 PacketSender (be.isach.ultracosmetics.util.PacketSender)1 Particles (be.isach.ultracosmetics.util.Particles)1 UtilParticles (be.isach.ultracosmetics.util.UtilParticles)1 CustomPathFinderGoalPanic (be.isach.ultracosmetics.v1_13_R2.pathfinders.CustomPathFinderGoalPanic)1 IEntityUtil (be.isach.ultracosmetics.version.IEntityUtil)1 Sets (com.google.common.collect.Sets)1 Math (java.lang.Math)1 Field (java.lang.reflect.Field)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1