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


Java EnderTeleportEvent类代码示例

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


EnderTeleportEvent类属于net.minecraftforge.event.entity.living包,在下文中一共展示了EnderTeleportEvent类的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: 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

示例4: 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

示例5: teleportEntityLivingRandomly

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
public static boolean teleportEntityLivingRandomly(EntityLivingBase entity,double range,double rangeV){
	double x = entity.posX + (rand.nextDouble() - 0.5D) * range;
       double y = entity.posY + (rand.nextDouble() - 0.5D) * rangeV;
       double z = entity.posZ + (rand.nextDouble() - 0.5D) * range;
       EnderTeleportEvent event=new EnderTeleportEvent(entity, x, y, z, 0);
       if(!MinecraftForge.EVENT_BUS.post(event)){
       	boolean didTeleport=entity.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ());
       	if(didTeleport){
       		entity.worldObj.playSound((EntityPlayer)null, entity.prevPosX, entity.prevPosY, entity.prevPosZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, entity.getSoundCategory(), 1.0F, 1.0F);
               entity.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
               return true;
       	}
       	return false;
       }
       return false;
}
 
开发者ID:EnderiumSmith,项目名称:Nuclear-Foundation,代码行数:17,代码来源:MethodUtil.java

示例6: teleportTo

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
protected boolean teleportTo(double x, double y, double z)
{
    EnderTeleportEvent event = new EnderTeleportEvent(this, x, y, z, 0);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return false;
    }

    boolean success = this.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ());

    if (success)
    {
        this.getEntityWorld().playSound(null, this.prevPosX, this.prevPosY, this.prevPosZ,
                SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
    }

    return success;
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:19,代码来源:EntityEndermanFighter.java

示例7: onImpact

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
	if (par1MovingObjectPosition.entityHit != null) {
		par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
	}
	for (int i = 0; i < 32; ++i) {
		this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
	}
	if (!this.worldObj.isRemote) {
		if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP) {
			EntityPlayerMP entityplayermp = (EntityPlayerMP)this.getThrower();
			if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj) {
				EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5);
				if (!MinecraftForge.EVENT_BUS.post(event)) {
					this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
					this.getThrower().fallDistance = 0.0F;
				}
			}
		}
		this.setDead();
	}
}
 
开发者ID:DarthFeder,项目名称:Reliquary,代码行数:23,代码来源:EntitySpecialEnderPearl.java

示例8: 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

示例9: teleportEvent

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
@SubscribeEvent
public void teleportEvent(EnderTeleportEvent event) {
	if (EtFuturum.enableEndermite) {
		EntityLivingBase entity = event.entityLiving;
		if (entity instanceof EntityPlayerMP)
			if (entity.getRNG().nextFloat() < 0.05F && entity.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) {
				EntityEndermite entityendermite = new EntityEndermite(entity.worldObj);
				entityendermite.setSpawnedByPlayer(true);
				entityendermite.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
				entity.worldObj.spawnEntityInWorld(entityendermite);
			}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:14,代码来源:ServerEventHandler.java

示例10: teleportTo

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
private boolean teleportTo(double x, double y, double z) {
	EnderTeleportEvent event = new EnderTeleportEvent(this, x, y, z, 0);
	if (MinecraftForge.EVENT_BUS.post(event)) {
		return false;
	}
	boolean flag = attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ());

	if (flag) {
		EasyMappings.world(this).playSound((EntityPlayer) null, prevPosX, prevPosY, prevPosZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, getSoundCategory(), 1.0F, 1.0F);
		playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
	}

	return flag;
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:15,代码来源:EntityFrienderman.java

示例11: Location

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
/**
 * Creates a Location based on the target position of a player and a fired
 * {@link EnderTeleportEvent}
 */
public Location(EnderTeleportEvent event, EntityPlayerMP player)
{
    world = (WorldServer) player.worldObj;
    posX  = event.getTargetX();
    posY  = event.getTargetY();
    posZ  = event.getTargetZ();
    pitch = player.rotationPitch;
    yaw   = player.rotationYaw;
}
 
开发者ID:abused,项目名称:World-Border,代码行数:14,代码来源:Location.java

示例12: 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

示例13: enderPearlTeleport

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
@SubscribeEvent
public void enderPearlTeleport(EnderTeleportEvent ev) {
	if (ev.getEntity().getEntityWorld().isRemote || !(ev.getEntity() instanceof EntityPlayerMP)) {
		return;
	}
	EntityPlayerMP player = (EntityPlayerMP) ev.getEntity();
	if (isWearingEnderBoots(player)) {
		ev.setAttackDamage(0.01f);
		damageEnderBoots(player);
	}
}
 
开发者ID:ToroCraft,项目名称:TeleToro,代码行数:12,代码来源:Teletory.java

示例14: 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);
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:13,代码来源:ItemRingSpace.java

示例15: Location

import net.minecraftforge.event.entity.living.EnderTeleportEvent; //导入依赖的package包/类
/**
 * Creates a Location based on the target position of a player and a fired
 * {@link EnderTeleportEvent}
 */
public Location(EnderTeleportEvent event, EntityPlayerMP player)
{
    world = (WorldServer) player.worldObj;
    posX  = event.targetX;
    posY  = event.targetY;
    posZ  = event.targetZ;
    pitch = player.rotationPitch;
    yaw   = player.rotationYaw;
}
 
开发者ID:RoyCurtis,项目名称:WorldBorder-Forge,代码行数:14,代码来源:Location.java


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