#Dynamic Attribute Curios

7 messages · Page 1 of 1 (latest)

sonic rapids
#

Require: KubeJS Curios

global.items = {
  common: {
    /** @type {$BiConsumer_<$SlotContext_, import("packages/net/minecraft/world/item/$ItemStack").$ItemStack>} */
    update: (slot, stack) => {
      if (!stack.hasNBT()) {
        stack.nbt = {};
      }
      stack.nbt.t = !(stack.nbt.getBoolean("t") || false);
    },
  },
  dynamic_attribute_curios: {
    /** @type {$Consumer_<$CapabilityCurios$AttributeModificationContext_>} */
    modifyAttribute: (ctx) => {
      let dayTime = 24000,
        living;
      if ((living = ctx.slotContext.entity()) != null) {
        dayTime = living.level.dayTime();
      }
      let amount = ((dayTime % 24000) / 24000) * 10;
      ctx.modify("minecraft:generic.max_health", "kubejs.dynamic_attribute_curios.luck", amount, "addition");
    },
  },
};

StartupEvents.registry("item", (event) => {
  event
    .create("kubejs:dynamic_attribute_curios")
    .attachCuriosCapability(
      CuriosJSCapabilityBuilder.create()
        .modifyAttribute((ctx) => {
          global.items.dynamic_attribute_curios.modifyAttribute(ctx);
        })
        .curioTick((slot, stack) => {
          global.items.common.update(slot, stack);
        })
    )
    .texture("minecraft:item/golden_apple")
    .tag("curios:ring");
});
CurseForge

Curios integration for Kubejs
18.7K Downloads | Mods

worn seal
#
let dayTime = 24000,
    living;
if ((living = ctx.slotContext.entity()) != null) {
    dayTime = living.level.dayTime();
}

this is the craziest way to do this and i love it lmao

sacred parrot
#

You appeared to be very knowledgeable about this

With that said, could you confirm something for me?

#

I’ve been trying to mess around with NBT attributes as it was said through the wiki that you can imprint attributes onto curios through its own handler

#

I mean, I’ve been running the command commands and I’ve been getting no results. I’m not sure if I’m doing something wrong or if whatever’s documented on the wiki for 20.1 is broken or if the system itself doesn’t work

#

If you could test this, I’d appreciate it as it would be helpful to ensure that I’ve ran into a bug and not just a skill issue with running commands lmao

clever spire