From 68214fb1a066b63bc8f3f62b201ae19aec2f5279 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 20 Jan 2014 20:18:23 +0000 Subject: [PATCH] Allow toggling of ZombiePigmen spawning in portal blocks By: Dmck2b --- .../world/level/block/NetherPortalBlock.java.patch | 9 ++++++++- .../src/main/java/org/spigotmc/SpigotWorldConfig.java | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch index f1dc332396..55b5220706 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch @@ -20,7 +20,14 @@ public class NetherPortalBlock extends Block implements Portal { -@@ -77,7 +84,8 @@ +@@ -71,13 +78,14 @@ + + @Override + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { +- if (world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(2000) < world.getDifficulty().getId()) { ++ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(2000) < world.getDifficulty().getId()) { // Spigot + while (world.getBlockState(pos).is((Block) this)) { + pos = pos.below(); } if (world.getBlockState(pos).isValidSpawn(world, pos, EntityType.ZOMBIFIED_PIGLIN)) { diff --git a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java index d1c8c21083..e986d172d7 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -269,4 +269,11 @@ public class SpigotWorldConfig this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false ); this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs ); } + + public boolean enableZombiePigmenPortalSpawns; + private void enableZombiePigmenPortalSpawns() + { + this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", true ); + this.log( "Allow Zombie Pigmen to spawn from portal blocks: " + this.enableZombiePigmenPortalSpawns ); + } }