mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@a39c4cb0 Updated Upstream (Paper) PurpurMC/Purpur@ea7b18ab Updated Upstream (Paper) PurpurMC/Purpur@0f82c210 Updated Upstream (Paper) PurpurMC/Purpur@8de15d66 this is important for the build to not fail.. PurpurMC/Purpur@5053eb0c use a different method for dropping lapis, closes #1692
81 lines
3.3 KiB
Diff
81 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 3 Mar 2025 01:16:29 +0300
|
|
Subject: [PATCH] Extend Sound API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
|
index 318bb02fe2921e5c41e7473500d1cf4dacf0c781..0f35f958c5c90dd4ac2ca80fdce53e73b644ab90 100644
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
|
@@ -836,4 +836,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
|
* @return {@code true} if the block can suffocate
|
|
*/
|
|
boolean isSuffocating();
|
|
+
|
|
+ // DivineMC start - Extend Sound API
|
|
+ /**
|
|
+ * Plays a sound at the location of the block
|
|
+ *
|
|
+ * @param sound sound to play
|
|
+ * @param volume volume of the sound
|
|
+ * @param pitch pitch of the sound
|
|
+ */
|
|
+ default void emitSound(@NotNull org.bukkit.Sound sound, float volume, float pitch) {
|
|
+ emitSound(sound, org.bukkit.SoundCategory.BLOCKS, volume, pitch);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Plays a sound at the location of the block
|
|
+ *
|
|
+ * @param sound sound to play
|
|
+ * @param category category of the sound
|
|
+ * @param volume volume of the sound
|
|
+ * @param pitch pitch of the sound
|
|
+ */
|
|
+ default void emitSound(@NotNull org.bukkit.Sound sound, @NotNull org.bukkit.SoundCategory category, float volume, float pitch) {
|
|
+ getWorld().playSound(getLocation().toCenterLocation(), sound, category, volume, pitch);
|
|
+ }
|
|
+ // DivineMC end - Extend Sound API
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
|
index a3d2013adf038f1fe96127c5dba442ffd2e031a8..e93bdf925505b00454a93207e12d1f21c8cb6af3 100644
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
|
@@ -1316,4 +1316,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
*/
|
|
void setImmuneToFire(@Nullable Boolean fireImmune);
|
|
// Purpur end - Fire Immunity API
|
|
+
|
|
+ // DivineMC start - Extend Sound API
|
|
+ /**
|
|
+ * Plays a sound at the location of the entity
|
|
+ *
|
|
+ * @param sound sound to play
|
|
+ * @param volume volume of the sound
|
|
+ * @param pitch pitch of the sound
|
|
+ */
|
|
+ default void emitSound(@NotNull org.bukkit.Sound sound, float volume, float pitch) {
|
|
+ org.bukkit.SoundCategory soundGroup = switch (this) {
|
|
+ case HumanEntity humanEntity -> org.bukkit.SoundCategory.PLAYERS;
|
|
+ case Ambient ambient -> org.bukkit.SoundCategory.AMBIENT;
|
|
+ case Monster monster -> org.bukkit.SoundCategory.HOSTILE;
|
|
+ default -> org.bukkit.SoundCategory.NEUTRAL;
|
|
+ };
|
|
+ emitSound(sound, soundGroup, volume, pitch);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Plays a sound at the location of the block
|
|
+ *
|
|
+ * @param sound sound to play
|
|
+ * @param category category of the sound
|
|
+ * @param volume volume of the sound
|
|
+ * @param pitch pitch of the sound
|
|
+ */
|
|
+ default void emitSound(@NotNull org.bukkit.Sound sound, @NotNull org.bukkit.SoundCategory category, float volume, float pitch) {
|
|
+ getWorld().playSound(this, sound, category, volume, pitch);
|
|
+ }
|
|
+ // DivineMC end - Extend Sound API
|
|
}
|