Package forestry.api.core

Examples of forestry.api.core.ITileStructure


  @Override
  public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
    if (!(tile instanceof TileHatch))
      return false;

    ITileStructure central = ((TileHatch) tile).getCentralTE();
    if (central == null || !(central instanceof TileFarmPlain))
      return false;

    TankManager tankManager = ((TileFarmPlain) central).getTankManager();
    FluidTankInfo info = tankManager.getTankInfo(0);
View Full Code Here


  @Override
  public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
    if (!(tile instanceof TileHatch))
      return false;

    ITileStructure central = ((TileHatch) tile).getCentralTE();
    if (central == null || !(central instanceof TileFarmPlain))
      return false;

    ItemStack fertilizer = central.getInventory().getStackInSlot(TileFarmPlain.SLOT_FERTILIZER);
    if (fertilizer == null)
      return true;
    return ((float) fertilizer.stackSize / fertilizer.getMaxStackSize()) <= threshold;
  }
View Full Code Here

    }

    if (!(tile instanceof TileHatch))
      return false;

    ITileStructure central = ((TileHatch) tile).getCentralTE();
    if (central == null || !(central instanceof TileFarmPlain))
      return false;

    ItemStack filter;
    if (parameter == null || parameter.getItemStack() == null) {
View Full Code Here

  @Override
  protected void updateServerSide() {
    super.updateServerSide();
   
    if (energyManager.getTotalEnergyStored() == 0) {
      ITileStructure central = getCentralTE();
      if (!(central instanceof TileForestry))
        return;

      TileForestry centralHousing = (TileForestry) central;
      centralHousing.setErrorState(EnumErrorCode.NOPOWER);
      return;
    }

    if (activationDelay > 0) {
      activationDelay--;
      return;
    }

    // Hard limit to 4 cycles / second.
    if (workCounter < WORK_CYCLES && energyManager.consumeEnergyToDoWork()) {
      workCounter++;
    }

    if (workCounter >= WORK_CYCLES && worldObj.getTotalWorldTime() % 5 == 0) {
      ITileStructure central = getCentralTE();
      if (!(central instanceof IFarmHousing))
        return;

      if (((IFarmHousing) central).doWork()) {
        workCounter = 0;
View Full Code Here

      return null;

    if (!isMaster) {
      TileEntity tile = worldObj.getTileEntity(masterX, masterY, masterZ);
      if (tile instanceof ITileStructure) {
        ITileStructure master = (ITileStructure) worldObj.getTileEntity(masterX, masterY, masterZ);
        if (master.isMaster())
          return master;
        else
          return null;
      } else
        return null;
View Full Code Here

    TileEntity tile = world.getTileEntity(x, y, z);

    super.breakBlock(world, x, y, z, block, meta);

    if (tile instanceof ITileStructure) {
      ITileStructure structure = (ITileStructure) tile;
      if (structure.isIntegratedIntoStructure() && !structure.isMaster()) {
        ITileStructure central = structure.getCentralTE();
        if (central != null)
          central.validateStructure();
      }
    }
  }
View Full Code Here

      return null;

    if (!isMaster()) {
      TileEntity tile = worldObj.getTileEntity(masterX, masterY, masterZ);
      if (tile instanceof ITileStructure) {
        ITileStructure master = (ITileStructure) worldObj.getTileEntity(masterX, masterY, masterZ);
        if (master.isMaster())
          return master;
        else
          return null;
      } else
        return null;
View Full Code Here

    isInited = true;
    if (!hasMaster())
      return;

    ITileStructure central = getCentralTE();
    if (!(central instanceof IFarmComponent))
      return;

    ((IFarmComponent) central).registerListener(this);
  }
View Full Code Here

  }

  private void dumpToInventory(IInventory[] inventories) {

    ITileStructure central = getCentralTE();
    if (central == null)
      return;
    IInventory inv = central.getInventory();

    for (int i = TileFarmPlain.SLOT_PRODUCTION_1; i < TileFarmPlain.SLOT_PRODUCTION_1 + TileFarmPlain.SLOT_COUNT_PRODUCTION; i++) {
      if (inv.getStackInSlot(i) == null)
        continue;
View Full Code Here

  }

  private IInventory getStructureInventory() {

    if (hasMaster()) {
      ITileStructure central = getCentralTE();
      if (central != null)
        return central.getInventory();
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of forestry.api.core.ITileStructure

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.