File tree Expand file tree Collapse file tree 7 files changed +52
-5
lines changed
src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox
src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/versions Expand file tree Collapse file tree 7 files changed +52
-5
lines changed Original file line number Diff line number Diff line change 1818 with :
1919 arguments : build
2020 - name : Upload Build Artifact
21- uses : actions/upload-artifact@v2
21+ uses : actions/upload-artifact@v4
2222 with :
2323 name : musicbox
2424 path : |
3131 - name : Checkout code
3232 uses : actions/checkout@v2
3333 - name : Download Build Artifact
34- uses : actions/download-artifact@v2
34+ uses : actions/download-artifact@v4
3535 with :
3636 name : musicbox
3737 path : build/libs/
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ allprojects {
2424 apply (plugin = " java-library" );
2525 apply (plugin = " io.freefair.lombok" )
2626
27- version = " 2.1.2 "
27+ version = " 2.1.3 "
2828
2929 repositories {
3030 mavenCentral()
@@ -67,4 +67,5 @@ dependencies {
6767 api(project(" :nms:versions:20_2" , " reobf" ))
6868 api(project(" :nms:versions:20_3" , " reobf" ))
6969 api(project(" :nms:versions:20_5" , " reobf" ))
70+ api(project(" :nms:versions:21" , " reobf" ))
7071}
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ public class JukeboxFactory {
1414 int iV = NMSUtils .parseMajorVersion (raw );
1515
1616 String className ;
17- if (iV == 20 ) {
17+ if (iV == 21 ) {
18+ className = START_PATH + "V21" ;
19+ } else if (iV == 20 ) {
1820 switch (raw ) {
1921 case "1.20" :
2022 case "1.20.1" :
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ plugins {
44java {
55 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
66}
7+ repositories {
8+ maven(" https://repo.minebench.de" ) // kiory fix
9+ }
710dependencies {
811 paperweight.paperDevBundle(" 1.20.5-R0.1-SNAPSHOT" )
912}
Original file line number Diff line number Diff line change 1+ plugins {
2+ id(" io.papermc.paperweight.userdev" )
3+ }
4+ java {
5+ toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
6+ }
7+ dependencies {
8+ paperweight.paperDevBundle(" 1.21-R0.1-SNAPSHOT" )
9+ }
Original file line number Diff line number Diff line change 1+ package ru .spliterash .musicbox .minecraft .nms .jukebox .versions ;
2+
3+ import net .minecraft .world .level .block .entity .JukeboxBlockEntity ;
4+ import org .bukkit .block .Jukebox ;
5+ import org .bukkit .craftbukkit .block .CraftJukebox ;
6+ import org .bukkit .craftbukkit .inventory .CraftItemStack ;
7+ import org .bukkit .inventory .ItemStack ;
8+ import ru .spliterash .musicbox .minecraft .nms .jukebox .IJukebox ;
9+
10+ public class V21 implements IJukebox {
11+ private final JukeboxBlockEntity tileEntity ;
12+
13+ public V21 (Jukebox jukebox ) {
14+ CraftJukebox craft = (CraftJukebox ) jukebox ;
15+ tileEntity = craft .getTileEntity ();
16+ }
17+
18+ public void setJukebox (ItemStack item ) {
19+ net .minecraft .world .item .ItemStack converted = CraftItemStack .asNMSCopy (item );
20+ tileEntity .setSongItemWithoutPlaying (converted , 0 );
21+
22+ }
23+
24+ public ItemStack getJukebox () {
25+ net .minecraft .world .item .ItemStack nmsItem = tileEntity .getItem (0 );
26+ if (nmsItem .isEmpty ())
27+ return null ;
28+
29+ return CraftItemStack .asBukkitCopy (nmsItem );
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ include "nms:versions:19_4"
1212include " nms:versions:20_1"
1313include " nms:versions:20_2"
1414include " nms:versions:20_3"
15- include " nms:versions:20_5"
15+ include " nms:versions:20_5"
16+ include " nms:versions:21"
You can’t perform that action at this time.
0 commit comments