mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-02 17:01:38 +01:00
c0936a71bd
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 01aa02eb PR-858: Add LivingEntity#playHurtAnimation() 9421320f PR-884: Refinements to new ban API for improved compatibility and correctness 37a60b45 SPIGOT-6455, SPIGOT-7030, PR-750: Improve ban API 4eeb174b All smithing inventories are now the new smithing inventory f2bb168e PR-880: Add methods to get/set FallingBlock CancelDrop e7a807fa PR-879: Add Player#sendHealthUpdate() 692b8e96 SPIGOT-7370: Remove float value conversion in plugin.yml 2d033390 SPIGOT-7403: Add direct API for waxed signs 16a08373 PR-876: Add missing Raider API and 'no action ticks' CraftBukkit Changes: b60a95c8c PR-1189: Add LivingEntity#playHurtAnimation() 95c335c63 PR-1226: Fix VehicleEnterEvent not being called for certain entities 0a0fc3bee PR-1227: Refinements to new ban API for improved compatibility and correctness 0d0b1e5dc Revert bad change to PathfinderGoalSit causing all cats to sit 648196070 SPIGOT-6455, SPIGOT-7030, PR-1054: Improve ban API 31fe848d6 All smithing inventories are now the new smithing inventory 9a919a143 SPIGOT-7416: SmithItemEvent not firing in Smithing Table 9f64f0d22 PR-1221: Add methods to get/set FallingBlock CancelDrop 3be9ac171 PR-1220: Add Player#sendHealthUpdate() c1279f775 PR-1209: Clean up various patches c432e4397 Fix Raider#setCelebrating() implementation 504d96665 SPIGOT-7403: Add direct API for waxed signs c68c1f1b3 PR-1216: Add missing Raider API and 'no action ticks' 85b89c3dd Increase outdated build delay Spigot Changes: 9ebce8af Rebuild patches 64b565e6 Rebuild patches
101 lines
5.2 KiB
Diff
101 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: KyGuy2002 <IEatBeans#1165>
|
|
Date: Fri, 11 Mar 2022 15:33:10 +0000
|
|
Subject: [PATCH] Added EntityToggleSitEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
|
index 9fb11df7131f400e6e631146c32efccea83adf56..1282911b97292cde30dff83de756bc91bf319cb2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
|
@@ -67,7 +67,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
|
}
|
|
|
|
this.orderedToSit = nbt.getBoolean("Sitting");
|
|
- this.setInSittingPose(this.orderedToSit);
|
|
+ this.setInSittingPose(this.orderedToSit, false); // Paper - Don't fire event
|
|
}
|
|
|
|
@Override
|
|
@@ -125,6 +125,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
|
}
|
|
|
|
public void setInSittingPose(boolean inSittingPose) {
|
|
+ // Paper start
|
|
+ this.setInSittingPose(inSittingPose, true);
|
|
+ }
|
|
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
|
+ // Paper end
|
|
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return; // Paper start - call EntityToggleSitEvent
|
|
byte b = this.entityData.get(DATA_FLAGS_ID);
|
|
if (inSittingPose) {
|
|
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
index 5052bcf16bb09b7bcf39566fef1378b1c4970fe6..62604ed2e82afd3603ccac5d9c6e285c431542b1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
@@ -427,7 +427,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
|
|
|
this.setSleeping(nbt.getBoolean("Sleeping"));
|
|
this.setVariant(Fox.Type.byName(nbt.getString("Type")));
|
|
- this.setSitting(nbt.getBoolean("Sitting"));
|
|
+ this.setSitting(nbt.getBoolean("Sitting"), false); // Paper
|
|
this.setIsCrouching(nbt.getBoolean("Crouching"));
|
|
if (this.level() instanceof ServerLevel) {
|
|
this.setTargetGoals();
|
|
@@ -440,6 +440,12 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
|
}
|
|
|
|
public void setSitting(boolean sitting) {
|
|
+ this.setSitting(sitting, true);
|
|
+ }
|
|
+ // Paper start
|
|
+ public void setSitting(boolean sitting, boolean fireEvent) {
|
|
+ if (fireEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return;
|
|
+ // Paper end
|
|
this.setFlag(1, sitting);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
index 4f03e50d8d9d67aa9a62fbb3bdb14f5ba851e08a..f43c4fed59c4c75540008284ddb197d9a6b5487b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
@@ -135,6 +135,7 @@ public class Panda extends Animal {
|
|
}
|
|
|
|
public void sit(boolean sitting) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return; // Paper start - call EntityToggleSitEvent
|
|
this.setFlag(8, sitting);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
index 2030fdb3124f793d7b545135b1db32fe9be27050..4efa7e331cc974008c653a04687a336e97626445 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
@@ -591,7 +591,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
|
|
}
|
|
|
|
public void sitDown() {
|
|
- if (!this.isCamelSitting()) {
|
|
+ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper
|
|
this.playSound(SoundEvents.CAMEL_SIT, 1.0F, 1.0F);
|
|
this.setPose(Pose.SITTING);
|
|
this.resetLastPoseChangeTick(-this.level().getGameTime());
|
|
@@ -599,7 +599,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
|
|
}
|
|
|
|
public void standUp() {
|
|
- if (this.isCamelSitting()) {
|
|
+ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper
|
|
this.playSound(SoundEvents.CAMEL_STAND, 1.0F, 1.0F);
|
|
this.setPose(Pose.STANDING);
|
|
this.resetLastPoseChangeTick(this.level().getGameTime());
|
|
@@ -607,6 +607,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
|
|
}
|
|
|
|
public void standUpInstantly() {
|
|
+ if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper
|
|
this.setPose(Pose.STANDING);
|
|
this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
|
|
}
|