Posted July 20, 20205 yr package com.yunus.sinif.util; import com.yunus.sinif.DenemeMod; import com.yunus.sinif.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 RegistryHandler { private static final String MOD_ID = DenemeMod.MOD_ID; public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, "dp"); public static void init(){ ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new); } public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, "dp"); but this line returns me an error. I dont know what is error just new DeferredRegister<> strikethrough can you help me? discord: Даяк Ыаде#3511
July 20, 20205 yr 21 minutes ago, Yunus Emre said: but this line returns me an error. I dont know what is error just new DeferredRegister<> strikethrough A warning is not an error. An error is an error. It's letting you know that this method of calling the constructor is deprecated and should be replaced with DeferredRegister::create. However, you could of found this out by hovering over the strike-through.
July 20, 20205 yr Author 5 minutes ago, ChampionAsh5357 said: A warning is not an error. An error is an error. It's letting you know that this method of calling the constructor is deprecated and should be replaced with DeferredRegister::create. However, you could of found this out by hovering over the strike-through. C:\Users\Pc\Desktop\1.15.2 mod from yunus\src\main\java\com\yunus\sinif\util\RegistryHandler.java:15: error: '(' or '[' expected public static final DeferredRegister<Item> ITEMS = new DeferredRegister::create(ForgeRegistries.ITEMS, MOD_ID); ^
July 20, 20205 yr 3 minutes ago, Yunus Emre said: new DeferredRegister::create I need a facepalm emoji so badly. I use the double colon operator to specify the location of a function. Let's break down what you wrote. First, you tried calling a static method using the double colon operator. Please learn some basic java and don't just follow some youtube tutorial. If you want a hint, a dot helps. Second, you called new on a method. You can only call new on constructors to create objects. A method is not a constructor. In this case, DeferredRegister::create is a static method for a constructor initialization circumventing the new operator (its called inside). And the easiest way you could've found this out is by reading the docs.
July 20, 20205 yr Author 2 minutes ago, ChampionAsh5357 said: I need a facepalm emoji so badly. I use the double colon operator to specify the location of a function. Let's break down what you wrote. First, you tried calling a static method using the double colon operator. Please learn some basic java and don't just follow some youtube tutorial. If you want a hint, a dot helps. Second, you called new on a method. You can only call new on constructors to create objects. A method is not a constructor. In this case, DeferredRegister::create is a static method for a constructor initialization circumventing the new operator (its called inside). And the easiest way you could've found this out is by reading the docs. I am watching this video:
July 20, 20205 yr Just now, Yunus Emre said: I am watching this video: I feel like you just ignored what I wrote. Go back and reread. Don't show me some youtube video. As a person who makes videos on youtube, its terrible most of the time, including my own.
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.