Files
Purpur/patches/server/0184-Piglin-portal-spawn-modifier.patch
William Blake Galbreath 635d108ae2 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
415f7ca165 Updated Upstream (Bukkit/CraftBukkit)
37df95b189 refactor: do not import List; use FQN
5c65546f5c rebase
fdef125b19 Expose EntityType#getTranslationKey
4d9b14efa4 Use AsyncAppender instead of AsyncLoggerContextSelector to keep loggging IO off main thread (#6381)
8c2adf8e9e Add warning to getOfflinePlayers (#6365)
370b60de14 Optimize indirect passenger iteration (#6366)
80836709e7 Fix block drops position losing precision millions of blocks out (#6387)
e942509e73 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6379)
ce43ce8265 Make EntityUnleashEvent cancellable (#4993)
591cac3685 Configurable item frame map cursor interval (#6385)
e9aa9ce66b Add config migration for named entity death logging option (#6390)
c2f47a76ae Implement Translatable in appropriate places (#6248)
f12a7f57e1 Clear bucket NBT after dispense (#6391)
4dd33cb8b6 [ci skip] Drop "Fix CME on adding a passenger in CreatureSpawnEvent" (#6384)
565cd3306c [ci skip] Add some helper methods to the ObfHelper util class (#6374)

Tuinity Changes:
6fd7e2b376 Update paper
2021-08-14 16:40:13 -05:00

53 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 13 Apr 2021 11:19:35 -0500
Subject: [PATCH] Piglin portal spawn modifier
Allows changing the modifier for the piglin spawn chance from a portal block
based on the world difficulty.
For example, with the default vanilla value of 2000 there is a 2 out of 2000 chance
for a piglin to spawn in a portal block each tick in normal mode.
Equation: random.nextInt(modifier) < difficulty
Difficulties:
0 - peaceful
1 - easy
2 - normal
3 - hard
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index fef1027829c44957e23c0a121033bfb7640d06f0..c42349d0f6b0025525278295b36f4030f122800e 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -55,7 +55,7 @@ public class NetherPortalBlock extends Block {
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
- if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(2000) < world.getDifficulty().getId()) { // Spigot
+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(world.purpurConfig.piglinPortalSpawnModifier) < world.getDifficulty().getId()) { // Spigot // Purpur
while (world.getBlockState(pos).is((Block) this)) {
pos = pos.below();
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index c2e0c46a626ae143b26e2a77d1077a10c657e61b..9e18b2e38b0c36eae8b7e24aedf3c4e6786a7ff0 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1460,6 +1460,7 @@ public class PurpurWorldConfig {
public boolean piglinRidableInWater = false;
public double piglinMaxHealth = 16.0D;
public boolean piglinBypassMobGriefing = false;
+ public int piglinPortalSpawnModifier = 2000;
private void piglinSettings() {
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
@@ -1470,6 +1471,7 @@ public class PurpurWorldConfig {
}
piglinMaxHealth = getDouble("mobs.piglin.attributes.max_health", piglinMaxHealth);
piglinBypassMobGriefing = getBoolean("mobs.piglin.bypass-mob-griefing", piglinBypassMobGriefing);
+ piglinPortalSpawnModifier = getInt("mobs.piglin.portal-spawn-modifier", piglinPortalSpawnModifier);
}
public boolean piglinBruteRidable = false;