コード例 #1
0
  @Override
  public void use(LivingFallEvent event, ExtendedPlayerKnowledge charon) {
    float fall = Math.round(event.distance) - 3.0F;
    boolean flag = false;
    float size = 0;

    if (fall > 0.0F) {
      if (charon.nanites.decreaseNanites((int) fall)) {
        event.distance -= fall;
        flag = true;
        size = fall / 15;
      } else {
        int nanites = charon.nanites.getNanites();

        if (charon.nanites.decreaseNanites(nanites)) {
          event.distance -= nanites;
          flag = true;
          size = nanites / 15;
        }
      }

      if (flag && size > 0) {
        EntityPlayer player = (EntityPlayer) event.entity;

        ExplosionHelper.newFallExplosion(
            player.worldObj, player, player.posX, player.posY, player.posZ, size * 2);
      }
    }
  }
コード例 #2
0
  /**
   * NOTE: LivingFallEvent is not called in Creative mode, so must also listen for {@link
   * PlayerFlyableFallEvent} Should receive canceled to make sure LeapingBlow triggers/deactivates
   */
  @SubscribeEvent(receiveCanceled = true)
  public void onFall(LivingFallEvent event) {
    if (event.entity instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) event.entity;
      ZSSPlayerInfo info = ZSSPlayerInfo.get(player);
      ZSSPlayerSkills skills = info.getPlayerSkills();
      if (skills.isSkillActive(SkillBase.leapingBlow)) {
        ((LeapingBlow) skills.getPlayerSkill(SkillBase.leapingBlow))
            .onImpact(player, event.distance);
      }

      if (!event.isCanceled() && info.reduceFallAmount > 0.0F) {
        event.distance -= info.reduceFallAmount;
        info.reduceFallAmount = 0.0F;
      }
    }
  }
コード例 #3
0
  @SubscribeEvent
  public void fallEvent(LivingFallEvent event) {
    EntityLivingBase e = event.entityLiving;
    ItemStack is = e.getEquipmentInSlot(1);

    if (is != null) {
      if (is.getItem() instanceof ItemSpringBoots) {
        if (is.getItem() == ItemRegistry.BEDJUMP.getItemInstance() || is.getItemDamage() > 0) {
          // ReikaJavaLibrary.pConsole(event.distance);
          event.distance *= 0.6F;
          // ReikaJavaLibrary.pConsole(event.distance);
          if (is.getItem() == ItemRegistry.BEDJUMP.getItemInstance())
            event.distance = Math.min(event.distance, 25);
        }
      }
    }
  }
コード例 #4
0
 @SubscribeEvent
 public void onPlayerFall(LivingFallEvent e) {
   if (e.entity instanceof EntityPlayer) {
     EntityPlayer player = (EntityPlayer) e.entity;
     if (dawnstoneArmourChecker(player)) {
       e.distance = 0F;
     }
   }
 }
コード例 #5
0
  @ForgeSubscribe
  public void onPlayerFall(LivingFallEvent event) {

    event.setCanceled(event.entity.worldObj.provider.dimensionId == mod_pocketDim.limboDimID);
  }
コード例 #6
0
 @ForgeSubscribe
 public void onEvent(LivingFallEvent evt) {
   if (evt.isCancelable()) {
     evt.setCanceled(true);
   }
 }