Package ic2.api.energy.prefab

Examples of ic2.api.energy.prefab.BasicSource


    if(te == null || !(te instanceof ICropTile))
    {
      return false;
    }
    ICropTile tec = (ICropTile)te;
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
      if(tec.getID() < 0 || !crop.canBeHarvested(tec) || crop.canGrow(tec))
      {
        return false;
      }
    }
    catch(Exception e)
View Full Code Here


  public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z)
  {
    List<ItemStack> drops = new ArrayList<ItemStack>();
   
    ICropTile tec = (ICropTile)world.getBlockTileEntity(x, y, z);
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
     
      float chance = crop.dropGainChance();
      for (int i = 0; i < tec.getGain(); i++)
      {
        chance *= 1.03F;
      }
     
      chance -= rand.nextFloat();
      int numDrops = 0;
      while (chance > 0.0F)
      {
        numDrops++;
        chance -= rand.nextFloat();
      }
      ItemStack[] cropDrops = new ItemStack[numDrops];
      for (int i = 0; i < numDrops; i++)
      {
        cropDrops[i] = crop.getGain(tec);
        if((cropDrops[i] != null) && (rand.nextInt(100) <= tec.getGain()))
        {
          cropDrops[i].stackSize += 1;
        }
      }
     
      tec.setSize(crop.getSizeAfterHarvest(tec));
      _dirtyField.setBoolean(tec, true);
      for(ItemStack s : cropDrops)
      {
        drops.add(s);
      }
View Full Code Here

    TileEntity te = world.getBlockTileEntity(x, y, z);
    if(te == null || !(te instanceof ICropTile))
    {
      return false;
    }
    ICropTile tec = (ICropTile)te;
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
      if(tec.getID() < 0 || !crop.canBeHarvested(tec) || crop.canGrow(tec))
      {
        return false;
      }
    }
    catch(Exception e)
View Full Code Here

  @Override
  public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z)
  {
    List<ItemStack> drops = new ArrayList<ItemStack>();
   
    ICropTile tec = (ICropTile)world.getBlockTileEntity(x, y, z);
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
     
      float chance = crop.dropGainChance();
      for (int i = 0; i < tec.getGain(); i++)
      {
        chance *= 1.03F;
      }
     
      chance -= rand.nextFloat();
      int numDrops = 0;
      while (chance > 0.0F)
      {
        numDrops++;
        chance -= rand.nextFloat();
      }
      ItemStack[] cropDrops = new ItemStack[numDrops];
      for (int i = 0; i < numDrops; i++)
      {
        cropDrops[i] = crop.getGain(tec);
        if((cropDrops[i] != null) && (rand.nextInt(100) <= tec.getGain()))
        {
          cropDrops[i].stackSize += 1;
        }
      }
     
      tec.setSize(crop.getSizeAfterHarvest(tec));
      _dirtyField.setBoolean(tec, true);
      for(ItemStack s : cropDrops)
      {
        drops.add(s);
      }
View Full Code Here

      if (energyReceived > outputRate) energyReceived -= outputRate;
      else energyReceived = 0;

      if (energyBuffer >= packetSize)
      {
        EnergyNet net = EnergyNet.getForWorld(worldObj);
        boolean packetSent;
        do
        {
          packetSent = false;
          EnergyTileSourceEvent sourceEvent = new EnergyTileSourceEvent(this, packetSize);
View Full Code Here

    }

    if (receivingRedstoneSignal())
    {
      energyBuffer += outputRate;
      EnergyNet net = EnergyNet.getForWorld(worldObj);
      while (energyBuffer >= packetSize)
      {
        EnergyTileSourceEvent sourceEvent = new EnergyTileSourceEvent(this, packetSize);
        MinecraftForge.EVENT_BUS.post(sourceEvent);
        //        net.emitEnergyFrom(this, packetSize); // No reason to save any surplus. Output is always the same.
View Full Code Here

    {
        this.initialized = true;
       
        if (Loader.isModLoaded("IC2"))
        {
            MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
        }
    }
View Full Code Here

    @Override
    public void initiate()
    {
        if (Loader.isModLoaded("IC2"))
        {
            MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
        }
    }
View Full Code Here

      worldObj = parent.worldObj;
      xCoord = parent.xCoord;
      yCoord = parent.yCoord;
      zCoord = parent.zCoord;

      MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));

      addedToEnet = true;
    }
  }
View Full Code Here

      worldObj = parent.worldObj;
      xCoord = parent.xCoord;
      yCoord = parent.yCoord;
      zCoord = parent.zCoord;

      MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));

      addedToEnet = true;
    }
  }
View Full Code Here

TOP

Related Classes of ic2.api.energy.prefab.BasicSource

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.