package net.mcreator.puzzle_code.procedures;

import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.Entity;
import net.minecraft.server.level.ServerLevel;

import net.mcreator.puzzle_code.init.PuzzleCodeModGameRules;

public class AdvencedTimeBlockEntityWalksOnTheBlockProcedure {
	public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
		if (entity == null)
			return;
		if (!(entity instanceof Player _plr ? _plr.getAbilities().instabuild : false)
				&& (world.getLevelData().getGameRules().getBoolean(PuzzleCodeModGameRules.BLOCKSAFFECTSYOU) || (entity instanceof Player _plr ? _plr.getAbilities().instabuild : false))) {
			if (world instanceof ServerLevel _level)
				_level.setDayTime((int) GetNBTNumberSystemProcedure.execute(world, x, y, z, "time"));
		}
	}
}
