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


Java LivingFallEvent.getEntityLiving方法代码示例

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


在下文中一共展示了LivingFallEvent.getEntityLiving方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent evt) {
	final Entity e = evt.getEntityLiving();
	if (evt.getDistance() > 4 && !e.isSneaking() && e instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer)e;

		EnchantmentLevel level = tryUseEnchantment(player, EntityEquipmentSlot.FEET);
		if (level == null) return;
		JumpInfo boost = new JumpInfo(level, evt.getDistance());
		level.createJumpExplosion(player);
		if (OpenMods.proxy.isClientPlayer(player)) {
			// And Now, Ladies and Gentlemen!
			// Logic Defying...
			// Loved By Everyone...
			// Possibly Buggy
			// TEEERRRRRIIIIBLE HAAAAAACK!
			KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode(), true);
			// no, seriously, can't find better way to make jump
			jumpBoosts.put(player, boost);
		}
		evt.setCanceled(true);
	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:24,代码来源:ExplosiveEnchantmentsHandler.java

示例2: onFall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent event) {
    if (event.getEntityLiving() instanceof EntityPlayer) {
        PossessivePlayer possessivePlayer = PossessHandler.get((EntityPlayer) event.getEntityLiving());
        if (possessivePlayer != null) {
            possessivePlayer.getPossessing().fall(event.getDistance(), event.getDamageMultiplier());
            event.setCanceled(true);
        }
    }
}
 
开发者ID:Fararise,项目名称:Possessed,代码行数:11,代码来源:ServerEventHandler.java

示例3: fall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void fall(LivingFallEvent event) {
	EntityLivingBase entity = event.getEntityLiving();
	if (!entity.isPotionActive(this)) return;

	PotionEffect effect = entity.getActivePotionEffect(this);
	if (effect == null) return;

	event.setDistance((float) (event.getDistance() / (effect.getAmplifier() + 0.5)));
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:11,代码来源:PotionLowGrav.java

示例4: fall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
public void fall(LivingFallEvent e) {
	EntityLivingBase entitySource = e.getEntityLiving();
	PotionEffect crash = entitySource.getActivePotionEffect(this);
	if (crash == null) return;

	PotionEffect jump = entitySource.getActivePotionEffect(MobEffects.JUMP_BOOST);
	float f = (jump == null) ? 0.0f : (jump.getAmplifier() + 1);
	float damage = MathHelper.clamp((e.getDistance() - 3.0f - f) * e.getDamageMultiplier() * 2, 0, 10f);

	float range = damage / 10f + Math.max(crash.getAmplifier(), 5);

	if (damage > 0.0f) {
		e.setDamageMultiplier(e.getDamageMultiplier() / (crash.getAmplifier() + 2));
		List<EntityLivingBase> entities = entitySource.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySource.getEntityBoundingBox().grow(range * 2));
		entities.stream().filter(entity -> entity != entitySource && entity.onGround).forEach(entity -> {
				entity.attackEntityFrom(damageSourceEarthquake(entitySource), range);
			entity.motionY = range / 10.0;
			entity.velocityChanged = true;
		});

		if (!entitySource.world.isRemote) for (BlockPos pos : BlockPos.getAllInBoxMutable(
				new BlockPos(entitySource.getPositionVector())
						.add(-range,
								-2,
								-range),
				new BlockPos(entitySource.getPositionVector())
						.add(range,
								0,
								range))) {
			IBlockState state = entitySource.world.getBlockState(pos);
			if (state.isFullCube()) entitySource.world.playEvent(2001, pos.toImmutable(), Block.getStateId(state));
		}
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:36,代码来源:PotionCrash.java

示例5: onFall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
    public void onFall (LivingFallEvent event) {
        if (event.getEntityLiving() instanceof EntityPlayer) {
            EntityPlayer player = (EntityPlayer) event.getEntityLiving();
            DriveStateCapability.IDriveState DS = player.getCapability(ModCapabilities.DRIVE_STATE, null);
            if (DS.getInDrive())
                event.setDistance(0);
            
//            if(player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() == 0){
//                player.motionY=-0.001;
//            }
        }
    }
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:14,代码来源:EntityEvents.java

示例6: onFall

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onFall(LivingFallEvent event) {
  EntityLivingBase entity = event.getEntityLiving();
  if (entity == null || entity instanceof EntityPlayer == false || entity.isSneaking()
      || entity.isPotionActive(this) == false) {
    return;
  }
  EntityPlayer player = (EntityPlayer) entity;
  if (event.getDistance() >= MIN_HEIGHT_START_BOUNCE) {
    event.setDamageMultiplier(0);
    if (entity.getEntityWorld().isRemote == false) {
      event.setCanceled(true); //nada serverside
    }
    else {
      UtilSound.playSound(player, player.getPosition(), SoundEvents.BLOCK_SLIME_FALL, SoundCategory.PLAYERS, UtilSound.VOLUME / event.getDistance());
      UtilParticle.spawnParticle(player.world, EnumParticleTypes.SLIME, player.getPosition());
      event.setDistance(0);// fall distance
      player.motionY *= -PERCENT_HEIGHT_BOUNCED;
      player.isAirBorne = true;
      player.onGround = false;
      //postpone until one tick later. otherwise there is vanilla code internally that says "ok you finished falldamage so motionY=0;"
      player.posY += 0.01;
      player.getEntityData().setInteger(NBT_TICK, player.ticksExisted + 1);
      player.getEntityData().setInteger(NBT_MOTIONY, (int) (player.motionY * 100f));
    }
  }
  else if (!entity.getEntityWorld().isRemote && entity.isSneaking()) {
    event.setDamageMultiplier(DAMAGE_REDUCTION);
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:31,代码来源:PotionBounce.java

示例7: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingFallEvent event) {
    if (event.getEntityLiving() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntityLiving();
        int damage = (int) (event.getDistance() - 3);
        int maxAbsorbed = PlayerTracker.getPlayerData(player).getAbilities().getFallDamagePrevention();
        if (damage < maxAbsorbed) {
            event.setCanceled(true);
        } else {
            event.setDistance(event.getDistance() - maxAbsorbed);
        }
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:14,代码来源:RewardFallDamage.java

示例8: onFallEvent

import net.minecraftforge.event.entity.living.LivingFallEvent; //导入方法依赖的package包/类
@SuppressWarnings("unused")
    @SubscribeEvent
    public void onFallEvent(LivingFallEvent event) {
        if (event.getEntityLiving() instanceof EntityPlayer && isDismounting) { //ConfigHandler.isDismounting()) {
			event.setCanceled(true);
			event.setDistance(0.0f);
			event.setDamageMultiplier(0.0f);
//            ConfigHandler.setIsDismounting(false);
            isDismounting = false;
        }
    }
 
开发者ID:m1k3s,项目名称:parachute,代码行数:12,代码来源:PlayerFallEvent.java


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