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@c1b4899 Fix dupe uuid check on entity add (#6735) PaperMC/Paper@3f043f7 Async catch modifications to critical entity state PaperMC/Paper@bc43f40 Update jline and TCA (#6829) PaperMC/Paper@d9e2817 Update paperweight to 1.1.13 (#6866) PaperMC/Paper@3e310e0 Remove redundant and unneeded repos, reorder repos (#6867) PaperMC/Paper@485d15f Update paperweight to 1.1.14 (#6868) PaperMC/Paper@09d50a9 Added missing mappings (#6810) PaperMC/Paper@0968cdd Move async catches back to where they were (#6869) PaperMC/Paper@6f71b7c Deduplicate strings in ObfHelper (#6841) PaperMC/Paper@ada930b Updated Upstream (Bukkit/CraftBukkit) (#6872) PaperMC/Paper@06d82e0 Cache palette array (#6767) PaperMC/Paper@70fe58d Expose the potential player cause of a lightning (#6782) PaperMC/Paper@c20c9d3 Fix CraftNamespacedKey shenanigans (#6825) PaperMC/Paper@29bb5a9 Add PlayerDeathEvent#getPlayer for clarity (#6859) PaperMC/Paper@124d079 Fix issues with mob conversion (#6831) PaperMC/Paper@22b0238 Add API for checking if a zombie has the option to break doors (#6855) PaperMC/Paper@5af80b0 Add isCollidable methods to various places (#6870) PaperMC/Paper@32ba088 Fix setPatternColor on tropical fish bucket meta (#6877) PaperMC/Paper@87121ce Move `getTrackedPlayers` up from Player to Entity (#6569) PaperMC/Paper@a923e33 Make despawn distance configs per-category, improve per category spawn limit config (#6717) PaperMC/Paper@3f17694 Goat ram API (#6336) PaperMC/Paper@cc2ecbc Add Raw Byte Entity Serialization (#6826) Airplane Changes: TECHNOVE/Airplane@e47949b Ty Penple <3 TECHNOVE/Airplane@86fee6b Update upstream
68 lines
5.0 KiB
Diff
68 lines
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: DoctaEnkoda <bierquejason@gmail.com>
|
|
Date: Mon, 31 May 2021 11:06:54 +0200
|
|
Subject: [PATCH] Config MobEffect by world
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
index 79e036d79dec2ec4404baf02c23ba5ccad20cdce..6706d8e6d43cc5f3058f08fdfde77bed57f4c641 100644
|
|
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
@@ -49,16 +49,16 @@ public class MobEffect {
|
|
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
|
if (this == MobEffects.REGENERATION) {
|
|
if (entity.getHealth() < entity.getMaxHealth()) {
|
|
- entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
|
+ entity.heal(entity.level.purpurConfig.entityHealthRegenAmount, RegainReason.MAGIC_REGEN); // CraftBukkit // Purpur
|
|
}
|
|
} else if (this == MobEffects.POISON) {
|
|
- if (entity.getHealth() > 1.0F) {
|
|
- entity.hurt(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
|
+ if (entity.getHealth() > entity.level.purpurConfig.entityMinimalHealthPoison) { // Purpur
|
|
+ entity.hurt(CraftEventFactory.POISON, entity.level.purpurConfig.entityPoisonDegenerationAmount); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON // Purpur
|
|
}
|
|
} else if (this == MobEffects.WITHER) {
|
|
- entity.hurt(DamageSource.WITHER, 1.0F);
|
|
+ entity.hurt(DamageSource.WITHER, entity.level.purpurConfig.entityWitherDegenerationAmount); // Purpur
|
|
} else if (this == MobEffects.HUNGER && entity instanceof Player) {
|
|
- ((Player) entity).applyExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
|
+ ((Player) entity).applyExhaustion(entity.level.purpurConfig.humanHungerExhaustionAmount * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent // Purpur
|
|
} else if (this == MobEffects.SATURATION && entity instanceof Player) {
|
|
if (!entity.level.isClientSide) {
|
|
// CraftBukkit start
|
|
@@ -68,7 +68,7 @@ public class MobEffect {
|
|
org.bukkit.event.entity.FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(entityhuman, amplifier + 1 + oldFoodLevel);
|
|
|
|
if (!event.isCancelled()) {
|
|
- entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F);
|
|
+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, entity.level.purpurConfig.humanSaturationRegenAmount); // Purpur
|
|
}
|
|
|
|
((ServerPlayer) entityhuman).connection.send(new ClientboundSetHealthPacket(((ServerPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 84f98b5dd5d9f15c7cc00068f053f31b82d51cdf..ff6fee57d36e939f34b9963afb656af31650dc4c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -283,6 +283,21 @@ public class PurpurWorldConfig {
|
|
poweredRailBoostModifier = getDouble("gameplay-mechanics.minecart.powered-rail.boost-modifier", poweredRailBoostModifier);
|
|
}
|
|
|
|
+ public float entityHealthRegenAmount = 1.0F;
|
|
+ public float entityMinimalHealthPoison = 1.0F;
|
|
+ public float entityPoisonDegenerationAmount = 1.0F;
|
|
+ public float entityWitherDegenerationAmount = 1.0F;
|
|
+ public float humanHungerExhaustionAmount = 0.005F;
|
|
+ public float humanSaturationRegenAmount = 1.0F;
|
|
+ private void mobEffectSettings() {
|
|
+ entityHealthRegenAmount = (float) getDouble("gameplay-mechanics.mob-effects.health-regen-amount", entityHealthRegenAmount);
|
|
+ entityMinimalHealthPoison = (float) getDouble("gameplay-mechanics.mob-effects.minimal-health-poison-amount", entityMinimalHealthPoison);
|
|
+ entityPoisonDegenerationAmount = (float) getDouble("gameplay-mechanics.mob-effects.poison-degeneration-amount", entityPoisonDegenerationAmount);
|
|
+ entityWitherDegenerationAmount = (float) getDouble("gameplay-mechanics.mob-effects.wither-degeneration-amount", entityWitherDegenerationAmount);
|
|
+ humanHungerExhaustionAmount = (float) getDouble("gameplay-mechanics.mob-effects.hunger-exhaustion-amount", humanHungerExhaustionAmount);
|
|
+ humanSaturationRegenAmount = (float) getDouble("gameplay-mechanics.mob-effects.saturation-regen-amount", humanSaturationRegenAmount);
|
|
+ }
|
|
+
|
|
public boolean catSpawning;
|
|
public boolean patrolSpawning;
|
|
public boolean phantomSpawning;
|