@Override
  public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {

    EntityPlayer par3EntityPlayer = (EntityPlayer) player;

    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(packet.data));

    ItemStack par1ItemStack;
    try {
      par1ItemStack = Packet.readItemStack(dis);
      Entity entityID = par3EntityPlayer.worldObj.getEntityByID(dis.readInt());

      if (par1ItemStack.getTagCompound() == null)
        par1ItemStack.setTagCompound(new NBTTagCompound());

      if (par1ItemStack.getTagCompound().hasKey(ModBreeds.tag)
          && (!par1ItemStack.getTagCompound().getString(ModBreeds.tag).equals("none"))) {
        par3EntityPlayer.addChatMessage(
            "Pet trap still has a  " + EntityList.getEntityString(entityID) + " inside !");
      } else {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setString(ModBreeds.tag, EntityList.getEntityString(entityID));
        par1ItemStack.setTagCompound(nbt);
        entityID.setDead();
        par3EntityPlayer.setCurrentItemOrArmor(0, par1ItemStack);
        if (!par3EntityPlayer.worldObj.isRemote)
          par3EntityPlayer.addChatMessage(
              "Stored a " + EntityList.getEntityString(entityID) + " in the Animal trap");
      }

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
    DimensionalLinkEntry[] entries = readEntries(itemStack);
    if (player.isSneaking()) {
      if (!world.isRemote) {
        int dimID = world.provider.dimensionId;
        DimensionalLinkEntry alreadyHasForThisWorld = null;
        for (DimensionalLinkEntry entry : entries)
          if (entry.dimID == dimID) alreadyHasForThisWorld = entry;
        if (alreadyHasForThisWorld != null) removeEntry(itemStack, alreadyHasForThisWorld.dimID);
        addEntry(
            itemStack,
            new DimensionalLinkEntry(
                dimID,
                (int) Math.floor(player.posX),
                (int) Math.floor(player.posY),
                (int) Math.floor(player.posZ)));

        player.addChatMessage(EnumChatFormatting.DARK_GREEN + "Warp point for this world set.");
      }
    } else {
      int dimID = world.provider.dimensionId;
      DimensionalLinkEntry link = null;
      for (DimensionalLinkEntry entry : entries) if (entry.dimID == dimID) link = entry;
      if (link != null) {
        double targetX = link.x + 0.5D;
        double targetY = link.y + 1.0D;
        double targetZ = link.z + 0.5D;
        EAVector3 targetVec = new EAVector3(targetX, targetY, targetZ);
        EAVector3 playerVec = EAVector3.fromEntityCenter(player);
        double distance = targetVec.subtract(playerVec).mag();
        int rfToConsume = (int) (distance * 2500.0D);
        if ((getEnergyStored(itemStack) >= rfToConsume)
            || ((player.capabilities.isCreativeMode) && (ensureCooldown(itemStack)))) {
          for (int i = 0; i < 128; i++) {
            world.spawnParticle(
                "portal",
                targetX,
                targetY,
                targetZ,
                world.rand.nextGaussian(),
                0.0D,
                world.rand.nextGaussian());
          }

          if (!world.isRemote) {
            if (!player.capabilities.isCreativeMode) extractEnergy(itemStack, rfToConsume, false);
            player.setPositionAndUpdate(targetX, targetY, targetZ);
            player.addChatMessage(EnumChatFormatting.DARK_GREEN + "Teleported.");
          }
        } else {
          player.addChatMessage(EnumChatFormatting.DARK_RED + "Not enough energy.");
        }
      } else {
        player.addChatMessage(
            EnumChatFormatting.DARK_RED + "Warp point is not set for this world.");
      }
    }

    return itemStack;
  }
  /**
   * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a
   * pig.
   */
  @Override
  public boolean interact(EntityPlayer var1) {
    ItemStack itemstack = var1.inventory.getCurrentItem();
    boolean flag = itemstack != null && itemstack.itemID == Item.monsterPlacer.itemID;

    if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) {
      if (!this.worldObj.isRemote) {
        this.setCustomer(var1);
        var1.openGui(DivineRPG.instance, GuiHandler.LEORNA, worldObj, entityId, entityId, entityId);
      }
      switch (this.rand.nextInt(5)) {
        case 0:
          var1.addChatMessage(
              "Leorna: Could you imagine if the whole world was covered in plants?");
          break;
        case 1:
          var1.addChatMessage("Leorna: Embracing nature is part of the importance of life.");
          break;
        case 2:
          var1.addChatMessage(
              "Leorna: Have you tried throwing Lomonas? They are mighty handy for finding my way.");
          break;
        case 3:
          var1.addChatMessage("Leorna: Hitchak sure is tasty. ");
          break;
        case 4:
          var1.addChatMessage("Leorna: Zelus won't stop looking at me.");
          break;
      }
      return true;
    } else return super.interact(var1);
  }
  @Override
  public boolean applyEffectEntity(
      ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (world.isRemote || !(target instanceof EntityLivingBase)) return true;

    if (((EntityLivingBase) target).isPotionActive(BuffList.astralDistortion.id)) {
      if (target instanceof EntityPlayer)
        ((EntityPlayer) target)
            .addChatMessage(
                new ChatComponentText("The distortion around you prevents you from teleporting"));
      return true;
    }

    if (target.dimension == 1) {
      if (target instanceof EntityPlayer)
        ((EntityPlayer) target).addChatMessage(new ChatComponentText("Nothing happens..."));
      return true;
    } else if (target.dimension == -1) {
      if (target instanceof EntityPlayer)
        ((EntityPlayer) target)
            .addChatMessage(new ChatComponentText("You are already in the nether."));
      return false;
    } else {
      DimensionUtilities.doDimensionTransfer((EntityLivingBase) target, -1);
    }

    return true;
  }
Exemple #5
0
  @Override
  public void processCommand(ICommandSender sender, String[] par2ArrayOfStr) {
    EntityPlayer player = getCommandSenderAsPlayer(sender);
    EntityPlayerMP other = func_82359_c(sender, par2ArrayOfStr[0]);

    if (par2ArrayOfStr.length != 1) {
      player.addChatMessage(getCommandUsage(sender));
      return;
    }

    NBTTagCompound playerdata =
        NecessitiesMain.instance.necessities_data.getCompoundTag(other.username);
    NecessitiesMain.instance.necessities_data.setCompoundTag(other.username, playerdata);
    NBTTagCompound tpa = playerdata.getCompoundTag("[Tpa]");
    playerdata.setCompoundTag("[Tpa]", tpa);

    if (tpa.hasKey("DenyAll")) {
      player.addChatMessage("Player " + other.username + " has blocked all teleport requests.");
      return;
    }
    tpa.setString("Command", "TPA");
    tpa.setString("Who", player.username);
    player.addChatMessage("Sending teleport request to player " + other.username);
    other.addChatMessage(
        player.username
            + " has requested to teleport to you.  Use /tpaccept to accept or /tpreject to refuse.");
  }
 @Override
 public boolean onItemUse(
     ItemStack item,
     EntityPlayer player,
     World world,
     int x,
     int y,
     int z,
     int s,
     float X,
     float Y,
     float Z) {
   if (world.isRemote) return true;
   if (item.stackTagCompound == null) createNBT(item);
   TileEntity te = world.getTileEntity(x, y, z);
   PipeEnergy energy =
       te != null && te instanceof IEnergy ? ((IEnergy) te).getEnergy((byte) s) : null;
   if (energy != null) {
     item.stackTagCompound.setInteger("lx", x);
     item.stackTagCompound.setInteger("ly", y);
     item.stackTagCompound.setInteger("lz", z);
     item.stackTagCompound.setFloat("Ucap", (float) energy.Ucap);
     item.stackTagCompound.setInteger("Umax", energy.Umax);
     item.stackTagCompound.setByte("ls", (byte) s);
     player.addChatMessage(new ChatComponentText("Energy linked"));
   } else {
     item.stackTagCompound.setInteger("ly", -1);
     player.addChatMessage(new ChatComponentText("Unlinked"));
   }
   return true;
 }
Exemple #7
0
  @SuppressWarnings({"unchecked", "ConstantConditions"})
  @Command(
      aliases = "pm",
      desc = "Send private message to target player.",
      usage = "/pm <target player> <message>")
  public void sendPm(@Sender EntityPlayer sender, String target, @Text String message) {

    try {
      UserId userId = profileService.findUserId(target);
      if (!Objects.equals(sender.getDisplayName(), userId.getEntityPlayer().getDisplayName())) {
        userId
            .getEntityPlayer()
            .addChatMessage(
                new ChatComponentText(
                    String.format(
                        "%s(%s - Message from %s%s: %s)",
                        EnumChatFormatting.GRAY,
                        formattedDate,
                        sender.getDisplayName(),
                        EnumChatFormatting.GRAY,
                        message.trim())));
        recipients.put(sender.getUniqueID(), profileService.findUserId(target));
      }
      if (Objects.equals(sender.getDisplayName(), userId.getEntityPlayer().getDisplayName())) {
        sender.addChatMessage(Messages.error(tr("whisper.pm.same-player.error")));
      }
    } catch (ProfileNotFoundException | NullPointerException e) {
      sender.addChatMessage(Messages.error(tr("whisper.pm.no-such-player.error")));
    } catch (ProfileLookupException ignored) {
    }
  }
  /* === INFO === */
  private void onDebugInfo(NBTTagCompound nbt, EntityPlayer player, Pos pos) {
    if (pos != null) {
      player.addChatMessage(
          new ChatComponentText(
              EnumChatFormatting.GOLD
                  + "Block Type: "
                  + EnumChatFormatting.RESET
                  + GameData.getBlockRegistry().getNameForObject(pos.getBlock(player.worldObj))));
      player.addChatMessage(
          new ChatComponentText(
              EnumChatFormatting.GOLD
                  + "Metadata: "
                  + EnumChatFormatting.RESET
                  + pos.getMetadata(player.worldObj)));

      TileEntity tile = pos.getTileEntity(player.worldObj);

      if (tile instanceof TileEntitySkull) {
        NBTTagCompound tag = new NBTTagCompound();
        tile.writeToNBT(tag);
        player.addChatMessage(
            new ChatComponentText(
                EnumChatFormatting.GOLD
                    + "Skull Rotation: "
                    + EnumChatFormatting.RESET
                    + tag.getByte("Rot")));
      }
    }
  }
 public void showHelp(boolean withParams) throws WrongUsageException {
   if (withParams) {
     player.addChatMessage(new ChatComponentText("Your Command: " + args[0]));
   } else {
     player.addChatMessage(new ChatComponentText("No parameters."));
     throw new WrongUsageException(getCommandUsage(player));
   }
 }
  @SubscribeEvent
  public void tickStart(PlayerTickEvent evt) {

    if (evt.phase != Phase.START) {
      return;
    }
    if (lastPoll > 0) {
      --lastPoll;
      return;
    }
    lastPoll = 400;

    if (!_notificationDisplayed && _updateThread.checkComplete()) {
      _notificationDisplayed = true;
      FMLCommonHandler.instance().bus().unregister(this);
      if (_updateThread.newVersionAvailable()) {
        if (!CoFHProps.enableUpdateNotice && !_updateThread.isCriticalUpdate()) {
          return;
        }
        ModVersion newVersion = _updateThread.newVersion();

        EntityPlayer player = evt.player;
        player.addChatMessage(
            new ChatComponentText(GOLD + "[" + _mod.getModName() + "]")
                .appendText(WHITE + " A new version is available:"));
        IChatComponent chat;
        String text = newVersion.modVersion().toString();
        if (Strings.isNullOrEmpty(_downloadUrl)) {
          chat = new ChatComponentText(text).setChatStyle(version);
        } else {
          chat =
              IChatComponent.Serializer.func_150699_a(
                  "[{\"text\":\""
                      + text
                      + "\",\"color\":\"aqua\"},"
                      + "{\"text\":\" "
                      + WHITE
                      + "["
                      + GREEN
                      + "Download"
                      + WHITE
                      + "]\","
                      + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":"
                      + "{\"text\":\"Click this to download the latest version\",\"color\":\"yellow\"}},"
                      + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\""
                      + _downloadUrl
                      + "\"}}]");
        }
        player.addChatMessage(chat);
        player.addChatMessage(
            new ChatComponentText(newVersion.description()).setChatStyle(description));
      }
    }
  }
 public void countAxis(EntityPlayer player) {
   if (player.worldObj.getTileEntity(new BlockPos(xa, ya, za)) != null) {
     component2 =
         new TextComponentTranslation(
             player.worldObj.getTileEntity(new BlockPos(xa, ya, za)).toString());
     player.addChatMessage(component2);
   }
   X = xb - xa;
   Y = yb - ya;
   Z = zb - za;
   component = new TextComponentTranslation(Print.printXYZ(X, Y, Z));
   player.addChatMessage(component);
 }
  @Override
  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
    if (!world.isRemote) {
      if (!this.isAbsorbingFocillium) {
        this.isAbsorbingFocillium = true;
        entityplayer.addChatMessage("Cell Active");
      } else {
        this.isAbsorbingFocillium = false;
        entityplayer.addChatMessage("Cell Inactive");
      }
    }

    return itemstack;
  }
 @Override
 public boolean onBlockActivated(
     World world,
     int x,
     int y,
     int z,
     EntityPlayer player,
     int par6,
     float par7,
     float par8,
     float par9) {
   TileEntity tileEntity = world.getTileEntity(x, y, z);
   if (tileEntity != null && tileEntity instanceof TileVendor) {
     TileVendor tileVendor = (TileVendor) world.getTileEntity(x, y, z);
     EntityPlayer playerTest = world.getPlayerEntityByName(tileVendor.playerName);
     if (playerTest == null || !tileVendor.isUseableByPlayer(playerTest)) {
       tileVendor.inUse = false;
     }
     ;
     if (tileVendor.inUse && !player.getDisplayName().contentEquals(tileVendor.playerName)) {
       if (!world.isRemote) {
         player.addChatMessage(
             new ChatComponentText(StatCollector.translateToLocal("chat.warning.inuse")));
       }
       return true;
     } else {
       player.openGui(UniversalCoins.instance, 0, world, x, y, z);
       tileVendor.playerName = player.getDisplayName();
       tileVendor.inUse = true;
       tileVendor.updateCoinsForPurchase();
       return true;
     }
   }
   return false;
 }
  @Override
  public boolean onBlockActivated(
      World par1World,
      int par2,
      int par3,
      int par4,
      EntityPlayer par5EntityPlayer,
      int par6,
      float par7,
      float par8,
      float par9) {
    boolean didSomething = false;

    if (par5EntityPlayer.getHealth() < 12) {
      par5EntityPlayer.heal(12 - par5EntityPlayer.getHealth());
      didSomething = true;
    }
    if (par5EntityPlayer.getFoodStats().getFoodLevel() < 12) {
      par5EntityPlayer
          .getFoodStats()
          .addStats(12 - par5EntityPlayer.getFoodStats().getFoodLevel(), 0F);
      didSomething = true;
    }

    if (!didSomething && !par1World.isRemote)
      par5EntityPlayer.addChatMessage(
          "The altar can not further heal you. Come back when you're more wounded.");

    return true;
  }
  @Override
  public void onLivingUpdate() {
    final EntityPlayer player =
        this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0);

    if (player != null && !player.equals(this.targetEntity)) {
      if (this.getDistanceSqToEntity(player) < 400.0D) {
        this.getNavigator().getPathToEntityLiving(player);
        this.targetEntity = player;
      }
    } else {
      this.targetEntity = null;
    }

    new Vector3(this);

    if (this.roomCoords != null && this.roomSize != null) {
      @SuppressWarnings("unchecked")
      List<Entity> entitiesWithin =
          this.worldObj.getEntitiesWithinAABB(
              EntityPlayer.class,
              AxisAlignedBB.getBoundingBox(
                  this.roomCoords.intX() - 1,
                  this.roomCoords.intY() - 1,
                  this.roomCoords.intZ() - 1,
                  this.roomCoords.intX() + this.roomSize.intX(),
                  this.roomCoords.intY() + this.roomSize.intY(),
                  this.roomCoords.intZ() + this.roomSize.intZ()));

      this.entitiesWithin = entitiesWithin.size();

      if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) {
        @SuppressWarnings("unchecked")
        List<EntityPlayer> entitiesWithin2 =
            this.worldObj.getEntitiesWithinAABB(
                EntityPlayer.class,
                AxisAlignedBB.getBoundingBox(
                    this.roomCoords.intX() - 11,
                    this.roomCoords.intY() - 11,
                    this.roomCoords.intZ() - 11,
                    this.roomCoords.intX() + this.roomSize.intX() + 10,
                    this.roomCoords.intY() + this.roomSize.intY() + 10,
                    this.roomCoords.intZ() + this.roomSize.intZ() + 10));

        for (EntityPlayer p : entitiesWithin2) {
          p.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.skeletonBoss.message")));
        }

        this.setDead();

        if (this.spawner != null) {
          this.spawner.playerCheated = true;
        }

        return;
      }
    }

    super.onLivingUpdate();
  }
 @Override
 public boolean onItemUse(
     ItemStack stack,
     EntityPlayer player,
     World world,
     int x,
     int y,
     int z,
     int par7,
     float par8,
     float par9,
     float par10) {
   if (world.provider.dimensionId != -1)
     player.addChatMessage(
         Util.getChatComponent(Util.AQUA + "This item can only be used in the Nether."));
   else if (!world.isRemote) {
     EntityKingOfScorchers entity = new EntityKingOfScorchers(world);
     entity.setPosition(x, y + 1, z);
     if (world.getCollidingBoundingBoxes(entity, entity.boundingBox).isEmpty()) {
       world.spawnEntityInWorld(entity);
       if (!player.capabilities.isCreativeMode) stack.stackSize--;
     }
   }
   return true;
 }
 /**
  * Returns true if the given quest made progress and/or no further interactions should occur.
  *
  * @param player
  * @param quest Quest instance to check for progress
  * @param handler IQuestHandler will have its methods called at appropriate times; pass {@link
  *     #DEFAULT_QUEST_HANDLER} if none available
  * @param data Optional arguments passed to the various {@code IQuest} methods, e.g. {@link
  *     IQuest#begin begin} and {@link IQuest#complete complete}
  * @return True if something happened, i.e. the calling interaction should be canceled
  */
 public static boolean checkQuestProgress(
     EntityPlayer player, IQuest quest, IQuestHandler handler, Object... data) {
   boolean changed = false;
   if (quest.isComplete(player)) {
     // do nothing if quest is already complete
   } else if (quest.canBegin(player)) {
     if (quest.begin(player, data)) {
       handler.onQuestBegun(quest, player);
       changed = true;
     }
   } else if (quest.canComplete(player)) {
     if (quest.complete(player, data)) {
       handler.onQuestCompleted(quest, player);
       changed = true;
     }
   } else if (quest.hasBegun(player) && quest.update(player, data)) {
     handler.onQuestChanged(quest, player);
     changed = true;
   }
   if (!changed) { // check for hint
     IChatComponent hint = quest.getHint(player, data);
     if (hint != null) { // result may be different on client vs. server due to Random
       if (!player.worldObj.isRemote && !hint.getFormattedText().equals("")) {
         player.addChatMessage(hint);
       }
       return true;
     }
   }
   if (changed && quest.requiresSync() && player instanceof EntityPlayerMP) {
     PacketDispatcher.sendTo(new SyncQuestPacket(quest), (EntityPlayerMP) player);
   }
   return changed;
 }
 private TileEntityTombstone placeTombstone(EntityPlayer player) {
   Optional<ChunkCoordinates> chunkCoordinate = findValidTombstoneLocation(player);
   if (chunkCoordinate.isPresent()) {
     /* Place a Tombstone */
     player.worldObj.setBlock(
         chunkCoordinate.get().posX,
         chunkCoordinate.get().posY,
         chunkCoordinate.get().posZ,
         BlockList.tombstone.get());
     TileEntity tileEntity =
         player.worldObj.getTileEntity(
             chunkCoordinate.get().posX, chunkCoordinate.get().posY, chunkCoordinate.get().posZ);
     StringBuilder sb = new StringBuilder();
     sb.append("Tombstone summoned to mark the 'passing' of ")
         .append(player.getCommandSenderName())
         .append(" at [");
     sb.append(chunkCoordinate.get().posX).append(", ");
     sb.append(chunkCoordinate.get().posY).append(", ");
     sb.append(chunkCoordinate.get().posZ).append("]");
     player.addChatMessage(new ChatComponentText(sb.toString()));
     if (tileEntity != null && tileEntity instanceof TileEntityTombstone) {
       ProjectZuluLog.debug(Level.INFO, sb.toString());
       return (TileEntityTombstone) tileEntity;
     }
   }
   ProjectZuluLog.warning(
       "Failed to find location to place tombstone at player location {X:%s, Y:%s, Z:%s}",
       player.posX, player.posY, player.posZ);
   return null;
 }
 @Override
 public boolean onBlockActivated(
     World world,
     int x,
     int y,
     int z,
     EntityPlayer player,
     int p_149727_6_,
     float p_149727_7_,
     float p_149727_8_,
     float p_149727_9_) {
   AbstractInvExpander expander = (AbstractInvExpander) world.getTileEntity(x, y, z);
   TurretBase base = expander.getBase();
   if (base != null && base.getTrustedPlayer(player.getUniqueID()) != null) {
     if (base.getTrustedPlayer(player.getUniqueID()).canOpenGUI) {
       player.openGui(ModularTurrets.instance, 7, world, x, y, z);
       return true;
     }
   }
   if (base != null && player.getUniqueID().toString().equals(base.getOwner())) {
     player.openGui(ModularTurrets.instance, 7, world, x, y, z);
   } else {
     player.addChatMessage(
         new ChatComponentText(StatCollector.translateToLocal("status.ownership")));
   }
   return true;
 }
 @SideOnly(Side.CLIENT)
 public boolean interact(EntityPlayer player) {
   if (canInteractWith(player)) {
     heal(25);
     player.addChatMessage("Builder: Greetings " + player.username + ", lets get starting.");
   }
   return true;
 }
 public void processActivate(EntityPlayer par5EntityPlayer, World world) {
   if (world.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord) == 0 && owner == "none") {
     owner = par5EntityPlayer.getEntityName();
     par5EntityPlayer.addChatMessage(
         "You are now the owner of this detector," + par5EntityPlayer.getEntityName());
     world.notifyBlockChange(xCoord, yCoord, zCoord, 2);
   }
 }
Exemple #22
0
 @Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (!world.isRemote) {
     TerminalData terminalData = TerminalData.get(player);
     if (!terminalData.isTerminalInstalled()) {
       player.addChatMessage(new ChatComponentTranslation("ac.terminal.notinstalled"));
     } else if (terminalData.isInstalled(app)) {
       player.addChatMessage(
           new ChatComponentTranslation("ac.terminal.app_alrdy_installed", app.getDisplayName()));
     } else {
       if (!player.capabilities.isCreativeMode) stack.stackSize--;
       terminalData.installApp(app);
       player.addChatMessage(
           new ChatComponentTranslation("ac.terminal.app_installed", app.getDisplayName()));
     }
   }
   return stack;
 }
  public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {

    if (player instanceof EntityPlayerMP
        && !ItemArmorMod.fullEquiped(player, resinresin.wars.registry.WarsItems.techArmor)) {
      player.addChatMessage(
          "\u00a74DONT CHEAT! \u00a72Wear The Tech Armour (which you must put on in survival)");
      stack.stackSize = 0;
    }
    return false;
  }
  @Override
  public void onWornTick(ItemStack stack, EntityLivingBase player) {
    if (!player.isInvisible()) {
      player.setInvisible(true);
    }
    NBTTagCompound tag = new NBTTagCompound();
    ((EntityPlayer) player).writeToNBT(tag);
    NBTTagCompound forgeTag = tag.getCompoundTag("ForgeData");

    int corruption = 0;

    if (forgeTag.hasKey("MindCorruption")) corruption = forgeTag.getInteger("MindCorruption");
    else forgeTag.setInteger("MindCorruption", 0);

    ((EntityPlayer) player).capabilities.disableDamage = true;

    if (!player.worldObj.isRemote) {
      if (corruption <= 0) {
        ((EntityPlayer) player)
            .addChatMessage(
                new ChatComponentText(
                    EMTTextHelper.PURPLE
                        + "You have worn the Ring. Your soul has now been forever "
                        + EMTTextHelper.PURPLE
                        + "tainted. "
                        + EMTTextHelper.RED
                        + EMTTextHelper.ITALIC
                        + "Beware of wearing the ring. The tainting will only "
                        + EMTTextHelper.RED
                        + EMTTextHelper.ITALIC
                        + "increase, and strange things will start happening."));
      } else if (corruption > 6000 && corruption < 24000 && random.nextInt(2000) == 0) {
        player.addPotionEffect(new PotionEffect(Potion.blindness.id, 500, 2, false));
      } else if (corruption >= 6000 && corruption < 24000 && random.nextInt(2000) == 0) {
        player.addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 2, false));
      } else if (corruption >= 24000 && corruption < 72000 && random.nextInt(2000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.attackEntityFrom(DamageSource.magic, 5);
      } else if (corruption >= 72000 && corruption < 120000 && random.nextInt(4000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.motionY += 2d;
      } else if (corruption >= 120000 && random.nextInt(10000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.addPotionEffect(new PotionEffect(Potion.wither.id, 5000, 4, false));
      } else if (corruption + 100 >= Integer.MAX_VALUE) { // =3333333
        player.isDead = true;
      }
    }
    forgeTag.setInteger("MindCorruption", ++corruption);
    tag.setTag("ForgeData", forgeTag);
    ((EntityPlayer) player).readFromNBT(tag);
  }
  @Override
  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
    Chunk3D chunk = new Chunk3D(entityplayer);

    if (getEnergy(itemstack) < ENERGY_USAGE && !entityplayer.capabilities.isCreativeMode) {
      if (!world.isRemote) {
        entityplayer.addChatMessage(
            new ChatComponentText(
                EnumColor.DARK_BLUE
                    + "[Mekanism] "
                    + EnumColor.RED
                    + LangUtils.localize("tooltip.seismicReader.needsEnergy")));
      }

      return itemstack;
    } else if (!MekanismUtils.isChunkVibrated(chunk)) {
      if (!world.isRemote) {
        entityplayer.addChatMessage(
            new ChatComponentText(
                EnumColor.DARK_BLUE
                    + "[Mekanism] "
                    + EnumColor.RED
                    + LangUtils.localize("tooltip.seismicReader.noVibrations")));
      }

      return itemstack;
    }

    if (!entityplayer.capabilities.isCreativeMode) {
      setEnergy(itemstack, getEnergy(itemstack) - ENERGY_USAGE);
    }

    entityplayer.openGui(
        Mekanism.instance,
        38,
        world,
        (int) entityplayer.posX,
        (int) entityplayer.posY,
        (int) entityplayer.posZ);

    return itemstack;
  }
 @Override
 public void processCommand(ICommandSender icommandsender, String[] argString) {
   if (icommandsender instanceof EntityPlayer) {
     EntityPlayer player = (EntityPlayer) icommandsender;
     if (argString.length == 0) {
       player.addChatMessage(
           new ChatComponentTranslation(
               "[Redoxiation] Hello,  " + player.getGameProfile().getName()));
     }
   }
 }
  @Override
  public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack itemStack) {
    if (WrenchUtility.isWrench(itemStack)) {
      if (tryLink(LinkUtility.getLink(itemStack), LinkUtility.getSide(itemStack))) {
        if (world().isRemote) {
          player.addChatMessage("Successfully linked devices.");
        }
        LinkUtility.clearLink(itemStack);
      } else {
        if (world().isRemote) {
          player.addChatMessage("Marked link for device.");
        }

        LinkUtility.setLink(itemStack, new VectorWorld(world(), x(), y(), z()));
        LinkUtility.setSide(itemStack, (byte) placementSide.ordinal());
      }

      return true;
    }

    if (player.getCurrentEquippedItem() != null) {
      if (player.getCurrentEquippedItem().itemID == Item.dyePowder.itemID) {
        setDye(player.getCurrentEquippedItem().getItemDamage());

        if (!player.capabilities.isCreativeMode) {
          player.inventory.decrStackSize(player.inventory.currentItem, 1);
        }

        return true;
      }
    }

    if (player.isSneaking()) {
      input = !input;
    }

    updateBounds();
    updatePath();

    return true;
  }
 @Override
 public IMessage onMessage(MessageFlight message, MessageContext ctx) {
   TragicConfig.overrideObject("allowFlight", message.flightEnabled == 1);
   if (!TragicConfig.getBoolean("allowFlight")) {
     EntityPlayer player = TragicMC.proxy.getPlayerFromMessageCtx(ctx);
     if (player != null)
       player.addChatMessage(
           new ChatComponentText(
               "Flight potion effect is disabled due to the server not allowing it. Change the option in your server.properties file if you want it enabled."));
   }
   return null;
 }
 @Override
 public boolean canInteractWith(EntityPlayer player) {
   if (player.getCurrentEquippedItem() != null
       && player.getCurrentEquippedItem().getItem() == Itemss.amadronTablet) {
     IPressurizable pressurizable = (IPressurizable) Itemss.amadronTablet;
     pressurizable.addAir(player.getCurrentEquippedItem(), -1);
     if (pressurizable.getPressure(player.getCurrentEquippedItem()) > 0) return true;
     else {
       player.addChatMessage(new ChatComponentTranslation("gui.tab.problems.notEnoughPressure"));
     }
   }
   return false;
 }
  /* === COPY === */
  private void onDebugCopy(NBTCompound nbt, EntityPlayer player, Pos pos) {
    if (pos == null) {
      nbt.removeTag("pos1");
      nbt.removeTag("pos2");
      player.addChatMessage(new ChatComponentText("Positions reset."));
    } else if (!nbt.hasKey("pos1")) {
      nbt.setLong("pos1", pos.toLong());
      player.addChatMessage(new ChatComponentText("Pos 1 set."));
    } else if (!nbt.hasKey("pos2")) {
      nbt.setLong("pos2", pos.toLong());
      player.addChatMessage(new ChatComponentText("Pos 2 set."));
    } else {
      Pos pos1 = Pos.at(nbt.getLong("pos1")), pos2 = Pos.at(nbt.getLong("pos2"));
      List<Pair<Pos, BlockInfo>> solidBlocks = new ArrayList<>(),
          transparentBlocks = new ArrayList<>();

      Pos.forEachBlock(
          pos1,
          pos2,
          blockPos -> {
            BlockInfo info = blockPos.getInfo(player.worldObj);

            if (info.block.isNormalCube()) solidBlocks.add(Pair.of(blockPos.immutable(), info));
            else transparentBlocks.add(Pair.of(blockPos.immutable(), info));
          });

      for (Pair<Pos, BlockInfo> data : Iterables.concat(solidBlocks, transparentBlocks)) {
        pos.offset(
                data.getLeft().getX() - pos1.getX(),
                data.getLeft().getY() - pos1.getY(),
                data.getLeft().getZ() - pos1.getZ())
            .setBlock(player.worldObj, data.getRight());
      }

      player.addChatMessage(new ChatComponentText("Copy done."));
    }
  }