use of net.minecraft.world.entity.monster.EnderMan in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method setVision.
@Override
public void setVision(Player player, EntityType entityType) {
final net.minecraft.world.entity.LivingEntity entity;
if (entityType == EntityType.CREEPER) {
entity = new Creeper(net.minecraft.world.entity.EntityType.CREEPER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.SPIDER) {
entity = new Spider(net.minecraft.world.entity.EntityType.SPIDER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.CAVE_SPIDER) {
entity = new CaveSpider(net.minecraft.world.entity.EntityType.CAVE_SPIDER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.ENDERMAN) {
entity = new EnderMan(net.minecraft.world.entity.EntityType.ENDERMAN, ((CraftWorld) player.getWorld()).getHandle());
} else {
return;
}
// Spectating an entity then immediately respawning the player prevents a client shader update,
// allowing the player to retain whatever vision the mob they spectated had.
send(player, new ClientboundAddMobPacket(entity));
send(player, new ClientboundSetCameraPacket(entity));
((CraftServer) Bukkit.getServer()).getHandle().moveToWorld(((CraftPlayer) player).getHandle(), ((CraftWorld) player.getWorld()).getHandle(), true, player.getLocation(), false);
}
use of net.minecraft.world.entity.monster.EnderMan in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method setVision.
@Override
public void setVision(Player player, EntityType entityType) {
final net.minecraft.world.entity.LivingEntity entity;
if (entityType == EntityType.CREEPER) {
entity = new Creeper(net.minecraft.world.entity.EntityType.CREEPER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.SPIDER) {
entity = new Spider(net.minecraft.world.entity.EntityType.SPIDER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.CAVE_SPIDER) {
entity = new CaveSpider(net.minecraft.world.entity.EntityType.CAVE_SPIDER, ((CraftWorld) player.getWorld()).getHandle());
} else if (entityType == EntityType.ENDERMAN) {
entity = new EnderMan(net.minecraft.world.entity.EntityType.ENDERMAN, ((CraftWorld) player.getWorld()).getHandle());
} else {
return;
}
// Spectating an entity then immediately respawning the player prevents a client shader update,
// allowing the player to retain whatever vision the mob they spectated had.
send(player, new ClientboundAddMobPacket(entity));
send(player, new ClientboundSetCameraPacket(entity));
((CraftServer) Bukkit.getServer()).getHandle().respawn(((CraftPlayer) player).getHandle(), ((CraftWorld) player.getWorld()).getHandle(), true, player.getLocation(), false);
}
Aggregations