Topic category: Help with Minecraft modding (Java Edition)
I opened bug #872 "Armor enchantments cause severe lag" (https://github.com/MCreator/MCreator/issues/872) and after their inability to fix the bug they decided to close it and send me here.
To give some background, the plan was to make a simple mod that added armor and weapons buff enough for players to stand a chance against the dragons in the mods "Ice and Fire" and "WyrmRoost." My thinking was something along the lines of the Ultimate Armor from Orespawn (back in the 1.7.10 days). This armor was enchanted with Protection, Blast Protection, Fire Protection and Projectile Protection, less than the total number of enchantments that Ultimate Armor had.
It doesn't matter what level the enchantments are at: 3, 5, 10, 15, or 20, the end result is always UNPLAYABLE Lag.
Please see video at the link: https://youtu.be/PfbDYtuXkMw
My event trigger components can be seen at: https://user-images.githubusercontent.com/48491179/106971066-00263980-6…
I believe this is a bug. KlemenDEV disagrees. Whatever it is, I ask for your help in solving it.
Thanks in advance,
M
If you do any complicated stuff in any tick update, there will be lag, there is no way around this.
As I pointed out, back in 1.7.10 Orespawn had an armor set called Ultimate Armor that had 2 more enchantments than what I'm attempting and it suffered no lag. We still play 1.7.10 to day because of Orespawn.
I removed half of the enchantments (Blast and Projectile Projection) and still suffer the lag.
Here is the Orespawn Ultimate Armor enchantments for comparison: https://user-images.githubusercontent.com/48491179/106961948-2c39be80-6…
The armor set I'm trying to create in MCreator has two (2) enchantments: Protection and Fire Protection and still lags the game out horribly.
So Klemen, Is there some reason why he could do this without lag in 1.7.10 that is fundamentally different than MC 1.16.4?
If you want to add it to armor, you have to add an "In inventory tick" procedure by code.
Luis, this post, and this forum, are about using MCreator software.
wait... what? did you just make a procedure that uses a global trigger of "when item is crafted", and you put that procedure in your adamant armor pieces' tick event, that gets executed EACH TICK? I believe Klemen was right in saying that what you were doing is complicated: the game might be having a hard time dealing with all that enchanting stuff happening each tick, it's just inappropriate, given that trigger, I guess.
try making 4 global procedures with the same global trigger "item is crafted". basically, the same procedure as the one that you showed in https://user-images.githubusercontent.com/48491179/106971066-00263980-6703-11eb-9690-70a95dc6abfd.png. but just change each one to the proper armor items (e.g. one procedure for when your helmet is crafted, one for chestplate,...), then apply the enchantments you wanna apply to the crafted armor item.
tl;dr: the reason your game's lagging might be because you used a procedure with a global trigger on your armor's tick update. try fixing this just as I've aforementioned if that's the case.
Sajevius, the structure used at the image link is what I was instructed to do by Klemen, although his original instruction had the "provided itemstack" component replaced with an empty one.
Conceptually, I think I understand what you're saying (change the global procedure "when item is crafted" so that it's not in a tick event) -- just not sure that I know *where* to put that new global procedure in MCreator.
I'll try hitting the green "+" and select procedure and name it "AdamantHelmetWhenCreated," and use the same procedure/component structure, then do the same for the other three armor pieces.
How do I "attach it" in MCreator so that it functions properly in game?
Thanks in advance,
M
I tried it as spoken above -- success! No lag! It seems that MCreator's default of putting enchantments in the tick event is what was causing the issue.
When the items are pulled out of creative, they seem to lack enchantments. Enchantments are had when crafted in survival/hardcore.
Thank you! You are awesome!
thanks for the compliment! and you're welcome :)
now, go forth and beat those IaF & WyrmRoost dragons!
Sajevius, a final request please: In creative mode their are no enchantments on the armor. While filming our test of the mod, I (in creative mode) couldn't give my son (he was in survvial mode) the enchanted armor. I had to give him the ingots and let him craft a set to get the enchantments. Is there any way to fix this in MCreator?
An easy (yet a bit tedious) solution for that is to make another procedure w/ a global trigger of "Entity picks up item". the only problem, though, is that if you directly get the armor pieces from their respective creative tab, they won't get any enchantment/s. you would need to drop the armor pieces from your inventory first, and when you pick them up, they'll get the enchantments you specified.
(note that I had to split the procedure into 4, as they would not fit in a single screenshot when combined in a single procedure. I made other procedures like this for the chest, legs, and boots while I was testing this, but in reality, you can combine them all into a single procedure)
idk... this is the only solution I found, but I hope you're ok with that
Thank you