0

I am creating a simple crafting block (not using block entities) and ran into some issues. I would like to use the onstep method inherent to the Blocks class to check whether an instanceof ItemEntity has landed on its surface (something dropped an item onto the block). I was thinking of using a map of type Item, Item to map one item into another (as a way to do recipes). For example: Items.STONE, Items.STONE_BRICKS would be implemented by my method as when you drop a stone item onto the block, it changes into a stone_brick item. I am, however, having some issues with using my modded items in the recipes. First of all: yes, the method works with all vanilla items.

The problem occurs when I try to add a modded item (of type ModItems a class that inherits from Items and declares items using a DeferredRegistry) using the syntax ModItems.SILVER_INGOT.get() (the .get() is necessary because the RegistryObject is not technically an item and you must use .get() to access the stored class). When I run the game with this, it says: java.lang.NullPointerException: Registry Object not present: <modId>:silver_ingot. I do import the class ModItems and the Modded Items are declared as public static final so I don't see a reason the class would have trouble finding them.

Any help here is appreciated. If you require any additional information about the project, just ask; I don't really know what is needed to figure out the issue.

3
  • I would like to say before anyone else does: Yes, I know I should be using block entities. I am relatively new to the whole modding scene and decided to try this as an introductory project. Commented Jan 23 at 3:14
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jan 30 at 21:25
  • I don't know what code to add. What do y'all need? yes I know that's a bot Commented Feb 1 at 15:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.