Skip to content

API 與附加模組整合

本文件概述了開發者如何與 速度計 (Speedometer) 互動或參考其註冊模式來建立自訂 F3 除錯條目。


📊 API 摘要資訊框

PropertySpecification
Public Constants Classnet.vanillaoutsider.speedometer.SpeedometerMod
Speedometer IdentifierIdentifier.withDefaultNamespace("speedometer")
原版玩家速度識別碼Identifier.withDefaultNamespace("player_speed")
Custom Entry Interfacenet.minecraft.client.gui.components.debug.DebugScreenEntry

💡 Spy-Wrapper Pattern Reference

java
public class DebugEntryPlayerSpeedWrapper implements DebugScreenEntry {
    private final DebugScreenEntry parent;

    public DebugEntryPlayerSpeedWrapper(DebugScreenEntry parent) {
        this.parent = parent;
    }

    @Override
    public void display(DebugScreenDisplayer displayer, Level level, LevelChunk clientChunk, LevelChunk serverChunk) {
        DebugScreenDisplayer spyDisplayer = new DebugScreenDisplayer() {
            @Override
            public void addLine(String line) {
                displayer.addLine(modifyLine(line));
            }
            
            private String modifyLine(String original) {
                if (original != null && original.startsWith("Speed: ")) {
                    return original + ", custom suffix";
                }
                return original;
            }
        };
        parent.display(spyDisplayer, level, clientChunk, serverChunk);
    }
}

🔗 相關頁面

Official documentation & web portal for Dasik Igaijinn mods.