Jump to content

Probability on spawn


yoshibv

Recommended Posts

My mod is an Among Us mod that spawns crewmates in the world. I'm trying to make the mod choose between spawning the crewmate entity or the impostor entity with a probability of 0.5 each. How would I do that?
I can provide any code of entities or everything you need in order to help me.  :)(Except the things I've tried to make the spawning probability, because I don't have them anymore lol).

Link to comment
Share on other sites

This is not a teach me how to mod forum. It is a support forum.

 

You need to show what you have tried that you think should work.

Preferably with the minimum amount of code on github so we can reproduce your problem.

If we have to waste time asking for that information, we probably won't, instead your question will likely just get ignored unless the problem is obvious from the small amount of information posted.

 

Anyway, the answer to this vague question can probably be found by comparing your code with Zombie.finalizeSpawn() or one of the other vanilla entities that can spawn multiple types?

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

36 minutes ago, warjort said:

If we have to waste time asking for that information, we probably won't, instead your question will likely just get ignored unless the problem is obvious from the small amount of information posted.

If you don't post more concrete information with your question, I am just going to ignore this thread until you do.

I am not going to waste more time making further incorrect guesses about what you are doing (like they were the same entity type) only to give you more incorrect/irrelevant answers.

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Well, I've never said that they were the same entity type...
I have two different entities, Crewmate and Impostor. And I want the Impostor to spawn among the crewmates with a probability (50% for example). That's it. I know how to do the probability thing, but I don't know how to use that probability to spawn them.

Link to comment
Share on other sites

But they are different entity types, otherwise they couldn't be different entities.

https://github.com/yoshibv/Amodgus/blob/356a2b0098112ca73b26131de0765e06ec636c80/src/main/java/es/yoshibv/amodgus/init/MobsInit.java#L18

 

Each spawn group can only have one entity type. I believe this is yours?

https://github.com/yoshibv/Amodgus/blob/356a2b0098112ca73b26131de0765e06ec636c80/src/main/resources/data/amodgus/worldgen/structure/ship.json#LL46C2-L46C2

 

So I guess you have 3 choices. There might be others?

* Make them the same entity type so the same spawn configuration spawns both and randomly select which spawns in finalizeSpawn()

* Make separate spawn configurations for the 2 entity types but that means they won't spawn in the same groups

* Have a "hack" where the Amongus.finalizeSpawn() has a chance to spawn a separate Imposter in its finalizeSpawn() method.

 

You can see something similar in that Zombie.finalizeSpawn() I mentioned before where it spawns a chicken for chicken jockeys.

But I am not sure what consequences it would have if you use finalizeSpawn() to spawn a new entity that the current entity is not riding?

I can't think of any vanilla examples that do something like that. I would guess the main problem is making sure they don't spawn at the same BlockPos?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.