-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote entity spawning logic to now specify entities for biomes.
- Loading branch information
1 parent
d88ef2e
commit 1e5bdf7
Showing
17 changed files
with
534 additions
and
427 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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/net/ltxprogrammer/changed/entity/beast/AbstractCaveEntity.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,29 @@ | ||
package net.ltxprogrammer.changed.entity.beast; | ||
|
||
import net.ltxprogrammer.changed.entity.ChangedEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.Difficulty; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.entity.MobSpawnType; | ||
import net.minecraft.world.entity.monster.Monster; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.ServerLevelAccessor; | ||
|
||
import java.util.Random; | ||
|
||
public abstract class AbstractCaveEntity extends ChangedEntity { | ||
public AbstractCaveEntity(EntityType<? extends ChangedEntity> type, Level level) { | ||
super(type, level); | ||
} | ||
|
||
public static <T extends ChangedEntity> boolean checkEntitySpawnRules(EntityType<T> entityType, ServerLevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) { | ||
if (!isDarkEnoughToSpawn(world, pos, random)) | ||
return false; | ||
if (pos.getY() > world.getSeaLevel() - 10) | ||
return false; | ||
if (random.nextFloat() < 0.75f) | ||
return false; | ||
return Monster.checkAnyLightMonsterSpawnRules(entityType, world, reason, pos, random); | ||
} | ||
} |
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
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
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
Oops, something went wrong.