Skip to content

Commit

Permalink
Fix some water mobs spawning on land
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 22, 2019
1 parent aeb7cc2 commit 2c7208d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import its_meow.betteranimalsplus.init.ModEntities;
import its_meow.betteranimalsplus.util.EntityTypeContainer;
import its_meow.betteranimalsplus.util.EntityTypeContainerTameable;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -117,7 +118,7 @@ public void onWorldLoad() {
if(entry.spawnType == EntityClassification.WATER_CREATURE && EntitySpawnPlacementRegistry.getPlacementType((EntityType<? extends MobEntity>) type) == null) {
// This thing breaks every other day
try {
EntitySpawnPlacementRegistry.<MobEntity>register((EntityType<MobEntity>) type, EntitySpawnPlacementRegistry.PlacementType.IN_WATER, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, (t, w, s, b, r) -> b.getY() > 45 && b.getY() < w.getSeaLevel());
EntitySpawnPlacementRegistry.<MobEntity>register((EntityType<MobEntity>) type, EntitySpawnPlacementRegistry.PlacementType.IN_WATER, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, (t, w, s, b, r) -> b.getY() > 45 && b.getY() < w.getSeaLevel() && w.getBlockState(b).getBlock() == Blocks.WATER);
} catch(Exception e) { // Just in case
e.printStackTrace();
}
Expand Down

0 comments on commit 2c7208d

Please sign in to comment.