#pragma once
#include "Mod.h"

class AntiRegen : public Mod {
public:
	int rotations = 0;
	float range = 6.f;
	bool autoblock = true;
	float minplacedelay, maxplacedelay = 0.f;
	AntiRegen() : Mod(_("Anti Regen"), _("Cover near redstones."), Category::COMBAT) {
		settings.push_back(new Setting{ _("Rotations"), &rotations, new int(1), new int(0), 1, {
			_("Normal"),
			_("Silent")
			}, true });

		settings.push_back(new Setting{ _("Range"), &range, new float(10.f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Min Place Delay"), &minplacedelay, new float(100.f), new float(0.f), 2, {}, true, 1.f });
		settings.push_back(new Setting{ _("Max Place Delay"), &maxplacedelay, new float(100.f), new float(0.f), 2, {}, true, 1.f });
		settings.push_back(new Setting{ _("Auto Block"), &autoblock, 0, 0, 0, {}, true });

		enabled = false;
	}

private:
	glm::ivec3 blockpos = glm::ivec3();
	bool placing = false;
	auto canPlace(glm::vec3 pos) -> bool;
	auto buildBlock(glm::vec3 pos, GameMode* gamemode, Player* player, PlayerInventory* playerinventory, Inventory* inventory) -> bool;
	
	auto handlePacket(Packet* packet, Player* arg1) -> void;

	virtual auto onWorldTick(Player* _this) -> void override;
	virtual auto onPacketSendBefore(Packet* packet) -> void override;
	virtual auto onPacketSendAfter2(Packet* packet, bool* cancel) -> void override;
	virtual auto onDisabled() -> void override;
};
