mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Piglin portal spawn modifier
This commit is contained in:
52
patches/server/0199-Piglin-portal-spawn-modifier.patch
Normal file
52
patches/server/0199-Piglin-portal-spawn-modifier.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
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 a3cca259f03d6ee0551bd075ceaa91ffb8fa21fc..689656dcfa823e5478f7c053137ee38c6ef19c00 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1373,6 +1373,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);
|
||||
@@ -1382,6 +1383,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;
|
||||
Reference in New Issue
Block a user