當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。