포지

2017-09-23 12 views
0

에 청크 로딩 티켓을 만들 수 없습니다 내가 사용하여 티켓을 시도했다. 내 모드를 실행하려고하면 NullPointerException이 발생합니다.포지

답변

0

이 경우 this.minecraftServer 또는 this.minecraftServer.entityWorldnull입니다.

if 문으로이를 둘러보십시오.

if (this.minecraftServer != null && this.minecraftServer.entityWorld != null){ 
    Ticket ticket = ForgeChunkManager.requestTicket(this, 
                this.minecraftServer.entityWorld, 
                ForgeChunkManager.Type.NORMAL); 
} 

및 디버깅을 목적으로

, 나는 당신이 두 가지 조건에서 분리 제안 :

if (this.minecraftServer == null) { 
    System.out.println("minecraftServer is null"); 
    //or do anything can to warn you 
} else if(this.minecraftServer.entityWorld == null) { 
    System.out.println("entityWorld is null"); 
    //or do anything can to warn you 
} else { 
    Ticket ticket = ForgeChunkManager.requestTicket(this, 
                this.minecraftServer.entityWorld, 
                ForgeChunkManager.Type.NORMAL); 
} 

당신이 값을 확인하기 위해 디버거를 사용할 수 있습니다하지 않는 한.

하지만 전체 코드가 없으면 다른 오류가 있는지 알 수 없습니다.