HomeJavaModsR15's Library
R15's Library
ModsJava

R15's Library

by R15Ofc · on Modrinth

A library that I use for my mods. Free Minecraft Java mod for 1.20.1.

⬇ Download on Modrinth
R15's Library — screenshot 1

banner

Docs

This library includes animation player, Create 0.5.1/6.0.0, Create: Copycats and CC:Tweaked compatibility

Animations

Animation player with a lot of uses

Registering clip in code

AnimationClip clip = AnimationClip.builder("myaddon:drill_pose", 20.0F)
    .looping(true)
    .track(new TimelineTrack("right_arm", List.of(
        new Keyframe(0.0F, Transform.IDENTITY, Easing.LINEAR),
        new Keyframe(10.0F, new Transform(Float3.ZERO, new Float3(-0.5F, 0.0F, 0.0F), Float3.ONE), Easing.EASE_IN_OUT),
        new Keyframe(20.0F, Transform.IDENTITY, Easing.EASE_IN_OUT)
    )))
    .build();

LibraryApi.registerAnimation(new ResourceLocation("myaddon", "drill_pose"), clip);

Playing on server

LibraryApi.playAnimation(serverPlayer, new ResourceLocation("myaddon", "drill_pose"), 1.0F, true);

Triggering from client

LibraryApi.requestSelfAnimation(new ResourceLocation("myaddon", "drill_pose"), 1.0F, true);

This sends a client->server packet and is controlled by config (allowClientAnimationTriggerPacket).

Data-driven clips

Drop JSON into data/<namespace>/r15lib_animations/<name>.json.

Example shape:

{
  "length": 12.0,
  "looping": false,
  "tracks": {
    "right_arm": [
      { "tick": 0.0, "rotation": [0.0, 0.0, 0.0], "easing": "LINEAR" },
      { "tick": 4.0, "rotation": [-0.95, 0.1, 0.0], "easing": "EASE_OUT" },
      { "tick": 12.0, "rotation": [0.0, 0.0, 0.0], "easing": "EASE_IN_OUT" }
    ]
  }
}

Commands

CC:Tweaked

Key pieces

Quick example

public class CrusherPeripheralOwner {
    private final MyCrusherBlockEntity blockEntity;

    public CrusherPeripheralOwner(MyCrusherBlockEntity blockEntity) {
        this.blockEntity = blockEntity;
    }

    @LuaPeripheralMethod("get_progress")
    public int getProgress() {
        return blockEntity.getProgress();
    }

    @LuaPeripheralMethod("set_enabled")
    public void setEnabled(boolean enabled) {
        blockEntity.setEnabled(enabled);
    }
}

CcTweakedApi.registerPeripheralFromOwnerClass(
    MyCrusherBlockEntity.class,
    "myaddon_crusher",
    CrusherPeripheralOwner::new,
    CrusherPeripheralOwner.class
);

Commands

Create: Copycats Plus

What is included

API

Config

Commands

Create

CreateCompatService auto-detects Create and exposes:

API usage

CreateAddonApi.snapshot(blockEntity) returns a CreateKineticSnapshot with:

CreateAddonApi.survey(level, center, radius) aggregates a local kinetic network area.

Commands

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more