aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/effect
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower/net/minecraft/world/effect
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/effect')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch55
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/HungerMobEffect.java.patch34
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch74
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/PoisonMobEffect.java.patch31
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/RegenerationMobEffect.java.patch31
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/effect/SaturationMobEffect.java.patch43
6 files changed, 268 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch
new file mode 100644
index 0000000000..7ca073964d
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch
@@ -0,0 +1,55 @@
+--- a/net/minecraft/world/effect/HealOrHarmMobEffect.java
++++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java
+@@ -8,37 +8,35 @@
+
+ private final boolean isHarm;
+
+- public HealOrHarmMobEffect(MobEffectCategory mobeffectcategory, int i, boolean flag) {
+- super(mobeffectcategory, i);
++ public HealOrHarmMobEffect(MobEffectCategory mobeffectinfo, int i, boolean flag) {
++ super(mobeffectinfo, i);
+ this.isHarm = flag;
+ }
+
+ @Override
+- @Override
+- public void applyEffectTick(LivingEntity livingentity, int i) {
+- super.applyEffectTick(livingentity, i);
+- if (this.isHarm == livingentity.isInvertedHealAndHarm()) {
+- livingentity.heal((float) Math.max(4 << i, 0));
++ public void applyEffectTick(LivingEntity livingEntity, int amplifier) {
++ super.applyEffectTick(livingEntity, amplifier);
++ if (this.isHarm == livingEntity.isInvertedHealAndHarm()) {
++ livingEntity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
+ } else {
+- livingentity.hurt(livingentity.damageSources().magic(), (float) (6 << i));
++ livingEntity.hurt(livingEntity.damageSources().magic(), (float) (6 << amplifier));
+ }
+
+ }
+
+ @Override
+- @Override
+- public void applyInstantenousEffect(@Nullable Entity entity, @Nullable Entity entity1, LivingEntity livingentity, int i, double d0) {
++ public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity indirectSource, LivingEntity livingEntity, int amplifier, double health) {
+ int j;
+
+- if (this.isHarm == livingentity.isInvertedHealAndHarm()) {
+- j = (int) (d0 * (double) (4 << i) + 0.5D);
+- livingentity.heal((float) j);
++ if (this.isHarm == livingEntity.isInvertedHealAndHarm()) {
++ j = (int) (health * (double) (4 << amplifier) + 0.5D);
++ livingEntity.heal((float) j, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
+ } else {
+- j = (int) (d0 * (double) (6 << i) + 0.5D);
+- if (entity == null) {
+- livingentity.hurt(livingentity.damageSources().magic(), (float) j);
++ j = (int) (health * (double) (6 << amplifier) + 0.5D);
++ if (source == null) {
++ livingEntity.hurt(livingEntity.damageSources().magic(), (float) j);
+ } else {
+- livingentity.hurt(livingentity.damageSources().indirectMagic(entity, entity1), (float) j);
++ livingEntity.hurt(livingEntity.damageSources().indirectMagic(source, indirectSource), (float) j);
+ }
+ }
+
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/HungerMobEffect.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/HungerMobEffect.java.patch
new file mode 100644
index 0000000000..8966bea205
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/HungerMobEffect.java.patch
@@ -0,0 +1,34 @@
+--- a/net/minecraft/world/effect/HungerMobEffect.java
++++ b/net/minecraft/world/effect/HungerMobEffect.java
+@@ -5,24 +5,22 @@
+
+ class HungerMobEffect extends MobEffect {
+
+- protected HungerMobEffect(MobEffectCategory mobeffectcategory, int i) {
+- super(mobeffectcategory, i);
++ protected HungerMobEffect(MobEffectCategory category, int color) {
++ super(category, color);
+ }
+
+ @Override
+- @Override
+- public void applyEffectTick(LivingEntity livingentity, int i) {
+- super.applyEffectTick(livingentity, i);
+- if (livingentity instanceof Player) {
+- Player player = (Player) livingentity;
++ public void applyEffectTick(LivingEntity livingEntity, int amplifier) {
++ super.applyEffectTick(livingEntity, amplifier);
++ if (livingEntity instanceof Player) {
++ Player entityhuman = (Player) livingEntity;
+
+- player.causeFoodExhaustion(0.005F * (float) (i + 1));
++ entityhuman.causeFoodExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean shouldApplyEffectTickThisTick(int i, int j) {
+ return true;
+ }
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch
new file mode 100644
index 0000000000..cb9791d6f1
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch
@@ -0,0 +1,74 @@
+--- a/net/minecraft/world/effect/MobEffectUtil.java
++++ b/net/minecraft/world/effect/MobEffectUtil.java
+@@ -15,47 +15,53 @@
+
+ public MobEffectUtil() {}
+
+- public static Component formatDuration(MobEffectInstance mobeffectinstance, float f, float f1) {
+- if (mobeffectinstance.isInfiniteDuration()) {
++ public static Component formatDuration(MobEffectInstance mobeffect, float f, float f1) {
++ if (mobeffect.isInfiniteDuration()) {
+ return Component.translatable("effect.duration.infinite");
+ } else {
+- int i = Mth.floor((float) mobeffectinstance.getDuration() * f);
++ int i = Mth.floor((float) mobeffect.getDuration() * f);
+
+ return Component.literal(StringUtil.formatTickDuration(i, f1));
+ }
+ }
+
+- public static boolean hasDigSpeed(LivingEntity livingentity) {
+- return livingentity.hasEffect(MobEffects.DIG_SPEED) || livingentity.hasEffect(MobEffects.CONDUIT_POWER);
++ public static boolean hasDigSpeed(LivingEntity entity) {
++ return entity.hasEffect(MobEffects.DIG_SPEED) || entity.hasEffect(MobEffects.CONDUIT_POWER);
+ }
+
+- public static int getDigSpeedAmplification(LivingEntity livingentity) {
++ public static int getDigSpeedAmplification(LivingEntity entity) {
+ int i = 0;
+ int j = 0;
+
+- if (livingentity.hasEffect(MobEffects.DIG_SPEED)) {
+- i = livingentity.getEffect(MobEffects.DIG_SPEED).getAmplifier();
++ if (entity.hasEffect(MobEffects.DIG_SPEED)) {
++ i = entity.getEffect(MobEffects.DIG_SPEED).getAmplifier();
+ }
+
+- if (livingentity.hasEffect(MobEffects.CONDUIT_POWER)) {
+- j = livingentity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier();
++ if (entity.hasEffect(MobEffects.CONDUIT_POWER)) {
++ j = entity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier();
+ }
+
+ return Math.max(i, j);
+ }
+
+- public static boolean hasWaterBreathing(LivingEntity livingentity) {
+- return livingentity.hasEffect(MobEffects.WATER_BREATHING) || livingentity.hasEffect(MobEffects.CONDUIT_POWER);
++ public static boolean hasWaterBreathing(LivingEntity entity) {
++ return entity.hasEffect(MobEffects.WATER_BREATHING) || entity.hasEffect(MobEffects.CONDUIT_POWER);
+ }
+
+- public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel serverlevel, @Nullable Entity entity, Vec3 vec3, double d0, MobEffectInstance mobeffectinstance, int i) {
+- MobEffect mobeffect = mobeffectinstance.getEffect();
+- List<ServerPlayer> list = serverlevel.getPlayers((serverplayer) -> {
+- return serverplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) serverplayer)) && vec3.closerThan(serverplayer.position(), d0) && (!serverplayer.hasEffect(mobeffect) || serverplayer.getEffect(mobeffect).getAmplifier() < mobeffectinstance.getAmplifier() || serverplayer.getEffect(mobeffect).endsWithin(i - 1));
++ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance mobeffect, int effect) {
++ // CraftBukkit start
++ return addEffectToPlayersAround(level, source, pos, radius, mobeffect, effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
++ }
++
++ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
++ // CraftBukkit end
++ MobEffect mobeffectlist = mobeffect.getEffect();
++ List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
++ return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
+ });
+
+- list.forEach((serverplayer) -> {
+- serverplayer.addEffect(new MobEffectInstance(mobeffectinstance), entity);
++ list.forEach((entityplayer) -> {
++ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit
+ });
+ return list;
+ }
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/PoisonMobEffect.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/PoisonMobEffect.java.patch
new file mode 100644
index 0000000000..ef14fc65ec
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/PoisonMobEffect.java.patch
@@ -0,0 +1,31 @@
+--- a/net/minecraft/world/effect/PoisonMobEffect.java
++++ b/net/minecraft/world/effect/PoisonMobEffect.java
+@@ -4,22 +4,20 @@
+
+ class PoisonMobEffect extends MobEffect {
+
+- protected PoisonMobEffect(MobEffectCategory mobeffectcategory, int i) {
+- super(mobeffectcategory, i);
++ protected PoisonMobEffect(MobEffectCategory category, int color) {
++ super(category, color);
+ }
+
+ @Override
+- @Override
+- public void applyEffectTick(LivingEntity livingentity, int i) {
+- super.applyEffectTick(livingentity, i);
+- if (livingentity.getHealth() > 1.0F) {
+- livingentity.hurt(livingentity.damageSources().magic(), 1.0F);
++ public void applyEffectTick(LivingEntity livingEntity, int amplifier) {
++ super.applyEffectTick(livingEntity, amplifier);
++ if (livingEntity.getHealth() > 1.0F) {
++ livingEntity.hurt(livingEntity.damageSources().poison, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean shouldApplyEffectTickThisTick(int i, int j) {
+ int k = 25 >> j;
+
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/RegenerationMobEffect.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/RegenerationMobEffect.java.patch
new file mode 100644
index 0000000000..d907f473e0
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/RegenerationMobEffect.java.patch
@@ -0,0 +1,31 @@
+--- a/net/minecraft/world/effect/RegenerationMobEffect.java
++++ b/net/minecraft/world/effect/RegenerationMobEffect.java
+@@ -4,22 +4,20 @@
+
+ class RegenerationMobEffect extends MobEffect {
+
+- protected RegenerationMobEffect(MobEffectCategory mobeffectcategory, int i) {
+- super(mobeffectcategory, i);
++ protected RegenerationMobEffect(MobEffectCategory category, int color) {
++ super(category, color);
+ }
+
+ @Override
+- @Override
+- public void applyEffectTick(LivingEntity livingentity, int i) {
+- super.applyEffectTick(livingentity, i);
+- if (livingentity.getHealth() < livingentity.getMaxHealth()) {
+- livingentity.heal(1.0F);
++ public void applyEffectTick(LivingEntity livingEntity, int amplifier) {
++ super.applyEffectTick(livingEntity, amplifier);
++ if (livingEntity.getHealth() < livingEntity.getMaxHealth()) {
++ livingEntity.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean shouldApplyEffectTickThisTick(int i, int j) {
+ int k = 50 >> j;
+
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/SaturationMobEffect.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/SaturationMobEffect.java.patch
new file mode 100644
index 0000000000..592eaabf01
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/SaturationMobEffect.java.patch
@@ -0,0 +1,43 @@
+--- a/net/minecraft/world/effect/SaturationMobEffect.java
++++ b/net/minecraft/world/effect/SaturationMobEffect.java
+@@ -2,21 +2,32 @@
+
+ import net.minecraft.world.entity.LivingEntity;
+ import net.minecraft.world.entity.player.Player;
++// CraftBukkit start
++import org.bukkit.craftbukkit.entity.CraftPlayer;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
+
+ class SaturationMobEffect extends InstantenousMobEffect {
+
+- protected SaturationMobEffect(MobEffectCategory mobeffectcategory, int i) {
+- super(mobeffectcategory, i);
++ protected SaturationMobEffect(MobEffectCategory category, int color) {
++ super(category, color);
+ }
+
+ @Override
+- @Override
+- public void applyEffectTick(LivingEntity livingentity, int i) {
+- super.applyEffectTick(livingentity, i);
+- if (!livingentity.level().isClientSide && livingentity instanceof Player) {
+- Player player = (Player) livingentity;
++ public void applyEffectTick(LivingEntity livingEntity, int amplifier) {
++ super.applyEffectTick(livingEntity, amplifier);
++ if (!livingEntity.level().isClientSide && livingEntity instanceof Player) {
++ Player entityhuman = (Player) livingEntity;
+
+- player.getFoodData().eat(i + 1, 1.0F);
++ // CraftBukkit start
++ 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);
++ }
++
++ ((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate();
++ // CraftBukkit end
+ }
+
+ }