Jump to content

Help with making block in 1.15.2 mod


coxakil50

Recommended Posts

I'm starting recently with making simple mod. I add new block but i found problem with adding block item. Can someone help me with that ?

 

This is my code :

in RegistryHandler:

public static final RegistryObject<Item> ROCK_BLOCK_ITEM = Items.register("rock_Block", () -> new BlockItemBase(ROCK_BLOCK.get()));

in BlockItemBase:

public class BlockItemBase extends BlockItem {

 

      public BlockItemBase(Block block) {

              super(block, new Item.Properties().group(CMain.Tab));

     }

}

Link to comment
Share on other sites

The error is : [14:14:30] [modloading-worker-2/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Failed to create mod instance. ModID: skysagamod, class com.Destiny.skysagamod.CMain
java.lang.ExceptionInInitializerError: null
    at com.Destiny.skysagamod.CMain.<init>(CMain.java:26) ~[?:?] {re:classloading}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181] {}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181] {}
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181] {}
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181] {}

At this line in CMain class I have :  RegistryHandler.init();

When I add //  in RegistryHandler before public static final RegistryObject<Item> ROCK_BLOCK_ITEM = Items.register("rock_Block", () -> new BlockItemBase(ROCK_BLOCK.get())); code compile so problem is with registration itemblock.

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.

Announcements



×
×
  • Create New...

Important Information

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