使用此模组,你可以:
1. 从 LivingEntity 获取 CuriosHelper
2. 创建自定义饰品槽位(Custom Curios)
3. 为物品添加饰品能力(Curios capabilities)
4. 注册或移除饰品的渲染
5. 添加 CuriosJS 事件
LivingEntity 饰品辅助工具

注册饰品 & 修改物品 (启动时)
StartupEvents.registry('item', event => {
event.create('test')
.attachCuriosCapability(
CuriosJSCapabilityBuilder.create()
.curioTick((slotContext, stack) => { })
.onEquip((slotContext, oldStack, newStack) => { })
.onUnequip((slotContext, oldStack, newStack) => { })
.canEquip((slotContext, stack) => true)
.canUnequip((slotContext, stack) => true)
.modifySlotsTooltip((tooltips, stack) => tooltips)
.addAttribute(
"minecraft:generic.max_health",
UUID,
20,
'addition'
)
.modifyAttribute(attributeModificationContext => {
let { slotContext, UUID, stack, modifiers } = attributeModificationContext
attributeModificationContext.modify(
"minecraft:generic.armor",
"identifier",
20,
'addition'
)
})
.canDrop((slotContext, source, lootingLevel, recentlyHit, stack) => true)
.modifyAttributesTooltip((tooltips, stack) => tooltips)
.modifyFortuneLevel((slotContext, lootContext, stack) => 0)
.modifyLootingLevel((slotContext, source, target, baseLooting, stack) => 0)
.makesPiglinsNeutral((slotContext, stack) => false)
.canWalkOnPowderedSnow((slotContext, stack) => false)
.isEnderMask((slotContext, enderMan, stack) => false)
)
.maxStackSize(1)
.tag("curios:head")
})
ItemEvents.modification(event => {
event.modify('apple', item => {
item.attachCuriosCapability(
CuriosJSCapabilityBuilder.create()
.curioTick((slotContext, stack) => { })
.onEquip((slotContext, oldStack, newStack) => { })
.onUnequip((slotContext, oldStack, newStack) => { })
.canEquip((slotContext, stack) => true)
.canUnequip((slotContext, stack) => true)
.modifySlotsTooltip((tooltips, stack) => tooltips)
.addAttribute(
"minecraft:generic.max_health",
"identifier",
20,
'addition'
)
.modifyAttribute(attributeModificationContext => {
let { slotContext, UUID, stack, modifiers } = attributeModificationContext
attributeModificationContext.modify(
"minecraft:generic.armor",
UUID,
20,
'addition'
)
})
.canDrop((slotContext, source, lootingLevel, recentlyHit, stack) => true)
.modifyAttributesTooltip((tooltips, stack) => tooltips)
.modifyFortuneLevel((slotContext, lootContext, stack) => 0)
.modifyLootingLevel((slotContext, source, target, baseLooting, stack) => 0)
.makesPiglinsNeutral((slotContext, stack) => false)
.canWalkOnPowderedSnow((slotContext, stack) => false)
.isEnderMask((slotContext, enderMan, stack) => false)
)
})
})
渲染 (客户端)
CuriosJSEvents.registerRenderer(event => {
// 移除饰品渲染
event.remove('test')
// 注册饰品渲染
event.register(
'apple',
context => {
let {
stack,
slotContext,
matrixStack,
renderLayerParent,
renderTypeBuffer,
light,
limbSwing,
limbSwingAmount,
partialTicks,
ageInTicks,
netHeadYaw,
headPitch
} = context
let { modelManager } = Client
let entity = slotContext.entity()
let model = modelManager.getModel(new ModelResourceLocation(stack.id, 'inventory'))
matrixStack.pushPose()
CuriosRenderer.translateIfSneaking(matrixStack, entity)
matrixStack.mulPose(new Quaternionf().rotateZ(JavaMath.toRadians(180)))
matrixStack.mulPose(RotationAxis.YP.deg(-netHeadYaw))
matrixStack.mulPose(RotationAxis.XP.deg(-headPitch))
Client.itemRenderer.render(
stack,
'head',
false,
matrixStack,
renderTypeBuffer,
light,
OverlayTexture.NO_OVERLAY,
model
)
matrixStack.popPose()
}
)
})

你是这个资源的作者?登录后可认领此资源。
相似资源
缓冲的原始输入和线程化的事件轮询
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
一个用于收集生物掉落物的多区块模组。
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
原版世界生成优化模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
评论 0
登录后参与评分
还没有评论,来抢沙发吧