[SPIGOT-6388] Shulker.getPeek() function Created: 05/Mar/21  Updated: 28/Apr/21  Resolved: 19/Apr/21

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

Type: New Feature Priority: Minor
Reporter: Evil Witchdoctor Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version:   bukkit-1.16-R1 and/or spigot-api-1.16-R1
Guidelines Read: Yes

 Description   

It would be nice to be able to get the state of a Shulker entity without NMS/reflection:

shulker.isClosed() -> boolean

Context:
Shulkers will periodically open or close their shells to peek out or shoot an enemy.



 Comments   
Comment by Evil Witchdoctor [ 15/Apr/21 ]

Awesome, thanks!
I don't have permission to access the links, but I agree with the decision here that an enum makes the most sense.

Comment by Julian v.d Berkmortel [ 14/Apr/21 ]

I created a pull request implementing both the API and implementation.

Bukkit: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/599
CraftBukkit: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/821

Comment by Baciu Vlad Robert [ 14/Apr/21 ]

I agree that we should use an enum for this. The name of the enum itself could be ShulkerState while its constants could be CLOSED, PEEKING, OPEN.

Comment by Julian v.d Berkmortel [ 13/Apr/21 ]

"Peek" is an NBT tag which can be 0 (closed), 30 (partially open) or 100 (completely open with rotating shell). I've tested it with numbers like 20, 150, 101, 200 et cetera but it seems that they result in either the shulker being partially or completely open.

I'd like to work on this but before I do it would be good to have the API outlined. I'd argue for an enum because there are only three numbers that have a real "meaning" in regards to the animation, I don't exactly know what the name of them should be and the name of the enum itself (if an enum would be decided upon).

Generated at Sat Mar 29 12:01:27 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.