Mining Dimensions [FABRIC]

Mining Dimensions [FABRIC]

857k Downloads

[1.18.1] Piglin brute weird spawning conditions in hunting dimension

EastArctica opened this issue · 11 comments

commented

I noticed some weird piglin brute spawning conditions while in the hunting dimension. Here's a video of what I mean. I believe this may be due to the fact that piglin brute spawning in vanilla minecraft doesn't occur 'randomly' and only occurs while spawning the bastion remnants(Note: I'm getting this from here based off this information "A small number of piglin brutes spawn in bastion remnants only upon generation and in some rooms.") So I believe that since piglin brutes are not meant to spawn 'randomly' they don't have the correct conditions set for their spawn.

Here's a video of flying around a bastion with all brutes set with NoAI and glowing upon spawn.(Note none of them being on the ground)

Overall not really sure but this can be replicated by teleporting to y=300(to prevent mobs spawning on the ground) and creating a layer of blocks.

Edit: If interested, Here's the spawns with NoAI and glowing. Also forgot to mention it but here's a list of my mods

commented

It was unintentional for them to spawn in the air. Seems to be a byproduct of vanilla code. The Hunting Dim was not primarily designed for farms, but for the "on the ground" fighting experience, for which the brutes provide a nice challenge.

I am confident that a clever farm builder like yourself will find a way around the inefficiency if you are so inclined.

Glad to have confirmation about it being a byproduct of vanilla code. The brutes do provide a nice challenge for quite a good reward during the early-mid game but I just couldn't help but let out the farmer inside me haha.

I did some checking in the vanilla code and I do not see any way to control the height of the brute spawning. The dimensions and mobs in the mod are added via daypack, which provides little control for such things.

I don't believe it's an issue with the height, more about the lack of a height check... If I get some time I'll set up the project and see if I can figure anything out 🤷

commented

It is a little odd. So, other than brutes falling from above, what exactly is the problem this creates?

commented

Sorry I might not have been clear or just might be misunderstanding your response. Essentially the brutes are able to spawn in the air without direct sunlight, I presume this isn't on purpose as looking at the code nothing seems to intentionally be causing this. The problem this creates for me is creating a 'passive' farm for these will cause increased inefficiency shown here.(Although they would fall to their death, it forces you to build this at a height that guarantees all falling will die which would have to be extremely high as brutes could spawn with feather falling and could spawn up to 128 blocks below you. Even with them dying it would still cause inefficiencies due to how long the entities will stay within the mobcap and possible spawns being wasted on ones that will die below you.

commented

It was unintentional for them to spawn in the air. Seems to be a byproduct of vanilla code. The Hunting Dim was not primarily designed for farms, but for the "on the ground" fighting experience, for which the brutes provide a nice challenge.

I am confident that a clever farm builder like yourself will find a way around the inefficiency if you are so inclined.

commented

I did some checking in the vanilla code and I do not see any way to control the height of the brute spawning. The dimensions and mobs in the mod are added via daypack, which provides little control for such things.

commented

I'm not quite sure I understand that mixin entirely. Did you write it yourself or grab it from another mod on GitHub?

commented

I'm not sure this is wise, since I believe it world create a restriction for ALL Piglin brutes throughout the game. Which might lead to unexpected results in vanilla and other mods.

If you got this working in a version of Mining Dimensions of your own, enjoy.

I would what a safer approach that confines the effect to my hunting dim only.

commented

I'm checking in with a more experienced mod author to get a second opinion.

commented

After looking into the vanilla code it seems that there is no SpawnRestriction set for the PIGLIN_BRUTE entity in net.minecraft.entity.SpawnRestriction. This causes the SpawnRestriction for brutes to default to NO_RESTRICTIONS. If this were to be fixed here's the mixin I used for testing.

commented

After consulting with a more experienced model, he thinks that it is safe to do. I will add it to v41 of the mod.

Thank you for researching this and providing the mixin. I've been at this 2 years and still have som much to learn.

commented

I'm not quite sure I understand that mixin entirely. Did you write it yourself or grab it from another mod on GitHub?

I wrote something very close to this however my lack of knowledge about mixins(mainly @shadow) and confusion about that static declaration caused me to turn to the internet. Originally I found the method here but whilst trying to find it again I found it here as well.

I'm not sure this is wise, since I believe it world create a restriction for ALL Piglin brutes throughout the game. Which might lead to unexpected results in vanilla and other mods.

If you got this working in a version of Mining Dimensions of your own, enjoy.

I would what a safer approach that confines the effect to my hunting dim only.

Oh my, I had entirely forgot about the affect on other mods! I did test out most cases in vanilla and it seemed to not affect it 🤷🏼‍♂️. I definitely would prefer a way to make it hunting dimension specific though...

After consulting with a more experienced model, he thinks that it is safe to do. I will add it to v41 of the mod.

Thank you for researching this and providing the mixin. I've been at this 2 years and still have som much to learn.

Alright, my other idea for fixing this(and how I found the cause originally) is by adding a mixin to canSpawn in SpawnHelper. However I never found a way with mixins to take in all parameters and modify only one based on the others(In this instance modify location based on entityType) . The only other issue with this is that I was unable to find the dimensions registry key and only managed to get a DimensionType that wasn't very useful. A more experienced developer like you might defyingly be able to do it though.