Skip to content

Commit

Permalink
Edited spawn categories to limit natural spawning.
Browse files Browse the repository at this point in the history
  • Loading branch information
LtxProgrammer committed Oct 9, 2024
1 parent ad17a12 commit 35f53b2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ protected static boolean checkSpawnBlock(ServerLevelAccessor world, MobSpawnType
public static <T extends ChangedEntity> boolean checkEntitySpawnRules(EntityType<T> entityType, ServerLevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) {
if (pos.getY() < world.getSeaLevel() - 10)
return false;
if (random.nextFloat() > 0.035f)
if (random.nextFloat() > 0.5f)
return false;
if (!checkSpawnBlock(world, reason, pos))
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static boolean isDeepEnoughToSpawn(LevelAccessor p_32367_, BlockPos p_32
public static <T extends ChangedEntity> boolean checkEntitySpawnRules(EntityType<T> entityType, ServerLevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) {
if (!world.canSeeSkyFromBelowWater(pos))
return false;
if (random.nextFloat() > 0.035f)
if (random.nextFloat() > 0.5f)
return false;

if (!world.getFluidState(pos.below()).is(FluidTags.WATER)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static <T extends ChangedEntity> boolean checkEntitySpawnRules(EntityType
return false;
if (pos.getY() > world.getSeaLevel() - 10)
return false;
if (random.nextFloat() > 0.035f)
if (random.nextFloat() > 0.5f)
return false;
if (!checkSpawnBlock(world, reason, pos))
return false;
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/net/ltxprogrammer/changed/init/ChangedEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexSquirrel::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexSquirrel::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexMantaRayFemale>> LATEX_MANTA_RAY_FEMALE = registerSpawning("latex_manta_ray_female", 0x6f7696, 0xd2d9e1,
EntityType.Builder.of(LatexMantaRayFemale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.58625F),
EntityType.Builder.of(LatexMantaRayFemale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.58625F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexMantaRayFemale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexMantaRayMale>> LATEX_MANTA_RAY_MALE = registerSpawning("latex_manta_ray_male", 0x6f7696, 0xd2d9e1,
EntityType.Builder.of(LatexMantaRayMale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
EntityType.Builder.of(LatexMantaRayMale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexMantaRayMale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexMedusaCat>> LATEX_MEDUSA_CAT = registerSpawning("latex_medusa_cat", 0xFFDB4F, 0xF398B7,
EntityType.Builder.of(LatexMedusaCat::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -203,7 +203,7 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexMingCat::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexMingCat::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexMermaidShark>> LATEX_MERMAID_SHARK = registerSpawning("latex_mermaid_shark", 0x969696, 0xFFFFFF,
EntityType.Builder.of(LatexMermaidShark::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.58625F),
EntityType.Builder.of(LatexMermaidShark::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.58625F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexMermaidShark::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexMoth>> LATEX_MOTH = registerSpawning("latex_moth", 0xFBE5BC, 0xD8BC99,
EntityType.Builder.of(LatexMoth::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -212,7 +212,7 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexMutantBloodcellWolf::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexMutantBloodcellWolf::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexSiren>> LATEX_SIREN = registerSpawning("latex_siren", 0x969696, 0xFFFFFF,
EntityType.Builder.of(LatexSiren::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.58625F),
EntityType.Builder.of(LatexSiren::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.58625F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexSiren::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexSnake>> LATEX_SNAKE = registerSpawning("latex_snake", 0xFFFFFF, 0x7E7E7E,
EntityType.Builder.of(LatexSnake::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -239,13 +239,13 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexRedPanda::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexRedPanda::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexShark>> LATEX_SHARK = registerSpawning("latex_shark", 0x969696, 0xFFFFFF,
EntityType.Builder.of(LatexShark::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
EntityType.Builder.of(LatexShark::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexShark::checkEntitySpawnRules);
public static final RegistryObject<EntityType<BuffLatexSharkMale>> LATEX_SHARK_MALE = registerSpawning("latex_shark_male", 0x969696, 0xFFFFFF,
EntityType.Builder.of(BuffLatexSharkMale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.8F, 2.2F),
EntityType.Builder.of(BuffLatexSharkMale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.8F, 2.2F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, BuffLatexSharkMale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<BuffLatexSharkFemale>> LATEX_SHARK_FEMALE = registerSpawning("latex_shark_female", 0x969696, 0xFFFFFF,
EntityType.Builder.of(BuffLatexSharkFemale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.8F, 2.25F),
EntityType.Builder.of(BuffLatexSharkFemale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.8F, 2.25F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, BuffLatexSharkFemale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<SniperDog>> SNIPER_DOG = registerSpawning("sniper_dog", 0xEF8F44, 0x894633,
EntityType.Builder.of(SniperDog::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -260,16 +260,16 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexSnowLeopardFemale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexSnowLeopardFemale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexSquidDogFemale>> LATEX_SQUID_DOG_FEMALE = registerSpawning("latex_squid_dog_female", 0xFFFFFF, 0x0,
EntityType.Builder.of(LatexSquidDogFemale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.8F, 2.1F),
EntityType.Builder.of(LatexSquidDogFemale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.8F, 2.1F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexSquidDogFemale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexSquidDogMale>> LATEX_SQUID_DOG_MALE = registerSpawning("latex_squid_dog_male", 0xFFFFFF, 0x0,
EntityType.Builder.of(LatexSquidDogMale::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.8F, 2.1F),
EntityType.Builder.of(LatexSquidDogMale::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.8F, 2.1F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexSquidDogMale::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexStiger>> LATEX_STIGER = registerSpawning("latex_stiger", 0x7b4251, 0xe0cfd9,
EntityType.Builder.of(LatexStiger::new, ChangedMobCategories.UNDERGROUND).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexStiger::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexTigerShark>> LATEX_TIGER_SHARK = registerSpawning("latex_tiger_shark", 0x969696, 0x0,
EntityType.Builder.of(LatexTigerShark::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
EntityType.Builder.of(LatexTigerShark::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexTigerShark::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexTrafficConeDragon>> LATEX_TRAFFIC_CONE_DRAGON = registerSpawning("latex_traffic_cone_dragon", 0xFFD201, 0x0,
EntityType.Builder.of(LatexTrafficConeDragon::new, ChangedMobCategories.UNDERGROUND).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -278,7 +278,7 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(LatexTranslucentLizard::new, ChangedMobCategories.UNDERGROUND).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, LatexTranslucentLizard::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexOrca>> LATEX_ORCA = registerSpawning("latex_orca", 0x393939, 0xFFFFFF,
EntityType.Builder.of(LatexOrca::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
EntityType.Builder.of(LatexOrca::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.7F, 1.93F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, LatexOrca::checkEntitySpawnRules);
public static final RegistryObject<EntityType<LatexOtter>> LATEX_OTTER = registerSpawning("latex_otter", 0x5D4743, 0xB6957C,
EntityType.Builder.of(LatexOtter::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand All @@ -296,7 +296,7 @@ public static boolean anyDimension(DimensionType dimensionType) {
EntityType.Builder.of(MilkPudding::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.6F, 0.5F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.ON_GROUND, MilkPudding::checkEntitySpawnRules);
public static final RegistryObject<EntityType<Shark>> SHARK = registerSpawning("shark", 0x969696, 0xFFFFFF,
EntityType.Builder.of(Shark::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.9F, 0.6F),
EntityType.Builder.of(Shark::new, ChangedMobCategories.AQUATIC).clientTrackingRange(10).sized(0.9F, 0.6F),
ChangedEntities::overworldOnly, SpawnPlacements.Type.IN_WATER, Shark::checkEntitySpawnRules);
public static final RegistryObject<EntityType<PureWhiteLatexWolf>> PURE_WHITE_LATEX_WOLF = registerSpawning("pure_white_latex_wolf", 0xFFFFFF, 0xFAFAFA,
EntityType.Builder.of(PureWhiteLatexWolf::new, ChangedMobCategories.CHANGED).clientTrackingRange(10).sized(0.7F, 1.93F),
Expand Down Expand Up @@ -501,18 +501,18 @@ public static void addSpawners(BiomeLoadingEvent event) { // Inject spawns into
/* Water spawning entities */

if (event.getCategory() == Biome.BiomeCategory.OCEAN || event.getCategory() == Biome.BiomeCategory.RIVER) {
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_MANTA_RAY_MALE, 30, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_MANTA_RAY_FEMALE, 30, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_MERMAID_SHARK, 20, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SIREN, 20, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SHARK, 100, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SHARK_MALE, 30, 1, 3, 0.7, 0.5);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SHARK_FEMALE, 30, 1, 3, 0.7, 0.5);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_TIGER_SHARK, 20, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_ORCA, 80, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SQUID_DOG_MALE, 80, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, LATEX_SQUID_DOG_FEMALE, 80, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.CHANGED, SHARK, 100, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_MANTA_RAY_MALE, 30, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_MANTA_RAY_FEMALE, 30, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_MERMAID_SHARK, 20, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SIREN, 20, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SHARK, 100, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SHARK_MALE, 30, 1, 3, 0.7, 0.5);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SHARK_FEMALE, 30, 1, 3, 0.7, 0.5);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_TIGER_SHARK, 20, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_ORCA, 80, 1, 3, 0.7, 0.15);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SQUID_DOG_MALE, 80, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, LATEX_SQUID_DOG_FEMALE, 80, 1, 3, 0.7, 0.35);
ChangedBiomeInterface.addSpawn(spawns, ChangedMobCategories.AQUATIC, SHARK, 100, 1, 3, 0.7, 0.15);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

public class ChangedMobCategories {
public static final MobCategory CHANGED = MobCategory.create("CHANGED",
Changed.modResourceStr("changed"), 40, false, false, 128);
Changed.modResourceStr("changed"), 10, false, false, 128);
public static final MobCategory UNDERGROUND = MobCategory.create("CHANGED_UNDERGROUND",
Changed.modResourceStr("underground"), 20, false, false, 128);
Changed.modResourceStr("underground"), 5, false, false, 128);
public static final MobCategory AQUATIC = MobCategory.create("CHANGED_AQUATIC",
Changed.modResourceStr("aquatic"), 5, false, false, 128);
}

0 comments on commit 35f53b2

Please sign in to comment.