Package ic2.api.energy.event

Examples of ic2.api.energy.event.EnergyTileLoadEvent


   * @param has to be an instance of IEnergyTile
  */
  @Override
  public void unregisterToEneryNet(TileEntity tile) {
    if(MainProxy.isServer(tile.getWorldObj())) {
      MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile));
    }
  }
View Full Code Here


    }

    public static void removeTileFromNet(TileEntity tile) {
        try {
            if (tile instanceof IEnergyTile)
                MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile));
        } catch (Throwable error) {
            Game.logErrorAPI("IC2", error, EnergyTileUnloadEvent.class);
        }
    }
View Full Code Here

    }

    @Override
    public void invalidate(){
        if(worldObj != null && !worldObj.isRemote) {
            MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
        }
        super.invalidate();
    }
View Full Code Here

    }

    @Override
    public void onChunkUnload(){
        if(worldObj != null && !worldObj.isRemote) {
            MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
        }
        super.onChunkUnload();
    }
View Full Code Here

    }

    @Override
    public void invalidate(){
        if(worldObj != null && !worldObj.isRemote) {
            MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
        }
        super.invalidate();
    }
View Full Code Here

    }

    @Override
    public void onChunkUnload(){
        if(worldObj != null && !worldObj.isRemote) {
            MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
        }
        super.onChunkUnload();
    }
View Full Code Here

  public EngineTin() {
    super(Defaults.ENGINE_TIN_HEAT_MAX, 100000, 4000);
    setHints(Config.hints.get("engine.tin"));

    if (PluginIC2.instance.isAvailable()) ic2EnergySink = new BasicSink(this, euConfig.euStorage, 3);
  }
View Full Code Here

    resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, FuelManager.generatorFuel.keySet());
    tankManager = new TankManager(resourceTank);

    if (PluginIC2.instance.isAvailable()) {
      ic2EnergySource = new BasicSource(this, maxEnergy, 1);
    }
  }
View Full Code Here

          }
        }
      }
      else if(MekanismUtils.useIC2() && acceptor instanceof IEnergySink)
      {
        IEnergySink handler = (IEnergySink)acceptor;

        if(handler.acceptsEnergyFrom(null, side.getOpposite()))
        {
          double demanded = handler.getDemandedEnergy()*Mekanism.FROM_IC2;
          int tier = Math.min(handler.getSinkTier(), 8);
          double max = EnergyNet.instance.getPowerFromTier(tier)*Mekanism.FROM_IC2;
         
          if(Math.min(demanded, max) > 0)
          {
            toReturn.add(acceptor);
View Full Code Here

      {
        storer.setEnergy(storer.getEnergy() + EnergizedItemManager.discharge(storer.inventory[slotID], storer.getMaxEnergy() - storer.getEnergy()));
      }
      else if(MekanismUtils.useIC2() && storer.inventory[slotID].getItem() instanceof IElectricItem)
      {
        IElectricItem item = (IElectricItem)storer.inventory[slotID].getItem();

        if(item.canProvideEnergy(storer.inventory[slotID]))
        {
          double gain = ElectricItem.manager.discharge(storer.inventory[slotID], (int)((storer.getMaxEnergy() - storer.getEnergy())*Mekanism.TO_IC2), 4, true, true, false)*Mekanism.FROM_IC2;
          storer.setEnergy(storer.getEnergy() + gain);
        }
      }
      else if(MekanismUtils.useRF() && storer.inventory[slotID].getItem() instanceof IEnergyContainerItem)
      {
        ItemStack itemStack = storer.inventory[slotID];
        IEnergyContainerItem item = (IEnergyContainerItem)storer.inventory[slotID].getItem();

        int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getEnergyStored(itemStack)));
        int toTransfer = (int)Math.round(Math.min(itemEnergy, ((storer.getMaxEnergy() - storer.getEnergy())*Mekanism.TO_TE)));

        storer.setEnergy(storer.getEnergy() + (item.extractEnergy(itemStack, toTransfer, false)*Mekanism.FROM_TE));
      }
      else if(storer.inventory[slotID].getItem() == Items.redstone && storer.getEnergy()+Mekanism.ENERGY_PER_REDSTONE <= storer.getMaxEnergy())
      {
        storer.setEnergy(storer.getEnergy() + Mekanism.ENERGY_PER_REDSTONE);
        storer.inventory[slotID].stackSize--;
View Full Code Here

TOP

Related Classes of ic2.api.energy.event.EnergyTileLoadEvent

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.