Allow toggling of ZombiePigmen spawning in portal blocks

By: Dmck2b <dmck2b+github@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2014-01-20 20:18:23 +00:00
parent bfc73d87f0
commit 68214fb1a0
2 changed files with 15 additions and 1 deletions

View file

@ -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)) {

View file

@ -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 );
}
}