Fully implement getStacksInRange, documentation needed still
This commit is contained in:
parent
53d224369b
commit
385ee4d8ea
2 changed files with 31 additions and 11 deletions
|
@ -2,7 +2,6 @@ package com.pahimar.ee3.api;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -93,22 +92,29 @@ public final class EnergyValueRegistryProxy
|
||||||
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getStacksInRange(int start, int finish)
|
public List getStacksInRange(int start, int finish)
|
||||||
{
|
{
|
||||||
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getStacksInRange(float start, float finish)
|
public List getStacksInRange(float start, float finish)
|
||||||
{
|
{
|
||||||
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getStacksInRange(EnergyValue start, EnergyValue finish)
|
public List getStacksInRange(EnergyValue start, EnergyValue finish)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
if (ee3Mod == null)
|
||||||
{
|
{
|
||||||
// TODO Finish
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish);
|
||||||
|
}
|
||||||
|
|
||||||
private static void init()
|
private static void init()
|
||||||
{
|
{
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.pahimar.ee3.recipe.RecipeRegistry;
|
||||||
import com.pahimar.ee3.util.EnergyValueHelper;
|
import com.pahimar.ee3.util.EnergyValueHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -482,19 +483,19 @@ public class EnergyValueRegistry
|
||||||
return computedStackMap;
|
return computedStackMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WrappedStack> getStacksInRange(int start, int finish)
|
public List getStacksInRange(int start, int finish)
|
||||||
{
|
{
|
||||||
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WrappedStack> getStacksInRange(float start, float finish)
|
public List getStacksInRange(float start, float finish)
|
||||||
{
|
{
|
||||||
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WrappedStack> getStacksInRange(EnergyValue start, EnergyValue finish)
|
public List getStacksInRange(EnergyValue start, EnergyValue finish)
|
||||||
{
|
{
|
||||||
List<WrappedStack> stacksInRange = new ArrayList<WrappedStack>();
|
List stacksInRange = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
SortedMap<EnergyValue, List<WrappedStack>> tailMap = energyValueRegistry.valueMappings.tailMap(start);
|
SortedMap<EnergyValue, List<WrappedStack>> tailMap = energyValueRegistry.valueMappings.tailMap(start);
|
||||||
SortedMap<EnergyValue, List<WrappedStack>> headMap = energyValueRegistry.valueMappings.headMap(finish);
|
SortedMap<EnergyValue, List<WrappedStack>> headMap = energyValueRegistry.valueMappings.headMap(finish);
|
||||||
|
@ -520,7 +521,20 @@ public class EnergyValueRegistry
|
||||||
{
|
{
|
||||||
if (biggerMap.containsKey(value))
|
if (biggerMap.containsKey(value))
|
||||||
{
|
{
|
||||||
stacksInRange.addAll(energyValueRegistry.valueMappings.get(value));
|
for (WrappedStack wrappedStack : energyValueRegistry.valueMappings.get(value))
|
||||||
|
{
|
||||||
|
if (wrappedStack.getWrappedStack() instanceof ItemStack || wrappedStack.getWrappedStack() instanceof FluidStack)
|
||||||
|
{
|
||||||
|
stacksInRange.add(wrappedStack.getWrappedStack());
|
||||||
|
}
|
||||||
|
else if (wrappedStack.getWrappedStack() instanceof OreStack)
|
||||||
|
{
|
||||||
|
for (ItemStack itemStack : OreDictionary.getOres(((OreStack) wrappedStack.getWrappedStack()).oreName))
|
||||||
|
{
|
||||||
|
stacksInRange.add(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue