Skip to content

Commit 7486b87

Browse files
committed
Use identity set for nbs custom instruments
1 parent 017fb64 commit 7486b87

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/net/raphimc/noteblocklib/util/SongUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
import net.raphimc.noteblocklib.model.song.Song;
2424

2525
import java.text.DecimalFormat;
26+
import java.util.Collections;
2627
import java.util.EnumSet;
27-
import java.util.HashSet;
28+
import java.util.IdentityHashMap;
2829
import java.util.Set;
2930

3031
public class SongUtil {
@@ -62,7 +63,7 @@ public static Set<MinecraftInstrument> getUsedVanillaInstruments(final Song song
6263
* @return The used custom instruments
6364
*/
6465
public static Set<NbsCustomInstrument> getUsedNbsCustomInstruments(final Song song) {
65-
final Set<NbsCustomInstrument> usedInstruments = new HashSet<>();
66+
final Set<NbsCustomInstrument> usedInstruments = Collections.newSetFromMap(new IdentityHashMap<>());
6667
song.getNotes().forEach(note -> {
6768
if (note.getInstrument() instanceof NbsCustomInstrument) {
6869
usedInstruments.add((NbsCustomInstrument) note.getInstrument());

0 commit comments

Comments
 (0)