@@ -843,16 +843,17 @@ public class ${name}Entity extends ${extendsClass}Entity <#if interfaces?size gt
843843 <#if data.mobSpawningType == "creature" >
844844 EntitySpawnPlacementRegistry.register(${JavaModName} Entities.${REGISTRYNAME} .get(),
845845 EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
846- <#if hasProcedure(data.spawningCondition) >
846+ <#if hasProcedure(data.spawningCondition) >
847847 (entityType, world, reason, pos, random) -> {
848848 int x = pos.getX();
849849 int y = pos.getY();
850850 int z = pos.getZ();
851851 return <@procedureOBJToConditionCode data.spawningCondition/ >;
852852 }
853- <#else >
854- (entityType, world, reason, pos, random) -> (world.getBlockState(pos.down()).getMaterial() == Material.ORGANIC && world.getLightSubtracted(pos, 0) > 8)
855- </#if >
853+ <#else >
854+ (entityType, world, reason, pos, random) ->
855+ (world.getBlockState(pos.down()).getMaterial() == Material.ORGANIC && world.getLightSubtracted(pos, 0) > 8)
856+ </#if >
856857 );
857858 <#elseif data.mobSpawningType == "ambient" || data.mobSpawningType == "misc" >
858859 EntitySpawnPlacementRegistry.register(${JavaModName} Entities.${REGISTRYNAME} .get(),
@@ -868,7 +869,7 @@ public class ${name}Entity extends ${extendsClass}Entity <#if interfaces?size gt
868869 MobEntity::canSpawnOn
869870 </#if >
870871 );
871- <#elseif data.mobSpawningType == "waterCreature" || data.mobSpawningType == "waterAmbient" || data.mobSpawningType == "undergroundWaterCreature" >
872+ <#elseif data.mobSpawningType == "waterCreature" || data.mobSpawningType == "waterAmbient" >
872873 EntitySpawnPlacementRegistry.register(${JavaModName} Entities.${REGISTRYNAME} .get(),
873874 EntitySpawnPlacementRegistry.PlacementType.IN_WATER, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
874875 <#if hasProcedure(data.spawningCondition) >
@@ -883,6 +884,22 @@ public class ${name}Entity extends ${extendsClass}Entity <#if interfaces?size gt
883884 (world.getBlockState(pos).matchesBlock(Blocks.WATER) && world.getBlockState(pos.up()).matchesBlock(Blocks.WATER))
884885 </#if >
885886 );
887+ <#elseif data.mobSpawningType == "undergroundWaterCreature" >
888+ EntitySpawnPlacementRegistry.register(${JavaModName} Entities.${REGISTRYNAME} .get(),
889+ EntitySpawnPlacementRegistry.PlacementType.IN_WATER, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
890+ <#if hasProcedure(data.spawningCondition) >
891+ (entityType, world, reason, pos, random) -> {
892+ int x = pos.getX();
893+ int y = pos.getY();
894+ int z = pos.getZ();
895+ return <@procedureOBJToConditionCode data.spawningCondition/ >;
896+ }
897+ <#else >
898+ (entityType, world, reason, pos, random) -> {
899+ return world.getFluidState(pos.down()).isIn(FluidTags.WATER) && world.getBlockState(pos.up()).isIn(Blocks.WATER) && pos.getY() >= (world.getSeaLevel() - 13) && pos.getY() <= world.getSeaLevel();
900+ }
901+ </#if >
902+ );
886903 <#else >
887904 EntitySpawnPlacementRegistry.register(${JavaModName} Entities.${REGISTRYNAME} .get(),
888905 EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
@@ -894,7 +911,7 @@ public class ${name}Entity extends ${extendsClass}Entity <#if interfaces?size gt
894911 return <@procedureOBJToConditionCode data.spawningCondition/ >;
895912 }
896913 <#else >
897- (entityType, world, reason, pos, random) ->
914+ (entityType, world, reason, pos, random) ->
898915 (world.getDifficulty() != Difficulty.PEACEFUL && MonsterEntity.isValidLightLevel(world, pos, random)
899916 && MobEntity.canSpawnOn(entityType, world, reason, pos, random))
900917 </#if >
0 commit comments