R15's Library 图标

R15's Library

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 0.1.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/r15s-library
资源信息

Minecraft 版本: 1.20.1

平台: fabric

标签: library

资源介绍

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

  • /r15lib play <targets> <clip> [looping] [speed]
  • /r15lib stop <targets>
  • /r15lib clips

CC:Tweaked

Key pieces

  • @LuaPeripheralMethod annotation for exposed methods.
  • CcTweakedApi.registerPeripheral(...) to bind a BlockEntity class to a peripheral type.
  • Reflection bridge creates an IDynamicPeripheral proxy when CC is installed.
  • Auto capability attach via Forge event hooks.

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

  • /r15lib cc
  • /r15lib cc bindings
  • /r15lib cc methods <binding-class>

Create: Copycats Plus

What is included

  • Compat detection with multiple candidate mod ids
  • Copycat block/block entity detection helpers
  • Material scanning (getMaterial)
  • Area survey service returning:
    • scanned block count
    • copycat block count
    • copycat block entity count
    • materialized entry count
    • material id (dominant one)

API

  • CopycatsApi.isLoaded()
  • CopycatsApi.isCopycat(state)
  • CopycatsApi.isCopycat(blockEntity)
  • CopycatsApi.material(blockEntity)
  • CopycatsApi.survey(level, center, radius)

Config

  • enableCopycatsReflection
  • maxCopycatsSurveyRadius

Commands

  • /r15lib copycats
  • /r15lib copycats inspect
  • /r15lib copycats survey [radius]

Create

CreateCompatService auto-detects Create and exposes:

  • installed()
  • line() -> V0_5 / V0_6 / UNKNOWN
  • version()
  • isKineticBlockEntity(BlockEntity)
  • reflection reads:
    • readStressImpact(...)
    • readStressCapacity(...)
    • readSpeed(...)
    • isOverStressed(...)

API usage

CreateAddonApi.snapshot(blockEntity) returns a CreateKineticSnapshot with:

  • impact
  • capacity
  • usage ratio
  • speed
  • overstressed
  • stress tier (IDLE, LIGHT, MEDIUM, HEAVY, CRITICAL)

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

Commands

  • /r15lib create
  • /r15lib create inspect
  • /r15lib create survey [radius]
  • /r15lib create plan <capacity> <machineImpact>
  • /r15lib create profile list
  • /r15lib create profile calc <profile> <capacity>
下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
shieldtimer

价格:0 墨喵币
下载量:0

查看详情
Craftable Saddle

价格:0 墨喵币
下载量:0

查看详情
Trade GUI

价格:0 墨喵币
下载量:0

查看详情
MrBoriiz's Cosmetics

价格:0 墨喵币
下载量:0

查看详情