mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
--------- Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> Co-authored-by: Fortern <blueten.ki@gmail.com> Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com> Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com> Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
41 lines
2.5 KiB
Diff
41 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Fri, 28 Jan 2022 18:34:29 +0800
|
|
Subject: [PATCH] Make snowball and egg can knockback player
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java
|
|
index 677b4b681f9c2c09a8ae3cfdec72102265547a7b..1474cf208019cd46ca767374bceb3c9c31fdeab2 100644
|
|
--- a/net/minecraft/world/entity/projectile/Snowball.java
|
|
+++ b/net/minecraft/world/entity/projectile/Snowball.java
|
|
@@ -54,6 +54,12 @@ public class Snowball extends ThrowableItemProjectile {
|
|
Entity entity = result.getEntity();
|
|
int i = entity instanceof Blaze ? 3 : 0;
|
|
entity.hurt(this.damageSources().thrown(this, this.getOwner()), i);
|
|
+ // Leaves start - make snowball can knockback player
|
|
+ if (org.leavesmc.leaves.LeavesConfig.modify.snowballAndEggCanKnockback && entity instanceof net.minecraft.server.level.ServerPlayer player) {
|
|
+ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
|
+ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
|
|
+ }
|
|
+ // Leaves end - make snowball can knockback player
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..6583f983129b2a90bd44104de9f4f992fa21a00c 100644
|
|
--- a/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
+++ b/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
@@ -55,6 +55,12 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
|
protected void onHitEntity(EntityHitResult result) {
|
|
super.onHitEntity(result);
|
|
result.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
|
|
+ // Leaves start - make egg can knockback player
|
|
+ if (org.leavesmc.leaves.LeavesConfig.modify.snowballAndEggCanKnockback && result.getEntity() instanceof net.minecraft.server.level.ServerPlayer player) {
|
|
+ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
|
+ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
|
|
+ }
|
|
+ // Leaves end - make egg can knockback player
|
|
}
|
|
|
|
@Override
|