Jump to content

Announcements



  • Posts

    • Can you post your ModBlocks class where you've registered the block, as well as which version of Minecraft you are using?
    • It looks like you're trying to pass the lemon juice item itself to the .food method in your first code snippet; that won't work. The parameter to the .food method needs to be a FoodProperties object, as the error says. The second way you're doing it there is much closer to how it should be. The problem there is that you're trying to access the LEMON_JUICE field of the vanilla FoodProperties class. This won't work because the vanilla food properties class does not have LEMON_JUICE information in it. You'll need to make your own ModFoods class, looking something like the vanilla Foods class. Here's an example: public class ModFoods { public static final FoodProperties LEMON_JUICE = (new FoodProperties.Builder()).nutrition(3).saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.5f).build(); } Then, your completed item registration would be: public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE))); Notice that I changed the FoodProperties to ModFoods, since that's the class where you'd be storing the food data.
    • For some reason it did not produce a crash log so here is the loading log. Version: 1.20.1 Forge - 47.2.0 https://paste.ee/p/MkmQt#s=0  
    • I have corrected the code as you have written it, though there have been errors present in the ModItems class when I have registered the item. (These have been present before but I forgot to mention them 🤦‍♂️).  public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModItems.LEMON_JUICE))); The first error occurs with the ModItems.LEMON_JUICE, the message is as follows: 'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)'   public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(FoodProperties.LEMON_JUICE))); The second error occurs with the FoodProperties.LEMON_JUICE, saying: Cannot resolve symbol 'LEMON_JUICE' This should be all that is left to do to finally fix all these errors that has been going on for two weeks now surprisingly. 
    • Made a block, copies exactly the soul campfire. But when I start Minecraft, it starts, and right before it goes into full screen, it errors out. That's when I get 2 of these: Caused by: java.lang.IllegalArgumentException: Cannot get property BooleanProperty{name=lit, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in Block{minecraft:air} And 2 of these: Caused by: java.lang.NullPointerException: Registry Object not present: revive:block_campfire   Thanks!
  • Topics

×
×
  • Create New...

Important Information

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