本文整理汇总了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.getEntityLiving方法的典型用法代码示例。如果您正苦于以下问题:Java EnderTeleportEvent.getEntityLiving方法的具体用法?Java EnderTeleportEvent.getEntityLiving怎么用?Java EnderTeleportEvent.getEntityLiving使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.living.EnderTeleportEvent
的用法示例。
在下文中一共展示了EnderTeleportEvent.getEntityLiving方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerPearl
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
if ( !(event.getEntityLiving() instanceof EntityPlayerMP) )
return;
if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
return;
EntityPlayerMP player = (EntityPlayerMP) event.getEntityLiving();
Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );
Location target = new Location(event, player);
Location newLoc = BorderCheck.checkPlayer(player, target, true, true);
if (newLoc != null)
{
event.setCanceled(true);
event.setTargetX(newLoc.posX);
event.setTargetY(newLoc.posY);
event.setTargetZ(newLoc.posZ);
}
}
示例2: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnderTeleport (EnderTeleportEvent event) {
if (event.getEntityLiving() instanceof EntityLivingBase && !event.getEntityLiving().isDead && event.getEntityLiving().getEntityWorld() instanceof WorldServer) {
for (final TileEntityEnderTether tile : getTethers((WorldServer) event.getEntityLiving().getEntityWorld())) {
if (tile.isEntityCloseEnough(event.getEntityLiving())) {
final BlockPos pos = tile.getPos();
event.setTargetX(pos.getX() + 0.5f);
event.setTargetY(pos.getY());
event.setTargetZ(pos.getZ() + 0.5f);
break;
}
}
}
}
示例3: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEnderTeleport(EnderTeleportEvent event) {
EntityLivingBase target = event.getEntityLiving();
for (EntityLivingBase living : target.world.getEntitiesWithinAABB(EntityLivingBase.class,
AABBHelper.getAABBFromEntity(target, 5)))
if (target != living && isEquipmented(living)) {
AlchemyEventSystem.markEventCanceled(event);
return;
}
if (isEquipmented(target))
event.setAttackDamage(0);
}
示例4: onEndermanTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEndermanTeleport(EnderTeleportEvent event) {
if (event.getEntityLiving() instanceof EntityEnderman && event.getEntityLiving().getEntityData().getBoolean("EIO:tracked")) {
event.setCanceled(true);
}
}