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’s public API consists of 14 interfaces in the org.violetmoon.quark.api package. Implement any of these on your Block, Item, Entity, BlockEntity, Screen, or Menu to hook into Quark features. All interfaces are designed to degrade gracefully — if the relevant Quark module is disabled, the interface has no effect.
Always guard access with a Quark mod-presence check (ModList.get().isLoaded("quark")) unless you are bundling the API classes with your mod. See Integrating Your Mod for setup details.

ICrawlSpaceBlock

Implement on a Block to let players crawl through it like Hollow Logs. Your block must be internally hollow, and you control which faces allow entry.
public interface ICrawlSpaceBlock {
    boolean canCrawl(Level level, BlockState state, BlockPos pos, Direction direction);

    default double crawlHeight(Level level, BlockState state, BlockPos pos, Direction direction) {
        return 0.13;
    }

    default boolean isLog(ServerPlayer sp, BlockState state, BlockPos pos, Direction direction) {
        return true;
    }
}
MethodDescription
canCrawlReturn true for faces the player may crawl into. Called for each direction.
crawlHeightThe height offset inside the block where the player is placed. Default 0.13.
isLogReturn false to suppress the log-specific crawl animation.

ICustomSorting

Implement on an Item (or provide via capability — see Capabilities) to give Quark’s inventory sorting a custom comparator and category for your item type.
public interface ICustomSorting {
    Comparator<ItemStack> getItemComparator();
    String getSortingCategory();
}
MethodDescription
getItemComparator()Returns a Comparator<ItemStack> used to sort stacks within the same category.
getSortingCategory()A unique string identifying this item family. Items are only compared against other items in the same category. Prefix with your mod ID (e.g. "mymod:wands").
Example:
public class WandItem extends Item implements ICustomSorting {
    @Override
    public Comparator<ItemStack> getItemComparator() {
        return Comparator.comparingInt(stack -> stack.getDamageValue());
    }

    @Override
    public String getSortingCategory() {
        return "mymod:wands";
    }
}

IEnchantmentInfluencer

Implement on a Block to make it influence the Matrix Enchanting table — changing the enchantment color tint, emitting extra particles, and boosting or suppressing specific enchantments.
public interface IEnchantmentInfluencer {
    @Nullable
    int getEnchantmentInfluenceColor(BlockGetter world, BlockPos pos, BlockState state);

    default int getInfluenceStack(BlockGetter world, BlockPos pos, BlockState state) {
        return 1;
    }

    @Nullable
    default ParticleOptions getExtraParticleOptions(BlockGetter world, BlockPos pos, BlockState state) {
        return null;
    }

    default double getExtraParticleChance(BlockGetter world, BlockPos pos, BlockState state) {
        return 1;
    }

    boolean influencesEnchantment(BlockGetter world, BlockPos pos, BlockState state,
                                   Holder<Enchantment> enchantment);

    boolean dampensEnchantment(BlockGetter world, BlockPos pos, BlockState state,
                                Holder<Enchantment> enchantment);
}
MethodDescription
getEnchantmentInfluenceColorReturns a packed RGB integer for the color tint. Return null to use no tint.
getInfluenceStackHow many blocks of this type stack their influence. Default 1.
getExtraParticleOptionsOptional extra particle type to emit near the enchanting table.
getExtraParticleChanceChance (0–1) per tick to emit the extra particle. Default 1.0.
influencesEnchantmentReturn true if this block boosts the given enchantment at the enchanting table.
dampensEnchantmentReturn true if this block suppresses the given enchantment at the enchanting table.

IMagnetMoveAction

Implement on a BlockEntity (or provide as a NeoForge capability) to receive a callback when Quark’s magnet moves your block entity, and to optionally veto the movement.
public interface IMagnetMoveAction {
    void onMagnetMoved(Level world, BlockPos pos, Direction direction,
                       BlockState state, BlockEntity tile);

    default boolean canMagnetMove(Level world, BlockPos pos, Direction direction,
                                  BlockState state, BlockEntity tile) {
        return true;
    }
}
Do not check for tile entities implementing this interface directly. Instead, expose it as a NeoForge capability.

IMagnetTracker

Tracks accumulated magnet force vectors on a per-position basis. This is an internal interface used by Quark’s magnet system; your mod can interact with it to apply or read magnet forces.
public interface IMagnetTracker {
    Vec3i getNetForce(BlockPos pos);
    void applyForce(BlockPos pos, int magnitude, boolean pushing,
                    Direction dir, int distance, BlockPos origin);
    void actOnForces(BlockPos pos);
    Collection<BlockPos> getTrackedPositions();
    void clear();
}

IMagneticEntity

Implement on an Entity to define custom movement behavior when Quark’s magnet acts on it. By default, entities are pushed via Entity.push(); override to apply custom physics or conditionally resist.
public interface IMagneticEntity {
    default void moveByMagnet(Entity self, Vec3 moveDirection, BlockEntity tile) {
        self.push(moveDirection.x(), moveDirection.y(), moveDirection.z());
    }
}
If you override moveByMagnet, it is your responsibility to actually move the entity. Quark will not apply default movement if the interface is implemented.

IPistonCallback

Implement on a BlockEntity (or provide as a capability) to receive a callback at the start and end of piston movement.
public interface IPistonCallback {
    void onPistonMovementStarted();

    default void onPistonMovementFinished() {
        // NO-OP
    }
}
Do not check for tile entities implementing IPistonCallback directly. Check for it as a NeoForge capability instead.

IQuarkButtonAllowed

A marker interface — implement on a Screen or Menu to allow Quark to render its inventory management buttons (sort, transfer, etc.) on that screen.
public interface IQuarkButtonAllowed {
    // marker — no methods
}
Example:
public class MyStorageScreen extends AbstractContainerScreen<MyMenu>
        implements IQuarkButtonAllowed {
    // Quark will now render sort/transfer buttons on this screen
}
You can also allowlist specific screens by class name in Quark’s general config (allowedScreens list) without touching the code.

IRotationLockable

Implement on a Block to control how Quark’s Rotation Lock feature applies your block’s facing state when placing via the lock.
public interface IRotationLockable {
    /**
     * @param half  -1 if not set, 0 if bottom, 1 if top
     */
    BlockState applyRotationLock(Level world, BlockPos pos, BlockState currState,
                                  Direction direction, int half);
}

IRuneColorProvider

Implement on an Item to provide a RuneColor for use with Quark’s Color Runes smithing system.
public interface IRuneColorProvider {
    RuneColor getRuneColor(ItemStack stack);
}
RuneColor is an enum in org.violetmoon.quark.content.tools.base with entries for each available rune color.

ISortingLockedSlots

Implement on a Menu (container) to designate specific slot indices that should be exempt from inventory sorting. Extends IQuarkButtonAllowed, so the Q buttons also appear.
public interface ISortingLockedSlots extends IQuarkButtonAllowed {
    @Nullable
    int[] getSortingLockedSlots(boolean sortingPlayerInventory);
}
Return an array of slot indices to exclude, or null to exclude none. The sortingPlayerInventory parameter is true when sorting the player’s own inventory region rather than the container region.

ITransferManager

Implement on a BlockEntity (or provide as a NeoForge capability) to allow Quark’s Easy Transferring system to move items into or out of your block, and to display Quark’s transfer buttons in the UI.
public interface ITransferManager {
    boolean acceptsTransfer(Player player);

    default IItemHandler getTransferItemHandler(Supplier<IItemHandler> defaultSupplier) {
        return defaultSupplier.get();
    }
}
MethodDescription
acceptsTransferReturn true to allow the given player to transfer items.
getTransferItemHandlerOverride to provide a custom IItemHandler for the transfer. By default, uses the block entity’s main capability handler.
Do not check for tile entities implementing ITransferManager directly. Expose it as a NeoForge capability.

ITrowelable

Implement on an Item to control whether the Trowel can place it. Note that #quark:trowel_blacklist and #quark:trowel_whitelist tags take priority over this interface.
public interface ITrowelable {
    default boolean canBeTroweled(ItemStack stack, UseOnContext context) {
        return true;
    }
}

IUsageTickerOverride

Implement on an Item to customize how Quark’s Usage Ticker displays the item count and target for that item type.
public interface IUsageTickerOverride {
    default int getUsageTickerCountForItem(ItemStack stack, Predicate<ItemStack> target) {
        return 0;
    }

    default boolean shouldUsageTickerCheckMatchSize(ItemStack stack) {
        return false;
    }

    ItemStack getUsageTickerItem(ItemStack stack, RegistryAccess access);
}
MethodDescription
getUsageTickerCountForItemReturn the count to display. target is a predicate matching similar items.
shouldUsageTickerCheckMatchSizeReturn true to check stack size when matching.
getUsageTickerItemReturn the representative ItemStack to show in the ticker HUD.

Build docs developers (and LLMs) love