当前位置: 首页>>代码示例>>Java>>正文


Java EnderTeleportEvent.setTargetZ方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.setTargetZ方法的典型用法代码示例。如果您正苦于以下问题:Java EnderTeleportEvent.setTargetZ方法的具体用法?Java EnderTeleportEvent.setTargetZ怎么用?Java EnderTeleportEvent.setTargetZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.living.EnderTeleportEvent的用法示例。


在下文中一共展示了EnderTeleportEvent.setTargetZ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:abused,项目名称:World-Border,代码行数:24,代码来源:EnderPearlListener.java

示例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;
            }
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:17,代码来源:FeatureEnderTether.java

示例3: onEnderTeleportEvent

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnderTeleportEvent(EnderTeleportEvent e) {
    World world = e.getEntityLiving().getEntityWorld();
    if (!world.isRemote) {
        List<TileEntity> loadedTileEntityList = new ArrayList<>(world.loadedTileEntityList);

        for (TileEntity tileEntity : loadedTileEntityList) {
            if (tileEntity instanceof OfferingBoxTileEntity) {
                if (((OfferingBoxTileEntity) tileEntity).getChargeLevel() > 0) {
                    if (TotemHelper.hasTotemType((OfferingBoxTileEntity) tileEntity, TotemType.ENDER)) {
                        Modifiers modifiers = TotemHelper.getModifiers(world, (OfferingBoxTileEntity) tileEntity);
                        int radius = DEFAULT_RADIUS + (int) (RANGE_BOOST * modifiers.range);

                        if (!isMobAffected(tileEntity.getPos(), e.getEntity(), radius)) {
                            BlockPos validPos = getValidTeleportPosAround(world, tileEntity.getPos());
                            if (validPos != null) {
                                //FMLLog.log(Level.ERROR, "Redirected endermen with radius: " + radius + " to target: " + validPos);
                                e.setTargetX(validPos.getX());
                                e.setTargetY(validPos.getY());
                                e.setTargetZ(validPos.getZ());
                            }
                            break;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:30,代码来源:EnderLogic.java


注:本文中的net.minecraftforge.event.entity.living.EnderTeleportEvent.setTargetZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。