This commit is contained in:
parent
20131e4879
commit
07a266d928
4
.github/workflows/ci_build_1.21.yml
vendored
4
.github/workflows/ci_build_1.21.yml
vendored
@ -16,7 +16,9 @@ jobs:
|
|||||||
- name: 初始化Gradle
|
- name: 初始化Gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@v4
|
||||||
- name: 构建项目
|
- name: 构建项目
|
||||||
run: ./gradlew build
|
run: |
|
||||||
|
chmod 755 ./gradlew
|
||||||
|
./gradlew build
|
||||||
- name: 上传构建
|
- name: 上传构建
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
@ -11,12 +11,24 @@ public class PlayerListTextLatency {
|
|||||||
public void init(){
|
public void init(){
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
}
|
}
|
||||||
|
private int calcLatencyColor(int latency){
|
||||||
|
if(latency>=0&&latency<=60){ //0-60
|
||||||
|
return 0x00FF00; //绿色
|
||||||
|
}else if(latency>60&&latency<=120){ //60-120
|
||||||
|
return 0xFFFF00; //黄色
|
||||||
|
}else if(latency>120&&latency<=200){//120-200
|
||||||
|
return 0xFFA500; //橙色
|
||||||
|
}else if(latency>200){ //>200
|
||||||
|
return 0xFF0000; //红色
|
||||||
|
}
|
||||||
|
return 0xFFFFFF; //默认白色
|
||||||
|
}
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRenderLatencyIcon(RenderLatencyIconEvent event){
|
public void onRenderLatencyIcon(RenderLatencyIconEvent event){
|
||||||
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
||||||
int latency=Math.clamp(event.entry.getLatency(),0,9999);
|
int latency=Math.clamp(event.entry.getLatency(),0,999);
|
||||||
String text=latency+" ms";
|
String text=latency+" ms";
|
||||||
event.draw.drawTextWithShadow(renderer,text, event.x+event.width-renderer.getWidth(text),event.y,0x00E970);
|
event.draw.drawTextWithShadow(renderer,text, event.x+event.width-renderer.getWidth(text),event.y,calcLatencyColor(latency));
|
||||||
event.callback.cancel();
|
event.callback.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user