refactor: simplify Song class by removing NamespacedKey and update createDiscs method
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 31s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 31s
This commit is contained in:
@@ -28,14 +28,12 @@ public class CustomMusicDiscs implements Listener {
|
||||
class Song {
|
||||
private String title;
|
||||
private String artist;
|
||||
private NamespacedKey nsk;
|
||||
private int number;
|
||||
private String oggFile;
|
||||
|
||||
public Song(String title, String artist, NamespacedKey nsk, int number, String oggFile) {
|
||||
public Song(String title, String artist, int number, String oggFile) {
|
||||
this.title = title;
|
||||
this.artist = artist;
|
||||
this.nsk = nsk;
|
||||
this.number = number;
|
||||
this.oggFile = oggFile;
|
||||
}
|
||||
@@ -48,10 +46,6 @@ public class CustomMusicDiscs implements Listener {
|
||||
return artist;
|
||||
}
|
||||
|
||||
public NamespacedKey getNsk() {
|
||||
return nsk;
|
||||
}
|
||||
|
||||
public int getNo() {
|
||||
return number;
|
||||
}
|
||||
@@ -70,14 +64,14 @@ public class CustomMusicDiscs implements Listener {
|
||||
public void createDiscs(App app) {
|
||||
List<Song> songList = new ArrayList<>();
|
||||
|
||||
songList.add(new Song("Stairway to Heaven", "Led Zeppelin", new NamespacedKey(app, "custom_music_disc"), 1,
|
||||
"stairway_to_heaven"));
|
||||
songList.add(new Song("M@GICAL☆CURE! LOVE ♥ SHOT!", "Hatsune Miku",
|
||||
new NamespacedKey(app, "custom_music_disc2"), 2, "magical_cure_love_shot"));
|
||||
songList.add(new Song("Aishiteru Banzai!", "LoveLive!", new NamespacedKey(app, "custom_music_disc3"), 3,
|
||||
"aishiteru_banzai"));
|
||||
songList.add(new Song("Miku", "Anamanaguchi", new NamespacedKey(app, "custom_music_disc4"), 4, "miku"));
|
||||
songList.add(new Song("Melt", "Hatsune Miku", new NamespacedKey(app, "custom_music_disc5"), 5, "melt"));
|
||||
songList.add(new Song("Stairway to Heaven", "Led Zeppelin", 1,"stairway_to_heaven"));
|
||||
songList.add(new Song("M@GICAL☆CURE! LOVE ♥ SHOT!", "Hatsune Miku", 2, "magical_cure_love_shot"));
|
||||
songList.add(new Song("Aishiteru Banzai!", "LoveLive!", 3, "aishiteru_banzai"));
|
||||
songList.add(new Song("Miku", "Anamanaguchi", 4, "miku"));
|
||||
songList.add(new Song("Melt", "Hatsune Miku", 5, "melt"));
|
||||
songList.add(new Song("Wurzelheim", "Gamefreak", 6, "littleroot_town"));
|
||||
songList.add(new Song("Lavandia", "Gamefreak", 7, "lavandia"));
|
||||
songList.add(new Song("Neuborkia", "Gamefreak", 8, "neuborkia"));
|
||||
|
||||
for (Song song : songList) {
|
||||
ItemStack customDisc = new ItemStack(Material.MUSIC_DISC_13);
|
||||
@@ -92,7 +86,7 @@ public class CustomMusicDiscs implements Listener {
|
||||
customDisc.setItemMeta(meta);
|
||||
}
|
||||
|
||||
NamespacedKey nskDisc = song.nsk;
|
||||
NamespacedKey nskDisc = new NamespacedKey(app, "custom_music_disc" + song.number);
|
||||
ShapelessRecipe reciped = new ShapelessRecipe(nskDisc, customDisc);
|
||||
reciped.addIngredient(1, Material.DIAMOND);
|
||||
reciped.addIngredient(1, Material.PAPER);
|
||||
|
||||
Reference in New Issue
Block a user