• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/src/main/java/org/cyclops/integrateddynamics/core/NoteBlockEventReceiver.java
1
package org.cyclops.integrateddynamics.core;
2

3
import com.google.common.collect.HashMultimap;
4
import com.google.common.collect.Multimap;
5
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
6
import net.neoforged.bus.api.EventPriority;
7
import net.neoforged.bus.api.SubscribeEvent;
8
import net.neoforged.neoforge.event.level.NoteBlockEvent;
9
import net.neoforged.neoforge.event.tick.ServerTickEvent;
10

11
/**
12
 * Captures note block events for one tick.
13
 * @author rubensworks
14
 */
15
public final class NoteBlockEventReceiver {
16

17
    private static NoteBlockEventReceiver INSTANCE;
18
    private Multimap<NoteBlockInstrument, NoteBlockEvent.Play> previousEvents = HashMultimap.create();
3✔
19
    private Multimap<NoteBlockInstrument, NoteBlockEvent.Play> currentEvents = HashMultimap.create();
3✔
20

21
    private NoteBlockEventReceiver() {
2✔
22

23
    }
1✔
24

25
    public static NoteBlockEventReceiver getInstance() {
26
        if(INSTANCE == null) {
2!
27
            INSTANCE = new NoteBlockEventReceiver();
4✔
28
        }
29
        return INSTANCE;
2✔
30
    }
31

32
    @SubscribeEvent(priority = EventPriority.LOWEST)
33
    public void onNoteEvent(NoteBlockEvent.Play event) {
34
        if(!event.isCanceled()) {
×
35
            currentEvents.put(event.getInstrument(), event);
×
36
        }
37
    }
×
38

39
    @SubscribeEvent
40
    public void onTick(ServerTickEvent.Pre event) {
41
        Multimap<NoteBlockInstrument, NoteBlockEvent.Play> tmp = previousEvents;
×
42
        previousEvents.clear();
×
43
        previousEvents = currentEvents;
×
44
        currentEvents = tmp;
×
45
    }
×
46

47
    public Multimap<NoteBlockInstrument, NoteBlockEvent.Play> getEvents() {
48
        return previousEvents;
×
49
    }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc