use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity 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);
}
use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity 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);
}
use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity 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);
}
use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity 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);
}
use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity 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);
}
Aggregations