[1.8+/1.9+/1.10+][NEI] Créer un plugin NotEnoughItems pour sa table de craft/son four
-
@‘AymericRed’:
Bonne idée, je vais voir ça
On merci
Minantcraft
-
Bonjour, je voudrais savoir quelles sont les choses à enlever si on à pas besoin de fuel. Et quelles sont les choses à ajouter si on à plusieurs ingrédient. PS: Ma machine est du même genre que ça: https://www.minecraftforgefrance.fr/showthread.php?tid=2017
-
Salut, je pense que tu devrais supprimer tout ce qui touche au mot “fuel” dans la classe du handler du four (et ne pas faire de handler pour le fuel), et modifier la classe “SmeltingPair” pour qu’elle prenne en charge plusieurs ingrédients, puis modifier les fonctions qui chargent les recettes. Si t’a besoin d’aide, je pense que ce sera plus simple par MP
-
Une queston je pourrais savoir comment certaint mod comme mekanisme… peuvent montrer leur crafd dans une machine sur nei ?
-
*Si je vous ai[st] aidé, n’oubliez pas de m’aider en me donnant un petit +
Et si vous est une marque de pluriel et pas un vouvoiement, aidé%(red)
-
@Yeyvo Ils utilisent l’API de NEI (comme ce tutoriel) et adaptent le code pour afficher les recettes des machines.
-
@‘AymericRed’:
@Yeyvo Ils utilisent l’API de NEI (comme ce tutoriel) et adaptent le code pour afficher les recettes des machines.
Je croit que ça pourrait mérité un tuto je vais commencé a lire leur code et j’en ferais un je croit
-
Alors j’ai peut-être zappé quelque chose, mais il y a déjà ce tuto.
-
Srx? Sur mff ?
-
Bah…le sujet sur lequel tu es actuellement traite de NEI.
-
Correction de quelques petites erreurs dans le code pour les fours, améliorations du sommaire, des pré-requis et ajout de liens pour passer certaines parties qui peuvent être inutiles à certains.
-
Pourquoi a chaque fois que je fais un truc ,ça va pas
Aidez moi svp !
-
Pourquoi ça fonctionne pas
Aidez moi svp !
buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { name 'CB Repo' url "http://chickenbones.net/maven/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } apply plugin: 'forge' version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" runDir = "eclipse" } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // for more info… // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html deobfCompile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:deobf" } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } }
-
Bon alors après avoir un peu regardé sur internet, la raison est ce que je pensais : 1.7.10.
J’ai l’impression que le gradle fourni avec la 1.7.10 n’a pas cette fonction, remplaces “deobfCompile” par “compile” et ça devrait fonctionner. -
On va dire que ça fonctionne pas tout a fait
Dans son tuto SCAREX utilise la version dev de NEI , c’est pas ce que je devrai faire ?
On peut voir que la deobf est pas disponible en 1.7.10
-
Ce sont les versions dev qu’il faut utiliser.
-
Bonjour !
J’ai suivi le tutoriel de BrokenSwing pour faire un “block de type four” et j’ai suivi ce tutoriel mais j’ai l’impression de voir les tutoriels différemment des autres XD
J’ai plusieurs erreurs indiqués par eclipse :
sur “instance” de Map <itemstack, itemstack=“”>recipes = CompressorRecipes.instance().getSmeltingList();(eclipse dit :The method instance() is undefined for the type CompressorRecipes)et sur “getItemBurnTime” de int burnTime = CompressorTE.getItemBurnTime(item); (eclipse me dit The method getItemBurnTime(ItemStack) is undefined for the type CompressorTE)
Voici ma class CompressorRecipeHandler :
package com.iutils.infinite.nei; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import com.iutils.infinite.Reference; import com.iutils.infinite.gui.GuiCompressor; import com.iutils.infinite.recipes.CompressorRecipes; import com.iutils.infinite.tileentities.CompressorTE; import codechicken.nei.ItemList; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.FurnaceRecipeHandler.FuelPair; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class CompressorRecipeHandler extends TemplateRecipeHandler { public static final String INDENTIFIER = Reference.MOD_ID + ".crafting"; public static ArrayList <fuelpair>afuels; @Override public String getRecipeName() { return I18n.format("recipename.compressorrecipe"); } @Override public String getGuiTexture() { return GuiCompressor.textures.toString(); } @Override public Class getGuiClass() { return GuiCompressor.class; } @Override public String getOverlayIdentifier() { return INDENTIFIER; } @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), INDENTIFIER));//Vous pouvez bien sur changer la position et la taille du rectangle (les arguments sont x, y, width, height) } @Override public void loadCraftingRecipes(String outputId, Object… results) { if (outputId.equals(INDENTIFIER) && getClass() == CompressorRecipeHandler.class) //Si on doit afficher toutes les recettes de ce type { Map <itemstack, itemstack="">recipes = CompressorRecipes.instance().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour toutes les recettes arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); //On l'ajoute à celles à afficher } else super.loadCraftingRecipes(outputId, results); //Va charger les recettes pour un item précis } @Override public void loadCraftingRecipes(ItemStack result) { Map <itemstack, itemstack="">recipes = CompressorRecipes.instance().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour chaque recette { if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) //On teste si elle correspond à celle que l'on cherche arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); //On l'ajoute aux recettes à afficher } } @Override public void loadUsageRecipes(String inputId, Object... ingredients) { if (inputId.equals("fuel") && getClass() == CompressorRecipeHandler.class) loadCraftingRecipes(INDENTIFIER); else super.loadUsageRecipes(inputId, ingredients); } @Override public void loadUsageRecipes(ItemStack ingredient) { Map <itemstack, itemstack="">recipes = CompressorRecipes.instance().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour chaque recette { if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) //On teste si elle correspond à celle que l'on cherche { SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipes.add(arecipe); //On l'ajoute aux recettes à afficher } } } public class SmeltingPair extends CachedRecipe { public SmeltingPair(ItemStack ingred, ItemStack result) { ingred.stackSize = 1; //Slot pour les ingrédients this.ingred = new PositionedStack(ingred, 51, 6); //51 : position x du slot sur le gui, 6 : position y //Slot pour le résultat this.result = new PositionedStack(result, 111, 24); //111 : position x du slot sur le gui, 24 : position y } public List <positionedstack>getIngredients() { return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); //Retourne un des ingrédients possibles en fonction du temps } public PositionedStack getResult() { return result; } public PositionedStack getOtherStack() //Retourne des stacks supplémentaires non impliqués directement dans la recette (exemple ici avec les fuels) { return afuels.get((cycleticks / 48) % afuels.size()).stack; } PositionedStack ingred; PositionedStack result; } @Override public TemplateRecipeHandler newInstance() { if (afuels == null || afuels.isEmpty()) //si la liste est vide findFuels(); return super.newInstance(); //Retourne une instance de la classe (appelle le constructeur) } private static Set excludedFuels() //Fuels qui ne seront pas affichés sur le gui { Set efuels = new HashSet(); efuels.add(Items.coal); return efuels; } private static void findFuels() //Pour chaque item existant, regarde si on peu l'utiliser comme carburant, et si oui l'ajoute à la liste des carburants { afuels = new ArrayList<fuelpair>(); Set efuels = excludedFuels(); for (ItemStack item : ItemList.items) { Block block = Block.getBlockFromItem(item.getItem()); if (block instanceof BlockDoor) continue; if (efuels.contains(item.getItem())) continue; int burnTime = CompressorTE.getItemBurnTime(item); if (burnTime > 0) { afuels.add(new FuelPair(item.copy(), burnTime)); } } } }
ma class CompressorRecipes :
package com.iutils.infinite.recipes; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import com.iutils.infinite.init.ItemMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class CompressorRecipes { private static final CompressorRecipes smeltingBase = new CompressorRecipes(); private Map smeltingList = new HashMap(); public CompressorRecipes() { this.addRecipe(Blocks.planks, Blocks.planks, Items.coal, new ItemStack(ItemMod.quarter_compressed_wood_block)); this.addRecipe(Blocks.stone, Blocks.stone, Items.coal, new ItemStack(ItemMod.quarter_compressed_stone_block)); this.addRecipe(Blocks.iron_block, Blocks.iron_block, Items.coal, new ItemStack(Items.iron_ingot)); } public void addRecipe(ItemStack stack1, ItemStack stack2, ItemStack stack3, ItemStack stack4) { ItemStack[] stackList = new ItemStack[]{stack1, stack2, stack3}; this.smeltingList.put(stackList, stack4); } public void addRecipe(Item item1, Item item2, Item item3, ItemStack stack) { this.addRecipe(new ItemStack(item1), new ItemStack(item2), new ItemStack(item3), stack); } public void addRecipe(Block block1, Item item2, Item item3, ItemStack stack) { this.addRecipe(Item.getItemFromBlock(block1), item2, item3, stack); } public void addRecipe(Block block1, Block block2, Item item3, ItemStack stack) { this.addRecipe(Item.getItemFromBlock(block1), Item.getItemFromBlock(block2), item3, stack); } public void addRecipe(Block block1, Block block2, Block block3, ItemStack stack) { this.addRecipe(Item.getItemFromBlock(block1), Item.getItemFromBlock(block2), Item.getItemFromBlock(block3), stack); } public ItemStack getSmeltingResult(ItemStack[] stack) { Iterator iterator = this.smeltingList.entrySet().iterator(); Entry entry; do { if (!iterator.hasNext()) { return null; } entry = (Entry)iterator.next(); } while (!this.isSameKey(stack, (ItemStack[])entry.getKey())); return (ItemStack)entry.getValue(); } private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2) { boolean isSame = false; for(int i=0; i<=2; i++) { if(stackList*.getItem() == stackList2*.getItem()) { isSame = true; } else { return false; } } return isSame; } public Map getSmeltingList() { return this.smeltingList; } public static CompressorRecipes smelting() { return smeltingBase; } }
et la class CompressorTE :
package com.iutils.infinite.tileentities; import com.iutils.infinite.init.BlockMod; import com.iutils.infinite.recipes.CompressorRecipes; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; public class CompressorTE extends TileEntity implements IInventory { private ItemStack[] contents = new ItemStack[4]; private String customName; private int workingTime = 0; private int workingTimeNeeded = 250; @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); if (compound.hasKey("CustomName", Constants.NBT.TAG_STRING)) { this.customName = compound.getString("CustomName"); } NBTTagList nbttaglist = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND); this.contents = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.workingTime = compound.getShort("workingTime"); this.workingTimeNeeded = compound.getShort("workingTimeNeeded"); } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); if (this.hasCustomInventoryName()) { compound.setString("CustomName", this.customName); } for (int i = 0; i < this.contents.length; ++i) { if (this.contents* != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.contents*.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); compound.setShort("workingTime",(short)this.workingTime); compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded); } public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } @Override public int getSizeInventory() { return this.contents.length; } @Override public ItemStack getStackInSlot(int slotIndex) { return this.contents[slotIndex]; } @Override public ItemStack decrStackSize(int slotIndex, int amount) { if (this.contents[slotIndex] != null) { ItemStack itemstack; if (this.contents[slotIndex].stackSize <= amount) { itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; this.markDirty(); return itemstack; } else { itemstack = this.contents[slotIndex].splitStack(amount); if (this.contents[slotIndex].stackSize == 0) { this.contents[slotIndex] = null; } this.markDirty(); return itemstack; } } else { return null; } } @Override public ItemStack getStackInSlotOnClosing(int slotIndex) { if (this.contents[slotIndex] != null) { ItemStack itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; return itemstack; } else { return null; } } @Override public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.contents[slotIndex] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } @Override public String getInventoryName() { return this.hasCustomInventoryName() ? this.customName : "tile.compressor.name"; } @Override public boolean hasCustomInventoryName() { return this.customName != null && !this.customName.isEmpty(); } public void setCustomName(String customName) { this.customName = customName; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int slotIndex, ItemStack stack) { return false; } public boolean isBurning() { return this.workingTime > 0; } private boolean canSmelt() { if (this.contents[0] == null || this.contents[1] == null || this.contents[2] == null) { return false; } else { ItemStack itemstack = CompressorRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); if (itemstack == null) return false; if (this.contents[3] == null) return true; if (!this.contents[3].isItemEqual(itemstack)) return false; int result = contents[3].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize(); } } public void updateEntity() { if(this.isBurning() && this.canSmelt()) { ++this.workingTime; } if(this.canSmelt() && !this.isBurning()) { this.workingTime = 1; } if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) { this.smeltItem(); this.workingTime = 0; } if(!this.canSmelt()) { this.workingTime= 0; } } public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = CompressorRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); if (this.contents[3] == null) { this.contents[3] = itemstack.copy(); } else if (this.contents[3].getItem() == itemstack.getItem()) { this.contents[3].stackSize += itemstack.stackSize; } –this.contents[0].stackSize; –this.contents[1].stackSize; –this.contents[2].stackSize; if (this.contents[0].stackSize <= 0) { this.contents[0] = null; } if (this.contents[1].stackSize <= 0) { this.contents[1] = null; } if (this.contents[2].stackSize <= 0) { this.contents[2] = null; } } } @SideOnly(Side.CLIENT) public int getCookProgress() { return this.workingTime * 41 / this.workingTimeNeeded; } }
J’espère que quelqu’un pourra m’aider :)</fuelpair></positionedstack></itemstack,></itemstack,></itemstack,></itemstack,></itemstack,></itemstack,></fuelpair></itemstack,>
-
Alors oui comme le tuto de BrokenSwing est en 1.7.10 je l’ai pas suivi pour faire mon tuto, mais ces modifs sont pas bien compliquées ^^ :
“CompressorRecipes.instance()” => “CompressorRecipes.smelting()”.
Et pour “CompressorTE.getItemBurnTime(item);”, vu que ta variable workingTimeNeeded ne change jamais, tu peux remplacer par sa valeur, 250. -
Crash … (quand j’ai essayé de cliquer sur le bouton recipes de ma machine)
package com.iutils.infinite.nei; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import com.iutils.infinite.Reference; import com.iutils.infinite.gui.GuiCompressor; import com.iutils.infinite.recipes.CompressorRecipes; import com.iutils.infinite.tileentities.CompressorTE; import codechicken.nei.ItemList; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.FurnaceRecipeHandler.FuelPair; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class CompressorRecipeHandler extends TemplateRecipeHandler { public static final String INDENTIFIER = Reference.MOD_ID + ".crafting"; public static ArrayList <fuelpair>afuels; @Override public String getRecipeName() { return I18n.format("recipename.compressorrecipe"); } @Override public String getGuiTexture() { return GuiCompressor.textures.toString(); } @Override public Class getGuiClass() { return GuiCompressor.class; } @Override public String getOverlayIdentifier() { return INDENTIFIER; } @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), INDENTIFIER));//Vous pouvez bien sur changer la position et la taille du rectangle (les arguments sont x, y, width, height) } @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(INDENTIFIER) && getClass() == CompressorRecipeHandler.class) //Si on doit afficher toutes les recettes de ce type { Map <itemstack, itemstack="">recipes = CompressorRecipes.smelting().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour toutes les recettes arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); //On l'ajoute à celles à afficher } else super.loadCraftingRecipes(outputId, results); //Va charger les recettes pour un item précis } @Override public void loadCraftingRecipes(ItemStack result) { Map <itemstack, itemstack="">recipes = CompressorRecipes.smelting().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour chaque recette { if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) //On teste si elle correspond à celle que l'on cherche arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); //On l'ajoute aux recettes à afficher } } @Override public void loadUsageRecipes(String inputId, Object... ingredients) { if (inputId.equals("fuel") && getClass() == CompressorRecipeHandler.class) loadCraftingRecipes(INDENTIFIER); else super.loadUsageRecipes(inputId, ingredients); } @Override public void loadUsageRecipes(ItemStack ingredient) { Map <itemstack, itemstack="">recipes = CompressorRecipes.smelting().getSmeltingList(); for (Entry <itemstack, itemstack="">recipe : recipes.entrySet()) //Pour chaque recette { if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) //On teste si elle correspond à celle que l'on cherche { SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipes.add(arecipe); //On l'ajoute aux recettes à afficher } } } public class SmeltingPair extends CachedRecipe { public SmeltingPair(ItemStack ingred, ItemStack result) { ingred.stackSize = 1; //Slot pour les ingrédients this.ingred = new PositionedStack(ingred, 51, 6); //51 : position x du slot sur le gui, 6 : position y //Slot pour le résultat this.result = new PositionedStack(result, 111, 24); //111 : position x du slot sur le gui, 24 : position y } public List <positionedstack>getIngredients() { return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); //Retourne un des ingrédients possibles en fonction du temps } public PositionedStack getResult() { return result; } public PositionedStack getOtherStack() //Retourne des stacks supplémentaires non impliqués directement dans la recette (exemple ici avec les fuels) { return afuels.get((cycleticks / 48) % afuels.size()).stack; } PositionedStack ingred; PositionedStack result; } @Override public TemplateRecipeHandler newInstance() { if (afuels == null || afuels.isEmpty()) //si la liste est vide findFuels(); return super.newInstance(); //Retourne une instance de la classe (appelle le constructeur) } private static Set excludedFuels() //Fuels qui ne seront pas affichés sur le gui { Set efuels = new HashSet(); efuels.add(Items.coal); return efuels; } private static void findFuels() //Pour chaque item existant, regarde si on peu l'utiliser comme carburant, et si oui l'ajoute à la liste des carburants { afuels = new ArrayList<fuelpair>(); Set efuels = excludedFuels(); for (ItemStack item : ItemList.items) { Block block = Block.getBlockFromItem(item.getItem()); if (block instanceof BlockDoor) continue; if (efuels.contains(item.getItem())) continue; int burnTime = 250; if (burnTime > 0) { afuels.add(new FuelPair(item.copy(), burnTime)); } } } }
:::
---- Minecraft Crash Report ----
// Why did you do that?Time: 14/06/17 20:50
Description: Updating screen eventsjava.lang.ClassCastException: [Lnet.minecraft.item.ItemStack; cannot be cast to net.minecraft.item.ItemStack
at com.iutils.infinite.nei.CompressorRecipeHandler.loadCraftingRecipes(CompressorRecipeHandler.java:73)
at codechicken.nei.recipe.TemplateRecipeHandler.getRecipeHandler(TemplateRecipeHandler.java:466)
at codechicken.nei.recipe.GuiCraftingRecipe.openRecipeGui(GuiCraftingRecipe.java:20)
at codechicken.nei.recipe.TemplateRecipeHandler.transferRect(TemplateRecipeHandler.java:574)
at codechicken.nei.recipe.TemplateRecipeHandler.access$000(TemplateRecipeHandler.java:34)
at codechicken.nei.recipe.TemplateRecipeHandler$RecipeTransferRectHandler.transferRect(TemplateRecipeHandler.java:234)
at codechicken.nei.recipe.TemplateRecipeHandler$RecipeTransferRectHandler.mouseClicked(TemplateRecipeHandler.java:225)
at codechicken.nei.guihook.GuiContainerManager.mouseClicked(GuiContainerManager.java:329)
at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:344)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseInput(GuiContainer.java)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1731)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)A detailed walkthrough of the error, its code path and all known details is as follows:
– Head –
Stacktrace:
at com.iutils.infinite.nei.CompressorRecipeHandler.loadCraftingRecipes(CompressorRecipeHandler.java:73)
at codechicken.nei.recipe.TemplateRecipeHandler.getRecipeHandler(TemplateRecipeHandler.java:466)
at codechicken.nei.recipe.GuiCraftingRecipe.openRecipeGui(GuiCraftingRecipe.java:20)
at codechicken.nei.recipe.TemplateRecipeHandler.transferRect(TemplateRecipeHandler.java:574)
at codechicken.nei.recipe.TemplateRecipeHandler.access$000(TemplateRecipeHandler.java:34)
at codechicken.nei.recipe.TemplateRecipeHandler$RecipeTransferRectHandler.transferRect(TemplateRecipeHandler.java:234)
at codechicken.nei.recipe.TemplateRecipeHandler$RecipeTransferRectHandler.mouseClicked(TemplateRecipeHandler.java:225)
at codechicken.nei.guihook.GuiContainerManager.mouseClicked(GuiContainerManager.java:329)
at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:344)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseInput(GuiContainer.java)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)– Affected screen –
Details:
Screen name: com.iutils.infinite.gui.GuiCompressor– Affected level –
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP[‘Player692’/681, l=‘MpServer’, x=-38,64, y=65,62, z=-39,55]]
Chunk stats: MultiplayerChunkCache: 225, 225
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (-46,64,-22), Chunk: (at 2,4,10 in -3,-2; contains blocks -48,0,-32 to -33,255,-17), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 780295 game time, 780295 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 117 total; [EntityEnderman[‘Enderman’/512, l=‘MpServer’, x=-20,84, y=49,00, z=39,31], EntitySpider[‘Spider’/513, l=‘MpServer’, x=-28,72, y=50,00, z=35,97], EntitySkeleton[‘Skeleton’/771, l=‘MpServer’, x=-37,56, y=51,00, z=-38,31], EntitySkeleton[‘Skeleton’/773, l=‘MpServer’, x=-38,50, y=53,00, z=-42,50], EntityZombie[‘Zombie’/781, l=‘MpServer’, x=-11,50, y=35,00, z=36,50], EntityEnderman[‘Enderman’/526, l=‘MpServer’, x=-13,94, y=38,00, z=-50,50], EntityItem[‘item.tile.mushroom’/527, l=‘MpServer’, x=-14,19, y=39,13, z=-48,13], EntitySlime[‘Slime’/528, l=‘MpServer’, x=-3,69, y=20,00, z=8,31], EntityCow[‘Cow’/529, l=‘MpServer’, x=-11,50, y=68,00, z=30,81], EntityChicken[‘Chicken’/530, l=‘MpServer’, x=-12,84, y=72,00, z=26,69], EntityCow[‘Cow’/540, l=‘MpServer’, x=11,69, y=89,00, z=-102,75], EntityCreeper[‘Creeper’/541, l=‘MpServer’, x=14,56, y=22,00, z=-65,03], EntityCreeper[‘Creeper’/542, l=‘MpServer’, x=14,63, y=20,00, z=-55,34], EntityCreeper[‘Creeper’/543, l=‘MpServer’, x=28,49, y=15,13, z=-56,52], EntityZombie[‘Zombie’/544, l=‘MpServer’, x=12,66, y=20,00, z=-56,50], EntityCreeper[‘Creeper’/545, l=‘MpServer’, x=15,09, y=20,00, z=-50,91], EntityCow[‘Cow’/546, l=‘MpServer’, x=-0,75, y=84,00, z=-60,50], EntityCreeper[‘Creeper’/547, l=‘MpServer’, x=15,53, y=22,00, z=-47,34], EntityZombie[‘Zombie’/548, l=‘MpServer’, x=1,94, y=36,00, z=-20,50], EntityZombie[‘Zombie’/549, l=‘MpServer’, x=7,69, y=34,00, z=-15,44], EntityZombie[‘Zombie’/550, l=‘MpServer’, x=6,91, y=34,00, z=-15,66], EntityCow[‘Cow’/551, l=‘MpServer’, x=0,97, y=64,00, z=-6,84], EntityBat[‘Bat’/552, l=‘MpServer’, x=-3,17, y=19,58, z=11,48], EntitySquid[‘Squid’/553, l=‘MpServer’, x=-0,75, y=59,78, z=7,03], EntityZombie[‘Zombie’/554, l=‘MpServer’, x=4,50, y=18,00, z=41,50], EntityCreeper[‘Creeper’/555, l=‘MpServer’, x=22,13, y=43,00, z=29,78], EntityCow[‘Cow’/558, l=‘MpServer’, x=30,19, y=89,00, z=-67,19], EntityCreeper[‘Creeper’/559, l=‘MpServer’, x=9,28, y=20,00, z=-58,50], EntityCreeper[‘Creeper’/560, l=‘MpServer’, x=20,50, y=20,00, z=-54,50], EntityCow[‘Cow’/561, l=‘MpServer’, x=19,47, y=87,00, z=-52,19], EntityChicken[‘Chicken’/562, l=‘MpServer’, x=23,56, y=64,00, z=-18,44], EntityCow[‘Cow’/563, l=‘MpServer’, x=17,94, y=64,00, z=-9,88], EntitySlime[‘Slime’/564, l=‘MpServer’, x=30,63, y=36,00, z=14,63], EntitySlime[‘Slime’/565, l=‘MpServer’, x=22,31, y=44,00, z=22,31], EntitySkeleton[‘Skeleton’/566, l=‘MpServer’, x=23,94, y=32,00, z=18,47], EntitySkeleton[‘Skeleton’/567, l=‘MpServer’, x=25,50, y=43,00, z=18,88], EntityCow[‘Cow’/586, l=‘MpServer’, x=37,81, y=88,00, z=-90,81], EntityCow[‘Cow’/587, l=‘MpServer’, x=40,53, y=89,00, z=-49,78], EntitySlime[‘Slime’/588, l=‘MpServer’, x=32,32, y=36,00, z=14,63], EntityCow[‘Cow’/590, l=‘MpServer’, x=33,63, y=83,00, z=24,41], EntityCow[‘Cow’/375, l=‘MpServer’, x=-112,78, y=63,00, z=-108,78], EntitySkeleton[‘Skeleton’/378, l=‘MpServer’, x=-113,88, y=53,00, z=-3,50], EntityCow[‘Cow’/379, l=‘MpServer’, x=-114,25, y=68,00, z=-7,75], EntityCow[‘Cow’/389, l=‘MpServer’, x=-110,06, y=63,00, z=-97,06], EntityCow[‘Cow’/390, l=‘MpServer’, x=-98,94, y=64,00, z=-111,34], EntitySquid[‘Squid’/393, l=‘MpServer’, x=-101,75, y=61,31, z=-73,22], EntityZombie[‘Zombie’/395, l=‘MpServer’, x=-99,31, y=41,00, z=-20,47], EntityBat[‘Bat’/396, l=‘MpServer’, x=-99,38, y=39,10, z=-10,75], EntityCreeper[‘Creeper’/397, l=‘MpServer’, x=-108,00, y=33,00, z=2,50], EntityCreeper[‘Creeper’/398, l=‘MpServer’, x=-104,97, y=33,00, z=4,56], EntityCreeper[‘Creeper’/399, l=‘MpServer’, x=-105,50, y=46,00, z=31,97], EntityCow[‘Cow’/400, l=‘MpServer’, x=-105,72, y=65,00, z=18,44], EntityCow[‘Cow’/401, l=‘MpServer’, x=-98,72, y=69,00, z=37,25], EntityCow[‘Cow’/409, l=‘MpServer’, x=-93,38, y=65,00, z=-113,44], EntityCow[‘Cow’/410, l=‘MpServer’, x=-94,75, y=64,00, z=-109,19], EntityCow[‘Cow’/411, l=‘MpServer’, x=-92,63, y=65,00, z=-88,50], EntityCow[‘Cow’/412, l=‘MpServer’, x=-94,50, y=61,00, z=-73,31], EntityCow[‘Cow’/413, l=‘MpServer’, x=-90,97, y=66,00, z=-77,84], EntityCow[‘Cow’/414, l=‘MpServer’, x=-80,16, y=64,00, z=-57,66], EntitySquid[‘Squid’/415, l=‘MpServer’, x=-94,59, y=57,34, z=-42,03], EntityZombie[‘Zombie’/416, l=‘MpServer’, x=-95,50, y=43,00, z=-22,03], EntityCow[‘Cow’/417, l=‘MpServer’, x=-88,19, y=67,00, z=-12,81], EntityCow[‘Cow’/418, l=‘MpServer’, x=-95,44, y=67,00, z=-15,38], EntityZombie[‘Zombie’/419, l=‘MpServer’, x=-94,50, y=17,00, z=29,69], EntityClientPlayerMP[‘Player692’/681, l=‘MpServer’, x=-38,64, y=65,62, z=-39,55], EntityCow[‘Cow’/436, l=‘MpServer’, x=-71,88, y=67,00, z=-90,78], EntityCow[‘Cow’/437, l=‘MpServer’, x=-78,31, y=67,00, z=-94,78], EntityCow[‘Cow’/438, l=‘MpServer’, x=-78,38, y=63,00, z=-34,47], EntitySkeleton[‘Skeleton’/439, l=‘MpServer’, x=-73,50, y=49,00, z=-40,28], EntitySkeleton[‘Skeleton’/440, l=‘MpServer’, x=-68,84, y=49,00, z=-40,44], EntityZombie[‘Zombie’/441, l=‘MpServer’, x=-69,09, y=15,00, z=-10,44], EntityCreeper[‘Creeper’/697, l=‘MpServer’, x=-39,50, y=31,00, z=-45,50], EntityCreeper[‘Creeper’/442, l=‘MpServer’, x=-70,03, y=68,00, z=3,28], EntityCow[‘Cow’/453, l=‘MpServer’, x=-48,97, y=68,00, z=-113,09], EntityCow[‘Cow’/454, l=‘MpServer’, x=-57,59, y=66,00, z=-105,59], EntityCow[‘Cow’/455, l=‘MpServer’, x=-59,38, y=66,00, z=-103,25], EntityCow[‘Cow’/456, l=‘MpServer’, x=-49,97, y=67,00, z=-80,94], EntityCow[‘Cow’/457, l=‘MpServer’, x=-59,78, y=64,00, z=-66,25], EntityEnderman[‘Enderman’/458, l=‘MpServer’, x=-48,76, y=53,00, z=-51,83], EntitySkeleton[‘Skeleton’/459, l=‘MpServer’, x=-48,44, y=30,00, z=-45,13], EntityBat[‘Bat’/460, l=‘MpServer’, x=-53,25, y=53,10, z=-45,25], EntityBat[‘Bat’/461, l=‘MpServer’, x=-59,28, y=54,10, z=-36,38], EntityBat[‘Bat’/462, l=‘MpServer’, x=-50,25, y=50,10, z=-34,47], EntityBat[‘Bat’/463, l=‘MpServer’, x=-52,00, y=55,10, z=-42,25], EntityBat[‘Bat’/464, l=‘MpServer’, x=-52,25, y=59,10, z=-34,25], EntityCreeper[‘Creeper’/465, l=‘MpServer’, x=-54,13, y=50,00, z=-46,47], EntityBat[‘Bat’/466, l=‘MpServer’, x=-52,63, y=50,10, z=-29,09], EntityBat[‘Bat’/467, l=‘MpServer’, x=-53,47, y=49,10, z=-30,69], EntityBat[‘Bat’/468, l=‘MpServer’, x=-51,22, y=50,10, z=-30,75], EntityBat[‘Bat’/469, l=‘MpServer’, x=-49,50, y=49,10, z=-28,59], EntityBat[‘Bat’/470, l=‘MpServer’, x=-54,72, y=51,10, z=-24,16], EntityBat[‘Bat’/471, l=‘MpServer’, x=-55,63, y=62,10, z=-25,75], EntityBat[‘Bat’/472, l=‘MpServer’, x=-53,50, y=49,10, z=-31,66], EntityZombie[‘Zombie’/473, l=‘MpServer’, x=-58,97, y=17,00, z=-9,50], EntityChicken[‘Chicken’/474, l=‘MpServer’, x=-58,69, y=70,00, z=39,34], EntityCow[‘Cow’/481, l=‘MpServer’, x=-36,25, y=70,00, z=-104,69], EntityCow[‘Cow’/482, l=‘MpServer’, x=-47,38, y=67,00, z=-105,41], EntityZombie[‘Zombie’/483, l=‘MpServer’, x=-41,56, y=14,00, z=-55,69], EntitySkeleton[‘Skeleton’/484, l=‘MpServer’, x=-37,06, y=45,00, z=-55,44], EntityZombie[‘Zombie’/485, l=‘MpServer’, x=-42,58, y=47,00, z=-56,96], EntityZombie[‘Zombie’/486, l=‘MpServer’, x=-46,03, y=14,00, z=-47,78], EntityCreeper[‘Creeper’/487, l=‘MpServer’, x=-46,38, y=30,00, z=-45,16], EntityBat[‘Bat’/488, l=‘MpServer’, x=-40,09, y=54,10, z=-32,41], EntityBat[‘Bat’/489, l=‘MpServer’, x=-37,72, y=54,10, z=-33,53], EntityBat[‘Bat’/490, l=‘MpServer’, x=-40,75, y=54,10, z=-32,25], EntityCow[‘Cow’/491, l=‘MpServer’, x=-42,19, y=64,00, z=-32,19], EntityZombie[‘Zombie’/492, l=‘MpServer’, x=-48,03, y=25,00, z=-17,50], EntityZombie[‘Zombie’/493, l=‘MpServer’, x=-61,50, y=35,00, z=41,21], EntityZombie[‘Zombie’/754, l=‘MpServer’, x=-98,50, y=27,00, z=40,50], EntityZombie[‘Zombie’/1014, l=‘MpServer’, x=22,50, y=77,00, z=-79,50], EntityCreeper[‘Creeper’/1015, l=‘MpServer’, x=24,50, y=77,00, z=-82,50], EntitySkeleton[‘Skeleton’/506, l=‘MpServer’, x=-20,50, y=30,00, z=-61,50], EntityCow[‘Cow’/507, l=‘MpServer’, x=-26,34, y=67,00, z=-54,34], EntityCreeper[‘Creeper’/508, l=‘MpServer’, x=-31,56, y=42,00, z=-34,03], EntityCreeper[‘Creeper’/509, l=‘MpServer’, x=-21,88, y=61,00, z=-33,69], EntityCow[‘Cow’/510, l=‘MpServer’, x=-26,63, y=72,00, z=-3,72], EntityEnderman[‘Enderman’/511, l=‘MpServer’, x=-27,75, y=50,00, z=40,28]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)– System Details –
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_121, Oracle Corporation
Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 585388640 bytes (558 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 13, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 6 mods loaded, 6 mods active
States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
UCHIJAAAAAAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAAAAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAAAAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAAAAAAA NotEnoughItems{1.0.5.120} [Not Enough Items] (NotEnoughItems-1.7.10-1.0.5.120-dev.jar)
UCHIJAAAAAAAAA CodeChickenCore{1.0.7.47} [CodeChicken Core] (minecraft.jar)
UCHIJAAAAAAAAA iutils{0.0.0} [IUtils Mod] (bin)
GL info: ’ Vendor: ‘NVIDIA Corporation’ Version: ‘4.5.0 NVIDIA 382.53’ Renderer: ‘GeForce 840M/PCIe/SSE2’
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce 840M/PCIe/SSE2 GL version 4.5.0 NVIDIA 382.53, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.Is Modded: Definitely; Client brand changed to ‘fml,forge’
Type: Client (map_client.txt)
Resource Packs: [F32-1.7.10.zip]
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1):::</fuelpair></positionedstack></itemstack,></itemstack,></itemstack,></itemstack,></itemstack,></itemstack,></fuelpair>
-
Il faut que tu adaptes le code de ta classe CompressorRecipeHandler car tes recettes ne sont pas au format ItemStack=>ItemStack mais ItemStack[]=>ItemStack, il n’arrive donc pas à transformer un Array en objet simple.