本文整理汇总了Java中com.dsh105.echopet.compat.api.event.PetMoveEvent类的典型用法代码示例。如果您正苦于以下问题:Java PetMoveEvent类的具体用法?Java PetMoveEvent怎么用?Java PetMoveEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PetMoveEvent类属于com.dsh105.echopet.compat.api.event包,在下文中一共展示了PetMoveEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tick
import com.dsh105.echopet.compat.api.event.PetMoveEvent; //导入依赖的package包/类
@Override
public void tick() {
//https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PathfinderGoalFollowOwner.java#L57
EntityPlayer owner = ((CraftPlayer) this.pet.getPlayerOwner()).getHandle();
// 1.9: this.d.getControllerLook().a(this.e, 10.0F, this.d.N());
this.pet.getControllerLook().a(owner, 10.0F, (float) this.pet.N());
if (--this.timer <= 0) {
this.timer = 10;
/*if (this.pet.getPlayerOwner().isFlying()) {
//Don't move pet when owner flying
return;
}*/
double speed = 0.6F;
if (!(this.pet instanceof EntityEnderDragonPet) && this.pet.h(owner) > (this.teleportDistance) && ((CraftPlayer) this.pet.getPlayerOwner()).getHandle().onGround || this.pet.getPlayerOwner().isInsideVehicle()) {
this.pet.getPet().teleportToOwner();
return;
}
PetMoveEvent moveEvent = new PetMoveEvent(this.pet.getPet(), this.pet.getLocation(), this.pet.getPlayerOwner().getLocation());
EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
if (moveEvent.isCancelled()) {
return;
}
if (pet.goalTarget == null) {
PathEntity path;
if (pet instanceof EntityGhastPet) {
path = pet.getNavigation().a(pet.getPlayerOwner().getLocation().getBlockX(), pet.getPlayerOwner().getLocation().getBlockY() + 5, pet.getPlayerOwner().getLocation().getBlockZ());
} else {
path = pet.getNavigation().a(owner);
}
//Smooth path finding to entity instead of location
pet.getNavigation().a(path, speed);
}
}
}
示例2: tick
import com.dsh105.echopet.compat.api.event.PetMoveEvent; //导入依赖的package包/类
@Override
public void tick(){
// https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PathfinderGoalFollowOwner.java#L57
EntityPlayer owner = ((CraftPlayer) this.pet.getPlayerOwner()).getHandle();
// 1.9: this.d.getControllerLook().a(this.e, 10.0F, this.d.N());
this.pet.getControllerLook().a(owner, 10.0F, (float) this.pet.N());
if(--this.timer <= 0){
this.timer = 10;
/*if (this.pet.getPlayerOwner().isFlying()) {
//Don't move pet when owner flying
return;
}*/
double speed = 0.6F;
if(!(this.pet instanceof EntityEnderDragonPet) && this.pet.h(owner) > (this.teleportDistance) && ((CraftPlayer) this.pet.getPlayerOwner()).getHandle().onGround || this.pet.getPlayerOwner().isInsideVehicle()){
this.pet.getPet().teleportToOwner();
return;
}
PetMoveEvent moveEvent = new PetMoveEvent(this.pet.getPet(), this.pet.getLocation(), this.pet.getPlayerOwner().getLocation());
EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
if(moveEvent.isCancelled()){ return; }
if(pet.goalTarget == null){
PathEntity path;
if(pet instanceof EntityGhastPet){
path = pet.getNavigation().a(pet.getPlayerOwner().getLocation().getBlockX(), pet.getPlayerOwner().getLocation().getBlockY() + 5, pet.getPlayerOwner().getLocation().getBlockZ());
}else{
path = pet.getNavigation().a(owner);
}
// Smooth path finding to entity instead of location
pet.getNavigation().a(path, speed);
}
}
}
示例3: tick
import com.dsh105.echopet.compat.api.event.PetMoveEvent; //导入依赖的package包/类
@Override
public void tick(){
// https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PathfinderGoalFollowOwner.java#L57
EntityPlayer owner = ((CraftPlayer) this.pet.getPlayerOwner()).getHandle();
// 1.9: this.d.getControllerLook().a(this.e, 10.0F, this.d.N());
this.pet.getControllerLook().a(owner, 10.0F, (float) this.pet.N());
if(--this.timer <= 0){
this.timer = 10;
/*if (this.pet.getPlayerOwner().isFlying()) {
//Don't move pet when owner flying
return;
}*/
double speed = 0.6F;
if(!(this.pet instanceof EntityEnderDragonPet) && this.pet.h(owner) > (this.teleportDistance) && ((CraftPlayer) this.pet.getPlayerOwner()).getHandle().onGround || this.pet.getPlayerOwner().isInsideVehicle()){
this.pet.getPet().teleportToOwner();
return;
}
PetMoveEvent moveEvent = new PetMoveEvent(this.pet.getPet(), this.pet.getLocation(), this.pet.getPlayerOwner().getLocation());
EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
if(moveEvent.isCancelled()){ return; }
if(pet.goalTarget == null){
PathEntity path;
if(pet instanceof EntityGhastPet || pet instanceof EntityVexPet){
path = pet.getNavigation().a(pet.getPlayerOwner().getLocation().getBlockX(), pet.getPlayerOwner().getLocation().getBlockY() + 5, pet.getPlayerOwner().getLocation().getBlockZ());
}else{
path = pet.getNavigation().a(owner);
}
// Smooth path finding to entity instead of location
pet.getNavigation().a(path, speed);
}
}
}
示例4: tick
import com.dsh105.echopet.compat.api.event.PetMoveEvent; //导入依赖的package包/类
@Override
public void tick() {
//https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PathfinderGoalFollowOwner.java#L57
EntityPlayer owner = ((CraftPlayer) this.pet.getPlayerOwner()).getHandle();
this.pet.getControllerLook().a(owner, 10.0F, (float) this.pet.bQ());
if (--this.timer <= 0) {
this.timer = 10;
/*if (this.pet.getPlayerOwner().isFlying()) {
//Don't move pet when owner flying
return;
}*/
double speed = 0.6F;
if(!(this.pet instanceof EntityEnderDragonPet) && this.pet.h(owner) > (this.teleportDistance) && ((CraftPlayer) this.pet.getPlayerOwner()).getHandle().onGround || this.pet.getPlayerOwner().isInsideVehicle()){
this.pet.getPet().teleportToOwner();
return;
}
PetMoveEvent moveEvent = new PetMoveEvent(this.pet.getPet(), this.pet.getLocation(), this.pet.getPlayerOwner().getLocation());
EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
if (moveEvent.isCancelled()) {
return;
}
if (pet.goalTarget == null) {
PathEntity path;
if (pet instanceof EntityGhastPet) {
path = pet.getNavigation().a(pet.getPlayerOwner().getLocation().getBlockX(), pet.getPlayerOwner().getLocation().getBlockY() + 5, pet.getPlayerOwner().getLocation().getBlockZ());
} else {
path = pet.getNavigation().a(owner);
}
//Smooth path finding to entity instead of location
pet.getNavigation().a(path, speed);
}
}
}
示例5: tick
import com.dsh105.echopet.compat.api.event.PetMoveEvent; //导入依赖的package包/类
@Override
public void tick() {
Player owner = pet.getPlayerOwner();
/*
* Make the pet look at the owner.
* Changing up to 10 yaw in the pet's facing (max) per tick.
* The speed to change the pitch at is requested from the entity.
* Also done in PetGoalLookAtPlayer.tick()
*/
this.pet.getEntity().lookAt(owner, 10.0F, (float) this.pet.getEntity().getVerticalFaceSpeed());
if (--this.timer <= 0) {
this.timer = 10;
if (this.pet.getPlayerOwner().isFlying()) {
//Don't move pet when owner flying
return;
}
double speed = 2.0F;
if (this.pet.getEntity().distanceTo(owner) > (this.teleportDistance) && pet.getPlayerEntity().isOnGround()) {
this.pet.getPet().teleportToOwner();
return;
}
PetMoveEvent moveEvent = new PetMoveEvent(this.pet.getPet(), this.pet.getLocation(), this.pet.getPlayerOwner().getLocation());
EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
if (moveEvent.isCancelled()) {
return;
}
PathEntity path;
if (pet.getEntityPetType() == PetType.GHAST) {
path = pet.getEntity().getNavigation().getPathToLocation(pet.getPlayerOwner().getLocation().getBlockX(), pet.getPlayerOwner().getLocation().getBlockY() + 5, pet.getPlayerOwner().getLocation().getBlockZ()); // getPathToLocation
} else {
path = pet.getEntity().getNavigation().getPathTo(owner); // getPathTo
}
//Smooth path finding to entity instead of location
pet.getEntity().getNavigation().navigateTo(path, speed); // Set a new path for the entity to follow
}
}