A few minor enhancements

This commit is contained in:
Aidan C. Brady 2013-11-24 16:35:01 -06:00
parent fea5e8dab7
commit 7c47043d37
2 changed files with 6 additions and 58 deletions

View file

@ -223,52 +223,6 @@ public final class CableUtils
return amount;
}
/**
* Emits energy from all sides of a TileEntity.
* @param amount - amount to send
* @param pointer - sending TileEntity
* @param ignored - ignored acceptors
* @return rejected energy
*/
public static double emitEnergyFromAllSides(double amount, TileEntity pointer, ArrayList<TileEntity> ignored)
{
if(pointer != null)
{
Set<EnergyNetwork> networks = new HashSet<EnergyNetwork>();
double totalRemaining = 0;
ignored.add(pointer);
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity sideTile = Object3D.get(pointer).getFromSide(side).getTileEntity(pointer.worldObj);
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile))
{
networks.add(((ITransmitter<EnergyNetwork>)sideTile).getTransmitterNetwork());
}
}
if(networks.size() == 0)
{
return amount;
}
double remaining = amount%networks.size();
double splitEnergy = (amount-remaining)/networks.size();
for(EnergyNetwork network : networks)
{
totalRemaining += network.emit(splitEnergy+remaining, ignored);
remaining = 0;
}
return totalRemaining;
}
return amount;
}
public static void emit(TileEntityElectricBlock emitter)
{
if(!emitter.worldObj.isRemote && MekanismUtils.canFunction(emitter))

View file

@ -966,21 +966,15 @@ public final class MekanismUtils
{
Object obj = itr.next();
if(obj != null)
if(obj instanceof IRecipe && ((IRecipe)obj).getRecipeOutput() != null)
{
if(obj instanceof IRecipe)
for(ItemStack itemStack : itemStacks)
{
if(((IRecipe)obj).getRecipeOutput() != null)
if(((IRecipe)obj).getRecipeOutput().isItemEqual(itemStack))
{
for(ItemStack itemStack : itemStacks)
{
if(((IRecipe)obj).getRecipeOutput().isItemEqual(itemStack))
{
itr.remove();
didRemove = true;
break;
}
}
itr.remove();
didRemove = true;
break;
}
}
}