package studio.halbear.hem.procedures;

import studio.halbear.hem.HemModVariables;
import studio.halbear.hem.HemMod;

import net.minecraft.world.IWorld;
import net.minecraft.entity.Entity;

import java.util.Map;

public class HotAirBalloonOnInitialEntitySpawnProcedure {

	public static void executeProcedure(Map<String, Object> dependencies) {
		if (dependencies.get("world") == null) {
			if (!dependencies.containsKey("world"))
				HemMod.LOGGER.warn("Failed to load dependency world for procedure HotAirBalloonOnInitialEntitySpawn!");
			return;
		}
		if (dependencies.get("entity") == null) {
			if (!dependencies.containsKey("entity"))
				HemMod.LOGGER.warn("Failed to load dependency entity for procedure HotAirBalloonOnInitialEntitySpawn!");
			return;
		}
		IWorld world = (IWorld) dependencies.get("world");
		Entity entity = (Entity) dependencies.get("entity");
		entity.getPersistentData().putDouble("Tick", 20);
		entity.getPersistentData().putDouble("Heat", 0);
		entity.getPersistentData().putDouble("Fuel", 0);
		entity.getPersistentData().putDouble("Pressure", 0);
		entity.getPersistentData().putBoolean("OpenFlame", (false));
		entity.getPersistentData().putDouble("XVel", 0);
		entity.getPersistentData().putDouble("YVel", 0);
		entity.getPersistentData().putDouble("Yaw", (entity.rotationYaw));
		entity.getPersistentData().putDouble("ID", HemModVariables.WorldVariables.get(world).VehicleID);
		HemModVariables.WorldVariables.get(world).VehicleID = (HemModVariables.WorldVariables.get(world).VehicleID + 1);
		HemModVariables.WorldVariables.get(world).syncData(world);
	}
}
