2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Video <videogamesm12@gmail.com>
|
|
|
|
Date: Mon, 11 Apr 2022 13:33:52 -0600
|
|
|
|
Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
|
|
|
effect overflows
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
2023-07-06 21:13:45 +00:00
|
|
|
index 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c36b88c9aa 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
2023-07-06 21:13:45 +00:00
|
|
|
@@ -57,6 +57,7 @@ public class MobEffect {
|
2022-07-28 03:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
|
|
|
+ boolean god = entity instanceof Player player && (player.isCreative() || player.isInvulnerable()); // Scissors
|
|
|
|
if (this == MobEffects.REGENERATION) {
|
|
|
|
if (entity.getHealth() < entity.getMaxHealth()) {
|
|
|
|
entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
2023-07-06 21:13:45 +00:00
|
|
|
@@ -83,17 +84,31 @@ public class MobEffect {
|
2022-07-28 03:57:50 +00:00
|
|
|
// CraftBukkit end
|
|
|
|
}
|
|
|
|
} else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) {
|
|
|
|
- if (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm()) {
|
|
|
|
+ // Scissors start
|
|
|
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
|
|
|
+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) {
|
2023-07-01 20:21:13 +00:00
|
|
|
+ // Scissors end
|
2023-03-16 03:57:35 +00:00
|
|
|
entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier));
|
2022-07-28 03:57:50 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
|
|
|
+ // Scissors start
|
|
|
|
+ if (!god) {
|
|
|
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
|
|
|
+ entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
|
|
|
+ }
|
|
|
|
+ // Scissors end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
|
|
|
int j;
|
|
|
|
+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't.
|
|
|
|
+ if (target instanceof Player player && (player.isCreative() || player.isInvulnerable())) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
|
|
|
+ // Scissors end
|
|
|
|
|
|
|
|
if ((this != MobEffects.HEAL || target.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !target.isInvertedHealAndHarm())) {
|
|
|
|
if ((this != MobEffects.HARM || target.isInvertedHealAndHarm()) && (this != MobEffects.HEAL || !target.isInvertedHealAndHarm())) {
|