2 Star 1 Fork 1

GermMC / WikiGermEngine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
custom_chestgui.md 9.88 KB
一键复制 编辑 原始数据 按行查看 历史
GermMC 提交于 2022-04-09 10:29 . 清茶的更新

自定义箱子GUI界面


第一步,在服务端中新建GermPlugin/gui/chest_xx.yml,并填入对应基础配置

#该配置可以替换所有原版箱子界面,改变槽位位置、大小等 让你的插件不用改变一个代码 还给你一个全新的UI系统
#根据chest_箱子界面名称的一部分 来替换为对应的文件
#例如有个箱子界面的标题为 强化系统
#那么配置的名字为 chest_强化,chest_化系,chest_系统 都会匹配成功
#
#当颠覆的chest界面打开时会生成变量 %opened_chest_title% = 箱子的原标题
#
#与箱子内指定槽位的物品hook 这样可以把原箱子槽位内的物品同步到扩展槽位内 并控制显示
# identity: "germmod_chest_slot_0"
# identity: "germmod_chest_slot_1"
# identity: "germmod_chest_slot_...."
chest_xx:  #这里的xx是你需要修改的箱子GUI界面的左上角标题 修改该行后请记住同步修改文件名            
  private:
    # 注意啦注意啦 以下dos仅在箱子颠覆界面可以用
    # placeholderItem<->ChestSlot@0 将箱子内第一个槽位的所有属性变量化 变量 %chest_slot_0_tip0% 代表名字 %chest_slot_0_tip1% 代表物品描述的第1行...%chest_slot_0_tip100% 代表物品描述的第100行
    # placeholderItem<->PlayerSlot@0 将背包内第一个槽位的所有属性变量化 变量 %player_slot_0_tip0% 代表名字 %player_slot_0_tip1% 分别代表物品描述的第1行...%player_slot_0_tip100% 代表物品描述的第100行
    # 在变量化物品时要注意,应该在变量化物品前加一个100毫秒的delay(不设置可能会获取的变量不准确)
    # 因为在箱子界面,物品的描述是由插件设置而来,需要一个数据包传输的过程
    # clickSlot<->ChestSlot@0 相当于左键点击箱子内第一个槽位
    # clickSlot<->PlayerSlot@0 相当于左键点击玩家背包第一个槽位
    # rightSlot<->PlayerSlot@0 ........
    # scrollSlot<->PlayerSlot@0 ........
    # shiftClickSlot<->PlayerSlot@0 ........
    # shiftRightSlot<->PlayerSlot@0 ........
    background:
        #图片的材质路径地址可以使用 local<->地址 或者直接输入 地址
        #同时支持网络连接地址 前面必须加上标记 url<-> 例如:url<->https://s1.ax1x.com/2020/06/19/NnqzVK.png
        #背包背景纹理地址 这个默认的是内置的
      path: 'local<->textures/gui/player_backpack.png'
        #图片的显示起始坐标(图片的左上角为起始点)
      locationX: "w*0.5-105"
      locationY: "h*0.5-128"
        #宽度width和高度height也同样支持运算符和 w h 变量 w代表整个MC的宽度
      width: "256"
      height: "256"
    #其他设置
    other:
      #是否关闭默认的背景(一个半黑色的透明背景) 默认为false
      disableDefaultBackground: true
      #点击到哪些组件会将鼠标上的物品丢出 (默认为点击没有组件的地方为丢出物品,但是用到全屏GUI时就需要此方法了)
      #填组件名字
      clickPartsDropCursorItem:
        - "background"
        - "drop_item_on_cursor"
    #关于箱子槽位的自定义设置
    ChestSlotSettings:
      #槽位的ID 格式为 slot_ID 每个槽位的ID请对应下图
      #槽位如果有的位置不想调的话就不写就可以了
      Slot_0:
        #槽位是否开启 默认为开启 可删除
        show: false
        #槽位的大小 可删除 默认为 16
        size: "16"
        #槽位的位置
        locationX: 'w*0.5+4'
        locationY: 'h*0.5-75'
      Slot_1:
        show: false
        size: "16"
        locationX: 'w*0.5+56'
        locationY: 'h*0.5-75'
      Slot_2:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_3:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_4:
        show: true
        size: "16"
        locationX: "w*0.379"
        locationY: "h*0.258"
      Slot_5:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_6:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_7:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_8:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_9:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_10:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_11:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_12:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_13:
        show: true
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_14:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_15:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_16:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_17:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_18:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_19:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_20:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_21:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_22:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_23:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_24:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_25:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_26:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
      Slot_27:
        show: false
        size: "16"
        locationX: '10'
        locationY: '30'
    #关于物品栏槽位的自定义设置
    PlayerSlotSettings:
      #槽位的ID 格式为 slot_ID 每个槽位的ID请对应下图
      #槽位如果有的位置不想调的话就不写就可以了
      Slot_0:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.016'
      Slot_1:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.016'
      Slot_2:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.016'
      Slot_3:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.016'
      Slot_4:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.058'
      Slot_5:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.058'
      Slot_6:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.058'
      Slot_7:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.058'
      Slot_8:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.1'
      Slot_9:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.1'
      Slot_10:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.1'
      Slot_11:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.1'
      Slot_12:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.142'
      Slot_13:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.142'
      Slot_14:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.142'
      Slot_15:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.142'
      Slot_16:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.182'
      Slot_17:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.182'
      Slot_18:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.182'
      Slot_19:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.182'
      Slot_20:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.226'
      Slot_21:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.226'
      Slot_22:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.226'
      Slot_23:
        show: true
        locationX: 'w*0.23'
        locationY: 'h*0.226'
      Slot_24:
        show: true
        locationX: 'w*0.166'
        locationY: 'h*0.266'
      Slot_25:
        show: true
        locationX: 'w*0.1875'
        locationY: 'h*0.266'
      Slot_26:
        show: true
        locationX: 'w*0.208'
        locationY: 'h*0.266'
      Slot_27:
        show: false
        locationX: '33'
        locationY: 'h*0.44'
      Slot_28:
        show: true
        locationX: 'w*0.055'
        locationY: 'h*0.44'
      Slot_29:
        show: true
        locationX: 'w*0.077'
        locationY: 'h*0.44'
      Slot_30:
        show: true
        locationX: 'w*0.098'
        locationY: 'h*0.44'
      Slot_31:
        show: true
        locationX: 'w*0.1198'
        locationY: 'h*0.44'
      Slot_32:
        show: true
        locationX: 'w*0.1416'
        locationY: 'h*0.44'
      Slot_33:
        show: true
        locationX: 'w*0.1635'
        locationY: 'h*0.44'
      Slot_34:
        show: true
        locationX: 'w*0.1854'
        locationY: 'h*0.44'
      Slot_35:
        show: true
        locationX: 'w*0.206'
        locationY: 'h*0.44'

{c}红色ID为ChestSlotSettings对应ID,蓝色ID为PlayerSlotSettings对应ID


第二步,按照第二节的教程来调整背景大小并添加你的需要的组件吧 😝

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/germmc/wiki-germ-engine.git
git@gitee.com:germmc/wiki-germ-engine.git
germmc
wiki-germ-engine
WikiGermEngine
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891