[SPIGOT-4503] Jukebox RecordItem is not only a Material Created: 25/Nov/18  Updated: 21/Dec/18  Resolved: 21/Dec/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Julia Fox Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

Irrelevant


Issue Links:
Relates
relates to SPIGOT-4543 Jukebox.setPlaying needs updates for ... Resolved
Version: 1.13-Latest
Guidelines Read: Yes

 Description   

Hello JIRA people,

the Jukebox block has a method setPlaying(Material) and a Method getPlaying():Material , while that is a good idea it might as well be an ItemStack in both cases because jukeboxes DO store the ItemMeta and/or Attributes of the record item.

While there are various ways of obtaining what is inside of the jukebox because it’s rather easy to get the NBT of the TileEntityJukebox-
It is next to impossible to get that TileEntity itself to set or edit its NBT and half of the time a set method executed in that context behaves wierdly (while attempting to set a named record for example inside the jukebox)

Context to better understand this; I am currently working on a plugin that adds custom music disks and I need to be able to put ItemStacks inside of jukeboxes without making them ‚play‘ in game sense;

So what I would suggest is another three interaction methods for Jukeboxes:
1: Jukebox#getRecordItem():ItemStack
2: Jukebox#setRecordItem(ItemStack recordItem):Boolean
3: Jukebox#setRecordItem(ItemStack recordItem, boolean startPlaying):Boolean

To the JIRA Mods: You don’t have to take your time to implement this, I already did but I want to hear your feedback before I make an attempt to contribute this.

Thanks -Julia



 Comments   
Comment by md_5 [ 21/Dec/18 ]

Works for me, but the code needs updates anyway.
Maybe you forgot to call .update

Comment by Julia Fox [ 18/Dec/18 ]

Damn not setRecord but setPlaying ... yea the public API for this is t working atm 1.13.x

Comment by Julia Fox [ 18/Dec/18 ]

I should be more clear, calling setRecord(Material) on 1.13.d doesn’t do anything or errors, I assume it’s something with the TileEntity but I really haven’t had the time

Comment by Julia Fox [ 18/Dec/18 ]

Sorry nd_5 I haven’t had the time, I’ll have more time after Christmas
In the meantime I figured out that the current API is broken too, as in just doesn’t work or errors, I haven’t figured out what’s behind that though either

Comment by md_5 [ 18/Dec/18 ]

Did you make progress on this?

Comment by md_5 [ 28/Nov/18 ]

Yes thats fine. If you end up using one a lot you can switch the imports

Comment by Julia Fox [ 28/Nov/18 ]

Also follow up, the class already imports the net Minecraft type ItemStack, so is it okay for me to use org.bukkit.inventory.ItemStack directly? I just want to know in case that is a no-no, but in the end we’ see after my PR...

Comment by Julia Fox [ 28/Nov/18 ]

How does an item behave with a material that isn’t a music disc? Because nothing makes sure that it’s a music disc even with the current API? I’ll have to test that later, and yes I’ll take the stacksize into consideration, thanks md_5! And yea I already figured that thing out with the CLA

Comment by md_5 [ 28/Nov/18 ]

You need to sign the CLA with your JIRA account details - then you will be able to access stash.

One thing that comes to mind is setting a stack size greater than 1 will probably behave badly.

Comment by Julia Fox [ 25/Nov/18 ]

Addition: So even if I would want to contribute this? There is no way to create an account on the Stash side of things, would I need to submit as request here? I’ve only ever used github so this is a bit confusing to me o_O

Generated at Tue Apr 22 05:09:37 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.