mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Add regen effect to campfires
This commit is contained in:
@@ -31,8 +31,7 @@ functionality itself.
|
||||
verbose
|
||||
~~~~~~~
|
||||
* **default**: false
|
||||
* **description**: Sets whether the server should dump all configuration values
|
||||
to the server log on startup.
|
||||
* **description**: Sets whether the server should dump all configuration values to the server log on startup.
|
||||
|
||||
logger
|
||||
~~~~~~
|
||||
@@ -68,3 +67,37 @@ mobs
|
||||
* pumpkin-can-be-added-back
|
||||
- **default**: true
|
||||
- **description**: Control if pumpkins can be placed back onto snowmen
|
||||
|
||||
World Settings
|
||||
==============
|
||||
|
||||
World settings are on a per-world basis. The child-node `default` is used for all worlds that do not have their own specific settings.
|
||||
|
||||
* campfire-regen
|
||||
* interval
|
||||
- **default**: 40
|
||||
- **description**: Time (in ticks) that campfires scan for player and apply regen on. Regen buff only gets applied if campfire is lit. Set to 0 to disable
|
||||
|
||||
* duration
|
||||
- **default**: 80
|
||||
- **description**: How long (in ticks) the regen buff lasts
|
||||
|
||||
* range
|
||||
- **default**: 5
|
||||
- **description**: Distance (in blocks) a player must be within to receive the regen buff
|
||||
|
||||
* amplifier
|
||||
- **default**: 0
|
||||
- **description**: The amplifier on the regen buff. `0` for level 1, `1` for level 2
|
||||
|
||||
* boost-duration
|
||||
- **default**: 80
|
||||
- **description**: How long (in ticks) the regen buff lasts when the campfire is in smoke signal mode
|
||||
|
||||
* boost-range
|
||||
- **default**: 10
|
||||
- **description**: Distance (in blocks) a player must be within to receive the regen buff when the campfire is in smoke signal mode
|
||||
|
||||
* boost-amplifier
|
||||
- **default**: 1
|
||||
- **description**: The amplifier on the regen buff when the campfire is in smoke signal mode
|
||||
|
||||
60
patches/server/0018-Add-regen-effect-to-campfires.patch
Normal file
60
patches/server/0018-Add-regen-effect-to-campfires.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
From 5f6b1226ebd2d3316469b5b9c3f301a5e4a903cf Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 19 May 2019 18:11:53 -0500
|
||||
Subject: [PATCH] Add regen effect to campfires
|
||||
|
||||
---
|
||||
.../minecraft/server/TileEntityCampfire.java | 10 ++++++++++
|
||||
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 17 +++++++++++++++++
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
index 3a97a6571..530022248 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
@@ -34,6 +34,16 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
|
||||
|
||||
} else {
|
||||
if (flag) {
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.campfireRegenInterval > 0 && world.getTime() % world.purpurConfig.campfireRegenInterval == 0L) {
|
||||
+ boolean signalBoost = getBlock().get(BlockCampfire.c);
|
||||
+ int duration = signalBoost ? world.purpurConfig.campfireRegenBoostDuration : world.purpurConfig.campfireRegenDuration;
|
||||
+ byte amp = (byte) (signalBoost ? world.purpurConfig.campfireRegenBoostAmp : world.purpurConfig.campfireRegenAmp);
|
||||
+ int range = signalBoost ? world.purpurConfig.campfireRegenBoostRange : world.purpurConfig.campfireRegenRange;
|
||||
+ MobEffect regeneration = new MobEffect(MobEffects.REGENERATION, duration, amp, true, true);
|
||||
+ world.a(EntityHuman.class, new AxisAlignedBB(position).g(range)).forEach(p -> p.addEffect(regeneration));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
this.f();
|
||||
} else {
|
||||
for (int i = 0; i < this.items.size(); ++i) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 30f11fe26..becb6f3b7 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -60,4 +60,21 @@ public class PurpurWorldConfig {
|
||||
config.addDefault("world-settings.default." + path, def);
|
||||
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
||||
}
|
||||
+
|
||||
+ public int campfireRegenInterval = 40;
|
||||
+ public int campfireRegenDuration = 80;
|
||||
+ public int campfireRegenRange = 5;
|
||||
+ public int campfireRegenAmp = 0;
|
||||
+ public int campfireRegenBoostDuration = 80;
|
||||
+ public int campfireRegenBoostRange = 10;
|
||||
+ public int campfireRegenBoostAmp = 1;
|
||||
+ private void campireRegenSettings() {
|
||||
+ campfireRegenInterval = getInt("campfire-regen.interval", campfireRegenInterval);
|
||||
+ campfireRegenDuration = getInt("campfire-regen.duration", campfireRegenDuration);
|
||||
+ campfireRegenRange = getInt("campfire-regen.range", campfireRegenRange);
|
||||
+ campfireRegenAmp = getInt("campfire-regen.amplifier", campfireRegenAmp);
|
||||
+ campfireRegenBoostDuration = getInt("campfire-regen.boost-duration", campfireRegenBoostDuration);
|
||||
+ campfireRegenBoostRange = getInt("campfire-regen.boost-range", campfireRegenBoostRange);
|
||||
+ campfireRegenBoostAmp = getInt("campfire-regen.boost-amplifier", campfireRegenBoostAmp);
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user