Solved Wolf and Iron Golem spawners FPS drop

Discussion in 'Spigot Plugin Development' started by beccar_mt, Jun 18, 2021.

  1. I made a plugin that changes the type of placed spawners, but when the type is changed to a Wolf or Iron Golem, the FPS drops to oblivion. Heres a demonstration (watch the FPS on the top left):



    The one thing i noticed between these two types of spawners is that neither of them have the little spinny mob inside the spawner, so this makes me think that this is a minecraft bug maybe?

    The code i used to set the spawner type:

    Code (Java):
    BlockState blockState = block.getState();
    CreatureSpawner spawner = (CreatureSpawner) blockState;
    spawner.setSpawnedType(entityType);
    blockState.update();
     
  2. Maybe it´s because irongolems and wolfs aren´t creatures so they can´t be spawned by a creature spawner (I didn´t check this so it might be wrong)
     
  3. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Creature.html
    They definetly are, but i used the EntityType anyway, and that also contains wolfs and iron golems.

    Edit: Just to clarify, the spawner actually works and mobs spawn from it, the only problems is this FPS drop
     
    #3 beccar_mt, Jun 18, 2021
    Last edited: Jun 18, 2021
  4. Maybe because of the particles ? Your computer just seems to be very bad honestly.
     
  5. Did you even watch the video or read his messages?
     
  6. Dropping FPS is a computer problem
     
  7. After testing this myself it does seem this might be a minecraft bug, spawners that do not show the little mob inside of them cause your FPS to drop, in my case it dropped from 300 to 230 but with a mob spawner that has the entity inside of it there was no FPS drop.


    Just tested this in 1.17 and the issue seems to be fixed in that version.
     
    #8 Bobcatsss, Jun 19, 2021
    Last edited: Jun 19, 2021
    • Informative Informative x 1
  8. Of course he didn't, he just wants to feel a little special.
     
  9. Did you even watch the video I provided? I get 500-600 FPS normally and the FPS only drops with wolf's and iron golems. How is this mY CoMPuTeR tHaT SEemS VeRy bAd my guy?
     
  10. My god we have a Sherlock here...
     
  11. Do you ever summon particles or something like that?
     
  12. Lol I didn't realize 1.17 was out already, I'll test there to see what happens.
     
  13. iT's tThE ParTiCleS (now with shaders)
     
  14. I tested in 1.17 and unfortunately, it's fixed. Guess no wolfs and iron golems for 1.16 then :/
     
  15. I think you're just sending too many particles. Can you send us more code, especially where you spawn the particles? Maybe 1.17 (fixed) this by limiting particle packets or something. I doubt its a bug from Minecraft itself.
     
  16. Jesus Christ... Its not the particles... I already tried testing this completly without the particles and i get the exact same result. I sent the video with particles because it was the state the plugin was in and i had already ruled that out. The fact that it only happens with two of the spawners already shows that it is not a problem with the particles.
     
    • Agree Agree x 1
  17. Again look at the video.

    I completely get why OP is so frustrated. He has 500 fps when doing it with a chicken or pig but with wolfs and iron golems it goes down to 15 fps. It's a bug in at least 1.16.5, maybe optifine, but it's not his code. Stop guessing dumb things that are ruled out.

    It seems to be an issue in 1.16 https://www.reddit.com/r/MinecraftHelp/comments/hzp5cn/java_massive_lag_in_proximity_of_iron_golem/

    The only way to fix it is to disable them or replace the entity inside with something that is renderable. It will break for the following:
    - Bee
    - Enderman
    - Iron golem
    - Polar bear
    - Wolf
    - Zombified piglin
     
    • Winner Winner x 1
  18. Well that's a shame. Was hoping there was something i could do besides just removing the option for the spawner

    Edit for future reference - Turns out there is something that can be done: https://www.spigotmc.org/resources/mobspawnerfpslagfix.85357/ Would have been nice if Spigot had implemented this in the server jar, but oh well
     
    #20 beccar_mt, Jun 19, 2021
    Last edited: Jun 19, 2021