Package mekanism.common

Examples of mekanism.common.IInvConfiguration


      return itemStack;
    }

    if(tileEntity instanceof IInvConfiguration)
    {
      IInvConfiguration config = (IInvConfiguration)tileEntity;
      int tileSide = config.getOrientation();
      EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());

      if(config.getEjector().hasStrictInput() && configColor != null && configColor != color)
      {
        return itemStack;
      }
    }
View Full Code Here


  private SideData getFromSlot(Slot slot)
  {
    if(slot.slotNumber < tileEntity.getSizeInventory())
    {
      IInvConfiguration config = (IInvConfiguration)tileEntity;

      for(SideData data : config.getSideData())
      {
        for(int id : data.availableSlots)
        {
          if(id == slot.getSlotIndex())
          {
View Full Code Here

      if(getState(stack) == 0) //Configurate
      {
        if(tile instanceof IInvConfiguration)
        {
          IInvConfiguration config = (IInvConfiguration)tile;

          if(!player.isSneaking())
          {
            player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.viewColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
            return true;
          }
          else {
            if(getEnergy(stack) >= ENERGY_PER_CONFIGURE)
            {
              setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
              MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
              player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));

              if(config instanceof TileEntityBasicBlock)
              {
                TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
                Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
              }

              return true;
            }
          }
        }
        else if(tile instanceof IConfigurable)
        {
          IConfigurable config = (IConfigurable)tile;

          if(player.isSneaking())
          {
            return config.onSneakRightClick(player, side);
          }
          else {
            return config.onRightClick(player, side);
          }
        }
      }
      else if(getState(stack) == 1) //Empty
      {
View Full Code Here

      upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
    }

    if(tileEntity instanceof IInvConfiguration)
    {
      IInvConfiguration config = (IInvConfiguration)tileEntity;

      itemStack.stackTagCompound.setBoolean("hasSideData", true);

      itemStack.stackTagCompound.setBoolean("ejecting", config.getEjector().isEjecting());

      for(int i = 0; i < 6; i++)
      {
        itemStack.stackTagCompound.setByte("config"+i, config.getConfiguration()[i]);
      }
    }
   
    if(tileEntity instanceof ISustainedData)
    {
View Full Code Here

  {
    ItemStack toInsert = stack.itemStack.copy();

    if(stack.pathType != Path.HOME && inv instanceof IInvConfiguration)
    {
      IInvConfiguration config = (IInvConfiguration)inv;
      int tileSide = config.getOrientation();
      EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());

      if(config.getEjector().hasStrictInput() && configColor != null && configColor != stack.color)
      {
        return;
      }
    }
View Full Code Here

        ((IUpgradeManagement)tileEntity).setSpeedMultiplier(getSpeedMultiplier(stack));
      }

      if(tileEntity instanceof IInvConfiguration)
      {
        IInvConfiguration config = (IInvConfiguration)tileEntity;

        if(stack.stackTagCompound != null && stack.stackTagCompound.hasKey("hasSideData"))
        {
          config.getEjector().setEjecting(stack.stackTagCompound.getBoolean("ejecting"));

          for(int i = 0; i < 6; i++)
          {
            config.getConfiguration()[i] = stack.stackTagCompound.getByte("config"+i);
          }
        }
      }
     
      if(tileEntity instanceof ISustainedData)
View Full Code Here

      return ((TileEntityLogisticalSorter)tileEntity).canSendHome(itemStack);
    }

    if(!force && tileEntity instanceof IInvConfiguration)
    {
      IInvConfiguration config = (IInvConfiguration)tileEntity;
      int tileSide = config.getOrientation();
      EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());

      if(config.getEjector().hasStrictInput() && configColor != null && configColor != color)
      {
        return false;
      }
    }
View Full Code Here

      return;
    }

    List<ForgeDirection> outputSides = new ArrayList<ForgeDirection>();

    IInvConfiguration configurable = (IInvConfiguration)tileEntity;

    for(int i = 0; i < configurable.getConfiguration().length; i++)
    {
      if(configurable.getConfiguration()[i] == configurable.getSideData().indexOf(sideData))
      {
        outputSides.add(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(i, tileEntity.facing)));
      }
    }
View Full Code Here

  {
    TileEntity tile = message.coord4D.getTileEntity(PacketHandler.getPlayer(context).worldObj);
   
    if(tile instanceof IInvConfiguration)
    {
      IInvConfiguration config = (IInvConfiguration)tile;

      if(message.packetType == ConfigurationPacket.EJECT)
      {
        config.getEjector().setEjecting(!config.getEjector().isEjecting());
      }
      else if(message.packetType == ConfigurationPacket.SIDE_DATA)
      {
        if(message.clickType == 0)
        {
          MekanismUtils.incrementOutput((IInvConfiguration)tile, message.configIndex);
        }
        else if(message.clickType == 1)
        {
          MekanismUtils.decrementOutput((IInvConfiguration)tile, message.configIndex);
        }
        else if(message.clickType == 2)
        {
          ((IInvConfiguration)tile).getConfiguration()[message.configIndex] = 0;
        }

        Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(message.coord4D, ((ITileNetwork)tile).getNetworkedData(new ArrayList())), new Range4D(message.coord4D));
      }
      else if(message.packetType == ConfigurationPacket.EJECT_COLOR)
      {
        if(message.clickType == 0)
        {
          config.getEjector().setOutputColor(TransporterUtils.increment(config.getEjector().getOutputColor()));
        }
        else if(message.clickType == 1)
        {
          config.getEjector().setOutputColor(TransporterUtils.decrement(config.getEjector().getOutputColor()));
        }
        else if(message.clickType == 2)
        {
          config.getEjector().setOutputColor(null);
        }
      }
      else if(message.packetType == ConfigurationPacket.INPUT_COLOR)
      {
        ForgeDirection side = ForgeDirection.getOrientation(message.inputSide);

        if(message.clickType == 0)
        {
          config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side)));
        }
        else if(message.clickType == 1)
        {
          config.getEjector().setInputColor(side, TransporterUtils.decrement(config.getEjector().getInputColor(side)));
        }
        else if(message.clickType == 2)
        {
          config.getEjector().setInputColor(side, null);
        }
      }
      else if(message.packetType == ConfigurationPacket.STRICT_INPUT)
      {
        config.getEjector().setStrictInput(!config.getEjector().hasStrictInput());
      }

      for(EntityPlayer p : ((TileEntityBasicBlock)config).playersUsing)
      {
        Mekanism.packetHandler.sendTo(new TileEntityMessage(message.coord4D, ((ITileNetwork)tile).getNetworkedData(new ArrayList())), (EntityPlayerMP)p);
View Full Code Here

TOP

Related Classes of mekanism.common.IInvConfiguration

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.