mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
2f92d4e00e
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: 01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs bc145b90 PR-940: Create registry for banner pattern and cat type CraftBukkit Changes: cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways 4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs b483a20db PR-1303: Create registry for banner pattern and cat type 4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
108 lines
4.6 KiB
Diff
108 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
Date: Sun, 5 Dec 2021 14:58:55 -0500
|
|
Subject: [PATCH] Expand FallingBlock API
|
|
|
|
- add auto expire setting
|
|
- add setter for block data
|
|
- add accessors for block state
|
|
|
|
Co-authored-by: Lukas Planz <lukas.planz@web.de>
|
|
|
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
|
index b191d304832fe3475b76fdce131db51e5042ac01..298e63e0ca9d4cbac3172fd93a217af79fad91df 100644
|
|
--- a/src/main/java/org/bukkit/World.java
|
|
+++ b/src/main/java/org/bukkit/World.java
|
|
@@ -2220,8 +2220,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
|
* @return The spawned {@link FallingBlock} instance
|
|
* @throws IllegalArgumentException if {@link Location} or {@link
|
|
* MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block
|
|
+ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
|
|
*/
|
|
@NotNull
|
|
+ @Deprecated // Paper
|
|
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException;
|
|
|
|
/**
|
|
@@ -2234,8 +2236,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
|
* @return The spawned {@link FallingBlock} instance
|
|
* @throws IllegalArgumentException if {@link Location} or {@link
|
|
* BlockData} are null
|
|
+ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
|
|
*/
|
|
@NotNull
|
|
+ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper
|
|
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException;
|
|
|
|
/**
|
|
@@ -2252,7 +2256,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
|
* @return The spawned {@link FallingBlock} instance
|
|
* @throws IllegalArgumentException if {@link Location} or {@link
|
|
* Material} are null or {@link Material} is not a block
|
|
- * @deprecated Magic value
|
|
+ * @deprecated Magic value. Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
|
|
*/
|
|
@Deprecated
|
|
@NotNull
|
|
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..a945e76dd61ef132ae3f3ee69635c927b1180523 100644
|
|
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
@@ -26,6 +26,33 @@ public interface FallingBlock extends Entity {
|
|
*/
|
|
@NotNull
|
|
BlockData getBlockData();
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Sets the data for the falling block.
|
|
+ * <br>
|
|
+ * Any potential additional data currently stored in the falling blocks {@link #getBlockState()} will be
|
|
+ * purged by calling this setter.
|
|
+ *
|
|
+ * @param blockData the data to use as the block
|
|
+ */
|
|
+ void setBlockData(@NotNull BlockData blockData);
|
|
+
|
|
+ /**
|
|
+ * Get the data of the falling block represented as a {@link org.bukkit.block.BlockState BlockState}
|
|
+ * which includes potential NBT data that gets applied when the block gets placed on landing.
|
|
+ *
|
|
+ * @return the BlockState representing this block
|
|
+ */
|
|
+ @NotNull
|
|
+ org.bukkit.block.BlockState getBlockState();
|
|
+
|
|
+ /**
|
|
+ * Sets the {@link BlockData} and possibly present tile entity data for the falling block.
|
|
+ *
|
|
+ * @param blockState the BlockState to use
|
|
+ */
|
|
+ void setBlockState(@NotNull org.bukkit.block.BlockState blockState);
|
|
+ // Paper end
|
|
|
|
/**
|
|
* Get if the falling block will break into an item if it cannot be placed.
|
|
@@ -137,4 +164,23 @@ public interface FallingBlock extends Entity {
|
|
default org.bukkit.Location getSourceLoc() {
|
|
return this.getOrigin();
|
|
}
|
|
+ // Paper Start - Auto expire setting
|
|
+ /**
|
|
+ * Sets if this falling block should expire after:
|
|
+ * - 30 seconds
|
|
+ * - 5 seconds and is outside of the world
|
|
+ *
|
|
+ * @return if this behavior occurs
|
|
+ */
|
|
+ boolean doesAutoExpire();
|
|
+
|
|
+ /**
|
|
+ * Sets if this falling block should expire after:
|
|
+ * - 30 seconds
|
|
+ * - 5 seconds and is outside of the world
|
|
+ *
|
|
+ * @param autoExpires if this behavior should occur
|
|
+ */
|
|
+ void shouldAutoExpire(boolean autoExpires);
|
|
+ // Paper End - Auto expire setting
|
|
}
|