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@d129162 Properly handle BlockBreakEvent#isDropItems (#8936) PaperMC/Paper@67a1a8c Fix Inventory#getLocation not working for the composter (#9596) PaperMC/Paper@5b34a09 Add option to disable chorus plant and mushroom block updates (#9442) PaperMC/Paper@ed8401c Fix rotation for spawning display entities (#9552) PaperMC/Paper@bd67b83 Determine lava and water fluid explosion resistance by their block explosion resistance (#9482) PaperMC/Paper@d928dda Don't tab-complete namespaced commands if `send-namespaced` is false (#9366) PaperMC/Paper@f43a19c Fix CME in CraftPersistentDataTypeRegistry (#6701) PaperMC/Paper@45ba652 [ci skip] Rebuild patches PaperMC/Paper@990765b Fire entity death event for ender dragon (#9495) PaperMC/Paper@1259b93 Fixed CraftItemStack/CraftItemMeta enchantment level inconsistency (#8792) PaperMC/Paper@88891c3 Add Entity Coordinate and Rotation API (#9461) PaperMC/Paper@5bf82aa Add cancellability to PlayerTrackEntityEvent (#8605) PaperMC/Paper@1b96c64 Improve cancelling PreCreatureSpawnEvent with per player mob spawns (#9400) PaperMC/Paper@7232506 Add entity tracker min Y distance config option (#9406) PaperMC/Paper@00a68b1 Player listing API (#8782) PaperMC/Paper@af6142e [ci skip] Update Gradle wrapper PaperMC/Paper@281855c Remove unused lag-compensate-block-breaking option (#9635) PaperMC/Paper@35ef053 [ci skip] update editorconfig and gitattributes (#9608) PaperMC/Paper@97b9c4a Fix NPE on Boat#getStatus (#9115) PaperMC/Paper@2be57c6 Expand Pose API (#8781) PaperMC/Paper@b29ecd4 Expose clicked BlockFace during BlockDamageEvent (#9632) PaperMC/Paper@e3f29f4 MerchantRecipe: add copy constructor (#8703) PaperMC/Paper@fed9042 More DragonBattle API (#5655) PaperMC/Paper@27d39ca Properly clone custom nbt tags inside ItemMeta (#7849) PaperMC/Paper@0c7385b Add PlayerPickItemEvent (#5590) PaperMC/Paper@9395aa6 Improve performance of mass crafts (#9603) PaperMC/Paper@7386a13 Fix endgateway teleportation offset (#9517) PaperMC/Paper@a712766 Allow custom damage for trident (#8132) PaperMC/Paper@3716832 Prevent overfilled bundles from duplicating items (#9633) PaperMC/Paper@9cbad8e Expose Hand during BlockCanBuildEvent (#9636)
68 lines
4.9 KiB
Diff
68 lines
4.9 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 53cc6befb752affcfec65e18365f6d369448d407..01850fc596a85974287ff6750427186d21acac41 100644
|
|
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
@@ -59,16 +59,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(entity.damageSources().poison, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
|
+ if (entity.getHealth() > entity.level().purpurConfig.entityMinimalHealthPoison) { // Purpur
|
|
+ entity.hurt(entity.damageSources().poison, entity.level().purpurConfig.entityPoisonDegenerationAmount); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON // Purpur
|
|
}
|
|
} else if (this == MobEffects.WITHER) {
|
|
- entity.hurt(entity.damageSources().wither(), 1.0F);
|
|
+ entity.hurt(entity.damageSources().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
|
|
@@ -76,7 +76,7 @@ public class MobEffect {
|
|
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
|
|
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
|
|
}
|
|
|
|
((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate();
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index bd485bc18e7012f14a7f85cda26f8a1ec2b0cca0..f95596f39021e3da3155c3175a6fcec8c6eb7ff9 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -331,6 +331,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;
|