From 9de529c4765a07a3c294d19a90282677f3816fe8 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:09:12 +0800 Subject: [PATCH] Fix --- .../0010-Make-snowball-and-egg-can-knockback-player.patch | 8 ++++---- patches/server/0011-Fakeplayer-support.patch | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/patches/server/0010-Make-snowball-and-egg-can-knockback-player.patch b/patches/server/0010-Make-snowball-and-egg-can-knockback-player.patch index d0bd5cd9..5842810c 100644 --- a/patches/server/0010-Make-snowball-and-egg-can-knockback-player.patch +++ b/patches/server/0010-Make-snowball-and-egg-can-knockback-player.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make snowball and egg can knockback player diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java -index 2b4d206c0d31ba38d7b2af654bd420e85145d441..21b1244a51aa96e769bb568ff7e682e4a583269d 100644 +index 2b4d206c0d31ba38d7b2af654bd420e85145d441..9711279772d1617395c6fc34ae0b4bea6a215fae 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java @@ -3,6 +3,7 @@ package net.minecraft.world.entity.projectile; @@ -24,14 +24,14 @@ index 2b4d206c0d31ba38d7b2af654bd420e85145d441..21b1244a51aa96e769bb568ff7e682e4 + // Leaves start - make snowball can knockback player + if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof ServerPlayer) { + entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); -+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.DAMAGE); ++ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); + } + // Leaves end - make snowball can knockback player } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -index 82bb8004635865f5202578d5a6f520048e7269d5..2b8d8330e7edfd23344c31b064c12348206dec48 100644 +index 82bb8004635865f5202578d5a6f520048e7269d5..22eae2f5fb8b5b767003e130014e3962d7522fd4 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java @@ -46,7 +46,14 @@ public class ThrownEgg extends ThrowableItemProjectile { @@ -43,7 +43,7 @@ index 82bb8004635865f5202578d5a6f520048e7269d5..2b8d8330e7edfd23344c31b064c12348 + // Leaves start - make egg can knockback player + if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof ServerPlayer) { + entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); -+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.DAMAGE); ++ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); + } + // Leaves end - make egg can knockback player } diff --git a/patches/server/0011-Fakeplayer-support.patch b/patches/server/0011-Fakeplayer-support.patch index 1ee98757..385e049b 100644 --- a/patches/server/0011-Fakeplayer-support.patch +++ b/patches/server/0011-Fakeplayer-support.patch @@ -1318,7 +1318,7 @@ index 0000000000000000000000000000000000000000..0db337866c71283464d026a4f230016b +} diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java new file mode 100644 -index 0000000000000000000000000000000000000000..73d5148108d7a7dd52d061cb778b2c98a71f456e +index 0000000000000000000000000000000000000000..bba57a2d72ab3051aacd4f4defa3e7377511c36b --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java @@ -0,0 +1,716 @@ @@ -1330,6 +1330,7 @@ index 0000000000000000000000000000000000000000..73d5148108d7a7dd52d061cb778b2c98 +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; ++import io.papermc.paper.event.entity.EntityKnockbackEvent; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.network.Connection; @@ -1374,7 +1375,6 @@ index 0000000000000000000000000000000000000000..73d5148108d7a7dd52d061cb778b2c98 +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.scheduler.CraftScheduler; +import org.bukkit.event.entity.CreatureSpawnEvent; -+import org.bukkit.event.entity.EntityKnockbackEvent; +import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; +import org.leavesmc.leaves.LeavesConfig; @@ -1768,7 +1768,7 @@ index 0000000000000000000000000000000000000000..73d5148108d7a7dd52d061cb778b2c98 + } + + @Override -+ public void knockback(double strength, double x, double z, @Nullable Entity knockingBackEntity, EntityKnockbackEvent.@NotNull KnockbackCause cause) { ++ public void knockback(double strength, double x, double z, @Nullable Entity attacker, @NotNull EntityKnockbackEvent.Cause cause) { + strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); + if (strength > 0.0D) { + this.hasImpulse = true;