package me.mrletsplay.advancedinfo.command; import me.mrletsplay.mrcore.command.event.CommandInvokedEvent; import me.mrletsplay.mrcore.fabric.command.FabricCommand; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.world.level.LevelProperties; public class WeatherForecastCommand extends FabricCommand { /* * public static final IntProvider CLEAR_WEATHER_DURATION_PROVIDER = UniformIntProvider.create(12000, 180000); public static final IntProvider RAIN_WEATHER_DURATION_PROVIDER = UniformIntProvider.create(12000, 24000); private static final IntProvider CLEAR_THUNDER_WEATHER_DURATION_PROVIDER = UniformIntProvider.create(12000, 180000); public static final IntProvider THUNDER_WEATHER_DURATION_PROVIDER = UniformIntProvider.create(3600, 15600); */ public WeatherForecastCommand() { super("weatherforecast"); } @Override public void action(CommandInvokedEvent event) { ServerPlayerEntity p = getSenderPlayer(event); if(p == null) { event.getSender().sendMessage("Player only"); return; } ServerWorld world = p.getServerWorld(); LevelProperties props = (LevelProperties) world.getLevelProperties(); int clearTime = props.getClearWeatherTime(); int rainTime = props.getRainTime(); int thunderTime = props.getThunderTime(); if(props.isRaining()) { // say when rain stops // check if thunder happens next }else { // check when next rain starts // check whether thunder is possible, how likely thunder is } event.getSender().sendMessage("§aClear time: §7" + props.getClearWeatherTime() + " §a(~§7" + (props.getClearWeatherTime() / (20*60)) + " §aminutes)"); event.getSender().sendMessage(String.format("§aRaining: §7%s §a(Time left: §7%s §a/ §7%s §aminutes)", props.isRaining(), props.getRainTime(), props.getRainTime() / (20 * 60))); event.getSender().sendMessage(String.format("§aThundering: §7%s §a(Time left: §7%s §a/ §7%s §aminutes)", props.isThundering(), props.getThunderTime(), props.getThunderTime() / (20 * 60))); } }