119 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			119 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.world.level.storage;
 | |
| 
 | |
| import java.util.Locale;
 | |
| import java.util.UUID;
 | |
| import net.minecraft.CrashReportCategory;
 | |
| import net.minecraft.CrashReportDetail;
 | |
| import net.minecraft.server.MinecraftServer;
 | |
| import net.minecraft.world.level.GameRules;
 | |
| import net.minecraft.world.level.GameType;
 | |
| import net.minecraft.world.level.LevelHeightAccessor;
 | |
| import net.minecraft.world.level.border.WorldBorder;
 | |
| import net.minecraft.world.level.timers.TimerQueue;
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| public interface ServerLevelData extends WritableLevelData {
 | |
| 	/**
 | |
| 	 * Get current world name
 | |
| 	 */
 | |
| 	String getLevelName();
 | |
| 
 | |
| 	/**
 | |
| 	 * Sets whether it is thundering or not.
 | |
| 	 */
 | |
| 	void setThundering(boolean thundering);
 | |
| 
 | |
| 	/**
 | |
| 	 * Return the number of ticks until rain.
 | |
| 	 */
 | |
| 	int getRainTime();
 | |
| 
 | |
| 	/**
 | |
| 	 * Sets the number of ticks until rain.
 | |
| 	 */
 | |
| 	void setRainTime(int time);
 | |
| 
 | |
| 	/**
 | |
| 	 * Defines the number of ticks until next thunderbolt.
 | |
| 	 */
 | |
| 	void setThunderTime(int time);
 | |
| 
 | |
| 	/**
 | |
| 	 * Returns the number of ticks until next thunderbolt.
 | |
| 	 */
 | |
| 	int getThunderTime();
 | |
| 
 | |
| 	@Override
 | |
| 	default void fillCrashReportCategory(CrashReportCategory crashReportCategory, LevelHeightAccessor level) {
 | |
| 		WritableLevelData.super.fillCrashReportCategory(crashReportCategory, level);
 | |
| 		crashReportCategory.setDetail("Level name", this::getLevelName);
 | |
| 		crashReportCategory.setDetail(
 | |
| 			"Level game mode",
 | |
| 			(CrashReportDetail<String>)(() -> String.format(
 | |
| 				Locale.ROOT,
 | |
| 				"Game mode: %s (ID %d). Hardcore: %b. Commands: %b",
 | |
| 				this.getGameType().getName(),
 | |
| 				this.getGameType().getId(),
 | |
| 				this.isHardcore(),
 | |
| 				this.isAllowCommands()
 | |
| 			))
 | |
| 		);
 | |
| 		crashReportCategory.setDetail(
 | |
| 			"Level weather",
 | |
| 			(CrashReportDetail<String>)(() -> String.format(
 | |
| 				Locale.ROOT, "Rain time: %d (now: %b), thunder time: %d (now: %b)", this.getRainTime(), this.isRaining(), this.getThunderTime(), this.isThundering()
 | |
| 			))
 | |
| 		);
 | |
| 	}
 | |
| 
 | |
| 	int getClearWeatherTime();
 | |
| 
 | |
| 	void setClearWeatherTime(int time);
 | |
| 
 | |
| 	int getWanderingTraderSpawnDelay();
 | |
| 
 | |
| 	void setWanderingTraderSpawnDelay(int delay);
 | |
| 
 | |
| 	int getWanderingTraderSpawnChance();
 | |
| 
 | |
| 	void setWanderingTraderSpawnChance(int chance);
 | |
| 
 | |
| 	@Nullable
 | |
| 	UUID getWanderingTraderId();
 | |
| 
 | |
| 	void setWanderingTraderId(UUID id);
 | |
| 
 | |
| 	/**
 | |
| 	 * Gets the GameType.
 | |
| 	 */
 | |
| 	GameType getGameType();
 | |
| 
 | |
| 	void setWorldBorder(WorldBorder.Settings serializer);
 | |
| 
 | |
| 	WorldBorder.Settings getWorldBorder();
 | |
| 
 | |
| 	/**
 | |
| 	 * Returns {@code true} if the World is initialized.
 | |
| 	 */
 | |
| 	boolean isInitialized();
 | |
| 
 | |
| 	/**
 | |
| 	 * Sets the initialization status of the World.
 | |
| 	 */
 | |
| 	void setInitialized(boolean initialized);
 | |
| 
 | |
| 	boolean isAllowCommands();
 | |
| 
 | |
| 	void setGameType(GameType type);
 | |
| 
 | |
| 	TimerQueue<MinecraftServer> getScheduledEvents();
 | |
| 
 | |
| 	void setGameTime(long time);
 | |
| 
 | |
| 	/**
 | |
| 	 * Set current world time
 | |
| 	 */
 | |
| 	void setDayTime(long time);
 | |
| 
 | |
| 	GameRules getGameRules();
 | |
| }
 |