use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class DarkSteelRecipeManager method getRecipes.
public static NNList<ItemStack> getRecipes(@Nonnull Set<UpgradePath> list, @Nonnull NNList<ItemStack> input) {
NNList<ItemStack> output = new NNList<ItemStack>();
NNIterator<ItemStack> iterator = input.iterator();
while (iterator.hasNext()) {
ItemStack inputStack = iterator.next();
if (inputStack.getItem() instanceof IDarkSteelItem) {
for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
if (upgrade.canAddToItem(inputStack, (IDarkSteelItem) inputStack.getItem())) {
ItemStack outputStack = inputStack.copy();
upgrade.addToItem(outputStack, (IDarkSteelItem) outputStack.getItem());
final UpgradePath path = new UpgradePath(inputStack, upgrade.getUpgradeItem(), outputStack);
if (!list.contains(path)) {
list.add(path);
output.add(outputStack);
}
}
}
}
}
return output;
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class StirlingRecipeCategory method register.
// -------------------------------------
public static void register(@Nonnull IModRegistry registry, @Nonnull IGuiHelper guiHelper) {
registry.addRecipeCategories(new StirlingRecipeCategory(guiHelper));
registry.addRecipeCategoryCraftingItem(new ItemStack(MachineObject.block_stirling_generator.getBlockNN(), 1, 0), StirlingRecipeCategory.UID);
registry.addRecipeCategoryCraftingItem(new ItemStack(MachineObject.block_simple_stirling_generator.getBlockNN(), 1, 0), StirlingRecipeCategory.UID);
registry.addRecipeClickArea(GuiStirlingGenerator.class, 155, 42, 16, 16, StirlingRecipeCategory.UID);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerStirlingGenerator.Normal.class, StirlingRecipeCategory.UID, 0, 1, 2, 4 * 9);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerStirlingGenerator.Simple.class, StirlingRecipeCategory.UID, 0, 1, 1, 4 * 9);
long start = System.nanoTime();
// Put valid fuel to "buckets" based on their burn time (energy production)
NNMap<Integer, NNList<ItemStack>> recipeInputs = new NNMap.Brutal<>();
List<ItemStack> validItems = registry.getIngredientRegistry().getIngredients(ItemStack.class);
int fuelCount = 0;
for (ItemStack stack : validItems) {
int burntime = stack == null ? -1 : TileStirlingGenerator.getBurnTimeGeneric(stack);
if (burntime <= 0)
continue;
++fuelCount;
if (recipeInputs.containsKey(burntime)) {
recipeInputs.get(burntime).add(stack);
} else {
NNList<ItemStack> list = new NNList<>();
list.add(stack);
recipeInputs.put(burntime, list);
}
}
List<StirlingRecipeWrapper> recipeList = new ArrayList<StirlingRecipeWrapper>();
// Order recipes from best to worst
TreeSet<Integer> recipeOrder = new TreeSet<Integer>(recipeInputs.keySet());
Iterator<Integer> it = recipeOrder.descendingIterator();
while (it.hasNext()) recipeList.add(new StirlingRecipeWrapper(recipeInputs.get(it.next()), guiHelper));
registry.addRecipes(recipeList, UID);
long end = System.nanoTime();
Log.info(String.format("StirlingRecipeCategory: Added %d stirling generator recipes for %d solid fuel to JEI in %.3f seconds.", recipeList.size(), fuelCount, (end - start) / 1000000000d));
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class BlockPaintedCarpet method getDrops.
@Override
public void getDrops(@Nonnull NonNullList<ItemStack> drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) {
NNList<ItemStack> drops2 = new NNList<>();
super.getDrops(drops2, world, pos, state, fortune);
for (ItemStack drop : drops2) {
PaintUtil.setSourceBlock(NullHelper.notnullM(drop, "null stack from getDrops()"), getPaintSource(state, world, pos));
}
drops.addAll(drops2);
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class BlockPaintedFenceGate method getDrops.
@Override
public void getDrops(@Nonnull NonNullList<ItemStack> drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) {
NNList<ItemStack> drops2 = new NNList<>();
super.getDrops(drops2, world, pos, state, fortune);
for (ItemStack drop : drops2) {
PaintUtil.setSourceBlock(NullHelper.notnullM(drop, "null stack from getDrops()"), getPaintSource(state, world, pos));
}
drops.addAll(drops2);
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class BlockPaintedStairs method getDrops.
@Override
public void getDrops(@Nonnull NonNullList<ItemStack> drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) {
NNList<ItemStack> drops2 = new NNList<>();
super.getDrops(drops2, world, pos, state, fortune);
for (ItemStack drop : drops2) {
PaintUtil.setSourceBlock(NullHelper.notnullM(drop, "null stack from getDrops()"), getPaintSource(state, world, pos));
}
drops.addAll(drops2);
}
Aggregations