Jump to content

[1.14.4] Can't change Zombie Pigmen & Wither Skeleton's swords


the_infamous_1

Recommended Posts

I use LivingSpawnEvent.SpecialSpawn to make all armor-able mobs spawn with my mod's armor instead of vanilla armor, same for weapons. The code works perfectly fine for anything that is not a Zombie Pigman or a Wither Skeleton. The current issue with these two mobs is that they will correctly have the modded swords if I spawn them via spawn egg or if they enter the Overworld via portal, but they will not spawn with modded swords in the Nether. I can check via log if a mob has recently spawned naturally and was re-armed in the Nether during the re-arming event and it will say something like "Wither Skeleton at XYZ spawned with Mod Sword" and when I teleport to that mob it will have its vanilla sword and not the modded sword.

Another issue is that overworld mobs will rarely ignore the re-arming event and spawn with vanilla armor, which I don't understand.

Edited by the_infamous_1
Link to comment
Share on other sites

2 hours ago, the_infamous_1 said:

Another issue is that overworld mobs will rarely ignore the re-arming event and spawn with vanilla armor, which I don't understand.

It's hard to see what's wrong when one can't see the thing that is going wrong. Post your code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Class where LivingSpawnEvent.SpecialSpawn is used: https://pastebin.com/08CRXyAm

Zombie Pigman Utilities: https://pastebin.com/F8HEa8qg
Wither Skeleton Utilities: https://pastebin.com/ximpsPcj

 

Note that for the pigmen and wither skeletons I don't use their armor methods, only setHeldItem and setEnchantment.

Edited by the_infamous_1
Link to comment
Share on other sites

4 minutes ago, the_infamous_1 said:

Note that for the pigmen and wither skeletons I don't use their armor methods, only the held item ones.

The equipment for entities is put on the Entity after LivingSpawnEvent.SpecialSpawn is called. Therefore it overrides yours. You should use EntityJoinWorldEvent instead.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I figured that was the case. If I use EntityJoinWorldEvent while keeping everything the same, while it does work 100% for new worlds, I can't load old worlds (stuck at 100% loading screen) and I believe I also can't load back into the new worlds that were just created with EntityJoinWorldEvent (same stuck at 100% issue).

Edited by the_infamous_1
Link to comment
Share on other sites

1 minute ago, the_infamous_1 said:

(same stuck at 100% issue).

Set a breakpoint in your event and see what is happening.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, the_infamous_1 said:

I hate to sound like a noob but how do I run with a breakpoint set (I know how to set one at least) to see what is happening? I'm in IntelliJ

This is the best I can give you for I do not use IntelliJ.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, the_infamous_1 said:

Would all those for loops I have to clear a mob's equipment in the event class potentially cause runtime issues due to having to run the loop for each spawned mob?

Probably. Another problem with using EntityJoinWorldEvent is the equipment on an Entity loaded from disk will have it's equipment changed.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

So while debugging I actually ran a previously created world and actually loaded in (maybe I'm just impatient?) but yeah the for loops were executing constantly and I can see why it would slow down world loading.

When you say an Entity loaded from disk will have it's equipment changed, you mean when I go back into an old world, mobs with modded armor will go through the arming process again? If that's the case then should I just check to see if a mob is at least wearing a single Armor item that is from my mod (so, just check if the boots are modded since that seems to appear for all armored mobs). Likewise, for the Wither Skeletons and Pigmen, just check to see if their mainhand is already modded.

Edited by the_infamous_1
Link to comment
Share on other sites

10 minutes ago, the_infamous_1 said:

If that's the case then should I just check to see if a mob is at least wearing a single Armor item that is from my mod (so, just check if the boots are modded since that seems to appear for all armored mobs). Likewise, for the Wither Skeletons and Pigmen, just check to see if their mainhand is already modded.

That will work if the Entity is guaranteed to have been given your equipment. However, that is not the case. What if another mod changes the equipment or your method determines that it doesn't get an item. You should instead attach a capability to the Entity to check if you have already tried to add your equipment.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, the_infamous_1 said:

I don't exactly know how to do that. Would you mind pointing me in the right direction, if not outright giving me an example?

Here is the forge documentation on Capabilities they are somewhat tricky to learn, but once you know what you need to do you'll be kicking yourself later.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

So I noticed this when debugging and attempting to load a world and failing to do so (before, when I said it was letting me load in, I didn't actually change SpecialSpawn to EntityJoinWorldEvent yet...yeah lol):

I can print to the logger zombie.toString() and get the ZombieEntity from the EntityJoinWorldEvent. I then try to print to the logger event.getWorld().getDifficultyForLocation(zombie.getPosition()).toString(), followed by a print to logger statement of ("Got past the previous line). Neither of those lines print while the world is initially trying to load. I assume that I should not be messing with getting the world or the difficulty if the actual world hasn't even been loaded?

Edited by the_infamous_1
Link to comment
Share on other sites

So, disabling anything in my event class involving local difficulty lets the world actually load, and mobs do spawn with at least their new modded weapons (including Pigmen & Wither Skeletons!).

So I guess I have to re-implement the arming system to work without difficulty as I just ripped it right out of vanilla code, vanilla code is very finnicky.

Edited by the_infamous_1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.