mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Pass predicate from default get hard colliding entities method
This commit is contained in:
parent
37df424eda
commit
368fc7c8c0
8 changed files with 51 additions and 203 deletions
|
@ -6,68 +6,75 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent
|
|||
This event is called when an entity receives knockback by another entity.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index a1cfa610eb3cc368b9641feeab709a4f5985ffbe..d94874b02ddcb640c9d94c99d83e77b2e55dce73 100644
|
||||
index a1cfa610eb3cc368b9641feeab709a4f5985ffbe..08141147f9795546e9397abed95834ed5e69a126 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -1085,7 +1085,9 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
@@ -1085,7 +1085,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
if (entity instanceof EntityLiving) {
|
||||
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper
|
||||
} else {
|
||||
entity.h((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F));
|
||||
}
|
||||
@@ -1109,7 +1111,9 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
@@ -1109,7 +1109,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {
|
||||
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 3997dc6d979bf5a027861397b948aa4e8486fc58..57521337ea5ad4b944cf7303d2b3f9b34431116a 100644
|
||||
index 3997dc6d979bf5a027861397b948aa4e8486fc58..75dca66206ecab6bcea32a05e33a638316786692 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -1479,7 +1479,9 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
@@ -1479,7 +1479,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
if (flag) {
|
||||
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
- ((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).doKnockback(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this);
|
||||
this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8..d0a389e6dc73202a3fa7c82eace1c92dece2982e 100644
|
||||
index 2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8..a62f769ab509edd30717cfca785449acecdf295e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1239,7 +1239,9 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1239,7 +1239,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
this.aw = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw);
|
||||
+ this.knockingBackEntity = entity1 instanceof EntityLiving ? ((EntityLiving) entity1) : null; // Paper
|
||||
this.a(0.4F, d0, d1);
|
||||
+ this.knockingBackEntity = null; // Paper
|
||||
- this.a(0.4F, d0, d1);
|
||||
+ this.doKnockback(0.4F, d0, d1, entity1); // Paper
|
||||
} else {
|
||||
this.aw = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||
}
|
||||
@@ -1287,7 +1289,9 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1287,7 +1287,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
protected void f(EntityLiving entityliving) {
|
||||
+ ((EntityLiving) entityliving).knockingBackEntity = this; // Paper
|
||||
entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ());
|
||||
+ ((EntityLiving) entityliving).knockingBackEntity = null; // Paper
|
||||
- entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ());
|
||||
+ entityliving.doKnockback(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ(), this);
|
||||
}
|
||||
|
||||
private boolean f(DamageSource damagesource) {
|
||||
@@ -1531,8 +1535,19 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1524,6 +1524,11 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void a(float f, double d0, double d1) {
|
||||
+ // Paper start - add knockbacking entity parameter
|
||||
+ this.doKnockback(f, d0, d1, null);
|
||||
+ }
|
||||
+ public void doKnockback(float f, double d0, double d1, Entity knockingBackEntity) {
|
||||
+ // Paper end - add knockbacking entity parameter
|
||||
f = (float) ((double) f * (1.0D - this.b(GenericAttributes.KNOCKBACK_RESISTANCE)));
|
||||
if (f > 0.0F) {
|
||||
this.impulse = true;
|
||||
@@ -1531,6 +1536,16 @@ public abstract class EntityLiving extends Entity {
|
||||
Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f);
|
||||
|
||||
this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
|
@ -83,7 +90,4 @@ index 2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8..d0a389e6dc73202a3fa7c82eace1c92d
|
|||
+ // Paper end
|
||||
}
|
||||
}
|
||||
+ EntityLiving knockingBackEntity; // Paper
|
||||
|
||||
@Nullable
|
||||
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 1249a7ae8fa8d6ea33cbc276717f1e4553f73b85..af554396fdb25719c158a81ccab76e91f5df2ff5 100644
|
||||
index d9e5d71a87140c90b79902887bd2f481f02956dc..afc665bfe9d527ca8d19f3ab9df0900d87f2d3f2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -2010,14 +2010,17 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
@@ -2006,14 +2006,17 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.datawatcher.set(EntityHuman.bs, nbttagcompound);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ index c2a3bd8f25e91f79723074d93f6a646a8ce76d8c..4934e71225fe1242615660a379e797e2
|
|||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
super.saveData(nbttagcompound);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db0956a52f31 100644
|
||||
index 4b249a644c680a7cc64b0d31cf453f94ff2b6a0c..d6a98bb7fc107649c179cded2d37c06a41146a89 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -95,7 +95,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -139,7 +139,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -1250,13 +1251,17 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1248,13 +1249,17 @@ public abstract class EntityLiving extends Entity {
|
||||
if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
|
||||
if (this.dk()) {
|
||||
if (!this.f(damagesource)) {
|
||||
|
@ -161,7 +161,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
}
|
||||
} else if (flag1) {
|
||||
this.c(damagesource);
|
||||
@@ -1396,6 +1401,7 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1392,6 +1397,7 @@ public abstract class EntityLiving extends Entity {
|
||||
Entity entity = damagesource.getEntity();
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
|
@ -169,7 +169,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
if (this.aV >= 0 && entityliving != null) {
|
||||
entityliving.a(this, this.aV, damagesource);
|
||||
}
|
||||
@@ -1407,16 +1413,36 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1403,16 +1409,36 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.isSleeping()) {
|
||||
this.entityWakeup();
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1424,7 +1450,7 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1420,7 +1446,7 @@ public abstract class EntityLiving extends Entity {
|
||||
if (!this.world.isClientSide) {
|
||||
boolean flag = false;
|
||||
|
||||
|
@ -217,7 +217,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
BlockPosition blockposition = this.getChunkCoordinates();
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
|
||||
@@ -1445,7 +1471,8 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1441,7 +1467,8 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ index c3f3a392f2b15a806c706b1e518282225b45bbc3..f5f043f0a5bafb7e432a541f9ef6db09
|
|||
Entity entity = damagesource.getEntity();
|
||||
int i;
|
||||
|
||||
@@ -1458,22 +1485,26 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -1454,22 +1481,26 @@ public abstract class EntityLiving extends Entity {
|
||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||
|
||||
this.dropInventory(); // CraftBukkit - from below
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add sun related API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 1b824bd3757b7e6723254c9cb2badaafbd2de2de..7c9b437d950623a978ca3d45c8ca57b39a897179 100644
|
||||
index 7a49e69bcc805330adbae7ec886f666e2b7e8310..4b196b031c382aa665520b46ebc146f6f6e830e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -1511,6 +1511,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
@@ -1509,6 +1509,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -847,10 +847,10 @@ index 0000000000000000000000000000000000000000..e61421d87a19bf2f6ce8836b48c445ff
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c5a7b186e96901d55680283500f423025ededbe8
|
||||
index 0000000000000000000000000000000000000000..8b8c2a0156fd936ea422b64ca6372fa6bd31be32
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
|
||||
@@ -0,0 +1,56 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.antixray;
|
||||
+
|
||||
+public final class DataBitsReader {
|
||||
|
@ -895,13 +895,9 @@ index 0000000000000000000000000000000000000000..c5a7b186e96901d55680283500f42302
|
|||
+ bitInLongIndex += bitsPerObject;
|
||||
+
|
||||
+ if (bitInLongIndex > 63) {
|
||||
+ bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
+ longInDataBitsIndex += 8;
|
||||
+ init();
|
||||
+
|
||||
+ if (bitInLongIndex > 0) {
|
||||
+ value |= current << bitsPerObject - bitInLongIndex & mask;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return value;
|
||||
|
@ -909,10 +905,10 @@ index 0000000000000000000000000000000000000000..c5a7b186e96901d55680283500f42302
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2eff19f6aaa31245f80910c6fbb541e32c672a31
|
||||
index 0000000000000000000000000000000000000000..5260882a319d5f897dd20e149d17077cb3f843ea
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
|
||||
@@ -0,0 +1,84 @@
|
||||
@@ -0,0 +1,79 @@
|
||||
+package com.destroystokyo.paper.antixray;
|
||||
+
|
||||
+public final class DataBitsWriter {
|
||||
|
@ -975,14 +971,9 @@ index 0000000000000000000000000000000000000000..2eff19f6aaa31245f80910c6fbb541e3
|
|||
+
|
||||
+ if (bitInLongIndex > 63) {
|
||||
+ finish();
|
||||
+ bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
+ longInDataBitsIndex += 8;
|
||||
+ init();
|
||||
+
|
||||
+ if (bitInLongIndex > 0) {
|
||||
+ current = current & ~(mask >>> bitsPerObject - bitInLongIndex) | (value & mask) >>> bitsPerObject - bitInLongIndex;
|
||||
+ dirty = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -991,7 +982,7 @@ index 0000000000000000000000000000000000000000..2eff19f6aaa31245f80910c6fbb541e3
|
|||
+
|
||||
+ if (bitInLongIndex > 63) {
|
||||
+ finish();
|
||||
+ bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
+ longInDataBitsIndex += 8;
|
||||
+ init();
|
||||
+ }
|
||||
|
|
|
@ -145,7 +145,7 @@ index 96f898acdeae1917a4aaf99ec4a48bccf3904488..73e9859e675902d9fc5942547966b524
|
|||
return this.children;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
index 74d4c28246e7db850e6d993e07a84b2a6ca24ce2..24705eef5514bfb078bea6f87e5457e73cee2d5e 100644
|
||||
index 74d4c28246e7db850e6d993e07a84b2a6ca24ce2..267a6baae89c181eed545e6758fac7115eb3882f 100644
|
||||
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
@@ -53,24 +53,36 @@ public interface IEntityAccess {
|
||||
|
@ -157,7 +157,7 @@ index 74d4c28246e7db850e6d993e07a84b2a6ca24ce2..24705eef5514bfb078bea6f87e5457e7
|
|||
+ * Not guaranteed to only return hard colliding entites
|
||||
+ */
|
||||
+ default List<Entity> getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate) {
|
||||
+ return this.getEntities(entity, axisalignedbb);
|
||||
+ return this.getEntities(entity, axisalignedbb, predicate);
|
||||
+ }
|
||||
+ // Paper end - optimise hard collision
|
||||
+
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Fri, 26 Jun 2020 14:10:10 -0700
|
||||
Subject: [PATCH] fixup! Anti-Xray
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
|
||||
index c5a7b186e96901d55680283500f423025ededbe8..8b8c2a0156fd936ea422b64ca6372fa6bd31be32 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
|
||||
@@ -42,13 +42,9 @@ public final class DataBitsReader {
|
||||
bitInLongIndex += bitsPerObject;
|
||||
|
||||
if (bitInLongIndex > 63) {
|
||||
- bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
longInDataBitsIndex += 8;
|
||||
init();
|
||||
-
|
||||
- if (bitInLongIndex > 0) {
|
||||
- value |= current << bitsPerObject - bitInLongIndex & mask;
|
||||
- }
|
||||
}
|
||||
|
||||
return value;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
|
||||
index 2eff19f6aaa31245f80910c6fbb541e32c672a31..5260882a319d5f897dd20e149d17077cb3f843ea 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
|
||||
@@ -60,14 +60,9 @@ public final class DataBitsWriter {
|
||||
|
||||
if (bitInLongIndex > 63) {
|
||||
finish();
|
||||
- bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
longInDataBitsIndex += 8;
|
||||
init();
|
||||
-
|
||||
- if (bitInLongIndex > 0) {
|
||||
- current = current & ~(mask >>> bitsPerObject - bitInLongIndex) | (value & mask) >>> bitsPerObject - bitInLongIndex;
|
||||
- dirty = true;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +71,7 @@ public final class DataBitsWriter {
|
||||
|
||||
if (bitInLongIndex > 63) {
|
||||
finish();
|
||||
- bitInLongIndex -= 64;
|
||||
+ bitInLongIndex = 0;
|
||||
longInDataBitsIndex += 8;
|
||||
init();
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Fri, 26 Jun 2020 14:28:49 -0700
|
||||
Subject: [PATCH] fixup! Implement EntityKnockbackByEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 3fa9e7b52b24629c96436fdd46d4e8c28c35f00e..2cada09ced1660526e9c112c2c8d92bbf9d6ea98 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -1094,9 +1094,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
if (entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
- ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
+ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper
|
||||
} else {
|
||||
entity.h((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F));
|
||||
}
|
||||
@@ -1120,9 +1118,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {
|
||||
- ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
- ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
+ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 61323f9b15350b1d227b2f3de67c40846ba7c2f9..677f88a44a92509d932f9bb7b1258a6ccecde256 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -1493,9 +1493,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
if (flag) {
|
||||
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||
- ((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||
- ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||
+ ((EntityLiving) entity).doKnockback(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this);
|
||||
this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 14606a12c472e0e58f76023a53a4129536ac5cc4..7a2140e4b901027997b2884275b35b43fe2175bc 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1240,9 +1240,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
this.aw = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw);
|
||||
- this.knockingBackEntity = entity1 instanceof EntityLiving ? ((EntityLiving) entity1) : null; // Paper
|
||||
- this.a(0.4F, d0, d1);
|
||||
- this.knockingBackEntity = null; // Paper
|
||||
+ this.doKnockback(0.4F, d0, d1, entity1); // Paper
|
||||
} else {
|
||||
this.aw = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||
}
|
||||
@@ -1294,9 +1292,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
protected void f(EntityLiving entityliving) {
|
||||
- ((EntityLiving) entityliving).knockingBackEntity = this; // Paper
|
||||
- entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ());
|
||||
- ((EntityLiving) entityliving).knockingBackEntity = null; // Paper
|
||||
+ entityliving.doKnockback(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ(), this);
|
||||
}
|
||||
|
||||
private boolean f(DamageSource damagesource) {
|
||||
@@ -1559,6 +1555,11 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void a(float f, double d0, double d1) {
|
||||
+ // Paper start - add knockbacking entity parameter
|
||||
+ this.doKnockback(f, d0, d1, null);
|
||||
+ }
|
||||
+ public void doKnockback(float f, double d0, double d1, Entity knockingBackEntity) {
|
||||
+ // Paper end - add knockbacking entity parameter
|
||||
f = (float) ((double) f * (1.0D - this.b(GenericAttributes.KNOCKBACK_RESISTANCE)));
|
||||
if (f > 0.0F) {
|
||||
this.impulse = true;
|
||||
@@ -1578,7 +1579,6 @@ public abstract class EntityLiving extends Entity {
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
- EntityLiving knockingBackEntity; // Paper
|
||||
|
||||
@Nullable
|
||||
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
Loading…
Reference in a new issue