Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jun 3, 2024
1 parent 311925f commit 9de529c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0011-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9de529c

Please sign in to comment.