KubeJS + CC: Tweaked

模组

· 作者 Wolfieboy09

适用于 Forge 1.20.1 和 1.19.2 的 KubeJS + CC: Tweaked

0 本站下载 0 关注 更新于 2 年前

需要前置:CC: Tweaked、KubeJS

最新 2002-1.0.2-beta · 1.20.2 · Forge

一键开服(送7天)

感谢 Amygdaloideae(在 GitHub 上称为 Prunoideae)的贡献。原始模组 点击此处
特别感谢 richie3366 帮助实现此移植版本!
模组图标由 FooterMan16 制作 \

可在 CurseForge 和 Modrinth 获取

CurseForge: \Modrinth:

为 KubeJS 添加支持,使其可以向任意方块添加 外围设备。

访问 Wiki 点击此处! 所有信息都在那里!

你可以添加到熔炉的方法示例:

// priority: 0
// The following code was last updated: April 30th 2024

// Visit the wiki for more info - https://kubejs.com/
ComputerCraftEvents.peripheral(event => {
    // First Param: peripheral type
    // Second Param: What block it goes to
    // Note: you can use regex for the second param
    
    event.registerPeripheral("furnace", "minecraft:furnace")
        // This limits the method to 1 call/tick,
        // as the method is scheduled on main thread.
        // The main thread is synced with the block
        .mainThreadMethod("burnTime", (container, direction, arguments) => {
            // This custom method returns the current
            // remaining burntime the furnace has.
            return container.entityData.getInt("BurnTime")
        })
        .mainThreadMethod("cookingProgress", (container) => {
            // This custom method returns the percentage
            // of the current cooking process going on.
            // A progress of 0 returned during two consecutive
            // ticks means that there is no cooking happening.
            let data = container.entityData
            let cookTime = data.getInt('CookTime')
            let cookTimeTotal = data.getInt('CookTimeTotal')
            if (!cookTimeTotal) return 0;
            return (cookTime / cookTimeTotal) * 100
        })


        // This has no limit on calling
        // however, the method can't access most of the in-world data.
        // For example, it couldn't access the NBT of a tile entity
        .method("say_hi", (container, direction, arguments) => {
            container.up.set("diamond_block")
            return "hi, here's your diamond block"
        })
})

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源