Skip to content

클라이언트 GameRule 및 GUI 도우미

도우미 클래스실행 환경주요 역할
ClientGameRuleHelper클라이언트 / 통합 서버클라이언트 스레드에서 통합 서버의 GameRule을 안전하게 조회
ConfigHelperCommon (클라이언트/서버 공용)JSON 설정 파일의 로드, 저장 및 원자적 교체
GuiHelper클라이언트ModMenu 및 Cloth Config 화면 구성을 위한 도우미

🖥️ 전용 서버(Dedicated Server) 크래시 방지

전용 서버 실행 시 발생할 수 있는 ClassLoader 예외를 완전히 차단하기 위해, 모든 GUI 도우미는 지연 로드 및 환경 분기 검사(FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT)를 적용합니다.

ascii
                      DynamicGameRuleManager.getInt(level, ruleKey)

                    ┌───────────────────┴───────────────────┐
                    ▼                                       ▼
          [ level instanceof ServerLevel ]       [ Client Environment ]
                    │                                       │
                    ▼                                       ▼
            Direct Level Lookup                   ClientGameRuleHelper
                                             (Queries Integrated Server)

📄 ConfigHelper의 원자적 파일 교체 보호

ConfigHelper는 예기치 않은 게임 강제 종료나 전원 차단 시 설정 파일의 손상을 방지합니다:

  1. 임시 파일 config.json.tmp에 데이터 기록.
  2. JSON 문법 및 파일 크기 검증.
  3. config.json.bak에 안전 백업 복사본 생성.
  4. Files.move(..., StandardCopyOption.ATOMIC_MOVE)를 통해 원자적으로 파일 교체.

🔗 관련 페이지

Official documentation & web portal for Dasik Igaijinn mods.