mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7b3b593 [ci skip] Update checkout action in workflow (#8510) PaperMC/Paper@36869cc Fix new block data in EntityChangeBlockEvent for silverfish when mobGriefing isn't enabled (#8099) PaperMC/Paper@2432233 Add allow server listing & text filtering client options (#7595) PaperMC/Paper@954e6f0 Fix a bunch more forceDrops for dropping items (#8095) PaperMC/Paper@32d95e9 Track projectile source for fireworks from dispensers (#8044) PaperMC/Paper@0249750 Fix EntityArgument suggestion permissions to align with EntitySelector#checkPermissions (#8511) PaperMC/Paper@8acb05d Make CommandSyntaxException implement ComponentMessageThrowable (#8513) PaperMC/Paper@c264018 [ci skip] Undo modification to removed patches in latest commit (#8512) PaperMC/Paper@304ab35 [ci skip] Remove old todo file PaperMC/Paper@8a4b752 Fix wrong descriptor in ASMEventExecutorGenerator (#8506) PaperMC/Paper@b743144 Fix MC-147659 (#8423) PaperMC/Paper@aaf5e39 Deprecate unused VehicleEntityCollisionEvent methods (#8498)
53 lines
3.1 KiB
Diff
53 lines
3.1 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 65fa00b3d4d35a4125f8de444e77ac54e9e28551..dd9badfb2879def258bf725a5d802f7d93bebce8 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, RandomSource 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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index b1ee7134cf9e3bc51fcd4fb7c64f151244f2f34c..83931e389e021af77680f1ca8e82f23f9b9eef32 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1625,6 +1625,7 @@ public class PurpurWorldConfig {
|
|
public double piglinMaxHealth = 16.0D;
|
|
public boolean piglinBypassMobGriefing = false;
|
|
public boolean piglinTakeDamageFromWater = false;
|
|
+ public int piglinPortalSpawnModifier = 2000;
|
|
private void piglinSettings() {
|
|
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
|
|
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
|
|
@@ -1637,6 +1638,7 @@ public class PurpurWorldConfig {
|
|
piglinMaxHealth = getDouble("mobs.piglin.attributes.max_health", piglinMaxHealth);
|
|
piglinBypassMobGriefing = getBoolean("mobs.piglin.bypass-mob-griefing", piglinBypassMobGriefing);
|
|
piglinTakeDamageFromWater = getBoolean("mobs.piglin.takes-damage-from-water", piglinTakeDamageFromWater);
|
|
+ piglinPortalSpawnModifier = getInt("mobs.piglin.portal-spawn-modifier", piglinPortalSpawnModifier);
|
|
}
|
|
|
|
public boolean piglinBruteRidable = false;
|