mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b4192fd fix NPE from changes in e4358b82171 PaperMC/Paper@5b6445a Revert "fix NPE from changes in e4358b82171" PaperMC/Paper@323c087 Revert "#686: Fix contains for default section generating real sections" PaperMC/Paper@c837002 Fix client world difficulty sync issue (#7035) PaperMC/Paper@a4782f7 [ci skip] fixup indent PaperMC/Paper@83aee0f [ci skip] Clarify setSize consequences for Slimes (#7036) PaperMC/Paper@7c8fdc1 Add dropped hunk from mid-tick tasks (#7034) PaperMC/Paper@fd263ef Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039) PaperMC/Paper@b8d486c Create workflow to add new PRs to the PR Queue project (#6918) PaperMC/Paper@a50e273 Include axolotls in affected entities for water splash potions (#7024) PaperMC/Paper@af95df8 Port Actually unload POI data from Tuinity 1.16 (#7044) PaperMC/Paper@04897b1 [ci skip] Revert "Create workflow to add new PRs to the PR Queue project (#6918)" (#7046) PaperMC/Paper@b4a77a8 Updated Upstream (Bukkit/CraftBukkit) (#7045) PaperMC/Paper@0e25db2 Fix mis-placed processEnchantOrder from 1.18 update (#7052) PaperMC/Paper@53d026e Fix unused EntitySectionStorage#getEntities(AABB, Consumer) method being broken PaperMC/Paper@772e880 Fix light propagation in high y sections PaperMC/Paper@33ea869 Bump Starlight light version PaperMC/Paper@74fd151 Fix entity equipment on cancellation of EntityDeathEvent (#5740) PaperMC/Paper@758e2a7 Fix bad ticking checks for blocks PaperMC/Paper@0e91b6a Return 0 for light values if a dimenion does not have them PaperMC/Paper@188a8df Fix ChunkSnapshot#isSectionEmpty(int) PaperMC/Paper@bbc7451 Fix issue with snapshotted biomes in last commit PaperMC/Paper@b475c6a Backport log4j fix PaperMC/Paper@4e355c4 Updated Upstream (CraftBukkit) PaperMC/Paper@dce79f3 Update Log4J (#7069)
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 8bbb9bdcf95989f1737714655f6f6a269d46d7f2..8d569eb2ec1b2bdbd415094ae04ae531dfdeafae 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).causeFoodExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
|
+ ((Player) entity).causeFoodExhaustion(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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 07d2e7c062a1bc1e58de6fb14d4be516818151f8..b9f6fd06b0320e1abd8a1c5b7461b9bbcb0314fe 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/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;
|