當前位置: 首頁>>代碼示例>>Java>>正文


Java EnderTeleportEvent.setCanceled方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.setCanceled方法的典型用法代碼示例。如果您正苦於以下問題:Java EnderTeleportEvent.setCanceled方法的具體用法?Java EnderTeleportEvent.setCanceled怎麽用?Java EnderTeleportEvent.setCanceled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.living.EnderTeleportEvent的用法示例。


在下文中一共展示了EnderTeleportEvent.setCanceled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: magnumTorchDenyTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void magnumTorchDenyTeleport(final EnderTeleportEvent event) {
    if (event.entityLiving instanceof EntityEnderman && !((EntityEnderman)event.entityLiving).isScreaming()) {
        for (final int[] coord : EventHandlerServer.magnumTorchRegistry) {
            if (coord[0] == event.entity.worldObj.provider.dimensionId && event.entity.worldObj.blockExists(coord[1], coord[2], coord[3]) && event.entity.worldObj.getTileEntity(coord[1], coord[2], coord[3]) instanceof IAntiMobTorch) {
                final TileEntity tile = event.entity.worldObj.getTileEntity(coord[1], coord[2], coord[3]);
                final double dx = tile.xCoord + 0.5f - event.targetX;
                final double dy = tile.yCoord + 0.5f - event.targetY;
                final double dz = tile.zCoord + 0.5f - event.targetZ;
                if ((dx * dx + dz * dz) / ((IAntiMobTorch)tile).getHorizontalTorchRangeSquared() + dy * dy / ((IAntiMobTorch)tile).getVerticalTorchRangeSquared() > 1.0) {
                    continue;
                }
                final double dx2 = tile.xCoord + 0.5f - event.entity.posX;
                final double dy2 = tile.yCoord + 0.5f - event.entity.posY;
                final double dz2 = tile.zCoord + 0.5f - event.entity.posZ;
                if (dx * dx + dy * dy + dz * dz >= dx2 * dx2 + dy2 * dy2 + dz2 * dz2) {
                    continue;
                }
                event.setCanceled(true);
            }
        }
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:24,代碼來源:EventHandlerServer.java

示例3: onPlayerPearl

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
    if ( !(event.entityLiving instanceof EntityPlayerMP) )
        return;

    if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
        return;

    EntityPlayerMP player = (EntityPlayerMP) event.entityLiving;
    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.targetX = newLoc.posX;
        event.targetY = newLoc.posY;
        event.targetZ = newLoc.posZ;
    }
}
 
開發者ID:RoyCurtis,項目名稱:WorldBorder-Forge,代碼行數:24,代碼來源:EnderPearlListener.java

示例4: onTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@Override
public void onTeleport(EnderTeleportEvent event, EntityLivingBase entity, double targetX, double targetY, double targetZ, int amplifier) {
	int redo = 5 - amplifier;
	if (redo < 0 || entity.world.rand.nextInt(redo) == 0) {
		event.setCanceled(true);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:8,代碼來源:EnderInhibitionBrew.java

示例5: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
	if (isTeleportPrevented(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, false)) {
		event.setCanceled(true);
	}
	if (isTeleportPrevented(event.getEntity().getEntityWorld(), event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) {
		event.setCanceled(true);
	}
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:10,代碼來源:EventHandler.java

示例6: BlockMobTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void BlockMobTeleport(EnderTeleportEvent event){
    if (!event.isCancelable()){return;}
    for (MobInhibitorReference Ref : MobInhibitor.HostileInhibitors){
        if (TestRange(Ref, event.targetX, event.targetY, event.targetZ, event.entity.worldObj.provider.dimensionId)) {
            event.setCanceled(true);
            LogHelper.debug("Blocked an Enderman teleport based on inhibitor at:"+Ref.i+", "+Ref.j+", "+Ref.k);
            break;
        }
    }

}
 
開發者ID:yarrim,項目名稱:MobInhibitor,代碼行數:13,代碼來源:ServerEventHandler.java

示例7: on

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void on(EnderTeleportEvent e) {
    if (!(e.entityLiving instanceof EntityPlayer) && !(e.entityLiving instanceof IBossDisplayData)) {
        if (TileBlockProtector.isSpotProtected(e.entityLiving.worldObj, e.entityLiving)) {
            e.setCanceled(true);
        }
    }
}
 
開發者ID:makeoo,項目名稱:Gadomancy,代碼行數:9,代碼來源:EventHandlerEntity.java

示例8: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
	// stop enderpearls from working
	if (event.entityLiving.worldObj.provider.dimensionId == Reference.DIMENSION_ID) {
		event.setCanceled(true);
	}
}
 
開發者ID:NPException,項目名稱:Dimensional-Pockets,代碼行數:8,代碼來源:InsidePocketEventHandler.java

示例9: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEnderTeleport(EnderTeleportEvent event){
    if(!HackableEnderman.onEndermanTeleport(event.entity)) {
        event.setCanceled(true);
    } else {
        if(Config.enableEndermanSeedDrop && Math.random() < 0.05D) {
            if(!event.entity.worldObj.isRemote) ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.ENDER_PLANT_DAMAGE), 0));
        }
    }
}
 
開發者ID:MineMaarten,項目名稱:PneumaticCraft,代碼行數:11,代碼來源:EventHandlerPneumaticCraft.java

示例10: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
  if (isTeleportPrevented(event.getEntity().world, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ)) {
    event.setCanceled(true);
  }
  if (isTeleportPrevented(event.getEntity().world, event.getTargetX(), event.getTargetY(), event.getTargetZ())) {
    event.setCanceled(true);
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:10,代碼來源:BlockInhibitorObelisk.java

示例11: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEnderTeleport(EnderTeleportEvent event) {
    if (!HackableEnderman.onEndermanTeleport(event.getEntity())) {
        event.setCanceled(true);
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:7,代碼來源:EventHandlerPneumaticCraft.java

示例12: stopEndermanTeleporting

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void stopEndermanTeleporting(EnderTeleportEvent e){
    if((e.getEntity() instanceof EntityEnderman || e.getEntity() instanceof EntityShulker) && ConfigurationFile.stopMobsFromTeleporting){
        e.setCanceled(true);
    }
}
 
開發者ID:baileyholl,項目名稱:Event-Tweaks,代碼行數:7,代碼來源:MobEventHandler.java

示例13: onEvent

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@Override
public void onEvent(EnderTeleportEvent event) {
	if (!this.endermanteleport) event.setCanceled(true);
}
 
開發者ID:MrNobody98,項目名稱:morecommands,代碼行數:5,代碼來源:CommandEnderman.java

示例14: onEnderTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void onEnderTeleport(EnderTeleportEvent event){
    if(event.entityLiving.isPotionActive(PotionFreeze.instance)){
        event.setCanceled(true);
    }
}
 
開發者ID:Enrrik,項目名稱:minecraftmod-golemworld,代碼行數:7,代碼來源:GolemWorldEventHooks.java

示例15: 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);
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:7,代碼來源:EndermanFixer.java


注:本文中的net.minecraftforge.event.entity.living.EnderTeleportEvent.setCanceled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。