Skip to content

Commit

Permalink
#20240618.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonCaramel committed Jun 18, 2024
1 parent 3476f03 commit 6e88901
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 83 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = 1.21-R0.1-SNAPSHOT

mcVersion = 1.21

paperCommit = 097284d06be5a2456fa3123fbbb127904134a021
paperCommit = b4b820851f5291c467b1a9590750a10ec67af4f6

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
8 changes: 4 additions & 4 deletions patches/0007-Add-more-API-for-EntityDamageEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ index 0000000000000000000000000000000000000000..a028efebea58fe8c5d633e5d4e079f05
+ void setOverrideKnockback(final @Nullable Vector knockback);
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 0e9ccfee7a03d341e7c4d271f53b4ed168b404ef..57d55297b6cbb3e31eea65c3fe1f37828f7b62a2 100644
index 11bccf6c27b8b2a2ed558a1375a3b3adc7952076..693dc6a9236ff7a3fd53c3c7f3d8abfe03fe73d6 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -275,4 +275,6 @@ public interface UnsafeValues {
// Paper end - lifecycle event API
@@ -279,4 +279,6 @@ public interface UnsafeValues {
<A extends Keyed, M> io.papermc.paper.registry.tag.@Nullable Tag<A> getTag(io.papermc.paper.registry.tag.@NotNull TagKey<A> tagKey); // Paper - hack to get tags for non-server backed registries

@NotNull java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines
ItemStack createEmptyStack(); // Paper - proxy ItemStack
+
+ @NotNull moe.caramel.daydream.world.DamageMata getDamageMeta(@NotNull Object damageSource); // Daydream - Add more API for EntityDamageEvent
}
Expand Down
8 changes: 4 additions & 4 deletions patches/0018-Add-sendTitleUpdate-for-inventories.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Subject: [PATCH] Add sendTitleUpdate for inventories
https://github.com/PaperMC/Paper/pull/7979

diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059..636f0a6151d939cebf4696fd8c958eee700f5ca3 100644
index 1e50dba6bb8753e6c1adff59ee0ff93adf3bfd4f..d50c4b6e82196ed5c8179e76397d8debb60ac890 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -489,4 +489,16 @@ public abstract class InventoryView {
@@ -313,4 +313,16 @@ public interface InventoryView {
* @param title The new title.
*/
public abstract void setTitle(@NotNull String title);
public void setTitle(@NotNull String title);
+
+ // Paper start - (Daydream) Add sendTitleUpdate for inventories
+ /**
Expand All @@ -23,6 +23,6 @@ index ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059..636f0a6151d939cebf4696fd8c958eee
+ *
+ * @param title the new title
+ */
+ public abstract void sendTitleUpdate(@NotNull net.kyori.adventure.text.Component title);
+ public void sendTitleUpdate(@NotNull net.kyori.adventure.text.Component title);
+ // Paper end - (Daydream) Add sendTitleUpdate for inventories
}
4 changes: 2 additions & 2 deletions patches/0020-Add-more-Projectile-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add more Projectile API


diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
index a3a979ca7cbc89c43713fbcc9e6524fb347fa2e2..8ae88b3cff7402d7d4088b3bc8697dd18fa40056 100644
index 15c7149cf9f6a0b1d99134122bb36672de72c7ca..807bf5480332500300a57f60282ebb62f3e79c61 100644
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
@@ -264,4 +264,20 @@ public interface AbstractArrow extends Projectile {
@@ -272,4 +272,20 @@ public interface AbstractArrow extends Projectile {
*/
void setHitSound(@NotNull org.bukkit.Sound sound);
// Paper end - more projectile API
Expand Down
34 changes: 11 additions & 23 deletions patches/0022-Add-ItemStack-Utilities.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,16 @@ Subject: [PATCH] Add ItemStack Utilities


diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 57d55297b6cbb3e31eea65c3fe1f37828f7b62a2..0c379c5ec7d8f32c4776c1decc408c780a19e7ad 100644
index 693dc6a9236ff7a3fd53c3c7f3d8abfe03fe73d6..fa74c6a059dd36efe3c744e495c807308fe528cc 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -277,4 +277,37 @@ public interface UnsafeValues {
@NotNull java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines
@@ -281,4 +281,25 @@ public interface UnsafeValues {
ItemStack createEmptyStack(); // Paper - proxy ItemStack

@NotNull moe.caramel.daydream.world.DamageMata getDamageMeta(@NotNull Object damageSource); // Daydream - Add more API for EntityDamageEvent
+
+ // Daydream start - Add ItemStack Utilities
+ /**
+ * Create a new ItemStack
+ * (for Paper Compatibility)
+ *
+ * @param material the material
+ * @param count item count
+ * @return ItemStack
+ * @see <a href=https://github.com/PaperMC/Paper/pull/8711>here</a>
+ */
+ @NotNull
+ ItemStack newItem(@NotNull org.bukkit.Material material, int count);
+
+ /**
+ * Inventory Iterator를 생성합니다.
+ *
+ * @param inventory 대상 인벤토리
Expand All @@ -47,10 +35,10 @@ index 57d55297b6cbb3e31eea65c3fe1f37828f7b62a2..0c379c5ec7d8f32c4776c1decc408c78
+ // Daydream end - Add ItemStack Utilities
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca15c9cf84f 100644
index f603b5b6ba80af919f415322583a8345a5b1358a..ed6ead5112ee47115f353cba4d5c6649de0c3fee 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -36,6 +36,99 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -71,6 +71,99 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@Utility
protected ItemStack() {}

Expand All @@ -66,7 +54,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static ItemStack create(final @NotNull Material type) {
+ return Bukkit.getUnsafe().newItem(type, 1);
+ return ItemStack.of(type);
+ }
+
+ /**
Expand All @@ -78,7 +66,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static ItemStack create(final @NotNull Material type, final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) {
+ final ItemStack item = Bukkit.getUnsafe().newItem(type, 1);
+ final ItemStack item = ItemStack.of(type);
+ item.editMeta(consumer);
+ return item;
+ }
Expand All @@ -94,7 +82,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static <M extends ItemMeta> ItemStack create(final @NotNull Material type, final @NotNull Class<M> metaClass, final @NotNull java.util.function.Consumer<@NotNull ? super M> consumer) {
+ final ItemStack item = Bukkit.getUnsafe().newItem(type, 1);
+ final ItemStack item = ItemStack.of(type);
+ item.editMeta(metaClass, consumer);
+ return item;
+ }
Expand All @@ -111,7 +99,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static ItemStack create(final @NotNull Material type, final int amount) {
+ return Bukkit.getUnsafe().newItem(type, amount);
+ return ItemStack.of(type, amount);
+ }
+
+ /**
Expand All @@ -124,7 +112,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static ItemStack create(final @NotNull Material type, final int amount, final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) {
+ final ItemStack item = Bukkit.getUnsafe().newItem(type, amount);
+ final ItemStack item = ItemStack.of(type, amount);
+ item.editMeta(consumer);
+ return item;
+ }
Expand All @@ -141,7 +129,7 @@ index c64413a6740b604282984dea2a8430a6e7478d68..68253480cf0d6cdbfae6a15ea4d39ca1
+ */
+ @NotNull
+ public static <M extends ItemMeta> ItemStack create(final @NotNull Material type, final int amount, final @NotNull Class<M> metaClass, final @NotNull java.util.function.Consumer<@NotNull ? super M> consumer) {
+ final ItemStack item = Bukkit.getUnsafe().newItem(type, amount);
+ final ItemStack item = ItemStack.of(type, amount);
+ item.editMeta(metaClass, consumer);
+ return item;
+ }
Expand Down
120 changes: 78 additions & 42 deletions patches/0026-Add-more-PDC-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,17 @@ Date: Thu, 20 Jul 2023 04:32:28 +0900
Subject: [PATCH] Add more PDC API


diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9882ed63f 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
@@ -219,4 +219,155 @@ public interface PersistentDataContainer {
this.readFromBytes(bytes, true);
}
// Paper end - byte array serialization
diff --git a/src/main/java/io/papermc/paper/persistence/PersistentDataContainerView.java b/src/main/java/io/papermc/paper/persistence/PersistentDataContainerView.java
index 4a4949fde3f03e2ea9d2dde245f7dea119e202bf..606f1b5ef72d4de9164e8ee19612117dfda42d3a 100644
--- a/src/main/java/io/papermc/paper/persistence/PersistentDataContainerView.java
+++ b/src/main/java/io/papermc/paper/persistence/PersistentDataContainerView.java
@@ -164,4 +164,118 @@ public interface PersistentDataContainerView {
* @throws java.io.IOException if we fail to write this container to a byte array
*/
byte @NonNull [] serializeToBytes() throws java.io.IOException;
+
+ // Daydream start - Add more PDC API
+ /**
+ * Stores a metadata value on the {@link PersistentDataHolder} instance.
+ * <p>
+ * This API cannot be used to manipulate minecraft data, as the values will
+ * be stored using your namespace. This method will override any existing
+ * value the {@link PersistentDataHolder} may have stored under the provided
+ * key.
+ *
+ * @param key the key this value will be stored under
+ * @param type the type this tag uses
+ * @param value the value to store in the tag
+ * @param <P> the generic java type of the tag value
+ * @param <C> the generic type of the object to store
+ *
+ * @throws IllegalArgumentException if the key is null
+ * @throws IllegalArgumentException if the type is null
+ * @throws IllegalArgumentException if the value is null. Removing a tag should
+ * be done using {@link #remove(String)}
+ * @throws IllegalArgumentException if no suitable adapter was found for
+ * the {@link PersistentDataType#getPrimitiveType()}
+ */
+ <P, C> void set(@NotNull String key, @NotNull PersistentDataType<P, C> type, @NotNull C value);
+
+ /**
+ * Returns if the persistent metadata provider has metadata registered
+ * matching the provided parameters.
+ * <p>
Expand Down Expand Up @@ -66,7 +43,7 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ * @throws IllegalArgumentException if the type to cast the found object to is
+ * null
+ */
+ <P, C> boolean has(@NotNull String key, @NotNull PersistentDataType<P, C> type);
+ <P, C> boolean has(@NonNull String key, @NonNull PersistentDataType<P, C> type);
+
+ /**
+ * Returns if the persistent metadata provider has metadata registered matching
Expand All @@ -85,7 +62,7 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ *
+ * @throws IllegalArgumentException if the key to look up is null
+ */
+ boolean has(@NotNull String key);
+ boolean has(@NonNull String key);
+
+ /**
+ * Returns the metadata value that is stored on the
Expand All @@ -108,8 +85,8 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ * the {@link
+ * PersistentDataType#getPrimitiveType()}
+ */
+ @Nullable
+ <P, C> C get(@NotNull String key, @NotNull PersistentDataType<P, C> type);
+ @org.jetbrains.annotations.Nullable
+ <P, C> C get(@NonNull String key, @NonNull PersistentDataType<P, C> type);
+
+ /**
+ * Returns the metadata value that is stored on the
Expand All @@ -134,8 +111,8 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ * @throws IllegalArgumentException if no suitable adapter was found for
+ * the {@link PersistentDataType#getPrimitiveType()}
+ */
+ @NotNull
+ <P, C> C getOrDefault(@NotNull String key, @NotNull PersistentDataType<P, C> type, @NotNull C defaultValue);
+ @NonNull
+ <P, C> C getOrDefault(@NonNull String key, @NonNull PersistentDataType<P, C> type, @NonNull C defaultValue);
+
+ /**
+ * Get the set of keys present on this {@link PersistentDataContainer}
Expand All @@ -146,8 +123,67 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ *
+ * @return the key set
+ */
+ @NotNull
+ @NonNull
+ Set<String> keys();
+ // Daydream end - Add more PDC API
}
diff --git a/src/main/java/io/papermc/paper/persistence/PersistentDataViewHolder.java b/src/main/java/io/papermc/paper/persistence/PersistentDataViewHolder.java
index 9789916f949374bfb50da535b076180700f7ae73..e297ecf95e623db9e8c4c28c1b02c5ee0c38f693 100644
--- a/src/main/java/io/papermc/paper/persistence/PersistentDataViewHolder.java
+++ b/src/main/java/io/papermc/paper/persistence/PersistentDataViewHolder.java
@@ -20,4 +20,20 @@ public interface PersistentDataViewHolder {
* @return the persistent data container view
*/
@NonNull PersistentDataContainerView getPersistentDataContainer();
+
+ // Daydream start - Add more PDC API
+ /**
+ * Returns a custom tag container view capable of viewing tags on the object.
+ * <p>
+ * Note that the tags stored on this container are all stored under their
+ * own custom namespace therefore modifying default tags using this
+ * {@link PersistentDataViewHolder} is impossible.
+ *
+ * @return the persistent data container view
+ */
+ @NonNull
+ default PersistentDataContainerView getPdc() {
+ return getPersistentDataContainer();
+ }
+ // Daydream end - Add more PDC API
}
diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
index 0f40eb52f6e2a5b6932cf9f223c1bbe9ab9eab1b..a601da2e7facb2172cdd186487b8a7b22cf0fc25 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
@@ -71,4 +71,43 @@ public interface PersistentDataContainer extends io.papermc.paper.persistence.Pe
this.readFromBytes(bytes, true);
}
// Paper end - byte array serialization
+
+ // Daydream start - Add more PDC API
+ /**
+ * Stores a metadata value on the {@link PersistentDataHolder} instance.
+ * <p>
+ * This API cannot be used to manipulate minecraft data, as the values will
+ * be stored using your namespace. This method will override any existing
+ * value the {@link PersistentDataHolder} may have stored under the provided
+ * key.
+ *
+ * @param key the key this value will be stored under
+ * @param type the type this tag uses
+ * @param value the value to store in the tag
+ * @param <P> the generic java type of the tag value
+ * @param <C> the generic type of the object to store
+ *
+ * @throws IllegalArgumentException if the key is null
+ * @throws IllegalArgumentException if the type is null
+ * @throws IllegalArgumentException if the value is null. Removing a tag should
+ * be done using {@link #remove(String)}
+ * @throws IllegalArgumentException if no suitable adapter was found for
+ * the {@link PersistentDataType#getPrimitiveType()}
+ */
+ <P, C> void set(@NotNull String key, @NotNull PersistentDataType<P, C> type, @NotNull C value);
+
+ /**
+ * Removes a custom key from the {@link PersistentDataHolder} instance.
Expand All @@ -165,10 +201,10 @@ index decf3b1949d4653a9fb01684b93ff91048137076..07d0b8117740eec35e318addd5bca5a9
+ // Daydream end - Add more PDC API
}
diff --git a/src/main/java/org/bukkit/persistence/PersistentDataHolder.java b/src/main/java/org/bukkit/persistence/PersistentDataHolder.java
index 80b277cc57f092f04fbf7810ac78d250b207b775..9baa25a9b7bf66b47ac05385f3be12c353eab00b 100644
index 71f33c1265bc753ef40108ffce0d4bd8656d2903..8670975efd18c63a4bfee4c284471cfc596b66ce 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataHolder.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataHolder.java
@@ -20,4 +20,19 @@ public interface PersistentDataHolder {
@@ -22,4 +22,19 @@ public interface PersistentDataHolder extends io.papermc.paper.persistence.Persi
@NotNull
PersistentDataContainer getPersistentDataContainer();

Expand All @@ -182,8 +218,8 @@ index 80b277cc57f092f04fbf7810ac78d250b207b775..9baa25a9b7bf66b47ac05385f3be12c3
+ *
+ * @return the persistent metadata container
+ */
+ @NotNull
+ default PersistentDataContainer getPdc() {
+ @Override
+ default @NotNull PersistentDataContainer getPdc() {
+ return getPersistentDataContainer();
+ }
+ // Daydream end - Add more PDC API
Expand Down
4 changes: 2 additions & 2 deletions patches/0033-Add-EnhancedModelEngine-Support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add EnhancedModelEngine Support


diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 0c379c5ec7d8f32c4776c1decc408c780a19e7ad..09af8ab816892692f35bccb5418978db86119038 100644
index fa74c6a059dd36efe3c744e495c807308fe528cc..fcf32ed574bdaf3c982c8f7156f46227f40b60af 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -310,4 +310,34 @@ public interface UnsafeValues {
@@ -302,4 +302,34 @@ public interface UnsafeValues {
@NotNull
java.util.ListIterator<ItemStack> createInventoryIterator(@NotNull org.bukkit.inventory.Inventory inventory, int nextIndex);
// Daydream end - Add ItemStack Utilities
Expand Down
Loading

0 comments on commit 6e88901

Please sign in to comment.