Package mekanism.common.tile

Examples of mekanism.common.tile.TileEntityElectricChest


  }

  @Override
  public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z)
  {
    TileEntityElectricChest tileEntity = (TileEntityElectricChest)entityplayer.worldObj.getTileEntity(x, y, z);

    if(id == 0)
    {
      if(isBlock)
      {
View Full Code Here


    {
      MachineType type = MachineType.get(this, metadata);
     
      if(type == MachineType.ELECTRIC_CHEST)
      {
        TileEntityElectricChest electricChest = (TileEntityElectricChest)tileEntity;

        if(!(entityplayer.isSneaking() || world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)))
        {
          if(electricChest.canAccess())
          {
            MekanismUtils.openElectricChestGui((EntityPlayerMP)entityplayer, electricChest, null, true);
          }
          else if(!electricChest.authenticated)
          {
View Full Code Here

    if(world.getBlockMetadata(x, y, z) != 13)
    {
      return blockHardness;
    }
    else {
      TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
      return tileEntity.canAccess() ? 3.5F : -1;
    }
  }
View Full Code Here

    if(message.packetType == ElectricChestPacketType.SERVER_OPEN)
    {
      try {
        if(message.isBlock)
        {
          TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);

          if(message.useEnergy)
          {
            tileEntity.setEnergy(tileEntity.getEnergy() - 100);
          }

          MekanismUtils.openElectricChestGui((EntityPlayerMP)player, tileEntity, null, true);
        }
        else {
          ItemStack stack = player.getCurrentEquippedItem();

          if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
          {
            if(message.useEnergy)
            {
              ((IEnergizedItem)stack.getItem()).setEnergy(stack, ((IEnergizedItem)stack.getItem()).getEnergy(stack) - 100);
            }

            InventoryElectricChest inventory = new InventoryElectricChest(player);
            MekanismUtils.openElectricChestGui((EntityPlayerMP)player, null, inventory, false);
          }
        }
      } catch(Exception e) {
        Mekanism.logger.error("Error while handling electric chest open packet.");
        e.printStackTrace();
      }
    }
    else if(message.packetType == ElectricChestPacketType.CLIENT_OPEN)
    {
      try {
        int x = message.coord4D != null ? message.coord4D.xCoord : 0;
        int y = message.coord4D != null ? message.coord4D.yCoord : 0;
        int z = message.coord4D != null ? message.coord4D.zCoord : 0;

        Mekanism.proxy.openElectricChest(player, message.guiType, message.windowId, message.isBlock, x, y, z);
      } catch(Exception e) {
        Mekanism.logger.error("Error while handling electric chest open packet.");
        e.printStackTrace();
      }
    }
    else if(message.packetType == ElectricChestPacketType.PASSWORD)
    {
      try {
        if(message.isBlock)
        {
          TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
          tileEntity.password = message.password;
          tileEntity.authenticated = true;
        }
        else {
          ItemStack stack = player.getCurrentEquippedItem();

          if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
          {
            ((IElectricChest)stack.getItem()).setPassword(stack, message.password);
            ((IElectricChest)stack.getItem()).setAuthenticated(stack, true);
          }
        }
      } catch(Exception e) {
        Mekanism.logger.error("Error while handling electric chest password packet.");
        e.printStackTrace();
      }
    }
    else if(message.packetType == ElectricChestPacketType.LOCK)
    {
      try {
        if(message.isBlock)
        {
          TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
          tileEntity.locked = message.locked;
          player.worldObj.notifyBlocksOfNeighborChange(message.coord4D.xCoord,message.coord4D.yCoord,message.coord4D.zCoord,Mekanism.MachineBlock);
        }
        else {
          ItemStack stack = player.getCurrentEquippedItem();
View Full Code Here

TOP

Related Classes of mekanism.common.tile.TileEntityElectricChest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.