-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor mob spawning checks and improve spatial query
- Loading branch information
1 parent
b1309ef
commit eb763b2
Showing
19 changed files
with
287 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 19 additions & 19 deletions
38
src/main/java/com/github/elenterius/biomancy/event/MobSpawnHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/github/elenterius/biomancy/world/MobSpawnFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.elenterius.biomancy.world; | ||
|
||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.entity.MobSpawnType; | ||
import net.minecraft.world.level.LevelAccessor; | ||
|
||
import java.util.Set; | ||
|
||
public interface MobSpawnFilter { | ||
|
||
Set<MobSpawnType> NATURAL_SPAWN_REASON = Set.of( | ||
MobSpawnType.EVENT, | ||
MobSpawnType.NATURAL, | ||
MobSpawnType.CHUNK_GENERATION, | ||
MobSpawnType.PATROL | ||
); | ||
|
||
static boolean isNaturalSpawn(MobSpawnType spawnReason) { | ||
return NATURAL_SPAWN_REASON.contains(spawnReason); | ||
} | ||
|
||
/** | ||
* At the moment only checks natural mob spawns | ||
*/ | ||
boolean isMobAllowedToSpawn(Mob mob, MobSpawnType spawnReason, LevelAccessor level, double x, double y, double z); | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/com/github/elenterius/biomancy/world/mound/ChambersGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/elenterius/biomancy/world/mound/MoundChamber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/main/java/com/github/elenterius/biomancy/world/mound/MoundGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 0 additions & 66 deletions
66
src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialBoundingBox.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.