@Override
 public void onArtUpdate(ItemStack par1ItemStack, EntityPlayer p) {
   if (p.worldObj.isDaytime()) {
     p.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 10, 0, true));
     p.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 100, 0, true));
   }
 }
 @Override
 public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack) {
   if (itemstack.getItem() == ACItems.abyssalnite_helmet)
     player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 20, 0));
   if (itemstack.getItem() == ACItems.abyssalnite_boots)
     player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 20, 0));
 }
 @Override
 public void doBacklashEffect(PropertyDoom doom, EntityPlayer player) {
   if (TragicConfig.allowHarmony) {
     player.addPotionEffect(new PotionEffect(TragicPotion.Harmony.id, 240));
   } else {
     player.addPotionEffect(new PotionEffect(Potion.blindness.id, 240));
   }
 }
Exemple #4
0
 @Override
 protected void onFoodEaten(
     ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
   par3EntityPlayer.addPotionEffect(
       new PotionEffect(Potion.poison.id, 150, 0)); // Potion Effect, Duration, Amplifier, Ambient
   par3EntityPlayer.addPotionEffect(
       new PotionEffect(
           Potion.moveSpeed.id, 650, 1)); // Potion Effect, Duration, Amplifier, Ambient
 }
 @Override
 public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {
   if (player.getCurrentArmor(2) != null && player.getCurrentArmor(2).getItem() == CompMod.dChest)
     // player.addVelocity(0, 1, 0);
     if (player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem() == CompMod.dLegs)
       player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 2, 10));
   if (player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == CompMod.dBoots)
     player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 2, 10));
   if (player.getCurrentArmor(3) != null && player.getCurrentArmor(3).getItem() == CompMod.dHelm)
     player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 2, 10));
 }
  @Override
  public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean currentItem) {
    EntityPlayer player = (EntityPlayer) entity;

    if (!currentItem) {
      return;
    } else {
      player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 10));
      player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 10, 3));
    }
  }
  public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
    entityPlayer.getFoodStats().addStats(this);
    world.playSoundAtEntity(
        entityPlayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
    itemStack.stackSize--;

    entityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 1 * 2400, 0));
    entityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 1 * 2400, 0));
    entityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 1 * 2400, 0));

    return new ItemStack(Item.glassBottle);
  }
  protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
    EntityXPOrb entity =
        new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(14) + 6);
    spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);

    player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 600, 0));
  }
  /** 食べる動作 */
  @Override
  public ItemStack onEaten(ItemStack item, World world, EntityPlayer player) {
    int meta = item.getItemDamage();

    if (!player.capabilities.isCreativeMode) {
      --item.stackSize;
    }
    this.returnItemStack(player, meta);

    if (!world.isRemote) {
      if (this.effectOnEaten(player, meta) != null) {
        ArrayList<PotionEffect> potion = this.effectOnEaten(player, meta);
        if (potion != null && !potion.isEmpty()) {
          for (PotionEffect ret : potion) {
            player.addPotionEffect(ret);
          }
        }
      }

      if (this.hungerOnEaten(meta) != null) {
        int[] h = this.hungerOnEaten(meta);
        player.getFoodStats().addStats(h[0], h[1]);
      }
    }

    return item;
  }
  @Override
  protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer player) {
    player.extinguish();

    if (!world.isRemote) {
      Random random = player.getRNG();
      int max = random.nextInt(3) + 1;

      for (int i = 0; i < max; ++i) {
        Potion potion = null;

        while (potion == null
            || potion.getEffectiveness() <= 0.5D
            || player.isPotionActive(potion)) {
          potion = Potion.potionTypes[random.nextInt(Potion.potionTypes.length)];
        }

        if (potion != null) {
          player.addPotionEffect(new PotionEffect(potion.getId(), random.nextInt(500) + 150));
        }
      }
    }

    player.getFoodStats().addStats((20 - player.getFoodStats().getFoodLevel()) / 2, 0.5F);
    player.heal((player.getMaxHealth() - player.getHealth()) * 0.5F);
  }
  public static void effect(TileTotemIntelligence totem, int i, int upgrades) {
    if (totem.worldObj.getWorldTime() % 80L == 0) {
      if (EntityUtil.getEntitiesInRange(
              totem.worldObj,
              totem.xCoord,
              totem.yCoord,
              totem.zCoord,
              10 + (upgrades * 5),
              10 + (upgrades * 5))
          != null) {
        for (Entity entity :
            EntityUtil.getEntitiesInRange(
                totem.worldObj,
                totem.xCoord,
                totem.yCoord,
                totem.zCoord,
                10 + (upgrades * 5),
                10 + (upgrades * 5))) {
          if (entity instanceof EntityPlayer) {
            if (entity.isBurning()) {
              Random rand = new Random();
              ((EntityPlayer) entity).heal(4 + rand.nextInt(4));
            }

            ((EntityPlayer) entity)
                .addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0));

            totem.decreaseChlorophyll(TotemUtil.decrementAmount(i));
          }
        }
      }
    }
  }
  @SubscribeEvent
  public void livingUpdate(LivingUpdateEvent event) {
    if (event.entityLiving instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) event.entityLiving;
      ItemStack is = player.inventory.armorItemInSlot(3);

      if ((is != null) && (is.getItem() == InitItems.itemBrassGoggles))
        player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 0, true));
      if ((is != null) && (is.getItem() == InitItems.itemDivingHelmet) && player.isInWater())
        player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 0, true));

      // TODO Change tis!!
      ItemStack stack = player.inventory.armorItemInSlot(0);
      if (stack == null) player.stepHeight = 0.5F;
    }
  }
 @Override
 public ItemStack onEaten(ItemStack ist, World world, EntityPlayer player) {
   if (!isPotion(ist)) return ist;
   if (!player.capabilities.isCreativeMode) {
     --ist.stackSize;
   }
   if (!world.isRemote) {
     PotionEffect effects[] = new PotionEffect[2];
     effects = getPotionEffects(ist);
     for (PotionEffect effect : effects) {
       if (effect == null) {
         continue;
       }
       player.addPotionEffect(effect);
     }
     if (isPanacea(ist)) {
       player.removePotionEffect(Potion.wither.id);
       player.removePotionEffect(Potion.hunger.id);
       player.removePotionEffect(Potion.poison.id);
       player.removePotionEffect(Potion.confusion.id);
       player.removePotionEffect(Potion.digSlowdown.id);
       player.removePotionEffect(Potion.moveSlowdown.id);
       player.removePotionEffect(Potion.blindness.id);
       player.removePotionEffect(Potion.weakness.id);
     }
   }
   if (!player.capabilities.isCreativeMode) {
     if (ist.stackSize <= 0) return new ItemStack(this, 1, emptyVialMeta());
     player.inventory.addItemStackToInventory(new ItemStack(this, 1, emptyVialMeta()));
   }
   return ist;
 }
 @Override
 public void onEaten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer) {
   aStack.stackSize--;
   ItemStack tStack = GT_OreDictUnificator.get(GT_Utility.copy(mEmptyContainer));
   if (tStack != null && !aPlayer.inventory.addItemStackToInventory(tStack))
     aPlayer.dropPlayerItemWithRandomChoice(tStack, true);
   aPlayer.worldObj.playSoundAtEntity(
       aPlayer, "random.burp", 0.5F, aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F);
   if (!aPlayer.worldObj.isRemote) {
     if (mMilk) {
       aPlayer.curePotionEffects(new ItemStack(Items.milk_bucket, 1, 0));
     }
     for (int i = 3; i < mPotionEffects.length; i += 4) {
       if (aPlayer.worldObj.rand.nextInt(100) < mPotionEffects[i]) {
         aPlayer.addPotionEffect(
             new PotionEffect(
                 mPotionEffects[i - 3],
                 mPotionEffects[i - 2],
                 mPotionEffects[i - 1],
                 mInvisibleParticles));
       }
     }
     if (mExplosive) {
       aPlayer.worldObj.newExplosion(
           aPlayer, aPlayer.posX, aPlayer.posY, aPlayer.posZ, 4, true, true);
       aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE);
     }
   }
 }
 private void handleEffectsForDimension(int power, int id, DimensionInformation information) {
   WorldServer world = DimensionManager.getWorld(id);
   if (world != null) {
     Set<EffectType> effects = information.getEffectTypes();
     List<EntityPlayer> players = new ArrayList<EntityPlayer>(world.playerEntities);
     for (EntityPlayer player : players) {
       for (EffectType effect : effects) {
         Integer potionEffect = effectsMap.get(effect);
         if (potionEffect != null) {
           Integer amplifier = effectAmplifierMap.get(effect);
           if (amplifier == null) {
             amplifier = 0;
           }
           player.addPotionEffect(
               new PotionEffect(potionEffect, EFFECTS_MAX * MAXTICKS * 3, amplifier, true));
         } else if (effect == EffectType.EFFECT_FLIGHT) {
           BuffProperties.addBuff(player, PlayerBuff.BUFF_FLIGHT, EFFECTS_MAX * MAXTICKS * 2);
         }
       }
       if (power < DimletConfiguration.DIMPOWER_WARN3) {
         // We are VERY low on power. Start bad effects.
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
         player.addPotionEffect(
             new PotionEffect(Potion.poison.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
       } else if (power < DimletConfiguration.DIMPOWER_WARN2) {
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 1, true));
       } else if (power < DimletConfiguration.DIMPOWER_WARN1) {
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true));
       }
     }
   }
 }
 @Override
 public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
   super.onUpdate(stack, world, entity, par4, par5);
   EntityPlayer player = (EntityPlayer) entity;
   ItemStack equipped = player.getCurrentEquippedItem();
   if (equipped == stack) {
     player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 6, 5));
   }
 }
  public static void checkPlayerPositions() {
    World worldObj = CompactMachines.instance.machineHandler.getWorld();
    if (worldObj.getTotalWorldTime() % 10 == 0) {
      for (int i = 0; i < worldObj.playerEntities.size(); i++) {
        if (worldObj.playerEntities.get(i) instanceof EntityPlayer) {
          EntityPlayer player = (EntityPlayer) worldObj.playerEntities.get(i);

          // Protect against falling into the void
          if (player.posY < 10) {
            player.fallDistance = 0;
            teleportPlayerOutOfMachineDimension((EntityPlayerMP) player);
            continue;
          }

          if (!ConfigurationHandler.keepPlayersInsideOfRooms) {
            continue;
          }

          if (player.capabilities.isCreativeMode && PlayerUtils.isPlayerOpped(player)) {
            // Opped players in creative mode are actually allowed to leave the rooms
            continue;
          }

          int lastCoord = PlayerUtils.getPlayerCoords(player);
          if (lastCoord == -1) {
            // We don't know where the player is atm :(
            continue;
          }

          if (!CompactMachines.instance.machineHandler.hasRoomSize(lastCoord)) {
            // We sadly don't know the size of the room the player is in. Skipping.
            // This automatically changes once any player enters the cube again.
            continue;
          }

          int roomSize =
              Reference.getBoxSize(CompactMachines.instance.machineHandler.getRoomSize(lastCoord));

          AxisAlignedBB bb = CubeTools.getBoundingBoxForCube(lastCoord, roomSize);
          if (!bb.isVecInside(Vec3.createVectorHelper(player.posX, player.posY, player.posZ))) {
            teleportPlayerToCoords((EntityPlayerMP) player, lastCoord, true);

            // Add potion effects for 200 ticks
            player.addPotionEffect(new PotionEffect(2, 200, 5, false)); // Slowness
            player.addPotionEffect(new PotionEffect(9, 200, 5, false)); // Nausea
          }
        }
      }
    }
  }
  @Override
  public void doBacklashEffect(PropertyDoom doom, EntityPlayer player) {

    player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 60, 0));
    player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60, 0));
    player.addPotionEffect(new PotionEffect(Potion.jump.id, 60, 0));
    player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 0));
    player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60, 0));

    player.addPotionEffect(new PotionEffect(Potion.confusion.id, 640, 0));
    if (TragicConfig.allowDisorientation)
      player.addPotionEffect(new PotionEffect(TragicPotion.Disorientation.id, 640, 1));
  }
Exemple #19
0
  @Override
  public boolean onBlockActivated(
      World world,
      int x,
      int y,
      int z,
      EntityPlayer player,
      int side,
      float hitX,
      float hitY,
      float hitZ) {
    if (world.isRemote) return true;
    TileEntityJarOHoney tile = Utils.getTileEntity(world, x, y, z, TileEntityJarOHoney.class);
    if (tile == null) return false;

    ItemStack stack = player.getCurrentEquippedItem();
    if (FluidContainerRegistry.isFilledContainer(stack)) {
      FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
      if (fluidStack.isFluidEqual(tile.getHoney()))
        if (fluidStack.amount + tile.getHoney().amount > TileEntityJarOHoney.HONEY_MAX_AMOUNT)
          return true;
        else {
          tile.addHoney(fluidStack.amount);
          ItemStack container = stack.getItem().getContainerItem(stack);
          stack.stackSize--;
          if (stack.stackSize <= 0) player.setCurrentItemOrArmor(0, container);
          else if (!player.inventory.addItemStackToInventory(container))
            Utils.dropStack(world, x, y, z, container);

          return true;
        }
    } else if (FluidContainerRegistry.isEmptyContainer(stack)) {
      ItemStack filledContainer = FluidContainerRegistry.fillFluidContainer(tile.getHoney(), stack);
      if (filledContainer != null) {
        stack.stackSize--;
        if (stack.stackSize <= 0) player.setCurrentItemOrArmor(0, filledContainer);
        else if (!player.inventory.addItemStackToInventory(filledContainer))
          Utils.dropStack(world, x, y, z, filledContainer);

        tile.drainHoney(FluidContainerRegistry.getFluidForFilledItem(filledContainer).amount);
        return true;
      }
    } else {
      player.getFoodStats().addStats(1, 0.8F);
      player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1));
      tile.drainHoney(100);
    }
    return false;
  }
 public ItemStack onItemRightClick(
     ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
   if (!par3EntityPlayer.capabilities.isCreativeMode) {
     if (ChiliMod.enableSpecialChiliSounds) {
       par2World.playSoundAtEntity(
           par3EntityPlayer,
           "ChiliMod:activateSpecialChili",
           0.5F,
           par2World.rand.nextFloat() * 0.1F + 0.9F);
     }
     par1ItemStack.stackSize -= 1;
   }
   par3EntityPlayer.addPotionEffect(new PotionEffect(ChiliMod.CMInvincibilityPotion.id, 300, 0));
   return par1ItemStack;
 }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  @SuppressWarnings("unchecked")
  public void onLivingUpdate() {
    if (!(this.dimension == Config.dimensionID && ECUtils.isEventActive("ec3.event.fumes")))
      this.setDead();

    if (!this.worldObj.isRemote) {
      --this.heightOffsetUpdateTime;

      if (this.heightOffsetUpdateTime <= 0) {
        this.heightOffsetUpdateTime = 100;
        this.mX = MathUtils.randomDouble(this.worldObj.rand);
        this.mY = MathUtils.randomDouble(this.worldObj.rand);
        this.mZ = MathUtils.randomDouble(this.worldObj.rand);
        this.setHeightOffset(0.5F + (float) this.rand.nextGaussian() * 3.0F);
      }
      this.motionX = mX / 10;
      this.motionY = mY / 10;
      this.motionZ = mZ / 10;
      if (this.ticksExisted > 1000) this.setDead();
    }
    EssentialCraftCore.proxy.spawnParticle(
        "fogFX", (float) posX, (float) posY + 2, (float) posZ, 0.0F, 1.0F, 0.0F);
    List<EntityPlayer> players =
        this.worldObj.getEntitiesWithinAABB(
            EntityPlayer.class,
            AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)
                .expand(6, 3, 6));
    for (int i = 0; i < players.size(); ++i) {
      EntityPlayer p = players.get(i);
      boolean ignorePoison = false;
      IInventory b = BaublesApi.getBaubles(p);
      if (b != null) {
        for (int i1 = 0; i1 < b.getSizeInventory(); ++i1) {
          ItemStack is = b.getStackInSlot(i1);
          if (is != null
              && is.getItem() != null
              && is.getItem() instanceof BaublesModifier
              && is.getItemDamage() == 19) ignorePoison = true;
        }
      }
      if (!p.worldObj.isRemote && !ignorePoison) {
        RadiationManager.increasePlayerRadiation(p, 10);
        p.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1));
      }
    }
    super.onLivingUpdate();
  }
 @Override
 protected void onFoodEaten(ItemStack p_77849_1_, World p_77849_2_, EntityPlayer p_77849_3_) {
   if (!p_77849_2_.isRemote) {
     if (effectsArray != null) {
       for (int i = 0; i < effectsArray.length; i++) {
         Cfg_PotionEffect effect = effectsArray[i];
         if (p_77849_2_.rand.nextFloat() < effect.potionEffectProbability) {
           p_77849_3_.addPotionEffect(
               new PotionEffect(
                   Util.potionEffectId(effect.effect),
                   effect.potionDuration * 20,
                   effect.potionAmplifier));
         }
       }
     }
   }
 }
  @Override
  public void apply(final ItemStack scrap, final World world, final EntityPlayer player) {
    Potion p = potion;

    // If no potion effect is defined, pick one randomly
    if (p == null) {
      // Keep looking until we have a non-null entry that
      // matches the noBad effect criteria.
      try {
        for (; p == null || noBad && isBadEffect.getBoolean(p); ) {
          p = Potion.potionTypes[rnd.nextInt(Potion.potionTypes.length)];
        }
      } catch (Throwable t) {;
      }
    }
    player.addPotionEffect(new PotionEffect(p.getId(), duration, amplifier));
  }
Exemple #24
0
 @Override
 public ItemStack onEaten(ItemStack ist, World world, EntityPlayer player) {
   if (!player.capabilities.isCreativeMode) {
     --ist.stackSize;
   }
   if (!world.isRemote) {
     for (PotionEffect effect : new PotionEssence(ist.getTagCompound()).getEffects()) {
       if (effect == null) continue;
       player.addPotionEffect(effect);
     }
   }
   if (!player.capabilities.isCreativeMode) {
     if (ist.stackSize <= 0) return new ItemStack(this, 1, 0);
     player.inventory.addItemStackToInventory(new ItemStack(this, 1, 0));
   }
   return ist;
 }
  @Override
  public void updateEntity() {

    if (surroundingCheckTicks++ % 100 == 0) {
      checkNearbyBlockState();
      surroundingCheckTicks = 1;
      if (!worldObj.isRemote
          && PowerNodeRegistry.For(this.worldObj).checkPower(this, this.capacity * 0.1f)) {
        List<EntityPlayer> nearbyPlayers =
            worldObj.getEntitiesWithinAABB(
                EntityPlayer.class,
                AxisAlignedBB.getBoundingBox(
                    this.xCoord - 2,
                    this.yCoord,
                    this.zCoord - 2,
                    this.xCoord + 2,
                    this.yCoord + 3,
                    this.zCoord + 2));
        for (EntityPlayer p : nearbyPlayers) {
          if (p.isPotionActive(BuffList.manaRegen.id)) continue;
          p.addPotionEffect(new BuffEffectManaRegen(600, 1));
        }
      }
    }

    if (onlyChargeAtNight == isNight()) {
      PowerNodeRegistry.For(this.worldObj)
          .insertPower(this, PowerTypes.LIGHT, 0.25f * powerMultiplier);
      if (worldObj.isRemote) {

        if (particleCounter++ % 180 == 0) {
          particleCounter = 1;
          AMCore.proxy.particleManager.RibbonFromPointToPoint(
              worldObj,
              xCoord + worldObj.rand.nextFloat(),
              yCoord + (worldObj.rand.nextFloat() * 2),
              zCoord + worldObj.rand.nextFloat(),
              xCoord + worldObj.rand.nextFloat(),
              yCoord + (worldObj.rand.nextFloat() * 2),
              zCoord + worldObj.rand.nextFloat());
        }
      }
    }
    super.callSuperUpdate();
  }
  private void handleLowPower(Integer id, int power, boolean doEffects) {
    if (power <= 0) {
      // We ran out of power!
      WorldServer world = DimensionManager.getWorld(id);
      if (world != null) {
        List<EntityPlayer> players = new ArrayList<EntityPlayer>(world.playerEntities);
        if (DimletConfiguration.dimensionDifficulty >= 1) {
          for (EntityPlayer player : players) {
            if (!RfToolsDimensionManager.checkValidPhasedFieldGenerator(player, true)) {
              player.attackEntityFrom(new DamageSourcePowerLow("powerLow"), 1000000.0f);
            } else {
              if (doEffects && DimletConfiguration.phasedFieldGeneratorDebuf) {
                player.addPotionEffect(
                    new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
                player.addPotionEffect(
                    new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
                player.addPotionEffect(
                    new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
              }
            }
          }
        } else {
          Random random = new Random();
          for (EntityPlayer player : players) {
            if (!RfToolsDimensionManager.checkValidPhasedFieldGenerator(player, true)) {
              WorldServer worldServerForDimension =
                  MinecraftServer.getServer()
                      .worldServerForDimension(DimletConfiguration.spawnDimension);
              int x = random.nextInt(2000) - 1000;
              int z = random.nextInt(2000) - 1000;
              int y = worldServerForDimension.getTopSolidOrLiquidBlock(x, z);
              if (y == -1) {
                y = 63;
              }

              TeleportationTools.teleportToDimension(
                  player, DimletConfiguration.spawnDimension, x, y, z);
            } else {
              if (doEffects) {
                player.addPotionEffect(
                    new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
                player.addPotionEffect(
                    new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
                player.addPotionEffect(
                    new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
              }
            }
          }
        }
      }
    }
  }
  @Override
  public void onArmorTick(final World world, final EntityPlayer player, final ItemStack itemStack) {
    super.onArmorTick(world, player, itemStack);
    final ItemStack boots = player.inventory.armorItemInSlot(0);
    final ItemStack pants = player.inventory.armorItemInSlot(1);
    final ItemStack chest = player.inventory.armorItemInSlot(2);
    final ItemStack head = player.inventory.armorItemInSlot(3);

    if (boots != null
        && boots.getItem() == ModItems.bootsPurple
        && pants != null
        && pants.getItem() == ModItems.leggingsPurple
        && chest != null
        && chest.getItem() == ModItems.chestplatePurple
        && head != null
        && head.getItem() == ModItems.helmetPurple)
      player.addPotionEffect(new PotionEffect(Potion.resistance.id, 0, 2));
  }
  public int amplifyEffect(EntityPlayer player, Potion potion) {
    PotionEffect eff = player.getActivePotionEffect(potion);
    if (eff != null) {
      int max = 1;
      max = 6;
      int newAmp = eff.getAmplifier();
      int newDur = eff.getDuration();
      if (newAmp < max) {
        newAmp++;
      }
      newDur += 500;
      eff.combine(new PotionEffect(eff.getPotionID(), newDur, newAmp));

      return newAmp;
    }

    player.addPotionEffect(new PotionEffect(potion.id, 300, 0));
    return 1;
  }
 @Override
 @SideOnly(Side.CLIENT)
 public void onEntityCollidedWithBlock(
     World world, int i, int j, int k, Entity entity) // when an entity steps into the liquid
     {
   if (entity instanceof EntityPlayer) {
     ((EntityPlayer) entity)
         .addPotionEffect(
             new PotionEffect(
                 Potion.damageBoost.getId(),
                 1200,
                 1)); // allows the potion affect to effect players
   }
   if (entity instanceof EntityLiving) {
     ((EntityLiving) entity)
         .addPotionEffect(
             new PotionEffect(
                 Potion.damageBoost.getId(), 1200, 1)); // allows the potion affect to effect mobs
   }
 }
  void handleTeleport(ICommandSender icommandsender) {
    Random rand;

    this.genPortal(Main.server.mc_server.getEntityWorld());
    Main.server.portal_is_generated = true;

    rand = icommandsender.getEntityWorld().rand;
    for (Object obj : icommandsender.getEntityWorld().playerEntities) {
      int x = Main.server.min_x + (rand.nextInt(Main.server.max_x - Main.server.min_x));
      int z = Main.server.min_z + (rand.nextInt(Main.server.max_z - Main.server.min_z));
      int y = icommandsender.getEntityWorld().getTopSolidOrLiquidBlock(x, z) + 100;
      ((EntityPlayer) obj).addPotionEffect(new PotionEffect(Potion.resistance.id, 400, 999));
      Main.server
          .mc_server
          .getCommandManager()
          .executeCommand(
              icommandsender,
              "tp " + ((EntityPlayer) obj).getCommandSenderName() + " " + x + " " + y + " " + z);
    }
  }