Topic category: Help with Minecraft modding (Java Edition)
I was trying to add a potion effect to my sword when I hit an entity, but I coudn't find a way when I create my sword from a tool mod.
So I tried creating an item, since there's the possibility to make a sword from there (or it seems to be), just as mcreator says, putting 1.5 in type of tool box.
So, now I got my poisonous sword, but the problem is that it's NOT a sword...
It's just an item (1 of damage, no attack cooldown and all the things a sword has) that give poison status to enetity that hits :/
So I'd like to know if there's a way to get a real sword from an item mod adding some codes (I tried mixing up with a "tool sword", but if I do not get errors, I get again the normal tool sword with no poison effect).
If not, I'd like to know if there's the possibility to get an enchanted item "by default" (without the needing of a recipe)
Hmm, tricky.
There're two ways of copying another item that I can think of. The first, using Forge you can find the item in the file directory(it's in MrCrayFishes tutorial), the other, is a shady method(I don't recommend it), using a Java decompiler, you could browse through mods, meaning you could see how other people have done it. I don't actually have much experience with Java. So I can't really help you there :(
Thanks,
~Coolq.
@#1 Yeah it's tricky but it's the only way I found to get a "sword" without cooldown without having haste, since all the code about attribute modifier doesn't work (surely I don't know how to make them work) and yeah, I've alredy took a look to sword class etc. and other mods, but mods uses outdated method or not compatible methods.
At least I can make an item with sharpness 19 to get an item with 10 of attack damage x)
Okay, good luck!
You could definitely do it with Java, though. I hope that you can get it working :)
UPDATE:
try this:
goto: global events -> when player hits entity -> in spesifics cases (item in hand = your sword) -> add potion efect and sellect potion effect
Taken from: https://mcreator.pylo.co/forum/30006/sword-effects
Credit goes to: mc_Dandy
@#3 That would give the potion effect to me unfortunatly.
But I "solved" this with a little trick using axe instead ;)
@#3.1 Ah ok, If you need any help! Just ask :)