按键呼出菜单
使用教程
第一步,先在Config.yml的按键绑定中 设置按键
config.yml
SimpleKeyBinding:
#按下左侧Ctrl呼出菜单,并唤出鼠标
KeyDown@LCONTROL:
- "servercmd`<->`gp hud show %player_name% 呼出菜单 -1"
- "servercmd`<->`gp misc focus %player_name% false"
#松开左侧Ctrl关闭菜单
KeyUp@LCONTROL:
- "servercmd`<->`gp hud remove %player_name% 呼出菜单"
- "servercmd`<->`gp misc focus %player_name% true"
第二步,然后添加一个gui,呼出菜单.yml
GUI文件位于服务端
plugins/GermPlugin/gui文件夹内任意位置 大概实现思路是这样,具体可自行优化
呼出菜单:
options:
startX: "w*0.5"
startY: "h*0.5"
openDos:
- "putPlaceholder`<->`菜单指令@无"
- "putPlaceholder`<->`菜单指令1@无"
closeDos:
- "condition`<->`notStr(%菜单指令%,无)"
- servercmd`<->`%菜单指令%
- servercmd`<->`%菜单指令1%
img1:
type: button
defaultPath: 'url`<->`https://pic.imgdb.cn/item/64aed20a1ddac507ccbde55c.png'
hoverPath: 'url`<->`https://pic.imgdb.cn/item/64aed20a1ddac507ccbde55c.png'
hoverSound: hoverbutton
clickSound: minecraft:ui.button.click
locationX: '-188'
locationY: '-188'
width: 188
height: 188
hoverDos:
- "putPlaceholder`<->`菜单指令@gp model cast %player_name% 劈叉1"
- "putPlaceholder`<->`菜单指令1@gp effect spawn %player_name% 表情1 表情1 %player_name%"
hoverAnimations:
move1:
type: scale
delay: 0
cycle: 1
stay: 0
permanent: true
duration: 100
#缩放中心点偏移的像素
offsetX: "-188/2-20"
offsetY: "-188/2-20"
offsetZ: "0"
#1为默认的大小 这个是根据原始大小与下列的数相乘得来的缩、扩放 from和to 都需>= 0
from: 1
to: 1.2
img2:
type: button
defaultPath: 'url`<->`https://pic.imgdb.cn/item/64aed2791ddac507ccbf5931.png'
hoverPath: 'url`<->`https://pic.imgdb.cn/item/64aed2791ddac507ccbf5931.png'
hoverSound: hoverbutton
clickSound: minecraft:ui.button.click
locationX: '0'
locationY: '-188'
width: 188
height: 188
hoverDos:
- "putPlaceholder`<->`菜单指令@gp model cast %player_name% 俯卧撑"
- "putPlaceholder`<->`菜单指令1@gp effect spawn %player_name% 表情2 表情2 %player_name%"
hoverAnimations:
move1:
type: scale
delay: 0
cycle: 1
stay: 0
permanent: true
duration: 100
#缩放中心点偏移的像素
offsetX: "188/2+20"
offsetY: "-188/2-20"
offsetZ: "0"
#1为默认的大小 这个是根据原始大小与下列的数相乘得来的缩、扩放 from和to都需>= 0
from: 1
to: 1.2
img3:
type: button
defaultPath: 'url`<->`https://pic.imgdb.cn/item/64aed28a1ddac507ccbf9026.png'
hoverPath: 'url`<->`https://pic.imgdb.cn/item/64aed28a1ddac507ccbf9026.png'
hoverSound: hoverbutton
clickSound: minecraft:ui.button.click
locationX: '-188'
locationY: '0'
width: 188
height: 188
hoverDos:
- "putPlaceholder`<->`菜单指令@gp model cast %player_name% 倒立"
- "putPlaceholder`<->`菜单指令1@gp effect spawn %player_name% 表情3 表情3 %player_name%"
hoverAnimations:
move1:
type: scale
delay: 0
cycle: 1
stay: 0
permanent: true
duration: 100
#缩放中心点偏移的像素
offsetX: "-188/2-20"
offsetY: "188/2+20"
offsetZ: "0"
#1为默认的大小 这个是根据原始大小与下列的数相乘得来的缩、扩放 from和to都需>= 0
from: 1
to: 1.2
img4:
type: button
defaultPath: 'url`<->`https://pic.imgdb.cn/item/64aed28a1ddac507ccbf90f0.png'
hoverPath: 'url`<->`https://pic.imgdb.cn/item/64aed28a1ddac507ccbf90f0.png'
hoverSound: hoverbutton
clickSound: minecraft:ui.button.click
locationX: '0'
locationY: '0'
width: 188
height: 188
hoverDos:
- "putPlaceholder`<->`菜单指令@gp model cast %player_name% 仰卧起坐"
- "putPlaceholder`<->`菜单指令1@gp effect spawn %player_name% 表情4 表情4 %player_name%"
hoverAnimations:
move1:
type: scale
delay: 0
cycle: 1
stay: 0
permanent: true
duration: 100
#缩放中心点偏移的像素
offsetX: "188/2+20"
offsetY: "188/2+20"
offsetZ: "0"
#1为默认的大小 这个是根据原始大小与下列的数相乘得来的缩、扩放 from和to都需>= 0
from: 1
to: 1.2