mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
71c84c8132
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: 9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent 258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD CraftBukkit Changes: 98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent 5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class 76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor Spigot Changes: e9ec5485 Rebuild patches f1b62e0c Rebuild patches
101 lines
5.4 KiB
Diff
101 lines
5.4 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] Add EntityToggleSitEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
|
index 4d893c445af2b6dc74d5ad731b69eb5a488817b4..e4550d3ac8d93e0dd9a54e41fbbbef2ef9d4f55e 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 - Add EntityToggleSitEvent
|
|
}
|
|
|
|
@Override
|
|
@@ -125,6 +125,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
|
}
|
|
|
|
public void setInSittingPose(boolean inSittingPose) {
|
|
+ // Paper start - Add EntityToggleSitEvent
|
|
+ this.setInSittingPose(inSittingPose, true);
|
|
+ }
|
|
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
|
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return;
|
|
+ // Paper end - Add 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 4c2e090a72dbd5bfb928e6ccbcedb1a25231d5b1..f7a7810fdc2f74b79fa14470493485e4b74539ab 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
@@ -437,7 +437,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 - Add EntityToggleSitEvent
|
|
this.setIsCrouching(nbt.getBoolean("Crouching"));
|
|
if (this.level() instanceof ServerLevel) {
|
|
this.setTargetGoals();
|
|
@@ -450,6 +450,12 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
|
}
|
|
|
|
public void setSitting(boolean sitting) {
|
|
+ // Paper start - Add EntityToggleSitEvent
|
|
+ this.setSitting(sitting, true);
|
|
+ }
|
|
+ public void setSitting(boolean sitting, boolean fireEvent) {
|
|
+ if (fireEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return;
|
|
+ // Paper end - Add EntityToggleSitEvent
|
|
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 4abd26c7baf8f198f13dd41a3146f9ece13a4164..0297e234f17c6157cfff79420b9eeaf4e0e2c3ab 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
@@ -139,6 +139,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 - Add 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 be8e056f82e348d7cd14bb22a873207cddfb3044..5f879ec74cadc8b27f3c1648890978dbdc27f9f0 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
|
|
@@ -556,7 +556,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
}
|
|
|
|
public void sitDown() {
|
|
- if (!this.isCamelSitting()) {
|
|
+ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper - Add EntityToggleSitEvent
|
|
this.playSound(SoundEvents.CAMEL_SIT, 1.0F, this.getVoicePitch());
|
|
this.setPose(Pose.SITTING);
|
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
|
@@ -565,7 +565,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
}
|
|
|
|
public void standUp() {
|
|
- if (this.isCamelSitting()) {
|
|
+ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper - Add EntityToggleSitEvent
|
|
this.playSound(SoundEvents.CAMEL_STAND, 1.0F, this.getVoicePitch());
|
|
this.setPose(Pose.STANDING);
|
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
|
@@ -574,6 +574,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
}
|
|
|
|
public void standUpInstantly() {
|
|
+ if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper - Add EntityToggleSitEvent
|
|
this.setPose(Pose.STANDING);
|
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
|
this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
|