mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Add PlayerStopUsingItemEvent
This commit is contained in:
parent
954f57e596
commit
2082797618
@ -969,12 +969,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1681,8 +2057,22 @@
|
||||
|
||||
public LivingEntity.Fallsounds getFallSounds() {
|
||||
@@ -1683,6 +2059,20 @@
|
||||
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Add delegate methods
|
||||
+ public SoundEvent getHurtSound0(DamageSource damagesource) {
|
||||
+ return this.getHurtSound(damagesource);
|
||||
@ -982,8 +980,8 @@
|
||||
+
|
||||
+ public SoundEvent getDeathSound0() {
|
||||
+ return this.getDeathSound();
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public SoundEvent getFallDamageSound0(int fallHeight) {
|
||||
+ return this.getFallDamageSound(fallHeight);
|
||||
+ }
|
||||
@ -1602,7 +1600,7 @@
|
||||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
|
||||
@ -1626,7 +1624,7 @@
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
}
|
||||
@ -1640,7 +1638,15 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3544,12 +4242,69 @@
|
||||
@@ -3512,6 +4210,7 @@
|
||||
|
||||
public void releaseUsingItem() {
|
||||
if (!this.useItem.isEmpty()) {
|
||||
+ if (this instanceof ServerPlayer) new io.papermc.paper.event.player.PlayerStopUsingItemEvent((Player) getBukkitEntity(), useItem.asBukkitMirror(), getTicksUsingItem()).callEvent(); // Paper - Add PlayerStopUsingItemEvent
|
||||
this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks());
|
||||
if (this.useItem.useOnRelease()) {
|
||||
this.updatingUsingItem();
|
||||
@@ -3544,12 +4243,69 @@
|
||||
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
Item item = this.useItem.getItem();
|
||||
|
||||
@ -1711,7 +1717,7 @@
|
||||
public boolean isSuppressingSlidingDownLadder() {
|
||||
return this.isShiftKeyDown();
|
||||
}
|
||||
@@ -3568,12 +4323,18 @@
|
||||
@@ -3568,12 +4324,18 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
||||
@ -1732,7 +1738,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (world.hasChunkAt(blockposition)) {
|
||||
@@ -3592,18 +4353,43 @@
|
||||
@@ -3592,18 +4354,43 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@ -1780,7 +1786,7 @@
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
}
|
||||
|
||||
@@ -3613,7 +4399,7 @@
|
||||
@@ -3613,7 +4400,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
@ -1789,7 +1795,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3706,7 +4492,7 @@
|
||||
@@ -3706,7 +4493,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@ -1798,7 +1804,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3718,9 +4504,9 @@
|
||||
@@ -3718,9 +4505,9 @@
|
||||
|
||||
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
||||
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
||||
@ -1810,7 +1816,7 @@
|
||||
});
|
||||
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
@@ -3740,7 +4526,7 @@
|
||||
@@ -3740,7 +4527,7 @@
|
||||
|
||||
@Nullable
|
||||
public Direction getBedOrientation() {
|
||||
@ -1819,7 +1825,7 @@
|
||||
|
||||
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3905,7 +4691,7 @@
|
||||
@@ -3905,7 +4692,7 @@
|
||||
public float maxUpStep() {
|
||||
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user