会员登录 立即注册

搜索

墨山降魔药水

[复制链接]
崎山小鹿 发表于 2025-6-17 10:04:05 | 显示全部楼层 |阅读模式
崎山小鹿
2025-6-17 10:04:05 471 8 看全部
有没有一种药水,能将敌方单位变成我方单位呢?
微信截图_20250620133619.png


普通药水
新建-》配置-》实体-》药水
微信截图_20250617142401.png
使用时间:32
添加动画:drink

{
    "format_version": "1.10",
    "minecraft:item": {
        "components": {
            "minecraft:food": {
                "can_always_eat": true,
                "cooldown_time": 32,
                "effects": [
                    {
                        "amplifier": 3,
                        "chance": 1.0,
                        "duration": 60,
                        "name": "night_vision"
                    }
                ],
                "nutrition": 0,
                "saturation_modifier": "poor",
                "using_converts_to": "minecraft:glass_bottle"
            },
            "minecraft:use_duration": 32.0
        },
        "description": {
            "identifier": "nvykb:feigong"
        }
    }
}

滞留药水
右键使用物品 → 生成一个被投掷的实体(entity) → 自动播放丢掷动画 → 命中后爆炸释放药效
微信截图_20250617232732.png

抛掷物部分:
"animations": {
                "flying": "animation.actor.billboard"
            },
内置动画 animation.actor.billboard。这个动画会让实体一直面朝摄像机(玩家),常用于粒子、精灵图类实体(像药水、火焰等)

"geometry": {
  "default": "geometry.item_sprite"
}
使用的是内置的 geometry.item_sprite,意思是这个实体以2D 贴图平面方式渲染。
它不会有立体模型,而是像一张纸一样在游戏中显示(贴图贴在一个矩形板上)。

"materials": {
  "default": "lingering_potion_enchanted"
}
lingering_potion_enchanted 是材质分组名,用于告诉引擎如何处理光照、透明度、叠加贴图等。
这个名字引用了 materials 文件中的材质设置(比如是否使用闪光效果、透明混合等)。

"scripts": {
  "animate": [
    "flying"
  ]
}
告诉游戏在客户端上对这个实体使用 flying 动画。
flying 就是前面定义的 animation.actor.billboard,也就是 始终面朝玩家 的动画。

"textures": {
        "default": "textures/items/potion_bottle_lingering_heal",
        "enchanted": "textures/misc/enchanted_item_glint"
      }
设置 default 为 potion_bottle_lingering_heal        确保实体始终使用治疗药水的外观
保留 enchanted        如果你希望保留闪光效果(附魔光),这个可以留;不需要的话也可以删掉


下面的效果在开发中...
投掷药水落地后爆炸产生的粒子 变成像滞留治疗药水那样的“红色心形”云雾效果
修改实体行为 JSON 文件中添加/替换粒子目前无法完成
使用默认瓶子和粒子效果
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-17 10:09:17 | 显示全部楼层
崎山小鹿
2025-6-17 10:09:17 看全部
{
    "format_version": "1.10.0",
    "minecraft:client_entity": {
        "description": {
            "animations": {
                "flying": "animation.actor.billboard"
            },
            "geometry": {
                "default": "geometry.item_sprite"
            },
            "identifier": "moshan:feigong",
            "materials": {
                "default": "splash_potion_enchanted"
            },
            "render_controllers": [
                "controller.render.splash_potion"
            ],
            "scripts": {
                "animate": [
                    "flying"
                ]
            },
            "textures": {
                "absorption": "textures/items/potion_bottle_splash_absorption",
                "blindness": "textures/items/potion_bottle_splash_blindness",
                "confusion": "textures/items/potion_bottle_splash_confusion",
                "damageBoost": "textures/items/potion_bottle_splash_damageBoost",
                "default": "textures/items/potion_bottle_splash",
                "digSlowdown": "textures/items/potion_bottle_splash_digSlowdown",
                "digSpeed": "textures/items/potion_bottle_splash_digSpeed",
                "enchanted": "textures/misc/enchanted_item_glint",
                "fireResistance": "textures/items/potion_bottle_splash_fireResistance",
                "harm": "textures/items/potion_bottle_splash_harm",
                "heal": "textures/items/potion_bottle_splash_heal",
                "healthBoost": "textures/items/potion_bottle_splash_healthBoost",
                "hunger": "textures/items/potion_bottle_splash_hunger",
                "invisibility": "textures/items/potion_bottle_splash_invisibility",
                "jump": "textures/items/potion_bottle_splash_jump",
                "levitation": "textures/items/potion_bottle_splash_levitation",
                "moveSlowdown": "textures/items/potion_bottle_splash_moveSlowdown",
                "moveSpeed": "textures/items/potion_bottle_splash_moveSpeed",
                "nightVision": "textures/items/potion_bottle_splash_nightVision",
                "poison": "textures/items/potion_bottle_splash_poison",
                "regeneration": "textures/items/potion_bottle_splash_regeneration",
                "resistance": "textures/items/potion_bottle_splash_resistance",
                "saturation": "textures/items/potion_bottle_splash_saturation",
                "slowFall": "textures/items/potion_bottle_splash_slowFall",
                "turtleMaster": "textures/items/potion_bottle_splash_turtleMaster",
                "waterBreathing": "textures/items/potion_bottle_splash_waterBreathing",
                "weakness": "textures/items/potion_bottle_splash_weakness",
                "wither": "textures/items/potion_bottle_splash_wither"
            }
        }
    }
}
解释:
几何体设置为 item_sprite,这是 Minecraft 中用于显示物品样式的一个内置平面几何体

splash_potion_enchanted 材质,通常表示一种闪烁的魔法药水材质

"scripts": { "animate": ["flying"] }
定义这个实体一开始就自动播放 "flying" 动画(也就是永远面向玩家的效果),不依赖状态机。
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-17 10:16:44 | 显示全部楼层
崎山小鹿
2025-6-17 10:16:44 看全部
{
    "format_version": "1.12.0",
    "minecraft:entity": {
        "component_groups": {

        },
        "components": {
            "minecraft:collision_box": {
                "height": 0.25,
                "width": 0.25
            },
            "minecraft:conditional_bandwidth_optimization": {
                "default_values": {
                    "max_dropped_ticks": 5,
                    "max_optimized_distance": 80.0,
                    "use_motion_prediction_hints": true
                }
            },
            "minecraft:persistent": {

            },
            "minecraft:physics": {

            },
            "minecraft:projectile": {
                "angle_offset": -20.0,
                "gravity": 0.05,
                "hit_sound": "glass",
                "on_hit": {
                    "douse_fire": {

                    },
                    "remove_on_hit": {

                    },
                    "thrown_potion_effect": {

                    }
                },
                "power": 0.5
            },
            "minecraft:pushable": {
                "is_pushable": true,
                "is_pushable_by_piston": true
            }
        },
        "description": {
            "identifier": "moshan:feigong",
            "is_experimental": false,
            "is_spawnable": false,
            "is_summonable": true
        },
        "events": {

        }
    }
}

解释:
"is_spawnable"        是否能自然生成或使用刷怪蛋生成;此处为 false

"components"
这是实体的主要行为配置部分

collision_box 碰撞体积1/4体积大小
conditional_bandwidth_optimization 远距离同步策略
physics 启用基本物理系统

projectile 定义了该实体是一个投掷物类型实体

events: 目前为空。你可以在这里定义命中后触发事件,如变身、召唤新实体、爆炸等

天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-18 13:02:42 | 显示全部楼层
崎山小鹿
2025-6-18 13:02:42 看全部
行为文件:
{
    "format_version": "1.10",
    "minecraft:item": {
        "components": {
            "minecraft:foil": false,
            "netease:shield": {
                "defence_damage_source_list": [
                    "drowning"
                ],
                "is_consume_damage": false
            }
        },
        "description": {
            "category": "equipment",
            "custom_item_type": "shield",
            "identifier": "moshan:mozidun",
            "register_to_create_menu": true
        }
    }
}
解释:
minecraft:item:表示这是一个 物品定义(不是实体或方块)
"minecraft:foil": false 解释:是否带有“闪光效果”。
"netease:shield"(网易扩展的盾牌组件)
drowning":表示 可抵挡溺水伤害
"is_consume_damage": false 不消耗耐久
"category": "equipment" 表示这个物品属于“装备”分类,会在物品栏“装备”分类中显示
"custom_item_type": "shield" 指定这个物品是一个“盾牌”类型
"identifier": "moshan:mozidun" 唯一标识符
"register_to_create_menu": true 是否将物品注册到创造模式物品菜单中
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-18 13:06:22 | 显示全部楼层
崎山小鹿
2025-6-18 13:06:22 看全部
物品资源文件:
{
    "format_version": "1.10",
    "minecraft:item": {
        "components": {

        },
        "description": {
            "identifier": "moshan:mozidun"
        }
    }
}
详细解释:
"components": {}
组件列表。这是 Minecraft 物品行为的核心部分,理论上可以包含如:

minecraft:use_animation(使用时的动画)

minecraft:durability(耐久)

minecraft:icon(物品图标)

minecraft:food(如果是食物)

minecraft:projectile_item(投掷行为)

netease:shield(网易盾牌行为)
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-18 13:16:23 | 显示全部楼层
崎山小鹿
2025-6-18 13:16:23 看全部
附着物文件:
{
    "format_version": "1.10.0",
    "minecraft:attachable": {
        "description": {
            "animations": {
                "wield": "controller.animation.default_custom_shield.wield",
                "wield_main_hand_first_person": "animation.moshan_shield.wield_main_hand_first_person",
                "wield_main_hand_first_person_block": "animation.moshan_shield.wield_main_hand_first_person_blocking",
                "wield_off_hand_first_person": "animation.moshan_shield.wield_off_hand_first_person",
                "wield_off_hand_first_person_block": "animation.moshan_shield.wield_off_hand_first_person_blocking",
                "wield_third_person": "animation.moshan_shield.wield_third_person"
            },
            "geometry": {
                "default": "geometry.shield"
            },
            "identifier": "moshan:mozidun",
            "materials": {
                "default": "entity_alphatest",
                "enchanted": "entity_alphatest_glint"
            },
            "render_controllers": [
                "controller.render.item_default"
            ],
            "scripts": {
                "animate": [
                    "wield"
                ],
                "initialize": [
                    "variable.main_hand_first_person_pos_x =  5.3;",
                    "variable.main_hand_first_person_pos_y = 26.0;",
                    "variable.main_hand_first_person_pos_z = 0.4;",
                    "variable.main_hand_first_person_rot_x = 91.0;",
                    "variable.main_hand_first_person_rot_y = 65.0;",
                    "variable.main_hand_first_person_rot_z = -43.0;",
                    "variable.off_hand_first_person_pos_x = -13.5;",
                    "variable.off_hand_first_person_pos_y = -5.8;",
                    "variable.off_hand_first_person_pos_z = 5.1;",
                    "variable.off_hand_first_person_with_bow_pos_z = -25.0;",
                    "variable.off_hand_first_person_rot_x = 1.0;",
                    "variable.off_hand_first_person_rot_y = 176.0;",
                    "variable.off_hand_first_person_rot_z = -2.5;"
                ],
                "pre_animation": [
                    "variable.is_using_bow = (query.get_equipped_item_name == 'bow') && (query.main_hand_item_use_duration > 0.0f);"
                ]
            },
            "textures": {
                "default": "textures/ui/mozi_shield",
                "enchanted": "textures/ui/enchanted_item_glint"
            }
        }
    }
}
详细解释:
这段代码定义的是一个用于网易我的世界(基岩版)的自定义盾牌的 attachable 配置。它控制了盾牌在第一人称视角、第三人称视角中的显示效果、动画、材质、位置、旋转角度等行为。
minecraft:attachable:说明这个 JSON 定义的是一个可附着物体(如盾牌、帽子、饰品),它可以在角色身上显示。

description:描述了盾牌的模型、动画、材质、脚本、渲染方式等。
animations  定义了 使用盾牌时播放的动画资源
wield        主控制器动画入口,控制盾牌的通用动画状态
wield_main_hand_first_person        第一人称视角,主手拿盾牌
wield_main_hand_first_person_block        第一人称视角,主手格挡状态
wield_off_hand_first_person        第一人称视角,副手拿盾
wield_off_hand_first_person_block        第一人称视角,副手格挡
wield_third_person        第三人称视角盾牌动画

"scripts" 用于动态设置动画行为和模型在不同状态下的定位
nimate:设置当前启用的动画控制器,这里是 wield,与上面的 "animations" 项关联。
initialize:初始化变量,设置模型在第一人称视角的手持位置和旋转角度(主手、副手各不同)。
这些变量会影响模型在手中的具体显示位置(手上偏移、角度等)。
pre_animation:动画播放前的条件计算,例如设置变量 is_using_bow(用于判断是否与弓箭冲突)

enchanted:用于附魔发光层贴图
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-18 13:24:31 | 显示全部楼层
崎山小鹿
2025-6-18 13:24:31 看全部
动画文件:
"format_version": "1.10.0",
  "animations": {
    "animation.moshan_shield.wield_main_hand_first_person": {
      "loop": true,
      "bones": {
        "shield": {
          "position": [ -12.0, 10.5, -12.0 ],
          "rotation": [ 76.0, -119.0, -34.0 ]
        },
        // 如果您的盾牌不是对称的,第一人称主手时需要转180度
        "bone3": {
          "rotation": [0.0, 0.0, 180.0]
        },
        // 让半个盾牌转起来
        "bone4": {
          "rotation": {
                                                "0.0": [0.0, 0.0, 0.0],
                                                "2.0": [0.0, 0.0, 360.0]
                                        }
        }
      }
    },
详细解释:
它的作用是描述当玩家第一人称主手持盾时,盾牌模型中指定的骨骼(如 shield、bone3、bone4)应该怎样移动、旋转或变化。

animation.moshan_shield.wield_main_hand_first_person:这是动画名称,应与 attachable 中 "animations" 字段相对应。

loop: true:动画是否循环。这里设为 true,意味着动画会一直重复(例如盾牌持续持有状态)。

bones: 指定模型中哪些骨骼(模型节点)要被动画控制。

position:控制该骨骼的相对坐标位置(x, y, z)

使盾牌在手中的偏移调整

rotation:设置盾牌在第一人称主手持盾状态下的角度旋转

x: 上下倾斜

y: 左右旋转

z: 旋转方向调整

这可以让盾牌在第一人称中“对准”玩家视角,不歪斜、不偏离

bone3 骨骼(可能是镜像辅助)

bone4 骨骼(旋转动画)
这是一个关键帧动画定义。

动画会在 0.0 秒 → 2.0 秒 之间,将 bone4 沿着 Z轴 完成一圈旋转(360°),实现一个旋转效果。
当动画 loop: true 时,它会不断转圈,非常适合用来做“发光魔法盾”的视觉特效。
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-18 13:33:31 | 显示全部楼层
崎山小鹿
2025-6-18 13:33:31 看全部
以下是一个动画定义文件(animations/animation.player_throw_item.json),模拟玩家将物品从手中向前挥臂投掷的动作。
{
  "format_version": "1.10.0",
  "animations": {
    "animation.player.throw_item": {
      "loop": false,
      "bones": {
        "rightarm": {
          "rotation": {
            "0.0":   [  0.0, 0.0, 0.0 ],
            "0.1":   [ -30.0, 0.0, 0.0 ],
            "0.2":   [ -60.0, 0.0, 0.0 ],
            "0.3":   [ -90.0, 0.0, 0.0 ],
            "0.4":   [ -60.0, 0.0, 0.0 ],
            "0.5":   [ -30.0, 0.0, 0.0 ],
            "0.6":   [   0.0, 0.0, 0.0 ]
          }
        },
        "body": {
          "rotation": {
            "0.0": [0.0, 0.0, 0.0],
            "0.3": [0.0, 5.0, 0.0],
            "0.6": [0.0, 0.0, 0.0]
          }
        }
      }
    }
  }
}
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

 楼主| 崎山小鹿 发表于 2025-6-19 21:56:35 | 显示全部楼层
崎山小鹿
2025-6-19 21:56:35 看全部
如何创建动画:
使用 attachable + animation controller + render controller 来控制动画,或者从 服务端调用动作
天不生墨翟,万古如长夜!以墨运商,以商助墨。金双石科技长期招聘科技研发人才!微信:qishanxiaolu   电话:15876572365   公司:深圳市金双石科技有限公司
回复

使用道具 举报

  • 您可能感兴趣
您需要登录后才可以回帖 登录 | 立即注册 |

本版积分规则 返回列表

管理员给TA私信
以墨运商,以商助墨。

查看:471 | 回复:8

金双石科技,软件开发20年,技术行业领先,您的满意,就是我们的目标,认真负责,开拓进取,让成品物超所值
关于我们
公司简介
发展历程
联系我们
本站站务
友情链接
新手指南
内容审核
商家合作
广告合作
商家入驻
新闻合作

手机APP

官方微博

官方微信

联系电话:15876572365 地址:深圳市宝安区西乡街道宝民二路宝民花园 ( 粤ICP备2021100124号-1 ) 邮箱:qishanxiaolu@qq.com
QQ|Powered by Discuz! X3.5 © 2001-2025 Discuz! Team.
快速回复 返回顶部 返回列表