Merge branch 'master' of https://github.com/calclavia/Resonant-Induction
This commit is contained in:
commit
01f871011f
2 changed files with 31 additions and 0 deletions
|
@ -98,6 +98,36 @@ public class SetUtil
|
||||||
|
|
||||||
return newSet;
|
return newSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <V> Set<V> capRemains(Set<V> set, int cap)
|
||||||
|
{
|
||||||
|
Set<V> toReturn = new HashSet<V>();
|
||||||
|
|
||||||
|
if(set.size() <= cap)
|
||||||
|
{
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Set<V> inverse = inverse(set);
|
||||||
|
|
||||||
|
int iterNeeded = set.size()-cap;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for(V obj : set)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
toReturn.add(obj);
|
||||||
|
|
||||||
|
if(count == iterNeeded)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits a set into the defined amount of new sets, and returns them in an ArrayList.
|
* Splits a set into the defined amount of new sets, and returns them in an ArrayList.
|
||||||
|
|
|
@ -219,6 +219,7 @@ public class BatteryUpdateProtocol
|
||||||
{
|
{
|
||||||
ArrayList<Set<ItemStack>> inventories = SetUtil.split(oldStructure.inventory, iteratedNodes.size());
|
ArrayList<Set<ItemStack>> inventories = SetUtil.split(oldStructure.inventory, iteratedNodes.size());
|
||||||
List<TileEntityBattery> iterList = SetUtil.asList(iteratedNodes);
|
List<TileEntityBattery> iterList = SetUtil.asList(iteratedNodes);
|
||||||
|
|
||||||
boolean didVisibleInventory = false;
|
boolean didVisibleInventory = false;
|
||||||
|
|
||||||
for(int i = 0; i < iterList.size(); i++)
|
for(int i = 0; i < iterList.size(); i++)
|
||||||
|
|
Loading…
Reference in a new issue