Classy!
No reviews yet
A simple class and ability library!
Provides a framework or library for other mods to use.
Neoforge is a fork of the Minecraft Forge available for versions 1.20.1+ of Minecraft. Many Forge mods are compatible with Neoforge and vice versa.
Fabric is a mod loader for versions 1.14+ of Minecraft, particularly popular for client side and optimization mods.
Community voices
Reviews
Click once to include, again to exclude, again to clear
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
About
Project Details
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.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
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
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
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers