Créer une table de craft compatible avec JEI et NEI
-
@‘AymericRed’:
Je dois dire que ce n’est pas une mauvaise idée, l’adapterais donc le tuto prochainement, mais par contre dans le lien que tu as donné les valeurs dand la fonction sont les mêmes qu’ici.
Woops, effectivement ! Le comble c’est que je n’arrive plus à retrouver l’endroit exact où j’ai chopé ces valeurs, haha.
Pour me faire pardonner, je mets directement mon code ci-dessous (fonctionnant pour une table de craft 5x5 */!*)@Override public ItemStack transferStackInSlot(EntityPlayer player, int slotId) { ItemStack itemstack = null; Slot slot = this.inventorySlots.get(slotId); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); /** * If the slot belongs to the craftResult slot, * Put the itemStack in the 27 slots player inventory */ if (slotId == 0) { if (!this.mergeItemStack(itemstack1, 26, 62, true)) { return (null); } slot.onSlotChange(itemstack1, itemstack); } /** * If the slot belongs to the 27 slots player inventory, * Put the itemStack in the 9 slots player hotbar */ else if (slotId >= 26 && slotId < 53) { if (!this.mergeItemStack(itemstack1, 53, 62, false)) { return (null); } } /** * If the slot belongs to the 9 slots player hotbar, * Put the itemStack in the 27 slots player inventory */ else if (slotId >= 53 && slotId < 62) { if (!this.mergeItemStack(itemstack1, 26, 53, false)) { return (null); } } /** * If the slot doesn't match with any of the if condition above, * Put the itemStack in the whole player inventory (hotbar + 27 slots) */ else if (!this.mergeItemStack(itemstack1, 26, 62, false)) { return (null); } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return (null); } slot.onPickupFromSlot(player, itemstack1); } return (itemstack); }
J’ai même commenté pour que ce soit plus clair !
Je me permets encore une fois aux personnes qui liront ce message plus tard, qu’en fin de compte ces fameuses valeurs (26, 53, 62) sont propres à la taille du inventorySlots de votre container (qui change à chaque fois que vous faites this.addSlotToContainer). À vous d’adapter ces valeurs en fonction de la grille de craft 4x4, 6x6 ou 100x100, etc…
-
Merci d’avoir mis ça, je m’en inspirerait, mais avec un truc dynamique changeant selon la taille de la grille ^^
EDIT : C’est fait -
Bonjour ! ,
Je suis en train de créer la table de craft en 1.7.10 mais j’ai un BIG problem …
eclipse me dit qu’il y a une erreur ici (sur le .add), dans la fonction public AdvancedShapedRecipes addRecipe , dans la class container :AdvancedShapedRecipes shapedrecipes = new AdvancedShapedRecipes(j, k, aitemstack, result); this.recipes.add(shapedrecipes); return shapedrecipes;
J’attends une réponse avec impatience ! (parce que c’est la seule erreur qui reste dans mon code )
-
Bonjour,
“dans la class container”
Tu ne parles pas plutôt de la classe du CraftingManager ?Quel est l’erreur indiquée exactement ? Et montre la classe entière avec les imports visibles.
-
Oui désolé je viens de me rendre compte que je me suis trompé , en même temps ça fait bien longtemps que j’éssaie de faire fonctionner ma table de craft et je suis un peu beaucoup fatigué !
Voici ma classe AdvancedCraftingRecipes :
package com.iutils.infinite.recipes; import java.util.List; import java.util.Map; import javax.annotation.Nullable; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; public class AdvancedCraftingManager { private static final AdvancedCraftingManager INSTANCE = new AdvancedCraftingManager(); public static AdvancedCraftingManager getInstance() { return INSTANCE; } /** La liste des recettes */ private final List <irecipe>recipes = Lists.<irecipe>newArrayList(); private AdvancedCraftingManager() { //Vous pouvez ajouter des recettes ici } /** * Adds a shaped recipe to the games recipe list. */ public AdvancedShapedRecipes addRecipe(ItemStack result, Object… recipeComponents) { String s = ""; int i = 0; int j = 0; int k = 0; if (recipeComponents* instanceof String[]) { String[] astring = (String[])((String[])recipeComponents[i++]); for (int l = 0; l < astring.length; ++l) { String s2 = astring[l]; ++k; j = s2.length(); s = s + s2; } } else { while (recipeComponents* instanceof String) { String s1 = (String)recipeComponents[i++]; ++k; j = s1.length(); s = s + s1; } } Character character; Map <character, object="">components = Maps.<character, object="">newHashMap(); Object in; for ( ; i < recipeComponents.length; i += 2) { in = recipeComponents_; Object component = null; character = (Character)recipeComponents*; if (in instanceof Item) { component = new ItemStack((Item)recipeComponents_); } else if (in instanceof Block) { component = new ItemStack((Block)recipeComponents_, 1, 32767); } else if (in instanceof ItemStack) { component = (ItemStack)recipeComponents_; } else if (in instanceof String) { component = (String)in; } else { throw new IllegalArgumentException("Invalid shaped recipe: unknown type " + in.getClass().getName() + "!"); } components.put(character, component); } Object[] aitemstack = new Object[j * k]; char key; Object component; for (int i1 = 0; i1 < j * k; ++i1) { key = s.charAt(i1); if (components.containsKey(Character.valueOf(key))) { component = components.get(Character.valueOf(key)); if(component instanceof ItemStack) aitemstack[i1] = ((ItemStack)component).copy(); else aitemstack[i1] = component; } else aitemstack[i1] = null; } AdvancedShapedRecipes shapedrecipes = new AdvancedShapedRecipes(j, k, aitemstack, result); this.recipes.add(shapedrecipes); return shapedrecipes; } /** * Adds a shapeless crafting recipe to the the game. */ public void addShapelessRecipe(ItemStack result, Object… recipeComponents) { List list = Lists.newArrayList(); for (Object component : recipeComponents) //Pour chaque composant de la recette { if (component instanceof ItemStack) { list.add(((ItemStack)component).copy()); } else if (component instanceof Item) { list.add(new ItemStack((Item)component)); } else if(component instanceof Block) { list.add(new ItemStack((Block)component)); } else if(component instanceof String) //Pour l'ore dictionnary { list.add(component); } else throw new IllegalArgumentException("Invalid shapeless recipe: unknown type " + component.getClass().getName() + "!"); } this.recipes.add(new AdvancedShapelessRecipe(result, list)); } /** * Adds an IRecipe to the list of crafting recipes. */ public void addRecipe(IRecipe recipe) { this.recipes.add(recipe); } /** * Retourne le résultat de la recette ou null si il n'y en a aucun */ @Nullable public ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn) { for (IRecipe irecipe : this.recipes) //Pour chaque recette { if (irecipe.matches(craftMatrix, worldIn)) //Si elle correspond à la matrice actuelle { return irecipe.getCraftingResult(craftMatrix); //On donne son résultat } } return null; } /** * Retourne les items retants après un craft */ public List <irecipe>getRecipeList() { return this.recipes; } }
eclipse me dit : The method add(IRecipe) in the type List <irecipe>is not applicable for the arguments (AdvancedShapedRecipes)
version pastebin !
Problème réglé , j’ai mis ça a la place :
AdvancedShapedRecipes shapedrecipes = new AdvancedShapedRecipes(j, k, aitemstack, result); this.recipes.add(new AdvancedShapelessRecipe(result, recipes)); return shapedrecipes;
par contre j’ai un problème , quand je fais un clic droit sur mon bloc , mon curseur de souris apparait un fragment de secondes et disparaît comme si le container s’ouvrait puis se refermait très rapidement.
EDIT : Corrigé !</irecipe></irecipe>____</character,></character,></irecipe></irecipe>
-
Alors apparement ton problème est résolu, mais avec ce code
AdvancedShapedRecipes shapedrecipes = new AdvancedShapedRecipes(j, k, aitemstack, result); this.recipes.add(new AdvancedShapelessRecipe(result, recipes)); return shapedrecipes; ``` la recette va pas bien fonctionner du tout (essayes pour voir). Car ce ne sera plus une recette shaped mais shapeless, le problème est que "AdvancedShapedRecipes" n'implémente pas IRecipe.
-
Merci ! mais le jeu crash a cause de cette ligne dans mon container:
@Override public void onCraftMatrixChanged(IInventory iiventory) { craftResult.setInventorySlotContents(0, AdvancedCraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); // celle-ci ! }
et ici , dans mon crafting manager:
AdvancedCraftingManager.getInstance().addRecipe(new ItemStack(Items.golden_apple), "A A", "X X", "X X", "A A", 'A', Items.carrot, 'X', Blocks.planks);
et également ici :
private static final AdvancedCraftingManager INSTANCE = new AdvancedCraftingManager();
-
Euh…envoies le crash-report plutôt ^^
-
ok :
:::–-- Minecraft Crash Report ----
// You’re mean.
Time: 11/06/17 17:59
Description: Unexpected error
java.lang.ExceptionInInitializerError
at com.iutils.infinite.containers.ContainerAdvancedCraftingTab.onCraftMatrixChanged(ContainerAdvancedCraftingTab.java:84)
at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
at net.minecraft.inventory.Slot.putStack(Slot.java:104)
at net.minecraft.inventory.Container.putStacksInSlots(Container.java:558)
at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1202)
at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:70)
at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:78)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1693)
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)
Caused by: java.lang.NullPointerException
at com.iutils.infinite.recipes.AdvancedCraftingManager.<init>(AdvancedCraftingManager.java:33)
at com.iutils.infinite.recipes.AdvancedCraftingManager.<clinit>(AdvancedCraftingManager.java:22)
… 21 more
A detailed walkthrough of the error, its code path and all known details is as follows:
– Head –
Stacktrace:
at com.iutils.infinite.containers.ContainerAdvancedCraftingTab.onCraftMatrixChanged(ContainerAdvancedCraftingTab.java:84)
at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
at net.minecraft.inventory.Slot.putStack(Slot.java:104)
at net.minecraft.inventory.Container.putStacksInSlots(Container.java:558)
at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1202)
at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:70)
at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:78)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:317)
– Affected level –
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP[‘Player189’/339, l=‘MpServer’, x=-41,31, y=67,99, z=-40,38]]
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: 545798 game time, 545798 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: 95 total; [EntityBat[‘Bat’/128, l=‘MpServer’, x=-50,25, y=50,10, z=-34,47], EntityBat[‘Bat’/129, l=‘MpServer’, x=-52,00, y=55,10, z=-42,25], EntityBat[‘Bat’/130, l=‘MpServer’, x=-51,25, y=54,10, z=-47,66], EntityBat[‘Bat’/131, l=‘MpServer’, x=-52,63, y=50,10, z=-29,09], EntityBat[‘Bat’/132, l=‘MpServer’, x=-53,47, y=49,10, z=-30,69], EntityBat[‘Bat’/133, l=‘MpServer’, x=-51,22, y=50,10, z=-30,75], EntityBat[‘Bat’/134, l=‘MpServer’, x=-49,50, y=49,10, z=-28,59], EntityBat[‘Bat’/135, l=‘MpServer’, x=-53,28, y=50,10, z=-21,41], EntityBat[‘Bat’/136, l=‘MpServer’, x=-54,72, y=51,10, z=-24,16], EntityBat[‘Bat’/137, l=‘MpServer’, x=-55,63, y=62,10, z=-25,75], EntityBat[‘Bat’/138, l=‘MpServer’, x=-53,50, y=49,10, z=-31,66], EntityCow[‘Cow’/145, l=‘MpServer’, x=-37,81, y=69,00, z=-102,47], EntityZombie[‘Zombie’/146, l=‘MpServer’, x=-37,34, y=69,00, z=-103,50], EntityCow[‘Cow’/147, l=‘MpServer’, x=-38,75, y=73,00, z=-78,38], EntitySkeleton[‘Skeleton’/148, l=‘MpServer’, x=-34,78, y=45,00, z=-57,41], EntityZombie[‘Zombie’/149, l=‘MpServer’, x=-46,47, y=49,00, z=-51,03], EntityBat[‘Bat’/150, l=‘MpServer’, x=-40,09, y=54,10, z=-32,41], EntityBat[‘Bat’/151, l=‘MpServer’, x=-37,72, y=54,10, z=-33,53], EntityBat[‘Bat’/152, l=‘MpServer’, x=-40,75, y=54,10, z=-32,25], EntityChicken[‘Chicken’/153, l=‘MpServer’, x=-42,38, y=68,00, z=33,94], EntityZombie[‘Zombie’/163, l=‘MpServer’, x=-28,66, y=88,00, z=-89,53], EntityCreeper[‘Creeper’/164, l=‘MpServer’, x=-31,56, y=42,00, z=-34,03], EntityCreeper[‘Creeper’/165, l=‘MpServer’, x=-21,88, y=61,00, z=-33,69], EntityWitch[‘Witch’/166, l=‘MpServer’, x=-22,69, y=61,00, z=-32,75], EntityCow[‘Cow’/167, l=‘MpServer’, x=-20,44, y=82,00, z=9,44], EntityZombie[‘Zombie’/169, l=‘MpServer’, x=-32,09, y=67,00, z=32,41], EntityChicken[‘Chicken’/170, l=‘MpServer’, x=-25,84, y=70,00, z=32,47], EntitySpider[‘Spider’/43, l=‘MpServer’, x=-112,16, y=62,11, z=-113,38], EntityCow[‘Cow’/46, l=‘MpServer’, x=-113,25, y=66,00, z=-21,72], EntityCow[‘Cow’/47, l=‘MpServer’, x=-119,25, y=67,00, z=-11,84], EntityChicken[‘Chicken’/48, l=‘MpServer’, x=-116,56, y=64,00, z=9,53], EntityCow[‘Cow’/183, l=‘MpServer’, x=-6,81, y=88,00, z=-92,78], EntityCow[‘Cow’/184, l=‘MpServer’, x=-3,47, y=66,00, z=-48,53], EntitySkeleton[‘Skeleton’/185, l=‘MpServer’, x=-7,69, y=64,00, z=-3,75], EntityCow[‘Cow’/57, l=‘MpServer’, x=-105,53, y=65,00, z=-104,41], EntitySkeleton[‘Skeleton’/186, l=‘MpServer’, x=-7,91, y=64,00, z=-7,53], EntityCow[‘Cow’/58, l=‘MpServer’, x=-108,27, y=64,00, z=-99,82], EntityCow[‘Cow’/59, l=‘MpServer’, x=-111,50, y=64,00, z=-102,97], EntityZombie[‘Zombie’/60, l=‘MpServer’, x=-107,05, y=64,00, z=-98,79], EntityChicken[‘Chicken’/61, l=‘MpServer’, x=-107,50, y=64,00, z=-63,50], EntityCow[‘Cow’/64, l=‘MpServer’, x=-98,16, y=64,00, z=-25,06], EntityCow[‘Cow’/65, l=‘MpServer’, x=-103,91, y=67,00, z=-15,67], EntityCow[‘Cow’/66, l=‘MpServer’, x=-100,94, y=68,00, z=33,91], EntitySkeleton[‘Skeleton’/195, l=‘MpServer’, x=12,78, y=69,00, z=-86,84], EntityCow[‘Cow’/196, l=‘MpServer’, x=4,53, y=88,00, z=-75,31], EntityCow[‘Cow’/197, l=‘MpServer’, x=2,78, y=88,00, z=-63,81], EntityCow[‘Cow’/198, l=‘MpServer’, x=10,84, y=64,00, z=-24,50], EntityEnderman[‘Enderman’/199, l=‘MpServer’, x=11,58, y=64,00, z=-16,38], EntityZombie[‘Zombie’/200, l=‘MpServer’, x=14,00, y=64,00, z=-10,59], EntityCow[‘Cow’/201, l=‘MpServer’, x=8,38, y=67,00, z=16,28], EntityCow[‘Cow’/205, l=‘MpServer’, x=24,03, y=94,00, z=-115,44], EntitySkeleton[‘Skeleton’/206, l=‘MpServer’, x=20,50, y=74,00, z=-88,50], EntitySkeleton[‘Skeleton’/207, l=‘MpServer’, x=17,72, y=71,00, z=-89,50], EntitySkeleton[‘Skeleton’/79, l=‘MpServer’, x=-87,50, y=65,00, z=-106,50], EntityCow[‘Cow’/208, l=‘MpServer’, x=30,19, y=89,00, z=-79,38], EntitySkeleton[‘Skeleton’/80, l=‘MpServer’, x=-89,50, y=65,00, z=-107,50], EntityCow[‘Cow’/209, l=‘MpServer’, x=19,47, y=87,00, z=-52,19], EntityCow[‘Cow’/81, l=‘MpServer’, x=-96,23, y=66,00, z=-100,24], EntityCow[‘Cow’/82, l=‘MpServer’, x=-91,31, y=59,00, z=-83,78], EntityZombie[‘Zombie’/210, l=‘MpServer’, x=26,31, y=64,00, z=-17,09], EntityCow[‘Cow’/83, l=‘MpServer’, x=-81,41, y=67,00, z=-83,91], EntityCow[‘Cow’/211, l=‘MpServer’, x=24,63, y=64,00, z=-7,32], EntityClientPlayerMP[‘Player189’/339, l=‘MpServer’, x=-41,31, y=67,99, z=-40,38], EntitySkeleton[‘Skeleton’/84, l=‘MpServer’, x=-83,50, y=65,00, z=-94,94], EntityZombie[‘Zombie’/212, l=‘MpServer’, x=26,39, y=64,00, z=-14,71], EntityCow[‘Cow’/85, l=‘MpServer’, x=-95,84, y=65,00, z=-88,06], EntityChicken[‘Chicken’/213, l=‘MpServer’, x=29,74, y=64,00, z=-4,28], EntityCow[‘Cow’/86, l=‘MpServer’, x=-90,50, y=66,00, z=-94,38], EntitySlime[‘Slime’/214, l=‘MpServer’, x=30,60, y=36,00, z=14,63], EntityCow[‘Cow’/87, l=‘MpServer’, x=-87,06, y=66,00, z=-76,09], EntitySlime[‘Slime’/215, l=‘MpServer’, x=22,31, y=44,00, z=22,72], EntityCow[‘Cow’/88, l=‘MpServer’, x=-95,84, y=68,00, z=-11,50], EntityCreeper[‘Creeper’/216, l=‘MpServer’, x=19,63, y=42,00, z=31,59], EntityCreeper[‘Creeper’/217, l=‘MpServer’, x=30,09, y=41,00, z=33,66], EntityCreeper[‘Creeper’/227, l=‘MpServer’, x=34,59, y=93,00, z=-116,44], EntityCow[‘Cow’/228, l=‘MpServer’, x=37,66, y=93,00, z=-101,69], EntityZombie[‘Zombie’/229, l=‘MpServer’, x=38,59, y=88,00, z=-40,09], EntityCreeper[‘Creeper’/230, l=‘MpServer’, x=34,09, y=43,00, z=12,25], EntityCow[‘Cow’/104, l=‘MpServer’, x=-67,75, y=67,00, z=-107,81], EntityCow[‘Cow’/105, l=‘MpServer’, x=-74,63, y=67,00, z=-109,22], EntityCow[‘Cow’/233, l=‘MpServer’, x=36,63, y=67,00, z=6,38], EntityCow[‘Cow’/106, l=‘MpServer’, x=-73,19, y=64,00, z=-54,06], EntityCow[‘Cow’/107, l=‘MpServer’, x=-77,03, y=63,00, z=-42,56], EntityBat[‘Bat’/108, l=‘MpServer’, x=-64,25, y=51,10, z=-31,25], EntityCow[‘Cow’/109, l=‘MpServer’, x=-73,28, y=64,00, z=-19,69], EntityCow[‘Cow’/110, l=‘MpServer’, x=-77,19, y=68,00, z=1,13], EntityCow[‘Cow’/119, l=‘MpServer’, x=-58,81, y=66,00, z=-102,50], EntityCow[‘Cow’/120, l=‘MpServer’, x=-51,50, y=66,00, z=-81,16], EntityZombie[‘Zombie’/121, l=‘MpServer’, x=-60,50, y=64,00, z=-75,50], EntityZombie[‘Zombie’/122, l=‘MpServer’, x=-55,50, y=64,00, z=-77,50], EntityWitch[‘Witch’/123, l=‘MpServer’, x=-54,50, y=35,00, z=-38,50], EntitySkeleton[‘Skeleton’/124, l=‘MpServer’, x=-54,06, y=33,00, z=-40,50], EntitySkeleton[‘Skeleton’/125, l=‘MpServer’, x=-51,50, y=35,00, z=-36,50], EntityBat[‘Bat’/126, l=‘MpServer’, x=-53,25, y=53,10, z=-45,25], EntityBat[‘Bat’/127, l=‘MpServer’, x=-59,28, y=54,10, z=-36,38]]
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:991)
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: 655526056 bytes (625 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: 15, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active
States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJAAAA 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):::</clinit></init>
-
Ah bah oui évidement x)
Tu ajoutes tes recettes dans ton constructeur, or pour ajouter les recettes, tu fais “AdvancedCraftingManager.getInstance().addRecipe(…)”, et le problème est que “AdvancedCraftingManager.getInstance()” va réappeller le constructeur, pour éviter ça java fait un return null donc NullPointerException.
Là c’est de ma faute, vu que j’avais mis l’exemple d’ajout dans l’init du mod et pas dans le constructeur, donc pour éviter un tel problème enlèves simplement les “AdvancedCraftingManager.getInstance()” devant les appels des fonctions pour ajouter une recette dans le constructeur.
Et je vais de mon côté corriger ça.
-
x) Merci beaucoup
It’s perfectly working ! (je sais pas pourquoi je me suis transformé en anglais) -
Ow that’s very good !
-
en 1.10 ca fonctionne ?
-
Alors là aucune idée, je pense que oui à part un ou deux changements potentiels de noms, mais si tu bloques je pourrais regarder.
C’est surtout en 1.12 que ça a des chances de changer. -
D’accord merci de ta réponse je vais essayer alors
-
Je viens de remarquer que le addShapelessRecipe n’accepte pas les “new ItemStack(Items.trucmachin, 1)” pour les crafts.
y a t’il possibilité de corriger cela ? -
Euh quel addShapelessRecipe (je suis sur Tapatalk donc pour trouver c’est pas vraiment pratique).
-
Celui-ci(c’est une partie de ton tutoriel):
Et le code permettant d’ajouter les recettes correspondant :- this.addShapelessRecipe(new ItemStack(Blocks.ANVIL), Items.CARROT, Items.GOLDEN_APPLE);
- this.addRecipe(new ItemStack(cratingTable), " C “, “X X”, ” C ", ‘C’, “slabWood”, ‘X’, Blocks.PLANKS); //“slabWood” est le nom des dalles de bois dans l’ore dictionnary, ceci est ajouté par Forge
- this.addRecipe(new ItemStack(Items.GOLDEN_APPLE), “A A”, “X X”, “X X”, “A A”, ‘A’, Items.CARROT, ‘X’, Blocks.PLANKS);
à placer dans le constructeur du TutorielCraftingManager.
-
Je crois qu’il manque un truc à ton message mais pas grave j’ai compris et je suis sur pc
Si j’ai compris tu veux mettre un ItemStack ici :this.addShapelessRecipe(new ItemStack(Blocks.ANVIL), ICI); ``` ? Et si c'est ça si ça devrait marcher. Si j'ai pas compris mets les arguments que t'essayes de passer et dit ce qui marche pas.
-
@‘AymericRed’:
Je crois qu’il manque un truc à ton message mais pas grave j’ai compris et je suis sur pc
Si j’ai compris tu veux mettre un ItemStack ici :this.addShapelessRecipe(new ItemStack(Blocks.ANVIL), ICI); ``` ? Et si c'est ça si ça devrait marcher. Si j'ai pas compris mets les arguments que t'essayes de passer et dit ce qui marche pas.
si je fait :
addShapelessRecipe(new ItemStack(Blocks.anvil), new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE)
si je met une planche(de n’importe quel type car j’ai mis “OreDictionary.WILDCARD_VALUE”) dans ma table de craft, ça m’affiche pas le resultat(une enclume).
alors que si je fait ça:
addShapelessRecipe(new ItemStack(Blocks.anvil), Item.getItemFromBlock(Blocks.planks)
ça m’affiche le resultat mais je dois uniquement mettre une planche en bois de chêne car je peux mettre “OreDictionnary.WILDCARD_VALUE” seulement avec “new ItemStack()”