mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Allow toggling of ZombiePigmen spawning in portal blocks
By: Dmck2b <dmck2b+github@gmail.com>
This commit is contained in:
parent
bfc73d87f0
commit
68214fb1a0
2 changed files with 15 additions and 1 deletions
|
@ -20,7 +20,14 @@
|
||||||
|
|
||||||
public class NetherPortalBlock extends Block implements Portal {
|
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)) {
|
if (world.getBlockState(pos).isValidSpawn(world, pos, EntityType.ZOMBIFIED_PIGLIN)) {
|
||||||
|
|
|
@ -269,4 +269,11 @@ public class SpigotWorldConfig
|
||||||
this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false );
|
this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false );
|
||||||
this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs );
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue