Jump to content

Entity spawning uncontrollably


Leronus

Recommended Posts

I'm using the biomeLoad event to spawn my duck entity in, but when returning to a biome or standing still in it, the ducks will keep on spawning at the same location on my modded server.

How do I prevent this?

I only want them to spawn once, at the same rate as chickens, near beaches or rivers.

 

GitRepo: https://github.com/Leronus/mOres

Image for reference: https://imgshare.io/image/2021-10-09-182453.pFfbGp

 

Class location: mOres/src/main/java/mod/mores/events/EntityEvent.java

Edited by Leronus
Further explanation
Link to comment
Share on other sites

34 minutes ago, Luis_ST said:

I tried to reproduce your problem, but i can't. The ducks are very rare in Beach and River Biomes and when they spawn there are 2-5 Ducks
the code works how it should

It works in singleplayer yes, but not on a server. That's when they keep spawning over and over.

Link to comment
Share on other sites

1 hour ago, Leronus said:

It works in singleplayer yes, but not on a server. That's when they keep spawning over and over.

for me it works on server and on client, again the code works how it should
with this code:

Spoiler
    @SubscribeEvent
    public static void onBiomeLoad(final BiomeLoadingEvent event){
        if (event.getName() == null){
            return;
        }

        if (Config.duckSpawning.get()) {
            MobSpawnInfoBuilder spawns = event.getSpawns();

            if (event.getCategory().equals(Biome.Category.BEACH) || event.getCategory().equals(Biome.Category.RIVER)) {
                spawns.addSpawn(EntityClassification.WATER_CREATURE, new MobSpawnInfo.Spawners(EntityTypeInit.DUCK.get(), 5, 2, 5));
            }
        }
    }

 


client:
https://ibb.co/Pz4xgjS

server:
https://ibb.co/XtLRTjN


 

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



×
×
  • Create New...

Important Information

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