Diskuze: Forge crafting resolver
V předchozím kvízu, Online test znalostí Java, jsme si ověřili nabyté zkušenosti z kurzu.

Člen

Zobrazeno 4 zpráv z 4.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
V předchozím kvízu, Online test znalostí Java, jsme si ověřili nabyté zkušenosti z kurzu.
Zkus to znovu a přes tlačítko vložit kód
/* / package ic2.core.uu;
/ /
/ / import ic2.core.AdvRecipe;
/ / import ic2.core.util.StackUtil;
/ / import java.util.ArrayList;
/ / import java.util.Arrays;
/ / import java.util.List;
/ / import net.minecraft.item.ItemStack;
/ / import net.minecraft.item.crafting.CraftingManager;
/ / import net.minecraft.item.crafting.IRecipe;
/ / import net.minecraftforge.oredict.ShapedOreRecipe;
/ / import net.minecraftforge.oredict.ShapelessOreRecipe;
/ /
/ / public class ForgeCraftingResolver
/ / implements IRecipeResolver
/ / {
/ / public List<RecipeTransformation> getTransformations(ItemStack output)
/ / {
/ 22 / assert (output.field_77994_a == 1) : output;
/ 23 / List<RecipeTransformation> ret = new ArrayList();
/ 25 / for (IRecipe irecipe : CraftingManager.func_77594_a().func_77592_b()) {
/ 26 / if ((irecipe instanceof ShapedOreRecipe))
/ / {
/ 27 / ShapedOreRecipe recipe = (ShapedOreRecipe)irecipe;
/ 29 / if (matches(recipe.func_77571_b(), output)) {
/ 32 / ret.add(new RecipeTransformation(fixSize(AdvRecipe.expandArray(recipe.getInput())), recipe.func_77571_b()));
/ / }
/ / }
/ 35 / else if ((irecipe instanceof ShapelessOreRecipe))
/ / {
/ 36 / ShapelessOreRecipe recipe = (ShapelessOreRecipe)irecipe;
/ 38 / if (matches(recipe.func_77571_b(), output)) {
/ 41 / ret.add(new RecipeTransformation(fixSize(AdvRecipe.expandArray(recipe.getInput().toArray())), recipe.func_77571_b()));
/ / }
/ / }
/ / }
/ 47 / return ret;
/ / }
/ /
/ / private boolean matches(ItemStack offer, ItemStack requirement)
/ / {
/ 51 / return (offer.field_77993_c == requirement.field_77993_c) && ((requirement.func_77960_j() == 32767) || (offer.func_77960_j() == requirement.func_77960_j()));
/ / }
/ /
/ / private List<List<ItemStack>> fixSize(List<ItemStack>[] x)
/ / {
/ 57 / List<ItemStack>[] ret = new ArrayList[x.length];
/ 59 / for (int i = 0; i < x.length; i++)
/ / {
/ 60 / ret[i] = new ArrayList();
/ 62 / for (ItemStack stack : x[i]) {
/ 63 / if (stack.field_77994_a == 1) {
/ 64 / ret[i].add(stack);
/ / } else {
/ 66 / ret[i].add(StackUtil.copyWithSize(stack, 1));
/ / }
/ / }
/ / }
/ 71 / return Arrays.asList(ret);
/ / }
/ */ }
/* Location: C:\Users\Admin\Desktop\
* Qualified Name: ic2.core.uu.ForgeCraftingResolver
* JD-Core Version: 0.7.0.1
*/
Zobrazeno 4 zpráv z 4.