gnembon / fabric-carpet

Fabric Carpet
MIT License
1.65k stars 261 forks source link

Fix piglin brutes spawning in air #1769

Closed aria1th closed 11 months ago

aria1th commented 11 months ago

Fixes https://github.com/gnembon/fabric-carpet/issues/1546

The core cause was Piglin Brutes not having spawn condition, allowing it to pass every check except 'damage'.

This patch registers spawn condition check for piglin brutes.

This does not mean they will spawn in overworld / elsewhere, since spawn requires mob list entry first.

altrisi commented 11 months ago

No rule checks there, does this affect vanilla behaviour? Or does this only run with the rule on?

Also throw something (like new AssertionError) on static shadows please (unless I'm confusing them with something else).

aria1th commented 11 months ago

@altrisi for normal cases, it should not be affected, but there might be some cases that could be inconsistent

  1. If some mods are already trying to make piglin brutes naturally spawnable then 😨
  2. Initial Structure mob spawns could be affected by this. (if it uses same SpawnPlacements, it means it was already spawning in air which can make newly generated piglin brutes far less than before).

I'll do some check in 24 hours.

aria1th commented 11 months ago

Some inspections: to NOT register static value and prevent some exceptions, instead of current code, the code should be modified as:

inject getHeightmapType, checkSpawnRules function instead.

aria1th commented 11 months ago

This was the minimal change required to prevent piglin brutes spawning in air - but it may prevent some new chunk piglin brute generation... but rule itself is already changing the behavior so it shouldn't matter, right? @altrisi

altrisi commented 11 months ago

As long as it only affects behaviour when the rule is on, and with it on it doesn't like severely like reduce base structure spawns (changes significantly "how it feels" (?) going normally through a bastion) or something it's fine for me.