1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/TamableAnimal.java
|
||||
+++ b/net/minecraft/world/entity/TamableAnimal.java
|
||||
@@ -84,7 +_,7 @@
|
||||
@@ -77,7 +_,7 @@
|
||||
}
|
||||
|
||||
this.orderedToSit = compound.getBoolean("Sitting");
|
||||
this.orderedToSit = compound.getBooleanOr("Sitting", false);
|
||||
- this.setInSittingPose(this.orderedToSit);
|
||||
+ this.setInSittingPose(this.orderedToSit, false); // Paper - Add EntityToggleSitEvent
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,8 +_,16 @@
|
||||
@@ -88,8 +_,16 @@
|
||||
@Override
|
||||
public boolean handleLeashAtDistance(Entity leashHolder, float distance) {
|
||||
if (this.isInSittingPose()) {
|
||||
@@ -28,20 +28,21 @@
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -155,6 +_,12 @@
|
||||
@@ -148,6 +_,13 @@
|
||||
}
|
||||
|
||||
public void setInSittingPose(boolean sitting) {
|
||||
+ // Paper start - Add EntityToggleSitEvent
|
||||
+ this.setInSittingPose(sitting, true);
|
||||
+ }
|
||||
+
|
||||
+ public void setInSittingPose(boolean sitting, boolean callEvent) {
|
||||
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return;
|
||||
+ // Paper end - Add EntityToggleSitEvent
|
||||
byte b = this.entityData.get(DATA_FLAGS_ID);
|
||||
if (sitting) {
|
||||
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
|
||||
@@ -227,7 +_,12 @@
|
||||
@@ -230,7 +_,12 @@
|
||||
if (this.level() instanceof ServerLevel serverLevel
|
||||
&& serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES)
|
||||
&& this.getOwner() instanceof ServerPlayer serverPlayer) {
|
||||
@@ -55,18 +56,18 @@
|
||||
}
|
||||
|
||||
super.die(cause);
|
||||
@@ -270,7 +_,14 @@
|
||||
@@ -273,7 +_,14 @@
|
||||
if (!this.canTeleportTo(new BlockPos(x, y, z))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.moveTo(x + 0.5, y, z + 0.5, this.getYRot(), this.getXRot());
|
||||
- this.snapTo(x + 0.5, y, z + 0.5, this.getYRot(), this.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityTeleportEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(this, x + 0.5, y, z + 0.5);
|
||||
+ if (event.isCancelled() || event.getTo() == null) { // Paper - prevent NP on null event to location
|
||||
+ if (event.isCancelled() || event.getTo() == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ org.bukkit.Location to = event.getTo();
|
||||
+ this.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ this.snapTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user