当前位置: 首页>>代码示例>>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;未经允许,请勿转载。