Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
de04cbced5
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: f29cb801 Separate checkstyle-suppressions file is not required 86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack 9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode() 994a6163 Attempt upgrade of resolver libraries CraftBukkit Changes: b3b43a6ad Add Checkstyle check for unused imports 13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names 3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API 2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor 1dbdbbed4 PR-1238: Remove unnecessary sign ticking 659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper e37e29ce0 Increase outdated build delay c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack 492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode() e11fbb9d7 Upgrade MySQL driver 9f3a0bd2a Attempt upgrade of resolver libraries 60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion Spigot Changes: 06d602e7 Rebuild patches
101 Zeilen
5.3 KiB
Diff
101 Zeilen
5.3 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 1999cda5876bb12283d8c91a1b3e737c0d27bc38..1611a54bb68af34bfcbfd17028f564b7332aa489 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 96799179b0dd1886f0cdc386f04e152a19b3337d..d17c69a857f083350cc9e9ec2b5dbe0a1482c85f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
@@ -433,7 +433,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();
|
|
@@ -446,6 +446,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 130761afcaa6723e0a9d9a518f1b526c344484b4..683cc5f9f066d554383fcd30e3654ac06ec76510 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
@@ -138,6 +138,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 faf3e31f23d71bbc345bf98d4240490ac4677843..1d9427da270edb447a2c8e031c4f05fe5d39603b 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
|
|
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
|
|
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
|
|
this.setPose(Pose.STANDING);
|
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
|
this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
|