Jump to content

[1.12.2] Using Registries crashes in ClientLauncher


WOLFI3654

Recommended Posts

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 by WOLFI3654
Font bugs (strange...)
Link to comment
Share on other sites

Use JSON recipes.

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.