Started by
Drexel20
on
Topic category: Help with Minecraft modding (Java Edition)
I'm a new modder, and I'm making a mod that includes a new type of golden armor, and I want to make it so that when the player wears the armor, piglins become passive, I don't know how, I don't know if that's possible, please help
Sorry for my bad English
Gonna bump this question, it seems like a pretty core feature to make mobs peaceful with armor on, so a Procedure using the new functionality would be appreciated.
I know it's not proper solution, but you can use command giving effect to a certain radius while wearing the armour, and make procedure adding all entities under that effect to specific scoreboard team (and removing them when effect ends). Scoreboard teams make all entities within it being peaceful to themselves (including even creepers not exploding), so it's useful workaround for all not-coded changes of behaviours.
Very nice and simple workaround!
How do you make that effect only target Piglins? I have made it so currently EVERYTHING within the radius gets set to the same team as the wearer with
(I'm new to MCreator but not new to coding)
I figured it out eventually, but sadly I must confirm this workaround doesn't actually work. I thought I just messed up the Procedures my gear, but as it turns out being on the same teams as Piglins without gold on DOESN'T stop them from attacking you IN 1.16.5
In 1.17, being on the same team as Piglins and Brutes DOES stop them from attacking you, but NOT any version before.
Tested in Vanilla 1.16.5 by just manually adding Piglins and myself to a team through commands to make sure.
Oh, that's interesting. I will try to test that myself I guess (was thinking about golden chainmail armour, so I have a reason for similar feature), but if it is as you say, then it's weird, considering there was no official bugs/fixes on that part, as far as I remember.
At least we know how to deal with that for 1.17, though ^^
Actually there was an official bug listing which did get (partially) fixed in 1.17 https://bugs.mojang.com/browse/MC-172304
That's how I knew I wasn't crazy after my testing lol
Your workaround would have been perfect, and it works great for something like a "Necromancer Chestplate" that would make Zombies or whatever passive, but it doesn't work for Piglins of all things.
I guess we need an MCreator update that natively supports the function MC uses to pacify Piglins with Gold, considering how useful that feature is; otherwise it's just raw code only.
Oh, so I wasn't aware of that, thanks for the link. To be honest, when 1.16 was released, I rather watched HermitCraft than used MCreator, haha.
And yeah, I plan to use that scoreboard solution for several similar features, considering I'm working on magic mod now and this can come in handy ^^ but I will try to find other (non-code-related) solutions for Piglins anyway, since we all three need that. So if I find anything, I will let us know here.
yes this
Agreed- as far as I can tell, there's no good workaround for this. Usually I'd expect to find a tag or something that could just be modified, but it seems like this is just hard-coded.
...Looked into it a bit more. It is possible to make an item neutralize piglins using Forge, (goodness knows there's plenty of mods that do just that.) However, since there's no tag for it, I'd assume you'd have to use some sort of custom code element. Specifically, this is the section of code I found that I assume neutralizes piglins, for the 'Gilded Netherite' mod:
On a (possibly easier) note, I also found an API that adds some Piglin tags, though I'm not sure if it supports Forge or not. (Wasn't entirely clear in the description.)
Piglib - Mods - Minecraft - CurseForge
...I'm betting if you lock the code for each item and input the 'makesPiglinsNeutral' property, it might just work. Haven't tested it though.
OH MY GOSH I FIGURED IT OUT. It took, like, an hour, but I came up with a method that works:
...And that should do it! Any armor made in this fashion will neutralizes piglins when worn, with the same properties as regular gold armor.