Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/VazkiiMods/Quark/llms.txt

Use this file to discover all available pages before exploring further.

Quark fires several NeoForge bus events that your mod can listen to. All events extend net.neoforged.bus.api.Event and are posted on the NeoForge event bus (MinecraftForge.EVENT_BUS / NeoForge.EVENT_BUS) unless otherwise noted. Subscribe with @SubscribeEvent on a method in a class registered via @Mod.EventBusSubscriber.
Module events (ModuleLoadedEvent, ModuleStateChangedEvent) are posted on the mod event bus, not the game event bus.

ModuleLoadedEvent

Fired when Quark’s module loader loads a module. This fires before the module’s configuration is resolved, so config values may not be final yet. Bus: Mod event bus
Cancellable: Yes (cancelling prevents the module from loading)
package org.violetmoon.quark.api.event;

public class ModuleLoadedEvent extends QuarkModuleEvent {
    public ModuleLoadedEvent(String eventName) {
        super(eventName);
    }
}
Fields (inherited from QuarkModuleEvent):
FieldTypeDescription
eventNameStringThe module’s event/registration name
Example — listen for a specific module loading:
@Mod.EventBusSubscriber(modid = "mymod", bus = Mod.EventBusSubscriber.Bus.MOD)
public class QuarkIntegration {
    @SubscribeEvent
    public static void onModuleLoaded(ModuleLoadedEvent event) {
        if ("hollow_logs".equals(event.eventName)) {
            // hollow logs module is loading
        }
    }
}

ModuleStateChangedEvent

Fired when a module’s enabled/disabled state changes (e.g. via the Q menu at runtime). Cancel the event to force the module disabled regardless of the user’s setting. Bus: Mod event bus
Cancellable: Yes (cancelling forces the module disabled)
package org.violetmoon.quark.api.event;

public class ModuleStateChangedEvent extends QuarkModuleEvent {
    public final boolean enabled;

    public ModuleStateChangedEvent(String eventName, boolean enabled) {
        super(eventName);
        this.enabled = enabled;
    }
}
Fields:
FieldTypeDescription
eventNameStringThe module’s event/registration name
enabledbooleanThe new state the module is transitioning to
Example — force a module off for compatibility:
@SubscribeEvent
public static void onModuleStateChanged(ModuleStateChangedEvent event) {
    if ("matrix_enchanting".equals(event.eventName) && event.enabled) {
        event.setCanceled(true); // prevent Matrix Enchanting from enabling
    }
}

GatherToolClassesEvent

Fired to gather tool classes for an ItemStack. Listen to this event to add your item to Quark’s tool-class system (used by features like Hoe Harvesting). Bus: NeoForge game event bus
Cancellable: No
package org.violetmoon.quark.api.event;

public class GatherToolClassesEvent extends Event {
    public final ItemStack stack;
    public final Set<String> classes;

    public GatherToolClassesEvent(ItemStack stack, Set<String> classes) {
        this.stack = stack;
        this.classes = classes;
    }
}
Fields:
FieldTypeDescription
stackItemStackThe item stack being queried
classesSet<String>Mutable set of tool class strings; add to this set to register your tool
Example — register a custom hoe:
@SubscribeEvent
public static void onGatherToolClasses(GatherToolClassesEvent event) {
    if (event.stack.getItem() instanceof MyCustomHoeItem) {
        event.classes.add("hoe");
    }
}

SimpleHarvestEvent

Fired by the Simple Harvest module when a player (or villager) right-clicks a crop block. Use this event to support double-height crops or to override the harvest target position. Only fires for blocks not on the #quark:simple_harvest_blacklisted tag. Bus: NeoForge game event bus
Cancellable: Yes (cancel to suppress harvest entirely; sets action to NONE)
package org.violetmoon.quark.api.event;

public class SimpleHarvestEvent extends Event implements ICancellableEvent {
    public final BlockState blockState;
    public final BlockPos pos;
    public final Level level;
    public final @Nullable InteractionHand hand;
    public final @Nullable Entity entity;   // may be Player or Villager

    public void setTargetPos(BlockPos pos) { ... }
    public BlockPos getTargetPos() { ... }

    public ActionType getAction() { ... }
    public void setAction(ActionType action) { ... }

    public enum ActionType { NONE, CLICK, HARVEST }
}
Fields:
FieldTypeDescription
blockStateBlockStateThe block state of the crop
posBlockPosThe position of the crop
levelLevelThe world
handInteractionHandThe hand used (null for villagers)
entityEntityThe player or villager harvesting
Key methods:
MethodDescription
setTargetPos(BlockPos)Redirect the harvest to a different position (useful for double-height crops like sugar cane)
getAction() / setAction(ActionType)Read or override the harvest action type
Example — support a double-height crop:
@SubscribeEvent
public static void onSimpleHarvest(SimpleHarvestEvent event) {
    if (event.blockState.getBlock() instanceof MyDoubleCropBlock) {
        // harvest the top half instead
        event.setTargetPos(event.pos.above());
        event.setAction(SimpleHarvestEvent.ActionType.HARVEST);
    }
}

UsageTickerEvent

Fired by the Usage Ticker module to determine which item and count to display in the HUD ticker. Two sub-events are posted: GetStack (to override the displayed item) and GetCount (to override the displayed count). Bus: NeoForge game event bus
Cancellable: Yes

Base fields (all sub-events)

FieldTypeDescription
slotEquipmentSlotThe slot being tracked
currentStackItemStackThe logical stack being counted
currentRealStackItemStackThe stack actually held/equipped
currentCountintThe current count before this event
passPassLOGICAL or RENDERING
playerPlayerThe player

UsageTickerEvent.GetStack

Override resultStack to change which item is shown in the ticker.
public static class GetStack extends UsageTickerEvent {
    public ItemStack getResultStack() { ... }
    public void setResultStack(ItemStack resultStack) { ... }
}

UsageTickerEvent.GetCount

Override resultCount to change the number shown in the ticker.
public static class GetCount extends UsageTickerEvent {
    public int getResultCount() { ... }
    public void setResultCount(int resultCount) { ... }
}
Example — show custom ammo count:
@SubscribeEvent
public static void onUsageTickerGetCount(UsageTickerEvent.GetCount event) {
    if (event.currentRealStack.getItem() instanceof MyGunItem) {
        int ammo = MyGunItem.getAmmoCount(event.currentRealStack);
        event.setResultCount(ammo);
    }
}

Build docs developers (and LLMs) love