Classy!

Quick rating

Classy!

No reviews yet

A simple class and ability library!

API/Library
Mod Loaders
NeoForge
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Required
Server Required

About

Project Details

Type
Mod
License
All Rights Reserved
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

Classy

Classy is a library for highly customizable access to a class and ability system. All it contains are methods for registering classes and abilities, casting interactions, and equipping classes. All else is done by the developer using this dependency.

Classes

Classes are designed to be expandable for every use case. Multiple classes may be equipped at one, but depending on your selection code, you can restrict the maximum number of equipped classes.

Registering a Class

Registering a class is extremely simple, and can be done like registering any other object. Just do the following:

private static final DeferredRegister<PlayerClass> CLASSES = DeferredRegister.create(MOD_ID, PlayerClass.PLAYER_CLASS);

private static final RegistrySupplier<PlayerClass> EXAMPLE_CLASS = registerClass(CLASSES, () -> new PlayerClass(
    ResourceLocation.fromNamespaceAndPath(MOD_ID, "example"),
    List.of(
        // This is where the abilities are added.
    )
));

public static void init() {
    CLASSES.register();
}

Classy has a command built-in to the mod to allow quickly equipping a class to test it. Simply just run /classy class [id] and it will equip or unequip the class.

Abilities

Abilities are very simple, not including cooldowns or a mana bar. Abilities only act as a system that are connected to a class. Choosing the ability to cast is also decided by your own code, allowing casting from index or identifier. Creating the rest of the ability is where it becomes more complicated.

An extremely basic ability can be done like this:

public class ExampleAbility extends PlayerAbility {
    public ExampleAbility() {
        super(ResourceLocation.fromNamespaceAndPath(MOD_ID, "example"));
    }

    @Override
    public void serverCast(ServerPlayer player) {
        player.hurt(player.damageSources().cactus(), 1f);
    }

    @Override
    public boolean canCast(Player player) {
        return true;
    }
}

All this ability will do is apply half a heart of cactus damage to the casting player.

If you would like more complicated interactions, such as triggering clientside player animations or having a held ability, you can use the following methods and fields:

// An ability that plays your cool player animation when cast.
public class ClientAnimationAbility extends PlayerAbility {
    public ClientAnimationAbility() {
        super(ResourceLocation.fromNamespaceAndPath(MOD_ID, "cooler_example"));
    }

    @Override
    public void clientCast(LocalPlayer player) {
        AnimationHandler.playCoolAnimation(player);
    }

    @Override
    public boolean canCast(Player player) {
        return true;
    }
}

// A held ability that charges up, and then gives you Speed I equivalent to how long you held for.
public class HeldAbility extends PlayerAbility {
    public HeldAbility() {
        super(ResourceLocation.fromNamespaceAndPath(MOD_ID, "coolest_example"));
    }

    int heldTimer = 0;

    @Override
    public void serverCast(ServerPlayer player) {
        heldTimer = 0;
        this.setActive(true);
    }

    @Override
    public void serverTick(ServerPlayer player) {
        heldTimer++;
        this.setActive(player.classy$isCasting()); // deactivate when no longer casting the ability
    }

    @Override
    public void serverEnd(ServerPlayer player) {
        player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, heldTimer, 0));
    }

    @Override
    public boolean canCast(Player player) {
        return true;
    }
}

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
CurseForge
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works