Jump to content

Deferred Registers not Wanting to Work in Forge 1.15.2


Justforgames250

Recommended Posts

I've been learning a bit of modding and so far I've been stopped in my tracks by this error I tried to add an item to the game but the only error Im having is with the Deferred Registers here's what its says:

'DeferredRegister(net.minecraftforge.registries.IForgeRegistry<T>, java.lang.String)' has private access in 'net.minecraftforge.registries.DeferredRegister'

 

I've looked all over the internet and even compared it to the correct way it is the exact same.

 

Here's the rest of the code in RegistryHadler.java:

package com.Justforgames250.tutorialmod.util;

        import com.Justforgames250.tutorialmod.Tutorial;
        import com.Justforgames250.tutorialmod.items.ItemBase;
        import net.minecraft.item.Item;
        import net.minecraftforge.fml.RegistryObject;
        import  net.minecraftforge.registries.DeferredRegister;
        import  net.minecraftforge.registries.ForgeRegistries;

public class RegistryHandler {
    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Tutorial.MOD_ID);//heres where i get the error

    //Items
    public static final RegistryObject<Item> RUBY = ITEMS.register("testitem", ItemBase::new);
}

 

Any help would be appreciated. I'm using 1.15.2 forge and am fine with providing more info if asked too. Thanks. 

Edited by Justforgames250
Link to comment
Share on other sites

Or looking at the DeferredRegister class itself to see where the constructor is called from...

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

  • 6 months later...
On 10/5/2020 at 3:44 PM, diesieben07 said:

Not sure why you looked "all over the internet" instead of just looking at the documentation. It tells you what to do and it also shows that you are not doing it correctly.

Sorry, I also just started with learning coding. But the documentation don't solve the problem!

(The Problem is what I underline here: "new DeferredRegister<>(ForgeRegistries.ITEMS, TestMod ..."

public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, TestMod.MOD_ID);

Hole Code:

package com.NotHeizer.TestMod.util;

import com.NotHeizer.TestMod.TestMod;
import com.NotHeizer.TestMod.items.ItemBase;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class RegisteryHandler {

    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, TestMod.MOD_ID);

    public static void init() {
        ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());

    //Items
    public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new)

 }

This was my "util" package. If I go into my TestMod (the Name of my Mod) Package there is 1 related Problem:

package com.NotHeizer.TestMod;

import com.NotHeizer.TestMod.util.RegisteryHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod("TMod")
public class TestMod {
    private static final Logger LOGGER = LogManager.getLogger();
public static final  String MOD_ID = "TestMod";

    public TestMod() {

        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

        RegisteryHandler.init();

        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event) { }

    private void doClientStuff(final FMLClientSetupEvent event) { }
}

You can't see it, but after:

@Mod("TMod")
public class TestMod {
    private static final Logger LOGGER = LogManager.getLogger();

and Befor:

public static final  String MOD_ID = "TestMod";

there stands: "1 related Problem" in red and if I klick on it, it sends me to: "new DeferredRegister<>(ForgeRegistries.ITEMS, TestMod ..." (btw"DeferredRegister<>" is than marked. I am a beginner, and I am not good at it, but I read through the documentation and could not find something that could help me, or I am still not good enough. Can you help me?

 

Sorry for my bad englisch :P And I saw your Name, it sounds German, so if you are German, I am too so pleas write me in German if you can so that I could understand easily!

Tanks in advanced!

 

Link to comment
Share on other sites

1 hour ago, Heizer said:

Oh ok, I thought it is for Java ok. shame on me for that, but where can I finde Java Suport? Or could you help me with finding a Website or Discord for it? Sorry, I don't want to steal your Time!!!

Internet? if you found this site you will also find one for java
just have a look here...

Link to comment
Share on other sites

2 hours ago, Heizer said:

Oh ok, I thought it is for Java ok.

Someone missed the board description.

Quote

Modder Support

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.

 

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

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.