Fabric 1.20.1: Getting Compilation Error When Adding Items

Started by Slimebo on

Topic category: Troubleshooting, bugs, and solutions

Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Fabric 1.20.1: Getting Compilation Error When Adding Items
Mon, 03/18/2024 - 16:51 (edited)

So, I'm having an issue with the Fabric plugin for MCreator that no one I've seen is having. When I try to add any item, including tools, a specific function is added to the [Mod Name]ModItems.java file:

private static void registerBlockingProperty(Item item) {
	ItemProperties.register(item, new ResourceLocation("blocking"), ItemProperties.getProperty(Items.SHIELD, new ResourceLocation("blocking")));
}

Now, this line is causing an error upon the compilation of the project:

incompatible types: ItemPropertyFunction cannot be converted to ClampedItemPropertyFunction 

Specifically at this point:

.getProperty(Items.SHIELD, new ResourceLocation("blocking")

I got onto a call with friends who use MCreator, and when they added an item, with the same version of MCreator and the Fabric plugin, they did not have the function causing issues in their code. I tried to lock the element and manually comment out the function causing trouble, but because [Mod Name]ModItems.java is a script shared by all items, not just the element I locked, I can't stop MCreator from overriding it. This problem has been causing me infinite trouble for the last 3 days, and any help would be appreciated. Thank you.

Edited by Slimebo on Mon, 03/18/2024 - 16:51