WOLFI3654 Posted January 31, 2018 Posted January 31, 2018 (edited) Hey There, I am currently working on a mod for the 1.12.2 I am using Forge 1.12.2 - 14.23.1.2555 But I came across a problem. I want to Register a shaped crafting and an enchantment with registries. Here is my class: Spoiler @Mod.EventBusSubscriber(modid = GommeModeMod.MODID) public static class CommonRegistryListener { @SubscribeEvent public static void onRegisterRecepie(RegistryEvent.Register<IRecipe> r) { System.out.println("Register"); ItemStack sword = new ItemStack(Items.DIAMOND_SWORD); sword.setTranslatableName("§1GommeSword"); sword.addEnchantment(Enchantments.KNOCKBACK, 5); sword.addEnchantment(Enchantments.SHARPNESS, 5); sword.addEnchantment(Enchantments.SMITE, 5); sword.addEnchantment(Enchantments.FIRE_ASPECT, 5); NonNullList<Ingredient> list = NonNullList.create(); // ForgeRegistries. list.addAll(Arrays.asList(new Ingredient[] { Ingredient.EMPTY, Ingredient.fromStacks(new ItemStack(Blocks.DIAMOND_BLOCK)), Ingredient.EMPTY, Ingredient.EMPTY, Ingredient.fromStacks(new ItemStack(Blocks.DIAMOND_BLOCK)), Ingredient.EMPTY, Ingredient.EMPTY, Ingredient.fromItem(Items.STICK), Ingredient.EMPTY })); // ForgeRegistries.RECIPES r.getRegistry().register(new ShapedRecipes("", 3, 3, list, sword) .setRegistryName(new ResourceLocation(GommeModeMod.MODID, "recipies.gomme_sword"))); } @SubscribeEvent public static void onRegisterEnchantments(RegistryEvent.Register<Enchantment> r) { // ForgeRegistries.ENCHANTMENTS r.getRegistry().register(new EnchantmentGommeMode().setName("gommemode").setRegistryName("ench.gommemode")); } } In eclipse everything is working fine, but when I export and try it in my Client I get The game crashed whilst initializing game Error: java.lang.NoClassDefFoundError: scala/actors/threadpool/Arrays Log: Spoiler Quote ---- Minecraft Crash Report ---- // Why is it breaking Time: 1/31/18 7:24 PM Description: Initializing game java.lang.NoClassDefFoundError: scala/actors/threadpool/Arrays at de.wolfi.gommemode.GommeModeMod$CommonRegistryListener.onRegisterRecepie(GommeModeMod.java:78) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_CommonRegistryListener_onRegisterRecepie_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:746) at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:622) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:717) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:352) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:534) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.ClassNotFoundException: scala.actors.threadpool.Arrays at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 18 more Caused by: java.lang.NullPointerException I don't know how to fix this error. I've already looked around and tried to use the implementations as other 1.12 mods on GitHub. Nothing worked for me... Edited January 31, 2018 by WOLFI3654 Font bugs (strange...) Quote
Draco18s Posted January 31, 2018 Posted January 31, 2018 Use JSON recipes. Quote 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.
WOLFI3654 Posted February 2, 2018 Author Posted February 2, 2018 I tried, but I wasn't able to figure out how to add own with a enchanted item as Output. And I got the same problem with the enchantment Quote
Draco18s Posted February 2, 2018 Posted February 2, 2018 Use the result: nbt object. e.g.: https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.12.2/src/main/resources/assets/testmod3/recipes/guardian_spawner_from_fish_and_sticks.json#L24-L31 Quote 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.
WOLFI3654 Posted February 2, 2018 Author Posted February 2, 2018 (edited) I figured out by myself what went wrong. I was importing the wrong Arrays for Arrays.asList. Without NBT it's working fine Edited February 4, 2018 by WOLFI3654 Quote
KittenKoder Posted February 3, 2018 Posted February 3, 2018 12 hours ago, diesieben07 said: You should still use JSON recipes. There are many cases in which the JSON recipes are clunky, like for adding a bunch of recipes for simple variants of models (such as if you are adding in a bunch of stairs). While making your own recipe class seems to be preferred, it's just adding more work when a simple array list would cut the work in half or more. Quote
LexManos Posted February 4, 2018 Posted February 4, 2018 You can still use 'a simple array list' to generate your jsons, just do it in your build script and not at runtime. There are many reasons to use the json system. And MANY ways to make it simple/easy if you get past the concept of everything having to be done at runtime. We use gradle for a reason, it's powerful. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
WOLFI3654 Posted February 4, 2018 Author Posted February 4, 2018 I don't know how to pull that off sry Quote
Recommended Posts
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.