Posted June 6Jun 6 I've just started modding, and I'm trying to make custom swords. When I try to import SwordItem, I get the error: Quote The import net.minecraft.world.item.SwordItem cannot be resolvedJava(268435846) What confuses me is that other item classes work fine: package io.github.xxx.denseswords.item; import io.github.xxx.denseswords.DenseSwords; import net.minecraft.world.item.Item; // works fine import net.minecraft.world.item.ShovelItem; // works fine import net.minecraft.world.item.SwordItem; // Error: The import cannot be resolved import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; Forge MDK v55.0.15 - Minecraft 1.21.5 Java v24.0.1 Windows 11 IDE: Visual Studio Code
1 hour ago1 hr The SwordItem class doesn't exist in newer versions, Mojang moved the sword functionality to Data Components. Look at the sword registrations in the Items class for examples of this. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.