Skip to content

Commit

Permalink
Add support for new custom nbs player
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrptonaught committed Jun 20, 2024
1 parent be02364 commit 70b61aa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ shadowJar {
relocate 'okio' , 'net.dv8tion.shaded.okio'

//Exclude META-INF entries of shaded deps
exclude('META-INF/**', '**/*.pdn','**/*.bbmodel')
exclude('META-INF/**')
// include() upsets shadow, so use from() instead
from('LICENSE.md', 'NOTICE.txt')
from('licenses') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import net.kyrptonaught.serverutils.dropevent.DropEventMod;
import net.kyrptonaught.serverutils.healthcmd.HealthCMDMod;
import net.kyrptonaught.serverutils.knockback.KnockbackMod;
import net.kyrptonaught.serverutils.noteblockMusic.NoteblockMusicMod;
import net.kyrptonaught.serverutils.panoramaViewer.PanoramaViewer;
import net.kyrptonaught.serverutils.personatus.PersonatusModule;
import net.kyrptonaught.serverutils.playerJoinLocation.PlayerJoinLocationMod;
Expand Down Expand Up @@ -90,7 +89,6 @@ public class ServerUtilsMod implements ModInitializer {
public static WhitelistSyncMod whitelistSyncMod = (WhitelistSyncMod) registerModule("whitelistsync", new WhitelistSyncMod());
public static SnowballKnockbackMod snowballKnockback = (SnowballKnockbackMod) registerModule("snowballknockback", new SnowballKnockbackMod());
public static Module armorHudModule = registerModule("armorhud", new ArmorHudMod());
public static Module noteblockMusic = registerModule("noteblockmusic", new NoteblockMusicMod());
public static PlayerJoinLocationMod playerJoinLocationMod = (PlayerJoinLocationMod) registerModule("playerjoinlocation", new PlayerJoinLocationMod());
public static Module knockbackModule = registerModule("knockback", new KnockbackMod());
public static CustomMapLoaderMod CustomMapLoaderModule = (CustomMapLoaderMod) registerModule("custommaploader", new CustomMapLoaderMod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import net.kyrptonaught.serverutils.dimensionLoader.CustomDimHolder;
import net.kyrptonaught.serverutils.dimensionLoader.DimensionLoaderMod;
import net.kyrptonaught.serverutils.discordBridge.MessageSender;
import net.kyrptonaught.serverutils.noteblockMusic.NoteblockMusicMod;
import net.kyrptonaught.serverutils.playerJoinLocation.PlayerJoinLocationMod;
import net.kyrptonaught.serverutils.playerlockdown.PlayerLockdownMod;
import net.kyrptonaught.serverutils.switchableresourcepacks.NoteBlockMusic;
import net.kyrptonaught.serverutils.switchableresourcepacks.ResourcePack;
import net.kyrptonaught.serverutils.switchableresourcepacks.SwitchableResourcepacksMod;
import net.minecraft.registry.CombinedDynamicRegistries;
Expand Down Expand Up @@ -145,7 +145,7 @@ public static void battleLoad(MinecraftServer server, Identifier addon, Identifi
return true;
});

NoteblockMusicMod.cacheAll(path.resolve("nbs"));
NoteBlockMusic.cacheAll(path.resolve("nbs"));

ADDON_DATAPACK_PROVIDER.loadAddon(addon, path);
tryEnableDatapack(server, config);
Expand Down Expand Up @@ -245,7 +245,7 @@ public static void prepareLobby(MinecraftServer server, Identifier addon, Identi

teleportToLobby(dimID, players, null);

NoteblockMusicMod.cacheAll(path.resolve("nbs"));
NoteBlockMusic.cacheAll(path.resolve("nbs"));

ADDON_DATAPACK_PROVIDER.loadAddon(addon, path);
tryEnableDatapack(server, config);
Expand Down Expand Up @@ -350,7 +350,7 @@ public static void unloadLobbyMap(MinecraftServer server, Identifier dimID, Coll
if (LOADED_LOBBIES.containsKey(dimID)) {
tryDisableDatapack(server, LOADED_LOBBIES.get(dimID));
ADDON_DATAPACK_PROVIDER.unloadAddon(LOADED_LOBBIES.get(dimID).addon_id);
NoteblockMusicMod.clearCache();
NoteBlockMusic.clearCache();
}

LOADED_LOBBIES.remove(dimID);
Expand All @@ -363,7 +363,7 @@ public static void unloadBattleMap(MinecraftServer server, Identifier dimID, Col
LOADED_BATTLE_MAPS.get(dimID).scheduleToRemove = true;
tryDisableDatapack(server, LOADED_BATTLE_MAPS.get(dimID).getAddon());
ADDON_DATAPACK_PROVIDER.unloadAddon(LOADED_BATTLE_MAPS.get(dimID).getAddon().addon_id);
NoteblockMusicMod.clearCache();
NoteBlockMusic.clearCache();
}

DimensionLoaderMod.unLoadDimension(server, dimID, functions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package net.kyrptonaught.serverutils.noteblockMusic;
package net.kyrptonaught.serverutils.switchableresourcepacks;

import net.kyrptonaught.noteblockplayer.Commands;
import net.kyrptonaught.serverutils.Module;
import net.raphimc.noteblocklib.format.nbs.NbsSong;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Stream;

public class NoteblockMusicMod extends Module {
public class NoteBlockMusic {

public static void cacheSong(String id, Path songPath) {
NbsSong song = Commands.loadSong(songPath);
Expand Down

0 comments on commit 70b61aa

Please sign in to comment.