52 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.world.level.storage;
 | |
| 
 | |
| import java.util.Locale;
 | |
| import net.minecraft.CrashReportCategory;
 | |
| import net.minecraft.CrashReportDetail;
 | |
| import net.minecraft.core.BlockPos;
 | |
| import net.minecraft.world.Difficulty;
 | |
| import net.minecraft.world.level.LevelHeightAccessor;
 | |
| 
 | |
| public interface LevelData {
 | |
| 	BlockPos getSpawnPos();
 | |
| 
 | |
| 	float getSpawnAngle();
 | |
| 
 | |
| 	long getGameTime();
 | |
| 
 | |
| 	/**
 | |
| 	 * Get current world time
 | |
| 	 */
 | |
| 	long getDayTime();
 | |
| 
 | |
| 	/**
 | |
| 	 * Returns {@code true} if it is thundering, {@code false} otherwise.
 | |
| 	 */
 | |
| 	boolean isThundering();
 | |
| 
 | |
| 	/**
 | |
| 	 * Returns {@code true} if it is raining, {@code false} otherwise.
 | |
| 	 */
 | |
| 	boolean isRaining();
 | |
| 
 | |
| 	/**
 | |
| 	 * Sets whether it is raining or not.
 | |
| 	 */
 | |
| 	void setRaining(boolean raining);
 | |
| 
 | |
| 	/**
 | |
| 	 * Returns {@code true} if hardcore mode is enabled, otherwise {@code false}.
 | |
| 	 */
 | |
| 	boolean isHardcore();
 | |
| 
 | |
| 	Difficulty getDifficulty();
 | |
| 
 | |
| 	boolean isDifficultyLocked();
 | |
| 
 | |
| 	default void fillCrashReportCategory(CrashReportCategory crashReportCategory, LevelHeightAccessor level) {
 | |
| 		crashReportCategory.setDetail("Level spawn location", (CrashReportDetail<String>)(() -> CrashReportCategory.formatLocation(level, this.getSpawnPos())));
 | |
| 		crashReportCategory.setDetail(
 | |
| 			"Level time", (CrashReportDetail<String>)(() -> String.format(Locale.ROOT, "%d game time, %d day time", this.getGameTime(), this.getDayTime()))
 | |
| 		);
 | |
| 	}
 | |
| }
 |