I am learning how to create my first mod. I have followed the first page of the following tutorial up to the Building and Testing Your Mod section: https://docs.minecraftforge.net/en/1.20.x/gettingstarted/
The Config.java class that is bundled in the MDK download uses the ResourceLocation.java class in two locations:
private static boolean validateItemName(final Object obj)
{
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName)); // <-----
}
/* ... */
static void onLoad(final ModConfigEvent event)
{
/* ... */
items = ITEM_STRINGS.get().stream()
.map(itemName -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemName))) // <-----
.collect(Collectors.toSet());
}
However, new ResourceLocation is underlined red on my Intellij IDE, with this popup when hovered on:
'ResourceLocation(java.lang.String, java.lang.String)' has private access in 'net.minecraft.resources.ResourceLocation'
With this being RecourceLocation's constructor
private ResourceLocation(String p_135811_, String p_135812_) {
assert isValidNamespace(p_135811_);
assert isValidPath(p_135812_);
this.namespace = p_135811_;
this.path = p_135812_;
}
In addition, this is the error that pops up while running the build task
error: constructor ResourceLocation in class ResourceLocation cannot be applied to given types;
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName));
^
required: String,String
found: String
What steps would I have to follow to follow to fix this?