From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 23 Mar 2021 15:40:45 -0400
Subject: [PATCH] Config to disable hostile mob spawn on ice


diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java
index c484e27650364b6537fe6b2e8e14de98382b86a3..096a7b76e0ae42ba8b859159e20fb72e101fe6de 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java
@@ -95,6 +95,12 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
     }
 
     public static boolean a(WorldAccess worldaccess, BlockPosition blockposition, Random random) {
+        // Purpur start
+        net.minecraft.world.level.block.state.IBlockData spawnBlock = worldaccess.getType(blockposition.down());
+        if ((!worldaccess.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.equals(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!worldaccess.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.equals(net.minecraft.world.level.block.Blocks.BLUE_ICE))) {
+            return false;
+        }
+        // Purpur end
         if (worldaccess.getBrightness(EnumSkyBlock.SKY, blockposition) > random.nextInt(32)) {
             return false;
         } else {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 8054d6242358dc2bf212c7aff55ebf011c22e474..aa401d246373fba0d6c66bff5fda5febdc59480a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -449,8 +449,12 @@ public class PurpurWorldConfig {
     }
 
     public boolean snowOnBlueIce = true;
+    public boolean mobsSpawnOnPackedIce = true;
+    public boolean mobsSpawnOnBlueIce = true;
     private void iceSettings() {
         snowOnBlueIce = getBoolean("blocks.blue_ice.allow-snow-formation", snowOnBlueIce);
+        mobsSpawnOnPackedIce = getBoolean("blocks.packed_ice.allow-mob-spawns", mobsSpawnOnPackedIce);
+        mobsSpawnOnBlueIce = getBoolean("blocks.blue_ice.allow-mob-spawns", mobsSpawnOnBlueIce);
     }
 
     public boolean chestOpenWithBlockOnTop = false;
