Package powercrystals.minefactoryreloaded.tile.machine

Source Code of powercrystals.minefactoryreloaded.tile.machine.TileEntityMobCounter

package powercrystals.minefactoryreloaded.tile.machine;

import net.minecraft.entity.EntityLiving;
import net.minecraftforge.common.ForgeDirection;
import powercrystals.minefactoryreloaded.MineFactoryReloadedCore;
import powercrystals.minefactoryreloaded.core.HarvestAreaManager;
import powercrystals.minefactoryreloaded.core.IHarvestAreaContainer;
import powercrystals.minefactoryreloaded.setup.Machine;
import powercrystals.minefactoryreloaded.tile.base.TileEntityFactory;

public class TileEntityMobCounter extends TileEntityFactory implements IHarvestAreaContainer
{
  private HarvestAreaManager _ham;
  private int _lastMobCount;
 
  public TileEntityMobCounter()
  {
    _ham = new HarvestAreaManager(this, 2, 2, 1);
  }
 
  @Override
  public boolean canRotate()
  {
    return true;
  }
 
  @Override
  public HarvestAreaManager getHAM()
  {
    return _ham;
  }
 
  @Override
  public void updateEntity()
  {
    super.updateEntity();
   
    if(worldObj == null)
    {
      return;
    }
   
    int mobCount = worldObj.getEntitiesWithinAABB(EntityLiving.class, _ham.getHarvestArea().toAxisAlignedBB()).size();
    if(mobCount != _lastMobCount)
    {
      _lastMobCount = mobCount;
      if(!worldObj.isRemote)
      {
        worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, MineFactoryReloadedCore.machineBlocks.get(Machine.MobCounter.getBlockIndex()).blockID);
      }
    }
  }
 
  @Override
  public int getRedNetOutput(ForgeDirection side)
  {
    return _lastMobCount;
  }
}
TOP

Related Classes of powercrystals.minefactoryreloaded.tile.machine.TileEntityMobCounter

TOP
Copyright © 2018 www.massapi.com. 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.