Posted October 1, 20177 yr Hello there, Im trying to get my Custom Workbench to work but without sucess, i can craft my on recipes on the whole grid wherever i place (Shapeless), but when i try with vanilla recipes it only works on the upper left corner 3x3 of my 5x5 grid. All my code is available at github HERE At attachments i have some images of whats happening. Iv tried multiple changes and none work I also did a breakpoint on the part that findMatchingRecipe compares the recipes and weither inside or outside the 3x3 grid, the contents of variables are the same. Just in case if needed, my IDE is IntelliJ IDEA. Thanx in advance. Edited October 1, 20177 yr by ResaloliPT
October 1, 20177 yr https://github.com/ResaloliPT/ExtrasInMinecraft/blob/master/src/main/java/com/resaloli/eim/content/crafting/CraftingManagerDCT.java#L34 Vanilla IRecipe implementations assume a 3x3 grid: /** * Used to check if a recipe matches current crafting inventory */ public boolean matches(InventoryCrafting inv, World worldIn) { for (int i = 0; i <= 3 - this.recipeWidth; ++i) { for (int j = 0; j <= 3 - this.recipeHeight; ++j) { if (this.checkMatch(inv, i, j, true)) { return true; } if (this.checkMatch(inv, i, j, false)) { return true; } } } return false; } Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 1, 20177 yr Author 9 minutes ago, Draco18s said: https://github.com/ResaloliPT/ExtrasInMinecraft/blob/master/src/main/java/com/resaloli/eim/content/crafting/CraftingManagerDCT.java#L34 Vanilla IRecipe implementations assume a 3x3 grid: /** * Used to check if a recipe matches current crafting inventory */ public boolean matches(InventoryCrafting inv, World worldIn) { for (int i = 0; i <= 3 - this.recipeWidth; ++i) { for (int j = 0; j <= 3 - this.recipeHeight; ++j) { if (this.checkMatch(inv, i, j, true)) { return true; } if (this.checkMatch(inv, i, j, false)) { return true; } } } return false; } Thx for posting, Hmm, weird no wonder i would never find, when i use IntelliJ to goto definition it show a nearly empty IRecipe interface Where could i get the default IRecipe to copy from?
October 1, 20177 yr That's an interface. You need to look at the classes that implement it. The snippet I showed was from ShapedRecipes. Right click on IRecipe and then in the context menu, click "open type hierarchy." Edit: Forge is also assuming a max width of 3: public static final int MAX_CRAFT_GRID_WIDTH = 3; public static final int MAX_CRAFT_GRID_HEIGHT = 3; @Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) { for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) { if (checkMatch(inv, x, y, false)) { return true; } if (mirrored && checkMatch(inv, x, y, true)) { return true; } } } return false; } Edited October 1, 20177 yr by Draco18s Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 1, 20177 yr Author 32 minutes ago, Draco18s said: That's an interface. You need to look at the classes that implement it. The snippet I showed was from ShapedRecipes. Right click on IRecipe and then in the context menu, click "open type hierarchy." Edit: Forge is also assuming a max width of 3: public static final int MAX_CRAFT_GRID_WIDTH = 3; public static final int MAX_CRAFT_GRID_HEIGHT = 3; @Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) { for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) { if (checkMatch(inv, x, y, false)) { return true; } if (mirrored && checkMatch(inv, x, y, true)) { return true; } } } return false; } Ohh nice Will try new things then will reply back
October 1, 20177 yr Author Indeed ShapedRecipes limited to 3x3, Shapeless already was using inv.get[Width/Height]() by default so i only made a ShapedRecipes implementing my own IRecipes and did some other changes, now when i place a item in the 3x3 it errors but doesnt crash, i push again the code to git. The changes can be seen HERE And here is the error i get: Spoiler [22:18:33] [Server thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class com.resaloli.eim.content.crafting.CraftingManagerDCT at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:796) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.resaloli.eim.content.crafting.CraftingManagerDCT at com.resaloli.eim.content.container.ContainerDCT.onCraftMatrixChanged(ContainerDCT.java:69) ~[ContainerDCT.class:?] at com.resaloli.eim.content.crafting.DCTCrafting.decrStackSize(DCTCrafting.java:111) ~[DCTCrafting.class:?] at net.minecraft.inventory.Slot.decrStackSize(Slot.java:136) ~[Slot.class:?] at net.minecraft.inventory.Container.slotClick(Container.java:321) ~[Container.class:?] at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:1212) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketClickWindow.processPacket(CPacketClickWindow.java:47) ~[CPacketClickWindow.class:?] at net.minecraft.network.play.client.CPacketClickWindow.processPacket(CPacketClickWindow.java:12) ~[CPacketClickWindow.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 5 more EDIT: On the commit i posted as can be seen on the CraftingManager i changed findMatchingRecipe to findMatchingRecipes and getRecipe to getRecipes because both where giving me clashing error. Error it would give: findMatchingRecipe(InventoryCrafting, World) in 'com.resaloli.eim.content.CraftingManagerDCT' clashes with findMatchingRecipe(InventoryCrafting, World) in 'net.minecraft.item.crafting.CraftingManager'; attempting to use incompatible type And same for getRecipe: getRecipe(ResourceLocation) in 'com.resaloli.eim.content.CraftingManagerDCT' clashes with getRecipe(ResourceLocation) in 'net.minecraft.item.crafting.CraftingManager'; attempting to use incompatible type Edited October 1, 20177 yr by ResaloliPT More info of changes
October 1, 20177 yr Or, you know you could just bring it to my attention. https://github.com/MinecraftForge/MinecraftForge/commit/b361b72515d1fddd4be0d822cb79b9e38187143c I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
October 2, 20177 yr Author 3 hours ago, LexManos said: Or, you know you could just bring it to my attention. https://github.com/MinecraftForge/MinecraftForge/commit/b361b72515d1fddd4be0d822cb79b9e38187143c Dunno who to rlly react to that , also an honor to be responded by someone i enjoy its awsome work
October 3, 20177 yr Author On 01/10/2017 at 11:09 PM, LexManos said: Or, you know you could just bring it to my attention. https://github.com/MinecraftForge/MinecraftForge/commit/b361b72515d1fddd4be0d822cb79b9e38187143c Works like a charm, thx for the patch EDIT: Github link just for future reference: HERE! Edited October 3, 20177 yr by ResaloliPT add github link
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.