Add more breakNaturally functionality (#7379)
This commit is contained in:
parent
1c535f96ac
commit
66437d059f
198 changed files with 206 additions and 146 deletions
68
patches/api/0185-Improve-Block-breakNaturally-API.patch
Normal file
68
patches/api/0185-Improve-Block-breakNaturally-API.patch
Normal file
|
@ -0,0 +1,68 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 2 Jan 2020 12:25:16 -0600
|
||||
Subject: [PATCH] Improve Block#breakNaturally API
|
||||
|
||||
Adds bool param to trigger world particle effects
|
||||
|
||||
Adds bool param to trigger exp drops for blocks
|
||||
|
||||
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index db441e463b02ee734f85c855f5538cd41041dbae..af705e45204975a342e1454156ba143ed52cecdc 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -480,6 +480,52 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
boolean breakNaturally(@Nullable ItemStack tool);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ *
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @return true if the block was destroyed
|
||||
+ * @see #breakNaturally(boolean, boolean) to trigger exp drops
|
||||
+ */
|
||||
+ default boolean breakNaturally(boolean triggerEffect) {
|
||||
+ return this.breakNaturally(triggerEffect, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ *
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @param dropExperience drop exp if the block normally does so
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(boolean triggerEffect, boolean dropExperience);
|
||||
+
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ * with a specific tool
|
||||
+ *
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @return true if the block was destroyed
|
||||
+ * @see #breakNaturally(ItemStack, boolean, boolean) to trigger exp drops
|
||||
+ */
|
||||
+ default boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect) {
|
||||
+ return this.breakNaturally(tool, triggerEffect, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ * with a specific tool
|
||||
+ *
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @param dropExperience drop exp if the block normally does so
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Simulate bone meal application to this block (if possible).
|
||||
*
|
|
@ -1,37 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Jan 2020 12:25:16 -0600
|
||||
Subject: [PATCH] Add effect to block break naturally
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index db441e463b02ee734f85c855f5538cd41041dbae..1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -480,6 +480,26 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
boolean breakNaturally(@Nullable ItemStack tool);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ *
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(boolean triggerEffect);
|
||||
+
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ * with a specific tool
|
||||
+ *
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Simulate bone meal application to this block (if possible).
|
||||
*
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
index 5f7d0d08be8bca06c9aa89659b7865a7b5a547f8..9d95218b49895ab76b00fe9524d9b25ea9f9b8c2 100644
|
||||
index bfd3654c02e8ad906c620a86165a38c65a31b62b..d5eeb37d331e205826aa6199bd481cb0db40d721 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
@@ -1,6 +1,8 @@
|
|
@ -269,7 +269,7 @@ index 02c5fcbc76b2db6bf4eb7580456b5658c08272b4..d56e1b50dd7da18f40278cec4bfdc941
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02..2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9 100644
|
||||
index af705e45204975a342e1454156ba143ed52cecdc..ce3b81c5d83c9747ea0e3410c932460d11bf5c55 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
@ -281,7 +281,7 @@ index 1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02..2c837ea822f3b0c4ec312f0c956fe1b7
|
|||
|
||||
/**
|
||||
* Gets the metadata for this block
|
||||
@@ -646,5 +646,15 @@ public interface Block extends Metadatable {
|
||||
@@ -672,5 +672,15 @@ public interface Block extends Metadatable {
|
||||
* @return the sound group for this block
|
||||
*/
|
||||
@NotNull org.bukkit.SoundGroup getBlockSoundGroup();
|
||||
|
|
|
@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukki
|
|||
index 2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9..4a408361ac86b8c490942686c2709817338f4f59 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -656,5 +656,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -682,5 +682,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@NotNull
|
||||
@Deprecated
|
||||
String getTranslationKey();
|
||||
|
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] Block Ticking API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index e405c279f6135c94c775a856ab88fd3cace6bd5c..9930ebe7a23d306c602840fd43652fbdaba481b3 100644
|
||||
index 0b02bfce9ee01c6beb14348129ab86c751c01e54..aba40431c5a1ae43106a678445483e0653e130d1 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -562,6 +562,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -588,6 +588,21 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
* @return true if the block was destroyed
|
||||
*/
|
||||
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect);
|
||||
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
||||
+
|
||||
+ /**
|
||||
+ * Causes the block to be ticked, this is different from {@link Block#randomTick()},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue