geforkt von Mirrors/Paper
fix knockback events (#10831)
* fix knockback events * squash * handle cancelled event for explosions
Dieser Commit ist enthalten in:
Ursprung
06e69c8991
Commit
a47e11d464
@ -1,180 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:40:39 +0200
|
||||
Subject: [PATCH] Add EntityKnockbackByEntityEvent and
|
||||
EntityPushedByEntityAttackEvent
|
||||
|
||||
Co-authored-by: aerulion <aerulion@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e0ba692c9b107f2b042a9c06549185e1c4777e27
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
|
||||
+ * vector can be modified. If this event is cancelled, the entity is not knocked back.
|
||||
+ */
|
||||
+public class EntityKnockbackByEntityEvent extends EntityPushedByEntityAttackEvent {
|
||||
+
|
||||
+ private final float knockbackStrength;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackByEntityEvent(@NotNull LivingEntity entity, @NotNull Entity hitBy, float knockbackStrength, @NotNull Vector acceleration) {
|
||||
+ super(entity, hitBy, acceleration);
|
||||
+ this.knockbackStrength = knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the entity which was knocked back
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the original knockback strength.
|
||||
+ */
|
||||
+ public float getKnockbackStrength() {
|
||||
+ return this.knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the Entity which hit
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getHitBy() {
|
||||
+ return super.getPushedBy();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..404bec776244fd776566c81f671f1009830c6d6e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
@@ -0,0 +1,82 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an entity is pushed by another entity's attack. The acceleration vector can be
|
||||
+ * modified. If this event is cancelled, the entity will not get pushed.
|
||||
+ * <p>
|
||||
+ * Note: Some entities might trigger this multiple times on the same entity
|
||||
+ * as multiple acceleration calculations are done.
|
||||
+ */
|
||||
+public class EntityPushedByEntityAttackEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final @NotNull Entity pushedBy;
|
||||
+ private @NotNull Vector acceleration;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPushedByEntityAttackEvent(@NotNull Entity entity, @NotNull Entity pushedBy, @NotNull Vector acceleration) {
|
||||
+ super(entity);
|
||||
+ this.pushedBy = pushedBy;
|
||||
+ this.acceleration = acceleration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity which pushed the affected entity.
|
||||
+ *
|
||||
+ * @return the pushing entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getPushedBy() {
|
||||
+ return this.pushedBy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the acceleration that will be applied to the affected entity.
|
||||
+ *
|
||||
+ * @return the acceleration vector
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Vector getAcceleration() {
|
||||
+ return this.acceleration; // TODO Clone in 1.21 to not instantly break what was technically already modifiable
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the relative acceleration that will be applied to the affected entity.
|
||||
+ *
|
||||
+ * @param acceleration the new acceleration vector
|
||||
+ */
|
||||
+ public void setAcceleration(final @NotNull Vector acceleration) {
|
||||
+ this.acceleration = acceleration.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
index 3f17290c0863cc1d452bb50c524c18b6ab255d70..bd44bc5ed9e20148f9b2ab3d2049187280f3eb18 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -7,7 +7,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when an entity receives knockback from another entity.
|
||||
+ *
|
||||
+ * @deprecated use {@link com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent}
|
||||
*/
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public class EntityKnockbackByEntityEvent extends EntityKnockbackEvent {
|
||||
|
||||
private final Entity source;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
index 9355efbbd4625e34d6c9d26bcbd02272202dec79..fe3374fbbfef728358e4a15bbf2deb238a1e0bfd 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
@@ -11,7 +11,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a living entity receives knockback.
|
||||
+ *
|
||||
+ * @deprecated use {@link com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent} or {@link io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent}
|
||||
*/
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public class EntityKnockbackEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
293
patches/api/0114-Add-entity-knockback-events.patch
Normale Datei
293
patches/api/0114-Add-entity-knockback-events.patch
Normale Datei
@ -0,0 +1,293 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:40:39 +0200
|
||||
Subject: [PATCH] Add entity knockback events
|
||||
|
||||
- EntityKnockbackEvent
|
||||
- EntityPushedByEntityAttackEvent
|
||||
- EntityKnockbackByEntityEvent
|
||||
|
||||
Co-authored-by: aerulion <aerulion@gmail.com>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..beb1715e30ec476e3031c247285d0d3219e8a8ea
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -0,0 +1,51 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import io.papermc.paper.event.entity.EntityKnockbackEvent;
|
||||
+import io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
|
||||
+ * vector can be modified. If this event is cancelled, the entity is not knocked back.
|
||||
+ */
|
||||
+public class EntityKnockbackByEntityEvent extends EntityPushedByEntityAttackEvent {
|
||||
+
|
||||
+ private final float knockbackStrength;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackByEntityEvent(final @NonNull LivingEntity entity, final @NonNull Entity hitBy, final EntityKnockbackEvent.@NonNull Cause cause, final float knockbackStrength, final @NonNull Vector knockback) {
|
||||
+ super(entity, cause, hitBy, knockback);
|
||||
+ this.knockbackStrength = knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the entity which was knocked back
|
||||
+ */
|
||||
+ @Override
|
||||
+ public @NonNull LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the original knockback strength.
|
||||
+ * @apiNote this value doesn't necessarily relate to {@link #getKnockback()}.
|
||||
+ */
|
||||
+ @ApiStatus.Obsolete(since = "1.20.6")
|
||||
+ public float getKnockbackStrength() {
|
||||
+ return this.knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the causing entity. Same as {@link #getPushedBy()}.
|
||||
+ *
|
||||
+ * @return the Entity which hit
|
||||
+ */
|
||||
+ public @NonNull Entity getHitBy() {
|
||||
+ return super.getPushedBy();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8aaafa4ea837f54b32497010d121f02b103e03a6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java
|
||||
@@ -0,0 +1,116 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity receives knockback.
|
||||
+ * @see EntityPushedByEntityAttackEvent
|
||||
+ * @see com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent
|
||||
+ */
|
||||
+public class EntityKnockbackEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Cause cause;
|
||||
+ protected Vector knockback;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackEvent(final @NonNull Entity entity, final EntityKnockbackEvent.@NonNull Cause cause, final @NonNull Vector knockback) {
|
||||
+ super(entity);
|
||||
+ this.cause = cause;
|
||||
+ this.knockback = knockback;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cause of the knockback.
|
||||
+ *
|
||||
+ * @return the cause of the knockback
|
||||
+ */
|
||||
+ public EntityKnockbackEvent.@NonNull Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the knockback force that will be applied to the entity. <br>
|
||||
+ * This value is read-only, changes made to it <b>will not</b> have any
|
||||
+ * effect on the final knockback received. Use {@link #setKnockback(Vector)}
|
||||
+ * to make changes.
|
||||
+ *
|
||||
+ * @return the knockback
|
||||
+ */
|
||||
+ public @NonNull Vector getKnockback() {
|
||||
+ return this.knockback.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the knockback force that will be applied to the entity.
|
||||
+ *
|
||||
+ * @param knockback the knockback
|
||||
+ */
|
||||
+ public void setKnockback(final @NonNull Vector knockback) {
|
||||
+ Preconditions.checkArgument(knockback != null, "knockback");
|
||||
+ this.knockback = knockback.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NonNull HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * An enum to specify the cause of the knockback.
|
||||
+ */
|
||||
+ public enum Cause {
|
||||
+
|
||||
+ /**
|
||||
+ * Knockback caused by non-entity damage.
|
||||
+ */
|
||||
+ DAMAGE,
|
||||
+ /**
|
||||
+ * Knockback caused by an attacking entity.
|
||||
+ */
|
||||
+ ENTITY_ATTACK,
|
||||
+ /**
|
||||
+ * Knockback caused by an explosion.
|
||||
+ */
|
||||
+ EXPLOSION,
|
||||
+ /**
|
||||
+ * Knockback caused by the target blocking with a shield.
|
||||
+ */
|
||||
+ SHIELD_BLOCK,
|
||||
+ /**
|
||||
+ * Knockback caused by a sweeping attack.
|
||||
+ */
|
||||
+ SWEEP_ATTACK,
|
||||
+ /**
|
||||
+ * A generic push.
|
||||
+ */
|
||||
+ PUSH,
|
||||
+ /**
|
||||
+ * Knockback with an unknown cause.
|
||||
+ */
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b9d2a7a5bc4e67d8c36047da616046cbedce1d4a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java
|
||||
@@ -0,0 +1,66 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an entity is pushed by another entity's attack. The acceleration vector can be
|
||||
+ * modified. If this event is cancelled, the entity will not get pushed.
|
||||
+ * <p>
|
||||
+ * Note: Some entities might trigger this multiple times on the same entity
|
||||
+ * as multiple acceleration calculations are done.
|
||||
+ */
|
||||
+public class EntityPushedByEntityAttackEvent extends EntityKnockbackEvent implements Cancellable {
|
||||
+
|
||||
+ private final Entity pushedBy;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPushedByEntityAttackEvent(final @NonNull Entity entity, final EntityKnockbackEvent.@NonNull Cause cause, final @NonNull Entity pushedBy, final @NonNull Vector knockback) {
|
||||
+ super(entity, cause, knockback);
|
||||
+ this.pushedBy = pushedBy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity which pushed the affected entity.
|
||||
+ *
|
||||
+ * @return the pushing entity
|
||||
+ */
|
||||
+ public @NonNull Entity getPushedBy() {
|
||||
+ return this.pushedBy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the acceleration that will be applied to the affected entity.
|
||||
+ *
|
||||
+ * @return the acceleration vector
|
||||
+ * @deprecated use {@link #getKnockback()}
|
||||
+ */
|
||||
+ @Deprecated(since = "1.20.6", forRemoval = true)
|
||||
+ public @NonNull Vector getAcceleration() {
|
||||
+ return this.knockback; // TODO Clone in 1.21 to not instantly break what was technically already modifiable (call super.getKnockback())
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the relative acceleration that will be applied to the affected entity.
|
||||
+ *
|
||||
+ * @param acceleration the new acceleration vector
|
||||
+ * @deprecated use {@link #setKnockback(Vector)}
|
||||
+ */
|
||||
+ @Deprecated(since = "1.20.6", forRemoval = true)
|
||||
+ public void setAcceleration(final @NonNull Vector acceleration) {
|
||||
+ super.setKnockback(acceleration);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return super.isCancelled();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ super.setCancelled(cancel);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
index 3f17290c0863cc1d452bb50c524c18b6ab255d70..bd44bc5ed9e20148f9b2ab3d2049187280f3eb18 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -7,7 +7,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when an entity receives knockback from another entity.
|
||||
+ *
|
||||
+ * @deprecated use {@link com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent}
|
||||
*/
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public class EntityKnockbackByEntityEvent extends EntityKnockbackEvent {
|
||||
|
||||
private final Entity source;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
index 9355efbbd4625e34d6c9d26bcbd02272202dec79..753e6f30da4f3dc9d5ed7d1b40d30b602b8c8c9e 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java
|
||||
@@ -11,7 +11,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a living entity receives knockback.
|
||||
+ *
|
||||
+ * @deprecated use {@link io.papermc.paper.event.entity.EntityKnockbackEvent}
|
||||
*/
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public class EntityKnockbackEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
@ -1,18 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:46:23 +0200
|
||||
Subject: [PATCH] Add EntityKnockbackByEntityEvent and
|
||||
EntityPushedByEntityAttackEvent
|
||||
Subject: [PATCH] Add entity knockback events
|
||||
|
||||
- EntityKnockbackEvent
|
||||
- EntityPushedByEntityAttackEvent
|
||||
- EntityKnockbackByEntityEvent
|
||||
|
||||
Co-authored-by: aerulion <aerulion@gmail.com>
|
||||
|
||||
This event is called when an entity receives knockback by another entity.
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 655ce0b58cc327a8dac1b006bec7dcb34964da0a..2777ed6f072af1733467c9f354bae0c5c967eea1 100644
|
||||
index 655ce0b58cc327a8dac1b006bec7dcb34964da0a..afc2e4a3eda78a47209581307c100663cdeb1afb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1891,9 +1891,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1891,8 +1891,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,66 +28,86 @@ index 655ce0b58cc327a8dac1b006bec7dcb34964da0a..2777ed6f072af1733467c9f354bae0c5
|
||||
+ public void push(double deltaX, double deltaY, double deltaZ, @org.jetbrains.annotations.Nullable Entity pushingEntity) {
|
||||
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(deltaX, deltaY, deltaZ);
|
||||
+ if (pushingEntity != null) {
|
||||
+ io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent event = new io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent(getBukkitEntity(), pushingEntity.getBukkitEntity(), delta);
|
||||
+ io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent event = new io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent(this.getBukkitEntity(), io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.PUSH, pushingEntity.getBukkitEntity(), delta);
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ delta = event.getAcceleration();
|
||||
+ delta = event.getKnockback();
|
||||
+ }
|
||||
+ this.setDeltaMovement(this.getDeltaMovement().add(delta.getX(), delta.getY(), delta.getZ()));
|
||||
this.hasImpulse = true;
|
||||
+ // Paper end - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
protected void markHurt() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index b10d532d81efa8330f363f86d5a19e8847b90ba0..8baf8f715d68c96133085d625599ab2aa30bb83c 100644
|
||||
index b10d532d81efa8330f363f86d5a19e8847b90ba0..6cc1a7ea24ebd32b898d440abf5c1f6121239ec8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1540,7 +1540,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? EntityKnockbackEvent.KnockbackCause.DAMAGE : EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
+ this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1593,7 +1593,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), null, EntityKnockbackEvent.KnockbackCause.SHIELD_BLOCK); // CraftBukkit
|
||||
+ target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this, EntityKnockbackEvent.KnockbackCause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker
|
||||
+ target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -1856,7 +1856,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.knockback(strength, x, z, null, EntityKnockbackEvent.KnockbackCause.UNKNOWN);
|
||||
@@ -1853,23 +1853,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public void knockback(double strength, double x, double z) {
|
||||
// CraftBukkit start - EntityKnockbackEvent
|
||||
- this.knockback(strength, x, z, null, EntityKnockbackEvent.KnockbackCause.UNKNOWN);
|
||||
+ this.knockback(strength, x, z, null, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.UNKNOWN); // Paper - knockback events
|
||||
}
|
||||
|
||||
- public void knockback(double d0, double d1, double d2, Entity attacker, EntityKnockbackEvent.KnockbackCause cause) {
|
||||
+ public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, EntityKnockbackEvent.KnockbackCause cause) { // Paper - add nullable to attacker param
|
||||
+ public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause) { // Paper - knockback events
|
||||
d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
//this.hasImpulse = true; // CraftBukkit - Move down
|
||||
@@ -1868,8 +1868,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
|
||||
- EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, vec3d1, vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ // Paper start - knockback events
|
||||
+ Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ Vec3 diff = finalVelocity.subtract(vec3d);
|
||||
+ io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, diff);
|
||||
+ // Paper end - knockback events
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Paper start - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
+ final org.bukkit.util.Vector currentMovement = this.getBukkitEntity().getVelocity();
|
||||
+ org.bukkit.util.Vector resultingMovement = event.getFinalKnockback();
|
||||
+ final org.bukkit.util.Vector deltaMovement = resultingMovement.clone().subtract(currentMovement);
|
||||
+ if (attacker != null) {
|
||||
+ final com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent knockbackEvent = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(this.getBukkitLivingEntity(), attacker.getBukkitEntity(), (float) event.getForce(), deltaMovement);
|
||||
+ if (!knockbackEvent.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Back from delta to the absolute vector
|
||||
+ resultingMovement = currentMovement.add(knockbackEvent.getAcceleration());
|
||||
+ }
|
||||
this.hasImpulse = true;
|
||||
- this.setDeltaMovement(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ());
|
||||
+ this.setDeltaMovement(resultingMovement.getX(), resultingMovement.getY(), resultingMovement.getZ());
|
||||
+ // Paper end - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
+ this.setDeltaMovement(vec3d.add(event.getKnockback().getX(), event.getKnockback().getY(), event.getKnockback().getZ())); // Paper - knockback events
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 6b802f8f214e5cf2bac145e88bf8e39040cec7ea..42d374959909ae13376055c869b6f5e493a710a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1789,7 +1789,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||
|
||||
if (flag) {
|
||||
if (f1 > 0.0F && target instanceof LivingEntity) {
|
||||
- ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
+ ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
|
||||
index 312398b7f1281144a0529a743d2a09376d575ff5..0c63779af7e1c790160fb2ab86bf455219b3cc36 100644
|
||||
index 312398b7f1281144a0529a743d2a09376d575ff5..51fc1574d195b17fd1dc42907de3bb0e451af457 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
|
||||
@@ -83,7 +83,7 @@ public class RamTarget extends Behavior<Goat> {
|
||||
@ -93,7 +115,7 @@ index 312398b7f1281144a0529a743d2a09376d575ff5..0c63779af7e1c790160fb2ab86bf4552
|
||||
float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f;
|
||||
float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F;
|
||||
- livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z());
|
||||
+ livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
+ livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
this.finishRam(world, entity);
|
||||
world.playSound(null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
} else if (this.hasRammedHornBreakingBlock(world, entity)) {
|
||||
@ -179,20 +201,32 @@ index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a14
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 338903091e43b71baa46157a95629c2e6b27b992..0efd7b3d748d90b3359560aa717a017092ae0e47 100644
|
||||
index 338903091e43b71baa46157a95629c2e6b27b992..03129c45fec4da4d124ed18101517e5ab696bbcd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1295,7 +1295,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1293,9 +1293,9 @@ public abstract class Player extends LivingEntity {
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
if (target instanceof LivingEntity) {
|
||||
((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
- ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
+ ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
} else {
|
||||
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
|
||||
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
}
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
@@ -1317,7 +1317,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
|
||||
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
|
||||
+ entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd..464ba41fd284e29374dbc81c984cf9486e51393e 100644
|
||||
index efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd..ccb5de967a83c01b69161af0c1c922fc31c7a0d9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -421,7 +421,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
@ -200,7 +234,7 @@ index efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd..464ba41fd284e29374dbc81c984cf948
|
||||
|
||||
if (vec3d.lengthSqr() > 0.0D) {
|
||||
- entityliving.push(vec3d.x, 0.1D, vec3d.z);
|
||||
+ entityliving.push(vec3d.x, 0.1D, vec3d.z, this); // Paper
|
||||
+ entityliving.push(vec3d.x, 0.1D, vec3d.z, this); // Paper - pass causing entity for knockback events
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,23 +252,69 @@ index 9f9b7373c9a714597858ddcd8932e31b902cf5a1..f7f26d595072372004143c4e26506ed5
|
||||
public abstract void explode();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index da9a9b235d1c8bcab3762134d69dcb112470e55d..a24e9c9e80659b5508e3c5ef3fa3d1a26b96b483 100644
|
||||
index da9a9b235d1c8bcab3762134d69dcb112470e55d..d15f216193613504c456d63a1c358973afad3ed1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -303,6 +303,16 @@ public class Explosion {
|
||||
// since the code below (the setDeltaMovement call as well as the hitPlayers map)
|
||||
// want the vector to be the relative velocity will the event provides the absolute velocity
|
||||
vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
|
||||
+ // Paper start - call EntityKnockbackByEntityEvent for explosions
|
||||
+ if (this.damageSource.getEntity() != null || this.source != null) {
|
||||
+ final org.bukkit.entity.Entity hitBy = this.damageSource.getEntity() != null ? this.damageSource.getEntity().getBukkitEntity() : this.source.getBukkitEntity();
|
||||
+ com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent paperEvent = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(((LivingEntity) entity).getBukkitLivingEntity(), hitBy, (float) event.getForce(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(vec3d1));
|
||||
+ if (!paperEvent.callEvent()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ vec3d1 = org.bukkit.craftbukkit.util.CraftVector.toNMS(paperEvent.getAcceleration());
|
||||
+ }
|
||||
+ // Paper end - call EntityKnockbackByEntityEvent for explosions
|
||||
@@ -296,13 +296,10 @@ public class Explosion {
|
||||
|
||||
// CraftBukkit start - Call EntityKnockbackEvent
|
||||
if (entity instanceof LivingEntity) {
|
||||
- Vec3 result = entity.getDeltaMovement().add(vec3d1);
|
||||
- org.bukkit.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.source, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.EXPLOSION, d13, vec3d1, result.x, result.y, result.z);
|
||||
-
|
||||
- // SPIGOT-7640: Need to subtract entity movement from the event result,
|
||||
- // since the code below (the setDeltaMovement call as well as the hitPlayers map)
|
||||
- // want the vector to be the relative velocity will the event provides the absolute velocity
|
||||
- vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
|
||||
+ // Paper start - knockback events
|
||||
+ io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.damageSource.getEntity() != null ? this.damageSource.getEntity() : this.source, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.EXPLOSION, d13, vec3d1);
|
||||
+ vec3d1 = event.isCancelled() ? Vec3.ZERO : org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getKnockback());
|
||||
+ // Paper end - knockback events
|
||||
}
|
||||
// CraftBukkit end
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index d4c44ff13f657343ec19de5e6cef7639330a5e88..fbbb0689b4c6552a3e73390363756e6308b32523 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1861,19 +1861,33 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
- public static EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity attacker, EntityKnockbackEvent.KnockbackCause cause, double force, Vec3 raw, double x, double y, double z) {
|
||||
- Vector bukkitRaw = new Vector(-raw.x, raw.y, -raw.z); // Due to how the knockback calculation works, we need to invert x and z.
|
||||
-
|
||||
- EntityKnockbackEvent event;
|
||||
+ // Paper start - replace knockback events
|
||||
+ public static io.papermc.paper.event.entity.EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause, double force, Vec3 knockback) {
|
||||
+ Vector apiKnockback = CraftVector.toBukkit(knockback);
|
||||
+
|
||||
+ final Vector currentVelocity = entity.getVelocity();
|
||||
+ final Vector legacyFinalKnockback = currentVelocity.clone().add(apiKnockback);
|
||||
+ final org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause legacyCause = org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.valueOf(cause.name());
|
||||
+ EntityKnockbackEvent legacyEvent;
|
||||
if (attacker != null) {
|
||||
- event = new EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z));
|
||||
+ legacyEvent = new EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), legacyCause, force, apiKnockback, legacyFinalKnockback);
|
||||
} else {
|
||||
- event = new EntityKnockbackEvent(entity, cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z));
|
||||
+ legacyEvent = new EntityKnockbackEvent(entity, legacyCause, force, apiKnockback, legacyFinalKnockback);
|
||||
}
|
||||
+ legacyEvent.callEvent();
|
||||
|
||||
- Bukkit.getPluginManager().callEvent(event);
|
||||
+ final io.papermc.paper.event.entity.EntityKnockbackEvent event;
|
||||
+ apiKnockback = legacyEvent.getFinalKnockback().subtract(currentVelocity);
|
||||
+ if (attacker != null) {
|
||||
+ event = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, (float) force, apiKnockback);
|
||||
+ } else {
|
||||
+ event = new io.papermc.paper.event.entity.EntityKnockbackEvent(entity, cause, apiKnockback);
|
||||
+ }
|
||||
+ event.setCancelled(legacyEvent.isCancelled());
|
||||
+ event.callEvent();
|
||||
return event;
|
||||
}
|
||||
+ // Paper end - replace knockback events
|
||||
|
||||
public static void callEntityRemoveEvent(Entity entity, EntityRemoveEvent.Cause cause) {
|
||||
if (entity instanceof ServerPlayer) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 8baf8f715d68c96133085d625599ab2aa30bb83c..12e205a01366a5825fd1b99097f1cef75dc0408e 100644
|
||||
index 6cc1a7ea24ebd32b898d440abf5c1f6121239ec8..7fffb8ee4474a4a39e77350e5b49feb8dac08cc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3938,6 +3938,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3928,6 +3928,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
// Paper start - Make shield blocking delay configurable
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 3b9bd1e1043d7388c03936d5b131e9e288fb8fec..9bb2b2baecfd4cfb9dbbf7cf5c8be939f1ecc4d6 100644
|
||||
index a4118a6109154b7d9c21023ac6bb10e521fe368d..4f63352f9f96b104e3a01929d96ee33dcd01ab7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -121,6 +121,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
|
||||
@ -16,7 +16,7 @@ index 3b9bd1e1043d7388c03936d5b131e9e288fb8fec..9bb2b2baecfd4cfb9dbbf7cf5c8be939
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
@@ -4002,6 +4003,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3992,6 +3993,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.level().clip(raytrace);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ index 665fcf8382fbcb214eda16dae9e40e33e257ec6f..2313c451dbcb28e79d8ff139696e2efb
|
||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4da4a0af7df25a913c48e9302ff47465c07e57af..82a54b40884d6c161f6f9935602ac107d7730338 100644
|
||||
index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa03f4b4f20 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2600,17 +2600,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@ -106,10 +106,10 @@ index 4da4a0af7df25a913c48e9302ff47465c07e57af..82a54b40884d6c161f6f9935602ac107
|
||||
if (this.valid) {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9bb2b2baecfd4cfb9dbbf7cf5c8be939f1ecc4d6..27912ca1a9825db67e77886da01ab843bd0b005b 100644
|
||||
index 4f63352f9f96b104e3a01929d96ee33dcd01ab7d..cc5cafa8388d96e18494d3c89f36d1654ea44f7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3585,9 +3585,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3575,9 +3575,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@Override
|
||||
public void stopRiding() {
|
||||
@ -146,7 +146,7 @@ index 509c8fae366e6aeca324b4d8e39bd3182d6d9b9b..c2005b86ac9ff6aa03ef7937c2b7a228
|
||||
this.clientOldAttachPosition = this.blockPosition();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index b27a6719edd47f7ecb3f8c5560a36fc201efea36..62a855594b5b87b92e18f47b84a18b99df1e33c7 100644
|
||||
index 8f7bce51e393074246575b0d8bb3cad68ecb4270..e60385c2b84ca0807ed5fc710017a1de09aa3c4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1150,7 +1150,13 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 47b1a4ec278cf9762c9eb9c1448cf78912b7d77a..ebdc95a04400ab71a261a1a4fd6e4477ee9d3122 100644
|
||||
index cc5cafa8388d96e18494d3c89f36d1654ea44f7d..58dacb52494972698b2d3740ed1cbe53e5264771 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3821,9 +3821,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3811,9 +3811,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void startUsingItem(InteractionHand hand) {
|
||||
@ -24,7 +24,7 @@ index 47b1a4ec278cf9762c9eb9c1448cf78912b7d77a..ebdc95a04400ab71a261a1a4fd6e4477
|
||||
this.useItem = itemstack;
|
||||
this.useItemRemaining = itemstack.getUseDuration();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -3903,6 +3908,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3893,6 +3898,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.releaseUsingItem();
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
@ -32,7 +32,7 @@ index 47b1a4ec278cf9762c9eb9c1448cf78912b7d77a..ebdc95a04400ab71a261a1a4fd6e4477
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
// CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
ItemStack itemstack;
|
||||
@@ -3937,8 +3943,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3927,8 +3933,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.stopUsingItem();
|
||||
|
@ -7,10 +7,10 @@ Subject: [PATCH] Entity Jump API
|
||||
public net.minecraft.world.entity.LivingEntity jumping
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index ebdc95a04400ab71a261a1a4fd6e4477ee9d3122..fa9da0e3b9fc579f16c3b05c8c45310940e68d62 100644
|
||||
index 58dacb52494972698b2d3740ed1cbe53e5264771..575f6b542a7c5c9a3f96a0e4e78f75f7dc060cd7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3401,8 +3401,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3391,8 +3391,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
|
||||
this.jumpInLiquid(FluidTags.LAVA);
|
||||
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
|
||||
|
@ -12,10 +12,10 @@ The entity's current team collision rule causes them to NEVER collide.
|
||||
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index fa9da0e3b9fc579f16c3b05c8c45310940e68d62..b8ea7830f9dc1b4ee0052bf3b83127c415cc8085 100644
|
||||
index 575f6b542a7c5c9a3f96a0e4e78f75f7dc060cd7..8c95f08302439c7bd36ae9834ea991b29c435cfa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3512,10 +3512,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3502,10 +3502,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.level().isClientSide()) {
|
||||
this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
|
||||
} else {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index b8ea7830f9dc1b4ee0052bf3b83127c415cc8085..2f3615cb8e4206ed2eb87c1341de4258879d3907 100644
|
||||
index 8c95f08302439c7bd36ae9834ea991b29c435cfa..166502bdeb4e20a122c023935f48047debc69bbd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2264,7 +2264,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2254,7 +2254,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
||||
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 5280bae3ad8f9c137e58add8a8d056df81de9928..33658a45d9f61640ab2b56be3fecb5b2552bca84 100644
|
||||
index 4b64e3575302fb7238bd647af409b85d69f4798a..34e89959a1ec8d391709373e02e7da928ca69770 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3624,7 +3624,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3614,7 +3614,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0a51ea55a6b768d71161c4492664a61ec1e5df15..0328738d613358a9042b1d12de511f212db68244 100644
|
||||
index 4187fc3722b7e27ccf4fcb2617c00c3af8241f9f..f7964a9ef04d35b5bf46ff18071ef22f53b9a3b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2010,6 +2010,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@ -44,10 +44,10 @@ index ee4495b67c46cf1282cdd6ad15b224b0b7b10bfb..e382a29b441b656f35bc24cb90f95cb4
|
||||
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 33658a45d9f61640ab2b56be3fecb5b2552bca84..70f34d741eeafd54fcd2f5aaf9d059ba0f96e60a 100644
|
||||
index 34e89959a1ec8d391709373e02e7da928ca69770..784aea6bddd4f8c71733549d0d7b7643becde9de 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3540,7 +3540,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3530,7 +3530,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return;
|
||||
}
|
||||
// Paper end - don't run getEntities if we're not going to use its result
|
||||
@ -56,7 +56,7 @@ index 33658a45d9f61640ab2b56be3fecb5b2552bca84..70f34d741eeafd54fcd2f5aaf9d059ba
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
// Paper - don't run getEntities if we're not going to use its result; moved up
|
||||
@@ -3730,9 +3730,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3720,9 +3720,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return !this.isRemoved() && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,10 @@ index e772b6f8f78ad1292b8fa268e8bb4001a38706c6..efa7cf50b5577f87a2dfa61b59bf8105
|
||||
} else {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 2640544d8b145df68e0fe888c8c8e5ab7034bfae..5feaa977db364c6811460666e820e2d6705aaeea 100644
|
||||
index 962f4d7453433392331cd68d207cb1c6c1c8fd67..fbdb2e595d8fa2fdd35c2ccea2bb48b520df6ea7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2036,4 +2036,12 @@ public class CraftEventFactory {
|
||||
@@ -2050,4 +2050,12 @@ public class CraftEventFactory {
|
||||
return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
|
||||
}
|
||||
// Paper end - WitchReadyPotionEvent
|
||||
|
@ -29,10 +29,10 @@ index efa7cf50b5577f87a2dfa61b59bf81052794fbf1..b4a742e8c513e458b34c216d1e907b47
|
||||
} else {
|
||||
// CraftBukkit start - Fire event when pushing items into other inventories
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 5feaa977db364c6811460666e820e2d6705aaeea..63042ca2ce555f42e15b8783f6c35f688fc9c194 100644
|
||||
index fbdb2e595d8fa2fdd35c2ccea2bb48b520df6ea7..676528008a90d9af916a96c3f3518f8d1bd090fb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2043,5 +2043,11 @@ public class CraftEventFactory {
|
||||
@@ -2057,5 +2057,11 @@ public class CraftEventFactory {
|
||||
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
|
||||
return event.callEvent();
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ index a9a39c99874001f1024f71bfc97130e8c9a507e7..19333b61bcb50f2171ac2c75d7f4ca4f
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkSource.getChunk(x, z, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 70f34d741eeafd54fcd2f5aaf9d059ba0f96e60a..533b020ab103bf353be21ccc95954f8e827a89c6 100644
|
||||
index 784aea6bddd4f8c71733549d0d7b7643becde9de..cff15c86d693835eb85272efcdeeef778cbd6c8d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3477,6 +3477,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3467,6 +3467,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
this.pushEntities();
|
||||
this.level().getProfiler().pop();
|
||||
|
@ -9,10 +9,10 @@ till their item is switched.
|
||||
This patch clears the active item when the event is cancelled
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 533b020ab103bf353be21ccc95954f8e827a89c6..bf5f8756555cc92d5b0a426400bf8fe8a834e96a 100644
|
||||
index cff15c86d693835eb85272efcdeeef778cbd6c8d..9c8e7dfef41f2559de77b79a93fbb3da827ec4fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3971,6 +3971,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3961,6 +3961,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Line Of Sight Changes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index bf5f8756555cc92d5b0a426400bf8fe8a834e96a..5dc4deca24f966bd4cb0b7f296f74487964e4c95 100644
|
||||
index 9c8e7dfef41f2559de77b79a93fbb3da827ec4fa..6fbfa08afc40e51af1110b5c7357a0c6089ff9a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3720,7 +3720,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3710,7 +3710,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
||||
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
||||
|
||||
|
@ -28,7 +28,7 @@ index 9b5af216d38ff4584d40586403bd92207b230dfa..533ea6cbb813c8d1dc2bb3f65fd94d4f
|
||||
+ // Paper end - add critical damage API
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 5019b9f257382f15aa333a8d421915a7a3afe991..f18e370399fb36040cec64dd7bee4915e3cb56d7 100644
|
||||
index 56f7a753d2167504b6d91219093097323a9081c5..07afb966626d86b065e138959e9ffcac27a0d5d2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1274,7 +1274,7 @@ public abstract class Player extends LivingEntity {
|
||||
@ -55,11 +55,11 @@ index 5019b9f257382f15aa333a8d421915a7a3afe991..f18e370399fb36040cec64dd7bee4915
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
- if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
|
||||
+ if (entityliving.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f4)) { // Paper - add critical damage API
|
||||
entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
|
||||
entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 047629405dc67e3bcb5e4b3d5afa0e821f8fde44..8e8258333e181491b2d5b61ebdb80de36e8179a9 100644
|
||||
index 49dc01532f9b60b3f594abca56b7d807fe6716d5..427e889f58c86f7649fc1b661d55277599b320c0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -392,6 +392,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
@ -71,7 +71,7 @@ index 047629405dc67e3bcb5e4b3d5afa0e821f8fde44..8e8258333e181491b2d5b61ebdb80de3
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 63219a3e9aa7384c941d556cf24a6b3020968da9..c00667c0a27f96202439f45bddd2b79cd46e7c25 100644
|
||||
index 3102324bfdaa82826eead1f40d24bf13553f6506..efc3808dde268f8325304f4bce8fb3bf399adafd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1064,7 +1064,7 @@ public class CraftEventFactory {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a1edb9465872f762e1bc3daf1a3121bc3654e847..13b410f0bd184fa37e2098e8f08de39babec356a 100644
|
||||
index e75da895d4e050a775d77966c5007487c2617fdc..cd0c949eb76814829e8554977358f8f818f33b20 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2754,16 +2754,28 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2744,16 +2744,28 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index af1b161e5e61fe244b316d352452038c9b4ea458..060eaba7971ee9e4ca1d77fa6a2d1265a41d26b9 100644
|
||||
index 1632b2231e20901ce8498f3a0442e9ea54fcc068..6025b45d1c247941d83cd9c2d516c14a70f64bfd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -406,6 +406,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@ -46,10 +46,10 @@ index af1b161e5e61fe244b316d352452038c9b4ea458..060eaba7971ee9e4ca1d77fa6a2d1265
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 13b410f0bd184fa37e2098e8f08de39babec356a..450de702338fae6f305fd37965e79bd52f3c221c 100644
|
||||
index cd0c949eb76814829e8554977358f8f818f33b20..81017788a4b08c9cb0fe7a1a9a99e13d903a55d8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3464,7 +3464,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3454,7 +3454,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("freezing");
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 450de702338fae6f305fd37965e79bd52f3c221c..7ae2e7751644df130c45e191dc7abdacfc308b88 100644
|
||||
index 81017788a4b08c9cb0fe7a1a9a99e13d903a55d8..4e25c8b48425777474fb22483f9e5e03a9d42178 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4033,6 +4033,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4023,6 +4023,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public void releaseUsingItem() {
|
||||
if (!this.useItem.isEmpty()) {
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Stop large look changes from crashing the server
|
||||
Co-authored-by: Jaren Knodel <Jaren@Knodel.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 7ae2e7751644df130c45e191dc7abdacfc308b88..3764d88dcf0795612b1f502cf927ae2dcb54c605 100644
|
||||
index 4e25c8b48425777474fb22483f9e5e03a9d42178..0a0a3e4c03e86a11430811c4934742122391687e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3142,37 +3142,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3132,37 +3132,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("rangeChecks");
|
||||
|
||||
|
@ -24,10 +24,10 @@ index 9f7088691c3ab848c5095b6109d14eae947ace99..1e122d5b49aa7f6a626e781e53de53be
|
||||
+ // Paper end - check global player list where appropriate
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 3764d88dcf0795612b1f502cf927ae2dcb54c605..d3a48cdb8a6f56cefe824fac814cef58c1697c10 100644
|
||||
index 0a0a3e4c03e86a11430811c4934742122391687e..d736a53a6ea2a20a950096cd89df178864e644f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3688,7 +3688,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3678,7 +3678,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void onItemPickup(ItemEntity item) {
|
||||
|
@ -69,10 +69,10 @@ index a0c52ce65d4035d135b1536c7408a6867a553447..dc035bf94c5f6574ed8ad369b327b7f7
|
||||
this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F);
|
||||
} // Paper - Call EntityDropItemEvent
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 633d19fef92cc13bc08e63d4fa441903c8c1f49e..4c2a09f137a5cb508317b4a72ae82d6389ad6305 100644
|
||||
index 3d26da4e2afbf29fff99c1ee352773022698e6c9..cbf2cd3c7005fb4148c15966079922a8b18ece91 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2106,4 +2106,28 @@ public class CraftEventFactory {
|
||||
@@ -2120,4 +2120,28 @@ public class CraftEventFactory {
|
||||
return event.callEvent();
|
||||
}
|
||||
// Paper end
|
||||
|
@ -23,10 +23,10 @@ index 2ebbf7954dc5e0d6c9d53327d05b725eec310086..c5bd2e90ad74ba08910f65a2e07b6f76
|
||||
|
||||
return !this.getResponse();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6c502f67234eee9c1446d490acde1dbe6f34119e..84b7552dfc2077b02e3c4120ad72334cf60212d6 100644
|
||||
index 1a891485933c81e0b80c8a193db5eca9208cbb18..e69a71595abbbf963e91995e5bbc91d1e509748b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2375,7 +2375,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2365,7 +2365,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
// Duplicate triggers if blocking
|
||||
if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
@ -35,7 +35,7 @@ index 6c502f67234eee9c1446d490acde1dbe6f34119e..84b7552dfc2077b02e3c4120ad72334c
|
||||
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
@@ -2383,7 +2383,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2373,7 +2373,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||
|
@ -50,10 +50,10 @@ index 9507dbbb4b490149b9248c384be5adaccae40c41..5bbadc890a72f1cb22c6881ebcc163b0
|
||||
for (int k = 0; k < 5; ++k) {
|
||||
worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 95b819ef8953b2d94a76e33328c967d21bf216b4..6ecdb9d965d9a14a65d7ce6b3c7b39d72d396167 100644
|
||||
index f4ca35e044e41b3fd1b83c482a5c19d188ea0bae..16f183c8e81b8c22ca51387e9e35282ed20d651c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2107,6 +2107,32 @@ public class CraftEventFactory {
|
||||
@@ -2121,6 +2121,32 @@ public class CraftEventFactory {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Broadcast take item packets with collector as source
|
||||
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 84b7552dfc2077b02e3c4120ad72334cf60212d6..b08a7a3ab30a6e4bf8d4dd90022e446444fafa46 100644
|
||||
index e69a71595abbbf963e91995e5bbc91d1e509748b..33c3c6ac66842735b06c078821930767386c7fd7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3714,7 +3714,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3704,7 +3704,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public void take(Entity item, int count) {
|
||||
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
||||
|
@ -26,10 +26,10 @@ index a306b30af19277386a2f3e560b4902a8b5796f2a..54851f6cc0d5fddb32a9a1e84a4f5ae4
|
||||
x = to.getX();
|
||||
y = to.getY();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index ae63033bab20bec39e0562421e7a3f449648a69d..c256b4307e896b3e9f0a399a93db761a8c5c593f 100644
|
||||
index c2a4c4607ccbbcabde66d7a92fe6c9010263225d..9b72443d98525b860e1ceae9f9c20b4ef7d8dd90 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4189,7 +4189,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4179,7 +4179,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (!(this instanceof ServerPlayer)) {
|
||||
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
|
||||
this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
||||
|
@ -26,10 +26,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 5eda2e858b309d2be704db1015c9c114ed9e63a9..7a6b667e637f3397211b68ccc699a6262cfe8265 100644
|
||||
index 6c2e9654f853cb821f77e67dacf225ddb7f22271..5bc16477729412e6252384e0ea58699ee08f7313 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3736,7 +3736,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3726,7 +3726,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
||||
|
||||
// Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
|
||||
|
@ -17,7 +17,7 @@ index 2cd0a4dc4f0baa08bd7f5a053303bb63733f0bab..0bd367235f80c1f0d319a6aa5130d82a
|
||||
};
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 7a6b667e637f3397211b68ccc699a6262cfe8265..f2d432eea1641533690502f27349c562c3a691ba 100644
|
||||
index 5bc16477729412e6252384e0ea58699ee08f7313..5161fdef2f0ebeb1943f30df5452875f09a45f32 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1459,7 +1459,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@ -44,7 +44,7 @@ index 7a6b667e637f3397211b68ccc699a6262cfe8265..f2d432eea1641533690502f27349c562
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
@@ -2340,7 +2341,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2330,7 +2331,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
Entity entity = damagesource.getDirectEntity();
|
||||
|
||||
|
@ -115,7 +115,7 @@ index 68446b7532dfbda303293aa9e756644c6fcdffca..a2142930b4d4b05987c90496fb9d733d
|
||||
this.sendLevelInfo(player, worldserver1);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 533808bb5652d70230062893b80c20b2010370c4..4ee843dfd826772c9157ca421d8fe1f36f814b51 100644
|
||||
index 9153c15cd2b8a3811d5f1c16ac2221aea7c3aacd..7ef9f67d27cc240191dd5d07e8dcf5fbdebe1049 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -703,13 +703,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@ -166,10 +166,10 @@ index 533808bb5652d70230062893b80c20b2010370c4..4ee843dfd826772c9157ca421d8fe1f3
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index f2d432eea1641533690502f27349c562c3a691ba..2676beb338f5e4d30c22124eb55cc5aa03807408 100644
|
||||
index 5161fdef2f0ebeb1943f30df5452875f09a45f32..8ffbc96af09288d6a81ff597a205df0f2d59bf43 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3834,6 +3834,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3824,6 +3824,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ The results indicate that this logic is 5 times faster than Vanilla
|
||||
and 2.3 times faster than Lithium.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 09d2377db5f37b5dcd03aa3629d3c24fa7f75d20..082b804f4793f72e76361f5427f0358273454b3d 100644
|
||||
index ff0eb772fb272b0bcdf948e79b284039b55311b0..8611725989cff89d809e6b8837d8dbd7e4da2494 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -112,6 +112,271 @@ public class Explosion {
|
||||
@ -468,7 +468,7 @@ index 09d2377db5f37b5dcd03aa3629d3c24fa7f75d20..082b804f4793f72e76361f5427f03582
|
||||
double d13;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -340,6 +656,9 @@ public class Explosion {
|
||||
@@ -327,6 +643,9 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ index 09d2377db5f37b5dcd03aa3629d3c24fa7f75d20..082b804f4793f72e76361f5427f03582
|
||||
}
|
||||
|
||||
public void finalizeExplosion(boolean particles) {
|
||||
@@ -555,14 +874,14 @@ public class Explosion {
|
||||
@@ -542,14 +861,14 @@ public class Explosion {
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
|
@ -63,10 +63,10 @@ index c7efde4e2b87b14e768429748b01c1bce659682b..1047027610624c9ba4bb5afd5d7f0714
|
||||
|
||||
if (this.hasDelayedDestroy) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2676beb338f5e4d30c22124eb55cc5aa03807408..62a38a21f7a949ca20b4975a603e163483fe6757 100644
|
||||
index 8ffbc96af09288d6a81ff597a205df0f2d59bf43..f26f05f8ab0d60c3a3668db63a01cc16a947a4b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3839,6 +3839,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3829,6 +3829,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
|
||||
}
|
||||
// Paper end - Properly cancel usable items
|
||||
@ -77,7 +77,7 @@ index 2676beb338f5e4d30c22124eb55cc5aa03807408..62a38a21f7a949ca20b4975a603e1634
|
||||
private void updatingUsingItem() {
|
||||
if (this.isUsingItem()) {
|
||||
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||
@@ -3857,7 +3861,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3847,7 +3851,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.triggerItemUseEffects(stack, 5);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ index 2676beb338f5e4d30c22124eb55cc5aa03807408..62a38a21f7a949ca20b4975a603e1634
|
||||
this.completeUsingItem();
|
||||
}
|
||||
|
||||
@@ -3903,7 +3912,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3893,7 +3902,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper - Prevent consuming the wrong itemstack
|
||||
this.useItem = itemstack;
|
||||
@ -103,7 +103,7 @@ index 2676beb338f5e4d30c22124eb55cc5aa03807408..62a38a21f7a949ca20b4975a603e1634
|
||||
if (!this.level().isClientSide) {
|
||||
this.setLivingEntityFlag(1, true);
|
||||
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
||||
@@ -3928,7 +3940,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3918,7 +3930,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
@ -115,7 +115,7 @@ index 2676beb338f5e4d30c22124eb55cc5aa03807408..62a38a21f7a949ca20b4975a603e1634
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4063,7 +4078,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4053,7 +4068,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
|
@ -8,10 +8,10 @@ it will not disable the shield if the attacker is holding
|
||||
an axe item.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 62a38a21f7a949ca20b4975a603e163483fe6757..0580d34ee23bba9709fd8dac78582f4f1cf0a71c 100644
|
||||
index f26f05f8ab0d60c3a3668db63a01cc16a947a4b2..3276ea59999e76c2a2b0c82b96e0e91865e96a98 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2341,7 +2341,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2331,7 +2331,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
Entity entity = damagesource.getDirectEntity();
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Revert to vanilla handling of LivingEntity#actuallyHurt
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0580d34ee23bba9709fd8dac78582f4f1cf0a71c..b68ef1439e72c61828bb15fe82da11c9057bdb30 100644
|
||||
index 3276ea59999e76c2a2b0c82b96e0e91865e96a98..6b447cdf5b14deb26e0454f9f731724c89f2d498 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2226,7 +2226,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2216,7 +2216,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -17,7 +17,7 @@ index 0580d34ee23bba9709fd8dac78582f4f1cf0a71c..b68ef1439e72c61828bb15fe82da11c9
|
||||
if (!this.isInvulnerableTo(damagesource)) {
|
||||
final boolean human = this instanceof net.minecraft.world.entity.player.Player;
|
||||
float originalDamage = f;
|
||||
@@ -2398,12 +2398,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2388,12 +2388,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -214,10 +214,10 @@ index b9b3277c8ed94e0cd30b20b9c00a33eaad48e5ac..c450447585af4c8cdc87abe871c229ff
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index b68ef1439e72c61828bb15fe82da11c9057bdb30..0ddf2e1a6d2ea836f8a140a435721e0ce96bd8d2 100644
|
||||
index 6b447cdf5b14deb26e0454f9f731724c89f2d498..ce01fe82dc1eaaf06ca317ddbc62b7d1b87a48b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3318,7 +3318,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3308,7 +3308,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
});
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren