Skip to content

toxicity188/DataComponentAPI

Repository files navigation

DataComponentAPI

This is a simple API for data component!

Usage in library plugin

public class TestPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        var apply = DataComponentAPI.api().adapter(new ItemStack(Material.DIAMOND_SWORD));
        apply.set(NMS.nms().damage(), 3);
        apply.set(NMS.nms().repairCost(), 20);
        apply.set(NMS.nms().rarity(), Rarity.EPIC);
        getLogger().info(apply.serialize().toString());
    }
}

Usage in shade

public class TestPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        DataComponentAPIBukkit.load();

        var apply = DataComponentAPI.api().adapter(new ItemStack(Material.DIAMOND_SWORD));
        apply.set(NMS.nms().damage(), 3);
        apply.set(NMS.nms().repairCost(), 20);
        apply.set(NMS.nms().rarity(), Rarity.EPIC);
        getLogger().info(apply.serialize().toString());
    }
}

How to use

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.toxicity188:DataComponentAPI:master-SNAPSHOT")
}