diff --git a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch index 82acf3b49d..bceefeb824 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch @@ -12,6 +12,15 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -85,7 +90,7 @@ + } + + this.orderedToSit = nbt.getBoolean("Sitting"); +- this.setInSittingPose(this.orderedToSit); ++ this.setInSittingPose(this.orderedToSit, false); // Paper - Add EntityToggleSitEvent + } + + @Override @@ -96,8 +101,16 @@ @Override public boolean handleLeashAtDistance(Entity leashHolder, float distance) { @@ -31,7 +40,20 @@ } return false; -@@ -244,7 +257,12 @@ +@@ -161,6 +174,12 @@ + } + + 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 b0 = (Byte) this.entityData.get(TamableAnimal.DATA_FLAGS_ID); + + if (inSittingPose) { +@@ -244,7 +263,12 @@ if (entityliving instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entityliving; @@ -45,7 +67,7 @@ } } } -@@ -295,7 +313,14 @@ +@@ -295,7 +319,14 @@ if (!this.canTeleportTo(new BlockPos(x, y, z))) { return false; } else { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch index 11383f1925..7052ecb52a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch @@ -10,7 +10,29 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> { -@@ -489,21 +492,22 @@ +@@ -416,7 +419,7 @@ + + this.setSleeping(nbt.getBoolean("Sleeping")); + this.setVariant(Fox.Variant.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(); +@@ -429,6 +432,12 @@ + } + + 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); + } + +@@ -489,21 +498,22 @@ entityitem.setPickUpDelay(40); entityitem.setThrower(this); this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); @@ -36,7 +58,7 @@ int i = itemstack.getCount(); if (i > 1) { -@@ -515,7 +519,7 @@ +@@ -515,7 +525,7 @@ this.setItemSlot(EquipmentSlot.MAINHAND, itemstack.split(1)); this.setGuaranteedDrop(EquipmentSlot.MAINHAND); this.take(itemEntity, itemstack.getCount()); @@ -45,7 +67,7 @@ this.ticksSinceEaten = 0; } -@@ -685,16 +689,38 @@ +@@ -685,16 +695,38 @@ return this.getTrustedUUIDs().contains(uuid); } @@ -87,7 +109,7 @@ } public static boolean isPathClear(Fox fox, LivingEntity chasedEntity) { -@@ -853,6 +879,16 @@ +@@ -853,6 +885,16 @@ if (entityplayer1 != null && entityplayer != entityplayer1) { entityfox.addTrustedUUID(entityplayer1.getUUID()); } @@ -104,7 +126,7 @@ if (entityplayer2 != null) { entityplayer2.awardStat(Stats.ANIMALS_BRED); -@@ -863,12 +899,14 @@ +@@ -863,12 +905,14 @@ this.partner.setAge(6000); this.animal.resetLove(); this.partner.resetLove(); @@ -123,7 +145,7 @@ } } -@@ -1264,6 +1302,11 @@ +@@ -1264,6 +1308,11 @@ int i = (Integer) state.getValue(SweetBerryBushBlock.AGE); state.setValue(SweetBerryBushBlock.AGE, 1); @@ -135,7 +157,7 @@ int j = 1 + Fox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0); ItemStack itemstack = Fox.this.getItemBySlot(EquipmentSlot.MAINHAND); -@@ -1494,7 +1537,7 @@ +@@ -1494,7 +1543,7 @@ } public static Fox.Variant byName(String name) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Panda.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Panda.java.patch index fb3a3e3cfe..efe53ccccb 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Panda.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Panda.java.patch @@ -12,7 +12,15 @@ public class Panda extends Animal { -@@ -525,7 +530,9 @@ +@@ -129,6 +134,7 @@ + } + + 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); + } + +@@ -525,7 +531,9 @@ Panda entitypanda = (Panda) iterator.next(); if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) { @@ -22,7 +30,7 @@ } } -@@ -533,7 +540,9 @@ +@@ -533,7 +541,9 @@ if (world1 instanceof ServerLevel worldserver) { if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -32,7 +40,7 @@ } } -@@ -541,14 +550,14 @@ +@@ -541,14 +551,14 @@ @Override protected void pickUpItem(ServerLevel world, ItemEntity itemEntity) { @@ -49,7 +57,7 @@ } } -@@ -657,7 +666,9 @@ +@@ -657,7 +667,9 @@ ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) { @@ -59,7 +67,7 @@ } this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1)); -@@ -772,7 +783,7 @@ +@@ -772,7 +784,7 @@ } public static Panda.Gene byName(String name) { @@ -68,7 +76,7 @@ } public static Panda.Gene getRandom(RandomSource random) { -@@ -876,10 +887,10 @@ +@@ -876,10 +888,10 @@ private final Panda panda; public PandaAvoidGoal(Panda panda, Class<T> fleeFromType, float distance, double slowSpeed, double fastSpeed) { @@ -82,7 +90,7 @@ this.panda = panda; } -@@ -935,7 +946,9 @@ +@@ -935,7 +947,9 @@ ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND); if (!itemstack.isEmpty()) { @@ -92,7 +100,7 @@ Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10; -@@ -1116,7 +1129,7 @@ +@@ -1116,7 +1130,7 @@ @Override protected void alertOther(Mob mob, LivingEntity target) { if (mob instanceof Panda && mob.isAggressive()) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/camel/Camel.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/camel/Camel.java.patch index e5ee64d2e3..58fdf79e56 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/camel/Camel.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/camel/Camel.java.patch @@ -46,3 +46,29 @@ } @Override +@@ -563,7 +572,7 @@ + } + + public void sitDown() { +- if (!this.isCamelSitting()) { ++ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper - Add EntityToggleSitEvent + this.makeSound(SoundEvents.CAMEL_SIT); + this.setPose(Pose.SITTING); + this.gameEvent(GameEvent.ENTITY_ACTION); +@@ -572,7 +581,7 @@ + } + + public void standUp() { +- if (this.isCamelSitting()) { ++ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper - Add EntityToggleSitEvent + this.makeSound(SoundEvents.CAMEL_STAND); + this.setPose(Pose.STANDING); + this.gameEvent(GameEvent.ENTITY_ACTION); +@@ -581,6 +590,7 @@ + } + + 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());