mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
53 lines
2.9 KiB
Diff
53 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <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/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
index ac5ce96ab62ec210816e7af85a4269073b7a9270..84140e01eba780ffb8289bff75d1b58af4deab76 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
@@ -52,7 +52,7 @@ public class BlockPortal extends Block {
|
|
|
|
@Override
|
|
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
|
- if (worldserver.spigotConfig.enableZombiePigmenPortalSpawns && worldserver.getDimensionManager().isNatural() && worldserver.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && random.nextInt(2000) < worldserver.getDifficulty().a()) { // Spigot
|
|
+ if (worldserver.spigotConfig.enableZombiePigmenPortalSpawns && worldserver.getDimensionManager().isNatural() && worldserver.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && random.nextInt(worldserver.purpurConfig.piglinPortalSpawnModifier) < worldserver.getDifficulty().a()) { // Spigot
|
|
while (worldserver.getType(blockposition).a((Block) this)) {
|
|
blockposition = blockposition.down();
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 37835f19ce917b36cb56e0d0d58d9be349919cab..78e4ef0103e1c9f96ec160e74b870902eda5e842 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -1419,6 +1419,7 @@ public class PurpurWorldConfig {
|
|
public boolean piglinRidable = false;
|
|
public boolean piglinRidableInWater = false;
|
|
public double piglinMaxHealth = 16.0D;
|
|
+ public int piglinPortalSpawnModifier = 2000;
|
|
private void piglinSettings() {
|
|
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
|
|
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
|
|
@@ -1428,6 +1429,7 @@ public class PurpurWorldConfig {
|
|
set("mobs.piglin.attributes.max_health", oldValue);
|
|
}
|
|
piglinMaxHealth = getDouble("mobs.piglin.attributes.max_health", piglinMaxHealth);
|
|
+ piglinPortalSpawnModifier = getInt("mobs.piglin.portal-spawn-modifier", piglinPortalSpawnModifier);
|
|
}
|
|
|
|
public boolean piglinBruteRidable = false;
|