Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ItemFrameMeta API #11270

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions patches/api/0484-add-ItemFrameMeta-API.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TehBrian <tehbrian@proton.me>
Date: Thu, 15 Aug 2024 17:06:29 -0400
Subject: [PATCH] add ItemFrameMeta API


diff --git a/src/main/java/io/papermc/paper/inventory/meta/ItemFrameMeta.java b/src/main/java/io/papermc/paper/inventory/meta/ItemFrameMeta.java
new file mode 100644
index 0000000000000000000000000000000000000000..65b388e0a48a5927448a79b0f2e7742895038034
--- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/meta/ItemFrameMeta.java
@@ -0,0 +1,53 @@
+package io.papermc.paper.inventory.meta;
+
+import org.bukkit.inventory.meta.ItemMeta;
+
+public interface ItemFrameMeta extends ItemMeta {
+ /**
+ * Gets whether the item frame is fixed.
+ *
+ * <p>Fixed item frames:</p>
+ * <ul>
+ * <li>Cannot have its contents modified or rotated.</li>
+ * <li>Will not break in absence of a supporting block.</li>
+ * <li>Will not take damage (except by players in creative).</li>
+ * <li>Cannot be moved by pistons.</li>
+ * </ul>
+ *
+ * @return whether the item frame is fixed
+ */
+ boolean isFixed();
+
+ /**
+ * Sets whether the item frame is fixed.
+ *
+ * <p>Fixed item frames:</p>
+ * <ul>
+ * <li>Cannot have its contents modified or rotated.</li>
+ * <li>Will not break in absence of a supporting block.</li>
+ * <li>Will not take damage (except by players in creative).</li>
+ * <li>Cannot be moved by pistons.</li>
+ * </ul>
+ *
+ * @param fixed true if the item frame is fixed
+ */
+ void setFixed(boolean fixed);
+
+ /**
+ * Gets whether the item frame's <b>frame</b> (background) is invisible.
+ *
+ * <p>Contents (items, maps) within invisible item frames are still visible.</p>
+ *
+ * @return whether the frame is invisible
+ */
+ boolean isInvisible();
+
+ /**
+ * Sets whether the item frame's <b>frame</b> (background) is invisible.
+ *
+ * <p>Contents (items, maps) within invisible item frames are still visible.</p>
+ *
+ * @param invisible true if the frame is invisible
+ */
+ void setInvisible(boolean invisible);
+}
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index 0168f0a14a3e899e84c5e36963ff79950ab580fb..b52c871297fb351e3781fe6163790def4f95f17f 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -1733,8 +1733,16 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
*/
ItemType.Typed<BookMeta> WRITTEN_BOOK = getItemType("written_book");
ItemType.Typed<ItemMeta> MACE = getItemType("mace");
- ItemType.Typed<ItemMeta> ITEM_FRAME = getItemType("item_frame");
- ItemType.Typed<ItemMeta> GLOW_ITEM_FRAME = getItemType("glow_item_frame");
+ // Paper start - add ItemFrameMeta API
+ /**
+ * ItemMeta: {@link io.papermc.paper.inventory.meta.ItemFrameMeta}
+ */
+ ItemType.Typed<io.papermc.paper.inventory.meta.ItemFrameMeta> ITEM_FRAME = getItemType("item_frame");
+ /**
+ * ItemMeta: {@link io.papermc.paper.inventory.meta.ItemFrameMeta}
+ */
+ ItemType.Typed<io.papermc.paper.inventory.meta.ItemFrameMeta> GLOW_ITEM_FRAME = getItemType("glow_item_frame");
+ // Paper end - add ItemFrameMeta API
ItemType.Typed<ItemMeta> FLOWER_POT = getItemType("flower_pot");
ItemType.Typed<ItemMeta> CARROT = getItemType("carrot");
ItemType.Typed<ItemMeta> POTATO = getItemType("potato");
Loading
Loading